Commit 5d869d2c6dee37a6121e2b98b1abc058fcc449f9

Authored by yvan.ni
1 parent 559eaece

指定门店选择的bug优化

pages/goods/goodsInfo/goodsInfo.js
... ... @@ -4003,7 +4003,32 @@ Page({
4003 4003 }
4004 4004  
4005 4005 var g_distr_type = th.data.sele_g.distr_type;
4006   - wx.hideLoading();
  4006 + wx.hideLoading()
  4007 +
  4008 +
  4009 + /*--- 判断初始的用户的默认门店要不要弄进去 ---*/
  4010 + var fid=-1;
  4011 + if(th.data.fir_def_store){
  4012 + var fid=e.data.data.pageData.findIndex((e)=>{
  4013 + return e.pickup_id==th.data.fir_def_store.pickup_id;
  4014 + })
  4015 + }
  4016 + //--如果找到默认门店,同时也应该判断配送方式对不对--
  4017 + if (th.data.fir_def_store && th.data.fir_def_store.pickup_id && fid<0 &&
  4018 + (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) {
  4019 + th.data.fir_def_store.CanOutQty = 0;
  4020 + //--当选择的门店是客户默认的门店的时候--
  4021 + if (th.data.def_pick_store && th.data.fir_def_store.pickup_id == th.data.def_pick_store.pickup_id) {
  4022 + th.setData({
  4023 + def_pick_store: th.data.fir_def_store
  4024 + });
  4025 + e.data.data.pageData.unshift(th.data.def_pick_store);
  4026 + } else {
  4027 + e.data.data.pageData.splice(1, 0, th.data.fir_def_store);
  4028 + }
  4029 + }
  4030 +
  4031 +
4007 4032  
4008 4033 //单总量超出10个的时候,同时门店有分类
4009 4034 if (e.data.data.total > 10 && e.his_cate_num) {
... ... @@ -4365,8 +4390,14 @@ Page({
4365 4390 em.his_cate_num=e.his_cate_num;
4366 4391  
4367 4392  
  4393 + var fid=-1;
  4394 + if(th.data.fir_def_store){
  4395 + var fid=em.data.data.pageData.findIndex((e)=>{
  4396 + return e.pickup_id==th.data.fir_def_store.pickup_id;
  4397 + })
  4398 + }
4368 4399 //--如果找到默认门店,同时也应该判断配送方式对不对--
4369   - if (th.data.fir_def_store && !is_find_def_store && th.data.fir_def_store.pickup_id &&
  4400 + if (th.data.fir_def_store && th.data.fir_def_store.pickup_id && fid<0 &&
4370 4401 (g_distr_type == 0 || th.data.fir_def_store.distr_type == 0 || th.data.def_pick_store.distr_type == g_distr_type)) {
4371 4402 th.data.fir_def_store.CanOutQty = 0;
4372 4403 //--当选择的门店是客户默认的门店的时候--
... ... @@ -7323,6 +7354,7 @@ Page({
7323 7354 })
7324 7355 }
7325 7356 },
  7357 +
7326 7358 //关闭选择门店
7327 7359 close_popup: function (e) {
7328 7360 var th = this;
... ... @@ -7528,7 +7560,7 @@ Page({
7528 7560  
7529 7561 if (!item) return false;
7530 7562  
7531   - if (item.is_no_dis_nor) {
  7563 + if (item.is_no_dis_nor || (item.is_no_dis_act && !th.data.is_normal)){
7532 7564 wx.showToast({
7533 7565 title: "该门店不可售,请选择其他门店",
7534 7566 icon: 'none',
... ... @@ -8551,7 +8583,7 @@ Page({
8551 8583 let item = f_more[i];
8552 8584 f_more[i].prom_id = item.act_id;
8553 8585 f_more[i].prom_type = 1;
8554   -
  8586 +
8555 8587 var url = "/api/ms/flash_sale/getNew/" + os.stoid + "/" + user_id + "/" + item.act_id;
8556 8588 await getApp().request.promiseGet(url, {}).then(rs => {
8557 8589 if (rs.data.code == 0 && rs.data.data) {
... ...