From eb852c8d176e4245e8726c2fb0718b7d6b04cd9f Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Thu, 23 May 2024 14:53:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=A2=9E=E5=8A=A0=E9=BB=98=E8=AE=A4=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E9=97=A8=E5=BA=97=20=20=E5=BD=93=E9=80=89=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E9=97=A8=E5=BA=97=E6=97=A0=E8=B4=A7=E6=BA=90=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E4=BD=BF=E7=94=A8=E9=BB=98=E8=AE=A4=E9=97=A8=E5=BA=97?= =?UTF-8?q?=E5=8F=91=E8=B4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/goods_details/index.vue | 52 ++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/pages/goods_details/index.vue b/pages/goods_details/index.vue index aca1490..d2510ff 100644 --- a/pages/goods_details/index.vue +++ b/pages/goods_details/index.vue @@ -440,11 +440,6 @@ - - - - - @@ -649,9 +644,11 @@ intervalId: '', // 特殊商品处理 agent_two_ids: [], + agent_two_mer_id: 0,// 默认发货门店 province_list: [],// 地区列表 province_has_list: [],// 存在货源的地区ids province_has_info_list: [],// 存在货源的地区信息列表 + province_default: {},// 默认发货地区信息 current_province_info: [],// 所在地区 send_province_info: [],// 发货地区 @@ -1147,6 +1144,7 @@ that.$set(that, 'svipPrice', res.data.show_svip_info && res.data.show_svip_info.show_svip_price || false); // 省公司门店特殊商品处理 that.$set(that, 'agent_two_ids', res.data.agent_two_ids || []) + that.$set(that, 'agent_two_mer_id', res.data.agent_two_mer_id || []) that.$set(that, 'province_list', res.data.province_list || []) that.$set(that, 'province_has_list', res.data.province_has_list || []) @@ -1866,17 +1864,25 @@ // console.log('当前选中地区 无货源') _this.getProvinceHasList();// 获取有货源的列表 if (Object.values(_this.province_has_info_list).length >= 2) { - // 有货源的地区大于二 - // console.log('有货源的地区大于二') - uni.showModal({ - title: '提示', - content: '本地区暂无库存,请选择发货地区!', - confirmText: '去选择', - showCancel: false, - success: (res) => { - _this.$refs.sendProvincePopup.open('bottom'); - } - }); + // 有货源的地区大于二 判断:默认发货门店是否有货源;有货源的直接使用默认门店,无货源则选择 + // console.log('有货源的门店列表', Object.values(_this.province_has_list)) + // console.log("默认发货门店id", _this.agent_two_mer_id) + if(Object.values(_this.province_has_list).includes(Number(_this.agent_two_mer_id))){ + // 默认发货门店存在货源 + // console.log("默认发货门店", _this.province_default) + _this.send_province_info = _this.province_default; + } else{ + // 默认发货门店不存在货源 + uni.showModal({ + title: '提示', + content: '本地区暂无库存,请选择发货地区!', + confirmText: '去选择', + showCancel: false, + success: (res) => { + _this.$refs.sendProvincePopup.open('bottom'); + } + }); + } } else if (Object.values(_this.province_has_info_list).length == 1) { // 有货源的地区等于1 @@ -1908,9 +1914,14 @@ let _this = this; let list = []; Object.values(_this.province_list).forEach((item) => { + // 获取存在货源列表 if(Object.values(_this.province_has_list).includes(Number(item.mer_id))){ list[Object.values(list).length] = Object.assign({}, item); } + // 默认发货地区信息 + if(_this.agent_two_mer_id > 0 && Number(_this.agent_two_mer_id) === Number(item.mer_id)){ + _this.province_default = Object.assign({}, item); + } }) _this.province_has_info_list = Object.values(list); @@ -1921,12 +1932,6 @@ this.$refs.sendProvincePopup.close(); }, - - - - - - } } @@ -2008,9 +2013,6 @@ } } - - - .ml8{ top:2rpx }