Commit 13f4b3a402799b1711ff787ac036b4b987656985
Merge branch 'test' of http://git.vipzhuang.cn/wxd/MShopWeApp into qa
Showing
10 changed files
with
301 additions
and
82 deletions
packageC/pages/presell/cart/cart.js
... | ... | @@ -62,6 +62,8 @@ Page({ |
62 | 62 | ckeck_quan_price: 0, |
63 | 63 | check_quan_price_list: '', |
64 | 64 | check_quan_ware_list: '', |
65 | + ckeck_quan_price_scj: 0, //优惠券用市场价进行获取 | |
66 | + | |
65 | 67 | isget_by_quan: {}, //是否调用了接口获取包邮券 |
66 | 68 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid |
67 | 69 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} |
... | ... | @@ -214,9 +216,11 @@ Page({ |
214 | 216 | onShow: function () { |
215 | 217 | |
216 | 218 | this.data.paying = 0; |
217 | - | |
218 | 219 | console.log('onshow-2222'); |
219 | 220 | |
221 | + | |
222 | + this.updateOrderCoupon(); | |
223 | + | |
220 | 224 | var th = this; |
221 | 225 | //判断是不是第一次进入 |
222 | 226 | if (this.data.fir_in) { |
... | ... | @@ -1059,7 +1063,7 @@ Page({ |
1059 | 1063 | storeId: oo.stoid, |
1060 | 1064 | CashRepNo: quan_no, |
1061 | 1065 | WaresSum: th.data.ckeck_quan_price, |
1062 | - WareIds: th.data.check_quan_ware_list | |
1066 | + WareIds: th.data.check_quan_ware_list, | |
1063 | 1067 | } |
1064 | 1068 | }).then(res => { |
1065 | 1069 | if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { |
... | ... | @@ -2116,6 +2120,8 @@ Page({ |
2116 | 2120 | check_quan_price_list = '', |
2117 | 2121 | check_quan_ware_list = ''; |
2118 | 2122 | |
2123 | + let check_quan_price_scj=0; | |
2124 | + | |
2119 | 2125 | for (var i in goodlist) { |
2120 | 2126 | var gd = goodlist[i]; |
2121 | 2127 | //--如果是秒杀就跳出,如果是赠品,如果是组合购,如果是限制使用优惠券-- |
... | ... | @@ -2134,6 +2140,7 @@ Page({ |
2134 | 2140 | item_price = gd.account_fir * gd.goods_num; |
2135 | 2141 | } |
2136 | 2142 | ckeck_quan_price += item_price; |
2143 | + check_quan_price_scj += gd.market_price * gd.goods_num; | |
2137 | 2144 | |
2138 | 2145 | //--组装价格list-- |
2139 | 2146 | if (check_quan_price_list) { |
... | ... | @@ -2160,6 +2167,7 @@ Page({ |
2160 | 2167 | arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; |
2161 | 2168 | arr[ind].check_quan_ware_list = check_quan_ware_list; |
2162 | 2169 | arr[ind].check_quan_price_list = check_quan_price_list; |
2170 | + arr[ind].check_quan_price_scj = check_quan_price_scj; | |
2163 | 2171 | |
2164 | 2172 | //是否关闭使用优惠券 |
2165 | 2173 | if (th.data.is_close_quan != 1 && !is_xz_yh) { |
... | ... | @@ -2171,7 +2179,8 @@ Page({ |
2171 | 2179 | userId: app.globalData.user_id, |
2172 | 2180 | BuySum: ckeck_quan_price, |
2173 | 2181 | WareIds: check_quan_ware_list, |
2174 | - pageSize: 100 | |
2182 | + pageSize: 100, | |
2183 | + scj: check_quan_price_scj, | |
2175 | 2184 | } |
2176 | 2185 | }).then(res => { |
2177 | 2186 | console.error('优惠券1---------------------'); |
... | ... | @@ -2203,6 +2212,7 @@ Page({ |
2203 | 2212 | var quanlist = null, th = this, frozenQuan = null; |
2204 | 2213 | var allprice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num; |
2205 | 2214 | th.data.ckeck_quan_price = allprice; |
2215 | + th.data.check_quan_price_scj = this.data.goods.market_price* this.data.order_goods.goods_num; | |
2206 | 2216 | |
2207 | 2217 | //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- |
2208 | 2218 | if (th.data.is_close_quan != 1) { |
... | ... | @@ -2213,14 +2223,22 @@ Page({ |
2213 | 2223 | frozenQuan = res.data.data; |
2214 | 2224 | th.data.frozenQuan = frozenQuan; |
2215 | 2225 | } |
2226 | + | |
2227 | + let quan_rq={ | |
2228 | + storeId: oo.stoid, | |
2229 | + userId: app.globalData.user_id, | |
2230 | + BuySum: th.data.ckeck_quan_price, | |
2231 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
2232 | + pageSize: 100 | |
2233 | + }; | |
2234 | + | |
2235 | + if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){ | |
2236 | + quan_rq.BuyPosSum=th.data.ckeck_quan_price; | |
2237 | + quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list); | |
2238 | + } | |
2239 | + | |
2216 | 2240 | app.request.time_limit_get(6, url, { |
2217 | - data: { | |
2218 | - storeId: oo.stoid, | |
2219 | - userId: app.globalData.user_id, | |
2220 | - BuySum: th.data.ckeck_quan_price, | |
2221 | - WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
2222 | - pageSize: 100 | |
2223 | - }, | |
2241 | + data: quan_rq, | |
2224 | 2242 | success: function (res) { |
2225 | 2243 | console.error('优惠券2-------------------'); |
2226 | 2244 | if (res.data.code == 0) { |
... | ... | @@ -3202,6 +3220,10 @@ Page({ |
3202 | 3220 | icon: 'none', |
3203 | 3221 | duration: 2500 |
3204 | 3222 | }) |
3223 | + | |
3224 | + | |
3225 | + th.updateOrderCoupon(); //取消支付的时候 | |
3226 | + | |
3205 | 3227 | }) |
3206 | 3228 | // var n = t.data.data; |
3207 | 3229 | // th.weixinPay(n, |
... | ... | @@ -3801,6 +3823,25 @@ Page({ |
3801 | 3823 | getApp().goto("/pages/index/index/index"); |
3802 | 3824 | }, |
3803 | 3825 | |
3826 | + //优惠券锁定后解锁方法 | |
3827 | + async updateOrderCoupon(){ | |
3828 | + try{ | |
3829 | + let req_data={ | |
3830 | + store_id:oo.stoid, | |
3831 | + user_id:(getApp().globalData.userInfo.user_id || 0), | |
3832 | + order_id:this.data.order_id, | |
3833 | + } | |
3834 | + await getApp().request.promisePost("/api/weshop/order/updateOrderCoupon",{ | |
3835 | + is_json:1, | |
3836 | + data:req_data | |
3837 | + }).then(res=>{ | |
3838 | + console.log(111) | |
3839 | + }) | |
3840 | + }catch(error){ | |
3841 | + console.log(error) | |
3842 | + } | |
3843 | + } | |
3844 | + | |
3804 | 3845 | |
3805 | 3846 | |
3806 | 3847 | ... | ... |
packageC/pages/presell/cart/cart2.js
... | ... | @@ -71,6 +71,7 @@ Page({ |
71 | 71 | ckeck_quan_price: 0, |
72 | 72 | check_quan_price_list: '', |
73 | 73 | check_quan_ware_list: '', |
74 | + check_quan_price_scj: 0, | |
74 | 75 | |
75 | 76 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid |
76 | 77 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} |
... | ... | @@ -753,6 +754,7 @@ Page({ |
753 | 754 | th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; |
754 | 755 | th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; |
755 | 756 | th.data.check_quan_ware_list = t.data.data.erpwareid + ""; |
757 | + th.data.check_quan_price_scj =t.data.data.market_price * gg.goods_num; | |
756 | 758 | } |
757 | 759 | else |
758 | 760 | { |
... | ... | @@ -771,12 +773,10 @@ Page({ |
771 | 773 | act: act |
772 | 774 | }); |
773 | 775 | |
774 | - | |
775 | - | |
776 | 776 | //计算价格 |
777 | 777 | th.calculatePrice2(); |
778 | 778 | //获取优惠券,如果有券的钱,就调用 |
779 | - if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan(); | |
779 | + if (th.data.check_quan_ware_list) th.get_buy_now_quan(); | |
780 | 780 | |
781 | 781 | }, |
782 | 782 | }); |
... | ... | @@ -3303,14 +3303,22 @@ Page({ |
3303 | 3303 | frozenQuan = res.data.data; |
3304 | 3304 | th.data.frozenQuan = frozenQuan; |
3305 | 3305 | } |
3306 | + | |
3307 | + let quan_req= { | |
3308 | + storeId: oo.stoid, | |
3309 | + userId: app.globalData.user_id, | |
3310 | + BuySum: th.data.ckeck_quan_price, | |
3311 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
3312 | + pageSize: 100 | |
3313 | + }; | |
3314 | + | |
3315 | + if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){ | |
3316 | + quan_req.BuyPosSum=th.data.ckeck_quan_price | |
3317 | + quan_req.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list) | |
3318 | + } | |
3319 | + | |
3306 | 3320 | app.request.time_limit_get(6, url, { |
3307 | - data: { | |
3308 | - storeId: oo.stoid, | |
3309 | - userId: app.globalData.user_id, | |
3310 | - BuySum: th.data.ckeck_quan_price, | |
3311 | - WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
3312 | - pageSize: 100 | |
3313 | - }, | |
3321 | + data:quan_req, | |
3314 | 3322 | success: function (res) { |
3315 | 3323 | if (res.data.code == 0) { |
3316 | 3324 | quanlist = res.data.data.pageData; | ... | ... |
packageD/pages/user/coupons/coupons.json
packageD/pages/user/coupons/coupons.wxml
1 | 1 | <wxs module="filter" src="filter.wxs"></wxs> |
2 | 2 | <wxs module="time" src="../../../../utils/filter.wxs"></wxs> |
3 | 3 | |
4 | +<com_top_nav title="我的优惠券"></com_top_nav> | |
5 | + | |
4 | 6 | <view> |
5 | 7 | |
6 | 8 | <view class="tab-head" bindtap="clickTab"> |
... | ... | @@ -35,7 +37,7 @@ |
35 | 37 | </view> |
36 | 38 | <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}"> |
37 | 39 | <!--<text class="{{detail.isShowDetails ? '':'ellipsis-1x'}}">使用说明: 包邮券,全场通用,满 {{detail.condition}}元使用{{detail.title?',不包邮地区:'+detail.title:''}}</text>--> |
38 | - <text class="{{detail.isShowDetails ? '':'ellipsis-1x'}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.showtypeName(detail.type)}}【消费满{{time.toFix(detail.condition,2)}}元可用】</text> | |
40 | + <text class="{{detail.isShowDetails ? '':'ellipsis-1x'}}"><text style="margin-right: 15rpx">使用说明:</text>{{filter.showtypeName(detail.type)}}【消费满{{time.toFix(detail.condition,2)}}元可用】 </text> | |
39 | 41 | </view> |
40 | 42 | </block> |
41 | 43 | |
... | ... | @@ -64,8 +66,10 @@ |
64 | 66 | </view> |
65 | 67 | </view> |
66 | 68 | <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}}、使用场景:{{ (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 | + <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:if="{{detail.Remark1!=''}}"> | |
70 | + <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 ? '仅线下可用' : '仅线上可用') :'通用'}} 取价规则:<block wx:if="{{detail.FactPriceType>0}}">零售价</block> <block wx:else >实收价</block></view> | |
71 | + <view class="{{detail.isShowDetails ? '':'ellipsis-1x'}}" wx:else> | |
72 | + <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 ? '仅线下可用' : '仅线上可用') :'通用'}} 取价规则:<block wx:if="{{detail.FactPriceType>0}}">零售价</block> <block wx:else>实收价</block></view> | |
69 | 73 | </view> |
70 | 74 | </block> |
71 | 75 | </view> | ... | ... |
packageE/pages/cart/cart2/cart2.js
... | ... | @@ -194,6 +194,7 @@ Page({ |
194 | 194 | def_coupon2: null,//直接购买优惠券列表 |
195 | 195 | def_coupon3: null,//购物车包邮券列表 |
196 | 196 | def_coupon4: null,//直接购买包邮券列表 |
197 | + | |
197 | 198 | }, |
198 | 199 | |
199 | 200 | |
... | ... | @@ -1895,7 +1896,8 @@ Page({ |
1895 | 1896 | |
1896 | 1897 | t.data.data.original_img = oo.imghost + t.data.data.original_img; |
1897 | 1898 | t.data.data['buynum'] = gg.goods_num; |
1898 | - var distr_t = 0, et = 0 | |
1899 | + var distr_t = 0, et = 0; | |
1900 | + | |
1899 | 1901 | |
1900 | 1902 | if (t.data.data.is_minishop == 1 && getApp().is_sp_hao()) { |
1901 | 1903 | |
... | ... | @@ -2379,7 +2381,7 @@ Page({ |
2379 | 2381 | //-- 计算价格 -- |
2380 | 2382 | th.calculatePrice2(); |
2381 | 2383 | //获取优惠券,如果有券的钱,就调用 |
2382 | - if (th.data.ckeck_quan_price > 0) th.get_buy_now_quan(); | |
2384 | + if (th.data.check_quan_ware_list ) th.get_buy_now_quan(); | |
2383 | 2385 | |
2384 | 2386 | } |
2385 | 2387 | |
... | ... | @@ -3239,14 +3241,32 @@ Page({ |
3239 | 3241 | //普通券的时候 |
3240 | 3242 | if (quan_no && th.data.using_quan[pickid].isby != 1) { |
3241 | 3243 | var IsUserWare = 1; |
3244 | + let is_quan_scj=0; | |
3245 | + let get_c_price_data={ | |
3246 | + storeId: oo.stoid, | |
3247 | + CashRepNo: quan_no, | |
3248 | + WaresSum: cart_item.check_quan_price_list, | |
3249 | + WareIds: cart_item.check_quan_ware_list | |
3250 | + }; | |
3251 | + | |
3252 | + //-- 如果是零售价的时候 --- | |
3253 | + if(th.data.using_quan[pickid].FactPriceType){ | |
3254 | + let scj_arr=c_arr[i].scj_arr; | |
3255 | + let scj_check_quan_price_list=''; | |
3256 | + let scj_check_quan_ware_list=''; | |
3257 | + for (let jh = 0; jh <scj_arr.length ; jh++) { | |
3258 | + scj_check_quan_price_list+=(scj_arr[jh].sum_price+",") | |
3259 | + scj_check_quan_ware_list+=(scj_arr[jh].erpwareid+",") | |
3260 | + } | |
3261 | + | |
3262 | + get_c_price_data.WaresSum= ut.sub_last(scj_check_quan_price_list); | |
3263 | + get_c_price_data.WareIds= ut.sub_last(scj_check_quan_ware_list); | |
3264 | + is_quan_scj=1; | |
3265 | + } | |
3266 | + | |
3242 | 3267 | //---获取优惠券优惠--- |
3243 | 3268 | await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { |
3244 | - data: { | |
3245 | - storeId: oo.stoid, | |
3246 | - CashRepNo: quan_no, | |
3247 | - WaresSum: cart_item.check_quan_price_list, | |
3248 | - WareIds: cart_item.check_quan_ware_list | |
3249 | - } | |
3269 | + data:get_c_price_data | |
3250 | 3270 | }).then(res => { |
3251 | 3271 | if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { |
3252 | 3272 | var q_data = res.data.data; |
... | ... | @@ -3280,7 +3300,7 @@ Page({ |
3280 | 3300 | for (var kk in cart_item.quan_youhui_list) { |
3281 | 3301 | var you_item = cart_item.quan_youhui_list[kk]; |
3282 | 3302 | //-- 对券的价格进行平摊 -- |
3283 | - await th.split_set_goods_quanprice(you_item, cart_item); | |
3303 | + await th.split_set_goods_quanprice(you_item, cart_item,is_quan_scj); | |
3284 | 3304 | } |
3285 | 3305 | } |
3286 | 3306 | |
... | ... | @@ -5529,15 +5549,14 @@ Page({ |
5529 | 5549 | |
5530 | 5550 | //房间号的ids |
5531 | 5551 | var room_ids = ""; |
5532 | - | |
5533 | - //-- 把券的钱,写入从表 --- | |
5534 | - if (t_item.quan_youhui_list && t_item.coupon_price) { | |
5535 | - for (var kk in t_item.quan_youhui_list) { | |
5536 | - var you_item = t_item.quan_youhui_list[kk]; | |
5537 | - //-- 对券的价格进行平摊 -- | |
5538 | - await th.split_set_goods_quanprice(you_item, t_item); | |
5539 | - } | |
5540 | - } | |
5552 | + //-- 把券的钱,写入从表,前面已经摊了一次了,不要再摊第二次 --- | |
5553 | + // if (t_item.quan_youhui_list && t_item.coupon_price) { | |
5554 | + // for (var kk in t_item.quan_youhui_list) { | |
5555 | + // var you_item = t_item.quan_youhui_list[kk]; | |
5556 | + // //-- 对券的价格进行平摊 -- | |
5557 | + // await th.split_set_goods_quanprice(you_item, t_item); | |
5558 | + // } | |
5559 | + // } | |
5541 | 5560 | |
5542 | 5561 | //看一下有没有活动不参与的,要记录到order_more表中 |
5543 | 5562 | let can_cx = t_item.show_can_cx; |
... | ... | @@ -5968,9 +5987,6 @@ Page({ |
5968 | 5987 | console.log("--str--"); |
5969 | 5988 | console.log(str); |
5970 | 5989 | |
5971 | - | |
5972 | - // return false; | |
5973 | - | |
5974 | 5990 | wx.showLoading({ title: "加载中" }); |
5975 | 5991 | th.setData({ submit: 1, }) |
5976 | 5992 | wx.request({ |
... | ... | @@ -6974,7 +6990,15 @@ Page({ |
6974 | 6990 | using_quan[pickid].isby = 1; |
6975 | 6991 | } else { |
6976 | 6992 | if (using_quan[pickid]) old_quan = using_quan[pickid]; |
6977 | - using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 }; | |
6993 | + | |
6994 | + let using_data={ coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 }; | |
6995 | + | |
6996 | + //-- 优化判断是有使用零售价的时候 -- | |
6997 | + if(item.FactPriceType){ | |
6998 | + using_data.FactPriceType=1; | |
6999 | + } | |
7000 | + | |
7001 | + using_quan[pickid] =using_data ; | |
6978 | 7002 | using_quan[pickid].isby = 0; |
6979 | 7003 | } |
6980 | 7004 | this.setData({ using_quan: using_quan }); |
... | ... | @@ -7195,6 +7219,8 @@ Page({ |
7195 | 7219 | check_quan_price_list_arr = [], |
7196 | 7220 | check_quan_ware_list_arr = []; |
7197 | 7221 | |
7222 | + let ck_price_scj=0; //市场价的优化 | |
7223 | + | |
7198 | 7224 | for (var i in goodlist) { |
7199 | 7225 | var gd = goodlist[i]; |
7200 | 7226 | //--如果是秒杀就跳出,如果是赠品,如果是组合购限制使用优惠券-- |
... | ... | @@ -7238,6 +7264,10 @@ Page({ |
7238 | 7264 | } |
7239 | 7265 | } |
7240 | 7266 | |
7267 | + if(gd.is_collocation && gd.market_price && !gd.goods_market_price){ | |
7268 | + gd.goods_market_price=gd.market_price; | |
7269 | + } | |
7270 | + | |
7241 | 7271 | //如果有限制使用优惠券,就要返回 |
7242 | 7272 | if (gd.prom_type == 3) { |
7243 | 7273 | |
... | ... | @@ -7248,16 +7278,33 @@ Page({ |
7248 | 7278 | } |
7249 | 7279 | var item_price = gd.goods_price * gd.goods_num; |
7250 | 7280 | var item_price2 = item_price; |
7281 | + var real_price=gd.goods_price; | |
7251 | 7282 | |
7252 | 7283 | //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- |
7253 | 7284 | if (gd.account_fir != null && gd.account_fir != undefined) { |
7254 | 7285 | item_price2 = gd.account_fir * gd.goods_num; |
7286 | + real_price=gd.account_fir; | |
7255 | 7287 | } |
7256 | 7288 | |
7257 | 7289 | if (gd.ld_account) { |
7258 | 7290 | item_price2 = gd.ld_account * gd.goods_num; |
7291 | + real_price=gd.ld_account; | |
7259 | 7292 | } |
7260 | 7293 | ckeck_quan_price += item_price; |
7294 | + | |
7295 | + //如果实收价等于市场价的死后 | |
7296 | + if(real_price>=gd.goods_market_price){ | |
7297 | + ck_price_scj+= real_price * gd.goods_num; //市场价的优化 | |
7298 | + if(!arr[ind].scj_arr) arr[ind].scj_arr=[]; //组装市场价的数组,如果优惠券使用了零售价的券,就要带入使用券的接口 | |
7299 | + arr[ind].scj_arr.push({ | |
7300 | + sum_price:real_price * gd.goods_num, | |
7301 | + index: parseInt(i), | |
7302 | + goods_id:gd.goods_id, | |
7303 | + erpwareid:gd.erpwareid | |
7304 | + }) | |
7305 | + } | |
7306 | + | |
7307 | + | |
7261 | 7308 | //如果商品有重复的过滤,一般是组合购和阶梯购的情况下 |
7262 | 7309 | var idx = check_quan_ware_list_arr.findIndex(function (ele) { |
7263 | 7310 | return ele == encodeURIComponent(gd['erpwareid']); |
... | ... | @@ -7323,18 +7370,31 @@ Page({ |
7323 | 7370 | arr[ind].check_quan_price_list = check_quan_price_list; |
7324 | 7371 | arr[ind].quan_list = null; |
7325 | 7372 | |
7373 | + var quan_req= { | |
7374 | + storeId: oo.stoid, | |
7375 | + userId: app.globalData.user_id, | |
7376 | + BuySum: arr[ind].ckeck_quan_price, | |
7377 | + WareIds: check_quan_ware_list, | |
7378 | + pageSize: 100 | |
7379 | + } | |
7380 | + | |
7381 | + if(arr[ind].scj_arr && arr[ind].scj_arr.length ){ | |
7382 | + quan_req.BuyPosSum=ck_price_scj //优化获取市场价的优惠券 | |
7383 | + | |
7384 | + let PosWareIds=[]; | |
7385 | + for (let is = 0; is < arr[ind].scj_arr.length; is++) { | |
7386 | + PosWareIds.push(arr[ind].scj_arr[is].erpwareid) | |
7387 | + } | |
7388 | + | |
7389 | + quan_req.PosWareIds=PosWareIds.join() //优化获取市场价的优惠券 | |
7390 | + } | |
7391 | + | |
7326 | 7392 | //-- 是否关闭使用优惠券,循环有找到商品 -- |
7327 | 7393 | if (th.data.is_close_quan != 1 && check_quan_ware_list) { |
7328 | 7394 | //--调用接口,获取优惠券的列表,3秒钟内控制接口请求-- |
7329 | 7395 | var url = "/api/weshop/couponList/getUseCouponList"; |
7330 | 7396 | await app.request.promiseGet(url, { |
7331 | - data: { | |
7332 | - storeId: oo.stoid, | |
7333 | - userId: app.globalData.user_id, | |
7334 | - BuySum: arr[ind].ckeck_quan_price, | |
7335 | - WareIds: check_quan_ware_list, | |
7336 | - pageSize: 100 | |
7337 | - } | |
7397 | + data:quan_req | |
7338 | 7398 | }).then(res => { |
7339 | 7399 | console.error('优惠券111111111111'); |
7340 | 7400 | if (res.data.code == 0) { |
... | ... | @@ -7383,7 +7443,7 @@ Page({ |
7383 | 7443 | //}) |
7384 | 7444 | }, |
7385 | 7445 | |
7386 | - //------ 获取立即购买的购物车的劵 -------- | |
7446 | + //------ 获取立即购买的购物车的劵,因为立即购买只有一个商品 -------- | |
7387 | 7447 | get_buy_now_quan: function () { |
7388 | 7448 | var quanlist = null, th = this, frozenQuan = null; |
7389 | 7449 | var good = this.data.bn_goods; |
... | ... | @@ -7404,14 +7464,23 @@ Page({ |
7404 | 7464 | frozenQuan = res.data.data; |
7405 | 7465 | th.data.frozenQuan = frozenQuan; |
7406 | 7466 | } |
7467 | + | |
7468 | + let get_q_req={ | |
7469 | + storeId: oo.stoid, | |
7470 | + userId: app.globalData.user_id, | |
7471 | + BuySum: th.data.ckeck_quan_price, | |
7472 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
7473 | + pageSize: 100 | |
7474 | + }; | |
7475 | + | |
7476 | + var gg = to.get_b_now(); | |
7477 | + if(th.data.ckeck_quan_price>= good.market_price* gg.goods_num){ | |
7478 | + get_q_req.BuyPosSum=th.data.ckeck_quan_price //优化获取市场价的优惠券 | |
7479 | + get_q_req.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list) //优化获取市场价的优惠券 | |
7480 | + } | |
7481 | + | |
7407 | 7482 | app.request.time_limit_get(6, url, { |
7408 | - data: { | |
7409 | - storeId: oo.stoid, | |
7410 | - userId: app.globalData.user_id, | |
7411 | - BuySum: th.data.ckeck_quan_price, | |
7412 | - WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
7413 | - pageSize: 100 | |
7414 | - }, | |
7483 | + data:get_q_req , | |
7415 | 7484 | success: function (res) { |
7416 | 7485 | console.error('优惠券22222222222222222'); |
7417 | 7486 | if (res.data.code == 0) { |
... | ... | @@ -8221,12 +8290,24 @@ Page({ |
8221 | 8290 | }, |
8222 | 8291 | |
8223 | 8292 | //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 |
8224 | - split_set_goods_quanprice: async function (you_item, t_item) { | |
8293 | + split_set_goods_quanprice: async function (you_item, t_item,is_quan_scj) { | |
8225 | 8294 | var coupon_price = you_item.WareCashSum; |
8226 | 8295 | var goods = t_item.goods; |
8227 | 8296 | var arr = []; |
8297 | + | |
8298 | + if(!t_item.quan_no) t_item.quan_no=you_item.CashRepNo; | |
8299 | + | |
8228 | 8300 | //判断是不是有goods_id重复 |
8229 | 8301 | for (var i = 0; i < goods.length; i++) { |
8302 | + | |
8303 | + if(is_quan_scj){ | |
8304 | + let fd=t_item.scj_arr.find(function (e){ | |
8305 | + return e.index==i && e.erpwareid==you_item.WareId; | |
8306 | + }) | |
8307 | + //不是零售价的商品,就进入下一轮 | |
8308 | + if(!fd) continue; | |
8309 | + } | |
8310 | + | |
8230 | 8311 | if (goods[i].erpwareid == you_item.WareId) { |
8231 | 8312 | var gg_ite = { |
8232 | 8313 | goods_id: goods[i].goods_id, |
... | ... | @@ -9189,7 +9270,6 @@ Page({ |
9189 | 9270 | var cx_prom_group = this.data.cartlist[idx].show_can_cx[gd_key].act_arr; |
9190 | 9271 | |
9191 | 9272 | var cx_arr = []; |
9192 | - | |
9193 | 9273 | for (var h = 0; h < cx_prom_group.length; h++) { |
9194 | 9274 | cx_prom_group[h].act.sele = 0; |
9195 | 9275 | //-- 看有没有选中的活动 -- |
... | ... | @@ -9221,11 +9301,16 @@ Page({ |
9221 | 9301 | |
9222 | 9302 | //-- 切换活动的时候,让订单促销参与不选中 -- |
9223 | 9303 | let tt_wd = "can_use_ord_prom[" + pk + "]"; |
9304 | + | |
9305 | + let using_quan =this.data.using_quan; | |
9306 | + using_quan[pk]={}; | |
9307 | + | |
9224 | 9308 | th.setData({ |
9225 | 9309 | send_lb: {}, |
9226 | 9310 | month_lb: {}, |
9227 | 9311 | send_gf: {}, |
9228 | - [tt_wd]: 0 | |
9312 | + [tt_wd]: 0, | |
9313 | + using_quan:using_quan | |
9229 | 9314 | }) |
9230 | 9315 | |
9231 | 9316 | th.data.prom_goods_map = {}; | ... | ... |
packageE/pages/cart/cart2/cart2.wxml
packageE/pages/cart/cart2/remark_part_qj.wxml
0 → 100644
1 | +<view class="xc-buttom " wx:if="{{item.is_open==1}}" > | |
2 | + <view style="padding:10rpx"> | |
3 | + <text class="five-level-word explain-coupon" wx:if="{{item.Remark}}">{{util.format(item.Remark)}}</text> | |
4 | + <text class="five-level-word explain-coupon" wx:else> | |
5 | + <block wx:if="{{item.UseObjectName}}">仅{{item.UseObjectName}}使用</block> | |
6 | + <block wx:else>全场通用</block> | |
7 | + </text> | |
8 | + <text class="five-level-word explain-coupon">取价规则:<block wx:if="{{item.FactPriceType>0}}">零售价</block><block wx:wx:else="{{item.FactPriceType>0}}">实收价</block></text> | |
9 | + </view> | |
10 | +</view> | |
0 | 11 | \ No newline at end of file | ... | ... |
packageE/pages/cart/cart2_pt/cart2_pt.js
... | ... | @@ -82,6 +82,7 @@ Page({ |
82 | 82 | ckeck_quan_price: 0, |
83 | 83 | check_quan_price_list: '', |
84 | 84 | check_quan_ware_list: '', |
85 | + check_quan_price_scj:0, //市场价的时候 | |
85 | 86 | |
86 | 87 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid |
87 | 88 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} |
... | ... | @@ -511,12 +512,21 @@ Page({ |
511 | 512 | |
512 | 513 | |
513 | 514 | th.calculatePrice2(); |
515 | + | |
516 | + th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; | |
517 | + th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; | |
518 | + th.data.check_quan_ware_list = t.data.data.erpwareid + ""; | |
519 | + th.data.check_quan_price_scj = t.data.data.market_price * gg.goods_num; | |
520 | + | |
521 | + th.get_buy_now_quan(); | |
522 | + | |
514 | 523 | } else { |
515 | 524 | |
516 | 525 | |
517 | 526 | th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; |
518 | 527 | th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; |
519 | 528 | th.data.check_quan_ware_list = t.data.data.erpwareid + ""; |
529 | + th.data.check_quan_price_scj = t.data.data.market_price * gg.goods_num; | |
520 | 530 | |
521 | 531 | gd.prom_id = gg.prom_id; |
522 | 532 | //--阶梯团很特殊,不能用总表来拿价格-- |
... | ... | @@ -1995,14 +2005,22 @@ Page({ |
1995 | 2005 | frozenQuan = res.data.data; |
1996 | 2006 | th.data.frozenQuan = frozenQuan; |
1997 | 2007 | } |
2008 | + | |
2009 | + let quan_rq={ | |
2010 | + storeId: oo.stoid, | |
2011 | + userId: app.globalData.user_id, | |
2012 | + BuySum: th.data.ckeck_quan_price, | |
2013 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
2014 | + pageSize: 100, | |
2015 | + }; | |
2016 | + | |
2017 | + if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){ | |
2018 | + quan_rq.BuyPosSum=th.data.ckeck_quan_price; | |
2019 | + quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list) | |
2020 | + } | |
2021 | + | |
1998 | 2022 | app.request.time_limit_get(6, url, { |
1999 | - data: { | |
2000 | - storeId: oo.stoid, | |
2001 | - userId: app.globalData.user_id, | |
2002 | - BuySum: th.data.ckeck_quan_price, | |
2003 | - WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
2004 | - pageSize: 100 | |
2005 | - }, | |
2023 | + data: quan_rq, | |
2006 | 2024 | success: function (res) { |
2007 | 2025 | if (res.data.code == 0) { |
2008 | 2026 | quanlist = res.data.data.pageData; | ... | ... |
packageE/pages/cart/cart_wk/cart_wk.js
... | ... | @@ -62,6 +62,8 @@ Page({ |
62 | 62 | check_quan_price_list: '', |
63 | 63 | check_quan_ware_list: '', |
64 | 64 | |
65 | + check_quan_price_scj:0, //市场价取价 | |
66 | + | |
65 | 67 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid |
66 | 68 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} |
67 | 69 | using_quan: {}, |
... | ... | @@ -117,6 +119,8 @@ Page({ |
117 | 119 | */ |
118 | 120 | onShow: function () { |
119 | 121 | |
122 | + this.updateOrderCoupon(); | |
123 | + | |
120 | 124 | var th = this; |
121 | 125 | //判断是不是第一次进入 |
122 | 126 | if(this.data.fir_in){ |
... | ... | @@ -479,6 +483,10 @@ Page({ |
479 | 483 | th.data.ckeck_quan_price = q_ch_money; |
480 | 484 | th.data.check_quan_price_list = q_ch_money + ""; |
481 | 485 | th.data.check_quan_ware_list = goods.erpwareid + ""; |
486 | + | |
487 | + let scj_money= parseFloat( order.market_price * order_goods.goods_num).toFixed(2); | |
488 | + th.data.check_quan_price_scj = scj_money; | |
489 | + | |
482 | 490 | }else{ |
483 | 491 | goods.is_xz_yh = 1; |
484 | 492 | } |
... | ... | @@ -664,6 +672,17 @@ Page({ |
664 | 672 | //--弹起支付框-- |
665 | 673 | to_pay() { |
666 | 674 | |
675 | + let order=this.data.order; | |
676 | + let formData=this.data.formData; | |
677 | + let exp_price=this.data.exp_price; | |
678 | + let bn_use_commission=this.data.bn_use_commission; | |
679 | + | |
680 | + //如果支付为0的时候 | |
681 | + if(order.tail_money+exp_price-formData.coupon_price-(bn_use_commission?goods.use_commission:0)-(formData.order_prom_amount?formData.order_prom_amount:0)<=0 ){ | |
682 | + this.to_pay_type(1); | |
683 | + return false; | |
684 | + } | |
685 | + | |
667 | 686 | //如果有再计算价格的过程中,不能提交订单 |
668 | 687 | if(this.data.submit){ return false} |
669 | 688 | if(!this.data.same_ok){ return false} |
... | ... | @@ -791,6 +810,8 @@ Page({ |
791 | 810 | },function (){ |
792 | 811 | th.data.paying=0; |
793 | 812 | //getApp().my_warnning("支付失败", 0, th); |
813 | + | |
814 | + th.updateOrderCoupon(); //取消祝福 | |
794 | 815 | }) |
795 | 816 | |
796 | 817 | //var n = t.data.data; |
... | ... | @@ -1520,23 +1541,34 @@ Page({ |
1520 | 1541 | if (good.whsle_id) return false; |
1521 | 1542 | if(!th.data.check_quan_ware_list) return false; |
1522 | 1543 | |
1544 | + | |
1545 | + | |
1546 | + | |
1523 | 1547 | //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- |
1524 | 1548 | if (th.data.is_close_quan != 1 && good.is_xz_yh != 1 && th.data.check_quan_ware_list) { |
1525 | 1549 | var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; |
1526 | 1550 | var url = "/api/weshop/couponList/getUseCouponList"; |
1551 | + | |
1552 | + let quan_rq={ | |
1553 | + storeId: oo.stoid, | |
1554 | + userId: app.globalData.user_id, | |
1555 | + BuySum: th.data.ckeck_quan_price, | |
1556 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
1557 | + pageSize: 100, | |
1558 | + }; | |
1559 | + | |
1560 | + if(th.data.ckeck_quan_price>=th.data.check_quan_price_scj){ | |
1561 | + quan_rq.BuyPosSum=th.data.ckeck_quan_price; | |
1562 | + quan_rq.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list) | |
1563 | + } | |
1564 | + | |
1527 | 1565 | app.request.promiseGet(url0, { 1: 1 }).then(res => { |
1528 | 1566 | if (res.data.code == 0) { |
1529 | 1567 | frozenQuan = res.data.data; |
1530 | 1568 | th.data.frozenQuan = frozenQuan; |
1531 | 1569 | } |
1532 | 1570 | app.request.time_limit_get(6, url, { |
1533 | - data: { | |
1534 | - storeId: oo.stoid, | |
1535 | - userId: app.globalData.user_id, | |
1536 | - BuySum: th.data.ckeck_quan_price, | |
1537 | - WareIds: encodeURIComponent(th.data.check_quan_ware_list), | |
1538 | - pageSize: 100 | |
1539 | - }, | |
1571 | + data: quan_rq, | |
1540 | 1572 | success: function (res) { |
1541 | 1573 | if (res.data.code == 0) { |
1542 | 1574 | quanlist = res.data.data.pageData; |
... | ... | @@ -2227,6 +2259,24 @@ Page({ |
2227 | 2259 | th.setData({ open_quan: 0 }); |
2228 | 2260 | }, |
2229 | 2261 | |
2262 | + //优惠券锁定后解锁方法 | |
2263 | + async updateOrderCoupon(){ | |
2264 | + try{ | |
2265 | + let req_data={ | |
2266 | + store_id:oo.stoid, | |
2267 | + user_id:(getApp().globalData.userInfo.user_id || 0), | |
2268 | + order_id:this.data.order_id, | |
2269 | + } | |
2270 | + await getApp().request.promisePost("/api/weshop/order/updateOrderCoupon",{ | |
2271 | + is_json:1, | |
2272 | + data:req_data | |
2273 | + }).then(res=>{ | |
2274 | + console.log(111) | |
2275 | + }) | |
2276 | + }catch(error){ | |
2277 | + | |
2278 | + } | |
2279 | + } | |
2230 | 2280 | |
2231 | 2281 | |
2232 | 2282 | ... | ... |
pages/user/assistance/giftpacklist.js
... | ... | @@ -218,9 +218,10 @@ Page({ |
218 | 218 | "actId": th.data.id, //活动Id |
219 | 219 | "actType": 5, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 |
220 | 220 | //"giftBagId": 1, //礼包Id |
221 | - "giftBagId": th.giftBagId, //礼包Id | |
221 | + "giftBagId": th.giftBagId, //礼包Id | |
222 | 222 | "storeId": a.stoid, //商家Id |
223 | - "userId": d.user_id //用户ID | |
223 | + "userId": d.user_id, //用户ID | |
224 | + "buyFrom":2 //小程序领取 | |
224 | 225 | }; |
225 | 226 | var data = JSON.stringify(json); |
226 | 227 | var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; | ... | ... |