Commit b90197be12069b4f5de5b23e9aaab73ce70ca336
1 parent
d5f80d8b
1. 优惠活动测试的bug 优化 10条
2. 优惠平摊的订单不能单个商品退
Showing
20 changed files
with
797 additions
and
10 deletions
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/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/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 && item.discount!=0}}"> | |
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.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}}"> | |
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> | ... | ... |