Commit 1e4c316879e1efa4d10ed80b1406bb31041ddae6
Merge branch 'qa' of http://git.vipzhuang.cn/wxd/MShopWeApp
Showing
10 changed files
with
312 additions
and
82 deletions
packageC/pages/presell/cart/cart.js
| @@ -62,6 +62,8 @@ Page({ | @@ -62,6 +62,8 @@ Page({ | ||
| 62 | ckeck_quan_price: 0, | 62 | ckeck_quan_price: 0, |
| 63 | check_quan_price_list: '', | 63 | check_quan_price_list: '', |
| 64 | check_quan_ware_list: '', | 64 | check_quan_ware_list: '', |
| 65 | + ckeck_quan_price_scj: 0, //优惠券用市场价进行获取 | ||
| 66 | + | ||
| 65 | isget_by_quan: {}, //是否调用了接口获取包邮券 | 67 | isget_by_quan: {}, //是否调用了接口获取包邮券 |
| 66 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid | 68 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid |
| 67 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} | 69 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} |
| @@ -214,9 +216,11 @@ Page({ | @@ -214,9 +216,11 @@ Page({ | ||
| 214 | onShow: function () { | 216 | onShow: function () { |
| 215 | 217 | ||
| 216 | this.data.paying = 0; | 218 | this.data.paying = 0; |
| 217 | - | ||
| 218 | console.log('onshow-2222'); | 219 | console.log('onshow-2222'); |
| 219 | 220 | ||
| 221 | + | ||
| 222 | + this.updateOrderCoupon(); | ||
| 223 | + | ||
| 220 | var th = this; | 224 | var th = this; |
| 221 | //判断是不是第一次进入 | 225 | //判断是不是第一次进入 |
| 222 | if (this.data.fir_in) { | 226 | if (this.data.fir_in) { |
| @@ -1059,7 +1063,7 @@ Page({ | @@ -1059,7 +1063,7 @@ Page({ | ||
| 1059 | storeId: oo.stoid, | 1063 | storeId: oo.stoid, |
| 1060 | CashRepNo: quan_no, | 1064 | CashRepNo: quan_no, |
| 1061 | WaresSum: th.data.ckeck_quan_price, | 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 | }).then(res => { | 1068 | }).then(res => { |
| 1065 | if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | 1069 | if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { |
| @@ -2116,6 +2120,8 @@ Page({ | @@ -2116,6 +2120,8 @@ Page({ | ||
| 2116 | check_quan_price_list = '', | 2120 | check_quan_price_list = '', |
| 2117 | check_quan_ware_list = ''; | 2121 | check_quan_ware_list = ''; |
| 2118 | 2122 | ||
| 2123 | + let check_quan_price_scj=0; | ||
| 2124 | + | ||
| 2119 | for (var i in goodlist) { | 2125 | for (var i in goodlist) { |
| 2120 | var gd = goodlist[i]; | 2126 | var gd = goodlist[i]; |
| 2121 | //--如果是秒杀就跳出,如果是赠品,如果是组合购,如果是限制使用优惠券-- | 2127 | //--如果是秒杀就跳出,如果是赠品,如果是组合购,如果是限制使用优惠券-- |
| @@ -2134,6 +2140,7 @@ Page({ | @@ -2134,6 +2140,7 @@ Page({ | ||
| 2134 | item_price = gd.account_fir * gd.goods_num; | 2140 | item_price = gd.account_fir * gd.goods_num; |
| 2135 | } | 2141 | } |
| 2136 | ckeck_quan_price += item_price; | 2142 | ckeck_quan_price += item_price; |
| 2143 | + check_quan_price_scj += gd.market_price * gd.goods_num; | ||
| 2137 | 2144 | ||
| 2138 | //--组装价格list-- | 2145 | //--组装价格list-- |
| 2139 | if (check_quan_price_list) { | 2146 | if (check_quan_price_list) { |
| @@ -2160,6 +2167,7 @@ Page({ | @@ -2160,6 +2167,7 @@ Page({ | ||
| 2160 | arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; | 2167 | arr[ind].ckeck_quan_price = ckeck_quan_price - cut_price; |
| 2161 | arr[ind].check_quan_ware_list = check_quan_ware_list; | 2168 | arr[ind].check_quan_ware_list = check_quan_ware_list; |
| 2162 | arr[ind].check_quan_price_list = check_quan_price_list; | 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 | if (th.data.is_close_quan != 1 && !is_xz_yh) { | 2173 | if (th.data.is_close_quan != 1 && !is_xz_yh) { |
| @@ -2171,7 +2179,8 @@ Page({ | @@ -2171,7 +2179,8 @@ Page({ | ||
| 2171 | userId: app.globalData.user_id, | 2179 | userId: app.globalData.user_id, |
| 2172 | BuySum: ckeck_quan_price, | 2180 | BuySum: ckeck_quan_price, |
| 2173 | WareIds: check_quan_ware_list, | 2181 | WareIds: check_quan_ware_list, |
| 2174 | - pageSize: 100 | 2182 | + pageSize: 100, |
| 2183 | + scj: check_quan_price_scj, | ||
| 2175 | } | 2184 | } |
| 2176 | }).then(res => { | 2185 | }).then(res => { |
| 2177 | console.error('优惠券1---------------------'); | 2186 | console.error('优惠券1---------------------'); |
| @@ -2203,6 +2212,7 @@ Page({ | @@ -2203,6 +2212,7 @@ Page({ | ||
| 2203 | var quanlist = null, th = this, frozenQuan = null; | 2212 | var quanlist = null, th = this, frozenQuan = null; |
| 2204 | var allprice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num; | 2213 | var allprice = this.data.pre_arr.presell_price * this.data.order_goods.goods_num; |
| 2205 | th.data.ckeck_quan_price = allprice; | 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 | if (th.data.is_close_quan != 1) { | 2218 | if (th.data.is_close_quan != 1) { |
| @@ -2213,14 +2223,22 @@ Page({ | @@ -2213,14 +2223,22 @@ Page({ | ||
| 2213 | frozenQuan = res.data.data; | 2223 | frozenQuan = res.data.data; |
| 2214 | th.data.frozenQuan = frozenQuan; | 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 | app.request.time_limit_get(6, url, { | 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 | success: function (res) { | 2242 | success: function (res) { |
| 2225 | console.error('优惠券2-------------------'); | 2243 | console.error('优惠券2-------------------'); |
| 2226 | if (res.data.code == 0) { | 2244 | if (res.data.code == 0) { |
| @@ -3202,6 +3220,10 @@ Page({ | @@ -3202,6 +3220,10 @@ Page({ | ||
| 3202 | icon: 'none', | 3220 | icon: 'none', |
| 3203 | duration: 2500 | 3221 | duration: 2500 |
| 3204 | }) | 3222 | }) |
| 3223 | + | ||
| 3224 | + | ||
| 3225 | + th.updateOrderCoupon(); //取消支付的时候 | ||
| 3226 | + | ||
| 3205 | }) | 3227 | }) |
| 3206 | // var n = t.data.data; | 3228 | // var n = t.data.data; |
| 3207 | // th.weixinPay(n, | 3229 | // th.weixinPay(n, |
| @@ -3801,6 +3823,25 @@ Page({ | @@ -3801,6 +3823,25 @@ Page({ | ||
| 3801 | getApp().goto("/pages/index/index/index"); | 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,6 +71,7 @@ Page({ | ||
| 71 | ckeck_quan_price: 0, | 71 | ckeck_quan_price: 0, |
| 72 | check_quan_price_list: '', | 72 | check_quan_price_list: '', |
| 73 | check_quan_ware_list: '', | 73 | check_quan_ware_list: '', |
| 74 | + check_quan_price_scj: 0, | ||
| 74 | 75 | ||
| 75 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid | 76 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid |
| 76 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} | 77 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} |
| @@ -753,6 +754,7 @@ Page({ | @@ -753,6 +754,7 @@ Page({ | ||
| 753 | th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; | 754 | th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; |
| 754 | th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; | 755 | th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; |
| 755 | th.data.check_quan_ware_list = t.data.data.erpwareid + ""; | 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 | else | 759 | else |
| 758 | { | 760 | { |
| @@ -771,12 +773,10 @@ Page({ | @@ -771,12 +773,10 @@ Page({ | ||
| 771 | act: act | 773 | act: act |
| 772 | }); | 774 | }); |
| 773 | 775 | ||
| 774 | - | ||
| 775 | - | ||
| 776 | //计算价格 | 776 | //计算价格 |
| 777 | th.calculatePrice2(); | 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,14 +3303,22 @@ Page({ | ||
| 3303 | frozenQuan = res.data.data; | 3303 | frozenQuan = res.data.data; |
| 3304 | th.data.frozenQuan = frozenQuan; | 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 | app.request.time_limit_get(6, url, { | 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 | success: function (res) { | 3322 | success: function (res) { |
| 3315 | if (res.data.code == 0) { | 3323 | if (res.data.code == 0) { |
| 3316 | quanlist = res.data.data.pageData; | 3324 | quanlist = res.data.data.pageData; |
packageD/pages/user/coupons/coupons.json
| 1 | { | 1 | { |
| 2 | "enablePullDownRefresh": false, | 2 | "enablePullDownRefresh": false, |
| 3 | "usingComponents": { | 3 | "usingComponents": { |
| 4 | - "nodata": "/components/nodata/nodata" | ||
| 5 | - } | 4 | + "nodata": "/components/nodata/nodata", |
| 5 | + "com_top_nav": "/components/com_top_nav/com_top_nav" | ||
| 6 | + }, | ||
| 7 | + "navigationStyle": "custom" | ||
| 6 | } | 8 | } |
| 7 | \ No newline at end of file | 9 | \ No newline at end of file |
packageD/pages/user/coupons/coupons.wxml
| 1 | <wxs module="filter" src="filter.wxs"></wxs> | 1 | <wxs module="filter" src="filter.wxs"></wxs> |
| 2 | <wxs module="time" src="../../../../utils/filter.wxs"></wxs> | 2 | <wxs module="time" src="../../../../utils/filter.wxs"></wxs> |
| 3 | 3 | ||
| 4 | +<com_top_nav title="我的优惠券"></com_top_nav> | ||
| 5 | + | ||
| 4 | <view> | 6 | <view> |
| 5 | 7 | ||
| 6 | <view class="tab-head" bindtap="clickTab"> | 8 | <view class="tab-head" bindtap="clickTab"> |
| @@ -35,7 +37,7 @@ | @@ -35,7 +37,7 @@ | ||
| 35 | </view> | 37 | </view> |
| 36 | <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}"> | 38 | <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}"> |
| 37 | <!--<text class="{{detail.isShowDetails ? '':'ellipsis-1x'}}">使用说明: 包邮券,全场通用,满 {{detail.condition}}元使用{{detail.title?',不包邮地区:'+detail.title:''}}</text>--> | 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 | </view> | 41 | </view> |
| 40 | </block> | 42 | </block> |
| 41 | 43 | ||
| @@ -64,8 +66,10 @@ | @@ -64,8 +66,10 @@ | ||
| 64 | </view> | 66 | </view> |
| 65 | </view> | 67 | </view> |
| 66 | <view class="c-info arrow-down {{detail.isShowDetails ? 'active':''}}" bindtap="clickDetails" data-index="{{idx}}"> | 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 | </view> | 73 | </view> |
| 70 | </block> | 74 | </block> |
| 71 | </view> | 75 | </view> |
packageE/pages/cart/cart2/cart2.js
| @@ -194,6 +194,7 @@ Page({ | @@ -194,6 +194,7 @@ Page({ | ||
| 194 | def_coupon2: null,//直接购买优惠券列表 | 194 | def_coupon2: null,//直接购买优惠券列表 |
| 195 | def_coupon3: null,//购物车包邮券列表 | 195 | def_coupon3: null,//购物车包邮券列表 |
| 196 | def_coupon4: null,//直接购买包邮券列表 | 196 | def_coupon4: null,//直接购买包邮券列表 |
| 197 | + | ||
| 197 | }, | 198 | }, |
| 198 | 199 | ||
| 199 | 200 | ||
| @@ -1895,7 +1896,8 @@ Page({ | @@ -1895,7 +1896,8 @@ Page({ | ||
| 1895 | 1896 | ||
| 1896 | t.data.data.original_img = oo.imghost + t.data.data.original_img; | 1897 | t.data.data.original_img = oo.imghost + t.data.data.original_img; |
| 1897 | t.data.data['buynum'] = gg.goods_num; | 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 | if (t.data.data.is_minishop == 1 && getApp().is_sp_hao()) { | 1902 | if (t.data.data.is_minishop == 1 && getApp().is_sp_hao()) { |
| 1901 | 1903 | ||
| @@ -2379,7 +2381,7 @@ Page({ | @@ -2379,7 +2381,7 @@ Page({ | ||
| 2379 | //-- 计算价格 -- | 2381 | //-- 计算价格 -- |
| 2380 | th.calculatePrice2(); | 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,42 @@ Page({ | @@ -3239,14 +3241,42 @@ Page({ | ||
| 3239 | //普通券的时候 | 3241 | //普通券的时候 |
| 3240 | if (quan_no && th.data.using_quan[pickid].isby != 1) { | 3242 | if (quan_no && th.data.using_quan[pickid].isby != 1) { |
| 3241 | var IsUserWare = 1; | 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 | + | ||
| 3259 | + //如果商品有重复的过滤,一般是组合购和阶梯购的情况下 | ||
| 3260 | + var idxx = scj_check_quan_ware_list.findIndex(function (ele) { | ||
| 3261 | + return ele == encodeURIComponent(scj_arr[jh].erpwareid); | ||
| 3262 | + }) | ||
| 3263 | + | ||
| 3264 | + if (idxx > -1) { | ||
| 3265 | + scj_check_quan_price_list[idxx] += scj_arr[jh].sum_price; | ||
| 3266 | + } else { | ||
| 3267 | + scj_check_quan_price_list.push(scj_arr[jh].sum_price); | ||
| 3268 | + scj_check_quan_ware_list.push(encodeURIComponent(scj_arr[jh].erpwareid)); | ||
| 3269 | + } | ||
| 3270 | + } | ||
| 3271 | + | ||
| 3272 | + get_c_price_data.WaresSum= scj_check_quan_price_list.join(); | ||
| 3273 | + get_c_price_data.WareIds= scj_check_quan_ware_list.join(); | ||
| 3274 | + is_quan_scj=1; | ||
| 3275 | + } | ||
| 3276 | + | ||
| 3242 | //---获取优惠券优惠--- | 3277 | //---获取优惠券优惠--- |
| 3243 | await getApp().request.promiseGet("/api/weshop/couponList/getUseCouponPrice", { | 3278 | 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 | - } | 3279 | + data:get_c_price_data |
| 3250 | }).then(res => { | 3280 | }).then(res => { |
| 3251 | if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { | 3281 | if (res.data.code == 0 && res.data.data && res.data.data.length > 0) { |
| 3252 | var q_data = res.data.data; | 3282 | var q_data = res.data.data; |
| @@ -3280,7 +3310,7 @@ Page({ | @@ -3280,7 +3310,7 @@ Page({ | ||
| 3280 | for (var kk in cart_item.quan_youhui_list) { | 3310 | for (var kk in cart_item.quan_youhui_list) { |
| 3281 | var you_item = cart_item.quan_youhui_list[kk]; | 3311 | var you_item = cart_item.quan_youhui_list[kk]; |
| 3282 | //-- 对券的价格进行平摊 -- | 3312 | //-- 对券的价格进行平摊 -- |
| 3283 | - await th.split_set_goods_quanprice(you_item, cart_item); | 3313 | + await th.split_set_goods_quanprice(you_item, cart_item,is_quan_scj); |
| 3284 | } | 3314 | } |
| 3285 | } | 3315 | } |
| 3286 | 3316 | ||
| @@ -5529,15 +5559,14 @@ Page({ | @@ -5529,15 +5559,14 @@ Page({ | ||
| 5529 | 5559 | ||
| 5530 | //房间号的ids | 5560 | //房间号的ids |
| 5531 | var room_ids = ""; | 5561 | 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 | - } | 5562 | + //-- 把券的钱,写入从表,前面已经摊了一次了,不要再摊第二次 --- |
| 5563 | + // if (t_item.quan_youhui_list && t_item.coupon_price) { | ||
| 5564 | + // for (var kk in t_item.quan_youhui_list) { | ||
| 5565 | + // var you_item = t_item.quan_youhui_list[kk]; | ||
| 5566 | + // //-- 对券的价格进行平摊 -- | ||
| 5567 | + // await th.split_set_goods_quanprice(you_item, t_item); | ||
| 5568 | + // } | ||
| 5569 | + // } | ||
| 5541 | 5570 | ||
| 5542 | //看一下有没有活动不参与的,要记录到order_more表中 | 5571 | //看一下有没有活动不参与的,要记录到order_more表中 |
| 5543 | let can_cx = t_item.show_can_cx; | 5572 | let can_cx = t_item.show_can_cx; |
| @@ -5968,9 +5997,6 @@ Page({ | @@ -5968,9 +5997,6 @@ Page({ | ||
| 5968 | console.log("--str--"); | 5997 | console.log("--str--"); |
| 5969 | console.log(str); | 5998 | console.log(str); |
| 5970 | 5999 | ||
| 5971 | - | ||
| 5972 | - // return false; | ||
| 5973 | - | ||
| 5974 | wx.showLoading({ title: "加载中" }); | 6000 | wx.showLoading({ title: "加载中" }); |
| 5975 | th.setData({ submit: 1, }) | 6001 | th.setData({ submit: 1, }) |
| 5976 | wx.request({ | 6002 | wx.request({ |
| @@ -6974,7 +7000,15 @@ Page({ | @@ -6974,7 +7000,15 @@ Page({ | ||
| 6974 | using_quan[pickid].isby = 1; | 7000 | using_quan[pickid].isby = 1; |
| 6975 | } else { | 7001 | } else { |
| 6976 | if (using_quan[pickid]) old_quan = using_quan[pickid]; | 7002 | if (using_quan[pickid]) old_quan = using_quan[pickid]; |
| 6977 | - using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 }; | 7003 | + |
| 7004 | + let using_data={ coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 }; | ||
| 7005 | + | ||
| 7006 | + //-- 优化判断是有使用零售价的时候 -- | ||
| 7007 | + if(item.FactPriceType){ | ||
| 7008 | + using_data.FactPriceType=1; | ||
| 7009 | + } | ||
| 7010 | + | ||
| 7011 | + using_quan[pickid] =using_data ; | ||
| 6978 | using_quan[pickid].isby = 0; | 7012 | using_quan[pickid].isby = 0; |
| 6979 | } | 7013 | } |
| 6980 | this.setData({ using_quan: using_quan }); | 7014 | this.setData({ using_quan: using_quan }); |
| @@ -7163,6 +7197,7 @@ Page({ | @@ -7163,6 +7197,7 @@ Page({ | ||
| 7163 | } | 7197 | } |
| 7164 | }, 500); | 7198 | }, 500); |
| 7165 | }, | 7199 | }, |
| 7200 | + | ||
| 7166 | //-----获取购物车进来的劵------- | 7201 | //-----获取购物车进来的劵------- |
| 7167 | get_cart_quan: async function (order_prom_list_cart) { | 7202 | get_cart_quan: async function (order_prom_list_cart) { |
| 7168 | var th = this; | 7203 | var th = this; |
| @@ -7195,6 +7230,8 @@ Page({ | @@ -7195,6 +7230,8 @@ Page({ | ||
| 7195 | check_quan_price_list_arr = [], | 7230 | check_quan_price_list_arr = [], |
| 7196 | check_quan_ware_list_arr = []; | 7231 | check_quan_ware_list_arr = []; |
| 7197 | 7232 | ||
| 7233 | + let ck_price_scj=0; //市场价的优化 | ||
| 7234 | + | ||
| 7198 | for (var i in goodlist) { | 7235 | for (var i in goodlist) { |
| 7199 | var gd = goodlist[i]; | 7236 | var gd = goodlist[i]; |
| 7200 | //--如果是秒杀就跳出,如果是赠品,如果是组合购限制使用优惠券-- | 7237 | //--如果是秒杀就跳出,如果是赠品,如果是组合购限制使用优惠券-- |
| @@ -7238,6 +7275,10 @@ Page({ | @@ -7238,6 +7275,10 @@ Page({ | ||
| 7238 | } | 7275 | } |
| 7239 | } | 7276 | } |
| 7240 | 7277 | ||
| 7278 | + if(gd.is_collocation && gd.market_price && !gd.goods_market_price){ | ||
| 7279 | + gd.goods_market_price=gd.market_price; | ||
| 7280 | + } | ||
| 7281 | + | ||
| 7241 | //如果有限制使用优惠券,就要返回 | 7282 | //如果有限制使用优惠券,就要返回 |
| 7242 | if (gd.prom_type == 3) { | 7283 | if (gd.prom_type == 3) { |
| 7243 | 7284 | ||
| @@ -7248,16 +7289,33 @@ Page({ | @@ -7248,16 +7289,33 @@ Page({ | ||
| 7248 | } | 7289 | } |
| 7249 | var item_price = gd.goods_price * gd.goods_num; | 7290 | var item_price = gd.goods_price * gd.goods_num; |
| 7250 | var item_price2 = item_price; | 7291 | var item_price2 = item_price; |
| 7292 | + var real_price=gd.goods_price; | ||
| 7251 | 7293 | ||
| 7252 | //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- | 7294 | //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 -- |
| 7253 | if (gd.account_fir != null && gd.account_fir != undefined) { | 7295 | if (gd.account_fir != null && gd.account_fir != undefined) { |
| 7254 | item_price2 = gd.account_fir * gd.goods_num; | 7296 | item_price2 = gd.account_fir * gd.goods_num; |
| 7297 | + real_price=gd.account_fir; | ||
| 7255 | } | 7298 | } |
| 7256 | 7299 | ||
| 7257 | if (gd.ld_account) { | 7300 | if (gd.ld_account) { |
| 7258 | item_price2 = gd.ld_account * gd.goods_num; | 7301 | item_price2 = gd.ld_account * gd.goods_num; |
| 7302 | + real_price=gd.ld_account; | ||
| 7259 | } | 7303 | } |
| 7260 | ckeck_quan_price += item_price; | 7304 | ckeck_quan_price += item_price; |
| 7305 | + | ||
| 7306 | + //如果实收价等于市场价的死后 | ||
| 7307 | + if(real_price>=gd.goods_market_price){ | ||
| 7308 | + ck_price_scj+= real_price * gd.goods_num; //市场价的优化 | ||
| 7309 | + if(!arr[ind].scj_arr) arr[ind].scj_arr=[]; //组装市场价的数组,如果优惠券使用了零售价的券,就要带入使用券的接口 | ||
| 7310 | + arr[ind].scj_arr.push({ | ||
| 7311 | + sum_price:real_price * gd.goods_num, | ||
| 7312 | + index: parseInt(i), | ||
| 7313 | + goods_id:gd.goods_id, | ||
| 7314 | + erpwareid:gd.erpwareid | ||
| 7315 | + }) | ||
| 7316 | + } | ||
| 7317 | + | ||
| 7318 | + | ||
| 7261 | //如果商品有重复的过滤,一般是组合购和阶梯购的情况下 | 7319 | //如果商品有重复的过滤,一般是组合购和阶梯购的情况下 |
| 7262 | var idx = check_quan_ware_list_arr.findIndex(function (ele) { | 7320 | var idx = check_quan_ware_list_arr.findIndex(function (ele) { |
| 7263 | return ele == encodeURIComponent(gd['erpwareid']); | 7321 | return ele == encodeURIComponent(gd['erpwareid']); |
| @@ -7323,18 +7381,31 @@ Page({ | @@ -7323,18 +7381,31 @@ Page({ | ||
| 7323 | arr[ind].check_quan_price_list = check_quan_price_list; | 7381 | arr[ind].check_quan_price_list = check_quan_price_list; |
| 7324 | arr[ind].quan_list = null; | 7382 | arr[ind].quan_list = null; |
| 7325 | 7383 | ||
| 7384 | + var quan_req= { | ||
| 7385 | + storeId: oo.stoid, | ||
| 7386 | + userId: app.globalData.user_id, | ||
| 7387 | + BuySum: arr[ind].ckeck_quan_price, | ||
| 7388 | + WareIds: check_quan_ware_list, | ||
| 7389 | + pageSize: 100 | ||
| 7390 | + } | ||
| 7391 | + | ||
| 7392 | + if(arr[ind].scj_arr && arr[ind].scj_arr.length ){ | ||
| 7393 | + quan_req.BuyPosSum=ck_price_scj //优化获取市场价的优惠券 | ||
| 7394 | + | ||
| 7395 | + let PosWareIds=[]; | ||
| 7396 | + for (let is = 0; is < arr[ind].scj_arr.length; is++) { | ||
| 7397 | + PosWareIds.push(arr[ind].scj_arr[is].erpwareid) | ||
| 7398 | + } | ||
| 7399 | + | ||
| 7400 | + quan_req.PosWareIds=PosWareIds.join() //优化获取市场价的优惠券 | ||
| 7401 | + } | ||
| 7402 | + | ||
| 7326 | //-- 是否关闭使用优惠券,循环有找到商品 -- | 7403 | //-- 是否关闭使用优惠券,循环有找到商品 -- |
| 7327 | if (th.data.is_close_quan != 1 && check_quan_ware_list) { | 7404 | if (th.data.is_close_quan != 1 && check_quan_ware_list) { |
| 7328 | //--调用接口,获取优惠券的列表,3秒钟内控制接口请求-- | 7405 | //--调用接口,获取优惠券的列表,3秒钟内控制接口请求-- |
| 7329 | var url = "/api/weshop/couponList/getUseCouponList"; | 7406 | var url = "/api/weshop/couponList/getUseCouponList"; |
| 7330 | await app.request.promiseGet(url, { | 7407 | 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 | - } | 7408 | + data:quan_req |
| 7338 | }).then(res => { | 7409 | }).then(res => { |
| 7339 | console.error('优惠券111111111111'); | 7410 | console.error('优惠券111111111111'); |
| 7340 | if (res.data.code == 0) { | 7411 | if (res.data.code == 0) { |
| @@ -7383,7 +7454,7 @@ Page({ | @@ -7383,7 +7454,7 @@ Page({ | ||
| 7383 | //}) | 7454 | //}) |
| 7384 | }, | 7455 | }, |
| 7385 | 7456 | ||
| 7386 | - //------ 获取立即购买的购物车的劵 -------- | 7457 | + //------ 获取立即购买的购物车的劵,因为立即购买只有一个商品 -------- |
| 7387 | get_buy_now_quan: function () { | 7458 | get_buy_now_quan: function () { |
| 7388 | var quanlist = null, th = this, frozenQuan = null; | 7459 | var quanlist = null, th = this, frozenQuan = null; |
| 7389 | var good = this.data.bn_goods; | 7460 | var good = this.data.bn_goods; |
| @@ -7404,14 +7475,23 @@ Page({ | @@ -7404,14 +7475,23 @@ Page({ | ||
| 7404 | frozenQuan = res.data.data; | 7475 | frozenQuan = res.data.data; |
| 7405 | th.data.frozenQuan = frozenQuan; | 7476 | th.data.frozenQuan = frozenQuan; |
| 7406 | } | 7477 | } |
| 7478 | + | ||
| 7479 | + let get_q_req={ | ||
| 7480 | + storeId: oo.stoid, | ||
| 7481 | + userId: app.globalData.user_id, | ||
| 7482 | + BuySum: th.data.ckeck_quan_price, | ||
| 7483 | + WareIds: encodeURIComponent(th.data.check_quan_ware_list), | ||
| 7484 | + pageSize: 100 | ||
| 7485 | + }; | ||
| 7486 | + | ||
| 7487 | + var gg = to.get_b_now(); | ||
| 7488 | + if(th.data.ckeck_quan_price>= good.market_price* gg.goods_num){ | ||
| 7489 | + get_q_req.BuyPosSum=th.data.ckeck_quan_price //优化获取市场价的优惠券 | ||
| 7490 | + get_q_req.PosWareIds=encodeURIComponent(th.data.check_quan_ware_list) //优化获取市场价的优惠券 | ||
| 7491 | + } | ||
| 7492 | + | ||
| 7407 | app.request.time_limit_get(6, url, { | 7493 | 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 | - }, | 7494 | + data:get_q_req , |
| 7415 | success: function (res) { | 7495 | success: function (res) { |
| 7416 | console.error('优惠券22222222222222222'); | 7496 | console.error('优惠券22222222222222222'); |
| 7417 | if (res.data.code == 0) { | 7497 | if (res.data.code == 0) { |
| @@ -8221,12 +8301,24 @@ Page({ | @@ -8221,12 +8301,24 @@ Page({ | ||
| 8221 | }, | 8301 | }, |
| 8222 | 8302 | ||
| 8223 | //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 | 8303 | //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表 |
| 8224 | - split_set_goods_quanprice: async function (you_item, t_item) { | 8304 | + split_set_goods_quanprice: async function (you_item, t_item,is_quan_scj) { |
| 8225 | var coupon_price = you_item.WareCashSum; | 8305 | var coupon_price = you_item.WareCashSum; |
| 8226 | var goods = t_item.goods; | 8306 | var goods = t_item.goods; |
| 8227 | var arr = []; | 8307 | var arr = []; |
| 8308 | + | ||
| 8309 | + if(!t_item.quan_no) t_item.quan_no=you_item.CashRepNo; | ||
| 8310 | + | ||
| 8228 | //判断是不是有goods_id重复 | 8311 | //判断是不是有goods_id重复 |
| 8229 | for (var i = 0; i < goods.length; i++) { | 8312 | for (var i = 0; i < goods.length; i++) { |
| 8313 | + | ||
| 8314 | + if(is_quan_scj){ | ||
| 8315 | + let fd=t_item.scj_arr.find(function (e){ | ||
| 8316 | + return e.index==i && e.erpwareid==you_item.WareId; | ||
| 8317 | + }) | ||
| 8318 | + //不是零售价的商品,就进入下一轮 | ||
| 8319 | + if(!fd) continue; | ||
| 8320 | + } | ||
| 8321 | + | ||
| 8230 | if (goods[i].erpwareid == you_item.WareId) { | 8322 | if (goods[i].erpwareid == you_item.WareId) { |
| 8231 | var gg_ite = { | 8323 | var gg_ite = { |
| 8232 | goods_id: goods[i].goods_id, | 8324 | goods_id: goods[i].goods_id, |
| @@ -9189,7 +9281,6 @@ Page({ | @@ -9189,7 +9281,6 @@ Page({ | ||
| 9189 | var cx_prom_group = this.data.cartlist[idx].show_can_cx[gd_key].act_arr; | 9281 | var cx_prom_group = this.data.cartlist[idx].show_can_cx[gd_key].act_arr; |
| 9190 | 9282 | ||
| 9191 | var cx_arr = []; | 9283 | var cx_arr = []; |
| 9192 | - | ||
| 9193 | for (var h = 0; h < cx_prom_group.length; h++) { | 9284 | for (var h = 0; h < cx_prom_group.length; h++) { |
| 9194 | cx_prom_group[h].act.sele = 0; | 9285 | cx_prom_group[h].act.sele = 0; |
| 9195 | //-- 看有没有选中的活动 -- | 9286 | //-- 看有没有选中的活动 -- |
| @@ -9221,11 +9312,16 @@ Page({ | @@ -9221,11 +9312,16 @@ Page({ | ||
| 9221 | 9312 | ||
| 9222 | //-- 切换活动的时候,让订单促销参与不选中 -- | 9313 | //-- 切换活动的时候,让订单促销参与不选中 -- |
| 9223 | let tt_wd = "can_use_ord_prom[" + pk + "]"; | 9314 | let tt_wd = "can_use_ord_prom[" + pk + "]"; |
| 9315 | + | ||
| 9316 | + let using_quan =this.data.using_quan; | ||
| 9317 | + using_quan[pk]={}; | ||
| 9318 | + | ||
| 9224 | th.setData({ | 9319 | th.setData({ |
| 9225 | send_lb: {}, | 9320 | send_lb: {}, |
| 9226 | month_lb: {}, | 9321 | month_lb: {}, |
| 9227 | send_gf: {}, | 9322 | send_gf: {}, |
| 9228 | - [tt_wd]: 0 | 9323 | + [tt_wd]: 0, |
| 9324 | + using_quan:using_quan | ||
| 9229 | }) | 9325 | }) |
| 9230 | 9326 | ||
| 9231 | th.data.prom_goods_map = {}; | 9327 | th.data.prom_goods_map = {}; |
packageE/pages/cart/cart2/cart2.wxml
| @@ -924,7 +924,7 @@ | @@ -924,7 +924,7 @@ | ||
| 924 | </view> | 924 | </view> |
| 925 | </view> | 925 | </view> |
| 926 | <!-- 打开是说明 --> | 926 | <!-- 打开是说明 --> |
| 927 | - <include src="remark_part.wxml" /> | 927 | + <include src="remark_part_qj.wxml" /> |
| 928 | </view> | 928 | </view> |
| 929 | <!-- 包邮券的显示,立即购买 --> | 929 | <!-- 包邮券的显示,立即购买 --> |
| 930 | <block wx:if="{{ is_b_now && bn_exp_type==0}}"> | 930 | <block wx:if="{{ is_b_now && bn_exp_type==0}}"> |
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:else="{{item.FactPriceType>0}}">实收价</block></text> | ||
| 9 | + </view> | ||
| 10 | +</view> | ||
| 0 | \ No newline at end of file | 11 | \ No newline at end of file |
packageE/pages/cart/cart2_pt/cart2_pt.js
| @@ -82,6 +82,7 @@ Page({ | @@ -82,6 +82,7 @@ Page({ | ||
| 82 | ckeck_quan_price: 0, | 82 | ckeck_quan_price: 0, |
| 83 | check_quan_price_list: '', | 83 | check_quan_price_list: '', |
| 84 | check_quan_ware_list: '', | 84 | check_quan_ware_list: '', |
| 85 | + check_quan_price_scj:0, //市场价的时候 | ||
| 85 | 86 | ||
| 86 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid | 87 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid |
| 87 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} | 88 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} |
| @@ -511,12 +512,21 @@ Page({ | @@ -511,12 +512,21 @@ Page({ | ||
| 511 | 512 | ||
| 512 | 513 | ||
| 513 | th.calculatePrice2(); | 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 | } else { | 523 | } else { |
| 515 | 524 | ||
| 516 | 525 | ||
| 517 | th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; | 526 | th.data.ckeck_quan_price = t.data.data.shop_price * gg.goods_num; |
| 518 | th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; | 527 | th.data.check_quan_price_list = t.data.data.shop_price * gg.goods_num + ""; |
| 519 | th.data.check_quan_ware_list = t.data.data.erpwareid + ""; | 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 | gd.prom_id = gg.prom_id; | 531 | gd.prom_id = gg.prom_id; |
| 522 | //--阶梯团很特殊,不能用总表来拿价格-- | 532 | //--阶梯团很特殊,不能用总表来拿价格-- |
| @@ -1995,14 +2005,22 @@ Page({ | @@ -1995,14 +2005,22 @@ Page({ | ||
| 1995 | frozenQuan = res.data.data; | 2005 | frozenQuan = res.data.data; |
| 1996 | th.data.frozenQuan = frozenQuan; | 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 | app.request.time_limit_get(6, url, { | 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 | success: function (res) { | 2024 | success: function (res) { |
| 2007 | if (res.data.code == 0) { | 2025 | if (res.data.code == 0) { |
| 2008 | quanlist = res.data.data.pageData; | 2026 | quanlist = res.data.data.pageData; |
packageE/pages/cart/cart_wk/cart_wk.js
| @@ -62,6 +62,8 @@ Page({ | @@ -62,6 +62,8 @@ Page({ | ||
| 62 | check_quan_price_list: '', | 62 | check_quan_price_list: '', |
| 63 | check_quan_ware_list: '', | 63 | check_quan_ware_list: '', |
| 64 | 64 | ||
| 65 | + check_quan_price_scj:0, //市场价取价 | ||
| 66 | + | ||
| 65 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid | 67 | // 设计一个数组来存放已经选择了的券编号,coupon_no是券号,money是面值,coupon_price是真正优惠的价格,数组的下标是pickid |
| 66 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} | 68 | //using_quan[11]={coupon_no:"1212121",money:"20",coupon_price:"45"} |
| 67 | using_quan: {}, | 69 | using_quan: {}, |
| @@ -117,6 +119,8 @@ Page({ | @@ -117,6 +119,8 @@ Page({ | ||
| 117 | */ | 119 | */ |
| 118 | onShow: function () { | 120 | onShow: function () { |
| 119 | 121 | ||
| 122 | + this.updateOrderCoupon(); | ||
| 123 | + | ||
| 120 | var th = this; | 124 | var th = this; |
| 121 | //判断是不是第一次进入 | 125 | //判断是不是第一次进入 |
| 122 | if(this.data.fir_in){ | 126 | if(this.data.fir_in){ |
| @@ -479,6 +483,10 @@ Page({ | @@ -479,6 +483,10 @@ Page({ | ||
| 479 | th.data.ckeck_quan_price = q_ch_money; | 483 | th.data.ckeck_quan_price = q_ch_money; |
| 480 | th.data.check_quan_price_list = q_ch_money + ""; | 484 | th.data.check_quan_price_list = q_ch_money + ""; |
| 481 | th.data.check_quan_ware_list = goods.erpwareid + ""; | 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 | }else{ | 490 | }else{ |
| 483 | goods.is_xz_yh = 1; | 491 | goods.is_xz_yh = 1; |
| 484 | } | 492 | } |
| @@ -664,6 +672,17 @@ Page({ | @@ -664,6 +672,17 @@ Page({ | ||
| 664 | //--弹起支付框-- | 672 | //--弹起支付框-- |
| 665 | to_pay() { | 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 | if(this.data.submit){ return false} | 687 | if(this.data.submit){ return false} |
| 669 | if(!this.data.same_ok){ return false} | 688 | if(!this.data.same_ok){ return false} |
| @@ -791,6 +810,8 @@ Page({ | @@ -791,6 +810,8 @@ Page({ | ||
| 791 | },function (){ | 810 | },function (){ |
| 792 | th.data.paying=0; | 811 | th.data.paying=0; |
| 793 | //getApp().my_warnning("支付失败", 0, th); | 812 | //getApp().my_warnning("支付失败", 0, th); |
| 813 | + | ||
| 814 | + th.updateOrderCoupon(); //取消祝福 | ||
| 794 | }) | 815 | }) |
| 795 | 816 | ||
| 796 | //var n = t.data.data; | 817 | //var n = t.data.data; |
| @@ -1520,23 +1541,34 @@ Page({ | @@ -1520,23 +1541,34 @@ Page({ | ||
| 1520 | if (good.whsle_id) return false; | 1541 | if (good.whsle_id) return false; |
| 1521 | if(!th.data.check_quan_ware_list) return false; | 1542 | if(!th.data.check_quan_ware_list) return false; |
| 1522 | 1543 | ||
| 1544 | + | ||
| 1545 | + | ||
| 1546 | + | ||
| 1523 | //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- | 1547 | //--如果商家后台没有限制使用优惠券,同时商品的优惠活动没有限制使用优惠券-- |
| 1524 | if (th.data.is_close_quan != 1 && good.is_xz_yh != 1 && th.data.check_quan_ware_list) { | 1548 | if (th.data.is_close_quan != 1 && good.is_xz_yh != 1 && th.data.check_quan_ware_list) { |
| 1525 | var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; | 1549 | var url0 = "/api/weshop/users/frozenQuan/listFrozenQuan/" + app.globalData.user_id; |
| 1526 | var url = "/api/weshop/couponList/getUseCouponList"; | 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 | app.request.promiseGet(url0, { 1: 1 }).then(res => { | 1565 | app.request.promiseGet(url0, { 1: 1 }).then(res => { |
| 1528 | if (res.data.code == 0) { | 1566 | if (res.data.code == 0) { |
| 1529 | frozenQuan = res.data.data; | 1567 | frozenQuan = res.data.data; |
| 1530 | th.data.frozenQuan = frozenQuan; | 1568 | th.data.frozenQuan = frozenQuan; |
| 1531 | } | 1569 | } |
| 1532 | app.request.time_limit_get(6, url, { | 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 | success: function (res) { | 1572 | success: function (res) { |
| 1541 | if (res.data.code == 0) { | 1573 | if (res.data.code == 0) { |
| 1542 | quanlist = res.data.data.pageData; | 1574 | quanlist = res.data.data.pageData; |
| @@ -2227,6 +2259,24 @@ Page({ | @@ -2227,6 +2259,24 @@ Page({ | ||
| 2227 | th.setData({ open_quan: 0 }); | 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,9 +218,10 @@ Page({ | ||
| 218 | "actId": th.data.id, //活动Id | 218 | "actId": th.data.id, //活动Id |
| 219 | "actType": 5, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 | 219 | "actType": 5, //活动类型 1:新人礼、2:评价有礼、3:节日营销、4:生日营销 |
| 220 | //"giftBagId": 1, //礼包Id | 220 | //"giftBagId": 1, //礼包Id |
| 221 | - "giftBagId": th.giftBagId, //礼包Id | 221 | + "giftBagId": th.giftBagId, //礼包Id |
| 222 | "storeId": a.stoid, //商家Id | 222 | "storeId": a.stoid, //商家Id |
| 223 | - "userId": d.user_id //用户ID | 223 | + "userId": d.user_id, //用户ID |
| 224 | + "buyFrom":2 //小程序领取 | ||
| 224 | }; | 225 | }; |
| 225 | var data = JSON.stringify(json); | 226 | var data = JSON.stringify(json); |
| 226 | var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; | 227 | var url = th.data.url + "/api/weshop/marketing/free/receive/gift/record/insert"; |