Commit 27d547ac authored by dragondean@qq.com's avatar dragondean@qq.com

Merge branch 'feature/order_edit' into pre-release

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