Commit da572fc1fe6359cfcbe512eab723e42e62f84b3d

Authored by yvan.ni
1 parent f5a18a2b

起订量的优化

... ... @@ -51,7 +51,7 @@ App({
51 51 config: null, //门店参数
52 52 config2: null, //门店配置
53 53 code: null,
54   - user_id:null,//6520390,//6520352
  54 + user_id:16072538,//6520390,//6520352
55 55 // user_id:6520314,// qa-6519858,//
56 56 // user_id:14148118,// qa-6519858,//
57 57 buy_now: null,
... ... @@ -1359,13 +1359,13 @@ App({
1359 1359 var limittype=gd.erp_limittype; //不低于0、倍数1
1360 1360 var limitqty=gd.erp_limitqty; //起购量
1361 1361  
1362   - //-- 如果有活动的时候 --
  1362 + //-- 如果有活动的时候,就直接返回1 --
1363 1363 if(act){
1364   - islimit=act.islimit;
1365   - limittype=act.limittype;
1366   - limitqty=act.limitqty;
  1364 + return 1;
  1365 + //islimit=act.islimit;
  1366 + //limittype=act.limittype;
  1367 + //limitqty=act.limitqty;
1367 1368 }
1368   -
1369 1369 //-- 不是限购的时候,返回1--
1370 1370 if(!islimit) return 1;
1371 1371 //-- 默认的时候 --
... ... @@ -1374,10 +1374,26 @@ App({
1374 1374 if(!limittype) return 1;
1375 1375 //倍数,加减的时候
1376 1376 return limitqty;
  1377 + },
1377 1378  
  1379 + //获取商品是不是有促销活动
  1380 + async get_has_cx_act(gid){
  1381 + var url = '/api/weshop/activitylist/listGoodActInfo2New';
  1382 + var req_d = {
  1383 + "store_id":this.globalData.setting.stoid,
  1384 + "goods_id": gid,
  1385 + "user_id":this.globalData.user_id,
  1386 + }
  1387 + var res= await this.promiseGet(url,{data:req_d});
  1388 + var cx_arr=[];
  1389 + if (res.data.code == 0 && res.data.data && res.data.data.length > 0) {
  1390 + var arr = res.data.data;
  1391 + cx_arr=arr.filter(function (e) {
  1392 + return e.s_time < ut.gettimestamp() && [3,5,7,10].indexOf(e.prom_type)>-1;
  1393 + })
  1394 + }
  1395 + return cx_arr;
1378 1396 }
1379 1397  
1380 1398  
1381   -
1382   -
1383 1399 });
... ...
packageC/pages/luckyGo/luckyGo_goodsInfo/luckyGo_goodsInfo.js
... ... @@ -2154,10 +2154,9 @@ Page({
2154 2154  
2155 2155 //----------增加购买数量-----------
2156 2156 addCartNum: function (t) {
2157   -
2158 2157 var add_num=1;
2159 2158 if(this.data.is_normal == 1){
2160   - add_num=getApp().get_limit_qty(this.data.sele_g,0,1);
  2159 + add_num=getApp().get_limit_qty(this.data.sele_g,this.data.is_act,1);
2161 2160 }
2162 2161 this.checkCartNum(this.data.goodsInputNum + add_num);
2163 2162 },
... ... @@ -2165,7 +2164,7 @@ Page({
2165 2164 subCartNum: function (t) {
2166 2165 var add_num=1;
2167 2166 if(this.data.is_normal == 1){
2168   - add_num=getApp().get_limit_qty(this.data.sele_g,0,1);
  2167 + add_num=getApp().get_limit_qty(this.data.sele_g,this.data.is_act,1);
2169 2168 }
2170 2169 this.checkCartNum(this.data.goodsInputNum - add_num);
2171 2170 },
... ... @@ -2191,7 +2190,9 @@ Page({
2191 2190 //------检查数量是不是超出限购------
2192 2191 checkCartNum: function (t) {
2193 2192 var th = this;
2194   - var mo_num=getApp().get_limit_qty(th.data.sele_g);
  2193 + var mo_num=getApp().get_limit_qty(th.data.sele_g,th.data.is_act);
  2194 + var steep=getApp().get_limit_qty(th.data.sele_g,th.data.is_act,1);
  2195 +
2195 2196 this.get_buy_num(this.data.sele_g, async function () {
2196 2197  
2197 2198 //--判断商品是否超出限购--
... ... @@ -2260,8 +2261,20 @@ Page({
2260 2261 e = th.data.def_pick_store.CanOutQty;
2261 2262 }
2262 2263 }
  2264 + }
2263 2265  
  2266 + //--- 促销活动也不控制起订量, 这里很重要的一个控制,起订量的 ----
  2267 + if(th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1){
  2268 + if(t<mo_num) t=mo_num;
  2269 + if(t>mo_num && (t-mo_num)%steep!=0){
  2270 + wx.showToast({
  2271 + title: '购买数必须是起订量的倍数',
  2272 + icon: 'none',
  2273 + });
  2274 + t=mo_num+ parseInt((t-mo_num)/steep)*steep+steep;
  2275 + }
2264 2276 }
  2277 +
2265 2278 if (!e) e = 0;
2266 2279 //库存不足,不增加
2267 2280 if (e < t) {
... ... @@ -2269,13 +2282,16 @@ Page({
2269 2282 if (e < 0) e = 0;
2270 2283  
2271 2284 if(th.data.is_normal == 1){
2272   - if(e<mo_num) e=mo_num;
  2285 + if(e<mo_num) e=mo_num;
  2286 + if(e>mo_num && (e-mo_num)%steep!=0){
  2287 + e=mo_num+ parseInt((e-mo_num)/steep)*steep;
  2288 + }
2273 2289 }
2274 2290  
2275 2291 th.setData({ goodsInputNum: e }); return false;
2276 2292 }
2277   - t > e || 0 == e ? t = e : t < 1 && (t = 1);
2278 2293  
  2294 + t > e || 0 == e ? t = e : t < 1 && (t = 1);
2279 2295 //只有普通商品才有起购数
2280 2296 if(th.data.is_normal == 1){
2281 2297 if(t<mo_num) t=mo_num;
... ... @@ -2301,7 +2317,7 @@ Page({
2301 2317 // wx.showModal({
2302 2318 // title: '超出商品限购',
2303 2319 // });
2304   - getApp().my_warnning('超出商品限购', 0, th);
  2320 + getApp().my_warnning('超出商品限购', 0, th);
2305 2321 var num = th.data.sele_g.viplimited - gd_buy_num;
2306 2322 if (num < 0) num = 0;
2307 2323 th.setData({ goodsInputNum: num })
... ... @@ -4302,9 +4318,6 @@ Page({
4302 4318 // ind == 1 为普通购买
4303 4319 openSpecModel_pt: function (e) {
4304 4320  
4305   -
4306   - var mo_num=getApp().get_limit_qty(this.data.sele_g);
4307   -
4308 4321 this.setData({ open_ind_store: 9, goodsInputNum: mo_num });
4309 4322 // 判断是否有待支付订单
4310 4323 var aid = this.data.group_id;
... ... @@ -6357,12 +6370,12 @@ Page({
6357 6370 }
6358 6371 }
6359 6372  
6360   -
  6373 + var r_data=null;
6361 6374 //调用接口判断订单优惠,
6362 6375 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gid + "/0" + "/" + user_id, {
6363 6376 }).then(async res=>{
6364 6377 if (res.data.code == 0 && res.data.data) {
6365   - var r_data = res.data.data;
  6378 + r_data = res.data.data;
6366 6379 var max = 0, min = 0;
6367 6380 //暂时积分够 不和 优惠,阶梯重叠
6368 6381 if(th.data.zh_act){
... ... @@ -6387,42 +6400,6 @@ Page({
6387 6400 r_data.promGoodsLists=null;
6388 6401 }
6389 6402  
6390   -
6391   - if (r_data.ladderLists) {
6392   - var act_id = r_data.ladderLists[0].form_id;
6393   - //-- 判断会员能不能参与阶梯促销 --
6394   - await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => {
6395   - if (res.data.code == 0 && res.data.data) {
6396   - var prom_content = "";
6397   -
6398   - //暂定优惠促销还不能重叠
6399   - if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){
6400   - return false;
6401   - }
6402   -
6403   - if(res.data.data.good_object==1){
6404   - r_data.promGoodsLists=null;
6405   - }
6406   -
6407   - for (let jj in r_data.ladderLists) {
6408   - if (r_data.ladderLists[jj].discount == 10) {
6409   - prom_content += "第" + (parseInt(jj) + 1) + "件原价,";
6410   - } else {
6411   - prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,";
6412   - }
6413   - }
6414   - prom_content = ut.sub_last(prom_content);
6415   - th.data.prom_type = 10;
6416   - th.data.prom_id = act_id;
6417   - th.setData({
6418   - jieti_prom: prom_content,
6419   - ladder_act_id: act_id
6420   - })
6421   - }
6422   - })
6423   - }
6424   -
6425   -
6426 6403 //普通购买不在界面显示
6427 6404 if(is_nor){
6428 6405 th.data.collocationGoods=r_data.collocationPromList;
... ... @@ -6438,8 +6415,50 @@ Page({
6438 6415 }
6439 6416 })
6440 6417  
  6418 + if (r_data.ladderLists) {
  6419 + var act_id = r_data.ladderLists[0].form_id;
  6420 + //-- 判断会员能不能参与阶梯促销 --
  6421 + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => {
  6422 + if (res.data.code == 0 && res.data.data) {
  6423 + var prom_content = "";
  6424 +
  6425 + //暂定优惠促销还不能重叠
  6426 + if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){
  6427 + return false;
  6428 + }
6441 6429  
  6430 + if(res.data.data.good_object==1){
  6431 + r_data.promGoodsLists=null;
  6432 + }
  6433 +
  6434 + for (let jj in r_data.ladderLists) {
  6435 + if (r_data.ladderLists[jj].discount == 10) {
  6436 + prom_content += "第" + (parseInt(jj) + 1) + "件原价,";
  6437 + } else {
  6438 + prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,";
  6439 + }
  6440 + }
  6441 + prom_content = ut.sub_last(prom_content);
  6442 + th.data.prom_type = 10;
  6443 + th.data.prom_id = act_id;
  6444 + th.setData({
  6445 + jieti_prom: prom_content,
  6446 + ladder_act_id: act_id
  6447 + })
  6448 + }
  6449 + })
  6450 + }
  6451 +
  6452 + //-- 如果有促销活动也算是有参与活动,参与活动的也统一不进行计算起订的数量 --
  6453 + this.data.is_act=0;
  6454 + if(this.data.zh_act || this.data.prom_goods || this.data.jieti_prom || this.data.collocationGoods ){
  6455 + this.data.is_act=1;
  6456 + }
6442 6457  
  6458 + //-- 更新默认购买的数量 ---
  6459 + var mo_num=getApp().get_limit_qty(th.data.sele_g,this.data.is_act);
  6460 + this.setData({goodsInputNum:mo_num})
  6461 + this.setData({mo_num:mo_num})
6443 6462  
6444 6463 },
6445 6464  
... ...
pages/cart/cart/cart.js
... ... @@ -1582,7 +1582,7 @@ Page({
1582 1582 },
1583 1583  
1584 1584 //-------------加数量---------------------
1585   - addNum: function (t) {
  1585 + addNum:async function (t) {
1586 1586 if (!this.data.is_load) return false;
1587 1587 if (this.data.up_dating == 1) return false;
1588 1588 this.data.up_dating = 1;
... ... @@ -1594,7 +1594,6 @@ Page({
1594 1594 console.log('add+');
1595 1595  
1596 1596 if (this.data.sales_rules < 2 || a.whsle_id || [1, 2, 4, 6, 8, 9].indexOf(a.prom_type) > -1) {
1597   -
1598 1597 if (a.goods_num > a.store_count) {
1599 1598 console.log('购买的数量不能-----');
1600 1599 // wx.showModal({
... ... @@ -1613,13 +1612,15 @@ Page({
1613 1612 }
1614 1613  
1615 1614 var add_num=1;
1616   - var mo_num=getApp().get_limit_qty(a);
1617   - var steep=getApp().get_limit_qty(a,0,1);
1618   - if(steep>1){
1619   - add_num=steep;
  1615 + //调用接口判断是不是促销活动的商品
  1616 + if([0,3,5,7,10].indexOf(a.prom_type) > -1){
  1617 + var cx_arr=await getApp().jc(a.goods_id,user_id);
  1618 + var steep=getApp().get_limit_qty(a,cx_arr.length,1);
  1619 + if(steep>1){
  1620 + add_num=steep;
  1621 + }
1620 1622 }
1621 1623  
1622   -
1623 1624 var e = {
1624 1625 goods_num: a.goods_num + add_num,
1625 1626 id: a.id,
... ... @@ -1627,11 +1628,11 @@ Page({
1627 1628 store_id: oo.stoid
1628 1629 };
1629 1630 // console.log('goods_num', e.goods_num);
1630   - this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems);
  1631 + this.postCardList(e, t.currentTarget.dataset.item, t.currentTarget.dataset.pitems,cx_arr);
1631 1632  
1632 1633 },
1633 1634 //-------------减数量---------------------
1634   - subNum: function (t) {
  1635 + subNum: async function (t) {
1635 1636 if (!this.data.is_load) return false;
1636 1637 if (this.data.up_dating == 1) return false;
1637 1638 this.data.up_dating = 1;
... ... @@ -1648,10 +1649,12 @@ Page({
1648 1649  
1649 1650  
1650 1651 var add_num=1;
1651   - var mo_num=getApp().get_limit_qty(a);
1652   - var steep=getApp().get_limit_qty(a,0,1);
1653   - if(steep>1){
1654   - add_num=steep;
  1652 + if([0,3,5,7,10].indexOf(a.prom_type) > -1){
  1653 + var cx_arr=await getApp().get_has_cx_act(a.goods_id);
  1654 + var steep = getApp().get_limit_qty(a, cx_arr.length, 1);
  1655 + if (steep > 1) {
  1656 + add_num = steep;
  1657 + }
1655 1658 }
1656 1659  
1657 1660 var e = {
... ... @@ -1685,10 +1688,7 @@ Page({
1685 1688 var e = a;
1686 1689 var th = this;
1687 1690  
1688   -
1689   - var mo_num=getApp().get_limit_qty(e);
1690   -
1691   - if (a = isNaN(t.detail.value) || t.detail.value < mo_num ? mo_num : parseInt(t.detail.value)) {
  1691 + if (a = isNaN(t.detail.value) || t.detail.value < 1 ? 1 : parseInt(t.detail.value)) {
1692 1692 var s = {
1693 1693 goods_num: a,
1694 1694 goods_id: e.service_id,
... ... @@ -2600,15 +2600,15 @@ Page({
2600 2600 th = e,
2601 2601 user_id = getApp().globalData.user_id;
2602 2602  
2603   - function normal_check(store_count, goodsinfo, wareIds) {
  2603 + function normal_check(store_count, goodsinfo, wareIds,cx_arr) {
2604 2604  
2605 2605  
2606 2606 // getApp().my_warnning('购买数量超出商品库存', 0, th);
2607 2607 var txt = "requestData[" + pitem + "].goods[" + item + "].goods_num";
2608 2608 //-- 要判断是不是起订量不购 --
2609 2609 if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){
2610   - var mo_num=getApp().get_limit_qty(goodsinfo);
2611   - var steep=getApp().get_limit_qty(goodsinfo,0,1);
  2610 + var mo_num=getApp().get_limit_qty(goodsinfo,cx_arr.length);
  2611 + var steep=getApp().get_limit_qty(goodsinfo,cx_arr.length,1);
2612 2612 if(mo_num>1 && t.goods_num<mo_num){
2613 2613 wx.showToast({
2614 2614 title: '购买数量小于商品的起订量',
... ... @@ -2712,16 +2712,21 @@ Page({
2712 2712 t.goods_num = cbuy > 0 ? cbuy : limit;
2713 2713  
2714 2714 if([0,3,5,7,10].indexOf(goodsinfo.prom_type)>-1){
2715   - var mo_num=getApp().get_limit_qty(goodsinfo);
2716   - var steep=getApp().get_limit_qty(goodsinfo,0,1);
  2715 +
  2716 + //-- 判断商品是不是 --
  2717 + var cx_arr=await getApp().get_has_cx_act(goodsinfo.goods_id);
  2718 +
  2719 + var mo_num=getApp().get_limit_qty(goodsinfo,cx_arr.length);
  2720 + var steep=getApp().get_limit_qty(goodsinfo,cx_arr.length,1);
  2721 +
2717 2722 if(mo_num>1 && t.goods_num<mo_num){
2718 2723 wx.showToast({
2719 2724 title: '购买数量小于商品的起订量',
2720 2725 icon: 'none',
2721 2726 });
2722 2727 t.goods_num=0;
2723   -
2724 2728 }
  2729 +
2725 2730 if(steep>1 && t.goods_num>mo_num && (t.goods_num-mo_num)%steep!=0 ){
2726 2731  
2727 2732 wx.showToast({
... ... @@ -2740,7 +2745,7 @@ Page({
2740 2745  
2741 2746 switch (goodsinfo.prom_type) {
2742 2747 case 1:
2743   - //读取秒杀
  2748 + //-- 读取秒杀 --
2744 2749 rq.get("/api/ms/flash_sale/getFlashSaleOne/" + oo.stoid + "/" + goodsinfo.prom_id, {
2745 2750 isShowLoading: 0,
2746 2751 success: function (res_d) {
... ... @@ -2939,10 +2944,10 @@ Page({
2939 2944 normal_check(store_count, goodsinfo, wareIds);
2940 2945 }
2941 2946 })
2942   -
2943 2947 break;
2944 2948 default:
2945   - normal_check(store_count, goodsinfo, wareIds);
  2949 + var cx_arr=await getApp().get_has_cx_act(goodsinfo.goods_id);
  2950 + normal_check(store_count, goodsinfo, wareIds,cx_arr);
2946 2951 break
2947 2952 }
2948 2953 }
... ...
pages/goods/goodsInfo/goodsInfo.js
... ... @@ -1107,14 +1107,6 @@ Page({
1107 1107 //获取统一条形码,普通商品和优惠促销的商品
1108 1108 if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 5 || ee.data.data.prom_type == 7 || ee.data.data.prom_type == 9 || ee.data.data.prom_type == 10) {
1109 1109  
1110   -
1111   - //-- 更新默认购买的数量 ---
1112   - var mo_num=getApp().get_limit_qty(t.data.data);
1113   -
1114   -
1115   - ee.setData({goodsInputNum:mo_num})
1116   - ee.setData({mo_num:mo_num})
1117   -
1118 1110 ee.get_sto();
1119 1111 ee.get_sku(o.stoid, t.data.data, gid);
1120 1112 ee.check_has_flash();
... ... @@ -2408,8 +2400,7 @@ Page({
2408 2400 var add_num=1;
2409 2401 var p_type=parseInt(this.data.prom_type)
2410 2402 if([1,2,4,6,8,9].indexOf(p_type)==-1 || this.data.openSpecModal_inte_normal == 1 || this.data.is_normal == 1){
2411   -
2412   - add_num = getApp().get_limit_qty(this.data,this.data.sele_g, 0, 1);
  2403 + add_num = getApp().get_limit_qty(this.data.sele_g, this.data.is_act, 1);
2413 2404 }
2414 2405  
2415 2406 this.checkCartNum(this.data.goodsInputNum + add_num);
... ... @@ -2420,9 +2411,8 @@ Page({
2420 2411 var add_num=1;
2421 2412 var p_type=parseInt(this.data.prom_type)
2422 2413 if([1,2,4,6,8,9].indexOf(p_type)==-1 || this.data.openSpecModal_inte_normal == 1 || this.data.is_normal == 1){
2423   - if(!th.data.prom_goods && !th.data.jieti_prom && !th.data.zh_act && !th.data.collocationGoods) {
2424   - add_num = getApp().get_limit_qty(this.data.sele_g, 0, 1);
2425   - }
  2414 + add_num = getApp().get_limit_qty(this.data.sele_g, this.data.is_act, 1);
  2415 +
2426 2416 }
2427 2417 this.checkCartNum(this.data.goodsInputNum - add_num);
2428 2418 },
... ... @@ -2448,9 +2438,8 @@ Page({
2448 2438 //------检查数量是不是超出限购------
2449 2439 checkCartNum: function (t) {
2450 2440 var th = this;
2451   -
2452   - var mo_num=getApp().get_limit_qty(th.data.sele_g);
2453   - var steep=getApp().get_limit_qty(th.data.sele_g,0,1);
  2441 + var mo_num=getApp().get_limit_qty(th.data.sele_g,th.data.is_act);
  2442 + var steep=getApp().get_limit_qty(th.data.sele_g,th.data.is_act,1);
2454 2443  
2455 2444 this.get_buy_num(this.data.sele_g, async function () {
2456 2445  
... ... @@ -2539,18 +2528,14 @@ Page({
2539 2528 }
2540 2529  
2541 2530 //--- 促销活动也不控制起订量, 这里很重要的一个控制,起订量的 ----
2542   - if([0,3,5,7,10].indexOf(p_type)>-1){
2543   - if(th.data.prom_goods || th.data.jieti_prom || th.data.zh_act || th.data.collocationGoods){
2544   - mo_num=1;steep=1;
2545   - }else{
2546   - if(t<mo_num) t=mo_num;
2547   - if(t>mo_num && (t-mo_num)%steep!=0){
2548   - wx.showToast({
2549   - title: '购买数必须是起订量的倍数',
2550   - icon: 'none',
2551   - });
2552   - t=mo_num+ parseInt((e-mo_num)/steep)*steep;
2553   - }
  2531 + if([0,3,5,7,10].indexOf(p_type)>-1 || th.data.openSpecModal_inte_normal == 1 || th.data.is_normal == 1){
  2532 + if(t<mo_num) t=mo_num;
  2533 + if(t>mo_num && (t-mo_num)%steep!=0){
  2534 + wx.showToast({
  2535 + title: '购买数必须是起订量的倍数',
  2536 + icon: 'none',
  2537 + });
  2538 + t=mo_num+ parseInt((t-mo_num)/steep)*steep+steep;
2554 2539 }
2555 2540 }
2556 2541  
... ... @@ -5017,8 +5002,6 @@ Page({
5017 5002  
5018 5003 var th = this;
5019 5004 var ind = parseInt(e.currentTarget.dataset.it);
5020   - var mo_num=getApp().get_limit_qty(this.data.sele_g);
5021   -
5022 5005 //如果是拼单活动的普通购买
5023 5006 if (ind == 1) {
5024 5007  
... ... @@ -5032,9 +5015,6 @@ Page({
5032 5015 th.setData({
5033 5016 is_normal: ind,
5034 5017 openSpecModal_pt: 1,
5035   - goodsInputNum: mo_num,
5036   - mo_num:mo_num
5037   -
5038 5018 });
5039 5019 } else {
5040 5020 th.get_sto(1);
... ... @@ -5042,8 +5022,6 @@ Page({
5042 5022 th.setData({
5043 5023 is_normal: ind,
5044 5024 openSpecModal_pt: 1,
5045   - goodsInputNum: mo_num,
5046   - mo_num:mo_num
5047 5025 });
5048 5026 });
5049 5027 }
... ... @@ -7488,13 +7466,13 @@ Page({
7488 7466 })
7489 7467 }
7490 7468 }
7491   -
  7469 + var r_data=null;
7492 7470  
7493 7471 //调用接口判断订单优惠,
7494 7472 await getApp().request.promiseGet("/api/weshop/goods/getGoodsPromListNew1/" + os.stoid + "/" + gid + "/0" + "/" + user_id, {
7495 7473 }).then(async res=>{
7496 7474 if (res.data.code == 0 && res.data.data) {
7497   - var r_data = res.data.data;
  7475 + r_data = res.data.data;
7498 7476 var max = 0, min = 0;
7499 7477 //暂时积分够 不和 优惠,阶梯重叠
7500 7478 if(th.data.zh_act){
... ... @@ -7519,42 +7497,6 @@ Page({
7519 7497 r_data.promGoodsLists=null;
7520 7498 }
7521 7499  
7522   -
7523   - if (r_data.ladderLists) {
7524   - var act_id = r_data.ladderLists[0].form_id;
7525   - //-- 判断会员能不能参与阶梯促销 --
7526   - await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => {
7527   - if (res.data.code == 0 && res.data.data) {
7528   - var prom_content = "";
7529   -
7530   - //暂定优惠促销还不能重叠
7531   - if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){
7532   - return false;
7533   - }
7534   -
7535   - if(res.data.data.good_object==1){
7536   - r_data.promGoodsLists=null;
7537   - }
7538   -
7539   - for (let jj in r_data.ladderLists) {
7540   - if (r_data.ladderLists[jj].discount == 10) {
7541   - prom_content += "第" + (parseInt(jj) + 1) + "件原价,";
7542   - } else {
7543   - prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,";
7544   - }
7545   - }
7546   - prom_content = ut.sub_last(prom_content);
7547   - th.data.prom_type = 10;
7548   - th.data.prom_id = act_id;
7549   - th.setData({
7550   - jieti_prom: prom_content,
7551   - ladder_act_id: act_id
7552   - })
7553   - }
7554   - })
7555   - }
7556   -
7557   -
7558 7500 //普通购买不在界面显示
7559 7501 if(is_nor){
7560 7502 th.data.collocationGoods=r_data.collocationPromList;
... ... @@ -7570,8 +7512,51 @@ Page({
7570 7512 }
7571 7513 })
7572 7514  
  7515 + //-- 如果有阶梯购的时候 --
  7516 + if (r_data && r_data.ladderLists) {
  7517 + var act_id = r_data.ladderLists[0].form_id;
  7518 + //-- 判断会员能不能参与阶梯促销 --
  7519 + await getApp().request.promiseGet("/api/weshop/prom/ladderForm/getNew/" + os.stoid + "/" + user_id + "/" + act_id, {}).then(res => {
  7520 + if (res.data.code == 0 && res.data.data) {
  7521 + var prom_content = "";
7573 7522  
  7523 + //暂定优惠促销还不能重叠
  7524 + if(res.data.data.good_object==0 && (r_data.promGoodsLists || th.data.zh_act)){
  7525 + return false;
  7526 + }
7574 7527  
  7528 + if(res.data.data.good_object==1){
  7529 + r_data.promGoodsLists=null;
  7530 + }
  7531 +
  7532 + for (let jj in r_data.ladderLists) {
  7533 + if (r_data.ladderLists[jj].discount == 10) {
  7534 + prom_content += "第" + (parseInt(jj) + 1) + "件原价,";
  7535 + } else {
  7536 + prom_content += "第" + (parseInt(jj) + 1) + "件" + r_data.ladderLists[jj].discount + "折,";
  7537 + }
  7538 + }
  7539 + prom_content = ut.sub_last(prom_content);
  7540 + th.data.prom_type = 10;
  7541 + th.data.prom_id = act_id;
  7542 + th.setData({
  7543 + jieti_prom: prom_content,
  7544 + ladder_act_id: act_id
  7545 + })
  7546 + }
  7547 + })
  7548 + }
  7549 +
  7550 + //-- 如果有促销活动也算是有参与活动,参与活动的也统一不进行计算起订的数量 --
  7551 + this.data.is_act=0;
  7552 + if(this.data.zh_act || this.data.prom_goods || this.data.jieti_prom || this.data.collocationGoods ){
  7553 + this.data.is_act=1;
  7554 + }
  7555 +
  7556 + //-- 更新默认购买的数量 ---
  7557 + var mo_num=getApp().get_limit_qty(th.data.sele_g,this.data.is_act);
  7558 + this.setData({goodsInputNum:mo_num})
  7559 + this.setData({mo_num:mo_num})
7575 7560  
7576 7561 },
7577 7562  
... ... @@ -7634,9 +7619,8 @@ Page({
7634 7619 openSpecModal_inte: 1,
7635 7620 goodsInputNum: 1
7636 7621 });
7637   -
7638   -
7639 7622 },
  7623 +
7640 7624 //-- 积分购普通购买 --
7641 7625 go_pay_integral_normal: function () {
7642 7626  
... ... @@ -8155,12 +8139,9 @@ Page({
8155 8139 openSpecModel_Nor: function () {
8156 8140 this.data.g_buy_num = new Map();
8157 8141 var th = this;
8158   - var mo_num=getApp().get_limit_qty(this.data.sele_g);
8159 8142  
8160 8143 this.setData({
8161 8144 open_ind_store: 5,
8162   - goodsInputNum: mo_num,
8163   - mo_num:mo_num
8164 8145 }); //拼团直接给4
8165 8146  
8166 8147 if (th.data.sku_g_pt) {
... ...
pages/goods/goodsInfo/goodsInfo.wxml
... ... @@ -1322,7 +1322,7 @@
1322 1322 <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
1323 1323 <block wx:else>
1324 1324 <view class="no_store" wx:if="{{def_pick_store.is_no_dis}}">(配送不匹配)</view>
1325   - <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0 &&!sele_g.whsle_id && !filters.is_virtual_gd(sele_g)}}">
  1325 + <view wx:elif="{{def_pick_store && !def_pick_store.CanOutQty && !filters.is_virtual_gd(sele_g.is_virtual) && sales_rules>=2 && prom_type==0 &&!sele_g.whsle_id }}">
1326 1326 (库存不足)
1327 1327 </view>
1328 1328 </block>
... ...