wxml
<view style="background-color: {{eventcolor}};">
<scroll-view class="box" scroll-y="true">
<view class="acttop" wx:if="{{banner.length>0}}">
<!-- <image mode="widthFix" src="../../images/che.png" style="width:300rpx;"></image> -->
<!-- <view class="banner_img" style="background-image:url({{banner}})" ></view> -->
<image class="big_img" src="{{banner}}"></image>
</view>
<view class="couponbox" wx:if="{{coupon.length>0}}">
<view class="coupontop">
<image mode="widthFix" src="../../images/actxian.png" class="couponimg"></image>
<text class="coupontext">先领券再购买</text>
<image mode="widthFix" src="../../images/actxian.png" class="couponimg"></image>
</view>
<view class="couponbotom" bindtap="ToCoupon">
<scroll-view scrollX="true" style="white-space: nowrap; ">
<view class="couponimgbox" wx:for="{{coupon}}">
<view class="couponimgtextpricex">
<text>¥</text>{{item.reducemoney}}
</view>
<view class="couponimgtext" bindtap="ToCoupon">
满<text>¥</text>{{item.needmoney}}减<text>¥</text>{{item.reducemoney}}
</view>
<image mode="widthFix" src="../../images/acoupon.png" class="couponimage" bindtap="ToCoupon" data-item="{{item}}"></image>
<image wx:if="{{item.collar}}" src="/images/coupon_received.png" class="coupon_img" ></image>
</view>
</scroll-view>
</view>
</view>
<view class="special">
<view class="coupontop">
<image mode="widthFix" src="../../images/actxian.png" class="couponimg"></image>
<text class="coupontext">特价专区</text>
<image mode="widthFix" src="../../images/actxian.png" class="couponimg"></image>
</view>
<view class="special" wx:if="{{tejiagoods.length>0}}">
<view class="specialbox" wx:for="{{tejiagoods}}">
<view class="specialboxleft" bindtap="goodsDetail" data='{{item}}' data-item="{{item}}">
<image mode="widthFix" src="{{item.goods_image}}" style="width:175rpx;height:160rpx;"></image>
<!-- <view class="skubox">2000g-3000g</view> -->
</view>
<view class="specialboxright" bindtap="goodsDetail" data-item="{{item}}">
<view class="text_top" data-id='{{item.id}}' data-store_id="{{item.storeid}}">
<view class="text_top_name">{{item.goods_name}}</view>
<!-- <view class="text_top_time">限时抢</view> -->
</view>
<view class="text_bottom" bindtap="goodsDetail" data-item="{{item}}">
<view class="text_bottom_price">
<view style="height: 30rpx;">
<span class="symbol">¥</span>
<text class="price_num">{{item.online_price}}</text>
</view>
<view style="height: 30rpx;">
<!-- <text class="price_old">¥50{{item.online_price}}</text> -->
</view>
<view class="btn_use" data-index="{{index}}" data-item="{{item}}" bindtap="addToCar">
加入购物车
</view>
</view>
</view>
</view>
</view>
</view>
<view wx:else>
<view class="error">
<image class="errorimg" src="/images/nogoods.jpg"></image>
</view>
</view>
</view>
<view class="rush">
<view class="coupontop">
<image mode="widthFix" src="../../images/actxian.png" class="couponimg"></image>
<text class="coupontext">过节疯狂购</text>
<image mode="widthFix" src="../../images/actxian.png" class="couponimg"></image>
</view>
<view class="rush" wx:if="{{huodonggoods.length>0}}">
<view class="rushbox" wx:for="{{huodonggoods}}" >
<view class="rushboxleft" bindtap="goodsDetail" data='{{item}}' data-item="{{item}}">
<image src="{{item.goods_image}}" style="width:350rpx; height: 200rpx;"></image>
</view>
<view class="rushboxright" bindtap="goodsDetail" data='{{item}}' data-item="{{item}}">
<view class="text_top" data-id='{{item.id}}' data-store_id="{{item.storeid}}">
<view class="text_top_rushname">{{item.goods_name}}</view>
</view>
<view class="rushrbox">
<!-- <view class="rushskubox">2000g-3000g</view> -->
<view class="text_bottom" bindtap="goodsDetail" data='{{item}}' data-item="{{item}}">
<view class="text_bottom_price" style=" position: absolute; right:20rpx;">
<view style="height: 30rpx;">
<span class="symbol">¥</span>
<text class="price_rushnum">{{item.online_price}}</text>
</view>
<view style="height: 30rpx;" bindtap="goodsDetail" data='{{item}}' data-item="{{item}}">
<!-- <text class="price_rushold">¥{{item.online_price}}</text> -->
</view>
<view class="btn_use" style=" position: absolute; right:0rpx;" data-index="{{index}}" data-item="{{item}}" bindtap="addToCar">
加入购物车
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view wx:else>
<view class="error">
<image class="errorimg" src="/images/nogoods.jpg"></image>
</view>
</view>
</view>
</scroll-view>
</view>
<!--
<view class="cu-modal {{showJiagong?'show':''}}">
<view class="cus-dialog">
<view style='overflow:hideen;width:70rpx;margin:0 auto;padding-bottom:20rpx;'>
<view class='just'></view>
<view class='just'></view>
<view class='just'></view>
</view>
<view style='padding:20rpx;'>
<view class="cu-bar bg-white justify-end">
<view class="contents">友情提示</view>
</view>
<view class="padding-xl" style='letter-spacing:8rpx;padding:10rpx;'>
本菜品可以加工成成品菜,请选择是否加工?
</view>
<view style='overflow:hidden;'>
<view class="btn-mac">
<view bindtap="machining" class="btn-cont" data-target="yes">加工</view>
</view>
<view class="btn-mac">
<view bindtap="unprocessed" class="btn-no_cont" data-target="no">不加工</view>
</view>
</view>
</view>
</view>
</view>
<view class="rule_text_big" hidden="{{show}}" bindtap="hidden">
<view class="rule_text_small" catchtap="default">
<view class="rule_text_small_top">
<view>活动规则</view>
<image style="width:45rpx;height:45rpx;" src="/images/pass_cha.png" catchtap="hidden"></image>
</view>
<view class="rule_text_small_content">
<view>
1、所有参加本次活动的卖家,必须设置跨店满减。例:满减档位有每满60减25、每满200减50。
</view>
<view>
2、部分商品订单火爆,可能会导致区域库存不足,部分商品会显示“抢光了”状态。若商品补货到位,我们会争取第一时间更新状态,感谢谅解!
</view>
<view>
3、部分商品由于库存原因进行限购,具体信息以界面展示为准,感谢谅解!
</view>
</view>
</view>
</view> -->
css
/* pages/Fullreduction/Fullreduction.wxss */page {
background: rgb(245, 245, 245);
}
.img_top {
width: 100%;
height: 240rpx;
position: fixed;
left: 0;
top: 0;
z-index: -1;
}
.nocoupon {
display: flex;
background: rgb(255,73,61);
justify-content: space-between;
padding: 20rpx 130rpx;
}
.mar {
width: 100rpx;
height: 75rpx;
justify-content: center;
text-align: center;
color: rgb(219, 215, 215);
font-size: 35rpx;
font-weight: 600;
}
.mar>text {
display: flex;
font-size: 20rpx;
justify-content: center;
padding: 0 auto;
}
.active {
color: #fff;
}
.active>text {
color: #f00;
background: #fff;
border-radius: 20rpx;
}
.rule {
background: #fff;
width: 91.5%;
/* border: 1px solid #f00; */
border-radius: 5rpx;
margin: 10rpx;
padding: 20rpx;
}
.rule_top {
display: flex;
}
.timer {
display: flex;
font-size: 25rpx;
margin: 0 auto;
padding: 5rpx 10rpx;
align-items: center;
color: #f00;
}
.timer>view {
font-weight: bold;
color: #000;
}
.timer>text {
background: #f00;
padding: 3rpx 8rpx;
border-radius: 10rpx;
color: #fff;
margin: 0 10rpx;
}
.rule_right {
position: absolute;
font-size: 25rpx;
width: 60rpx;
padding: 5rpx 10rpx;
background: rgb(237, 237, 237);
border-radius: 50rpx 0 0 50rpx;
right: 15rpx;
top: 30rpx;
}
.rule_bottom {
font-size: 25rpx;
color: #f00;
text-align: center;
font-weight: 500;
}
.goodList {
display: flex;
background: #fff;
border-radius: 5rpx;
margin: 10rpx;
padding: 10rpx;
}
.goodList>image {
width: 200rpx;
height: 200rpx;
}
.goodlist_text {
width: 65%;
padding: 0 20rpx;
}
.text_top_name {
margin-top: 10rpx;
height: 60rpx;
font-size: 24rpx;
font-weight: 700;
}
.text_top_rushname {
margin-top: 20rpx;
height: 80rpx;
font-size: 26rpx;
font-weight: 700;
}
.text_top_time {
font-size: 20rpx;
width: 40%;
padding: 5rpx;
border-radius: 10rpx;
text-align: center;
color: rgb(240, 142, 141);
background: rgb(255, 241, 240);
}
.banner_img {
width: 100%;
height: 100%;
background-size: 100% 100%;
-moz-background-size: 100% 100%;
background-color: #ccc;
}
.text_bottom {
/* margin-top: 25rpx; */
}
.text_bottom_time {
position: relative;
top: 20rpx;
width: 75rpx;
border: 1px solid #f00;
border-radius: 5rpx;
font-size: 21rpx;
text-align: center;
color: #f00;
}
.symbol {
font-size: 26rpx;
color: #f00;
}
.text_bottom_price {
/* display: flex; */
/* justify-content: space-between; */
/* align-items: center; */
/* margin-top: 27rpx; */
height: 30rpx;
}
.price_num {
color: #f00;
font-size: 31rpx;
font-weight: bold;
}
.price_rushnum {
color: #f00;
font-size: 38rpx;
font-weight: bold;
}
.price_old {
font-size: 22rpx;
color: rgb(178, 178, 178);
text-decoration: line-through;
}
.price_rushold {
font-size: 26rpx;
color: rgb(178, 178, 178);
text-decoration: line-through;
}
.rob {
width: 150rpx;
height: 60rpx;
}
.rob_text_one {
position: relative;
left: 90rpx;
font-size: 28rpx;
}
.rob_text_two {
font-size: 25rpx;
color: rgb(116, 116, 116);
}
.rob_text_one>text {
right: 130rpx;
bottom: 20rpx;
position: relative;
width: 100rpx;
color: #fff;
}
.img_text {
display: flex;
width: 200rpx;
height: 200rpx;
align-items: center;
justify-content: center;
}
.img_text>text {
width: 130rpx;
font-size: 25rpx;
text-align: center;
background-color: rgba(122, 130, 109, 0.7);
border-radius: 30rpx;
color: #fff;
}
.box {
/* background-color: #d53037; */
width: 100vw;
/* height: 100rpx; */
height: calc( 100vh - 0rpx );
}
.rule_text_big{
position: absolute;
top: 0;
width: 100%;
height: 100%;
background: rgba(98,98,98,0.5);
}
.rule_text_small{
position: absolute;
height: 65%;
background: #fff;
bottom: 0;
border-radius: 20rpx 20rpx 0 0;
}
.rule_text_small_top{
height: 100rpx;
width: 100%;
border-bottom: 1px solid #ccc;
}
.rule_text_small_top>view{
font-size: 30rpx;
font-weight: 700;
font-family: "微软雅黑";
width: 100%;
height: 100rpx;
line-height: 100rpx;
text-align:center;
}
.rule_text_small_top>image{
position: relative;
left: 690rpx;
bottom: 72rpx;
}
.rule_text_small_content{
padding: 30rpx;
font-size: 26rpx;
}
.cu-modal.show {
opacity: 1;
transition-duration: 0.3s;
-ms-transform: scale(1);
transform: scale(1);
overflow-x: hidden;
overflow-y: auto;
pointer-events: auto;
}
.cu-modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1110;
opacity: 0;
outline: 0;
text-align: center;
-ms-transform: scale(1.185);
transform: scale(1.185);
backface-visibility: hidden;
perspective: 2000rpx;
background: rgba(0, 0, 0, 0.4);
transition: all 0.3s ease-in-out 0s;
pointer-events: none;
}
.cu-dialog {
position: relative;
display: inline-block;
vertical-align: middle;
margin-left: auto;
margin-right: auto;
width: 680rpx;
max-width: 100%;
background-color: #f8f8f8;
border-radius: 10rpx;
overflow: hidden;
}
bg-white {
background-color: var(--white);
color: var(--darkGray);
}
.justify-end {
justify-content: flex-end;
}
.contents {
color: red;
font-weight: bold;
padding-bottom: 10rpx;
}
.cus-dialog {
position: fixed;
vertical-align: middle;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 550rpx;
max-width: 100%;
background-color: #f8f8f8;
border-radius: 10rpx;
overflow: hidden;
border: 1px solid #d53037;
}
.btn-mac {
width: 40%;
float: left;
padding: 25rpx;
}
.btn-cont {
background-color: #d53037;
border: 1px solid #ccc;
color: #fff;
font-size: 28rpx;
padding: 10rpx;
border-radius: 10rpx;
letter-spacing: 6rpx;
font-weight: bold;
}
.btn-no_cont {
border: 1px solid #ccc;
font-size: 28rpx;
padding: 10rpx;
border-radius: 10rpx;
letter-spacing: 6rpx;
color: #d53037;
font-weight: bold;
}
.just {
float: left;
width: 15rpx;
height: 15rpx;
background-color: #d53037;
margin: 0 auto;
margin-left: 8rpx;
}
.acttop{
background-color: #fff;
height: 25%;
width: 100%;
}
.couponbox{
/* margin-top: 20rpx; */
/* background-color: #96fbc4; */
height: 18%;
width: 100%;
}
.coupontop{
margin-top: 10rpx;
display: flex;
justify-content: center;
height: 48rpx;
width: 100%;
}
.coupontext{
height: 44rpx;
width: 30%;
box-shadow: 0 0 10rpx #e2e2e2;
margin: 0 10rpx 0 10rpx;
background-color: rgb(149,9, 25);
border-radius: 20rpx;
color: #fff;
font-size: 22rpx;
text-align: center;
line-height: 48rpx;
/* margin-top: 16rpx; */
/* float: right; */
}
.couponimg{
/* font-size: 40rpx; */
/* font-weight: 600; */
height: 48rpx;
width: 130rpx;
margin-top: 18rpx;
}
.couponimage{
margin: 10rpx 10rpx 10rpx 10rpx;
width: 100px;
z-index: -1;
position: absolute;
top: 0;
left: 0;
}
.couponimgtext{
margin-top: 10rpx;
font-size: 20rpx;
text-align: center;
z-index: 1;
}
.couponimgtext>text {
content: '¥';
color: #000000;
font-size: 16rpx;
}
.couponimgtextpricex {
margin-top: 10rpx;
font-size: 30rpx;
font-weight: 700;
line-height: 26rpx;
text-align: center;
margin-top: 24rpx;
color: #000000;
}
.couponimgtextpricex>text {
content: '¥';
color: #000000;
font-size: 20rpx;
}
.couponbotom{
/* background-color: #fff; */
display: flex;
/* justify-content: center; */
width: 100%;
height: 80%;
}
.couponimgbox{
/* background-color: #fff; */
margin-top: 10rpx;
display: inline-block;
width:110px;
height: 80%;
position: relative;
z-index: 1;
}
.coupon_img{
position: absolute;
top: 11rpx;
left: 15rpx;
width: 85rpx;
height: 70rpx;
z-index: -1;
}
/* 特价专区 */
.special{
display: flex;
/* justify-content: space-between; */
/* height: 500rpx; */
flex-wrap: wrap;
width: 100%;
/* background-color: blue */
}
.specialbox{
border-radius: 10rpx;
display: flex;
width: 48%;
height: 220rpx;
background-color: #fff;
margin: 10rpx 0rpx 10rpx 10rpx;
}
.specialboxleft{
margin: 10rpx 0rpx 0rpx 5rpx;
height: 180rpx;
}
.specialboxright{
margin: 10rpx 0 0 5rpx;
height: 180rpx;
}
/* 加入购物车按钮 */
.btn_use {
margin: 0 auto;
width: 170rpx;
height: 34rpx;
background-color: #FF3C50;
border-radius: 11rpx;
color: #fff;
font-size: 22rpx;
text-align: center;
line-height: 34rpx;
margin-top: 1rpx;
margin-bottom: 25rpx;
}
.skubox{
position: relative;
top: 20rpx;
width: 140rpx;
border: 1px solid #f00;
border-radius: 5rpx;
font-size: 18rpx;
text-align: center;
color: #f00;
}
/* 过节疯狂购 */
.rush{
display: flex;
flex-wrap: wrap;
width: 100%;
}
.rushbox{
display: flex;
border-radius: 10rpx;
margin-top: 10rpx;
margin: 10rpx 10rpx 0rpx 10rpx;
width: 100%;
height:220rpx;
background-color: #fff;
}
.rushboxleft{
/* background-color: #d53037; */
margin: 10rpx 0rpx 0rpx 10rpx;
width:350rpx;
height: 200rpx;
}
.rushboxright{
/* background-color: #6836dd; */
margin: 10rpx 0rpx 0rpx 10rpx;
width:350rpx;
height: 200rpx;
}
.rushrbox{
display: flex;
height:150rpx;
/* background-color: #96fbc4; */
}
.rushskubox{
position: relative;
top: 20rpx;
width: 140rpx;
/* border: 1px solid #f00; */
border-radius: 5rpx;
font-size: 18rpx;
text-align: center;
color: rgb(0, 0, 0);
}
.big_img{
/* background-color: #f00; */
width: 100%;
height: 100%;
}
.error{
margin: 10rpx 10rpx 10rpx 10rpx;
border-radius: 20rpx;
width: 98%;
background-color: #ffff;
}
.errorimg{
align-items: center;
margin:20rpx 200rpx;
height: 320rpx;
width: 320rpx;
}
js
// pages/more/more.js
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
coupon: [],
activeindex: 1,
goods_list: [],
show: true,
selectSkuDetailId: '',
shoppingNum: '',
showJiagong: false,
endtime: '',
huodonggoods: [],
banner: [],
tejiagoods: [],
eventcolor: [],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
var that = this;
wx.setNavigationBarTitle({
title: options.title
});
that.getFullreduction(options.id);
that.getcoupon();
},
show() {
this.setData({
show: false
})
},
hidden() {
this.setData({
show: true
})
},
showJiagong(e) {
this.setData({
showJiagong: true,
showSelectSku: false,
});
},
hidesJiagong(e) {
this.setData({
showJiagong: false
})
},
default () {
return false;
},
// 获取优惠券
getcoupon() {
var t = this;
// n = this.data.activeindex;
app.sendRequest({
url: "/Notice/coupons/coupons",
type: "post",
data: {},
success: function (b) {
if (1 == b.status) {
t.setData({
coupon: b.data
});
} else t.setData({
coupon: null
});
}
});
},
// 获取商品
getFullreduction(n) {
var t = this;
// n = this.data.activeindex;
app.sendRequest({
url: "/Notice/event_activity",
type: "post",
data: {
id: n,
},
success(res) {
t.setData({
huodonggoods: res.data.huodong_goods,
banner: res.data.cover,
tejiagoods: res.data.tejia_goods,
goods_list: res.data,
eventcolor: res.data.event_color,
})
}
})
},
// 跳转到商品详情
goodsDetail: function (a) {
var id = a.currentTarget.dataset.item.goods_id;
var store_id = a.currentTarget.dataset.item.store_id;
app.XcxData.store_id = store_id
wx.navigateTo({
url: "/pages/details/details?id=" + id
});
},
//获取商品规格
getGoodsSku: function (e) {
var t = this,
goods_id = e.goods_id,
store_id = e.store_id;
wx.showLoading({
title: "加载中...",
mask: !0
}), app.sendRequest({
url: "/Shopping/getGoodsSku_v1",
type: "post",
data: {
goods_id: goods_id,
store_id: store_id
},
success: function (r) {
if (r.status == 1) {
// console.log('加工');
} else {
// console.log('不加工');
var a = {
menuid: 0,
machtype: 0,
goods_id: goods_id,
store_id: store_id,
type: 1,
num: this.data.shoppingNum,
sku_id: this.data.selectSkuDetailId,
change_state: 1
}
t.toAddCar(a);
}
}
});
},
//添加购物车
toAddCar(e) {
// return
var a = this;
e.change_state = 1, app.sendRequest({
url: "/Shopping/addShopping_v1",
type: "post",
data: e,
loadingTitle: "正在添加...",
success: function (t) {
// console.log(t);
wx.showToast({
title: t.msg,
icon: "none",
duration: 2e3,
mask: !0
});
}
});
},
// 领取优惠券
//跳转页面
ToCoupon() {
wx.navigateTo({
url: '/pages/Coupon/Coupon',
})
},
//查看是否加工
addToCar: function (g) {
var that = this;
var goods = g.currentTarget.dataset.item;
app.sendRequest({
url: "/NewGoods/getmachining",
type: "post",
data: {
id: goods.id,
},
success: function (res) {
// return
if ((1 == res.status) && (res.data != '')) {
var menus = res.data;
} else {
var menus = '';
}
that.setData({
machtype: '',
menuid: '',
menus: menus
})
if (2 == goods.attribute_state) {
var e = {
goods_id: goods.goods_id,
store_id: goods.store_id
}
that.getGoodsSku(e);
} else {
if (menus) {
that.setData({
shoppingNum: 1,
selectSkuDetailId: "",
goods_id: goods.goods_id,
store_id: goods.store_id
})
that.showJiagong();
} else {
var e = {
goods_id: goods.goods_id,
num: 1,
store_id: goods.store_id,
change_state: 1
};
that.toAddCar(e);
}
}
}
});
},
//加工
machining() {
wx.navigateTo({
url: '/pages/food/food?goods_id=' + this.data.goods_id + '&num=' + this.data.shoppingNum + '&sku_id=' + this.data.selectSkuDetailId + '&store_id=' + this.data.store_id + '&machtype=1&menuid=0'
})
this.hidesJiagong();
},
//不加工
unprocessed() {
this.toAddCar({
menuid: 0,
machtype: 0,
goods_id: this.data.goods_id,
store_id: this.data.store_id,
num: this.data.shoppingNum,
sku_id: this.data.selectSkuDetailId
});
this.hidesJiagong();
},
mjDetail(e) {
var id = e.currentTarget.dataset.id;
var store_id = e.currentTarget.dataset.store_id;
wx.navigateTo({
url: "/pages/details/details?id=" + id + '&store_id=' + store_id
});
},
similar(e) {
console.log('找相似');
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
json
{
"usingComponents": {}
}