Commit 6bd230f0 authored by 邓春圆's avatar 邓春圆

渠道修改添加页面2

parent 2741ef39
...@@ -23,9 +23,15 @@ export default { ...@@ -23,9 +23,15 @@ export default {
val:'' val:''
} }
}, },
created() {
},
watch:{ watch:{
val(){ val(){
this.$emit('input',this.val) this.$emit('input',this.val)
},
value(val){
console.log(val,'valllll')
this.val = val;
} }
} }
} }
......
<template>
<div>
<el-row type="flex" align="align" :gutter="10" >
<el-col :span="3">空运订单重量上限(kg)</el-col>
<el-col :span="6" ><el-input v-model="value1.airWeightLimit"></el-input></el-col>
<el-col :span="6">
<slot></slot>
</el-col>
</el-row>
<h1>空运清关费</h1>
<div v-for="(item ,index) in value1.channelPriceStepClearanceList">
<el-row :gutter="10">
<el-col :span="4">
{{index + 1 }}阶梯定价方案:
</el-col>
<el-col :span="6">
<el-button type="primary" @click="addInterval" v-if="index === 0" >
添加区间
</el-button>
<el-button type="danger" @click="deleteFn(index)" v-else>
删除
</el-button>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="3">
{{index + 1}}阶梯
</el-col>
<el-col :span="9">
<div style="display: flex;align-items: center;">
<el-input v-model="item.startNum"></el-input> - <el-input v-model="item.endNum" ></el-input > /
<weight-select v-model="item.weightUnit" :options="unitList"></weight-select>
</div>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="3" >
空运清关费
</el-col>
<el-col :span="9">
<div style="display: flex;align-items: center;">
<el-input v-model="item.clearancePrice"></el-input>
<currency-select :options="currencyList" v-model="item.clearancePriceUnit"></currency-select>
/ <weight-select :options="unitList" v-model="item.clearanceVolumeUnit"></weight-select>
</div>
</el-col>
</el-row>
</div>
</div>
</template>
<script>
import {getCurrencyPage} from "@/api/ecw/currency";
import CurrencySelect from "@/views/ecw/channel/componrnts/currency-select.vue";
import {getUnitList} from "@/api/ecw/unit";
import WeightSelect from "@/views/ecw/channel/componrnts/weight-select.vue";
export default {
props:{
value:{
type:Object,
default:()=>({channelPriceStepClearanceList:[{
"channelId":'',
"clearancePrice":'',
"clearancePriceUnit":'',
"clearanceVolumeUnit":'',
"endNum":'',
"packagingId":'',
"startNum":'',
"weightUnit":''
}]})
}
},
name: "packaging-type",
components: {WeightSelect, CurrencySelect},
created() {
getCurrencyPage(this.params).then(res => this.currencyList = res.data.list)
getUnitList().then(res => this.unitList = res.data)
},
data(){
return {
currencyList:[],
unitList:[],
value1:{
airWeightLimit:undefined,
packagingTypes:undefined,
channelPriceStepClearanceList:[],
},
}
},
mounted() {
this.value1 = this.value
console.log(this.value1,'value1')
this.$nextTick(()=>{
if(this.value1.channelPriceStepClearanceList.length === 0){
this.addInterval()
}
})
},
methods:{
addInterval(){
let p = {
"channelId":'',
"clearancePrice":'',
"clearancePriceUnit":'',
"clearanceVolumeUnit":'',
"endNum":'',
"packagingId":'',
"startNum":'',
"weightUnit":''
}
this.value1.channelPriceStepClearanceList.push(p)
},
deleteFn(index){
this.value1.channelPriceStepClearanceList.splice(index, 1)
}
},
watch:{
value1:{
handler(val){
this.$emit('input', val)
},
deep:true
},
value:{
handler(val){
this.value1 = val;
},
deep:true
}
}
}
</script>
<style scoped>
.el-row {
margin-bottom: 10px;
display: flex;
flex-wrap: wrap;
align-items: center;
}
</style>
...@@ -18,6 +18,8 @@ export default { ...@@ -18,6 +18,8 @@ export default {
type:[String,Number] type:[String,Number]
} }
}, },
created() {
},
data(){ data(){
return{ return{
val:'' val:''
...@@ -26,6 +28,9 @@ export default { ...@@ -26,6 +28,9 @@ export default {
watch:{ watch:{
val(){ val(){
this.$emit('input', this.val) this.$emit('input', this.val)
},
value(val){
this.val = val;
} }
} }
} }
......
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-card shadow="never"> <el-card shadow="never">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ $t('渠道信息') }}</span> <span>{{ $t('渠道信息') }}</span>
...@@ -85,16 +83,38 @@ ...@@ -85,16 +83,38 @@
</el-input> </el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<!-- <el-col :span="12">
<el-form-item :label="$t('渠道代理')" prop="channelAgent">
<el-input
v-model="form.channelAgent"
:placeholder="$t('请输入渠道代理')"
/>
</el-form-item>
</el-col> -->
</el-row> </el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="可出商品特性">
<el-select multiple v-model="form.attrId">
<el-option v-for="(item, index) in attrList" :value="item.id" :label="$l(item, 'attrName')"></el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<div style="display: flex; justify-content: space-between;">
<h1>
渠道包装列表
</h1>
<div>
<el-button type="primary" @click="addPackaging" >添加包装类型</el-button>
<el-button type="text">选择渠道包装模板</el-button>
</div>
</div>
<el-row :gutter="20" v-for="(item, index) in form.channelPackagingList" :key="index">
<el-col :span="2">包装类型{{index + 1}}</el-col>
<el-col :span="5">
<el-select multiple v-model="item.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) " ></el-option>
</el-select>
</el-col>
<el-col :span="16">
<packaging-type v-if="form.channelPackagingList.length" v-model="form.channelPackagingList[index]">
<el-button @click="deleteFn(index)" type="danger">删除包装类型{{index + 1}}</el-button>
</packaging-type>
</el-col>
</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"
...@@ -140,23 +160,31 @@ ...@@ -140,23 +160,31 @@
import { import {
createChannel, createChannel,
updateChannel, updateChannel,
deleteChannel,
getChannel, getChannel,
getChannelPage, getChannelPage,
exportChannelExcel, exportChannelExcel,
} from "@/api/ecw/channel"; } from "@/api/ecw/channel";
import {getWarehouseList} from '@/api/ecw/warehouse' import {getWarehouseList} from '@/api/ecw/warehouse'
import {getExpressPage} from '@/api/ecw/express' import {getExpressPage} from '@/api/ecw/express'
import PackagingType from "@/views/ecw/channel/componrnts/packaging-type.vue";
import {DICT_TYPE, getDictDataLabel, getDictDatas} from "@/utils/dict";
import {getProductAttrList} from "@/api/ecw/productAttr";
export default { export default {
components: {PackagingType},
data() { data() {
return { return {
form: { form: {
channelCostCreateReqVO:{} channelCostCreateReqVO:{},
channelPackagingList:[],
attrId:[],
}, },
rules: {}, rules: {},
expressList:[], expressList:[],
warehouseList: [], warehouseList: [],
warehouseIdsArr:[] warehouseIdsArr:[],
attrList:[]
}; };
}, },
watch:{ watch:{
...@@ -169,7 +197,12 @@ export default { ...@@ -169,7 +197,12 @@ export default {
this.wareHouseIdsArr = val?.split(',') || [] this.wareHouseIdsArr = val?.split(',') || []
} */ } */
}, },
async created() { mounted() {
getProductAttrList().then(response => {
this.attrList = response.data;
})
},
async created() {
// 获得仓库 // 获得仓库
await getWarehouseList().then(res => { await getWarehouseList().then(res => {
this.warehouseList = res.data this.warehouseList = res.data
...@@ -180,8 +213,11 @@ export default { ...@@ -180,8 +213,11 @@ 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})
console.log('this.form.warehouseIds', this.form.warehouseIds) this.form.attrId = this.form.attrId.split(',').map(i => +i)
this.form.channelPackagingList.forEach(item =>{
item.packagingTypes = 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)
} }
...@@ -190,6 +226,17 @@ export default { ...@@ -190,6 +226,17 @@ export default {
}, },
computed:{ computed:{
DICT_TYPE() {
return DICT_TYPE
},
deletePackagingTypes(){
let a = []
this.form.channelPackagingList.forEach(item => {
a.push(...item.packagingTypes)
})
console.log(a,'aaa')
return a
}
/* wareHouseIdsArr:{ /* wareHouseIdsArr:{
get(){ get(){
return this.form.wareHouseIds?.split(',') || [] return this.form.wareHouseIds?.split(',') || []
...@@ -201,23 +248,37 @@ export default { ...@@ -201,23 +248,37 @@ export default {
} */ } */
}, },
methods: { methods: {
getDictDatas,
deleteFn(index){
this.form.channelPackagingList.splice(index, 1)
},
//添加包装类型
addPackaging(){
let p = {
airWeightLimit:undefined,
packagingTypes:[],
channelPriceStepClearanceList:[],
}
this.form.channelPackagingList.push(p)
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs["form"].validate((valid) => { this.$refs["form"].validate((valid) => {
if (!valid) { if (!valid) {
return; return;
} }
this.form.warehouseIds = this.warehouseIdsArr.join(',') this.form.warehouseIds = this.warehouseIdsArr.join(',')
let attrId = this.form.attrId.join(',')
// 修改的提交 // 修改的提交
if (this.form.channelId != null) { if (this.form.channelId != null) {
updateChannel(this.form).then((response) => { updateChannel({...this.form,attrId}).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.$router.back(); this.$router.back();
}); });
return; return;
} }
// 添加的提交 // 添加的提交
createChannel(this.form).then((response) => { createChannel({...this.form,attrId}).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.$router.back(); this.$router.back();
}); });
......
<template>
<div>
<el-row type="flex" align="align" :gutter="10" >
<el-col :span="3">空运订单重量上限(kg)</el-col>
<el-col :span="6" ><el-input></el-input></el-col>
<el-col :span="6"><el-button type="danger">删除包装类型1</el-button></el-col>
</el-row>
<h1>空运清关费</h1>
<el-row :gutter="10">
<el-col :span="4">
第1阶梯定价方案:
</el-col>
<el-col :span="6">
<el-button type="primary">
添加区间
</el-button>
<el-button type="danger">
删除
</el-button>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="3">
第1阶梯
</el-col>
<el-col :span="6">
<div style="display: flex;align-items: center;">
<el-input></el-input> - <el-input></el-input> / <weight-select :options="unitList"></weight-select>
</div>
</el-col>
</el-row>
<el-row :gutter="10">
<el-col :span="3" >
空运清关费
</el-col>
<el-col :span="6">
<div style="display: flex;align-items: center;">
<el-input></el-input>
<currency-select :options="currencyList"></currency-select>
/ <weight-select :options="unitList"></weight-select>
</div>
</el-col>
</el-row>
</div>
</template>
<script>
import {getCurrencyPage} from "@/api/ecw/currency";
import CurrencySelect from "@/views/ecw/channelMnage/componrnts/currency-select.vue";
import {getUnitList} from "@/api/ecw/unit";
import WeightSelect from "@/views/ecw/channelMnage/componrnts/weight-select.vue";
export default {
name: "packaging-type",
components: {WeightSelect, CurrencySelect},
created() {
getCurrencyPage(this.params).then(res => this.currencyList = res.data.list)
getUnitList().then(res => this.unitList = res.data)
},
data(){
return {
currencyList:[],
unitList:[]
}
}
}
</script>
<style scoped>
.el-row {
margin-bottom: 10px;
display: flex;
flex-wrap: wrap;
align-items: center;
}
</style>
...@@ -116,7 +116,7 @@ ...@@ -116,7 +116,7 @@
</template> </template>
<script> <script>
import PackagingType from "@/views/ecw/channelMnage/componrnts/packaging-type.vue"; import PackagingType from "@/views/ecw/channel/componrnts/packaging-type.vue";
import {getProductAttrList} from "@/api/ecw/productAttr"; import {getProductAttrList} from "@/api/ecw/productAttr";
import {getWarehouseList} from "@/api/ecw/warehouse"; import {getWarehouseList} from "@/api/ecw/warehouse";
import {DICT_TYPE} from "@/utils/dict"; import {DICT_TYPE} from "@/utils/dict";
......
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