Commit b5a9563c authored by 我在何方's avatar 我在何方
parents ab71d2f8 a4a3fcd6
...@@ -7,21 +7,26 @@ ...@@ -7,21 +7,26 @@
<el-radio v-for="dict in transportTypes" :key="dict.value" :label="dict.value">{{$l(dict, 'label')}}</el-radio> <el-radio v-for="dict in transportTypes" :key="dict.value" :label="dict.value">{{$l(dict, 'label')}}</el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </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-form-item :label="$t('出货渠道')" prop="shippingChannelId">
<el-select v-model="form.shippingChannelId" :placeholder="$t('请选择出货渠道')"> <el-select v-model="form.shippingChannelId" :placeholder="$t('请选择出货渠道')" clearable>
<el-option v-for="item in channelList" :label="$l(item, 'name')" :value="item.channelId" :key="item.channelId"></el-option> <el-option v-for="item in filteredChannelList" :label="$l(item, 'name')" :value="item.channelId" :key="item.channelId"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('始发地')" prop="startWarehouseId"> <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-option v-for="item in exportWarehouseList" :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="destWarehouseId"> <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-option v-for="item in importWarehouseList" :label="$l(item, 'title')" :value="item.id" :key="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -73,6 +78,7 @@ ...@@ -73,6 +78,7 @@
<script> <script>
import { createbox, updatebox } from "@/api/ecw/boxAir"; import { createbox, updatebox } from "@/api/ecw/boxAir";
import { getChannelList } from '@/api/ecw/channel' import { getChannelList } from '@/api/ecw/channel'
import { getTradeCountryList } from '@/api/ecw/region'
export default { export default {
name: "editAirForm", name: "editAirForm",
...@@ -91,11 +97,14 @@ export default { ...@@ -91,11 +97,14 @@ export default {
this.form.destinationClearanceSelect = 3 this.form.destinationClearanceSelect = 3
} }
this.getChannelList() this.getChannelList()
this.getTradeCountry()
}, },
data() { data() {
return { return {
// 表单参数 // 表单参数
form: { }, form: {
destCountryId: undefined
},
channelList: [], channelList: [],
// 表单校验 // 表单校验
rules: { rules: {
...@@ -108,7 +117,8 @@ export default { ...@@ -108,7 +117,8 @@ export default {
destWarehouseId: [ destWarehouseId: [
{ required: true, message: this.$t('目的地不能为空'), trigger: 'blur' } { required: true, message: this.$t('目的地不能为空'), trigger: 'blur' }
] ]
} },
tradeCountryList:[]
}; };
}, },
watch:{ watch:{
...@@ -116,11 +126,29 @@ export default { ...@@ -116,11 +126,29 @@ export default {
if(!this.form.destinationClearance){ if(!this.form.destinationClearance){
this.$set(this.form, 'destinationClearance', 1) 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: { methods: {
async getTradeCountry(){
this.tradeCountryList = (await getTradeCountryList()).data
},
getChannelList() { getChannelList() {
getChannelList().then((res) => (this.channelList = res.data)) getChannelList({}).then((res) => (this.channelList = res.data))
}, },
/*destinationClearanceSelect(val) { /*destinationClearanceSelect(val) {
this.$set(this.form,'destinationClearance',val) this.$set(this.form,'destinationClearance',val)
...@@ -160,9 +188,22 @@ export default { ...@@ -160,9 +188,22 @@ export default {
}, },
importWarehouseList() { importWarehouseList() {
return this.warehouseList.filter( 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> </script>
......
...@@ -202,18 +202,19 @@ ...@@ -202,18 +202,19 @@
<h2>{{$t('订单数据')}}</h2> <h2>{{$t('订单数据')}}</h2>
<el-form-item :label="$t('下单统计')" class="mb-0"> <el-form-item :label="$t('下单统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, { {{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumCartonsNumFinishedWarehouseIn, num: statistics.sumNumInput,
weight: statistics.sumWeightFinishedWarehouseIn, weight: statistics.sumWeightInput,
volume: statistics.sumVolumeFinishedWarehouseIn, volume: statistics.sumVolumeInput,
quantity: statistics.sumQuantityAllFinishedWarehouseIn quantity: statistics.sumQuantityInput
}) }} }) }}
</el-form-item> </el-form-item>
<el-form-item :label="$t('入仓统计')" class="mb-0"> <el-form-item :label="$t('入仓统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, { {{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumNum, num: statistics.sumCartonsNumFinishedWarehouseIn,
weight: statistics.sumWeight, weight: statistics.sumWeightFinishedWarehouseIn,
volume: statistics.sumVolume, volume: statistics.sumVolumeFinishedWarehouseIn,
quantity: statistics.sumQuantity quantity: statistics.sumQuantityAllFinishedWarehouseIn
}) }} }) }}
</el-form-item> </el-form-item>
<el-form-item :label="$t('打包前统计')" class="mb-0"> <el-form-item :label="$t('打包前统计')" class="mb-0">
...@@ -226,10 +227,10 @@ ...@@ -226,10 +227,10 @@
</el-form-item> </el-form-item>
<el-form-item :label="$t('打包后统计')" class="mb-0"> <el-form-item :label="$t('打包后统计')" class="mb-0">
{{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, { {{ $t(`{num}箱 {weight}Kg {volume}m³ {quantity}个`, {
num: statistics.sumNumInput, num: statistics.sumNum,
weight: statistics.sumWeightInput, weight: statistics.sumWeight,
volume: statistics.sumVolumeInput, volume: statistics.sumVolume,
quantity: statistics.sumQuantityInput quantity: statistics.sumQuantity
}) }} }) }}
</el-form-item> </el-form-item>
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <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-col>
</el-row> </el-row>
...@@ -486,6 +486,15 @@ export default { ...@@ -486,6 +486,15 @@ export default {
return !!item[`${prefix}Price`] 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){ handleFormUnitChange(data){
console.log("handleFormUnitChange", {...data}) console.log("handleFormUnitChange", {...data})
...@@ -548,7 +557,15 @@ export default { ...@@ -548,7 +557,15 @@ export default {
let data = Object.assign({}, this.form, { let data = Object.assign({}, this.form, {
// lineChannelList: this.selectedRoutes, // lineChannelList: this.selectedRoutes,
// specialList: this.specialProducts, // specialList: this.specialProducts,
isAllProduct: this.isAllProduct ? 1:0 isAllProduct: this.isAllProduct ? 1:0,
// 阶梯价
freightPriceStepList: [],
clearancePriceStepList: [],
fullPriceStepList: [],
// 非阶梯价包装类型
freightPricePackagingList: [],
clearancePricePackagingList: [],
fullPricePackagingList: []
}) })
// 如果是勾選了全部篩選商品,則獲取商品ID // 如果是勾選了全部篩選商品,則獲取商品ID
...@@ -571,17 +588,25 @@ export default { ...@@ -571,17 +588,25 @@ export default {
} }
if(!isValid)return if(!isValid)return
} */ } */
if(data.stepPrice){
// 全包价 // 全包价
if(this.form.priceType == 1) { if(this.form.priceType == 1) {
data.fullPriceStepList = this.getPriceList(this.form.fullPriceStepList, 'all') 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.clearancePriceStepList = this.getPriceList(this.form.clearancePriceStepList, 'clearance')
data.freightPriceStepList = this.getPriceList(this.form.freightPriceStepList, 'transport') 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 data.lineChannelList = this.selectedRoutes
......
...@@ -330,7 +330,7 @@ export default { ...@@ -330,7 +330,7 @@ export default {
}, },
// 获得用语提交的阶梯价副本 // 获得用语提交的阶梯价副本
getPriceList(stepList){ getPriceList(stepList, prefix){
if(!stepList?.length) return [] if(!stepList?.length) return []
let stepPriceList = JSON.parse(JSON.stringify(stepList)) let stepPriceList = JSON.parse(JSON.stringify(stepList))
stepPriceList.forEach((item, index) => { stepPriceList.forEach((item, index) => {
...@@ -373,14 +373,14 @@ export default { ...@@ -373,14 +373,14 @@ export default {
data.lineChannelList = this.selectedRoutes data.lineChannelList = this.selectedRoutes
let isValid = true /* let isValid = true
for (let stepPrice of this.$refs.stepPrice){ for (let stepPrice of this.$refs.stepPrice){
if(!stepPrice.validate()){ if(!stepPrice.validate()){
isValid = false isValid = false
break break
} }
} }
if(!isValid)return if(!isValid)return */
// 全包价 // 全包价
if(this.form.priceType == 1) { if(this.form.priceType == 1) {
...@@ -407,17 +407,6 @@ export default { ...@@ -407,17 +407,6 @@ export default {
}) })
.finally(res => this.loading = false) .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 { ...@@ -33,16 +33,11 @@ export default {
computed:{ computed:{
getUnit(){ getUnit(){
return (field, unitField) => { return (field, unitField) => {
if(this.type == 'sea'){ // 非阶梯价
if(this.value.stepPrice && !this.value.priceStepList?.length){ if(this.value?.stepPrice != 1){
return null
}
if(this.value.stepPrice){
return this.value.priceStepList[0][unitField]
}
return this.value[unitField] return this.value[unitField]
} }
// 后面是空运 // 后面是阶梯价
if(!this.value[field]?.length) return null if(!this.value[field]?.length) return null
return this.value[field][0][unitField] 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