Commit f23c7b78381afe0cabda7fb2703fd5681a49602d

Authored by yvan.ni
1 parent aecfcdd8

1、商品线下库存 默认门店要显示, 如果库存不足,要提示(库存不足)

2、多条吗商品在切换的时的库存控制
3、 订单列表中立即支付的bug修复
pages/goods/goodsInfo/goodsInfo.js
@@ -219,6 +219,7 @@ Page({ @@ -219,6 +219,7 @@ Page({
219 new_user: 0, //新用户 219 new_user: 0, //新用户
220 220
221 def_pick_store: null, // 默认的门店 221 def_pick_store: null, // 默认的门店
  222 + fir_def_store:null, //客户默认的门店的
222 lat: null, //维度 223 lat: null, //维度
223 lon: null, //经度 224 lon: null, //经度
224 225
@@ -233,11 +234,11 @@ Page({ @@ -233,11 +234,11 @@ Page({
233 is_collect_load:0, //是不是处理 234 is_collect_load:0, //是不是处理
234 is_newsales_rules:0, //是否开启最新的门店规则,此时会新读门店,当点击选择门店时会触发读取线下库存 235 is_newsales_rules:0, //是否开启最新的门店规则,此时会新读门店,当点击选择门店时会触发读取线下库存
235 sales_rules:1, //默认是线上销售 236 sales_rules:1, //默认是线上销售
  237 +
236 }, 238 },
237 239
238 //------初始化加载---------- 240 //------初始化加载----------
239 onLoad: function(t) { 241 onLoad: function(t) {
240 -  
241 wx.setNavigationBarTitle({ 242 wx.setNavigationBarTitle({
242 title: "商品详情", 243 title: "商品详情",
243 }) 244 })
@@ -297,7 +298,6 @@ Page({ @@ -297,7 +298,6 @@ Page({
297 //---如果后台又开等级卡的开关--- 298 //---如果后台又开等级卡的开关---
298 if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){ 299 if(sw_arr.rank_switch && sw_arr.rank_switch=="2"){
299 th.setData({rank_switch:true}); 300 th.setData({rank_switch:true});
300 -  
301 //---回调卡的列表--- 301 //---回调卡的列表---
302 th.getPlusCardType(function(ob){ 302 th.getPlusCardType(function(ob){
303 th.setData({card_list:ob.card_list}); 303 th.setData({card_list:ob.card_list});
@@ -346,38 +346,38 @@ Page({ @@ -346,38 +346,38 @@ Page({
346 clearInterval(w_time); 346 clearInterval(w_time);
347 var distance = null; 347 var distance = null;
348 var e=JSON.parse(JSON.stringify(ee)); 348 var e=JSON.parse(JSON.stringify(ee));
349 -  
350 349
351 //如果有开启近距离的话,同时距离优不一样了 350 //如果有开启近距离的话,同时距离优不一样了
352 if (that.data.lat != null) { 351 if (that.data.lat != null) {
353 //如果经纬度有变化的话 352 //如果经纬度有变化的话
354 if( appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){ 353 if( appd.lat==that.data.lat && appd.lon==that.data.lon && e.distance>0 ){
  354 + that.data.fir_def_store=e;
355 that.setData({ 355 that.setData({
356 def_pick_store: e, 356 def_pick_store: e,
357 sto_sele_name: e.pickup_name, 357 sto_sele_name: e.pickup_name,
358 sto_sele_id: e.pickup_id, 358 sto_sele_id: e.pickup_id,
359 sto_sele_distr: e.distr_type 359 sto_sele_distr: e.distr_type
360 }) 360 })
361 - }else{  
362 - //要用接口是获取距离,js的计算不准  
363 - getApp().request.get("/api/weshop/pickup/list",{  
364 - data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon},  
365 - success:function (res) {  
366 - if(res.data.code==0){  
367 - e=res.data.data.pageData[0];  
368 - if (e){  
369 - appd.pk_store=e;  
370 - that.setData({  
371 - def_pick_store: e,  
372 - sto_sele_name: e.pickup_name,  
373 - sto_sele_id: e.pickup_id,  
374 - sto_sele_distr: e.distr_type  
375 - })  
376 - }  
377 -  
378 - }  
379 - }  
380 - }) 361 + }else{
  362 + //要用接口是获取距离,js的计算不准
  363 + getApp().request.promiseGet("/api/weshop/pickup/list",{
  364 + data:{store_id:os.stoid,pickup_id:e.pickup_id,lat:th.data.lat,lon: th.data.lon},
  365 + }).then(res=>{
  366 + if(res.data.code==0){
  367 + e=res.data.data.pageData[0];
  368 + if (e){
  369 + appd.pk_store=e;
  370 + that.data.fir_def_store=e;
  371 + that.setData({
  372 + def_pick_store: e,
  373 + sto_sele_name: e.pickup_name,
  374 + sto_sele_id: e.pickup_id,
  375 + sto_sele_distr: e.distr_type
  376 + })
  377 + }
  378 +
  379 + }
  380 + })
381 } 381 }
382 382
383 //e.distance = distance; 383 //e.distance = distance;
@@ -387,18 +387,16 @@ Page({ @@ -387,18 +387,16 @@ Page({
387 }else{ 387 }else{
388 if (e) { 388 if (e) {
389 e.distance = null; 389 e.distance = null;
  390 + that.data.fir_def_store=e;
390 that.setData({ 391 that.setData({
391 def_pick_store: e, 392 def_pick_store: e,
392 sto_sele_name: e.pickup_name, 393 sto_sele_name: e.pickup_name,
393 sto_sele_id: e.pickup_id, 394 sto_sele_id: e.pickup_id,
394 sto_sele_distr: e.distr_type 395 sto_sele_distr: e.distr_type
395 }) 396 })
396 - }  
397 -  
398 - 397 + }
399 } 398 }
400 -  
401 - 399 +
402 }, 500) 400 }, 500)
403 }); 401 });
404 402
@@ -549,7 +547,7 @@ Page({ @@ -549,7 +547,7 @@ Page({
549 547
550 //---展示--- 548 //---展示---
551 onShow: function() { 549 onShow: function() {
552 - var goods_list = null,th = this; 550 + var goods_list = null,th = this,that=this;
553 var ui = setInterval(function () { 551 var ui = setInterval(function () {
554 goods_list = th.selectComponent("#goods_list"); 552 goods_list = th.selectComponent("#goods_list");
555 if (goods_list) { 553 if (goods_list) {
@@ -626,8 +624,38 @@ Page({ @@ -626,8 +624,38 @@ Page({
626 624
627 625
628 //获取统一条形码,普通商品和优惠促销的商品 626 //获取统一条形码,普通商品和优惠促销的商品
629 - if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 2 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 4 || ee.data.data.prom_type == 5){  
630 - 627 + if (ee.data.data.prom_type == 0 || ee.data.data.prom_type == 2 || ee.data.data.prom_type == 3 || ee.data.data.prom_type == 4 || ee.data.data.prom_type == 5){
  628 +
  629 + //默认门店要拿下门店库存
  630 + if(that.data.sales_rules==2 && that.data.is_newsales_rules && that.data.fir_def_store){
  631 + var lock=0,plist=null;
  632 + //先读取门店的lock,采用链式写法,少用await
  633 + getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
  634 + data:{store_id:os.stoid,wareId:ee.data.data.goods_id,storageId:that.data.fir_def_store.pickup_id}
  635 + }).then(res=>{
  636 + if(res.data.code==0 && res.data.data.total>0){
  637 + for(var i in res.data.data.pageData)
  638 + lock+=res.data.data.pageData[i].outQty
  639 + }
  640 + //---通过接口获取门店的线下库存信息--
  641 + return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
  642 + data:{storageNos:that.data.fir_def_store.pickup_no,wareIds:encodeURIComponent(th.data.data.erpwareid),storeId:os.stoid}
  643 + })
  644 + }).then(res=>{
  645 + if(res.data.code==0 && res.data.data.total>0){
  646 + plist=res.data.data.pageData[0];
  647 + }
  648 + if(plist && plist.CanOutQty-lock>0){
  649 + that.data.fir_def_store.CanOutQty=plist.CanOutQty-lock;
  650 + }else{
  651 + that.data.fir_def_store.CanOutQty=0;
  652 + }
  653 + //--给门店赋值线下库存--
  654 + th.setData({def_pick_store:that.data.fir_def_store});
  655 + })
  656 +
  657 + }
  658 +
631 //获取门店 659 //获取门店
632 ee.get_sto(); 660 ee.get_sto();
633 ee.get_sku(o.stoid, t.data.data.sku, gid); 661 ee.get_sku(o.stoid, t.data.data.sku, gid);
@@ -1453,6 +1481,7 @@ Page({ @@ -1453,6 +1481,7 @@ Page({
1453 1481
1454 //-----------选择属性的按钮事件---------- 1482 //-----------选择属性的按钮事件----------
1455 sele_spec: function(e) { 1483 sele_spec: function(e) {
  1484 + var that=this,ee=this,th=this;
1456 var gid = e.currentTarget.dataset.gid; 1485 var gid = e.currentTarget.dataset.gid;
1457 var sku_g = this.data.sku_g; 1486 var sku_g = this.data.sku_g;
1458 var item = null; 1487 var item = null;
@@ -1466,7 +1495,37 @@ Page({ @@ -1466,7 +1495,37 @@ Page({
1466 sele_g: item, 1495 sele_g: item,
1467 gid: gid 1496 gid: gid
1468 }); 1497 });
1469 - this.get_sto(); 1498 +
  1499 + this.get_sto();
  1500 + //默认门店要拿下门店库存
  1501 + if(that.data.sales_rules==2 && that.data.def_pick_store){
  1502 + var lock=0,plist=null;
  1503 + //先读取门店的lock,采用链式写法,少用await
  1504 + getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
  1505 + data:{store_id:os.stoid,wareId:ee.data.sele_g.goods_id,storageId:that.data.def_pick_store.pickup_id}
  1506 + }).then(res=>{
  1507 + if(res.data.code==0 && res.data.data.total>0){
  1508 + for(var i in res.data.data.pageData)
  1509 + lock+=res.data.data.pageData[i].outQty
  1510 + }
  1511 + //---通过接口获取门店的线下库存信息--
  1512 + return getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
  1513 + data:{storageNos:that.data.def_pick_store.pickup_no,wareIds:encodeURIComponent(th.data.sele_g.erpwareid),storeId:os.stoid}
  1514 + })
  1515 + }).then(res=>{
  1516 + if(res.data.code==0 && res.data.data.total>0){
  1517 + plist=res.data.data.pageData[0];
  1518 + }
  1519 + if(plist && plist.CanOutQty-lock>0){
  1520 + that.data.def_pick_store.CanOutQty=plist.CanOutQty-lock;
  1521 + }else{
  1522 + that.data.def_pick_store.CanOutQty=0;
  1523 + }
  1524 + //--给门店赋值线下库存--
  1525 + th.setData({def_pick_store:that.data.def_pick_store});
  1526 + })
  1527 + }
  1528 +
1470 1529
1471 this.sele_spec_chech_activity(); 1530 this.sele_spec_chech_activity();
1472 }, 1531 },
@@ -1521,7 +1580,7 @@ Page({ @@ -1521,7 +1580,7 @@ Page({
1521 1580
1522 //---------拿出门店分类和门店------------ 1581 //---------拿出门店分类和门店------------
1523 get_sto(e) { 1582 get_sto(e) {
1524 - var th = this; 1583 + var th = this,that=this;
1525 var timer_get = setInterval(function() { 1584 var timer_get = setInterval(function() {
1526 if (th.data.is_get_local_ok == 0) return false; 1585 if (th.data.is_get_local_ok == 0) return false;
1527 var dd = null, 1586 var dd = null,
@@ -1562,6 +1621,7 @@ Page({ @@ -1562,6 +1621,7 @@ Page({
1562 sto_sele_id: e.data.data.pageData[0].pickup_id, 1621 sto_sele_id: e.data.data.pageData[0].pickup_id,
1563 sto_sele_distr: e.data.data.pageData[0].distr_type 1622 sto_sele_distr: e.data.data.pageData[0].distr_type
1564 }); 1623 });
  1624 + th.data.fir_def_store=e.data.data.pageData[0];
1565 } 1625 }
1566 1626
1567 //-- 如果有默认选择门店的时候,要把默认门店放在第一位 -- 1627 //-- 如果有默认选择门店的时候,要把默认门店放在第一位 --
@@ -1780,10 +1840,11 @@ Page({ @@ -1780,10 +1840,11 @@ Page({
1780 o_plist[kk].CanOutQty=n_item.CanOutQty-lock_num; 1840 o_plist[kk].CanOutQty=n_item.CanOutQty-lock_num;
1781 new_list.push(o_plist[kk]); 1841 new_list.push(o_plist[kk]);
1782 //如果找到默认门店 1842 //如果找到默认门店
1783 - if(def_pick_store && n_item.StorageNo==def_pick_store.pickup_no){  
1784 - def_pick_store.CanOutQty=n_item.CanOutQty-lock_num;  
1785 - th.setData({def_pick_store:def_pick_store})  
1786 - is_find_def_store=1; 1843 + if(n_item.StorageNo==th.data.fir_def_store.pickup_no){
  1844 + th.data.fir_def_store.CanOutQty=n_item.CanOutQty-lock_num;
  1845 + if(def_pick_store.pickup_id==th.data.fir_def_store.pickup_id)
  1846 + th.setData({def_pick_store:th.data.fir_def_store})
  1847 + is_find_def_store=1;
1787 } 1848 }
1788 } 1849 }
1789 break; 1850 break;
@@ -1794,14 +1855,21 @@ Page({ @@ -1794,14 +1855,21 @@ Page({
1794 //数据组装下 1855 //数据组装下
1795 var em={};em.data={};em.data.data={}; 1856 var em={};em.data={};em.data.data={};
1796 em.data.data.total=new_list.length; 1857 em.data.data.total=new_list.length;
1797 - em.data.data.pageData=new_list;  
1798 - 1858 + em.data.data.pageData=new_list;
  1859 +
  1860 + if(th.data.fir_def_store && !is_find_def_store){
  1861 + th.data.fir_def_store.CanOutQty=0;
  1862 + //--当选择的门店是客户默认的门店的时候--
  1863 + if(th.data.fir_def_store.pickup_id==th.data.def_pick_store.pickup_id) {
  1864 + th.setData({def_pick_store:th.data.fir_def_store});
  1865 + em.data.data.pageData.unshift(th.data.def_pick_store);
  1866 + }else{
  1867 + em.data.data.pageData.splice(1,0,th.data.fir_def_store);
  1868 + }
  1869 + }
  1870 +
1799 //---把数组组装进去--- 1871 //---把数组组装进去---
1800 - th.deal_pickup(em);  
1801 - if(th.data.def_pick_store && !is_find_def_store){  
1802 - th.setData({def_pick_store:null});  
1803 - }  
1804 - 1872 + th.deal_pickup(em);
1805 }else{ 1873 }else{
1806 th.setData({def_pick_store:null,all_sto:null,only_pk:null}) 1874 th.setData({def_pick_store:null,all_sto:null,only_pk:null})
1807 } 1875 }
@@ -3405,7 +3473,7 @@ Page({ @@ -3405,7 +3473,7 @@ Page({
3405 // 选择门店 3473 // 选择门店
3406 choice_store: function(ee) { 3474 choice_store: function(ee) {
3407 var th = this; 3475 var th = this;
3408 - //var ind=ee.currentTarget.dataset.ind; 3476 + var ind=ee.currentTarget.dataset.ind;
3409 var bconfig = th.data.bconfig; 3477 var bconfig = th.data.bconfig;
3410 3478
3411 if(!th.data.only_pk && !th.data.def_pickpu_list){ 3479 if(!th.data.only_pk && !th.data.def_pickpu_list){
@@ -3461,25 +3529,63 @@ Page({ @@ -3461,25 +3529,63 @@ Page({
3461 th.get_sto(); 3529 th.get_sto();
3462 } 3530 }
3463 3531
3464 -  
3465 -  
3466 -  
3467 - this.setData({  
3468 - //open_ind_store: ind,  
3469 - store: 1,  
3470 - openSpecModal: !1,  
3471 - openSpecModal_pt: !1  
3472 - }) 3532 + if(ind!=undefined && ind!=null ){
  3533 + this.setData({
  3534 + open_ind_store: ind,
  3535 + store: 1,
  3536 + openSpecModal: !1,
  3537 + openSpecModal_pt: !1
  3538 + })
  3539 + }else{
  3540 + this.setData({
  3541 + store: 1,
  3542 + openSpecModal: !1,
  3543 + openSpecModal_pt: !1
  3544 + })
  3545 + }
3473 }, 3546 },
3474 //关闭选择门店 3547 //关闭选择门店
3475 close_popup: function(e) { 3548 close_popup: function(e) {
3476 - 3549 + var th=this;
3477 this.setData({ 3550 this.setData({
3478 store: 0, 3551 store: 0,
3479 choice_sort_store: 0, 3552 choice_sort_store: 0,
3480 - sort_store: 0 3553 + sort_store: 0,
  3554 + fir_pick_index:0,
  3555 + sec_pick_index:0
3481 }) 3556 })
  3557 +
  3558 + var openindstore=this.data.open_ind_store;
  3559 + if (openindstore == 1) {
  3560 + th.setData({
  3561 + openSpecModal: !0,
  3562 + openSpecModal_ind: openindstore,
  3563 + });
  3564 + } else if (openindstore == 2) {
  3565 + th.setData({
  3566 + openSpecModal: !0,
  3567 + openSpecModal_ind: openindstore,
  3568 + });
  3569 + }
  3570 + else if (openindstore == 4) { //4就是拼团
  3571 + th.setData({
  3572 + openSpecModal_pt: 1, //打开拼团购买界面
  3573 + store: 0, //关闭门店
  3574 + choice_sort_store: 0, //关闭门店2级
  3575 + sort_store: 0, //关闭门店2级
  3576 + });
  3577 + }
  3578 + else {
  3579 + th.setData({
  3580 + store: 0,
  3581 + choice_sort_store: 0,
  3582 + sort_store: 0
  3583 + })
  3584 + }
  3585 +
  3586 +
3482 }, 3587 },
  3588 +
3483 //选择更多门店 3589 //选择更多门店
3484 more_store: function() { 3590 more_store: function() {
3485 this.setData({ 3591 this.setData({
@@ -3509,19 +3615,18 @@ Page({ @@ -3509,19 +3615,18 @@ Page({
3509 sec_pick_index: 0 3615 sec_pick_index: 0
3510 }); 3616 });
3511 }, 3617 },
  3618 +
3512 choose_for_store_fir: function(e) { 3619 choose_for_store_fir: function(e) {
3513 var index_c = e.currentTarget.dataset.ind; 3620 var index_c = e.currentTarget.dataset.ind;
3514 - var th=this;  
3515 - this.check_the_pick(index_c,function(){  
3516 - th.setData({  
3517 - fir_pick_index: index_c  
3518 - })  
3519 - })  
3520 - 3621 + var th=this;
  3622 + th.setData({
  3623 + fir_pick_index: index_c
  3624 + })
  3625 +
3521 }, 3626 },
3522 3627
3523 //如果开启线下库存,已经急速库存才会使用 3628 //如果开启线下库存,已经急速库存才会使用
3524 - async check_the_pick(index,func){ 3629 + async check_the_pick(item,func){
3525 var th=this; 3630 var th=this;
3526 var goodsinfo=th.data.sele_g; 3631 var goodsinfo=th.data.sele_g;
3527 var erpwareid=goodsinfo.erpwareid; 3632 var erpwareid=goodsinfo.erpwareid;
@@ -3535,18 +3640,8 @@ Page({ @@ -3535,18 +3640,8 @@ Page({
3535 3640
3536 if(this.data.sales_rules!=2 && this.data.is_newsales_rules!=1){ 3641 if(this.data.sales_rules!=2 && this.data.is_newsales_rules!=1){
3537 func(); 3642 func();
3538 - }else{  
3539 - var item=null;  
3540 - if (th.data.choice_sort_store == 0) {  
3541 - if (th.data.is_show_sto_cat == 1) {  
3542 - item = th.data.def_pickpu_list[index];  
3543 - } else {  
3544 - item = th.data.only_pk[index]; //当没有门店分类的时候  
3545 - }  
3546 - } else {  
3547 - item = th.data.sec_sto.s_arr[index];  
3548 - }  
3549 - 3643 + }else{
  3644 +
3550 //先读取门店的lock 3645 //先读取门店的lock
3551 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{ 3646 await getApp().request.promiseGet("/api/weshop/order/ware/lock/page",{
3552 data:{store_id:os.stoid,wareId:goodsinfo.goods_id,storageId:item.pickup_id} 3647 data:{store_id:os.stoid,wareId:goodsinfo.goods_id,storageId:item.pickup_id}
@@ -3555,8 +3650,7 @@ Page({ @@ -3555,8 +3650,7 @@ Page({
3555 for(var i in res.data.data.pageData ) 3650 for(var i in res.data.data.pageData )
3556 lock+=res.data.data.pageData[i].outQty; 3651 lock+=res.data.data.pageData[i].outQty;
3557 } 3652 }
3558 - })  
3559 - 3653 + })
3560 //读取线下的门店库存 3654 //读取线下的门店库存
3561 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{ 3655 await getApp().request.promiseGet("/api/weshop/goods/getWareStorages",{
3562 data:{storageNos:item.pickup_no,wareIds:encodeURIComponent(erpwareid),storeId:os.stoid} 3656 data:{storageNos:item.pickup_no,wareIds:encodeURIComponent(erpwareid),storeId:os.stoid}
@@ -3567,6 +3661,7 @@ Page({ @@ -3567,6 +3661,7 @@ Page({
3567 }) 3661 })
3568 3662
3569 if(plist && plist.CanOutQty-lock>0){ 3663 if(plist && plist.CanOutQty-lock>0){
  3664 + item.CanOutQty=plist.CanOutQty-lock;
3570 func(); 3665 func();
3571 return false; 3666 return false;
3572 } 3667 }
@@ -3594,144 +3689,142 @@ Page({ @@ -3594,144 +3689,142 @@ Page({
3594 var index = th.data.sec_pick_index; 3689 var index = th.data.sec_pick_index;
3595 item = th.data.sec_sto.s_arr[index]; 3690 item = th.data.sec_sto.s_arr[index];
3596 } 3691 }
3597 - th.setData({  
3598 - def_pick_store: item,  
3599 - sto_sele_name: item.pickup_name,  
3600 - sto_sele_id: item.pickup_id,  
3601 - sto_sele_distr: item.distr_type,  
3602 - store: 0,  
3603 - choice_sort_store: 0,  
3604 - fir_pick_index: 0  
3605 - });  
3606 -  
3607 - if (openindstore == 1) {  
3608 - th.setData({  
3609 - openSpecModal: !0,  
3610 - openSpecModal_ind: openindstore,  
3611 - });  
3612 - } else if (openindstore == 2) {  
3613 - th.setData({  
3614 - openSpecModal: !0,  
3615 - openSpecModal_ind: openindstore,  
3616 - });  
3617 - }  
3618 - else if (openindstore == 4) { //4就是拼团  
3619 - th.setData({  
3620 - openSpecModal_pt: 1, //打开拼团购买界面  
3621 - store: 0, //关闭门店  
3622 - choice_sort_store: 0, //关闭门店2级  
3623 - sort_store: 0, //关闭门店2级  
3624 - });  
3625 - }  
3626 -  
3627 - else {  
3628 - th.setData({  
3629 - store: 0,  
3630 - choice_sort_store: 0,  
3631 - sort_store: 0  
3632 - })  
3633 - }  
3634 - 3692 +
  3693 + //--回调函数的用法--
  3694 + th.check_the_pick(item,function(){
  3695 + th.setData({
  3696 + def_pick_store: item,
  3697 + sto_sele_name: item.pickup_name,
  3698 + sto_sele_id: item.pickup_id,
  3699 + sto_sele_distr: item.distr_type,
  3700 + store: 0,
  3701 + choice_sort_store: 0,
  3702 + fir_pick_index: 0
  3703 + });
  3704 +
  3705 + if (openindstore == 1) {
  3706 + th.setData({
  3707 + openSpecModal: !0,
  3708 + openSpecModal_ind: openindstore,
  3709 + });
  3710 + } else if (openindstore == 2) {
  3711 + th.setData({
  3712 + openSpecModal: !0,
  3713 + openSpecModal_ind: openindstore,
  3714 + });
  3715 + }
  3716 + else if (openindstore == 4) { //4就是拼团
  3717 + th.setData({
  3718 + openSpecModal_pt: 1, //打开拼团购买界面
  3719 + store: 0, //关闭门店
  3720 + choice_sort_store: 0, //关闭门店2级
  3721 + sort_store: 0, //关闭门店2级
  3722 + });
  3723 + }
  3724 + else {
  3725 + th.setData({
  3726 + store: 0,
  3727 + choice_sort_store: 0,
  3728 + sort_store: 0
  3729 + })
  3730 + }
  3731 + })
3635 }, 3732 },
3636 //---点击二级之后的选择--- 3733 //---点击二级之后的选择---
3637 choose_for_store: function(e) { 3734 choose_for_store: function(e) {
3638 var index_c = e.currentTarget.dataset.ind; 3735 var index_c = e.currentTarget.dataset.ind;
3639 - var th=this;  
3640 - th.check_the_pick(index_c,function(){  
3641 - th.setData({ 3736 + var th=this;
  3737 + th.setData({
3642 sec_pick_index: index_c, 3738 sec_pick_index: index_c,
3643 fir_pick_index: index_c 3739 fir_pick_index: index_c
3644 - })  
3645 - }) 3740 + })
  3741 +
3646 }, 3742 },
3647 //把选择的门店设置成默认的门店def_pick 3743 //把选择的门店设置成默认的门店def_pick
3648 set_def_pick: function(e) { 3744 set_def_pick: function(e) {
3649 var th = this; 3745 var th = this;
3650 var item = null; 3746 var item = null;
3651 -  
3652 if (th.data.choice_sort_store == 0) { 3747 if (th.data.choice_sort_store == 0) {
3653 -  
3654 var index = th.data.fir_pick_index; 3748 var index = th.data.fir_pick_index;
3655 -  
3656 if (th.data.is_show_sto_cat == 1) { 3749 if (th.data.is_show_sto_cat == 1) {
3657 item = th.data.def_pickpu_list[index]; 3750 item = th.data.def_pickpu_list[index];
3658 } else { 3751 } else {
3659 item = th.data.only_pk[index]; //当没有门店分类的时候 3752 item = th.data.only_pk[index]; //当没有门店分类的时候
3660 -  
3661 } 3753 }
3662 } else { 3754 } else {
3663 var index = th.data.sec_pick_index; 3755 var index = th.data.sec_pick_index;
3664 item = th.data.sec_sto.s_arr[index]; 3756 item = th.data.sec_sto.s_arr[index];
3665 } 3757 }
3666 -  
3667 - var store_id = o.stoid;  
3668 - var user_id = getApp().globalData.user_id;  
3669 - var def_pickup_id = item.pickup_id;  
3670 -  
3671 - getApp().request.put('/api/weshop/users/update', {  
3672 - data: {  
3673 - user_id,  
3674 - def_pickup_id  
3675 - },  
3676 - success: function(res) {  
3677 - if (res.data.code == 0) {  
3678 - if (th.data.choice_sort_store == 0) th.setData({  
3679 - fir_pick_index: 0  
3680 - });  
3681 - getApp().globalData.pk_store = item;  
3682 - } else {  
3683 - //s.showWarning("设置默认门店地址失败", null, 500, !1);  
3684 - getApp().my_warnning("设置默认门店地址失败",0,th)  
3685 - }  
3686 -  
3687 - }  
3688 - });  
3689 -  
3690 - th.setData({  
3691 - def_pick_store: item,  
3692 - sto_sele_name: item.pickup_name,  
3693 - sto_sele_id: item.pickup_id,  
3694 - sto_sele_distr: item.distr_type,  
3695 - store: 0,  
3696 - choice_sort_store: 0  
3697 - });  
3698 -  
3699 -  
3700 - var openindstore = th.data.open_ind_store;  
3701 - if (openindstore == 1) {  
3702 - th.setData({  
3703 - openSpecModal: !0,  
3704 - openSpecModal_ind: openindstore,  
3705 - store: 0,  
3706 - choice_sort_store: 0,  
3707 - sort_store: 0,  
3708 - });  
3709 - } else if (openindstore == 2) {  
3710 - th.setData({  
3711 - openSpecModal: !0,  
3712 - openSpecModal_ind: openindstore,  
3713 - store: 0,  
3714 - choice_sort_store: 0,  
3715 - sort_store: 0,  
3716 - });  
3717 - }  
3718 - else if (openindstore == 4) { //4就是拼团  
3719 - th.setData({  
3720 - openSpecModal_pt: 1, //打开拼团购买界面  
3721 - store: 0, //关闭门店  
3722 - choice_sort_store: 0, //关闭门店2级  
3723 - sort_store: 0, //关闭门店2级  
3724 - });  
3725 - }  
3726 -  
3727 - else {  
3728 - th.setData({  
3729 - store: 0,  
3730 - choice_sort_store: 0,  
3731 - sort_store: 0,  
3732 - })  
3733 - }  
3734 - 3758 +
  3759 + //先设置之前,要判断是不是有库存
  3760 + th.check_the_pick(item,function(){
  3761 + var store_id = o.stoid;
  3762 + var user_id = getApp().globalData.user_id;
  3763 + var def_pickup_id = item.pickup_id;
  3764 +
  3765 + getApp().request.put('/api/weshop/users/update', {
  3766 + data: {
  3767 + user_id,
  3768 + def_pickup_id
  3769 + },
  3770 + success: function(res) {
  3771 + if (res.data.code == 0) {
  3772 + if (th.data.choice_sort_store == 0) th.setData({
  3773 + fir_pick_index: 0
  3774 + });
  3775 + getApp().globalData.pk_store = item;
  3776 + } else {
  3777 + //s.showWarning("设置默认门店地址失败", null, 500, !1);
  3778 + getApp().my_warnning("设置默认门店地址失败",0,th)
  3779 + }
  3780 +
  3781 + }
  3782 + });
  3783 +
  3784 + th.setData({
  3785 + def_pick_store: item,
  3786 + sto_sele_name: item.pickup_name,
  3787 + sto_sele_id: item.pickup_id,
  3788 + sto_sele_distr: item.distr_type,
  3789 + store: 0,
  3790 + choice_sort_store: 0
  3791 + });
  3792 +
  3793 + var openindstore = th.data.open_ind_store;
  3794 + if (openindstore == 1) {
  3795 + th.setData({
  3796 + openSpecModal: !0,
  3797 + openSpecModal_ind: openindstore,
  3798 + store: 0,
  3799 + choice_sort_store: 0,
  3800 + sort_store: 0,
  3801 + });
  3802 + } else if (openindstore == 2) {
  3803 + th.setData({
  3804 + openSpecModal: !0,
  3805 + openSpecModal_ind: openindstore,
  3806 + store: 0,
  3807 + choice_sort_store: 0,
  3808 + sort_store: 0,
  3809 + });
  3810 + }
  3811 + else if (openindstore == 4) { //4就是拼团
  3812 + th.setData({
  3813 + openSpecModal_pt: 1, //打开拼团购买界面
  3814 + store: 0, //关闭门店
  3815 + choice_sort_store: 0, //关闭门店2级
  3816 + sort_store: 0, //关闭门店2级
  3817 + });
  3818 + }
  3819 +
  3820 + else {
  3821 + th.setData({
  3822 + store: 0,
  3823 + choice_sort_store: 0,
  3824 + sort_store: 0,
  3825 + })
  3826 + }
  3827 + })
3735 }, 3828 },
3736 3829
3737 wait_for_store_config: function() { 3830 wait_for_store_config: function() {
pages/goods/goodsInfo/goodsInfo.wxml
@@ -404,7 +404,15 @@ @@ -404,7 +404,15 @@
404 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}} 404 距离:{{def_pick_store.distance>1000?filters.toFix(def_pick_store.distance/1000,2)+"km":filters.toFix(def_pick_store.distance,0)+"m"}}
405 405
406 </view> 406 </view>
407 - </view> 407 + </view>
  408 + <view class="no_store" wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
  409 + <block wx:else>
  410 + <view class="no_store" wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
  411 + <block wx:else>
  412 + <view class="no_store" wx:if="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view>
  413 + </block>
  414 + </block>
  415 +
408 <view class="fs24 xc-ash-9f">地址:{{def_pick_store.fulladdress}}</view> 416 <view class="fs24 xc-ash-9f">地址:{{def_pick_store.fulladdress}}</view>
409 </view> 417 </view>
410 </view> 418 </view>
@@ -910,11 +918,11 @@ @@ -910,11 +918,11 @@
910 <text class="right-arrow"></text> 918 <text class="right-arrow"></text>
911 </view> 919 </view>
912 </view> 920 </view>
913 - <view wx:if="{{only_pk && !only_pk.length}}">门店库存不足</view> 921 + <view wx:if="{{only_pk && !only_pk.length}}">(库存不足)</view>
914 <block wx:else> 922 <block wx:else>
915 - <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">门店库存不足</view> 923 + <view wx:if="{{def_pickpu_list && !def_pickpu_list.length}}">(库存不足)</view>
916 <block wx:else> 924 <block wx:else>
917 - <view wx:if="{{def_pick_store && def_pick_store.CanOutQty<=0 && sales_rules==2 && prom_type==0}}">门店库存不足</view> 925 + <view wx:if="{{def_pick_store && !def_pick_store.CanOutQty && sales_rules==2 && prom_type==0}}">(库存不足)</view>
918 </block> 926 </block>
919 </block> 927 </block>
920 928
@@ -960,11 +968,10 @@ @@ -960,11 +968,10 @@
960 <block wx:if="{{!def_pick_store}}"> 968 <block wx:if="{{!def_pick_store}}">
961 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view> 969 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">请先选择门店</view>
962 </block> 970 </block>
963 - <block wx:else>  
964 - 971 + <block wx:else>
965 <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 --> 972 <!-- 如果是线下库存购买的时候,且是普通商品购买的时候 -->
966 <block wx:if="{{sales_rules==2 && prom_type==0}}"> 973 <block wx:if="{{sales_rules==2 && prom_type==0}}">
967 - <block wx:if="{{def_pick_store.CanOutQty<=0}}"> 974 + <block wx:if="{{!def_pick_store.CanOutQty}}">
968 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view> 975 <view class="spec-cart-btn fs32" data-action="add" style="background-color: #dcdcdc;color: #999">库存不足</view>
969 </block> 976 </block>
970 <block wx:else> 977 <block wx:else>
pages/goods/goodsInfo/goodsInfo.wxss
@@ -2254,7 +2254,7 @@ right:17rpx; top:55rpx; @@ -2254,7 +2254,7 @@ right:17rpx; top:55rpx;
2254 height: 90rpx; 2254 height: 90rpx;
2255 } 2255 }
2256 .sn_height{ 2256 .sn_height{
2257 - height: 170rpx; 2257 + min-height: 170rpx; height: auto;padding: 10rpx 0;
2258 } 2258 }
2259 .xc-address_frame .address_frame{ 2259 .xc-address_frame .address_frame{
2260 width: 92%; 2260 width: 92%;
@@ -2566,4 +2566,5 @@ border-radius: 55rpx; @@ -2566,4 +2566,5 @@ border-radius: 55rpx;
2566 button.custom-service { line-height: normal; border: 0;} 2566 button.custom-service { line-height: normal; border: 0;}
2567 button.custom-service::after{ 2567 button.custom-service::after{
2568 border: 0; 2568 border: 0;
2569 -}  
2570 \ No newline at end of file 2569 \ No newline at end of file
  2570 +}
  2571 +.no_store{color:#d60021; font-size: 26rpx;}
2571 \ No newline at end of file 2572 \ No newline at end of file
pages/user/order_detail/order_detail.js
1 var e = getApp(), r = e.request,rq=r,t = require("../../../utils/util.js"), o = require("../../../utils/common.js"),oo=e.globalData,os=oo.setting; 1 var e = getApp(), r = e.request,rq=r,t = require("../../../utils/util.js"), o = require("../../../utils/common.js"),oo=e.globalData,os=oo.setting;
2 var regeneratorRuntime = require('../../../utils/runtime.js'); 2 var regeneratorRuntime = require('../../../utils/runtime.js');
  3 +var ut= require('../../../utils/util.js');
  4 +
3 5
4 Page({ 6 Page({
5 data: { 7 data: {
@@ -325,12 +327,14 @@ Page({ @@ -325,12 +327,14 @@ Page({
325 } 327 }
326 328
327 if(good.prom_type==1 || good.prom_type==6){ 329 if(good.prom_type==1 || good.prom_type==6){
328 - if(gg.prom_type!=good.prom_type)  
329 - wx.showModal({  
330 - title: '提示',  
331 - content: gg.goods_name+'商品的活动发生了变化'  
332 - });  
333 - return false; 330 + if(gg.prom_type!=good.prom_type) {
  331 + wx.showModal({
  332 + title: '提示',
  333 + content: gg.goods_name+'商品的活动发生了变化'
  334 + });
  335 + return false;
  336 + }
  337 +
334 }else{ 338 }else{
335 339
336 if(gg.prom_type==1 || gg.prom_type==6){ 340 if(gg.prom_type==1 || gg.prom_type==6){
pages/user/order_list/order_list.js
@@ -422,13 +422,18 @@ Page({ @@ -422,13 +422,18 @@ Page({
422 return false; 422 return false;
423 } 423 }
424 424
  425 +
  426 + console.log("-----------------111-------------------");
  427 +
425 if(good.prom_type==1 || good.prom_type==6){ 428 if(good.prom_type==1 || good.prom_type==6){
426 - if(gg.prom_type!=good.prom_type)  
427 - wx.showModal({  
428 - title: '提示',  
429 - content: gg.goods_name+'商品的活动发生了变化'  
430 - });  
431 - return false; 429 + if(gg.prom_type!=good.prom_type) {
  430 + wx.showModal({
  431 + title: '提示',
  432 + content: gg.goods_name+'商品的活动发生了变化'
  433 + });
  434 + return false;
  435 + }
  436 +
432 }else{ 437 }else{
433 438
434 if(gg.prom_type==1 || gg.prom_type==6){ 439 if(gg.prom_type==1 || gg.prom_type==6){
@@ -507,6 +512,8 @@ Page({ @@ -507,6 +512,8 @@ Page({
507 512
508 } 513 }
509 } 514 }
  515 +
  516 + console.log("------------------------------------");
510 517
511 var prom=null; 518 var prom=null;
512 //---如果是活动的时候--- 519 //---如果是活动的时候---