Commit d264459832fe57b6d47467d8ae24d8025cd23a20

Authored by WXD-SEASON\season
2 parents 51bb256a 5eb9e254

合并

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,21 @@ 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 + }
  2238 +
2216 2239 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   - },
  2240 + data: quan_rq,
2224 2241 success: function (res) {
2225 2242 console.error('优惠券2-------------------');
2226 2243 if (res.data.code == 0) {
... ... @@ -3202,6 +3219,10 @@ Page({
3202 3219 icon: 'none',
3203 3220 duration: 2500
3204 3221 })
  3222 +
  3223 +
  3224 + th.updateOrderCoupon(); //取消支付的时候
  3225 +
3205 3226 })
3206 3227 // var n = t.data.data;
3207 3228 // th.weixinPay(n,
... ... @@ -3801,6 +3822,25 @@ Page({
3801 3822 getApp().goto("/pages/index/index/index");
3802 3823 },
3803 3824  
  3825 + //优惠券锁定后解锁方法
  3826 + async updateOrderCoupon(){
  3827 + try{
  3828 + let req_data={
  3829 + store_id:oo.stoid,
  3830 + user_id:(getApp().globalData.userInfo.user_id || 0),
  3831 + order_id:this.data.order_id,
  3832 + }
  3833 + await getApp().request.promisePost("/api/weshop/order/updateOrderCoupon",{
  3834 + is_json:1,
  3835 + data:req_data
  3836 + }).then(res=>{
  3837 + console.log(111)
  3838 + })
  3839 + }catch(error){
  3840 + console.log(error)
  3841 + }
  3842 + }
  3843 +
3804 3844  
3805 3845  
3806 3846  
... ...
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,21 @@ 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 + }
  3318 +
3306 3319 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   - },
  3320 + data:quan_req,
3314 3321 success: function (res) {
3315 3322 if (res.data.code == 0) {
3316 3323 quanlist = res.data.data.pageData;
... ...
packageD/pages/user/coupons/coupons.json
1 1 {
2 2 "enablePullDownRefresh": false,
3 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 9 \ No newline at end of file
... ...
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">
... ...
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  
... ... @@ -5968,9 +5988,6 @@ Page({
5968 5988 console.log("--str--");
5969 5989 console.log(str);
5970 5990  
5971   -
5972   - // return false;
5973   -
5974 5991 wx.showLoading({ title: "加载中" });
5975 5992 th.setData({ submit: 1, })
5976 5993 wx.request({
... ... @@ -6974,7 +6991,15 @@ Page({
6974 6991 using_quan[pickid].isby = 1;
6975 6992 } else {
6976 6993 if (using_quan[pickid]) old_quan = using_quan[pickid];
6977   - using_quan[pickid] = { coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
  6994 +
  6995 + let using_data={ coupon_no: item.CashRepNo, money: item.Sum, is_nouse_red: 0 };
  6996 +
  6997 + //-- 优化判断是有使用零售价的时候 --
  6998 + if(item.FactPriceType){
  6999 + using_data.FactPriceType=1;
  7000 + }
  7001 +
  7002 + using_quan[pickid] =using_data ;
6978 7003 using_quan[pickid].isby = 0;
6979 7004 }
6980 7005 this.setData({ using_quan: using_quan });
... ... @@ -7195,6 +7220,8 @@ Page({
7195 7220 check_quan_price_list_arr = [],
7196 7221 check_quan_ware_list_arr = [];
7197 7222  
  7223 + let ck_price_scj=0; //市场价的优化
  7224 +
7198 7225 for (var i in goodlist) {
7199 7226 var gd = goodlist[i];
7200 7227 //--如果是秒杀就跳出,如果是赠品,如果是组合购限制使用优惠券--
... ... @@ -7248,16 +7275,33 @@ Page({
7248 7275 }
7249 7276 var item_price = gd.goods_price * gd.goods_num;
7250 7277 var item_price2 = item_price;
  7278 + var real_price=gd.goods_price;
7251 7279  
7252 7280 //-- 如果有平摊下去,有实收价格的时候,就要用account来计算价格 --
7253 7281 if (gd.account_fir != null && gd.account_fir != undefined) {
7254 7282 item_price2 = gd.account_fir * gd.goods_num;
  7283 + real_price=gd.account_fir;
7255 7284 }
7256 7285  
7257 7286 if (gd.ld_account) {
7258 7287 item_price2 = gd.ld_account * gd.goods_num;
  7288 + real_price=gd.ld_account;
  7289 + }
  7290 + ckeck_quan_price += item_price2;
  7291 +
  7292 + //如果实收价等于市场价的死后
  7293 + if(real_price>=gd.goods_market_price){
  7294 + ck_price_scj+= gd.goods_market_price * gd.goods_num; //市场价的优化
  7295 + if(!arr[ind].scj_arr) arr[ind].scj_arr=[]; //组装市场价的数组,如果优惠券使用了零售价的券,就要带入使用券的接口
  7296 + arr[ind].scj_arr.push({
  7297 + sum_price:real_price * gd.goods_num,
  7298 + index: parseInt(i),
  7299 + goods_id:gd.goods_id,
  7300 + erpwareid:gd.erpwareid
  7301 + })
7259 7302 }
7260   - ckeck_quan_price += item_price;
  7303 +
  7304 +
7261 7305 //如果商品有重复的过滤,一般是组合购和阶梯购的情况下
7262 7306 var idx = check_quan_ware_list_arr.findIndex(function (ele) {
7263 7307 return ele == encodeURIComponent(gd['erpwareid']);
... ... @@ -7323,18 +7367,24 @@ Page({
7323 7367 arr[ind].check_quan_price_list = check_quan_price_list;
7324 7368 arr[ind].quan_list = null;
7325 7369  
  7370 + var quan_req= {
  7371 + storeId: oo.stoid,
  7372 + userId: app.globalData.user_id,
  7373 + BuySum: arr[ind].ckeck_quan_price,
  7374 + WareIds: check_quan_ware_list,
  7375 + pageSize: 100
  7376 + }
  7377 +
  7378 + if(arr[ind].scj_arr){
  7379 + quan_req.BuyPosSum=ck_price_scj //优化获取市场价的优惠券
  7380 + }
  7381 +
7326 7382 //-- 是否关闭使用优惠券,循环有找到商品 --
7327 7383 if (th.data.is_close_quan != 1 && check_quan_ware_list) {
7328 7384 //--调用接口,获取优惠券的列表,3秒钟内控制接口请求--
7329 7385 var url = "/api/weshop/couponList/getUseCouponList";
7330 7386 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   - }
  7387 + data:quan_req
7338 7388 }).then(res => {
7339 7389 console.error('优惠券111111111111');
7340 7390 if (res.data.code == 0) {
... ... @@ -7383,7 +7433,7 @@ Page({
7383 7433 //})
7384 7434 },
7385 7435  
7386   - //------ 获取立即购买的购物车的劵 --------
  7436 + //------ 获取立即购买的购物车的劵,因为立即购买只有一个商品 --------
7387 7437 get_buy_now_quan: function () {
7388 7438 var quanlist = null, th = this, frozenQuan = null;
7389 7439 var good = this.data.bn_goods;
... ... @@ -7404,14 +7454,22 @@ Page({
7404 7454 frozenQuan = res.data.data;
7405 7455 th.data.frozenQuan = frozenQuan;
7406 7456 }
  7457 +
  7458 + let get_q_req={
  7459 + storeId: oo.stoid,
  7460 + userId: app.globalData.user_id,
  7461 + BuySum: th.data.ckeck_quan_price,
  7462 + WareIds: encodeURIComponent(th.data.check_quan_ware_list),
  7463 + pageSize: 100
  7464 + };
  7465 +
  7466 + var gg = to.get_b_now();
  7467 + if(th.data.ckeck_quan_price>= good.market_price* gg.goods_num){
  7468 + get_q_req.BuyPosSum=th.data.ckeck_quan_price //优化获取市场价的优惠券
  7469 + }
  7470 +
7407 7471 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   - },
  7472 + data:get_q_req ,
7415 7473 success: function (res) {
7416 7474 console.error('优惠券22222222222222222');
7417 7475 if (res.data.code == 0) {
... ... @@ -8221,12 +8279,22 @@ Page({
8221 8279 },
8222 8280  
8223 8281 //进行对商品的平摊g_item是单个商品,you_item是这个商品分多少优惠券的钱,goods是商品列表
8224   - split_set_goods_quanprice: async function (you_item, t_item) {
  8282 + split_set_goods_quanprice: async function (you_item, t_item,is_quan_scj) {
8225 8283 var coupon_price = you_item.WareCashSum;
8226 8284 var goods = t_item.goods;
8227 8285 var arr = [];
8228 8286 //判断是不是有goods_id重复
8229 8287 for (var i = 0; i < goods.length; i++) {
  8288 +
  8289 + if(is_quan_scj){
  8290 + let fd=t_item.scj_arr.find(function (e){
  8291 + return e.index==i;
  8292 + })
  8293 +
  8294 + //不是零售价的商品,就进入下一轮
  8295 + if(!fd) continue;
  8296 + }
  8297 +
8230 8298 if (goods[i].erpwareid == you_item.WareId) {
8231 8299 var gg_ite = {
8232 8300 goods_id: goods[i].goods_id,
... ...
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,21 @@ 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 + }
  2020 +
1998 2021 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   - },
  2022 + data: quan_rq,
2006 2023 success: function (res) {
2007 2024 if (res.data.code == 0) {
2008 2025 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,33 @@ 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 + }
  1563 +
1527 1564 app.request.promiseGet(url0, { 1: 1 }).then(res => {
1528 1565 if (res.data.code == 0) {
1529 1566 frozenQuan = res.data.data;
1530 1567 th.data.frozenQuan = frozenQuan;
1531 1568 }
1532 1569 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   - },
  1570 + data: quan_rq,
1540 1571 success: function (res) {
1541 1572 if (res.data.code == 0) {
1542 1573 quanlist = res.data.data.pageData;
... ... @@ -2227,6 +2258,24 @@ Page({
2227 2258 th.setData({ open_quan: 0 });
2228 2259 },
2229 2260  
  2261 + //优惠券锁定后解锁方法
  2262 + async updateOrderCoupon(){
  2263 + try{
  2264 + let req_data={
  2265 + store_id:oo.stoid,
  2266 + user_id:(getApp().globalData.userInfo.user_id || 0),
  2267 + order_id:this.data.order_id,
  2268 + }
  2269 + await getApp().request.promisePost("/api/weshop/order/updateOrderCoupon",{
  2270 + is_json:1,
  2271 + data:req_data
  2272 + }).then(res=>{
  2273 + console.log(111)
  2274 + })
  2275 + }catch(error){
  2276 +
  2277 + }
  2278 + }
2230 2279  
2231 2280  
2232 2281  
... ...