Commit 7036f6ad authored by 邓春圆's avatar 邓春圆

添加所属国家

parent eac11f1c
...@@ -98,6 +98,14 @@ export function getTradeCityList(query) { ...@@ -98,6 +98,14 @@ export function getTradeCityList(query) {
params: query params: query
}) })
} }
// 获得目的地国家
export function getTradeCountryList(query) {
return request({
url: '/ecw/region/getTradeCountryList',
method: 'get',
params: query
})
}
export function listByIds(params){ export function listByIds(params){
......
...@@ -8,12 +8,12 @@ ...@@ -8,12 +8,12 @@
<el-row> <el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="$t('中文名称')" prop="nameZh"> <el-form-item :label="$t('中文名称')" prop="nameZh">
<el-input v-model="form.nameZh" :placeholder="$t('请输入名称-中文')" /> <el-input v-model="form.nameZh" :placeholder="$t('请输入名称-中文')"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="$t('名称英文')" prop="nameEn"> <el-form-item :label="$t('名称英文')" prop="nameEn">
<el-input v-model="form.nameEn" :placeholder="$t('请输入名称-英文')" /> <el-input v-model="form.nameEn" :placeholder="$t('请输入名称-英文')"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -49,23 +49,23 @@ ...@@ -49,23 +49,23 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<!-- <el-form-item :label="$t('归属仓库')" prop="warehouseIds">--> <!-- <el-form-item :label="$t('归属仓库')" prop="warehouseIds">-->
<!-- &lt;!&ndash; <el-select v-model="form.wareHouseIds">--> <!-- &lt;!&ndash; <el-select v-model="form.wareHouseIds">-->
<!-- <el-option v-for="item in warehouseList" :value="item.id" :label="item.nameZh"/>--> <!-- <el-option v-for="item in warehouseList" :value="item.id" :label="item.nameZh"/>-->
<!-- </el-select> &ndash;&gt;--> <!-- </el-select> &ndash;&gt;-->
<!-- <el-checkbox-group v-model="warehouseIdsArr">--> <!-- <el-checkbox-group v-model="warehouseIdsArr">-->
<!-- &lt;!&ndash;label需要是字符串,因为回显时分解后为字符串格式&ndash;&gt;--> <!-- &lt;!&ndash;label需要是字符串,因为回显时分解后为字符串格式&ndash;&gt;-->
<!-- <el-checkbox v-for="item in warehouseList" :label="`${item.id}`" :key="item.id" >{{item.titleZh}}</el-checkbox>--> <!-- <el-checkbox v-for="item in warehouseList" :label="`${item.id}`" :key="item.id" >{{item.titleZh}}</el-checkbox>-->
<!-- </el-checkbox-group>--> <!-- </el-checkbox-group>-->
<!-- &lt;!&ndash; <el-input--> <!-- &lt;!&ndash; <el-input-->
<!-- v-model="form.warehouseIds"--> <!-- v-model="form.warehouseIds"-->
<!-- placeholder="请输入归属仓库Ids"--> <!-- placeholder="请输入归属仓库Ids"-->
<!-- /> &ndash;&gt;--> <!-- /> &ndash;&gt;-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item :label="$t('排序')" prop="sort"> <el-form-item :label="$t('排序')" prop="sort">
<el-input v-model="form.sort" :placeholder="$t('请输入排序')" /> <el-input v-model="form.sort" :placeholder="$t('请输入排序')"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -83,6 +83,14 @@ ...@@ -83,6 +83,14 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item :label="$t('所属目的国家')" prop="country">
<el-select filterable clearable v-model="form.countryId" :placeholder="$t('请选择国家')">
<el-option v-for="dict in countryList"
:key="dict.id" :label="$l(dict,'title')" :value="parseInt(dict.id)"/>
</el-select>
</el-form-item>
</el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
...@@ -96,7 +104,7 @@ ...@@ -96,7 +104,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="渠道泡重比例" prop="attrId"> <el-form-item label="渠道泡重比例" prop="attrId">
<el-input v-model.number="form.bubbleWeightRatio" style="width: 200px" > <el-input v-model.number="form.bubbleWeightRatio" style="width: 200px">
<template #suffix> <template #suffix>
<span>%</span> <span>%</span>
</template> </template>
...@@ -104,29 +112,29 @@ ...@@ -104,29 +112,29 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<!-- <div style="display: flex; justify-content: space-between;">--> <!-- <div style="display: flex; justify-content: space-between;">-->
<!-- <h1>--> <!-- <h1>-->
<!-- <span style="color: red;font-size: 14px;font-weight: 700;">*</span>--> <!-- <span style="color: red;font-size: 14px;font-weight: 700;">*</span>-->
<!-- 渠道包装列表--> <!-- 渠道包装列表-->
<!-- </h1>--> <!-- </h1>-->
<!-- <div>--> <!-- <div>-->
<!-- <el-button type="primary" @click="addPackaging" >添加包装类型</el-button>--> <!-- <el-button type="primary" @click="addPackaging" >添加包装类型</el-button>-->
<!-- <el-button type="text" @click="dialogVisible = true;">选择渠道包装模板</el-button>--> <!-- <el-button type="text" @click="dialogVisible = true;">选择渠道包装模板</el-button>-->
<!-- </div>--> <!-- </div>-->
<!-- </div>--> <!-- </div>-->
<!-- <el-row :gutter="20" v-for="(itemm, index) in form.channelPackagingList" style="margin-bottom: 50px;border-bottom: 1px solid #cccccc" :key="index">--> <!-- <el-row :gutter="20" v-for="(itemm, index) in form.channelPackagingList" style="margin-bottom: 50px;border-bottom: 1px solid #cccccc" :key="index">-->
<!-- <el-col :span="2">包装类型{{index + 1}}:</el-col>--> <!-- <el-col :span="2">包装类型{{index + 1}}:</el-col>-->
<!-- <el-col :span="5">--> <!-- <el-col :span="5">-->
<!-- <el-select multiple v-model="itemm.packagingTypes" >--> <!-- <el-select multiple v-model="itemm.packagingTypes" >-->
<!-- <el-option v-for="item in getDictDatas(DICT_TYPE.ECW_PACKAGING_TYPE)" :value="item.value" :key="item.value" :label="$l(item, 'label')" :disabled="deletePackagingTypes.includes(item.value) && !itemm.packagingTypes.includes(item.value)" ></el-option>--> <!-- <el-option v-for="item in getDictDatas(DICT_TYPE.ECW_PACKAGING_TYPE)" :value="item.value" :key="item.value" :label="$l(item, 'label')" :disabled="deletePackagingTypes.includes(item.value) && !itemm.packagingTypes.includes(item.value)" ></el-option>-->
<!-- </el-select>--> <!-- </el-select>-->
<!-- </el-col>--> <!-- </el-col>-->
<!-- <el-col :span="16">--> <!-- <el-col :span="16">-->
<!-- <packaging-type v-if="form.channelPackagingList.length" v-model="form.channelPackagingList[index]">--> <!-- <packaging-type v-if="form.channelPackagingList.length" v-model="form.channelPackagingList[index]">-->
<!-- <el-button :disabled="form.channelPackagingList.length === 1" @click="deleteFn(index)" type="danger">删除包装类型{{index + 1}}</el-button>--> <!-- <el-button :disabled="form.channelPackagingList.length === 1" @click="deleteFn(index)" type="danger">删除包装类型{{index + 1}}</el-button>-->
<!-- </packaging-type>--> <!-- </packaging-type>-->
<!-- </el-col>--> <!-- </el-col>-->
<!-- </el-row>--> <!-- </el-row>-->
<el-form-item :label="$t('备注-中文')" prop="remarksZh"> <el-form-item :label="$t('备注-中文')" prop="remarksZh">
<el-input <el-input
v-model="form.remarksZh" v-model="form.remarksZh"
...@@ -145,22 +153,22 @@ ...@@ -145,22 +153,22 @@
</el-radio-group> </el-radio-group>
</el-form-item> --> </el-form-item> -->
</el-card> </el-card>
<!-- <el-card shadow="never">--> <!-- <el-card shadow="never">-->
<!-- <div slot="header" class="clearfix">--> <!-- <div slot="header" class="clearfix">-->
<!-- <span>{{ $t('渠道收费规则') }}</span>--> <!-- <span>{{ $t('渠道收费规则') }}</span>-->
<!-- </div>--> <!-- </div>-->
<!-- --> <!-- -->
<!-- <el-form-item :label="$t('清关单价')" prop="customsClearUnit">--> <!-- <el-form-item :label="$t('清关单价')" prop="customsClearUnit">-->
<!-- <el-input v-model="form.customsClearUnit" :placeholder="$t('请输入清关单价')">--> <!-- <el-input v-model="form.customsClearUnit" :placeholder="$t('请输入清关单价')">-->
<!-- <span slot="append">$</span>--> <!-- <span slot="append">$</span>-->
<!-- </el-input>--> <!-- </el-input>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- <el-form-item label="每0.5KG单价" prop="weightUnitPrice">--> <!-- <el-form-item label="每0.5KG单价" prop="weightUnitPrice">-->
<!-- <el-input v-model="form.weightUnitPrice" :placeholder="$t('此字段名暂缺')" >--> <!-- <el-input v-model="form.weightUnitPrice" :placeholder="$t('此字段名暂缺')" >-->
<!-- <span slot="append">$</span>--> <!-- <span slot="append">$</span>-->
<!-- </el-input>--> <!-- </el-input>-->
<!-- </el-form-item>--> <!-- </el-form-item>-->
<!-- </el-card>--> <!-- </el-card>-->
</el-form> </el-form>
<div> <div>
<el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button> <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
...@@ -192,34 +200,37 @@ import PackagingType from "@/views/ecw/channel/componrnts/packaging-type.vue"; ...@@ -192,34 +200,37 @@ import PackagingType from "@/views/ecw/channel/componrnts/packaging-type.vue";
import {DICT_TYPE, getDictDataLabel, getDictDatas} from "@/utils/dict"; import {DICT_TYPE, getDictDataLabel, getDictDatas} from "@/utils/dict";
import {getProductAttrList} from "@/api/ecw/productAttr"; import {getProductAttrList} from "@/api/ecw/productAttr";
import indexDialog from "@/views/ecw/channel/index-dialog.vue"; import indexDialog from "@/views/ecw/channel/index-dialog.vue";
import {getTradeCountryList} from "@/api/ecw/region";
export default { export default {
components: {PackagingType,indexDialog}, components: {PackagingType, indexDialog},
data() { data() {
return { return {
dialogVisible:false, countryList: [],
dialogVisible: false,
form: { form: {
bubbleWeightRatio:100, countryId: undefined,
channelCostCreateReqVO:{}, bubbleWeightRatio: 100,
channelPackagingList:[], channelCostCreateReqVO: {},
attrId:[], attrId: [],
}, },
rules: { rules: {
nameZh:{required:true,message:'请输入中文名称',trigger:'blur'}, nameZh: {required: true, message: '请输入中文名称', trigger: 'blur'},
nameEn:{required:true,message:'请输入英文名称',trigger:'blur'}, nameEn: {required: true, message: '请输入英文名称', trigger: 'blur'},
internalNameZh:{required:true,message:'请输入内部中文名称',trigger:'blur'}, internalNameZh: {required: true, message: '请输入内部中文名称', trigger: 'blur'},
internalNameEn:{required:true,message:'请输入内部英文名称',trigger:'blur'}, internalNameEn: {required: true, message: '请输入内部英文名称', trigger: 'blur'},
typeNumber:{required:true,message:'请输入编码类型',trigger:'blur'}, typeNumber: {required: true, message: '请输入编码类型', trigger: 'blur'},
code:{required:true,message:'请输入简码',trigger:'blur'}, code: {required: true, message: '请输入简码', trigger: 'blur'},
attrId:{required:true,message:'请选择可出商品特性',trigger:'blur'} attrId: {required: true, message: '请选择可出商品特性', trigger: 'blur'}
}, },
expressList:[], expressList: [],
warehouseList: [], warehouseList: [],
warehouseIdsArr:[], warehouseIdsArr: [],
attrList:[] attrList: []
}; };
}, },
watch:{ watch: {
/* wareHouseIdsArr(val){ /* wareHouseIdsArr(val){
console.log('更新wareHouseIdsArr', val) console.log('更新wareHouseIdsArr', val)
this.$set(this.form, 'wareHouseIds', val.join(',')) this.$set(this.form, 'wareHouseIds', val.join(','))
...@@ -230,6 +241,9 @@ export default { ...@@ -230,6 +241,9 @@ export default {
} */ } */
}, },
mounted() { mounted() {
getTradeCountryList().then(r => {
this.countryList = r.data
})
getProductAttrList().then(response => { getProductAttrList().then(response => {
this.attrList = response.data; this.attrList = response.data;
this.form.attrId = this.attrList.map(i => i.id) this.form.attrId = this.attrList.map(i => i.id)
...@@ -246,37 +260,38 @@ export default { ...@@ -246,37 +260,38 @@ export default {
if (this.$route.query.id) { if (this.$route.query.id) {
getChannel(this.$route.query.id).then((res) => { getChannel(this.$route.query.id).then((res) => {
this.$set(this, 'form', {... res.data}) this.$set(this, 'form', {...res.data})
if(this.form.channelPackagingList === null ){ // if(this.form.channelPackagingList === null ){
this.form.channelPackagingList = []; // this.form.channelPackagingList = [];
this.addPackaging() // this.addPackaging()
} // }
if(this.form.attrId){ if (this.form.attrId) {
this.form.attrId = this.form.attrId.split(',').map(i => +i) this.form.attrId = this.form.attrId.split(',').map(i => +i)
}else { } else {
this.form.attrId = [] this.form.attrId = []
} }
this.form.countryId = this.form.countryId || undefined
this.form.channelPackagingList.forEach(item =>{ // this.form.channelPackagingList.forEach(item =>{
item.packagingTypes = item.packagingTypes && item.packagingTypes.length !== 0 ? item.packagingTypes.split(',') : [] // item.packagingTypes = item.packagingTypes && item.packagingTypes.length !== 0 ? item.packagingTypes.split(',') : []
}) // })
// if(this.form.warehouseIds.length){ // if(this.form.warehouseIds.length){
// this.warehouseIdsArr = this.form.warehouseIds.split(',')?.filter(item => !!item) // this.warehouseIdsArr = this.form.warehouseIds.split(',')?.filter(item => !!item)
// } // }
if(this.form.bubbleWeightRatio){ if (this.form.bubbleWeightRatio) {
this.form.bubbleWeightRatio = this.form.bubbleWeightRatio * 100 this.form.bubbleWeightRatio = this.form.bubbleWeightRatio * 100
} }
}); });
}else { } else {
this.addPackaging() this.addPackaging()
} }
}, },
computed:{ computed: {
DICT_TYPE() { DICT_TYPE() {
return DICT_TYPE return DICT_TYPE
}, },
deletePackagingTypes(){ deletePackagingTypes() {
let a = [] let a = []
this.form.channelPackagingList.forEach(item => { this.form.channelPackagingList.forEach(item => {
a.push(...item.packagingTypes) a.push(...item.packagingTypes)
...@@ -295,60 +310,60 @@ export default { ...@@ -295,60 +310,60 @@ export default {
}, },
methods: { methods: {
getDictDatas, getDictDatas,
copyFn(val){ copyFn(val) {
this.form.channelPackagingList = []; this.form.channelPackagingList = [];
this.dialogVisible = false; this.dialogVisible = false;
getChannel(val).then((res) => { // getChannel(val).then((res) => {
(res.data.channelPackagingList || []).forEach((item,index) =>{ // (res.data.channelPackagingList || []).forEach((item,index) =>{
this.form.channelPackagingList[index] = { airWeightLimit:item.airWeightLimit, packagingTypes: item.packagingTypes ? item.packagingTypes.split(',') : [], channelPriceStepClearanceList:[],} // this.form.channelPackagingList[index] = { airWeightLimit:item.airWeightLimit, packagingTypes: item.packagingTypes ? item.packagingTypes.split(',') : [], channelPriceStepClearanceList:[],}
// if(!this.form.channelPackagingList[index]){ // // if(!this.form.channelPackagingList[index]){
// this.form.channelPackagingList[index] = { airWeightLimit:item.airWeightLimit, packagingTypes:item.packagingTypes ? item.packagingTypes.split(',') : [], channelPriceStepClearanceList:[],} // // this.form.channelPackagingList[index] = { airWeightLimit:item.airWeightLimit, packagingTypes:item.packagingTypes ? item.packagingTypes.split(',') : [], channelPriceStepClearanceList:[],}
// }else { // // }else {
// // //
// // }
// item.channelPriceStepClearanceList.forEach((itemm, indexx) => {
// let p = {
// "channelId":'',
// "clearancePrice":'',
// "clearancePriceUnit":'',
// "clearanceVolumeUnit":'',
// "endNum":'',
// "packagingId":'',
// "startNum":'',
// "weightUnit":''
// } // }
item.channelPriceStepClearanceList.forEach((itemm, indexx) => { // if(!this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx]){
let p = { // this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx] = p;
"channelId":'', // }
"clearancePrice":'', // let it = this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx]
"clearancePriceUnit":'', // this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx] = {
"clearanceVolumeUnit":'', // ...p,
"endNum":'', // ...it,
"packagingId":'', // clearancePrice:itemm.clearancePrice,
"startNum":'', // clearancePriceUnit:itemm.clearancePriceUnit,
"weightUnit":'' // clearanceVolumeUnit:itemm.clearanceVolumeUnit,
} // endNum:itemm.endNum,
if(!this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx]){ // startNum:itemm.startNum,
this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx] = p; // weightUnit:itemm.weightUnit
} // } ;
let it = this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx] // })
this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx] = { // })
...p, // this.$forceUpdate()
...it, // });
clearancePrice:itemm.clearancePrice,
clearancePriceUnit:itemm.clearancePriceUnit,
clearanceVolumeUnit:itemm.clearanceVolumeUnit,
endNum:itemm.endNum,
startNum:itemm.startNum,
weightUnit:itemm.weightUnit
} ;
})
})
this.$forceUpdate()
});
}, },
deleteFn(index){ deleteFn(index) {
this.form.channelPackagingList.splice(index, 1) this.form.channelPackagingList.splice(index, 1)
}, },
//添加包装类型 //添加包装类型
addPackaging(){ addPackaging() {
let p = { let p = {
airWeightLimit:'', airWeightLimit: '',
packagingTypes:[], packagingTypes: [],
channelPriceStepClearanceList:[], channelPriceStepClearanceList: [],
} }
this.form.channelPackagingList.push(p) this.form.channelPackagingList.push(p)
}, },
verify(row){ verify(row) {
return (row.startNum !== '' && row.endNum !== '' && row.clearancePrice !== '' && row.clearancePriceUnit !== '' && row.clearanceVolumeUnit !== '') return (row.startNum !== '' && row.endNum !== '' && row.clearancePrice !== '' && row.clearancePriceUnit !== '' && row.clearanceVolumeUnit !== '')
}, },
/** 提交按钮 */ /** 提交按钮 */
...@@ -358,29 +373,28 @@ export default { ...@@ -358,29 +373,28 @@ export default {
return; return;
} }
let derail = false let derail = false
this.form.channelPackagingList.forEach(item =>{ // this.form.channelPackagingList.forEach(item =>{
if(item.airWeightLimit === '' || item.airWeightLimit === 0){ // if(item.airWeightLimit === '' || item.airWeightLimit === 0){
derail = true // derail = true
return this.$message.warning('请输入空运订单重量上限') // return this.$message.warning('请输入空运订单重量上限')
} // }
if(!item.packagingTypes.length){ // // if(!item.packagingTypes.length){
derail = true // // derail = true
return this.$message.warning('请输入包装类型') // // return this.$message.warning('请输入包装类型')
} // // }
if(!item.channelPriceStepClearanceList.every(this.verify)){ // // if(!item.channelPriceStepClearanceList.every(this.verify)){
derail = true // // derail = true
return this.$message.warning('请输入阶梯价格') // // return this.$message.warning('请输入阶梯价格')
} // // }
}) // })
if (derail) return;
// this.form.warehouseIds = this.warehouseIdsArr.join(',') // this.form.warehouseIds = this.warehouseIdsArr.join(',')
let form = JSON.parse(JSON.stringify(this.form)) let form = JSON.parse(JSON.stringify(this.form))
let attrId = this.form.attrId let attrId = this.form.attrId
attrId = attrId.join(',') attrId = attrId.join(',')
form.attrId = attrId form.attrId = attrId
form.channelPackagingList.forEach(item =>{ // form.channelPackagingList.forEach(item =>{
item.packagingTypes = item.packagingTypes.join(',') // item.packagingTypes = item.packagingTypes.join(',')
}) // })
form.bubbleWeightRatio = form.bubbleWeightRatio / 100 form.bubbleWeightRatio = form.bubbleWeightRatio / 100
// 修改的提交 // 修改的提交
if (this.form.channelId != null) { if (this.form.channelId != null) {
...@@ -401,7 +415,7 @@ export default { ...@@ -401,7 +415,7 @@ export default {
}; };
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.el-card{ .el-card {
margin-bottom: 20px; margin-bottom: 20px;
} }
</style> </style>
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