Commit 4af8c1089aba13412169b48a53b9014486f72dfb
Merge branch 'qa' of http://git.vipzhuang.cn/wxd/MShopWeApp
Showing
13 changed files
with
374 additions
and
78 deletions
components/promate_pop/promate_pop.wxss
packageB/pages/evaluate/evaluate.js
... | ... | @@ -26,7 +26,8 @@ Page({ |
26 | 26 | is_act:0, //是否能购获取图片 |
27 | 27 | actId:0, //活动ID |
28 | 28 | giftBagId:0, //礼包ID |
29 | - ftype:0 | |
29 | + ftype:0, | |
30 | + isdg:0, //是否是导购 | |
30 | 31 | |
31 | 32 | }, |
32 | 33 | //点击星级 |
... | ... | @@ -242,6 +243,11 @@ Page({ |
242 | 243 | this.setData({ftype:parseInt(options.fromtype)}) ; |
243 | 244 | if(options.fromtype==4 || options.fromtype==1 ) th.judge_act(); |
244 | 245 | } |
246 | + if (options.isdg) { | |
247 | + this.setData({ | |
248 | + isdg:options.isdg | |
249 | + }) | |
250 | + } | |
245 | 251 | //th.query_bea(); |
246 | 252 | |
247 | 253 | var userinfo=getApp().globalData.userInfo; |
... | ... | @@ -288,8 +294,9 @@ Page({ |
288 | 294 | console.log(id,"订单", this.data.number); |
289 | 295 | |
290 | 296 | var ty=this.data.ftype?this.data.ftype:2; |
297 | + var isdg = this.data.isdg | |
291 | 298 | wx.redirectTo({ |
292 | - url: "/pages/giftpack/evaluategift/evaluategift?actId="+id+ "&orderType="+ty+"&orderNumber="+this.data.number+"&isdg=1" | |
299 | + url: "/pages/giftpack/evaluategift/evaluategift?actId="+id+ "&orderType="+ty+"&orderNumber="+this.data.number+"&isdg="+isdg | |
293 | 300 | }); |
294 | 301 | |
295 | 302 | }, | ... | ... |
packageD/pages/user/coupons/coupons.wxml
... | ... | @@ -64,8 +64,8 @@ |
64 | 64 | </view> |
65 | 65 | </view> |
66 | 66 | <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}"> |
67 | - <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:if="{{detail.Remark1!=''}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}</view> | |
68 | - <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:else><text style="margin-right: 15rpx">使用说明:</text> {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}</view> | |
67 | + <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:if="{{detail.Remark1!=''}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};{{detail.Remark1}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}、使用场景:{{ (detail.UseRange && detail.UseRange !=0) ? (detail.UseRange==1 ? '仅线下可用' : '仅线上可用') :'通用'}}</view> | |
68 | + <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:else><text style="margin-right: 15rpx">使用说明:</text> {{filter.getNum(detail.Sum)}}元优惠券,{{(detail.UseObjectID==null || detail.UseObjectID=='')?"全场通用":"仅限"+(detail.UseObjectName)+"使用"}},满 {{detail.BuySum==null || detail.BuySum==''?filter.getNum(0):filter.getNum(detail.BuySum)}}元使用 {{detail.region_list_name==null || detail.region_list_name==''?"":",不包邮地区:"+region_list_name}};活动名称:{{detail.ActName}}、活动编号:{{detail.ActNo}}、使用场景:{{(detail.UseRange && detail.UseRange !=0) ? (detail.UseRange==1 ? '仅线下可用' : '仅线上可用') :'通用'}}</view> | |
69 | 69 | </view> |
70 | 70 | </block> |
71 | 71 | </view> | ... | ... |
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -1294,7 +1294,7 @@ Page({ |
1294 | 1294 | await m_cx.cart_cx_group(th, arr[k].goods, c_item, 0, 0, (show_can_cx) => { |
1295 | 1295 | |
1296 | 1296 | arr[k].show_can_cx = show_can_cx; |
1297 | - }) | |
1297 | + },2) | |
1298 | 1298 | } else { |
1299 | 1299 | var show_can_cx = this.data.cartlist[k].show_can_cx; |
1300 | 1300 | //-- 多促销活动的优化 -- |
... | ... | @@ -5103,6 +5103,26 @@ Page({ |
5103 | 5103 | } |
5104 | 5104 | } |
5105 | 5105 | |
5106 | + //看一下有没有活动不参与的,要记录到order_more表中 | |
5107 | + let can_cx=t_item.show_can_cx; | |
5108 | + let is_user_no_yhcx=null; | |
5109 | + for(let iu in can_cx){ | |
5110 | + if(can_cx[iu].no_cj_prom){ | |
5111 | + | |
5112 | + if(!is_user_no_yhcx) is_user_no_yhcx=[]; | |
5113 | + is_user_no_yhcx.push({ | |
5114 | + prom_id:can_cx[iu].cur_act.prom_id, | |
5115 | + prom_type:can_cx[iu].cur_act.prom_type, | |
5116 | + }) | |
5117 | + break; | |
5118 | + } | |
5119 | + } | |
5120 | + //如果有活动不参与的,要记录到order_more表中 | |
5121 | + if(is_user_no_yhcx){ | |
5122 | + item.is_user_no_yhcx=JSON.stringify(is_user_no_yhcx); | |
5123 | + } | |
5124 | + | |
5125 | + | |
5106 | 5126 | //代发商品的集合 |
5107 | 5127 | var df_goods = []; |
5108 | 5128 | var df_price = 0; |
... | ... | @@ -5112,7 +5132,8 @@ Page({ |
5112 | 5132 | //此单的组合活动汇总 |
5113 | 5133 | var zh_map_count={}; |
5114 | 5134 | var check_map = {}; |
5115 | - let groupchat_ids=[] | |
5135 | + let groupchat_ids=[]; | |
5136 | + | |
5116 | 5137 | |
5117 | 5138 | //-------------让商品添加到商品列表-------------------- |
5118 | 5139 | for (var k = 0; k < t_item.goods.length; k++) { |
... | ... | @@ -5473,6 +5494,8 @@ Page({ |
5473 | 5494 | } |
5474 | 5495 | // debugger |
5475 | 5496 | var str = JSON.stringify(pdata); |
5497 | + | |
5498 | + | |
5476 | 5499 | |
5477 | 5500 | wx.showLoading({ title: "加载中" }); |
5478 | 5501 | th.setData({ submit: 1, }) | ... | ... |
packageG/pages/user/my_service/cosmetology_list.js
... | ... | @@ -22,13 +22,13 @@ Page({ |
22 | 22 | projectId:"",//项目id |
23 | 23 | }, |
24 | 24 | onReachBottom: function() { |
25 | - var th = this; | |
26 | - if (this.data.total <= th.data.pageSize) return; | |
27 | - if (this.data.ismore) return; | |
28 | - wx.showLoading({ | |
29 | - title: '加载中...', | |
30 | - }) | |
31 | - th.query_cology(); | |
25 | + // var th = this; | |
26 | + // if (this.data.total <= th.data.pageSize) return; | |
27 | + // if (this.data.ismore) return; | |
28 | + // wx.showLoading({ | |
29 | + // title: '加载中...', | |
30 | + // }) | |
31 | + // th.query_cology(); | |
32 | 32 | }, |
33 | 33 | query_cology: function() { |
34 | 34 | var th = this; |
... | ... | @@ -42,27 +42,31 @@ Page({ |
42 | 42 | serviceId: itemId, |
43 | 43 | storageId: storageId, |
44 | 44 | page: th.data.curpage, |
45 | - pageSize: th.data.pageSize | |
45 | + pageSize: 100 | |
46 | 46 | } |
47 | 47 | }).then(res => { |
48 | 48 | wx.hideLoading(); |
49 | 49 | if (res.data.code == 0) { |
50 | - th.data.curpage++; | |
50 | + // th.data.curpage++; | |
51 | 51 | var arr1 = th.data.cosmetology_list; |
52 | 52 | var arr2 = res.data.data; |
53 | 53 | var arr3 = [...arr1, ...arr2]; |
54 | - | |
55 | - | |
56 | 54 | th.setData({ |
57 | 55 | cosmetology_list: arr3, |
58 | 56 | total: res.data.data.total, |
59 | 57 | is_service_read: 1, |
60 | 58 | is_cosmetology_read:1 |
61 | 59 | }), wx.stopPullDownRefresh(); //停止下拉刷新 |
60 | + if (arr2.length < th.data.pageSize) { | |
61 | + th.setData({ | |
62 | + is_cosmetology_read:1, | |
63 | + ismore:1 | |
64 | + }) | |
65 | + } | |
62 | 66 | } else { |
63 | 67 | th.setData({ |
64 | 68 | is_cosmetology_read:1, |
65 | - ismore:1 | |
69 | + ismore:1 | |
66 | 70 | }) |
67 | 71 | } |
68 | 72 | }) | ... | ... |
pages/cart/cart/cart.js
... | ... | @@ -855,6 +855,7 @@ Page({ |
855 | 855 | item.selected = 0; |
856 | 856 | item.erpwareid = good.erpwareid; //要同步下线商品的id |
857 | 857 | item.shop_price = good.shop_price; //要同步下线商品的id |
858 | + item.init_goods_price=good.goods_price; | |
858 | 859 | |
859 | 860 | //-- 读出每一种商品的所有的活动,方便后面的活动切换使用 -- |
860 | 861 | if (item.prom_type == 0) |
... | ... | @@ -1559,6 +1560,10 @@ Page({ |
1559 | 1560 | var fir = 0; |
1560 | 1561 | for (var j = 0; j < item.length; j++) { |
1561 | 1562 | if (item[j].is_gift) continue; |
1563 | + | |
1564 | + //把价格还原 | |
1565 | + item[j].goods_price=item[j].init_goods_price; | |
1566 | + | |
1562 | 1567 | var obj = JSON.parse(JSON.stringify(item[j])); |
1563 | 1568 | var gd_info=obj; |
1564 | 1569 | |
... | ... | @@ -2078,6 +2083,7 @@ Page({ |
2078 | 2083 | this.data.btn_click = 1; |
2079 | 2084 | var garr = e.data.service_data; |
2080 | 2085 | |
2086 | + //之前没有选中,代表现在要选中 | |
2081 | 2087 | if (!a.selected) { |
2082 | 2088 | |
2083 | 2089 | //如果是标记的时候 |
... | ... | @@ -2385,7 +2391,7 @@ Page({ |
2385 | 2391 | //不需要修改价格 |
2386 | 2392 | await m_cx.cart_cx_group(th, ite1, car[a], 0, n_ok, (show_can_cx) => { |
2387 | 2393 | rd_arr.push(show_can_cx) |
2388 | - },1) | |
2394 | + }) | |
2389 | 2395 | } |
2390 | 2396 | |
2391 | 2397 | if(car.length>1 && c_ind>-1){ |
... | ... | @@ -2393,7 +2399,7 @@ Page({ |
2393 | 2399 | //检验和设置商品的最终是以 取用什么活动,因为多促销 |
2394 | 2400 | await m_cx.cart_cx_group(th, ite2, car[c_ind], 0, n_ok, (show_can_cx) => { |
2395 | 2401 | rd_arr[c_ind]=show_can_cx; |
2396 | - },1) | |
2402 | + }) | |
2397 | 2403 | } |
2398 | 2404 | |
2399 | 2405 | for (var a = 0; a < car.length; a++) { |
... | ... | @@ -4012,7 +4018,7 @@ Page({ |
4012 | 4018 | |
4013 | 4019 | //如果会员是等级会员,商品有等级价,且不是活动商品 |
4014 | 4020 | if (card_field && val[card_field] > 0 && |
4015 | - ((val.prom_type == 0 && g_arr[i].prom_type == 0) || g_arr[i].prom_type == 3 || g_arr[i].prom_type == 5 || g_arr[i].prom_type == 7 || g_arr[i].prom_type == 10)) { | |
4021 | + ((val.prom_type == 0 && g_arr[i].prom_type == 0) || g_arr[i].prom_type == 5 || g_arr[i].prom_type == 7 || g_arr[i].prom_type == 10)) { | |
4016 | 4022 | if (g_arr[i].goods_price != val[card_field]) { |
4017 | 4023 | isok = 0; |
4018 | 4024 | gname = val.goods_name; |
... | ... | @@ -5104,8 +5110,11 @@ Page({ |
5104 | 5110 | |
5105 | 5111 | var th = this; |
5106 | 5112 | var car = JSON.parse(JSON.stringify(this.data.requestData)); |
5107 | - var item = car[c_idx].goods, | |
5108 | - is_s_sele = 1; | |
5113 | + var item = car[c_idx].goods, is_s_sele = 1; | |
5114 | + | |
5115 | + for (var i = 0; i < item.length; i++) { | |
5116 | + item[i].goods_price = item[i].init_goods_price; | |
5117 | + } | |
5109 | 5118 | |
5110 | 5119 | var is_has_other = 0; |
5111 | 5120 | for (var ii = 0; ii < car.length; ii++) { |
... | ... | @@ -5126,15 +5135,16 @@ Page({ |
5126 | 5135 | } |
5127 | 5136 | //-- 让选择进入对应 -- |
5128 | 5137 | for (var i = 0; i < item.length; i++) { |
5129 | - if (sele_arr.hasOwnProperty(i)) { | |
5130 | - item[i].selected = sele_arr[i]; | |
5131 | - } | |
5138 | + if (sele_arr.hasOwnProperty(i)) { | |
5139 | + item[i].selected = sele_arr[i]; | |
5140 | + } | |
5132 | 5141 | } |
5142 | + | |
5133 | 5143 | //-- 先批量判断一下活动的类型,同时要同步跟新 -- |
5134 | 5144 | m_cx.cart_cx_group(this, item, car[c_idx], 0, 0, (show_can_cx) => { |
5135 | 5145 | car[c_idx].show_can_cx = show_can_cx; |
5136 | 5146 | th.cx_check_ok2(func, car); |
5137 | - },1); | |
5147 | + }); | |
5138 | 5148 | |
5139 | 5149 | }, |
5140 | 5150 | |
... | ... | @@ -5257,6 +5267,7 @@ Page({ |
5257 | 5267 | } |
5258 | 5268 | } |
5259 | 5269 | } |
5270 | + | |
5260 | 5271 | func({ |
5261 | 5272 | 'code': 0, |
5262 | 5273 | 'msg': '成功' | ... | ... |
pages/cart/cart/cart.wxml
... | ... | @@ -193,16 +193,7 @@ |
193 | 193 | <view class="flex jc_sb fs28" wx:for="{{item.make_up_arr}}" style="margin-bottom: 20rpx" > |
194 | 194 | <view class="ellipsis-1" style="width: 80%">再买<text class="co-red">{{item.diff}}<text wx:if="{{item.diff_type==0}}">元</text> |
195 | 195 | <text wx:if="{{item.diff_type==1}}">件</text> |
196 | - </text>, | |
197 | - <text wx:if="{{item.content.is_money==1}}">免{{item.content.money}}元|</text> | |
198 | - <text wx:if="{{item.content.is_sale==1}}">打{{item.content.sale}}折|</text> | |
199 | - <text wx:if="{{item.content.is_past==1}}">包邮|</text> | |
200 | - <text wx:if="{{item.content.is_coupon==1}}">送优惠券|</text> | |
201 | - <text wx:if="{{item.content.is_int==1}}">送积分|</text> | |
202 | - <text wx:if="{{item.content.is_gift==1}}">送赠品|</text> | |
203 | - <text wx:if="{{item.content.is_libao==1}}">送礼包|</text> | |
204 | - <text wx:if="{{item.content.is_zxlibao==1}}">送专享礼包|</text> | |
205 | - <text wx:if="{{item.content.is_monthgiftbag==1}}">送每月礼包|</text> | |
196 | + </text>,{{g_filter.map_str(item.content)}} | |
206 | 197 | <text></text> |
207 | 198 | </view> |
208 | 199 | <view class="co-red" data-prom_id="{{item.prom_id}}" bindtap="go_cou_dang">去凑单></view> | ... | ... |
pages/cart/cart/g_filter.wxs
... | ... | @@ -35,6 +35,22 @@ var g_filters = { |
35 | 35 | if([1,2,4,6,8,9].indexOf(items.prom_type)>-1) return false; |
36 | 36 | if(!show_can_cx) return false; |
37 | 37 | return true; |
38 | + }, | |
39 | + | |
40 | + //判断一下文件末尾的|号,促销显示送的内容 | |
41 | + map_str:function (content){ | |
42 | + var string=''; | |
43 | + if(content.is_money==1) string+='免'+content.money+'元|'; | |
44 | + if(content.is_sale==1) string+="打"+content.sale+"折|"; | |
45 | + if(content.is_past==1) string+= "包邮|"; | |
46 | + if(content.is_coupon==1) string+="送优惠券|"; | |
47 | + if(content.is_int==1) string+="送积分|"; | |
48 | + if(content.is_gift==1) string+="送赠品|"; | |
49 | + if(content.is_libao==1) string+="送礼包|"; | |
50 | + if(content.is_zxlibao==1) string+="送专享礼包|"; | |
51 | + if(content.is_monthgiftbag==1) string+="送每月礼包|"; | |
52 | + string=string.substring(0,string.length-1); | |
53 | + return string | |
38 | 54 | } |
39 | 55 | |
40 | 56 | } |
... | ... | @@ -44,5 +60,6 @@ module.exports = { |
44 | 60 | end_time: g_filters.end_time, |
45 | 61 | toFix: g_filters.toFix, |
46 | 62 | is_more_act: g_filters.is_more_act, |
47 | - check_show:g_filters.check_show | |
63 | + check_show:g_filters.check_show, | |
64 | + map_str:g_filters.map_str | |
48 | 65 | } |
49 | 66 | \ No newline at end of file | ... | ... |
pages/giftpack/evaluategift/evaluategift.js
... | ... | @@ -189,6 +189,9 @@ Page({ |
189 | 189 | "giftBagId": th.data.giftBagId, |
190 | 190 | "buyFrom": 2 |
191 | 191 | }; |
192 | + if (th.data.isdg) { | |
193 | + json.isdg=th.data.isdg | |
194 | + } | |
192 | 195 | var data = JSON.stringify(json); |
193 | 196 | var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; |
194 | 197 | getApp().request.json_post(url, json, | ... | ... |
pages/user/index/index.js
... | ... | @@ -174,8 +174,11 @@ Page({ |
174 | 174 | if (item.is_sy == 0) { |
175 | 175 | var now = Date.parse(new Date()); now = now / 1000; |
176 | 176 | if (item.end_time < now) { |
177 | - th.setData({ is_no_plus: 0 }) | |
177 | + th.setData({ is_no_plus: 0 }) | |
178 | + }else{ | |
179 | + th.setData({ is_no_plus: 1 }) | |
178 | 180 | } |
181 | + | |
179 | 182 | }else if(item.is_sy == 1){ |
180 | 183 | th.setData({ is_no_plus: 1 }) |
181 | 184 | } | ... | ... |
pages/user/order_detail/order_detail.js
... | ... | @@ -178,6 +178,7 @@ Page({ |
178 | 178 | r.use_commission=res.data.data.use_commission; |
179 | 179 | r.pre_cut=res.data.data.pre_cut; //预存款 |
180 | 180 | r.pre_json=res.data.data.pre_json; //预存款 |
181 | + r.is_user_no_yhcx = res.data.data.is_user_no_yhcx; //判断订单是不是优惠促销不参与 | |
181 | 182 | } |
182 | 183 | }) |
183 | 184 | |
... | ... | @@ -822,6 +823,17 @@ Page({ |
822 | 823 | }) |
823 | 824 | |
824 | 825 | |
826 | + if(gg.prom_type==3){ | |
827 | + var prom_pc=null; | |
828 | + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | |
829 | + if (res.data.code == 0) { prom_pc = res.data.data; } | |
830 | + }) | |
831 | + | |
832 | + if(prom_pc){ | |
833 | + gg.discount_field=prom_pc.discount_field; | |
834 | + } | |
835 | + } | |
836 | + | |
825 | 837 | if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9) |
826 | 838 | && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) { |
827 | 839 | var prom = null; |
... | ... | @@ -900,6 +912,7 @@ Page({ |
900 | 912 | }) |
901 | 913 | |
902 | 914 | |
915 | + //商品的订单列表的活动类型,和gg参与的类型不一致 | |
903 | 916 | if(good.prom_type != gg.prom_type && good.prom_id != gg.prom_id){ |
904 | 917 | //如果商品有单独的活动的是偶 |
905 | 918 | switch (gg.prom_type){ |
... | ... | @@ -912,19 +925,66 @@ Page({ |
912 | 925 | case 3: |
913 | 926 | var prom=null; |
914 | 927 | var yh_check=1; |
915 | - await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | |
916 | - if (res.data.code == 0) { prom = res.data.data; } | |
917 | - }) | |
918 | - if (prom && prom.limit_num) { | |
919 | - var limit_num = prom.limit_num; | |
920 | - var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id) | |
921 | - if (limit_num>0 && user_pre_buynum >= limit_num) { | |
928 | + | |
929 | + | |
930 | + //如果有优惠促销的普通购买的时候 | |
931 | + if(order.is_user_no_yhcx && good.prom_type==0 && order.is_user_no_yhcx!='0' && order.is_user_no_yhcx!='null' ){ | |
932 | + let obj=JSON.parse(order.is_user_no_yhcx); | |
933 | + //obj数组使用find函数快速查找 | |
934 | + if(obj.find((item)=>{return item.prom_id==gg.prom_id && item.prom_type==3})){ | |
922 | 935 | yh_check=0; |
923 | 936 | } |
924 | 937 | } |
938 | + | |
939 | + //判断优惠促销活动的限购 | |
940 | + if(yh_check){ | |
941 | + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | |
942 | + if (res.data.code == 0) { prom = res.data.data; } | |
943 | + }) | |
944 | + if (prom && prom.limit_num) { | |
945 | + var limit_num = prom.limit_num; | |
946 | + var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id) | |
947 | + if (limit_num>0 && user_pre_buynum >= limit_num) { | |
948 | + yh_check=0; | |
949 | + } | |
950 | + } | |
951 | + } | |
952 | + | |
953 | + //--- 要判断一下优惠促销的商品的限购 --- | |
954 | + if(yh_check){ | |
955 | + var pro_gd_limit_num=0; | |
956 | + var p_limit_rs= await getApp().request.promisePost('/api/weshop/promgoods/getPromGoodsLimitNum',{ | |
957 | + data:{ | |
958 | + store_id:os.stoid,goods_id:gg.goods_id,prom_id:gg.prom_id,prom_type:3 | |
959 | + } | |
960 | + }) | |
961 | + if(p_limit_rs && p_limit_rs.data.code==0){ | |
962 | + pro_gd_limit_num=p_limit_rs.data.data | |
963 | + } | |
964 | + //-- 如果有商品限购的时候 -- | |
965 | + if(pro_gd_limit_num>0){ | |
966 | + var pro_by_num=0; | |
967 | + var lrs= { | |
968 | + store_id: os.stoid,user_id: getApp().globalData.user_id, | |
969 | + goods_id: gg.goods_id, prom_type: 3, | |
970 | + prom_id: gg.prom_id, isnew:1 | |
971 | + }; | |
972 | + var gd_limit_rs=await getApp().promiseGet('/api/weshop/ordergoods/getUserBuyGoodsNum',{data:lrs}); | |
973 | + if(gd_limit_rs && gd_limit_rs.data.code==0){ | |
974 | + pro_by_num=gd_limit_rs.data.data.promgoodsbuynum | |
975 | + } | |
976 | + if(pro_gd_limit_num<pro_by_num+good.goods_num){ | |
977 | + yh_check=0; | |
978 | + } | |
979 | + } | |
980 | + } | |
981 | + | |
925 | 982 | //-- 优惠促销活动没有超出限购的话 -- |
926 | 983 | if(yh_check){ |
927 | 984 | if(!the_yh_map[gg.prom_id]) the_yh_map[gg.prom_id]=[]; |
985 | + if(prom) good.discount_field=prom.discount_field; | |
986 | + good.r_shop_price=gg.shop_price; | |
987 | + good.r_market_price=gg.market_price; | |
928 | 988 | the_yh_map[gg.prom_id].push(good); |
929 | 989 | } |
930 | 990 | |
... | ... | @@ -979,7 +1039,6 @@ Page({ |
979 | 1039 | } |
980 | 1040 | } |
981 | 1041 | |
982 | - | |
983 | 1042 | //如果有普通商品要判断能不到达到优惠促销的条件 |
984 | 1043 | if(Object.keys(the_yh_map).length){ |
985 | 1044 | for (let rkey in the_yh_map) { |
... | ... | @@ -987,7 +1046,17 @@ Page({ |
987 | 1046 | var all_num=0; |
988 | 1047 | |
989 | 1048 | for(var ij=0;ij<the_yh_map[rkey].length;ij++){ |
990 | - all_price+=the_yh_map[rkey][ij].goods_price * the_yh_map[rkey][ij].goods_num; | |
1049 | + var t_price=the_yh_map[rkey][ij].goods_price; | |
1050 | + switch (the_yh_map[rkey][ij].discount_field){ | |
1051 | + case 1: | |
1052 | + t_price=the_yh_map[rkey][ij].r_shop_price; | |
1053 | + break; | |
1054 | + case 2: | |
1055 | + t_price=the_yh_map[rkey][ij].r_market_price; | |
1056 | + break; | |
1057 | + } | |
1058 | + | |
1059 | + all_price+=t_price * the_yh_map[rkey][ij].goods_num; | |
991 | 1060 | all_num+= the_yh_map[rkey][ij].goods_num; |
992 | 1061 | } |
993 | 1062 | |
... | ... | @@ -1010,8 +1079,6 @@ Page({ |
1010 | 1079 | } |
1011 | 1080 | |
1012 | 1081 | } |
1013 | - | |
1014 | - | |
1015 | 1082 | //-- 判断活动是不是OK -- |
1016 | 1083 | if (!t_ok) { |
1017 | 1084 | th.setData({ paying: 0 }); return false; |
... | ... | @@ -1043,17 +1110,32 @@ Page({ |
1043 | 1110 | |
1044 | 1111 | //-- 如果会员是等级会员,商品有等级价,且不是活动商品,同时线下取价的要放在最后来判断 -- |
1045 | 1112 | if (!good.is_gift && !good.is_collocation && gg.prom_type != 9) { |
1046 | - if (card_field && gg[card_field] > 0) { | |
1047 | - if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0; | |
1048 | - if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
1049 | 1113 | |
1050 | - } else { | |
1051 | - if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0; | |
1052 | - if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
1114 | + //-- 优惠促销的时候控制取价规则 -- | |
1115 | + if(gg.prom_type!=3 || gg.discount_field==undefined || gg.discount_field==0 ) { | |
1116 | + if (card_field && gg[card_field] > 0) { | |
1117 | + if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0; | |
1118 | + if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
1119 | + | |
1120 | + } else { | |
1121 | + if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0; | |
1122 | + if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
1123 | + } | |
1124 | + }else{ | |
1125 | + if(good.prom_type==3){ | |
1126 | + switch (gg.discount_field){ | |
1127 | + case 1: | |
1128 | + if (good.goods_price != gg.shop_price) isok = 0; | |
1129 | + break; | |
1130 | + case 2: | |
1131 | + if (good.goods_price != gg.market_price) isok = 0; | |
1132 | + break; | |
1133 | + } | |
1134 | + } | |
1053 | 1135 | } |
1136 | + | |
1054 | 1137 | var is_h = 0; |
1055 | 1138 | if (!isok) { |
1056 | - | |
1057 | 1139 | var content = gg.goods_name + '商品的价格发生了变化,请取消订单重新购买1' |
1058 | 1140 | th.toast(content); |
1059 | 1141 | th.setData({ paying: 0 }); |
... | ... | @@ -2310,8 +2392,24 @@ Page({ |
2310 | 2392 | //-- 查看物流 -- |
2311 | 2393 | go_wuliu:function (e) { |
2312 | 2394 | getApp().go_wuliu(e); |
2313 | - } | |
2395 | + }, | |
2314 | 2396 | |
2397 | + //优惠促销用户参与次数,is_buy=1,表示只获取支付了的 | |
2398 | + async getUserBuyPromNum_pre(prom_id,is_buy) { | |
2399 | + var userInfo = getApp().globalData.userInfo; | |
2400 | + var url = `/api/weshop/ordergoods/getUserBuyPromNum?is_all=1&store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`; | |
2401 | + if(is_buy){ | |
2402 | + url = `/api/weshop/ordergoods/getUserBuyPromNum?store_id=${os.stoid}&user_id=${userInfo.user_id}&prom_type=3&prom_id=${prom_id}`; | |
2403 | + } | |
2404 | + let res = await getApp().request.promiseGet(url, { | |
2405 | + data: {} | |
2406 | + }); | |
2407 | + let user_pre_buynum = 0 | |
2408 | + if (res.data.code == 0 && res.data.data) { | |
2409 | + user_pre_buynum = res.data.data.userbuynum | |
2410 | + } | |
2411 | + return user_pre_buynum | |
2412 | + } | |
2315 | 2413 | |
2316 | 2414 | |
2317 | 2415 | ... | ... |
pages/user/order_list/order_list.js
... | ... | @@ -17,6 +17,8 @@ var ut = require('../../../utils/util.js'); |
17 | 17 | var t = require("../../../utils/pay.js"); |
18 | 18 | var t_pay = require("../../../utils/pay2.js"); |
19 | 19 | |
20 | + | |
21 | + | |
20 | 22 | Page({ |
21 | 23 | data: { |
22 | 24 | url: e.globalData.setting.url, |
... | ... | @@ -410,6 +412,7 @@ Page({ |
410 | 412 | data[ind].use_commission = res.data.data.use_commission; |
411 | 413 | data[ind].pre_cut = res.data.data.pre_cut; //是否使用预存,如果是使用预存不能单品退,只能整单退 |
412 | 414 | data[ind].pre_json = res.data.data.pre_json; //是否使用预存,如果是使用预存不能单品退,只能整单退 |
415 | + data[ind].is_user_no_yhcx = res.data.data.is_user_no_yhcx; //判断订单是不是优惠促销不参与 | |
413 | 416 | } |
414 | 417 | }) |
415 | 418 | |
... | ... | @@ -1105,13 +1108,25 @@ Page({ |
1105 | 1108 | return e.s_time < ut.gettimestamp() || (e.warm_uptime && e.warm_uptime < ut.gettimestamp()) |
1106 | 1109 | }) |
1107 | 1110 | if (arr2.length == 1) { |
1108 | - gg.prom_type=arr2[0].prom_type; | |
1109 | - gg.prom_id=arr2[0].act_id; | |
1111 | + gg.prom_type=arr2[0].prom_type; | |
1112 | + gg.prom_id=arr2[0].act_id; | |
1110 | 1113 | } |
1111 | 1114 | } |
1112 | 1115 | }) |
1113 | 1116 | |
1114 | 1117 | |
1118 | + if(gg.prom_type==3){ | |
1119 | + var prom_pc=null; | |
1120 | + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | |
1121 | + if (res.data.code == 0) { prom_pc = res.data.data; } | |
1122 | + }) | |
1123 | + | |
1124 | + if(prom_pc){ | |
1125 | + gg.discount_field=prom_pc.discount_field; | |
1126 | + } | |
1127 | + } | |
1128 | + | |
1129 | + | |
1115 | 1130 | if ((gg.prom_type == 1 || gg.prom_type == 2 || gg.prom_type == 4 || gg.prom_type == 6 || gg.prom_type == 8 || gg.prom_type == 9) |
1116 | 1131 | && !good.is_collocation && !good.is_gift && !good.is_integral_normal && !good.is_pd_normal) { |
1117 | 1132 | var prom = null; |
... | ... | @@ -1189,6 +1204,7 @@ Page({ |
1189 | 1204 | }) |
1190 | 1205 | |
1191 | 1206 | |
1207 | + //商品的订单列表的活动类型,和gg参与的类型不一致 | |
1192 | 1208 | if(good.prom_type != gg.prom_type && good.prom_id != gg.prom_id){ |
1193 | 1209 | //如果商品有单独的活动的是偶 |
1194 | 1210 | switch (gg.prom_type){ |
... | ... | @@ -1201,21 +1217,69 @@ Page({ |
1201 | 1217 | case 3: |
1202 | 1218 | var prom=null; |
1203 | 1219 | var yh_check=1; |
1204 | - await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | |
1205 | - if (res.data.code == 0) { prom = res.data.data; } | |
1206 | - }) | |
1207 | - if (prom && prom.limit_num) { | |
1208 | - var limit_num = prom.limit_num; | |
1209 | - var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id) | |
1210 | - if (limit_num>0 && user_pre_buynum >= limit_num) { | |
1211 | - yh_check=0; | |
1220 | + | |
1221 | + | |
1222 | + //如果有优惠促销的普通购买的时候 | |
1223 | + if(order.is_user_no_yhcx && good.prom_type==0 && order.is_user_no_yhcx!='0' && order.is_user_no_yhcx!='null' ){ | |
1224 | + let obj=JSON.parse(order.is_user_no_yhcx); | |
1225 | + //obj数组使用find函数快速查找 | |
1226 | + if(obj.find((item)=>{return item.prom_id==gg.prom_id && item.prom_type==3})){ | |
1227 | + yh_check=0; | |
1228 | + } | |
1229 | + } | |
1230 | + | |
1231 | + //判断优惠促销活动的限购 | |
1232 | + if(yh_check){ | |
1233 | + await getApp().request.promiseGet("/api/weshop/promgoods/get/" + os.stoid + "/" + gg.prom_id, {}).then(res => { | |
1234 | + if (res.data.code == 0) { prom = res.data.data; } | |
1235 | + }) | |
1236 | + if (prom && prom.limit_num) { | |
1237 | + var limit_num = prom.limit_num; | |
1238 | + var user_pre_buynum = await this.getUserBuyPromNum_pre(prom.id) | |
1239 | + if (limit_num>0 && user_pre_buynum >= limit_num) { | |
1240 | + yh_check=0; | |
1241 | + } | |
1242 | + } | |
1243 | + } | |
1244 | + | |
1245 | + //--- 要判断一下优惠促销的商品的限购 --- | |
1246 | + if(yh_check){ | |
1247 | + var pro_gd_limit_num=0; | |
1248 | + var p_limit_rs= await getApp().request.promisePost('/api/weshop/promgoods/getPromGoodsLimitNum',{ | |
1249 | + data:{ | |
1250 | + store_id:os.stoid,goods_id:gg.goods_id,prom_id:gg.prom_id,prom_type:3 | |
1251 | + } | |
1252 | + }) | |
1253 | + if(p_limit_rs && p_limit_rs.data.code==0){ | |
1254 | + pro_gd_limit_num=p_limit_rs.data.data | |
1255 | + } | |
1256 | + //-- 如果有商品限购的时候 -- | |
1257 | + if(pro_gd_limit_num>0){ | |
1258 | + var pro_by_num=0; | |
1259 | + var lrs= { | |
1260 | + store_id: os.stoid,user_id: getApp().globalData.user_id, | |
1261 | + goods_id: gg.goods_id, prom_type: 3, | |
1262 | + prom_id: gg.prom_id, isnew:1 | |
1263 | + }; | |
1264 | + var gd_limit_rs=await getApp().promiseGet('/api/weshop/ordergoods/getUserBuyGoodsNum',{data:lrs}); | |
1265 | + if(gd_limit_rs && gd_limit_rs.data.code==0){ | |
1266 | + pro_by_num=gd_limit_rs.data.data.promgoodsbuynum | |
1267 | + } | |
1268 | + if(pro_gd_limit_num<pro_by_num+good.goods_num){ | |
1269 | + yh_check=0; | |
1270 | + } | |
1212 | 1271 | } |
1213 | 1272 | } |
1273 | + | |
1214 | 1274 | //-- 优惠促销活动没有超出限购的话 -- |
1215 | 1275 | if(yh_check){ |
1216 | 1276 | if(!the_yh_map[gg.prom_id]) the_yh_map[gg.prom_id]=[]; |
1277 | + if(prom) good.discount_field=prom.discount_field; | |
1278 | + good.r_shop_price=gg.shop_price; | |
1279 | + good.r_market_price=gg.market_price; | |
1217 | 1280 | the_yh_map[gg.prom_id].push(good); |
1218 | 1281 | } |
1282 | + | |
1219 | 1283 | break |
1220 | 1284 | case 7: |
1221 | 1285 | //获取组合购活动 |
... | ... | @@ -1268,6 +1332,7 @@ Page({ |
1268 | 1332 | } |
1269 | 1333 | |
1270 | 1334 | |
1335 | + | |
1271 | 1336 | //如果有普通商品要判断能不到达到优惠促销的条件 |
1272 | 1337 | if(Object.keys(the_yh_map).length){ |
1273 | 1338 | for (let rkey in the_yh_map) { |
... | ... | @@ -1275,7 +1340,17 @@ Page({ |
1275 | 1340 | var all_num=0; |
1276 | 1341 | |
1277 | 1342 | for(var ij=0;ij<the_yh_map[rkey].length;ij++){ |
1278 | - all_price+=the_yh_map[rkey][ij].goods_price * the_yh_map[rkey][ij].goods_num; | |
1343 | + var t_price=the_yh_map[rkey][ij].goods_price; | |
1344 | + switch (the_yh_map[rkey][ij].discount_field){ | |
1345 | + case 1: | |
1346 | + t_price=the_yh_map[rkey][ij].r_shop_price; | |
1347 | + break; | |
1348 | + case 2: | |
1349 | + t_price=the_yh_map[rkey][ij].r_market_price; | |
1350 | + break; | |
1351 | + } | |
1352 | + | |
1353 | + all_price+=t_price * the_yh_map[rkey][ij].goods_num; | |
1279 | 1354 | all_num+= the_yh_map[rkey][ij].goods_num; |
1280 | 1355 | } |
1281 | 1356 | |
... | ... | @@ -1329,14 +1404,33 @@ Page({ |
1329 | 1404 | |
1330 | 1405 | //-- 如果会员是等级会员,商品有等级价,且不是活动商品,同时线下取价的要放在最后来判断 -- |
1331 | 1406 | if (!good.is_gift && !good.is_collocation && gg.prom_type != 9) { |
1332 | - if (card_field && gg[card_field] > 0) { | |
1333 | - if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0; | |
1334 | - if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
1335 | 1407 | |
1336 | - } else { | |
1337 | - if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0; | |
1338 | - if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
1408 | + | |
1409 | + //-- 优惠促销的时候控制取价规则 -- | |
1410 | + if(gg.prom_type!=3 || gg.discount_field==undefined || gg.discount_field==0 ){ | |
1411 | + if (card_field && gg[card_field] > 0) { | |
1412 | + if (good.goods_price != gg[card_field] && good.offline_cut <= 0) isok = 0; | |
1413 | + if (good.goods_price > gg[card_field] && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
1414 | + | |
1415 | + } else { | |
1416 | + if (good.goods_price != gg.shop_price && good.offline_cut <= 0) isok = 0; | |
1417 | + if (good.goods_price > gg.shop_price && good.offline_cut > 0) isok = 0; //如果线下价格比较贵,则不通过 | |
1418 | + } | |
1419 | + }else{ | |
1420 | + | |
1421 | + if(good.prom_type==3){ | |
1422 | + switch (gg.discount_field){ | |
1423 | + case 1: | |
1424 | + if (good.goods_price != gg.shop_price) isok = 0; | |
1425 | + break; | |
1426 | + case 2: | |
1427 | + if (good.goods_price != gg.market_price) isok = 0; | |
1428 | + break; | |
1429 | + } | |
1430 | + } | |
1339 | 1431 | } |
1432 | + | |
1433 | + | |
1340 | 1434 | var is_h = 0; |
1341 | 1435 | if (!isok) { |
1342 | 1436 | ... | ... |
utils/more_cx.js
... | ... | @@ -364,8 +364,29 @@ module.exports = { |
364 | 364 | return g_item.goods_id==ck_prom_type.goods[b].goods_id && [0,3,5,7,10].indexOf(g_item.prom_type)>-1; |
365 | 365 | }) |
366 | 366 | if(fg>-1){ |
367 | + | |
368 | + goods[fg].goods_price = goods[fg].init_goods_price; | |
367 | 369 | goods[fg].prom_type=ck_prom_type.prom_type; |
368 | 370 | goods[fg].prom_id=ck_prom_type.prom_id; |
371 | + | |
372 | + if(ck_prom_type.prom_type==3){ | |
373 | + let ffd=th.data.in_yhact[ck_prom_type.prom_id]; | |
374 | + let f_price = goods[fg].goods_price; | |
375 | + if (ffd.discount_field != undefined) { | |
376 | + switch (ffd.discount_field) { | |
377 | + case 0: | |
378 | + f_price = goods[fg].goods_price; | |
379 | + break; | |
380 | + case 1: | |
381 | + f_price = goods[fg].shop_price; | |
382 | + break; | |
383 | + case 2: | |
384 | + f_price = goods[fg].goods_market_price; | |
385 | + break; | |
386 | + } | |
387 | + } | |
388 | + goods[fg].goods_price = f_price; | |
389 | + } | |
369 | 390 | } |
370 | 391 | } |
371 | 392 | |
... | ... | @@ -402,8 +423,12 @@ module.exports = { |
402 | 423 | //-- 促销活动对象表,最初的map表,包含活动类型,活动id,goods商品 --- |
403 | 424 | var cx_act_map=[]; |
404 | 425 | for(var i=0; i<goods.length;i++){ |
405 | - //-- 运用深拷贝,避免价格的bug --s | |
406 | - var c_item= JSON.parse(JSON.stringify(goods[i])); | |
426 | + | |
427 | + //商品的价格要还原,只有在购物车时候有init_goods_price,因为购物车要还原 | |
428 | + if(goods[i].init_goods_price!=undefined) | |
429 | + goods[i].goods_price=goods[i].init_goods_price; | |
430 | + //进行深拷贝 | |
431 | + var c_item=JSON.parse(JSON.stringify(goods[i])); | |
407 | 432 | //没有选中 |
408 | 433 | if(!c_item.selected) continue; |
409 | 434 | //如果是秒杀之类是商品 |
... | ... | @@ -526,7 +551,7 @@ module.exports = { |
526 | 551 | for(var f=0;f<t_goods.length;f++){ |
527 | 552 | all_num+=t_goods[f].goods_num; |
528 | 553 | |
529 | - if(!is_no_change) { | |
554 | + if(is_no_change!=1) { | |
530 | 555 | //-- 优惠促销取价的优化 -- |
531 | 556 | let f_price = t_goods[f].goods_price; |
532 | 557 | if (fd.discount_field != undefined) { |
... | ... | @@ -752,6 +777,25 @@ module.exports = { |
752 | 777 | if(fg>-1){ |
753 | 778 | goods[fg].prom_type=ck_prom_type.prom_type; |
754 | 779 | goods[fg].prom_id=ck_prom_type.prom_id; |
780 | + | |
781 | + if(ck_prom_type.prom_type==3 && (is_no_change!=2 || ck_prom_type.is_no_ok!=1) ){ | |
782 | + let ffd=th.data.in_yhact[ck_prom_type.prom_id]; | |
783 | + let f_price = goods[fg].goods_price; | |
784 | + if (ffd.discount_field != undefined) { | |
785 | + switch (ffd.discount_field) { | |
786 | + case 0: | |
787 | + f_price = goods[fg].goods_price; | |
788 | + break; | |
789 | + case 1: | |
790 | + f_price = goods[fg].shop_price; | |
791 | + break; | |
792 | + case 2: | |
793 | + f_price = goods[fg].goods_market_price; | |
794 | + break; | |
795 | + } | |
796 | + } | |
797 | + goods[fg].goods_price = f_price; | |
798 | + } | |
755 | 799 | } |
756 | 800 | } |
757 | 801 | } | ... | ... |