Commit 56796bc1 authored by 邓春圆's avatar 邓春圆

渠道修改添加页面3

parent 6bd230f0
...@@ -16,6 +16,7 @@ export default { ...@@ -16,6 +16,7 @@ export default {
}, },
value:{ value:{
type: [Number,String], type: [Number,String],
default:undefined,
} }
}, },
data(){ data(){
...@@ -24,6 +25,7 @@ export default { ...@@ -24,6 +25,7 @@ export default {
} }
}, },
created() { created() {
this.val = this.value;
}, },
watch:{ watch:{
val(){ val(){
......
...@@ -58,16 +58,7 @@ export default { ...@@ -58,16 +58,7 @@ export default {
props:{ props:{
value:{ value:{
type:Object, type:Object,
default:()=>({channelPriceStepClearanceList:[{ default:()=>({channelPriceStepClearanceList:[]})
"channelId":'',
"clearancePrice":'',
"clearancePriceUnit":'',
"clearanceVolumeUnit":'',
"endNum":'',
"packagingId":'',
"startNum":'',
"weightUnit":''
}]})
} }
}, },
name: "packaging-type", name: "packaging-type",
......
...@@ -19,6 +19,7 @@ export default { ...@@ -19,6 +19,7 @@ export default {
} }
}, },
created() { created() {
this.val = this.value;
}, },
data(){ data(){
return{ return{
......
...@@ -99,14 +99,14 @@ ...@@ -99,14 +99,14 @@
</h1> </h1>
<div> <div>
<el-button type="primary" @click="addPackaging" >添加包装类型</el-button> <el-button type="primary" @click="addPackaging" >添加包装类型</el-button>
<el-button type="text">选择渠道包装模板</el-button> <el-button type="text" @click="dialogVisible = true;">选择渠道包装模板</el-button>
</div> </div>
</div> </div>
<el-row :gutter="20" v-for="(item, index) in form.channelPackagingList" :key="index"> <el-row :gutter="20" v-for="(itemm, index) in form.channelPackagingList" :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="item.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) " ></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">
...@@ -154,7 +154,17 @@ ...@@ -154,7 +154,17 @@
<el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button> <el-button type="primary" @click="submitForm">{{ $t('确 定') }}</el-button>
<el-button @click="$router.back()">{{ $t('返回列表') }}</el-button> <el-button @click="$router.back()">{{ $t('返回列表') }}</el-button>
</div> </div>
</div> <el-dialog
title="提示"
:visible.sync="dialogVisible"
width="60%">
<index-dialog @copyFn="copyFn"></index-dialog>
<span slot="footer" class="dialog-footer" style="text-align: center;">
<el-button @click="dialogVisible = false" type="primary">关 闭</el-button>
</span>
</el-dialog>
</div>
</template> </template>
<script> <script>
import { import {
...@@ -169,11 +179,12 @@ import {getExpressPage} from '@/api/ecw/express' ...@@ -169,11 +179,12 @@ import {getExpressPage} from '@/api/ecw/express'
import PackagingType from "@/views/ecw/channel/componrnts/packaging-type.vue"; 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";
export default { export default {
components: {PackagingType}, components: {PackagingType,indexDialog},
data() { data() {
return { return {
dialogVisible:false,
form: { form: {
channelCostCreateReqVO:{}, channelCostCreateReqVO:{},
channelPackagingList:[], channelPackagingList:[],
...@@ -234,7 +245,6 @@ export default { ...@@ -234,7 +245,6 @@ export default {
this.form.channelPackagingList.forEach(item => { this.form.channelPackagingList.forEach(item => {
a.push(...item.packagingTypes) a.push(...item.packagingTypes)
}) })
console.log(a,'aaa')
return a return a
} }
/* wareHouseIdsArr:{ /* wareHouseIdsArr:{
...@@ -249,6 +259,32 @@ export default { ...@@ -249,6 +259,32 @@ export default {
}, },
methods: { methods: {
getDictDatas, getDictDatas,
copyFn(val){
this.form.channelPackagingList = [];
this.dialogVisible = false;
getChannel(val).then((res) => {
res.data.channelPackagingList.forEach((item,index) =>{
if(!this.form.channelPackagingList[index]){
this.form.channelPackagingList[index] = { airWeightLimit:undefined, packagingTypes:[], channelPriceStepClearanceList:[],}
}
item.channelPriceStepClearanceList.forEach((itemm, indexx) => {
let p = { "channelId":'',
"clearancePrice":'',
"clearancePriceUnit":'',
"clearanceVolumeUnit":'',
"endNum":'',
"packagingId":'',
"startNum":'',
"weightUnit":''}
if(!this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx]){
this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx] = p;
}
let it = this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx]
this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx] = {...p,...it,clearancePrice:itemm.clearancePrice,clearancePriceUnit:itemm.clearancePriceUnit,clearanceVolumeUnit:itemm.clearanceVolumeUnit} ;
})
})
});
},
deleteFn(index){ deleteFn(index){
this.form.channelPackagingList.splice(index, 1) this.form.channelPackagingList.splice(index, 1)
}, },
...@@ -268,17 +304,23 @@ export default { ...@@ -268,17 +304,23 @@ export default {
return; return;
} }
this.form.warehouseIds = this.warehouseIdsArr.join(',') this.form.warehouseIds = this.warehouseIdsArr.join(',')
let attrId = this.form.attrId.join(',') let form = JSON.parse(JSON.stringify(this.form))
let attrId = this.form.attrId
attrId = attrId.join(',')
form.attrId = attrId
form.channelPackagingList.forEach(item =>{
item.packagingTypes = item.packagingTypes.join(',')
})
// 修改的提交 // 修改的提交
if (this.form.channelId != null) { if (this.form.channelId != null) {
updateChannel({...this.form,attrId}).then((response) => { updateChannel(form).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.$router.back(); this.$router.back();
}); });
return; return;
} }
// 添加的提交 // 添加的提交
createChannel({...this.form,attrId}).then((response) => { createChannel(form).then((response) => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.$router.back(); this.$router.back();
}); });
......
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="$t('名称')" prop="nameZh">
<el-input v-model="queryParams.nameZh" :placeholder="$t('请输入名称')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<!-- <el-form-item label="名称-英文" prop="nameEn">
<el-input v-model="queryParams.nameEn" placeholder="请输入名称-英文" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> -->
<el-form-item :label="$t('内部名称')" prop="internalNameZh">
<el-input v-model="queryParams.internalNameZh" :placeholder="$t('请输入内部名称')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<!-- <el-form-item label="内部名称-英文" prop="internalNameEn">
<el-input v-model="queryParams.internalNameEn" placeholder="请输入内部名称-英文" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> -->
<el-form-item :label="$t('类型编码')" prop="typeNumber">
<el-input v-model="queryParams.typeNumber" :placeholder="$t('请输入类型编码')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<!-- <el-form-item label="仓库ID字符串" prop="warehouseIds">
<el-input v-model="queryParams.warehouseIds" placeholder="请输入仓库ID字符串" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> -->
<!-- <el-form-item :label="$t('排序')" prop="sort">
<el-input v-model="queryParams.sort" :placeholder="$t('请输入排序')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> -->
<el-form-item :label="$t('快递ID')" prop="expressId">
<el-input v-model="queryParams.expressId" :placeholder="$t('请输入快递ID')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item :label="$t('预计时间')">
<el-input v-model="queryParams.etaTime" :placeholder="$t('预计到达天数')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item :label="$t('渠道代理')" prop="channelAgent">
<el-input v-model="queryParams.channelAgent" :placeholder="$t('请输入渠道代理')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<el-form-item :label="$t('备注')" prop="remarksZh">
<el-input v-model="queryParams.remarksZh" :placeholder="$t('请输入备注-中文')" clearable @keyup.enter.native="handleQuery"/>
</el-form-item>
<!-- <el-form-item label="备注-英文" prop="remarksEn">
<el-input v-model="queryParams.remarksEn" placeholder="请输入备注-英文" clearable @keyup.enter.native="handleQuery"/>
</el-form-item> -->
<!-- <el-form-item label="状态(0:禁用 1:启用)" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态(0:禁用 1:启用)" clearable size="small">
<el-option :label="$t('请选择字典生成')" value="" />
</el-select>
</el-form-item> -->
<!-- <el-form-item :label="$t('创建时间')">
<el-date-picker v-model="dateRangeCreateTime" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" />
</el-form-item> -->
<el-form-item>
<el-button type="primary" icon="el-icon-search" @click="handleQuery">{{ $t('搜索') }}</el-button>
<el-button icon="el-icon-refresh" @click="resetQuery">{{ $t('重置') }}</el-button>
</el-form-item>
</el-form>
<!-- 列表 -->
<el-table v-loading="loading" :data="list">
<el-table-column :label="$t('渠道ID')" align="center" prop="channelId" />
<el-table-column :label="$t('名称')" align="center" prop="nameZh">
<template slot-scope="{row}">{{$l(row, 'name')}}</template>
</el-table-column>
<el-table-column :label="$t('内部名称')" align="center" prop="internalNameZh">
<template slot-scope="{row}">{{$l(row, 'internalName')}}</template>
</el-table-column>
<el-table-column :label="$t('包装数量')" prop="packagingCount">
</el-table-column>
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="text" @click="copyFn(scope.row)">
复制
</el-button>
</template>
</el-table-column>
</el-table>
<!-- 分页组件 -->
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
@pagination="getList"/>
</div>
</template>
<script>
import {getChannelPage, exportChannelExcel } from "@/api/ecw/channel";
export default {
name: "EcwChannelIndex",
components: {
},
data() {
return {
// 遮罩层
loading: false,
// 导出遮罩层
exportLoading: false,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 渠道管理列表
list: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
dateRangeEtaTime: [],
dateRangeCreateTime: [],
// 查询参数
queryParams: {
pageNo: 1,
pageSize: 10
},
// 表单参数
form: {},
// 表单校验
rules: {
}
};
},
created() {
this.getList();
},
activated() {
this.getList();
},
methods: {
copyFn(val){
this.$emit('copyFn',val.channelId)
},
/** 查询列表 */
getList() {
this.loading = true;
// 处理查询参数
let params = {...this.queryParams};
// 执行查询
getChannelPage(params).then(response => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.queryParams = {
pageNo: 1,
pageSize: 10
}
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
return this.$router.push('create_channel')
},
/** 修改按钮操作 */
handleUpdate(row) {
return this.$router.push('edit_channel?id=' + row.channelId)
},
/** 删除按钮操作 */
handleDelete(row) {
const channelId = row.channelId;
this.$modal.confirm(this.$t('是否确认删除渠道管理编号为{channelId}的数据项?'),{channelId} ).then(function() {
return deleteChannel(channelId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = {...this.queryParams};
params.pageNo = undefined;
params.pageSize = undefined;
this.addBeginAndEndTime(params, this.dateRangeEtaTime, 'etaTime');
this.addBeginAndEndTime(params, this.dateRangeCreateTime, 'createTime');
// 执行导出
this.$modal.confirm('是否确认导出所有渠道管理数据项?').then(() => {
this.exportLoading = true;
return exportChannelExcel(params);
}).then(response => {
this.$download.excel(response, '渠道列表.xls');
this.exportLoading = false;
}).catch(() => {});
}
}
};
</script>
<style lang="scss">
.left {
.el-tag {
background-color: #e6f6fd;
border: 1px solid #ccecfb;
display: inline-block;
height:auto;
padding: 0 10px;
line-height: 30px;
font-size: 12px;
color: #02a1e9;
border-radius: 4px;
box-sizing: border-box;
white-space: nowrap;
}
}
</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