Commit 3951aaf5 authored by dragondean@qq.com's avatar dragondean@qq.com

Merge branch 'feature/order_edit' into pre-release

parents 1dffdad4 87d3d90f
......@@ -10,7 +10,15 @@ export default {
attrList: {
type: Array,
required: true
}
},
currencyMap: {
type: Object,
required: true
},
unitMap:{
type: Object,
required: true
},
},
computed:{
// 显示特性
......@@ -27,6 +35,15 @@ export default {
},
},
methods:{
// 获取储位名称
getLocationName(locationArr){
if(!locationArr || !locationArr.length) return ''
let arr = []
locationArr.forEach(item => {
arr.push(`${item.areaName}${item.locationName || ''}`)
})
return Array.from(new Set(arr)).join(",")
},
// 获取品名汇总数据
getProdSummary(e){
console.log("getProdSummart", e)
......@@ -52,19 +69,19 @@ export default {
volume: new Decimal(0),
}
this.list?.forEach(item => {
worth = worth.plus(item.worth)
fillData.num = fillData.num.plus(item.num)
fillData.weight = fillData.weight.plus(item.weight)
fillData.volume = fillData.volume.plus(item.volume)
fillData.quantity = fillData.quantity.plus(item.quantity)
worth = worth.plus(item.worth || 0)
fillData.num = fillData.num.plus(item.num || 0)
fillData.weight = fillData.weight.plus(item.weight || 0)
fillData.volume = fillData.volume.plus(item.volume || 0)
fillData.quantity = fillData.quantity.plus(item.quantity || 0)
if(item.warehouseInInfoVO){
warehouseInData.num = warehouseInData.num.plus(item.cartonsNum)
warehouseInData.weight = warehouseInData.weight.plus(item.weight)
warehouseInData.volume = warehouseInData.volume.plus(item.volume)
warehouseInData.quantity = warehouseInData.quantity.plus(item.quantityAll)
warehouseInData.num = warehouseInData.num.plus(item.warehouseInInfoVO.cartonsNum || 0)
warehouseInData.weight = warehouseInData.weight.plus(item.warehouseInInfoVO.weight || 0)
warehouseInData.volume = warehouseInData.volume.plus(item.warehouseInInfoVO.volume || 0)
warehouseInData.quantity = warehouseInData.quantity.plus(item.warehouseInInfoVO.quantityAll || 0)
}
chargeData.weight = chargeData.weight.plus(item.chargeWeight)
chargeData.volume = chargeData.volume.plus(item.chargeVolume)
chargeData.weight = chargeData.weight.plus(item.chargeWeight || 0)
chargeData.volume = chargeData.volume.plus(item.chargeVolume || 0)
})
const summary = Array(19).fill(null)
summary[3] = this.$t("合计")
......
......@@ -72,7 +72,11 @@
<el-card class="card">
<el-descriptions border :title="$t('运输')" :column="5" :labelStyle="{width:'110px'}" :contentStyle="{width:'150px'}">
<el-descriptions-item :label="$t('始发仓')">{{$l(order.initialLogisticsInfoDto, 'startTitle')}}</el-descriptions-item>
<el-descriptions-item :label="$t('目的仓')">{{$l(order.initialLogisticsInfoDto, 'destTitle')}}</el-descriptions-item>
<el-descriptions-item :label="$t('目的仓')">
{{$l(order.initialLogisticsInfoDto, 'destCountryTitle')}} -
{{$l(order.initialLogisticsInfoDto, 'destCityTitle')}} -
{{$l(order.initialLogisticsInfoDto, 'destTitle')}}
</el-descriptions-item>
<!-- <el-descriptions-item :label="$t('地址')" :span="2">{{order.logisticsInfoDto.startAddressZh}}</el-descriptions-item> -->
<el-descriptions-item :label="$t('运输方式')" >
<dict-tag :type="DICT_TYPE.ECW_TRANSPORT_TYPE" :value="order.transportId" />
......@@ -215,11 +219,19 @@
<el-card class="card">
<el-tabs v-model="activeName">
<el-tab-pane :label="$t('货物详情')" name="first">
<detail-prod :list="order.orderItemVOList" :attr-list="attrList"></detail-prod>
<detail-prod :list="order.orderItemVOList"
:attr-list="attrList"
:currency-map="currencyMap"
:unit-map="unitMap"
></detail-prod>
</el-tab-pane>
<!--退参品名 退仓/已混箱品名 lanbm 2024-04-16 按客户的要求修改-->
<el-tab-pane :label="$t('退仓/已混箱品名')" name="six">
<detail-prod :list="orderItemDeletedData" :attr-list="attrList"></detail-prod>
<detail-prod :list="orderItemDeletedData"
:attr-list="attrList"
:currency-map="currencyMap"
:unit-map="unitMap"
></detail-prod>
</el-tab-pane>
<!--lanbm 2024-06-11 处理订单到仓时间取值问题-->
<el-tab-pane :label="$t('订单动态')" name="second">
......@@ -613,16 +625,7 @@ export default {
})
},
methods: {
checkPermi, // 检查权限
// 获取储位名称
getLocationName(locationArr){
if(!locationArr || !locationArr.length) return ''
let arr = []
locationArr.forEach(item => {
arr.push(`${item.areaName}${item.locationName || ''}`)
})
return Array.from(new Set(arr)).join(",")
},
checkPermi, // 检查权限,
//订单信息显示更多
handleChange(val){
this.showText = val.length>0? this.$t('隐藏') : this.$t('显示更多')
......
......@@ -102,12 +102,12 @@
<div class="form-section">
<el-form-item :label="$t('运输方式')" prop="transportId">
<dict-selector :type="DICT_TYPE.ECW_TRANSPORT_TYPE" v-model="form.transportId" formatter="number"
clearable/>
clearable @input="updateRoutes('transportId')"/>
</el-form-item>
</div>
<div class="form-section">
<el-form-item :label="$t('始发城市')" prop="departureId" :disabled="false">
<el-select v-model="form.departureId" :placeholder="$t('请选择始发地')" :disabled="false" clearable>
<el-select v-model="form.departureId" :placeholder="$t('请选择始发地')" :disabled="false" clearable @input="updateRoutes('departureId')">
<el-option v-for="item in exportCityList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
......@@ -957,7 +957,7 @@ export default {
// 无收货人且控货则默认发货人付款
this.$set(this.form, 'drawee', 1)
// 清除收货人必填校验
this.$refs.form.clearValidate("consigneeContactsId")
this.$refs.form?.clearValidate("consigneeContactsId")
}
},
ccIdArr(arr){
......@@ -966,7 +966,7 @@ export default {
// 始发地
'form.departureId'(departureId, oldDepartureId){
console.log('departureId', departureId)
this.getOpenedRouterList()
// this.getOpenedRouterList()
},
// 目的地
async 'form.objectiveId'(objectiveId, oldObjectiveId){
......@@ -1005,7 +1005,7 @@ export default {
this.$set(this.form, 'portDestCustomsClear', 1)
}
this.getOpenedRouterList()
// this.getOpenedRouterList()
},
'form.channelId'(){
this.calculationPrice()
......@@ -1020,7 +1020,7 @@ export default {
this.$set(this.form, 'objectiveId', null)
}
// 更新线路备选
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)
......@@ -1094,9 +1094,9 @@ export default {
},
'form.type'(newVal, oldVal){
// 在选择预计送货日期后这里会触发,暂不清楚原因,所以加一个判断
if(newVal?.join(",") == oldVal?.join(",")){
/* if(newVal?.join(",") == oldVal?.join(",")){
return
}
} */
this.setBllLandingPrice('form.type')
},
'form.drawee'(old, newVal){
......@@ -1151,6 +1151,7 @@ export default {
}*/
},
activated(){
console.log("%c activated", "color: red")
if(this.$route.query.id != this.form.id){
console.log("activated 加载订单数据")
this.getOrder()
......@@ -1167,6 +1168,7 @@ export default {
this.updateChannel = this.$route.query.updateChannel == 1
},
async created() {
console.log("%c created", "color: red")
// 初始化自定义付款人需要在前面,否则先执行activated里的getOrder,会被覆盖
this.getDictDatas(this.DICT_TYPE.ECW_CUSTOM_DRAWEE).forEach(item => {
this.customDraweeList.push({
......@@ -1181,7 +1183,7 @@ export default {
})
this.productAttrList = (await getProductAttrList()).data
await this.getChannelList()
await this.getTradeCity()
this.currencyList = (await getCurrencyList()).data
this.unitList = (await getUnitList()).data
this.transportList = this.getDictDatas(this.DICT_TYPE.ECW_TRANSPORT_TYPE)
......@@ -1197,15 +1199,15 @@ export default {
console.log('created 加载订单数据')
this.getOrder()
}else{
await this.getTradeCity()
this.addProduct()
this.$nextTick(() => {
this.initing = false
})
}
},
methods: {
async getTradeCity(){
async getTradeCity(a){
let query = {}
if(this.form.channelId){
query.channelId = this.form.channelId
......@@ -1227,29 +1229,27 @@ export default {
console.log('加载中或者已加载此订单数据,不重复加载', this.initing, this.form.orderId, this.$route.query.id)
return
}
this.$nextTick()
await this.$nextTick()
this.initing = true
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() */
// 可能是来自于activated切换其他订单获取数据,需要重新获取城市确保路线的时候能有效过滤
await this.getTradeCity()
await this.getOpenedRouterList()
this.selectedRouter = this.routerList.find(item => item.id === this.form.lineId)
if(this.selectedRouter){
this.form.destCountryId = this.selectedRouter.destCountryId
}
}else console.log("未找到选择的路线", this.routerList, this.selectedRouter)
console.log("国家ID", this.form.destCountryId)
console.log({...this.form}, {
/* console.log({...this.form}, {
customsClearCert: this.form.customsClearCert,
isUnpack: this.form.isUnpack,
isSingleTicketTransport: this.form.isSingleTicketTransport,
})
}) */
this.form.type = this.form.type ? this.form.type.split(',').filter(item => item != '') : []
this.form.packageTypeArr = this.form.packageType ? this.form.packageType.split(',').filter(item => item != '') : []
......@@ -1490,6 +1490,11 @@ export default {
num: ''
})
},
// 更新路线并打印来源
updateRoutes(fr){
console.log("%cupdateRotutes", "color: blue", fr)
return this.getOpenedRouterList()
},
// 获取路线
async getOpenedRouterList(){
let params = {}
......@@ -1505,16 +1510,28 @@ export default {
if(this.form.channelId){
params.channelId = this.form.channelId
}
console.log("获取路线,参数", params)
// 始发,目的和运输方式都没有的时候不获取
if(!params.startCityId && !params.destCityId && !params.transportType) return false
await getOpenedRouterList(params).then(res => {
return getOpenedRouterList(params).then(res => {
this.routerList = res.data.filter(item => {
return this.exportCityIds.indexOf(item.startCityId) > -1 && this.importCityIds.indexOf(item.destCityId) > -1
})
console.log(`已获取到路线${res.data?.length}条,有效路线${this.routerList.length},参数:${JSON.stringify(params)}`)
console.table([
{
all: res.data.map(item => item.id).join(","),
avail: this.routerList.map(item => item.id).join(",")
}
])
// 如果已选择的线路ID不在上述路线列表里则重置
if(this.form.lineId && !this.routerList.find(item => item.id == this.form.lineId)) {
if(this.form.lineId) {
this.selectedRouter = this.routerList.find(item => item.id == this.form.lineId)
if(!this.selectedRouter){
console.log(`获取到的路线未找到原路线lineId: ${this.form.lineId},重置为null`)
this.$set(this.form, 'lineId', null)
}
}
})
},
// 计算体积
......@@ -1600,7 +1617,7 @@ export default {
this.form.packageType = this.form.packageTypeArr.join(',')
for(const i in this.form.orderItemVOList){
const item = this.form.orderItemVOList[index]
const item = this.form.orderItemVOList[i]
if(!item.prodId){
return this.$message.error(this.$t(`第{index}行未选择商品`, i+1))
}
......@@ -1655,12 +1672,9 @@ export default {
this.$nextTick(() =>{
this.initing = false
this.$nextTick(() => {
this.$refs.form.clearValidate
this.$redirect('success?orderId=' + response.data)
})
})
});
});
},
......@@ -1816,7 +1830,7 @@ export default {
this.form.objectiveId = null
this.form.lineId = null
this.selectedRouter = null
this.getOpenedRouterList()
this.updateRoutes('handleChangeDestCountry')
}
},
// 切换目的城市
......@@ -1826,7 +1840,7 @@ export default {
this.form.lineId = null
this.selectedRouter = null
this.form.destCountryId = this.destCityList.find(item => item.shi === val)?.guojia
await this.getOpenedRouterList()
await this.updateRoutes('handleChangeDestCity')
}
},
// 切换路线
......
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