-
Status changed to merged
-
mentioned in commit ec18a591fc522474c8a012ea36abb75810431cfc
-
2. 优惠平摊的订单不能单个商品退
Showing
32 changed files
app.json
... | ... | @@ -85,12 +85,17 @@ |
85 | 85 | "pages/video/index", |
86 | 86 | "pages/template/index", |
87 | 87 | "pages/store/index" |
88 | - ], | |
88 | + | |
89 | + ], | |
89 | 90 | |
90 | 91 | "subPackages": [{ |
91 | 92 | "root": "packageA/", |
92 | 93 | "name":"pack1", |
93 | - "pages": ["pages/prom_list/prom_list"] | |
94 | + "pages": [ | |
95 | + "pages/prom_list/prom_list", | |
96 | + "pages/quan_list/quan_list", | |
97 | + "pages/quan_pro/quan_pro" | |
98 | + ] | |
94 | 99 | }], |
95 | 100 | |
96 | 101 | "permission": { | ... | ... |
app.wxss
packageA/pages/quan_list/filter.wxs
0 → 100644
1 | +var is_has = function (text,val) { | |
2 | + if(text.indexOf(","+val+",")==-1) return false; | |
3 | + return true | |
4 | +} | |
5 | + | |
6 | +function get_guige(color,spece){ | |
7 | + if(color=="" && spece==""){return "规格1"} | |
8 | + if(spece!="" && color==""){return spece} | |
9 | + if(spece=="" && color!=""){return color} | |
10 | + if(spece!="" && color!=""){return spece+"/"+color} | |
11 | + return ""; | |
12 | +} | |
13 | + | |
14 | +function get_color(index){ | |
15 | + var i=index%3; | |
16 | + switch(i){ | |
17 | + case 0: return "red"; | |
18 | + case 1: return "blue"; | |
19 | + case 2: return "purple"; | |
20 | + } | |
21 | +} | |
22 | + | |
23 | +module.exports = { | |
24 | + is_has: is_has, | |
25 | + get_guige:get_guige, | |
26 | + get_color:get_color | |
27 | +} | ... | ... |
packageA/pages/quan_list/g_filter.wxs
0 → 100644
1 | +var g_filters = { | |
2 | + //-- 判断是不是有等级价 -- | |
3 | + is_has_rank:function(rank_switch,item){ | |
4 | + if(!rank_switch) return false; | |
5 | + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true} | |
6 | + return false; | |
7 | + }, | |
8 | + | |
9 | + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- | |
10 | + get_card_price:function(goods,all_card,type){ | |
11 | + var price1=parseFloat(goods['cardprice1']); | |
12 | + var price2=parseFloat(goods['cardprice2']); | |
13 | + var price3=parseFloat(goods['cardprice3']); | |
14 | + if(!all_card){ | |
15 | + if(type==0) return 0; | |
16 | + return ""; | |
17 | + } | |
18 | + | |
19 | + var arr=[]; | |
20 | + var min_price= 0; | |
21 | + var min_name=""; | |
22 | + | |
23 | + var min_price=null; | |
24 | + var min_name=null; | |
25 | + //---设置对应的价格名字---- | |
26 | + for(var i=0;i<3;i++) { | |
27 | + var vl=all_card[i]; | |
28 | + if(!vl) continue; | |
29 | + if(vl['CorrPrice']=="Price1" && price1>0) | |
30 | + { | |
31 | + if(min_price==null) { | |
32 | + min_price=price1;min_name=vl['CardName']; | |
33 | + } | |
34 | + else if(price1<min_price) { | |
35 | + min_price=price1;min_name=vl['CardName']; | |
36 | + } | |
37 | + } | |
38 | + if(vl['CorrPrice']=="Price2" && price2>0) | |
39 | + { | |
40 | + if(min_price==null) { | |
41 | + min_price=price2;min_name=vl['CardName']; | |
42 | + } | |
43 | + else if(price2<min_price) { | |
44 | + min_price=price2;min_name=vl['CardName']; | |
45 | + } | |
46 | + } | |
47 | + | |
48 | + if(vl['CorrPrice']=="Price3" && price3>0) | |
49 | + { | |
50 | + if(min_price==null) { | |
51 | + min_price=price3;min_name=vl['CardName']; | |
52 | + } | |
53 | + else if(price3<min_price) { | |
54 | + min_price=price3;min_name=vl['CardName']; | |
55 | + } | |
56 | + } | |
57 | + | |
58 | + } | |
59 | + if(min_price==null){ | |
60 | + if(type==0) return 0; | |
61 | + return ""; | |
62 | + } | |
63 | + | |
64 | + //if(type==0) return arr.length; | |
65 | + //--进行排序,升序--- | |
66 | + /*--- | |
67 | + arr.sort(function(a,b){ | |
68 | + if (a.price < b.price) { | |
69 | + return -1; | |
70 | + } else if (a.fee == b.fee) { | |
71 | + return 0; | |
72 | + } else { | |
73 | + return 1; | |
74 | + } | |
75 | + })--*/ | |
76 | + //-- 获取最下价钱,和相应的卡的名称 -- | |
77 | + //min_price=min.price; | |
78 | + //min_name=min.name; | |
79 | + if(type==0) return min_price.toFixed(2); | |
80 | + if(min_name.length>4 ) min_name=min_name.substring(0, 4); | |
81 | + return min_name; | |
82 | + }, | |
83 | +} | |
84 | +module.exports = { | |
85 | + is_has_rank:g_filters.is_has_rank, | |
86 | + get_card_price:g_filters.get_card_price, | |
87 | +} | |
0 | 88 | \ No newline at end of file | ... | ... |
packageA/pages/quan_list/quan_list.js
0 → 100644
1 | +var t = require("../../../utils/util.js"), ut = t, | |
2 | + e = require("../../../utils/common.js"), | |
3 | + oo = getApp().globalData, | |
4 | + os = getApp().globalData.setting; | |
5 | +var utils = require('../../../utils/util.js'),ut=utils; | |
6 | + | |
7 | + | |
8 | + | |
9 | +Page({ | |
10 | + data: { | |
11 | + stoid: os.stoid, | |
12 | + url: os.url, | |
13 | + resourceUrl: os.resourceUrl, | |
14 | + iurl: os.imghost, | |
15 | + defaultAvatar: os.resourceUrl + "/static/images/user68.jpg", | |
16 | + dataList: null, | |
17 | + config2:null, | |
18 | + curpage:1, | |
19 | + loading:0, | |
20 | + get_item:null, | |
21 | + show_success:0, | |
22 | + }, | |
23 | + //------初始化加载---------- | |
24 | + onLoad: function(t) { | |
25 | + var th=this; | |
26 | + getApp().getConfig2(function (conf) { | |
27 | + conf.couponset=conf.couponset.replace(/\<img/g,'<img style="width:100%;height:auto;display:block"'); | |
28 | + th.setData({config2:conf}); | |
29 | + }) | |
30 | + }, | |
31 | + //---展示--- | |
32 | + onShow: function() { | |
33 | + this.data.curpage=1; | |
34 | + this.setData({dataList:null}); | |
35 | + this.get_quan_list(); | |
36 | + //券的模拟数据 | |
37 | + //var data = [{ is_get:0,money:50,condition:500,id:1,name: "券名字", endtype: 0, use_start_time: 1579596090, use_end_time: 1611218490, everyone_num: 2,interval_time:1,color:"red"}]; | |
38 | + //th.setData({dataList: data}); | |
39 | + }, | |
40 | + | |
41 | + onHide: function() { | |
42 | + | |
43 | + }, | |
44 | + | |
45 | + //--券的列表页面的函数-- | |
46 | + get_quan_list:function(){ | |
47 | + var th=this; | |
48 | + if(th.data.loading) return false; | |
49 | + th.data.loading=1; | |
50 | + var user_id=getApp().globalData.user_id; | |
51 | + getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | |
52 | + data:{store_id:os.stoid,type:1,pageSize:10,page:th.data.curpage,user_id:user_id} | |
53 | + }).then(res => { | |
54 | + th.data.loading=0; | |
55 | + if(res.data.code==0){ | |
56 | + if(!th.data.dataList) th.data.dataList=new Array(); | |
57 | + th.data.dataList=th.data.dataList.concat(res.data.data.pageData); | |
58 | + th.data.curpage++; | |
59 | + th.setData({dataList:th.data.dataList}); | |
60 | + } | |
61 | + }); | |
62 | + }, | |
63 | + | |
64 | + //---加载更多是靠这个函数---- | |
65 | + onReachBottom: function() { | |
66 | + this.get_quan_list(); | |
67 | + }, | |
68 | + | |
69 | + | |
70 | + //--滚动到顶部-- | |
71 | + doScrollTop: function() { | |
72 | + wx.pageScrollTo({ scrollTop: 0 }); | |
73 | + }, | |
74 | + | |
75 | + //-----领取券----- | |
76 | + get_quan: function(e) { | |
77 | + var cid = e.currentTarget.dataset.cid; | |
78 | + var index = e.currentTarget.dataset.ind; | |
79 | + var item = this.data.dataList[index]; | |
80 | + | |
81 | + //--先判断会员状态-- | |
82 | + var user_info = getApp().globalData.userInfo; | |
83 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
84 | + wx.navigateTo({ | |
85 | + url: '/pages/getphone/getphone', | |
86 | + }) | |
87 | + return false; | |
88 | + } | |
89 | + | |
90 | + //如果券还在领取中,不能再点 | |
91 | + if (item.linging == 1) { | |
92 | + getApp().my_warnning('领取中..', 0, this); | |
93 | + return false; | |
94 | + } | |
95 | + | |
96 | + //如果领取的次数到了 | |
97 | + if (item.everyone_num > 0 && item.lqnum >= item.everyone_num) { | |
98 | + getApp().my_warnning('领取失败,您已领完该券', 0, this); | |
99 | + return false; | |
100 | + } | |
101 | + var lq_num = item.lqnum; | |
102 | + var pdata = { | |
103 | + 'uid': oo.user_id, | |
104 | + 'cid': cid, | |
105 | + 'store_id': os.stoid, | |
106 | + 'type': 5 | |
107 | + }; | |
108 | + var app = getApp(), | |
109 | + th = this; | |
110 | + app.request.post("/api/weshop/couponList/saveCouponList", { | |
111 | + data: pdata, | |
112 | + success: function(res) { | |
113 | + if (res.data.code == 0) { | |
114 | + var text = "dataList[" + index + "].is_get"; | |
115 | + var text2 = "dataList[" + index + "].linging"; | |
116 | + var text3 = "get_item"; | |
117 | + var obj = {};obj[text] = 1; obj[text2] = 0;obj[text3] = item;obj['show_success']=1; | |
118 | + th.setData(obj); | |
119 | + } else { | |
120 | + app.confirmBox(res.data.msg); | |
121 | + var text2 = "dataList[" + index + "].linging"; | |
122 | + th.setData({[text2]:0}); | |
123 | + } | |
124 | + } | |
125 | + }) | |
126 | + }, | |
127 | + close_show:function () { | |
128 | + this.setData({show_success:0,get_item:null}) | |
129 | + }, | |
130 | + go_quan:function () { | |
131 | + getApp().goto("/pages/user/coupons/coupons"); | |
132 | + }, | |
133 | + go_detail:function (e) { | |
134 | + var index=e.currentTarget.dataset.ind; | |
135 | + var item=this.data.dataList[index]; | |
136 | + getApp().goto("/packageA/pages/quan_pro/quan_pro?id="+item.id); | |
137 | + } | |
138 | + | |
139 | + | |
140 | +}); | ... | ... |
packageA/pages/quan_list/quan_list.json
0 → 100644
packageA/pages/quan_list/quan_list.wxml
0 → 100644
1 | +<wxs module="filters" src="../../../utils/filter.wxs"></wxs> | |
2 | +<wxs module="g_filters" src="g_filter.wxs"></wxs> | |
3 | +<wxs module="tool" src="filter.wxs"></wxs> | |
4 | + | |
5 | +<view class="header"> | |
6 | + <rich-text nodes="{{config2.couponset}}" class="r_txt fs26"></rich-text> | |
7 | +</view> | |
8 | +<view class="content"> | |
9 | + <view bindtap="go_detail" data-ind="{{index}}" class="quan_item flex fs30" wx:for="{{dataList}}"> | |
10 | + <!-- 左边 --> | |
11 | + <view class="left {{tool.get_color(index)}} flex ai-center jc-center co-w"> | |
12 | + <view class="t-c"> | |
13 | + <view class="fs40"><text class="fs24">¥</text>{{filters.toFix(item.money,2)}}</view> | |
14 | + <view>满{{filters.toFix(item.condition,2)}}可用</view> | |
15 | + </view> | |
16 | + </view> | |
17 | + <!-- 右边 --> | |
18 | + <view class="right fs24 co_g pding" style="background-image:url({{iurl}}/miniapp/images/coupon_img/white.png); position: relative"> | |
19 | + <view class="fs28 co_b" style="margin-top: 15rpx">{{item.name}}</view> | |
20 | + <view style="margin-top: 5rpx">所有门店通用</view> | |
21 | + <view wx:if="{{item.endtype==0}}">有效期 | |
22 | + <text wx:if="{{item.use_start_time>0}}"> {{filters.format_time(item.use_start_time)}}</text>至 | |
23 | + <text wx:if="{{item.use_start_time>0}}"> {{filters.format_time(item.use_end_time)}}</text><text wx:else>不限</text> | |
24 | + </view> | |
25 | + <view wx:else>有效期<text wx:if="{{item.days>0}}">{{item.days}}天</text><text wx:else>不限</text></view> | |
26 | + <view>每人限领:<text wx:if="{{item.everyone_num>0}}">{{item.everyone_num}}</text><text wx:else>不限</text></view> | |
27 | + <!-- 领取按钮 --> | |
28 | + <view data-ind="{{index}}" data-cid="{{item.id}}" catchtap="get_quan"> | |
29 | + <view wx:if="{{item.everyone_num>0 && item.lqnum>=item.everyone_num}}" class="btn flex jc-center ai-center is_get">已领取</view> | |
30 | + <view wx:else class="btn flex jc-center ai-center">立即领取</view> | |
31 | + </view> | |
32 | + </view> | |
33 | + </view> | |
34 | +</view> | |
35 | + | |
36 | +<view wx:if="{{show_success}}"> | |
37 | + <view class="cover-layer" bindtap="close_show"></view> | |
38 | + <view class="suc_content"> | |
39 | + <view class="up flex jc-center"> | |
40 | + <view class="t-c"> | |
41 | + <image src="{{iurl}}/miniapp/images/coupon_img/success.png"></image> | |
42 | + <view style="margin-top:32rpx;color:#4e220b" class="fs36 ellipsis-1">恭喜您获得【{{get_item.name}}】优惠券</view> | |
43 | + </view> | |
44 | + </view> | |
45 | + <view class="down co-w t-c fs35" bindtap="go_quan">查看我的优惠券</view> | |
46 | + </view> | |
47 | +</view> | |
48 | + | |
49 | +<warn id="warn"></warn> | |
50 | +<nav_box id="nav"></nav_box> | |
51 | + | ... | ... |
packageA/pages/quan_list/quan_list.wxss
0 → 100644
1 | +page{background-color: #f8f8f8;} | |
2 | +.co-w{color: #ffffff;} | |
3 | +.co_g{color:#b399b3} | |
4 | +.co_b{color:#333;} | |
5 | + | |
6 | +.header{padding: 0 10rpx;} | |
7 | +.r_txt{line-height: 45rpx; } | |
8 | +.content{padding: 0 20rpx; margin-top: 20rpx} | |
9 | +.quan_item{ height: 213rpx; margin-bottom: 20rpx } | |
10 | +.quan_item .left{overflow: hidden;width: 35%; height: 213rpx;border-top-left-radius:10rpx;border-bottom-left-radius:10rpx;position: relative} | |
11 | +.quan_item .right{width: 65%; height: 210rpx; border-top-right-radius:10rpx;border-bottom-right-radius:10rpx;position: relative; | |
12 | + background-position: center;background-size: 100% 100%; background-repeat: no-repeat} | |
13 | +.quan_item .left.red {background: url(https://mshopimg.yolipai.net/miniapp/images/coupon_img/red.png) no-repeat;background-position: center;background-size: 100% 100%;} | |
14 | +.quan_item .left.blue {background: url(https://mshopimg.yolipai.net/miniapp/images/coupon_img/blue.png) no-repeat;background-position: center;background-size: 100% 100%;} | |
15 | +.quan_item .left.purple {background: url(https://mshopimg.yolipai.net/miniapp/images/coupon_img/purple.png) no-repeat;background-position: center;background-size: 100% 100%;} | |
16 | + | |
17 | +.quan_item .right.pding{padding-left: 40rpx} | |
18 | +.btn{position: absolute;right: 20rpx; bottom: 20rpx; border-radius: 5px; border: 1rpx solid #c4182e; width: 132rpx; height: 40rpx; color: #c4182e } | |
19 | +.btn.is_get{border: 0;background-color: #dcdcdc;color: #adb3be; width: 94rpx;} | |
20 | + | |
21 | +.suc_content{ | |
22 | + height: 300rpx; width: 84%; margin-left:8%;position: fixed; border-radius:25rpx; | |
23 | + top:50%; margin-top: -150rpx;background-color: #fff; z-index: 999999; | |
24 | +} | |
25 | + | |
26 | +.suc_content .up{ height:200rpx } | |
27 | +.suc_content .up image{ width: 280rpx; height: 220rpx; margin-top: -130rpx} | |
28 | +.suc_content .down{ background-color: #c4182e; height:106rpx; line-height: 106rpx; | |
29 | +border-bottom-right-radius:25rpx; | |
30 | +border-bottom-left-radius:25rpx; | |
31 | +} | |
32 | + | ... | ... |
packageA/pages/quan_pro/filter.wxs
0 → 100644
1 | +var is_has = function (text,val) { | |
2 | + if(text.indexOf(","+val+",")==-1) return false; | |
3 | + return true | |
4 | +} | |
5 | + | |
6 | +function get_guige(color,spece){ | |
7 | + if(color=="" && spece==""){return "规格1"} | |
8 | + if(spece!="" && color==""){return spece} | |
9 | + if(spece=="" && color!=""){return color} | |
10 | + if(spece!="" && color!=""){return spece+"/"+color} | |
11 | + return ""; | |
12 | +} | |
13 | + | |
14 | +module.exports = { | |
15 | + is_has: is_has, | |
16 | + get_guige:get_guige | |
17 | +} | ... | ... |
packageA/pages/quan_pro/g_filter.wxs
0 → 100644
1 | +var g_filters = { | |
2 | + //-- 判断是不是有等级价 -- | |
3 | + is_has_rank:function(rank_switch,item){ | |
4 | + if(!rank_switch) return false; | |
5 | + if(item.cardprice1 || item.cardprice2 || item.cardprice3) {return true} | |
6 | + return false; | |
7 | + }, | |
8 | + | |
9 | + //-- 判断,不是等级会员时候,要显示的最低等级价和名称 -- | |
10 | + get_card_price:function(goods,all_card,type){ | |
11 | + var price1=parseFloat(goods['cardprice1']); | |
12 | + var price2=parseFloat(goods['cardprice2']); | |
13 | + var price3=parseFloat(goods['cardprice3']); | |
14 | + if(!all_card){ | |
15 | + if(type==0) return 0; | |
16 | + return ""; | |
17 | + } | |
18 | + | |
19 | + var arr=[]; | |
20 | + var min_price= 0; | |
21 | + var min_name=""; | |
22 | + | |
23 | + var min_price=null; | |
24 | + var min_name=null; | |
25 | + //---设置对应的价格名字---- | |
26 | + for(var i=0;i<3;i++) { | |
27 | + var vl=all_card[i]; | |
28 | + if(!vl) continue; | |
29 | + if(vl['CorrPrice']=="Price1" && price1>0) | |
30 | + { | |
31 | + if(min_price==null) { | |
32 | + min_price=price1;min_name=vl['CardName']; | |
33 | + } | |
34 | + else if(price1<min_price) { | |
35 | + min_price=price1;min_name=vl['CardName']; | |
36 | + } | |
37 | + } | |
38 | + if(vl['CorrPrice']=="Price2" && price2>0) | |
39 | + { | |
40 | + if(min_price==null) { | |
41 | + min_price=price2;min_name=vl['CardName']; | |
42 | + } | |
43 | + else if(price2<min_price) { | |
44 | + min_price=price2;min_name=vl['CardName']; | |
45 | + } | |
46 | + } | |
47 | + | |
48 | + if(vl['CorrPrice']=="Price3" && price3>0) | |
49 | + { | |
50 | + if(min_price==null) { | |
51 | + min_price=price3;min_name=vl['CardName']; | |
52 | + } | |
53 | + else if(price3<min_price) { | |
54 | + min_price=price3;min_name=vl['CardName']; | |
55 | + } | |
56 | + } | |
57 | + | |
58 | + } | |
59 | + if(min_price==null){ | |
60 | + if(type==0) return 0; | |
61 | + return ""; | |
62 | + } | |
63 | + | |
64 | + //if(type==0) return arr.length; | |
65 | + //--进行排序,升序--- | |
66 | + /*--- | |
67 | + arr.sort(function(a,b){ | |
68 | + if (a.price < b.price) { | |
69 | + return -1; | |
70 | + } else if (a.fee == b.fee) { | |
71 | + return 0; | |
72 | + } else { | |
73 | + return 1; | |
74 | + } | |
75 | + })--*/ | |
76 | + //-- 获取最下价钱,和相应的卡的名称 -- | |
77 | + //min_price=min.price; | |
78 | + //min_name=min.name; | |
79 | + if(type==0) return min_price.toFixed(2); | |
80 | + if(min_name.length>4 ) min_name=min_name.substring(0, 4); | |
81 | + return min_name; | |
82 | + }, | |
83 | +} | |
84 | +module.exports = { | |
85 | + is_has_rank:g_filters.is_has_rank, | |
86 | + get_card_price:g_filters.get_card_price, | |
87 | +} | |
0 | 88 | \ No newline at end of file | ... | ... |
packageA/pages/quan_pro/quan_pro.js
0 → 100644
1 | +var t = require("../../../utils/util.js"), ut = t, | |
2 | + e = require("../../../utils/common.js"), | |
3 | + oo = getApp().globalData, | |
4 | + os = getApp().globalData.setting; | |
5 | + var utils = require('../../../utils/util.js'),ut=utils; | |
6 | + | |
7 | +Page({ | |
8 | + data: { | |
9 | + stoid: os.stoid, | |
10 | + url: os.url, | |
11 | + resourceUrl: os.resourceUrl, | |
12 | + iurl: os.imghost, | |
13 | + defaultAvatar: os.resourceUrl + "/static/images/user68.jpg", | |
14 | + q_data: null, | |
15 | + id:null, | |
16 | + config2:null, | |
17 | + | |
18 | + }, | |
19 | + //------初始化加载---------- | |
20 | + onLoad: function(t) { | |
21 | + var id=t.id; | |
22 | + this.data.id=id; | |
23 | + var goods_list = this.selectComponent("#goods_list"); //组件的id | |
24 | + goods_list.init(); | |
25 | + setTimeout(function() { | |
26 | + goods_list.get_list(); | |
27 | + }, 300) | |
28 | + }, | |
29 | + | |
30 | + //---展示,显示券的信息--- | |
31 | + onShow: function() { | |
32 | + var th=this; | |
33 | + var user_id=getApp().globalData.user_id; | |
34 | + getApp().request.promiseGet("/api/weshop/prom/coupon/pageCouponList", { | |
35 | + data:{store_id:os.stoid,type:1,id:th.data.id,user_id:user_id} | |
36 | + }).then(res => { | |
37 | + if(res.data.code==0){ | |
38 | + th.setData({q_data:res.data.data.pageData[0]}); | |
39 | + } | |
40 | + }); | |
41 | + }, | |
42 | + | |
43 | + onHide: function() { | |
44 | + | |
45 | + }, | |
46 | + //--滚动到顶部-- | |
47 | + doScrollTop: function() { | |
48 | + wx.pageScrollTo({ scrollTop: 0 }); | |
49 | + }, | |
50 | + | |
51 | + //---加载更多是靠这个函数---- | |
52 | + onReachBottom: function() { | |
53 | + var goods_list = this.selectComponent("#goods_list"); //组件的id | |
54 | + if (goods_list) goods_list.get_list(); | |
55 | + }, | |
56 | + | |
57 | + //-----领取券----- | |
58 | + get_quan: function() { | |
59 | + var item=this.data.q_data; | |
60 | + var cid = this.data.q_data.id; | |
61 | + var th=this; | |
62 | + //--先判断会员状态-- | |
63 | + var user_info = getApp().globalData.userInfo; | |
64 | + if (user_info == null || user_info.mobile == undefined || user_info.mobile == "" || user_info.mobile == null) { | |
65 | + wx.navigateTo({ | |
66 | + url: '/pages/getphone/getphone', | |
67 | + }) | |
68 | + return false; | |
69 | + } | |
70 | + //如果券还在领取中,不能再点 | |
71 | + if (th.data.linging == 1) { | |
72 | + getApp().my_warnning('领取中..', 0, this); | |
73 | + return false; | |
74 | + } | |
75 | + th.data.linging = 1; | |
76 | + //如果领取的次数到了 | |
77 | + if (item.everyone_num > 0 && item.lqnum >= item.everyone_num) { | |
78 | + getApp().my_warnning('领取失败,您已领完该券', 0, this); | |
79 | + return false; | |
80 | + } | |
81 | + var lq_num = item.lqnum; | |
82 | + var pdata = { | |
83 | + 'uid': oo.user_id, | |
84 | + 'cid': cid, | |
85 | + 'store_id': os.stoid, | |
86 | + 'type': 5 | |
87 | + }; | |
88 | + var app = getApp(), | |
89 | + th = this; | |
90 | + app.request.post("/api/weshop/couponList/saveCouponList", { | |
91 | + data: pdata, | |
92 | + success: function(res) { | |
93 | + th.data.linging = 0; | |
94 | + if (res.data.code == 0) { | |
95 | + item.lqnum++; | |
96 | + var text = "dataList[" + index + "].is_get"; | |
97 | + var text2 = "dataList[" + index + "].linging"; | |
98 | + var text3="q_data"; | |
99 | + var obj = {};obj[text] = 1; obj[text2] = 0;obj[text3] = item;obj['show_success']=1; | |
100 | + th.setData(obj); | |
101 | + } else { | |
102 | + app.confirmBox(res.data.msg); | |
103 | + } | |
104 | + } | |
105 | + }) | |
106 | + }, | |
107 | + | |
108 | + | |
109 | +}); | ... | ... |
packageA/pages/quan_pro/quan_pro.json
0 → 100644
1 | +{ | |
2 | + "navigationBarTitleText": "优惠券", | |
3 | + "enablePullDownRefresh": false, | |
4 | + "usingComponents": { | |
5 | + "nav_box": "/components/nav_box/nav_box", | |
6 | + "warn": "/components/long_warn/long_warn", | |
7 | + "goods_recommend":"/components/goods_list/goods_list" | |
8 | + } | |
9 | +} | |
0 | 10 | \ No newline at end of file | ... | ... |
packageA/pages/quan_pro/quan_pro.wxml
0 → 100644
1 | +<wxs module="filters" src="../../../utils/filter.wxs"></wxs> | |
2 | +<wxs module="g_filters" src="g_filter.wxs"></wxs> | |
3 | +<wxs module="tool" src="filter.wxs"></wxs> | |
4 | + | |
5 | +<!-- 上部分 --> | |
6 | +<view class="up_part"> | |
7 | + <view class="img_part"> | |
8 | + <image style="width: 100%; height: 450rpx" src="{{iurl}}/miniapp/images/coupon_img/q_detail_bg.png"></image> | |
9 | + <view class="q_content"> | |
10 | + <view class="upper flex jc_sb co-w"> | |
11 | + <view class="left fs30"> | |
12 | + <view> | |
13 | + <image style="width: 70rpx; height: 70rpx; vertical-align: middle; margin-right: 20rpx" src="{{iurl}}/miniapp/images/coupon_img/coupon_logo.png"></image> | |
14 | + {{q_data.name}} | |
15 | + </view> | |
16 | + <view class="flex ai-center ellipsis-1" style="margin-top: 24rpx; margin-right: 20rpx"><view class="t_circle"></view> | |
17 | + <text wx:if="{{q_data.useobjecttype==0}}">全场通用</text> | |
18 | + <text wx:else>仅限{{q_data.useobjectname}}使用</text> | |
19 | + </view> | |
20 | + </view> | |
21 | + <view class="right" style="margin-right: 80rpx;"> | |
22 | + <view class="f40 t-c" style="margin-top: 100rpx"><text class="fs26">¥</text>{{filters.toFix(q_data.money,2)}}</view> | |
23 | + <view class="fs28">满{{filters.toFix(q_data.condition,2)}}可用</view> | |
24 | + </view> | |
25 | + </view> | |
26 | + <view wx:if="{{item.endtype==0}}" class="lower fs30">有效期 | |
27 | + <text wx:if="{{q_data.use_start_time>0}}"> {{filters.format_time(q_data.use_start_time)}}</text>至 | |
28 | + <text wx:if="{{q_data.use_start_time>0}}"> {{filters.format_time(q_data.use_end_time)}}</text><text wx:else>不限</text> | |
29 | + </view> | |
30 | + <view wx:else class="lower fs30">有效期<text wx:if="{{q_data.days>0}}">{{q_data.days}}天</text><text wx:else>不限</text></view> | |
31 | + | |
32 | + </view> | |
33 | + </view> | |
34 | + | |
35 | + <view class="flex jc-center" style="margin-top: 40rpx"> | |
36 | + <view wx:if="{{q_data.everyone_num>0 && q_data.lqnum>=q_data.everyone_num}}" class="btn flex jc-center ai-center gray" bindtap="get_quan">已领取</view> | |
37 | + <view wx:else class="btn flex jc-center ai-center" bindtap="get_quan">立即领取</view> | |
38 | + </view> | |
39 | + <view class="flex jc-center fs36" style="margin-top: 40rpx"> | |
40 | + <image style="margin-right: 20rpx" class="love" src="{{iurl}}/miniapp/images/coupon_img/love.png"></image>猜你喜欢 | |
41 | + </view> | |
42 | +</view> | |
43 | +<!-- 下部分 --> | |
44 | +<view class="down_part"> | |
45 | + <!-- 商品列表组件 --> | |
46 | + <goods_recommend id="goods_list"></goods_recommend> | |
47 | +</view> | |
48 | + | |
49 | + | |
50 | +<view wx:if="{{show_success}}"> | |
51 | + <view class="cover-layer" bindtap="close_show"></view> | |
52 | + <view class="suc_content"> | |
53 | + <view class="up flex jc-center"> | |
54 | + <view class="t-c"> | |
55 | + <image src="{{iurl}}/miniapp/images/coupon_img/success.png"></image> | |
56 | + <view style="margin-top:32rpx;color:#4e220b" class="fs36 ellipsis-1">恭喜您获得【{{get_item.name}}】优惠券</view> | |
57 | + </view> | |
58 | + </view> | |
59 | + <view class="down co-w t-c fs35" bindtap="go_quan">查看我的优惠券</view> | |
60 | + </view> | |
61 | +</view> | |
62 | + | |
63 | + | |
64 | +<warn id="warn"></warn> | |
65 | +<nav_box id="nav"></nav_box> | |
66 | + | |
67 | + | ... | ... |
packageA/pages/quan_pro/quan_pro.wxss
0 → 100644
1 | +page{background-color: #f8f8f8;} | |
2 | +.co-w{color: #ffffff;} | |
3 | +.co_g{color:#b399b3} | |
4 | +.co_b{color:#333;} | |
5 | + | |
6 | +.up_part{background-color: #fff;padding-bottom: 20rpx} | |
7 | +.img_part{ padding: 0 20rpx; position: relative} | |
8 | +.btn{ width: 90%; height: 72rpx; border-radius: 10rpx; background-color: #ff6c6c; color: #fff;} | |
9 | +.love{ width: 60rpx; height: 50rpx} | |
10 | +.q_content{ position: absolute;top: 0; left: 0; width: 100%; height: 450rpx;padding: 0 20rpx; } | |
11 | +.upper{ height:330rpx;} | |
12 | +.lower{ height: 120rpx; line-height: 170rpx;color:#7a668f} | |
13 | + | |
14 | +.upper .left{ margin-left:30rpx; margin-top: 30rpx } | |
15 | +.t_circle{ width: 10rpx; height: 10rpx; border-radius: 50%; background-color: #fff; margin-right: 8rpx} | |
16 | + | |
17 | +.suc_content{ | |
18 | + height: 300rpx; width: 84%; margin-left:8%;position: fixed; border-radius:25rpx; | |
19 | + top:50%; margin-top: -150rpx;background-color: #fff; z-index: 999999; | |
20 | +} | |
21 | + | |
22 | +.suc_content .up{ height:200rpx;} | |
23 | +.suc_content .up image{ width: 280rpx; height: 220rpx; margin-top: -130rpx} | |
24 | +.suc_content .down{ background-color: #c4182e; height:106rpx; line-height: 106rpx; | |
25 | + border-bottom-right-radius:25rpx; | |
26 | + border-bottom-left-radius:25rpx; | |
27 | +} | |
28 | + | |
29 | +.btn.gray{background-color: #dcdcdc; color: #adb3be;} | ... | ... |
pages/cart/cart/cart.js
... | ... | @@ -747,8 +747,13 @@ Page({ |
747 | 747 | plist=res.data.data.pageData[0]; |
748 | 748 | } |
749 | 749 | }) |
750 | - var ob={}; ob.code=1; | |
751 | - if(t.goods_num>plist.CanOutQty-lock){ | |
750 | + var ob={}; ob.code=1; | |
751 | + | |
752 | + if(!plist){ | |
753 | + ob.code=-1;ob.CanOutQty=0;func(ob); return false; | |
754 | + } | |
755 | + | |
756 | + if( t.goods_num>plist.CanOutQty-lock){ | |
752 | 757 | ob.code=-1; |
753 | 758 | ob.CanOutQty=plist.CanOutQty-lock |
754 | 759 | if(ob.CanOutQty<0) ob.CanOutQty=0; |
... | ... | @@ -1104,6 +1109,7 @@ Page({ |
1104 | 1109 | |
1105 | 1110 | //检查莫个门店下的商品是不是优惠活动,有的话,看要不要送礼品,同时有没有倍增 |
1106 | 1111 | check_prom_activity:async function (cindex) { |
1112 | + var make_up_arr=new Array(); | |
1107 | 1113 | var th=this; |
1108 | 1114 | var map=new Map(); |
1109 | 1115 | var list=this.data.requestData[cindex]; |
... | ... | @@ -1170,7 +1176,7 @@ Page({ |
1170 | 1176 | is_bz: prom.is_bz |
1171 | 1177 | } |
1172 | 1178 | }).then(res=>{ |
1173 | - if(res.data.code==0) discount=res.data.data[0]; | |
1179 | + if(res.data.code==0) discount=res.data.data; | |
1174 | 1180 | }) |
1175 | 1181 | //---如果有打折的信息,赠送的信息--- |
1176 | 1182 | if(discount && discount['goods_id']){ |
... | ... | @@ -1223,10 +1229,46 @@ Page({ |
1223 | 1229 | } |
1224 | 1230 | } |
1225 | 1231 | } |
1232 | + //-- 获取 -- | |
1233 | + await getApp().request.promiseGet("/api/weshop/promgoodslist/list",{ | |
1234 | + data:{prom_id:prom.id} | |
1235 | + }).then(res=>{ | |
1236 | + if(res.data.code==0){ | |
1237 | + var list=res.data.data; | |
1238 | + for(var i in list){ | |
1239 | + var item=list[i]; | |
1240 | + if(item.prom_type==0){ | |
1241 | + if(ob.price<item.condition){ | |
1242 | + var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.price).toFixed(2), content:JSON.parse(item.preferential_type)} | |
1243 | + make_up_arr.push(elem); break; | |
1244 | + } | |
1245 | + }else{ | |
1246 | + if(ob.goods_num<item.condition){ | |
1247 | + var elem={prom_id:prom.id,diff_type:item.prom_type,diff:(item.condition-ob.price).toFixed(2), content:JSON.parse(item.preferential_type)} | |
1248 | + make_up_arr.push(elem);break; | |
1249 | + } | |
1250 | + } | |
1251 | + } | |
1252 | + } | |
1253 | + }) | |
1226 | 1254 | } |
1227 | 1255 | //--更新购物车的前台渲染-- |
1228 | 1256 | var rq_text="requestData["+cindex+"]"; |
1229 | 1257 | this.setData({[rq_text]:list}); |
1258 | + var diff_text="requestData["+cindex+"].make_up_arr"; | |
1259 | + //-- 如果有凑单的话 -- | |
1260 | + if(make_up_arr.length>0){ | |
1261 | + this.setData({[diff_text]:make_up_arr}); | |
1262 | + }else{ | |
1263 | + this.setData({[diff_text]:null}); | |
1264 | + } | |
1265 | + }, | |
1266 | + | |
1267 | + //去凑单 | |
1268 | + go_cou_dang:function (e) { | |
1269 | + var prom_id=e.currentTarget.dataset.prom_id; | |
1270 | + var url="/pages/goods/goodsList/goodsList?prom_type=3&prom_id="+prom_id; | |
1271 | + getApp().goto(url); | |
1230 | 1272 | } |
1231 | 1273 | |
1232 | 1274 | }); |
1233 | 1275 | \ No newline at end of file | ... | ... |
pages/cart/cart/cart.wxml
... | ... | @@ -84,6 +84,24 @@ |
84 | 84 | </view> |
85 | 85 | </view> |
86 | 86 | </view> |
87 | + <!--- 去凑单 --> | |
88 | + <view style="margin-top: 20rpx; padding: 0 30rpx"> | |
89 | + <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" > | |
90 | + <view>再买<text class="co-red">{{item.diff}}<text wx:if="{{item.diff_type==0}}">元</text> | |
91 | + <text wx:if="{{item.diff_type==1}}">件</text> | |
92 | + </text>, | |
93 | + <text wx:if="{{item.content.is_money}}">免{{item.content.is_money}}元|</text> | |
94 | + <text wx:if="{{item.content.is_sale}}">打{{item.content.sale}}折|</text> | |
95 | + <text wx:if="{{item.content.is_past}}">包邮|</text> | |
96 | + <text wx:if="{{item.content.is_coupon}}">送优惠券|</text> | |
97 | + <text wx:if="{{item.content.is_int}}">送积分|</text> | |
98 | + <text wx:if="{{item.content.is_gift}}">送赠品|</text> | |
99 | + <text wx:if="{{item.content.is_libao}}">送礼包|</text> | |
100 | + <text></text> | |
101 | + </view> | |
102 | + <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view> | |
103 | + </view> | |
104 | + </view> | |
87 | 105 | </block> |
88 | 106 | </view> |
89 | 107 | <view class="pay-for flex-vertical-between"> | ... | ... |
pages/cart/cart2/cart2.js
... | ... | @@ -165,8 +165,23 @@ Page({ |
165 | 165 | th.data.isget_by_quan={}; |
166 | 166 | } |
167 | 167 | |
168 | - th.setData({user_addr: ie }); | |
169 | - var going=0; | |
168 | + //更换地址回来要重新调用计算价钱的接口 | |
169 | + if(!th.data.user_addr || th.data.user_addr.address_id!=ie.address_id){ | |
170 | + if (th.data.is_b_now == 1) { | |
171 | + if(th.data.bn_goods) { | |
172 | + th.calculatePrice2(); | |
173 | + } | |
174 | + }else{ | |
175 | + if (th.data.cartlist){ | |
176 | + th.calculatePrice(); | |
177 | + } | |
178 | + } | |
179 | + } | |
180 | + | |
181 | + th.setData({user_addr: ie }); | |
182 | + var going=0; | |
183 | + | |
184 | + | |
170 | 185 | //使用计时器,避免空现象 |
171 | 186 | /*--- |
172 | 187 | var jishi= setInterval(function () { |
... | ... | @@ -597,7 +612,7 @@ Page({ |
597 | 612 | }; |
598 | 613 | var c_arr=JSON.parse(JSON.stringify(th.data.old_cartlist)); |
599 | 614 | //---循环购物车--- |
600 | - for(var i=0;i<c_arr.length;i++){ | |
615 | + for(var i in c_arr){ | |
601 | 616 | //因为搭配购买也是再这里计算,搭配购的is_b_now==1 |
602 | 617 | if(th.data.is_b_now==0) { |
603 | 618 | //此时物流的选择方式要用th.data.cartlist; |
... | ... | @@ -639,13 +654,12 @@ Page({ |
639 | 654 | is_bz: item_map.is_bz |
640 | 655 | } |
641 | 656 | }).then(res => { |
642 | - if (res.data.code == 0) { | |
657 | + if (res.data.code == 0 && res.data.data.condition) { | |
643 | 658 | var get_data = res.data.data; |
644 | 659 | item_map.is_bz = get_data.is_bz; //是不是倍增 |
645 | - item_map.is_xz_yh = get_data.is_xz_yh; //是不是优惠 | |
646 | 660 | item_map.bs = get_data.bs; //是不是倍数 |
647 | 661 | item_map.is_past = get_data.is_past; //是不是包邮 |
648 | - item_map.prom_price = get_data.price?get_data.price:0; | |
662 | + item_map.prom_price = get_data.price?get_data.price:item_map.price; | |
649 | 663 | item_map.s_intValue = get_data.intValue; |
650 | 664 | item_map.s_coupon_id = get_data.coupon_id; |
651 | 665 | item_map.s_coupon_num = get_data.coupon_num; |
... | ... | @@ -674,6 +688,10 @@ Page({ |
674 | 688 | } |
675 | 689 | } |
676 | 690 | |
691 | + var q_conditin=0; | |
692 | + //判断包邮券的钱 | |
693 | + q_conditin=o_price; | |
694 | + if(!item_map.is_xz_yh) q_conditin=o_price-item_map.price; | |
677 | 695 | //--看有没有减价-- |
678 | 696 | if(item_map.prom_price && item_map.price-item_map.prom_price){ |
679 | 697 | if(cart_item.prom_pt_json){ |
... | ... | @@ -681,7 +699,10 @@ Page({ |
681 | 699 | }else{ |
682 | 700 | cart_item.prom_pt_json=[{"prom_id":item_map.prom_id,"dis":item_map.price-item_map.prom_price,"ispt":0}]; |
683 | 701 | } |
702 | + | |
684 | 703 | o_price-=(item_map.price-item_map.prom_price); |
704 | + //如果有限制使用优惠券,就要减掉参与的活动商品的钱 | |
705 | + if(!item_map.is_xz_yh) q_conditin=o_price; | |
685 | 706 | } |
686 | 707 | |
687 | 708 | //--优惠多少钱-- |
... | ... | @@ -742,7 +763,7 @@ Page({ |
742 | 763 | if(!th.data.isget_by_quan[pickid]){ |
743 | 764 | //--判断要不要显示包邮券,调用接口,因为有for循环--- |
744 | 765 | await getApp().request.promiseGet("/api/weshop/userfeemail/pageAndArea",{ |
745 | - data:{store_id:os.stoid,isuse:0,condition:o_price,user_id:getApp().globalData.user_id,pageSize:2000} | |
766 | + data:{store_id:os.stoid,isuse:0,condition:q_conditin,user_id:getApp().globalData.user_id,pageSize:2000} | |
746 | 767 | }).then(res=>{ |
747 | 768 | if(res.data.code==0 && res.data.data.total>0){ |
748 | 769 | //此时要循环判断包邮的地区,不包邮商品是不是符合 |
... | ... | @@ -808,6 +829,8 @@ Page({ |
808 | 829 | for(var j=0;j<item.length;j++){ |
809 | 830 | //如果都包邮,都没必要等级数量了 |
810 | 831 | if(th.data.is_quan_by[pickid]) continue; |
832 | + //如果是优惠活动是包邮,就不用计算包邮的费用了 | |
833 | + if(item[j].is_past) continue; | |
811 | 834 | //是不是不包邮的商品 |
812 | 835 | var is_good_no_by=0; |
813 | 836 | if(no_ex_good){ |
... | ... | @@ -815,13 +838,11 @@ Page({ |
815 | 838 | } |
816 | 839 | //如果达到全场包邮的条件,同时,没有地区不包邮,或者商品不包邮 |
817 | 840 | if(o_price>=freight_free && freight_free>0 && !is_good_no_by && th.data.is_no_by[pickid]!=1){ |
818 | - var i=1; | |
819 | 841 | continue; |
820 | 842 | } |
821 | 843 | |
822 | 844 | //--如果是包邮券使用的情况下,如果商品是包邮的,那么就不进行计算-- |
823 | 845 | if(th.data.using_quan[pickid] && th.data.using_quan[pickid].isby==1 && !is_good_no_by){ |
824 | - var i=1; | |
825 | 846 | continue; |
826 | 847 | } |
827 | 848 | |
... | ... | @@ -1029,7 +1050,7 @@ Page({ |
1029 | 1050 | |
1030 | 1051 | var o_shipping_price = 0, goods_weight = -1, goods_piece = -1; |
1031 | 1052 | //-----------当地址不为空,且是物流时,计算物流费用,并同时商品不是优惠活动的包邮---------- |
1032 | - if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1){ | |
1053 | + if (th.data.user_addr != null && th.data.bn_exp_type == 0 && good.is_free_shipping == 0 && good.is_past!=1 && good.is_xz_yh!=1){ | |
1033 | 1054 | //看是不是有调用过包邮券 |
1034 | 1055 | if(!th.data.isget_by_quan[th.data.bn_pick]){ |
1035 | 1056 | var condition=allpice-cut_price; |
... | ... | @@ -1349,7 +1370,7 @@ Page({ |
1349 | 1370 | } |
1350 | 1371 | if(th.data.formData.give_coupon_id>0){ |
1351 | 1372 | order_prom_list.give_coupon_id=th.data.formData.give_coupon_id; |
1352 | - order_prom_list.give_coupon_id=th.data.formData.g_coupon_num; | |
1373 | + order_prom_list.g_coupon_num=th.data.formData.g_coupon_num; | |
1353 | 1374 | } |
1354 | 1375 | if(th.data.formData.give_lb_id>0){ |
1355 | 1376 | order_prom_list.give_lb_id=th.data.formData.give_lb_id; |
... | ... | @@ -2417,7 +2438,7 @@ Page({ |
2417 | 2438 | storeId: oo.stoid, |
2418 | 2439 | userId: app.globalData.user_id, |
2419 | 2440 | BuySum: th.data.ckeck_quan_price, |
2420 | - WareIds: th.data.check_quan_ware_list, | |
2441 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
2421 | 2442 | pageSize: 100 |
2422 | 2443 | }, |
2423 | 2444 | success: function (res) { |
... | ... | @@ -2470,9 +2491,10 @@ Page({ |
2470 | 2491 | //立即购买获取优惠活动的内容 |
2471 | 2492 | buy_now_prom_goods:function (prom_id,arr,func) { |
2472 | 2493 | var price=arr.shop_price*arr.goods_num; |
2494 | + var prom=null; | |
2473 | 2495 | getApp().request.promiseGet("/api/weshop/promgoods/get/"+os.stoid+"/"+prom_id,{}).then(res=>{ |
2474 | 2496 | if(res.data.code==0){ |
2475 | - var prom=res.data.data; | |
2497 | + prom=res.data.data; | |
2476 | 2498 | return getApp().request.promiseGet("/api/weshop/goods/getDiscount", { |
2477 | 2499 | data: { |
2478 | 2500 | price: price, |
... | ... | @@ -2488,24 +2510,27 @@ Page({ |
2488 | 2510 | }).then(res=>{ |
2489 | 2511 | if(res.data.code==0){ |
2490 | 2512 | var get_data=res.data.data; |
2491 | - arr.is_bz=get_data.is_bz; //是不是倍增 | |
2492 | - arr.is_xz_yh=get_data.is_xz_yh; //是不是优惠 | |
2513 | + arr.is_bz=prom.is_bz; //是不是倍增 | |
2514 | + arr.is_xz_yh=prom.is_xz_yh; //是不是优惠 | |
2493 | 2515 | arr.bs=get_data.bs; //是不是倍数 |
2494 | 2516 | arr.is_past=get_data.is_past; //是不是包邮 |
2495 | - arr.prom_price=get_data.price; | |
2517 | + arr.prom_price=get_data.price?get_data.price:price; | |
2496 | 2518 | arr.s_intValue=get_data.intValue; |
2497 | 2519 | arr.s_coupon_id=get_data.coupon_id; |
2498 | 2520 | arr.s_coupon_num=get_data.coupon_num; |
2499 | - arr.gift_id=get_data.gift_id; | |
2500 | - arr.gift_goods_id=get_data.goods_id; | |
2501 | - arr.gift_goods_name=get_data.goods_name; | |
2502 | - arr.gift_goods_color=get_data.goodsinfo.goods_color; | |
2503 | - arr.gift_goods_spec=get_data.goodsinfo.goods_spec; | |
2504 | - arr.gift_original_img=get_data.goodsinfo.original_img; | |
2505 | - arr.gift_weight=get_data.goodsinfo.weight; | |
2506 | - arr.gift_exp_sum_type=get_data.goodsinfo.exp_sum_type; | |
2507 | - arr.gift_limit_num=get_data.limit_num; | |
2508 | - arr.gift_storecount=get_data.gift_storecount; | |
2521 | + //-- 看是不是有赠品 -- | |
2522 | + if(get_data.gift_id) { | |
2523 | + arr.gift_id = get_data.gift_id; | |
2524 | + arr.gift_goods_id = get_data.goods_id; | |
2525 | + arr.gift_goods_name = get_data.goods_name; | |
2526 | + arr.gift_goods_color = get_data.goodsinfo.goods_color; | |
2527 | + arr.gift_goods_spec = get_data.goodsinfo.goods_spec; | |
2528 | + arr.gift_original_img = get_data.goodsinfo.original_img; | |
2529 | + arr.gift_weight = get_data.goodsinfo.weight; | |
2530 | + arr.gift_exp_sum_type = get_data.goodsinfo.exp_sum_type; | |
2531 | + arr.gift_limit_num = get_data.limit_num; | |
2532 | + arr.gift_storecount = get_data.gift_storecount; | |
2533 | + } | |
2509 | 2534 | arr.s_libao=get_data.libao; |
2510 | 2535 | arr.s_lb_num=get_data.lb_num; |
2511 | 2536 | } |
... | ... | @@ -2550,6 +2575,7 @@ Page({ |
2550 | 2575 | ob.price=item.goods_price*item.goods_num; |
2551 | 2576 | ob.goods_num=item.goods_num; |
2552 | 2577 | ob.is_bz=prom.is_bz; |
2578 | + ob.is_xz_yh=prom.is_xz_yh; | |
2553 | 2579 | map[pickid][item.prom_id]=ob; |
2554 | 2580 | } |
2555 | 2581 | }else{ |
... | ... | @@ -2562,6 +2588,7 @@ Page({ |
2562 | 2588 | ob.price=item.goods_price*item.goods_num; |
2563 | 2589 | ob.goods_num=item.goods_num; |
2564 | 2590 | ob.is_bz=prom.is_bz; |
2591 | + ob.is_xz_yh=prom.is_xz_yh; | |
2565 | 2592 | var obj={}; |
2566 | 2593 | obj[item.prom_id]=ob; |
2567 | 2594 | map[pickid]=obj; |
... | ... | @@ -2572,8 +2599,9 @@ Page({ |
2572 | 2599 | //计算立即购买赠品的物流费用 |
2573 | 2600 | get_now_gift_goods_wuliu:function (code, o_shipping_price, user_addr, gift_freight_free,allpice, rs,shipping_price,no_by_data) { |
2574 | 2601 | var good=this.data.buy_now_gift_goods; |
2575 | - var goods_weight=-1, goods_piece=-1; | |
2602 | + var goods_weight=-1, goods_piece=-1; | |
2576 | 2603 | var gift_shipping_price=0; |
2604 | + var th=this; | |
2577 | 2605 | switch (good['exp_sum_type']) { |
2578 | 2606 | case 1: |
2579 | 2607 | //统一运费 |
... | ... | @@ -2596,7 +2624,7 @@ Page({ |
2596 | 2624 | } |
2597 | 2625 | } |
2598 | 2626 | //如果有设置不包邮商品 |
2599 | - if(no_by_data && no_by_data.goods_list && freight_free){ | |
2627 | + if(no_by_data && no_by_data.goods_list && gift_freight_free){ | |
2600 | 2628 | if(th.check_by_goods(no_by_data.goods_list)){ |
2601 | 2629 | gift_freight_free=0; |
2602 | 2630 | th.data.is_no_by[th.data.bn_pick]=1; | ... | ... |
pages/cart/cart2/cart2.wxml
... | ... | @@ -296,11 +296,11 @@ |
296 | 296 | </block> |
297 | 297 | |
298 | 298 | <view class="information"> |
299 | - <view class="item"> | |
299 | + <view class="item" wx:if="{{formData.all_price>0}}"> | |
300 | 300 | <view>商品金额</view> |
301 | 301 | <view class="co-red">¥ {{formData.all_price}}元</view> |
302 | 302 | </view> |
303 | - <view class="item"> | |
303 | + <view class="item" wx:if="{{formData.shipping_price>0}}"> | |
304 | 304 | <view>配送费用</view> |
305 | 305 | <view class="co-red">¥ {{formData.shipping_price}}元</view> |
306 | 306 | </view> |
... | ... | @@ -318,7 +318,7 @@ |
318 | 318 | <view>订单优惠</view> |
319 | 319 | <view class="co-red">- ¥ {{formData.order_prom_amount}}元</view> |
320 | 320 | </view> |
321 | - <view class="item"> | |
321 | + <view class="item" wx:if="{{formData.user_money>0}}"> | |
322 | 322 | <view>使用余额</view> |
323 | 323 | <view class="co-red">- ¥ {{formData.user_money}}元</view> |
324 | 324 | </view> | ... | ... |
pages/cart/cart2_pt/cart2_pt.wxml
... | ... | @@ -129,11 +129,11 @@ |
129 | 129 | <view class="co-red">¥ {{formData.all_price}}元</view> |
130 | 130 | </view> |
131 | 131 | |
132 | - <view class="item"> | |
132 | + <view class="item" wx:if="{{formData.shipping_price>0}}"> | |
133 | 133 | <view>配送费用</view> |
134 | 134 | <view class="co-red">¥ {{formData.shipping_price}}元</view> |
135 | 135 | </view> |
136 | - <view class="item"> | |
136 | + <view class="item" wx:if="{{formData.user_money>0}}"> | |
137 | 137 | <view>使用余额</view> |
138 | 138 | <view class="co-red">- ¥ {{formData.user_money}}元</view> |
139 | 139 | </view> | ... | ... |
pages/cart/cart_wk/cart_wk.wxml
pages/goods/categoryList/categoryList.wxml
... | ... | @@ -460,10 +460,11 @@ |
460 | 460 | </navigator> |
461 | 461 | </view> |
462 | 462 | <view class="no-data" wx:if="{{msgStatus == true}}"> |
463 | - <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> | |
463 | + <!-- <image class="cart-image" src="{{iurl}}/miniapp/images/cart-null.png"></image> --> | |
464 | 464 | |
465 | - <view wx:if="{{msgStatus == true && lastMsg == false}}" class="no-data-title">该类别暂无推荐商品 {{countDownNum}} 秒后自动跳到下一个类别</view> | |
466 | - <view wx:elif="{{lastMsg == true && msgStatus == true}}" class="no-data-title">该类别暂无推荐商品</view> | |
465 | + <view wx:if="{{msgStatus == true && lastMsg == false}}" class="no-data-title" style="text-align:center;margin-top:100px"> | |
466 | + <view style="color:#444;line-height:30px;">该类别暂无推荐商品</view><view style="color:#444;line-height:30px;"> {{countDownNum}} 秒后自动跳到下一个类别</view> </view> | |
467 | + <view wx:elif="{{lastMsg == true && msgStatus == true}}" class="no-data-title" style="text-align:center;margin-top:100px">该类别暂无推荐商品</view> | |
467 | 468 | <!-- <navigator class="lookat" openType="switchTab" url="/pages/index/index/index"> 去逛逛 </navigator> --> |
468 | 469 | </view> |
469 | 470 | ... | ... |
pages/goods/categoryList/categoryList.wxss
pages/goods/goodsInfo/goodsInfo.wxml
... | ... | @@ -448,8 +448,8 @@ |
448 | 448 | <text wx:if="{{item.money>0}}">减价{{item.money}}元;</text> |
449 | 449 | <text wx:if="{{item.sale>0}}">打{{item.sale}}折;</text> |
450 | 450 | <text wx:if="{{item.past==1}}">包邮;</text> |
451 | - <text wx:if="{{item.int>0}}">送{{tem.int}}积分;</text> | |
452 | - <text wx:if="{{item.coupon_id>0}}">送{{item.coupon}}元优惠券;</text> | |
451 | + <text wx:if="{{item.intValue>0}}">送{{tem.intValue}}积分;</text> | |
452 | + <text wx:if="{{item.couponId>0}}">送{{item.couponMoney}}元优惠券;</text> | |
453 | 453 | <text wx:if="{{item.gift_id>0}}">送商品{{item.goods_name}};</text> |
454 | 454 | <text wx:if="{{item.lb_id>0}}">送{{item.lbtitle}};</text> |
455 | 455 | </view> | ... | ... |
pages/goods/goodsInfo/goodsInfo.wxss
... | ... | @@ -2571,7 +2571,7 @@ button.custom-service::after{ |
2571 | 2571 | border: 0; |
2572 | 2572 | } |
2573 | 2573 | .no_store{color:#d60021; font-size: 26rpx;} |
2574 | -.cx_show_view{ width: 580rpx; line-height: 30rpx; margin-bottom: 20rpx; } | |
2574 | +.cx_show_view{ width: 580rpx; line-height: 30rpx; margin-bottom: 6rpx; } | |
2575 | 2575 | .cx_show_view .word{ width: 400rpx} |
2576 | 2576 | .prom_condition { |
2577 | 2577 | color: #d60021; | ... | ... |
pages/goods/goodsList/goodsList.js
... | ... | @@ -3,6 +3,7 @@ |
3 | 3 | default: t |
4 | 4 | }; |
5 | 5 | }(require("../../../utils/LoadMore.js")), e = getApp(), a = new t.default(), oo = e.globalData.setting, ut = require("../../../utils/util.js"); |
6 | +var regeneratorRuntime = require('../../../utils/runtime.js'); | |
6 | 7 | |
7 | 8 | Page({ |
8 | 9 | data: { |
... | ... | @@ -19,7 +20,9 @@ Page({ |
19 | 20 | adname:"desc", //升降的字段 |
20 | 21 | is_new:0, |
21 | 22 | is_hot:0, |
23 | + prom_goods_list:null, | |
22 | 24 | }, |
25 | + | |
23 | 26 | onLoad: function(t) { |
24 | 27 | var th=this; |
25 | 28 | a.init(this, "", "requestData"); |
... | ... | @@ -47,8 +50,22 @@ Page({ |
47 | 50 | |
48 | 51 | if (0 != t.is_new && t.is_new != undefined) { url += "&is_new=" + t.is_new; } |
49 | 52 | if (0 != t.is_hot && t.is_hot != undefined) { url += "&is_hot=" + t.is_hot; } |
53 | + | |
54 | + //优惠活动的凑单 | |
55 | + if(t.prom_type==3){ | |
56 | + if (0 != t.prom_id && t.prom_id != undefined) { url += "&prom_id=" + t.prom_id; } | |
57 | + if (0 != t.prom_type && t.prom_type != undefined) { url += "&prom_type=" + t.prom_type; } | |
58 | + //-- 获取 -- | |
59 | + getApp().request.promiseGet("/api/weshop/promgoodslist/list",{ | |
60 | + data:{prom_id:t.prom_id } | |
61 | + }).then(res=>{ | |
62 | + if(res.data.code==0){ | |
63 | + var arr= res.data.data.pageData; | |
64 | + th.set_prom_list(arr); | |
65 | + } | |
66 | + }) | |
67 | + } | |
50 | 68 | this.requestGoodsList(url); |
51 | - | |
52 | 69 | getApp().getConfig2(function(rs){ |
53 | 70 | //计算等级价相关 |
54 | 71 | var swithc_list=rs.switch_list; |
... | ... | @@ -80,8 +97,45 @@ Page({ |
80 | 97 | },500) |
81 | 98 | } |
82 | 99 | }); |
83 | - | |
84 | 100 | }, |
101 | + | |
102 | + //设置优惠券的 | |
103 | + set_prom_list:async function(arr){ | |
104 | + var th=this; | |
105 | + for(var i in arr){ | |
106 | + //优惠的实际内容 | |
107 | + arr[i].preferential_type=JSON.parse(arr[i].preferential_type); | |
108 | + //--送优惠券- | |
109 | + if(arr[i].preferential_type.is_coupon){ | |
110 | + //-- 获取券的内容 -- | |
111 | + await getApp().request.promiseGet(" /api/weshop/prom/coupon/get/"+arr[i].coupon, { | |
112 | + }).then(res => { | |
113 | + if(res.data.code==0) | |
114 | + arr[i].quan_name=res.data.data.name; | |
115 | + }) | |
116 | + } | |
117 | + //--送礼包-- | |
118 | + if(arr[i].is_libao) { | |
119 | + //-- 获取 -- | |
120 | + await getApp().request.promiseGet("/api/weshop/libao/libaoForm/page?id="+arr[i].is_libao+"&store_id="+oo.stoid, { | |
121 | + }).then(res => { | |
122 | + if(res.data.code==0) | |
123 | + arr[i].ib_name=res.data.data.pageData[0].lbtitle; | |
124 | + }) | |
125 | + } | |
126 | + //--送赠品-- | |
127 | + if(arr[i].is_gift) { | |
128 | + //-- 获取 -- | |
129 | + await getApp().request.promiseGet("/api/weshop/prom/gift/page?id="+arr[i].gift+"&store_id="+oo.stoid, { | |
130 | + }).then(res => { | |
131 | + if(res.data.code==0) | |
132 | + arr[i].gift_name=res.data.data.pageData[0].goods_name; | |
133 | + }) | |
134 | + } | |
135 | + } | |
136 | + th.setData({prom_goods_list:arr}); | |
137 | + }, | |
138 | + | |
85 | 139 | changeTab: function(t) { |
86 | 140 | var ord = t.currentTarget.dataset.href; |
87 | 141 | var ad = t.currentTarget.dataset.ad; | ... | ... |
pages/goods/goodsList/goodsList.wxml
1 | 1 | <wxs module="g_filter" src="g_filter.wxs"></wxs> |
2 | 2 | <view class="container"> |
3 | + <view> | |
4 | + | |
5 | + <view> 满50.00元 减5元 包邮 送10积分 送8元优惠券 送海飞丝洗发水丝质 顺滑& </view> | |
6 | + | |
7 | + </view> | |
8 | + | |
9 | + | |
10 | + | |
11 | + | |
12 | + | |
3 | 13 | <view class="nav"> |
4 | 14 | <navigator bindtap="changeTab" class="nav-item" data-href="goods_id" data-ad="{{adname}}">综合 |
5 | 15 | <view class="ico-dg" wx:if="{{tabname=='goods_id'}}"> | ... | ... |
pages/goods/goodsList/goodsList.wxss
pages/user/order_detail/order_detail.js
... | ... | @@ -70,6 +70,16 @@ Page({ |
70 | 70 | success:async function (eb) { |
71 | 71 | r.order_goods=eb.data.data.pageData; |
72 | 72 | |
73 | + var glist = r.order_goods; | |
74 | + for(var i in glist){ | |
75 | + if(glist[i].is_gift){ | |
76 | + r.is_prom=1; | |
77 | + } | |
78 | + } | |
79 | + | |
80 | + | |
81 | + | |
82 | + | |
73 | 83 | //------------对比一下有没有退款记录------------ |
74 | 84 | await getApp().request.promiseGet("/api/weshop/order/returngoods/page",{ |
75 | 85 | data: { order_id: r.order_id, store_id: os.stoid, | ... | ... |
pages/user/order_detail/order_detail.wxml
... | ... | @@ -35,7 +35,7 @@ |
35 | 35 | <view class="goods-num">×{{item.goods_num}}</view> |
36 | 36 | |
37 | 37 | <!-- 不是整单退的时候 --> |
38 | - <block wx:if="{{order.is_all_return!=1}}"> | |
38 | + <block wx:if="{{order.is_all_return!=1 && order.discount==0 && order.coupon_price<=0 && order.order_prom_amount<=0 && order.discount_amount<0 && item.prom_type!=5 && !order.is_prom}}"> | |
39 | 39 | <view bindtap="checkReturnGoodsStatus" class="goods-num" data-oid="{{item.order_id}}" |
40 | 40 | data-recid="{{item.goods_id}}" wx:if="{{item.return_btn==1 && !order.is_bedistri}}">申请退款</view> |
41 | 41 | <view bindtap="gotoreturn" class="return-btn" data-oid="{{item.order_id}}" | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -112,6 +112,14 @@ Page({ |
112 | 112 | tt = res; |
113 | 113 | }) |
114 | 114 | |
115 | + var glist = tt.data.data.pageData; | |
116 | + for(var i in glist){ | |
117 | + if(glist[i].is_gift){ | |
118 | + data[ind].is_prom=1; | |
119 | + } | |
120 | + } | |
121 | + | |
122 | + | |
115 | 123 | //------------对比一下有没有退款记录------------ |
116 | 124 | await getApp().request.promiseGet("/api/weshop/order/returngoods/page", { |
117 | 125 | data: { | ... | ... |
pages/user/order_list/order_list.wxml
... | ... | @@ -67,7 +67,7 @@ |
67 | 67 | </view> |
68 | 68 | <view class="flex-level-right fs26 refund"> |
69 | 69 | <!-- 不是整单退的时候 --> |
70 | - <block wx:if="{{item.is_all_return!=1}}"> | |
70 | + <block wx:if="{{item.is_all_return!=1 && item.discount==0 && item.coupon_price<=0 && item.order_prom_amount<=0 && item.discount_amount<0 && goods.prom_type!=5 && !item.is_prom}}"> | |
71 | 71 | <view catchtap="checkReturnGoodsStatus" class="return-btn" data-oid="{{goods.order_id}}" data-recid="{{goods.goods_id}}" wx:if="{{goods.return_btn==1 && !item.is_bedistri }}">申请退款</view> |
72 | 72 | <view catchtap="gotoreturn" class="return-btn" data-oid="{{goods.order_id}}" data-recid="{{goods.goods_id}}" wx:if="{{goods.return_btn==2}}">退款中</view> |
73 | 73 | <view catchtap="checkReturnGoodsStatus" class="return-btn" data-oid="{{goods.order_id}}" data-recid="{{goods.goods_id}}" wx:if="{{goods.return_btn==3}}">重新退款</view> | ... | ... |