Commit b5a9563c authored by 我在何方's avatar 我在何方
parents ab71d2f8 a4a3fcd6
......@@ -7,21 +7,26 @@
<el-radio v-for="dict in transportTypes" :key="dict.value" :label="dict.value">{{$l(dict, 'label')}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="$t('目的国')" prop="destCountryId">
<el-select v-model="form.destCountryId" clearable>
<el-option v-for="item in tradeCountryList" :key="item.id" :label="$l(item, 'title')" :value="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('出货渠道')" prop="shippingChannelId">
<el-select v-model="form.shippingChannelId" :placeholder="$t('请选择出货渠道')">
<el-option v-for="item in channelList" :label="$l(item, 'name')" :value="item.channelId" :key="item.channelId"></el-option>
<el-select v-model="form.shippingChannelId" :placeholder="$t('请选择出货渠道')" clearable>
<el-option v-for="item in filteredChannelList" :label="$l(item, 'name')" :value="item.channelId" :key="item.channelId"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('始发地')" prop="startWarehouseId">
<el-select v-model="form.startWarehouseId" :placeholder="$t('请选择始发地')">
<el-select v-model="form.startWarehouseId" :placeholder="$t('请选择始发地')" clearable>
<el-option v-for="item in exportWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的地')" prop="destWarehouseId">
<el-select v-model="form.destWarehouseId" :placeholder="$t('请选择目的地')">
<el-select v-model="form.destWarehouseId" :placeholder="$t('请选择目的地')" clearable>
<el-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
......@@ -73,6 +78,7 @@
<script>
import { createbox, updatebox } from "@/api/ecw/boxAir";
import { getChannelList } from '@/api/ecw/channel'
import { getTradeCountryList } from '@/api/ecw/region'
export default {
name: "editAirForm",
......@@ -91,11 +97,14 @@ export default {
this.form.destinationClearanceSelect = 3
}
this.getChannelList()
this.getTradeCountry()
},
data() {
return {
// 表单参数
form: { },
form: {
destCountryId: undefined
},
channelList: [],
// 表单校验
rules: {
......@@ -108,19 +117,38 @@ export default {
destWarehouseId: [
{ required: true, message: this.$t('目的地不能为空'), trigger: 'blur' }
]
}
},
tradeCountryList:[]
};
},
watch:{
'form.destinationClearanceSelect'(){
if(!this.form.destinationClearance){
this.$set(this.form, 'destinationClearance', 1)
}
watch:{
'form.destinationClearanceSelect'(){
if(!this.form.destinationClearance){
this.$set(this.form, 'destinationClearance', 1)
}
},
'form.destCountryId'(){
this.getChannelList()
},
'form.shippingChannelId'(){
let channel = this.channelList.find(item => item.channelId == this.form.shippingChannelId)
if(channel){
this.$set(this.form, 'destCountryId', channel.countryId)
}
},
'form.destWarehouseId'(){
let city = this.importWarehouseList.find(item => item.id == this.form.destWarehouseId)
if(city){
this.form.destCountryId = city.guojia
}
}
},
methods: {
async getTradeCountry(){
this.tradeCountryList = (await getTradeCountryList()).data
},
getChannelList() {
getChannelList().then((res) => (this.channelList = res.data))
getChannelList({}).then((res) => (this.channelList = res.data))
},
/*destinationClearanceSelect(val) {
this.$set(this.form,'destinationClearance',val)
......@@ -160,9 +188,22 @@ export default {
},
importWarehouseList() {
return this.warehouseList.filter(
(item) => item.tradeType == "1" || item.type == "3"
(item) => {
if(this.form.destCountryId && item.guojia != this.form.destCountryId){
return false
}
return item.tradeType == "1" || item.type == "3"
}
);
},
filteredChannelList(){
return this.channelList.filter(item => {
if(this.form.destCountryId && this.form.destCountryId != item.countryId){
return false
}
return true
})
}
},
};
</script>
......
......@@ -202,19 +202,20 @@
<h2>{{$t('订单数据')}}</h2>
<el-form-item :label="$t('下单统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumCartonsNumFinishedWarehouseIn,
weight: statistics.sumWeightFinishedWarehouseIn,
volume: statistics.sumVolumeFinishedWarehouseIn,
quantity: statistics.sumQuantityAllFinishedWarehouseIn
}) }}
num: statistics.sumNumInput,
weight: statistics.sumWeightInput,
volume: statistics.sumVolumeInput,
quantity: statistics.sumQuantityInput
}) }}
</el-form-item>
<el-form-item :label="$t('入仓统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumNum,
weight: statistics.sumWeight,
volume: statistics.sumVolume,
quantity: statistics.sumQuantity
}) }}
num: statistics.sumCartonsNumFinishedWarehouseIn,
weight: statistics.sumWeightFinishedWarehouseIn,
volume: statistics.sumVolumeFinishedWarehouseIn,
quantity: statistics.sumQuantityAllFinishedWarehouseIn
}) }}
</el-form-item>
<el-form-item :label="$t('打包前统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
......@@ -226,11 +227,11 @@
</el-form-item>
<el-form-item :label="$t('打包后统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumNumInput,
weight: statistics.sumWeightInput,
volume: statistics.sumVolumeInput,
quantity: statistics.sumQuantityInput
}) }}
num: statistics.sumNum,
weight: statistics.sumWeight,
volume: statistics.sumVolume,
quantity: statistics.sumQuantity
}) }}
</el-form-item>
<el-card style="margin-top: 15px;">
......
......@@ -33,7 +33,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<quick-set :unit-list="unitList" :currency-list="currencyList" :value="form"></quick-set>
<quick-set :unit-list="unitList" :currency-list="currencyList" :value="form" type="sea"></quick-set>
</el-col>
</el-row>
......@@ -486,6 +486,15 @@ export default {
return !!item[`${prefix}Price`]
})
},
// 格式化包装类型费用
getPackingPrice(packging){
if(!packging?.length) return
packging = JSON.parse(JSON.stringify(packging))
return packging.filter(item => !!item.packagingTypes).map(item => {
item.packagingTypes = item.packagingTypes?.join(",") || ""
return item
})
},
// 非阶梯价格更新单位
handleFormUnitChange(data){
console.log("handleFormUnitChange", {...data})
......@@ -548,7 +557,15 @@ export default {
let data = Object.assign({}, this.form, {
// lineChannelList: this.selectedRoutes,
// specialList: this.specialProducts,
isAllProduct: this.isAllProduct ? 1:0
isAllProduct: this.isAllProduct ? 1:0,
// 阶梯价
freightPriceStepList: [],
clearancePriceStepList: [],
fullPriceStepList: [],
// 非阶梯价包装类型
freightPricePackagingList: [],
clearancePricePackagingList: [],
fullPricePackagingList: []
})
// 如果是勾選了全部篩選商品,則獲取商品ID
......@@ -571,18 +588,26 @@ export default {
}
if(!isValid)return
} */
// 全包价
if(this.form.priceType == 1) {
if(data.stepPrice){
// 全包价
if(this.form.priceType == 1) {
data.fullPriceStepList = this.getPriceList(this.form.fullPriceStepList, 'all')
delete data.clearancePriceStepList
delete data.freightPriceStepList
}else{
}else{
data.clearancePriceStepList = this.getPriceList(this.form.clearancePriceStepList, 'clearance')
data.freightPriceStepList = this.getPriceList(this.form.freightPriceStepList, 'transport')
delete data.fullPriceStepList
}
}
// 非阶梯价则需要提交包装类型
else{
if(this.form.priceType == 1){
data.fullPricePackagingList = this.getPackingPrice(this.form.fullPricePackagingList)
}else{
data.freightPricePackagingList = this.getPackingPrice(this.form.freightPricePackagingList)
data.clearancePricePackagingList = this.getPackingPrice(this.form.clearancePricePackagingList)
}
}
data.lineChannelList = this.selectedRoutes
if(data.lineChannelList.length < 1){
......
......@@ -330,7 +330,7 @@ export default {
},
// 获得用语提交的阶梯价副本
getPriceList(stepList){
getPriceList(stepList, prefix){
if(!stepList?.length) return []
let stepPriceList = JSON.parse(JSON.stringify(stepList))
stepPriceList.forEach((item, index) => {
......@@ -373,14 +373,14 @@ export default {
data.lineChannelList = this.selectedRoutes
let isValid = true
/* let isValid = true
for (let stepPrice of this.$refs.stepPrice){
if(!stepPrice.validate()){
isValid = false
break
}
}
if(!isValid)return
if(!isValid)return */
// 全包价
if(this.form.priceType == 1) {
......@@ -407,17 +407,6 @@ export default {
})
.finally(res => this.loading = false)
});
},
// 快捷设置,只更新默认运费
quickSet(){
// 字段,根据是否全包价来取
let field = this.form.priceType == 1 ? 'allPrice' : 'transportPrice'
// 取得要加的数额(减少则是负数)
let amount = Decimal(this.quickForm.plus || -this.quickForm.minus)
this.form.priceStepList.forEach(item => {
// 加上对应的价格,但是不能小于0
this.$set(item, field, Math.max(0, Decimal(item[field] || 0).plus(amount).toNumber()))
})
}
}
}
......
......@@ -33,16 +33,11 @@ export default {
computed:{
getUnit(){
return (field, unitField) => {
if(this.type == 'sea'){
if(this.value.stepPrice && !this.value.priceStepList?.length){
return null
}
if(this.value.stepPrice){
return this.value.priceStepList[0][unitField]
}
// 非阶梯价
if(this.value?.stepPrice != 1){
return this.value[unitField]
}
// 后面是空运
// 后面是阶梯价
if(!this.value[field]?.length) return null
return this.value[field][0][unitField]
}
......
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