Commit 46ace1a1 authored by zhengyi's avatar zhengyi

价格设置页面的线路选择器bug修复

parent 5d4ce54e
...@@ -16,7 +16,8 @@ ...@@ -16,7 +16,8 @@
v-model="destCountryIds" v-model="destCountryIds"
multiple multiple
clearable> clearable>
<el-option v-for="item in countryList" :key="item.id" :label="$l(item, 'title')" :value="item.id"/> <el-option v-for="item in destCountryList" :key="item.guojia"
:label="isChinese ? item.guojiaName : item.guojiaNameEn" :value="item.guojia"/>
</el-select> </el-select>
{{ $t('目的城市') }}: {{ $t('目的城市') }}:
...@@ -29,19 +30,21 @@ ...@@ -29,19 +30,21 @@
v-model="destCityIds" v-model="destCityIds"
multiple multiple
clearable> clearable>
<el-option v-for="item in AddressCity" :key="item.shi" :label="item.shiName" :value="item.shi"/> <el-option v-for="item in destCityList" :key="item.shi" :label="isChinese ? item.shiName : item.shiNameEn"
:value="item.shi"/>
</el-select> </el-select>
{{ $t('目的仓') }}: {{ $t('目的仓') }}:
<el-select :placeholder="$t('请选择目的仓')" <el-select :placeholder="$t('请选择目的仓')"
v-model="destWarehouseIds" v-model="destWarehouseIds"
multiple multiple
clearable> clearable>
<el-option v-for="item in AddressTown" :key="item.id" :label="item.titleZh" :value="item.id"/> <el-option v-for="item in destWarehouseList" :key="item.warehouseId"
:label="isChinese ? item.warehouseTitleZh : item.warehouseTitleEn" :value="item.warehouseId"/>
</el-select> </el-select>
<template v-if="type != 'sea'"> <template v-if="type != 'sea'">
{{ $t('出货渠道') }}: {{ $t('出货渠道') }}:
<el-select :placeholder="$t('请选择出货渠道')" v-model="channelId" clearable> <el-select :placeholder="$t('请选择出货渠道')" v-model="channelIds" clearable multiple>
<el-option v-for="item in channelList" :key="item.channelId" :label="item.nameZh" :value="item.channelId"/> <el-option v-for="item in channelList" :key="item.channelId" :label="item.nameZh" :value="item.channelId"/>
</el-select> </el-select>
</template> </template>
...@@ -113,7 +116,7 @@ ...@@ -113,7 +116,7 @@
import {getChannelList} from '@/api/ecw/channel' import {getChannelList} from '@/api/ecw/channel'
import {getListTree, getTradeCityList} from '@/api/ecw/region' import {getListTree, getTradeCityList} from '@/api/ecw/region'
import {getRegionList} from "@/api/ecw/order"; import {getRegionList} from "@/api/ecw/order";
import {openedRouterList} from '@/api/ecw/warehouse' import {getGuojiaAndShiAndWarehouseList, openedRouterList} from '@/api/ecw/warehouse'
import {getProductAttrList} from "@/api/ecw/productAttr"; import {getProductAttrList} from "@/api/ecw/productAttr";
import Template from "@/views/cms/template"; import Template from "@/views/cms/template";
...@@ -153,22 +156,31 @@ export default { ...@@ -153,22 +156,31 @@ export default {
destCountryId: null, destCountryId: null,
destCityId: null, destCityId: null,
destWarehouseId: null, destWarehouseId: null,
destCountryList: [],//目的国
destCityList: [],//目的城市
destWarehouseList: [],//目的仓
destCountryIds: [], destCountryIds: [],
destCityIds: [], destCityIds: [],
destWarehouseIds: [], destWarehouseIds: [],
channelIds: [],
} }
}, },
computed: { computed: {
isChinese() {
return this.$i18n.locale === "zh_CN"
},
importCityList() { importCityList() {
return this.tradeCityList.filter(item => item.type == 1 || item.type == 3) return this.tradeCityList.filter(item => item.type == 1 || item.type == 3)
}, },
exportCityList() { exportCityList() {
//字典:贸易类型字典region_trade_type,0非进出口,1进口,2出口,3进出口 //字典:贸易类型字典region_trade_type,0非进出口,1进口,2出口,3进出口
console.log("进出口城市列表", this.tradeCityList)
return this.tradeCityList.filter(item => item.type == 2 || item.type == 3) return this.tradeCityList.filter(item => item.type == 2 || item.type == 3)
}, },
exportCityIds() { exportCityIds() {
let ids = [] let ids = []
console.log("出口城市列表", this.exportCityList)
this.exportCityList.forEach(item => { this.exportCityList.forEach(item => {
ids.push(item.id) ids.push(item.id)
}) })
...@@ -183,16 +195,23 @@ export default { ...@@ -183,16 +195,23 @@ export default {
}, },
// 根据选择的渠道筛选 // 根据选择的渠道筛选
availChannelList() { availChannelList() {
return this.channelList.filter(item => !this.channelId || this.channelId == item.channelId) return this.channelList.filter(item => !this.channelIds || this.channelIds.includes(item.channelId))
}, },
filteredRouterList() { filteredRouterList() {
let transportTypeList = [] let transportTypeList = []
if (!this.transportType) {
this.transportType = this.type == "sea" ? 1 : 3
}
this.transportTypeDicts this.transportTypeDicts
.filter(this.transportFilter) .filter(this.transportFilter)
.filter(transport => !this.channelId || transport.cssClass == 'channel') .filter(transport => !this.channelId || transport.cssClass == 'channel')
.forEach(item => { .forEach(item => {
console.log("运输方式", this.transportType)
if (this.transportType === null || this.transportType == '' || this.transportType == item.value) { if (this.transportType === null || this.transportType == '' || this.transportType == item.value) {
let routerList = [] let routerList = []
console.log("开通的线路", this.openedRouterList)
this.openedRouterList.forEach(router => { this.openedRouterList.forEach(router => {
if (router.transportType == item.value) { if (router.transportType == item.value) {
let availChannels = [] let availChannels = []
...@@ -226,7 +245,7 @@ export default { ...@@ -226,7 +245,7 @@ export default {
transportTypeList.push(child) transportTypeList.push(child)
} }
}) })
console.log(transportTypeList) console.log("运输线路", transportTypeList)
return transportTypeList return transportTypeList
}, },
// 是否显示商品特性(渠道) // 是否显示商品特性(渠道)
...@@ -299,21 +318,12 @@ export default { ...@@ -299,21 +318,12 @@ export default {
//监听当前地区值的变化,于与上方地区值进行了双向绑定 //监听当前地区值的变化,于与上方地区值进行了双向绑定
deep: true, //深度监听 deep: true, //深度监听
handler() { handler() {
//每当值省份值改变时其下地区值进行清空 console.log("目的国家id集合变更", this.destCityIds)
this.AddressCity = []; this.destWarehouseIds = [];
this.AddressTown = []; this.destCityIds = [];
this.destWarehouseIds = "";
this.destCityIds = "";
this.findByprovinceCode();
if (this.destCountryIds && this.destCountryIds.length > 0) { if (this.destCountryIds && this.destCountryIds.length > 0) {
//1 是所有区域,2 国家,3是市, this.destCityList = this.AddressCity.filter(item => this.destCountryIds.includes(item.guojia))
this.getAddressCity() this.destWarehouseList = this.AddressTown.filter(item => this.destCountryIds.includes(item.guojia))
this.getAddressTown()
} else if (
this.destCountryIds && this.destCountryIds.length > 0 &&
this.destCityIds && this.destCityIds.size() > 0
) {
this.getAddressTown()
} }
this.getOpenedRouterList() this.getOpenedRouterList()
}, },
...@@ -321,62 +331,31 @@ export default { ...@@ -321,62 +331,31 @@ export default {
destCityIds: { destCityIds: {
deep: true, //深度监听 目的仓 deep: true, //深度监听 目的仓
handler() { handler() {
this.AddressTown = []; console.log("目的城市id集合变更", this.destCityIds)
this.destWarehouseIds = ""; this.destWarehouseIds = [];
this.findBycityCode(); if (this.destCityIds && this.destCityIds.length > 0) {
if ( let cityCountryIdList = this.destCityList.filter(item => this.destCityIds.includes(item.shi)).map((city) => {
this.destCountryIds && this.destCountryIds.length > 0 && return city.guojia
this.destCityIds && this.destCityIds.length > 0 && })
this.destWarehouseIds && this.destWarehouseIds.length > 0 this.destCountryList = this.countryList.filter(item => cityCountryIdList.includes(item.guojia))
) { this.destWarehouseList = this.AddressTown.filter(item => this.destCityIds.includes(item.shi))
//获取当前城市值id,获取该城市下区域
} else if (
this.destCountryIds && this.destCountryIds.length > 0 &&
this.destCityIds && this.destCityIds.length > 0 &&
this.destWarehouseIds && this.destWarehouseIds.length > 0
) {
this.getAddressTown()
} else if (
this.destCountryIds && this.destCountryIds.length > 0 &&
this.destCityIds && this.destCityIds.length > 0
) {
this.findByprovinceCode()
this.getAddressTown()
} else if (
this.destCountryIds && this.destCountryIds.length > 0 &&
this.destCityIds && this.destCityIds.length > 0 &&
this.destWarehouseIds && this.destWarehouseIds.length > 0
) {
//获取当前城市值id,获取该城市下区域
} }
this.getOpenedRouterList() this.getOpenedRouterList()
this.getChannelList()
}, },
}, },
destWarehouseIds: { destWarehouseIds: {
deep: true, //深度监听 deep: true, //深度监听
handler() { handler() {
if ( console.log("目的仓库id集合变更", this.destWarehouseIds)
this.destCountryIds && this.destCountryIds.length > 0 && if (this.destWarehouseIds && this.destWarehouseIds.length > 0) {
this.destCityIds && this.destCityIds.length > 0 && let warehouseCountryIdList = this.destWarehouseList.filter(item => this.destWarehouseIds.includes(item.warehouseId)).map((warehouse) => {
this.destWarehouseIds && this.destWarehouseIds.length > 0 return warehouse.guojia
) { })
//获取当前城市值id,获取该城市下区域 this.destCountryList = this.countryList.filter(item => warehouseCountryIdList.includes(item.guojia))
this.findBycityCode() let warehouseCityIdList = this.destWarehouseList.filter(item => this.destWarehouseIds.includes(item.warehouseId)).map((warehouse) => {
} else if ( return warehouse.shi
this.destCountryIds && this.destCountryIds.length > 0 && })
this.destCityIds && this.destCityIds.length > 0 && this.destCityList = this.AddressCity.filter(item => warehouseCityIdList.includes(item.shi))
this.destWarehouseIds && this.destWarehouseIds.length > 0
) {
this.getAddressTown()
} else if (
this.destCountryIds && this.destCountryIds.length > 0 &&
this.destCityIds && this.destCityIds.length > 0 &&
this.destWarehouseIds && this.destWarehouseIds.length > 0
) {
this.findBycityCode()
} }
this.getOpenedRouterList() this.getOpenedRouterList()
}, },
...@@ -390,9 +369,10 @@ export default { ...@@ -390,9 +369,10 @@ export default {
this.changeOption() this.changeOption()
} }
await this.$nextTick() await this.$nextTick()
this.getCountryList() this.getGuojiaAndShiAndWarehouseList()
this.getAddressCity() // this.getCountryList()
this.getAddressTown() // this.getAddressCity()
// this.getAddressTown()
this.getChannelList() this.getChannelList()
if (this.value && this.value.length) { if (this.value && this.value.length) {
this.selectedRoutes = this.value this.selectedRoutes = this.value
...@@ -417,6 +397,20 @@ export default { ...@@ -417,6 +397,20 @@ export default {
this.channelList = res.data this.channelList = res.data
}) })
}, },
getGuojiaAndShiAndWarehouseList() {
getGuojiaAndShiAndWarehouseList({tradeType: 1}).then(res => {
let guojiaAndShiAndWarehouse = res.data
console.log("全部的国家、城市、仓库关联数据", guojiaAndShiAndWarehouse)
// 常量选项
this.countryList = guojiaAndShiAndWarehouse.guojiaList;
this.AddressCity = guojiaAndShiAndWarehouse.shiList;
this.AddressTown = guojiaAndShiAndWarehouse.warehouseList;
// 临时筛选项
this.destCountryList = guojiaAndShiAndWarehouse.guojiaList;
this.destCityList = guojiaAndShiAndWarehouse.shiList;
this.destWarehouseList = guojiaAndShiAndWarehouse.warehouseList;
})
},
getAttrList() { getAttrList() {
getProductAttrList().then(res => { getProductAttrList().then(res => {
this.attrList = res.data this.attrList = res.data
...@@ -447,7 +441,7 @@ export default { ...@@ -447,7 +441,7 @@ export default {
params.startCityId = this.exportCity params.startCityId = this.exportCity
} }
if (this.destCountryIds) { if (this.destCountryIds) {
params.destCountryIds = this.destCountryId params.destCountryIds = this.destCountryIds
} }
if (this.destCityIds) { if (this.destCityIds) {
params.destCityIds = this.destCityIds params.destCityIds = this.destCityIds
...@@ -513,21 +507,21 @@ export default { ...@@ -513,21 +507,21 @@ export default {
return (this.type == 'sea' ? ['1', '2'] : ['3', '4']).indexOf(item.value) > -1 return (this.type == 'sea' ? ['1', '2'] : ['3', '4']).indexOf(item.value) > -1
}, },
/* 国家 */ /* 国家 */
getCountryList() { // getCountryList() {
getListTree({treeType: 1}).then((response) => { // getListTree({treeType: 1}).then((response) => {
this.countryList = response.data; // this.countryList = response.data;
}) // })
}, // },
getAddressCity() { // getAddressCity() {
getRegionList(4, 4).then(({data}) => { // getRegionList(4, 4).then(({data}) => {
this.AddressCity = data; // this.AddressCity = data;
}) // })
}, // },
getAddressTown() { // getAddressTown() {
getRegionList(5, 5).then(({data}) => { // getRegionList(5, 5).then(({data}) => {
this.AddressTown = data; // this.AddressTown = data;
}) // })
}, // },
findByprovinceCode() { findByprovinceCode() {
if (this.destCountryIds != null && this.destCountryIds.length > 0) { if (this.destCountryIds != null && this.destCountryIds.length > 0) {
//获取当前省份值id,获取该省份下城市 destCountryId provinceCode //获取当前省份值id,获取该省份下城市 destCountryId provinceCode
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment