Commit e10c6941 authored by dragondean@qq.com's avatar dragondean@qq.com

修改创建订单运输部分联动异常

parent f6559c8c
...@@ -114,8 +114,11 @@ ...@@ -114,8 +114,11 @@
<view class="corder-tab1-item corder-picker"> <view class="corder-tab1-item corder-picker">
<image src="../../static/img/corder-1-1.png" mode=""></image> <image src="../../static/img/corder-1-1.png" mode=""></image>
<text><span class="redcolor">*</span>{{$lang.lang.create.method}}</text> <text><span class="redcolor">*</span>{{$lang.lang.create.method}}</text>
<picker :class="config.transport.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :value="config.transport.index" :range="config.transport.label" data-config="transport" data-key="transportId" @change="configChange" v-if="config.transport.value.length > 0"> <!--<picker :class="config.transport.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :value="config.transport.index" :range="config.transport.label" data-config="transport" data-key="transportId" @change="handleChangeTransport" v-if="config.transport.value.length > 0">
<view class="uni-input">{{config.transport.label[config.transport.index]}}</view> <view class="uni-input">{{config.transport.label[config.transport.index]}}</view>
</picker>-->
<picker class="v-picker" :value="currentTransportIndex" :range="transportList" :range-key="transportRangeKey" @change="changeTransport">
<view class="uni-input">{{currentTransportIndex !== null ? transportList[currentTransportIndex][transportRangeKey] : $lang.lang.create.choose}}</view>
</picker> </picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image> <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
</view> </view>
...@@ -123,8 +126,11 @@ ...@@ -123,8 +126,11 @@
<view class="corder-tab1-item corder-picker"> <view class="corder-tab1-item corder-picker">
<image src="../../static/img/corder-1-3.png" mode=""></image> <image src="../../static/img/corder-1-3.png" mode=""></image>
<text><span class="redcolor">*</span>{{$lang.lang.create.startCity}}</text> <text><span class="redcolor">*</span>{{$lang.lang.create.startCity}}</text>
<picker :class="config.tradeCity1.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :value="config.tradeCity1.index" :range="config.tradeCity1.label" data-config="tradeCity1" data-key="departureId" @change="configChange" v-if="config.tradeCity1.value.length > 0"> <!--<picker :class="config.tradeCity1.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :value="config.tradeCity1.index" :range="config.tradeCity1.label" data-config="tradeCity1" data-key="departureId" @change="configChange" v-if="config.tradeCity1.value.length > 0">
<view class="uni-input">{{config.tradeCity1.label[config.tradeCity1.index]}}</view> <view class="uni-input">{{config.tradeCity1.label[config.tradeCity1.index]}}</view>
</picker>-->
<picker class="v-picker" :value="currentStartCityIndex" :range="startCityList" :range-key="startCityRangeKey" @change="changeStartCity">
<view class="uni-input">{{currentStartCityIndex !== null ? startCityList[currentStartCityIndex][startCityRangeKey] : $lang.lang.create.choose}}</view>
</picker> </picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image> <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
</view> </view>
...@@ -132,8 +138,8 @@ ...@@ -132,8 +138,8 @@
<view class="corder-tab1-item corder-picker"> <view class="corder-tab1-item corder-picker">
<image src="../../static/img/corder-1-4.png" mode=""></image> <image src="../../static/img/corder-1-4.png" mode=""></image>
<text><span class="redcolor">*</span>{{$lang.lang.create.dstCountry}}</text> <text><span class="redcolor">*</span>{{$lang.lang.create.dstCountry}}</text>
<picker class="v-picker" :range="dstCountryList" :range-key="$lang.locale == 'zh' ? 'guojiaName' : 'guojiaNameEn'" :value="currentDstCountryIndex" @change="changeDstCountry"> <picker class="v-picker" :range="dstCountryList" :range-key="guojiaRangeKey" :value="currentDstCountryIndex" @change="changeDstCountry">
<view class="uni-input">{{currentDstCountryIndex !== null ? dstCountryList[currentDstCountryIndex][$lang.locale == 'zh' ? 'guojiaName' : 'guojiaNameEn'] : $lang.lang.create.choose}}</view> <view class="uni-input">{{currentDstCountryIndex !== null ? dstCountryList[currentDstCountryIndex][guojiaRangeKey] : $lang.lang.create.choose}}</view>
</picker> </picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image> <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
</view> </view>
...@@ -141,8 +147,8 @@ ...@@ -141,8 +147,8 @@
<view class="corder-tab1-item corder-picker"> <view class="corder-tab1-item corder-picker">
<image src="../../static/img/corder-1-4.png" mode=""></image> <image src="../../static/img/corder-1-4.png" mode=""></image>
<text><span class="redcolor">*</span>{{$lang.lang.create.endCity}}</text> <text><span class="redcolor">*</span>{{$lang.lang.create.endCity}}</text>
<picker class="v-picker" :range="filteredDstCityList" :range-key="$lang.locale == 'zh' ? 'shiName' : 'shiNameEn'" :value="currentDstCityIndex" @change="changeDstCity"> <picker class="v-picker" :range="filteredDstCityList" :range-key="shiRangeKey" :value="currentDstCityIndex" @change="changeDstCity">
<view class="uni-input">{{ currentDstCityIndex !== null ? filteredDstCityList[currentDstCityIndex][$lang.locale == 'zh' ? 'shiName' : 'shiNameEn'] : $lang.lang.create.choose }}</view> <view class="uni-input">{{ currentDstCityIndex !== null ? filteredDstCityList[currentDstCityIndex][shiRangeKey] : $lang.lang.create.choose }}</view>
</picker> </picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image> <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
</view> </view>
...@@ -150,16 +156,22 @@ ...@@ -150,16 +156,22 @@
<view class="corder-tab1-item corder-picker"> <view class="corder-tab1-item corder-picker">
<image src="../../static/img/corder-1-5.png" mode=""></image> <image src="../../static/img/corder-1-5.png" mode=""></image>
<text><span class="redcolor">*</span>{{$lang.lang.notices.lined}}</text> <text><span class="redcolor">*</span>{{$lang.lang.notices.lined}}</text>
<picker :disabled="openedRouterF||!params.transportId" :class="config.openedRouter.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :value="config.openedRouter.index" :range="config.openedRouter.label" data-config="openedRouter" data-key="lineId" @change="configChange" v-if="config.openedRouter.value.length > 0"> <!--<picker :disabled="openedRouterF||!params.transportId" :class="config.openedRouter.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :value="config.openedRouter.index" :range="config.openedRouter.label" data-config="openedRouter" data-key="lineId" @change="configChange" v-if="config.openedRouter.value.length > 0">
<view class="uni-input">{{config.openedRouter.label[config.openedRouter.index]}}</view> <view class="uni-input">{{config.openedRouter.label[config.openedRouter.index]}}</view>
</picker>-->
<picker class="v-picker" :value="currentRouteIndex" :range="routerList" :range-key="routerRangeKey" @change="changeRoute">
<view class="uni-input">{{currentRouteIndex !== null ? routerList[currentRouteIndex][routerRangeKey] : $lang.lang.create.choose}}</view>
</picker> </picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image> <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
</view> </view>
<view class="corder-tab1-item corder-picker" v-if="!channeled"> <view class="corder-tab1-item corder-picker" v-if="!channeled">
<image src="../../static/img/corder-1-2.png" mode=""></image> <image src="../../static/img/corder-1-2.png" mode=""></image>
<text>{{$lang.lang.create.channel}}</text> <text>{{$lang.lang.create.channel}}</text>
<picker :class="config.channel.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :disabled="channeled" :value="config.channel.index" :range="config.channel.label" data-config="channel" data-key="channelId" @change="configChange" v-if="config.channel.value.length > 0"> <!--<picker :class="config.channel.index == 0 ? 'v-picker v-picker-2' : 'v-picker'" :disabled="channeled" :value="config.channel.index" :range="config.channel.label" data-config="channel" data-key="channelId" @change="configChange" v-if="config.channel.value.length > 0">
<view class="uni-input">{{config.channel.label[config.channel.index]}}</view> <view class="uni-input">{{config.channel.label[config.channel.index]}}</view>
</picker>-->
<picker class="v-picker" :value="currentChannelIndex" :range="channelList" :range-key="channelRangeKey" @change="changeChannel">
<view class="uni-input">{{currentChannelIndex !== null ? channelList[currentChannelIndex][channelRangeKey] : $lang.lang.create.choose}}</view>
</picker> </picker>
<image class="rgt" src="../../static/img/rgt.png" mode=""></image> <image class="rgt" src="../../static/img/rgt.png" mode=""></image>
</view> </view>
...@@ -924,16 +936,30 @@ ...@@ -924,16 +936,30 @@
format: true format: true
}) })
return { return {
// 始发城市
startCityList:[],
currentStartCityIndex: null,
// 路线
routerList: [],
currentRouteIndex: null,
// 渠道
channelList:[],
currentChannelIndex: null,
// 运输方式
transportList: [],
currentTransportIndex: null,
// 目的国
dstCountryList:[], dstCountryList:[],
// 当前国家索引
currentDstCountryIndex: null,
// 目的城市
dstCityList: [], dstCityList: [],
// 当前展示的目的城市列表 // 当前展示的目的城市列表
filteredDstCityList:[], filteredDstCityList:[],
// 当前国家索引
currentDstCountryIndex: null,
// 当前城市索引 // 当前城市索引
currentDstCityIndex: null, currentDstCityIndex: null,
// 路线
routerList:[],
items:[ items:[
{ {
value:"1", value:"1",
...@@ -1145,6 +1171,8 @@ ...@@ -1145,6 +1171,8 @@
}, },
async onLoad (op) { async onLoad (op) {
await this.getDstCountryList() await this.getDstCountryList()
await this.getTransport()
await this.getStartCity()
// this.getZd() // this.getZd()
this.getTreeList() this.getTreeList()
this.getCurrencyData() this.getCurrencyData()
...@@ -1158,8 +1186,8 @@ ...@@ -1158,8 +1186,8 @@
this.orderConfig('harvest_method', 'harvestMethod') this.orderConfig('harvest_method', 'harvestMethod')
// this.orderConfig('commission_currency_type', 'currencyType') // this.orderConfig('commission_currency_type', 'currencyType')
this.getCurrencyList() this.getCurrencyList()
this.getTradeCity('tradeCity1') // this.getTradeCity('tradeCity1')
this.getTradeCity('tradeCity2') // this.getTradeCity('tradeCity2')
this.getChanel() this.getChanel()
this.getProductAttrList() this.getProductAttrList()
this.getproductData() this.getproductData()
...@@ -1171,7 +1199,7 @@ ...@@ -1171,7 +1199,7 @@
this.orderId = op.id this.orderId = op.id
} }
if(op.transportId){ if(op.transportId){
this.params.transportId = op.transportId /*this.params.transportId = op.transportId
setTimeout(()=>{ setTimeout(()=>{
this.getConfigIndex('transport',op.transportId) this.getConfigIndex('transport',op.transportId)
},1000) },1000)
...@@ -1179,7 +1207,12 @@ ...@@ -1179,7 +1207,12 @@
this.channeled = false this.channeled = false
} }
this.openedRouterF = false this.openedRouterF = false
this.getOpenedRouter() this.getOpenedRouter()*/
const transIndex = this.transportList.findIndex(item => item.value == op.transportId)
if(transIndex > -1){
// 模拟选择
this.changeTransport({detail: {value: transIndex}})
}
} }
// this.gertConsignorId() // this.gertConsignorId()
}, },
...@@ -1195,6 +1228,24 @@ ...@@ -1195,6 +1228,24 @@
}, },
isOverSearWarehouse(){ isOverSearWarehouse(){
return this.params.type?.indexOf('2') != -1 return this.params.type?.indexOf('2') != -1
},
transportRangeKey(){
return this.$lang.locale == 'zh' ? 'label' : 'labelEn'
},
guojiaRangeKey(){
return this.$lang.locale == 'zh' ? 'guojiaName' : 'guojiaNameEn'
},
shiRangeKey(){
return this.$lang.locale == 'zh' ? 'shiName' : 'shiNameEn'
},
channelRangeKey(){
return this.$lang.locale == 'zh' ? 'nameZh' : 'nameEn'
},
routerRangeKey(){
return 'showName'
},
startCityRangeKey(){
return this.$lang.locale == 'zh' ? 'titleZh' : 'titleEn'
} }
}, },
watch:{ watch:{
...@@ -1446,7 +1497,10 @@ ...@@ -1446,7 +1497,10 @@
that.getChanel() that.getChanel()
} }
if(e.target.dataset.key=='channelId'){ if(e.target.dataset.key=='channelId'){
// 没有选择目的城市才需要更换
if(this.currentDstCityIndex === null){
that.getTradeCity('tradeCity2') that.getTradeCity('tradeCity2')
}
} }
if(e.target.dataset.key =='channelId' || e.target.dataset.key == 'transportId' || e.target.dataset.key == 'departureId' || e.target.dataset.key == 'objectiveId') { if(e.target.dataset.key =='channelId' || e.target.dataset.key == 'transportId' || e.target.dataset.key == 'departureId' || e.target.dataset.key == 'objectiveId') {
if(!that.params.channelId || !that.params.transportId ||!that.params.lineId ||(that.params.departureId != 0 && this.params.objectiveId != 0)){ if(!that.params.channelId || !that.params.transportId ||!that.params.lineId ||(that.params.departureId != 0 && this.params.objectiveId != 0)){
...@@ -2753,6 +2807,10 @@ ...@@ -2753,6 +2807,10 @@
} }
}) })
}, },
async getStartCity(){
const res = await this.$request.get('/app-api/ecw/region/getTradeCityList', {type: 2})
this.startCityList = res.data || []
},
//获取始发、目的城市 //获取始发、目的城市
getTradeCity(key){ getTradeCity(key){
let that = this let that = this
...@@ -2771,7 +2829,6 @@ ...@@ -2771,7 +2829,6 @@
that.$request.get('/app-api/ecw/region/getTradeCityList', param).then(res => { that.$request.get('/app-api/ecw/region/getTradeCityList', param).then(res => {
if(res.code==0&&res.data&&res.data.length > 0){ if(res.code==0&&res.data&&res.data.length > 0){
let d = res.data let d = res.data
this.tradeCityList = res.data
for(let i in d){ for(let i in d){
if(that.$lang.locale=='zh'){ if(that.$lang.locale=='zh'){
that.config[key].label.push(d[i].titleZh) that.config[key].label.push(d[i].titleZh)
...@@ -2784,12 +2841,12 @@ ...@@ -2784,12 +2841,12 @@
}) })
}, },
//获取出货渠道 //获取出货渠道
getChanel(){ async getChanel(){
this.config.channel = { /*this.config.channel = {
index: 0, index: 0,
label: [this.$lang.lang.notices.please], label: [this.$lang.lang.notices.please],
value: [''], value: [''],
} }*/
let that = this let that = this
let params={} let params={}
...@@ -2799,7 +2856,10 @@ ...@@ -2799,7 +2856,10 @@
if(that.currentDstCountryIndex !== null){ if(that.currentDstCountryIndex !== null){
params.countryId = this.dstCountryList[this.currentDstCountryIndex].guojia params.countryId = this.dstCountryList[this.currentDstCountryIndex].guojia
} }
that.$request.get('/app-api/ecw/channel/select',params).then(res => { const res = await that.$request.get('/app-api/ecw/channel/select',params)
this.channelList = res.data || []
/*
.then(res => {
if(res.code==0&&res.data&&res.data.length > 0){ if(res.code==0&&res.data&&res.data.length > 0){
let d = res.data let d = res.data
for(let i in d){ for(let i in d){
...@@ -2811,10 +2871,10 @@ ...@@ -2811,10 +2871,10 @@
that.config['channel'].value.push(d[i].channelId) that.config['channel'].value.push(d[i].channelId)
} }
} }
}) })*/
}, },
//获取线路 //获取线路
getOpenedRouter () { async getOpenedRouter () {
let that = this let that = this
let params = {} let params = {}
if(that.params.channelId){ if(that.params.channelId){
...@@ -2832,7 +2892,17 @@ ...@@ -2832,7 +2892,17 @@
if(this.currentDstCountryIndex !== null){ if(this.currentDstCountryIndex !== null){
params.destCountryId = this.dstCountryList[this.currentDstCountryIndex].guojia params.destCountryId = this.dstCountryList[this.currentDstCountryIndex].guojia
} }
that.$request.post('/app-api/ecw/warehouse/openedRouterList', params).then(res => { const res = await that.$request.post('/app-api/ecw/warehouse/openedRouterList', params)
if(!res.data.length){
return this.routerList = []
}
this.routerList = res.data.map(item => {
item.showName = this.$lang.locale == 'zh' ? `${item.startTitleZh} >> ${item.destTitleZh}` : `${item.startTitleEn} >> ${item.destTitleEn}`
return item
})
/*
.then(res => {
if(res.code==0&&res.data&&res.data.length > 0){ if(res.code==0&&res.data&&res.data.length > 0){
let d = res.data let d = res.data
this.routerList = res.data this.routerList = res.data
...@@ -2909,7 +2979,7 @@ ...@@ -2909,7 +2979,7 @@
that.orderConfig('harvest_method', 'harvestMethod') that.orderConfig('harvest_method', 'harvestMethod')
} }
} }
}) })*/
}, },
...@@ -3068,41 +3138,127 @@ ...@@ -3068,41 +3138,127 @@
changeDstCountry(e){ changeDstCountry(e){
console.log("changeDstCountry", e) console.log("changeDstCountry", e)
this.currentDstCountryIndex = e.detail.value this.currentDstCountryIndex = e.detail.value
// 重置目的城市
this.currentDstCityIndex = null this.currentDstCityIndex = null
this.params.objectiveId = '' this.params.objectiveId = ''
this.filteredDstCityList = this.dstCityList.filter(item => item.guojia == this.dstCountryList[this.currentDstCountryIndex].guojia) this.filteredDstCityList = this.dstCityList.filter(item => item.guojia == this.dstCountryList[this.currentDstCountryIndex].guojia)
// 重置渠道 // 重置线路
this.params.channelId = ''
this.getChanel()
// 切换国家,路线要重置
this.resetRoutes() this.resetRoutes()
console.log("this.resetRoutes()", {...this.config.openedRouter})
this.getOpenedRouter() this.getOpenedRouter()
// 如果是空运则重置渠道
this.resetChannelIfAir()
}, },
changeDstCity(e){ changeDstCity(e){
console.log("changeDstCity", e)
this.currentDstCityIndex = e.detail.value this.currentDstCityIndex = e.detail.value
this.params.objectiveId = this.filteredDstCityList[this.currentDstCityIndex].shi this.params.objectiveId = this.filteredDstCityList[this.currentDstCityIndex].shi
// 切换城市,路线要重置
this.resetRoutes()
this.getOpenedRouter()
// 如果是空运则重置渠道
this.resetChannelIfAir()
},
resetRoutes(){
this.currentRouteIndex = null
this.params.lineId = ''
},
// 如果是空运则重置渠道
resetChannelIfAir(){
if(this.currentTransportIndex === null){
return
}
// 如果是空运则重置渠道
if(this.transportList[this.currentTransportIndex].value == 3){
this.params.channelId = ''
this.getChanel()
}
},
async getTransport(){
const res = await this.$request.getConfig("transport_type")
console.log("transport", res)
this.transportList = res.data.list
},
changeTransport(e){
console.log("changeTransport", e)
this.currentTransportIndex = e.detail.value
this.params.transportId = this.transportList[this.currentTransportIndex].value
// 重置渠道 // 重置渠道
this.currentChannelIndex = null
this.params.channelId = '' this.params.channelId = ''
// 空运则加载渠道
if(this.params.transportId == 3){
this.channeled = false
this.getChanel() this.getChanel()
}else this.channeled = true
// 切换城市,路线要重置 // 重置并重新获取线路
this.currentRouteIndex = null
this.params.lineId = ''
this.getOpenedRouter()
},
changeChannel(e){
this.currentChannelIndex = e.detail.value
this.params.channelId = this.channelList[this.currentChannelIndex].channelId
// 如果未选择目的城市,则需要根据渠道回显目的国
if(this.currentDstCityIndex === null){
const countryId = this.channelList[this.currentChannelIndex].countryId
const dstCountryIndex = this.dstCountryList.findIndex(item => item.guojia == countryId)
if(dstCountryIndex > -1 && dstCountryIndex != this.currentDstCountryIndex){
this.currentDstCountryIndex = dstCountryIndex
this.params.objectiveId = ''
this.filteredDstCityList = this.dstCityList.filter(item => item.guojia == this.dstCountryList[this.currentDstCountryIndex].guojia)
// 重置城市和目的国之后需要重新加载路线
this.resetRoutes() this.resetRoutes()
console.log("this.resetRoutes()", {...this.config.openedRouter})
this.getOpenedRouter() this.getOpenedRouter()
}
}
}, },
resetRoutes(){ changeRoute(e){
this.config.openedRouter = { this.currentRouteIndex = e.detail.value
index: 0, this.params.lineId = this.routerList[this.currentRouteIndex].id
label: [this.$lang.lang.notices.please],
value: [''], // 如果没有始发城市则回显
otherService:[''], if(this.currentStartCityIndex === null){
controlStatus:[''] const startCityIndex = this.startCityList.findIndex(item => item.id == this.routerList[this.currentRouteIndex].startCityId)
if(startCityIndex > -1){
this.currentStartCityIndex = startCityIndex
this.params.departureId = this.startCityList[this.currentStartCityIndex].id
}
} }
// 如果没有目的城市则回显
if(this.currentDstCityIndex === null){
const currentCityIndex = this.filteredDstCityList.findIndex(item => item.shi == this.routerList[this.currentRouteIndex].destCityId)
if(currentCityIndex > -1){
this.currentDstCityIndex = currentCityIndex
this.params.objectiveId = this.filteredDstCityList[this.currentDstCityIndex].shi
const currentDstCountryIndex = this.dstCountryList.findIndex(item => item.guojia == this.filteredDstCityList[this.currentDstCityIndex].guojia)
if(currentDstCountryIndex > -1 && currentDstCountryIndex != this.currentDstCountryIndex){
this.currentDstCountryIndex = currentDstCountryIndex
// 切换了目的国则需要更新渠道
this.currentChannelIndex = null
this.params.channelId = ''
this.getChanel()
}
}
}
},
changeStartCity(e){
this.currentStartCityIndex = e.detail.value
this.params.departureId = this.startCityList[this.currentStartCityIndex].id
// 重置路线
this.currentRouteIndex = null
this.params.lineId = ''
this.getOpenedRouter()
} }
} }
} }
......
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