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

完善订单编辑

parent 0f24ef21
......@@ -141,3 +141,12 @@ export function quantityRequired(lineId) {
method: 'get'
})
}
// 获取仓库区域并行国家、城市、仓库列表
export function getGuojiaAndShiAndWarehouseList(params = {}) {
return request({
url: '/ecw/warehouse/getGuojiaAndShiAndWarehouseList',
method: 'get',
params
})
}
......@@ -10,7 +10,6 @@
<el-table-column label="新内容" prop="newValue"></el-table-column>
</el-table>
</el-card>
<div class="page-title">{{ editMode ? $t('编辑订单') + '-' + form.orderNo : $t('新建订单')}}</div>
<el-card class="form-section mt-10">
......@@ -112,9 +111,14 @@
<el-option v-for="item in exportCityList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的国家')" prop="destCountryId">
<el-select v-model="form.destCountryId" :placeholder="$t('请选择目的国家')" @change="handleChangeDestCountry" clearable>
<el-option v-for="item in showDestCountryList" :label="$l(item, 'guojiaName')" :value="item.guojia" :key="item.guojia"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的城市')" prop="objectiveId">
<el-select v-model="form.objectiveId" :placeholder="$t('请选择目的地')" :disabled2="inWarehouse" clearable>
<el-option v-for="item in importCityList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
<el-select v-model="form.objectiveId" :placeholder="$t('请选择目的地')" @change="handleChangeDestCity" clearable>
<el-option v-for="item in showDestCityList" :label="$l(item, 'shiName')" :value="item.shi" :key="item.shi"></el-option>
</el-select>
</el-form-item>
</div>
......@@ -123,7 +127,7 @@
<el-input :value="selectedRouter ? $l(selectedRouter, 'startTitle') + ' > ' + $l(selectedRouter, 'destTitle') : ''" disabled :placeholder="$t('请在右侧选择线路')"></el-input>
</el-form-item>
<!--select是原生组件,不受el-form的disabled控制-->
<select size="5" v-model="form.lineId" style="min-width: 300px; border:1px solid #DCDFE6; border-radius:4px">
<select size="5" v-model="form.lineId" style="min-width: 300px; border:1px solid #DCDFE6; border-radius:4px" @change="handleChangeLineId">
<option v-for="item in routerList" :value="item.id" :key="item.id">
{{$l(item, 'startTitle')}} >> {{$l(item, 'destTitle')}}
(<dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="item.transportType"></dict-tag>)
......@@ -147,7 +151,7 @@
<div>
<!--默认显示类型(selectedRouter==null),如果选择路线后没开通则隐藏-->
<el-form-item :label="$t('增值服务')" v-if="routeOtherServices.indexOf('1') > -1 || routeOtherServices.indexOf('4') > -1">
<el-checkbox-group v-model="form.type" :disabled2="inWarehouse">
<el-checkbox-group v-model="form.type">
<el-checkbox label="1" v-if="routeOtherServices.indexOf('1') > -1">{{$t('集运')}}</el-checkbox>
<el-checkbox label="2" v-if="routeOtherServices.indexOf('4') > -1">{{$t('海外仓')}}</el-checkbox>
</el-checkbox-group>
......@@ -173,9 +177,9 @@
</template>
<template slot-scope="scope">
<el-form-item label=""
:prop="`orderItemVOList.${scope.$index}.prodId`"
:rules="{
required: true, message: $t('请选择产品'), trigger: 'blur'
:prop2="`orderItemVOList.${scope.$index}.prodId`"
:rules2="{
// required: true, message: $t('请选择产品'), trigger: 'blur'
}"
class="mb-0 mr-0"
>
......@@ -482,12 +486,8 @@
<div class="form-section flex">
<el-form-item :label="$t('收货方式')" prop="harvestMethod" class="ml-20">
<el-select v-model="harvestMethod2" @change="handleChange">
<el-option
v-for="dict in lunchList"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
<el-option :label="$t('自提')" :value="1" ></el-option>
<el-option v-if="homeDeliveryService" :label="$t('送货上门')" :value="2" ></el-option>
</el-select>
</el-form-item>
......@@ -666,7 +666,7 @@ import {getProductAttrList} from '@/api/ecw/productAttr'
import {getChannelList} from '@/api/ecw/channel'
import Selector from '@/components/Selector'
import CustomerContactSelector from '@/components/CustomerContactSelector'
import {openedRouterList as getOpenedRouterList} from '@/api/ecw/warehouse'
import { getGuojiaAndShiAndWarehouseList, openedRouterList as getOpenedRouterList } from '@/api/ecw/warehouse'
import {getTradeCityList} from '@/api/ecw/region'
import {getDictData, getDictDatas} from '@/utils/dict'
import {getCurrencyList} from '@/api/ecw/currency'
......@@ -688,6 +688,10 @@ import Template from '@/views/cms/template/index.vue'
// 缓存默认的表单数据
let makeDefaultFormData = () => {
return {
destCountryId: null,
lienId: null,
objectiveId: null,
departureId: null,
status:0,
sendstatus:0,
isCargoControl: false,
......@@ -759,10 +763,10 @@ export default {
offerNumber:null,
showAdress: false,
harvestMethod2: null,
lunchList: [
/* lunchList: [
{ label: "自提", value: 1 },
{ label: "送货上门", value: 2 },
],
], */
// 发货人是否允许控货无收货人
noConsignee: false,
// 是否有收货人
......@@ -771,6 +775,9 @@ export default {
showFullConsignor: false,
// 是否展示全部收货人信息
showFullConsignee: false,
destCountryList:[],
destCityList: [],
selectedRouter: null
};
},
computed:{
......@@ -842,11 +849,11 @@ export default {
getDictDatas(){
return getDictDatas
},
selectedRouter(){
/* selectedRouter(){
// otherService 1 集运服务 2 送货上门 3 非控货订单代收货款 4 海外仓 5 提货异常
if(!this.form.lineId)return null
return this.routerList.find(item => item.id == this.form.lineId)
},
}, */
// 送货上门
homeDeliveryService(){
return this.selectedRouter && this.selectedRouter.otherService && this.selectedRouter.otherService.indexOf('2') > -1
......@@ -932,6 +939,14 @@ export default {
return false
}
return true
},
// 显示的目的国
showDestCountryList(){
return this.destCountryList
},
showDestCityList(){
if(!this.form.destCountryId) return this.destCityList
return this.destCityList.filter(item => item.guojia === this.form.destCountryId) || []
}
},
watch:{
......@@ -950,27 +965,13 @@ export default {
'form.departureId'(departureId, oldDepartureId){
console.log('departureId', departureId)
this.getOpenedRouterList()
// 修改始发地后需要重新选择路线
/* if(oldDepartureId && oldDepartureId != departureId && !this.initing){
console.log('修改始发地,重置lineId', oldDepartureId, departureId)
this.$set(this.form, 'lineId', null)
} */
},
// 目的地
async 'form.objectiveId'(objectiveId, oldObjectiveId){
// 重新获取路线
await this.getOpenedRouterList()
// 如果已选择的路线不在可用路线里则重置
/* if(this.form.lineId && !this.routerList.find(item => item.id == this.form.lineId)){
this.$set(this.form, 'lineId', null)
} */
// await this.getOpenedRouterList()
// 重新获取渠道
await this.getChannelList()
// 如果已选择的渠道不在可用渠道里则重置
/* if(this.form.channelId && !this.channelList.find(item => item.channelId == this.form.channelId)){
this.$set(this.form, 'channelId', null)
} */
},
'form.transportId'(transportId, oldTransportId){
// 空运
......@@ -1042,9 +1043,9 @@ export default {
if(!router){
return
}
this.$set(this.form, 'departureId', router.startCityId)
/* this.$set(this.form, 'departureId', router.startCityId)
this.$set(this.form, 'objectiveId', router.destCityId)
this.$set(this.form, 'transportId', router.transportType)
this.$set(this.form, 'transportId', router.transportType) */
await this.getChannelList()
this.calculationPrice()
this.$nextTick(() => {
......@@ -1091,7 +1092,7 @@ export default {
},
'form.type'(newVal, oldVal){
// 在选择预计送货日期后这里会触发,暂不清楚原因,所以加一个判断
if(newVal.join(",") == oldVal.join(",")){
if(newVal?.join(",") == oldVal?.join(",")){
return
}
this.setBllLandingPrice('form.type')
......@@ -1172,7 +1173,10 @@ export default {
value: 2 // 1 发货人,2收货人,默认收货人,可修改
})
})
await getGuojiaAndShiAndWarehouseList({tradeType: 1}).then(({data}) => {
this.destCountryList = data.guojiaList
this.destCityList = data.shiList
})
this.productAttrList = (await getProductAttrList()).data
await this.getChannelList()
await this.getTradeCity()
......@@ -1223,10 +1227,21 @@ export default {
}
this.$nextTick()
this.initing = true
getUpdateInfo(this.$route.query.id).then(res => {
getUpdateInfo(this.$route.query.id).then(async (res) => {
this.form = Object.assign({}, {...res.data}, {orderItemVOList: []})
this.getOfferData()
/* this.form.orderItemVOList = []; */
/* consolr.log("线路")
// 切换城市,会清空路线,回填国家,获取可用路线,所以后面需要重新给路线赋值
await this.handleChangeDestCity(this.form.objectiveId)
this.form.lienId = res.data.lineId
await this.handleChangeLineId() */
await this.getOpenedRouterList()
this.selectedRouter = this.routerList.find(item => item.id === this.form.lineId)
if(this.selectedRouter){
this.form.destCountryId = this.selectedRouter.destCountryId
}
console.log({...this.form}, {
customsClearCert: this.form.customsClearCert,
......@@ -1464,36 +1479,41 @@ export default {
},
addProduct(data){
this.form.orderItemVOList.push(data || {prodAttrArr:[]})
this.form.orderItemVOList.push(data || {
prodAttrArr:[],
prodId: null,
worth: '',
volume: '',
weight: '',
num: ''
})
},
// 获取路线
getOpenedRouterList(){
debounce(() => {
let params = {}
if(this.form.departureId){
params.startCityId = this.form.departureId
}
if(this.form.objectiveId){
params.destCityId = this.form.objectiveId
}
if(this.form.transportId){
params.transportType = this.form.transportId
}
if(this.form.channelId){
params.channelId = this.form.channelId
}
// 始发,目的和运输方式都没有的时候不获取
if(!params.startCityId && !params.destCityId && !params.transportType) return false
getOpenedRouterList(params).then(res => {
this.routerList = res.data.filter(item => {
return this.exportCityIds.indexOf(item.startCityId) > -1 && this.importCityIds.indexOf(item.destCityId) > -1
})
// 如果已选择的线路ID不在上述路线列表里则重置
if(this.form.lineId && !this.routerList.find(item => item.id == this.form.lineId)) {
this.$set(this.form, 'lineId', null)
}
async getOpenedRouterList(){
let params = {}
if(this.form.departureId){
params.startCityId = this.form.departureId
}
if(this.form.objectiveId){
params.destCityId = this.form.objectiveId
}
if(this.form.transportId){
params.transportType = this.form.transportId
}
if(this.form.channelId){
params.channelId = this.form.channelId
}
// 始发,目的和运输方式都没有的时候不获取
if(!params.startCityId && !params.destCityId && !params.transportType) return false
await getOpenedRouterList(params).then(res => {
this.routerList = res.data.filter(item => {
return this.exportCityIds.indexOf(item.startCityId) > -1 && this.importCityIds.indexOf(item.destCityId) > -1
})
}, 100, false)()
// 如果已选择的线路ID不在上述路线列表里则重置
if(this.form.lineId && !this.routerList.find(item => item.id == this.form.lineId)) {
this.$set(this.form, 'lineId', null)
}
})
},
// 计算体积
calcVolume(row){
......@@ -1577,6 +1597,13 @@ export default {
})
this.form.packageType = this.form.packageTypeArr.join(',')
for(const i in this.form.orderItemVOList){
const item = this.form.orderItemVOList[index]
if(!item.prodId){
return this.$message.error(this.$t(`第{index}行未选择商品`, i+1))
}
}
// 付款人=发货人提示
if (+this.form.drawee === 1 && !this.updateChannel) {
await this.$confirm(this.$t('请再次确认运费由您支付还是收货人支付?'))
......@@ -1779,6 +1806,47 @@ export default {
this.form.displayBillLadingPrice = res.data.isShowTidanPrice
})
},
// 切换目的国
handleChangeDestCountry(val) {
console.log("handleChangeDestCountry", val)
this.form.destCountryId = val
if(this.form.destCountryId){
this.form.objectiveId = null
this.form.lineId = null
this.selectedRouter = null
this.getOpenedRouterList()
}
},
// 切换目的城市
async handleChangeDestCity(val){
this.form.objectiveId = val
if(this.form.objectiveId){
this.form.lineId = null
this.selectedRouter = null
this.form.destCountryId = this.destCityList.find(item => item.shi === val)?.guojia
await this.getOpenedRouterList()
}
},
// 切换路线
setLineId(lineId){
this.form.lineId = lineId
this.handleChangeLineId()
},
// 切换线路回调
async handleChangeLineId(){
await this.$nextTick()
this.selectedRouter = this.routerList.find(item => item.id === this.form.lineId)
console.log("handleChangeLineId",
"路线", this.form.lineId,
"目的市", this.selectedRouter?.destCityId,
"目的国", this.selectedRouter?.destCountryId,
"始发市", this.selectedRouter?.startCityId)
if(this.form.lineId){
this.form.objectiveId = this.selectedRouter?.destCityId
this.form.destCountryId = this.selectedRouter?.destCountryId
this.form.departureId = this.selectedRouter?.startCityId
}
},
}
};
</script>
......
......@@ -899,7 +899,6 @@
>{{ $t("查看异常") }}</el-dropdown-item
>
<el-dropdown-item
v-if="canHandleException(scope.row)"
@click.native="openException(scope.row)"
>{{ $t("处理异常") }}</el-dropdown-item
>
......@@ -1737,13 +1736,6 @@ export default {
return arr.indexOf(state) == -1;
};
},
// 根据异常类型和用户权限校验是否可以处理异常
canHandleException(){
return (order) => {
// TODO 需要等接口返回异常类型
return true
}
},
// 增值服务文本
getTypeText(){
return type => {
......
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