Commit 7125e0a9 authored by 邓春圆's avatar 邓春圆

商品的阶梯价格,以及阶梯组件修改

parent 2ee96827
<template>
<div>
<el-row type="flex" align="align" :gutter="10" >
<el-col :span="3">空运订单重量上限(kg)</el-col>
<el-col :span="6">空运订单重量上限(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">
<div v-for="(item ,index) in value1[keyArr]">
<el-row :gutter="10">
<el-col :span="4">
{{index + 1 }}阶梯定价方案:
......@@ -58,7 +58,11 @@ export default {
props:{
value:{
type:Object,
default:()=>({channelPriceStepClearanceList:[]})
default:()=>({})
},
keyArr:{
type:String,
default:'channelPriceStepClearanceList'
}
},
name: "packaging-type",
......@@ -74,16 +78,14 @@ export default {
value1:{
airWeightLimit:undefined,
packagingTypes:undefined,
channelPriceStepClearanceList:[],
},
}
},
mounted() {
this.value1 = this.value
console.log(this.value1,'value1')
this.$nextTick(()=>{
if(this.value1.channelPriceStepClearanceList.length === 0){
if(this.value1[this.keyArr] && this.value1[this.keyArr].length === 0){
this.addInterval()
}
})
......@@ -100,11 +102,12 @@ export default {
"startNum":'',
"weightUnit":''
}
this.value1.channelPriceStepClearanceList.push(p)
this.value1[this.keyArr].push(p)
this.$forceUpdate();
},
deleteFn(index){
this.value1.channelPriceStepClearanceList.splice(index, 1)
this.value1[this.keyArr].splice(index, 1)
this.$forceUpdate();
}
},
watch:{
......
......@@ -225,6 +225,9 @@ export default {
if (this.$route.query.id) {
getChannel(this.$route.query.id).then((res) => {
this.$set(this, 'form', {... res.data})
if(!this.form.channelPackagingList !== null ){
this.form.channelPackagingList = [];
}
this.form.attrId = this.form.attrId.split(',').map(i => +i)
this.form.channelPackagingList.forEach(item =>{
item.packagingTypes = item.packagingTypes.split(',') || []
......@@ -268,14 +271,16 @@ export default {
this.form.channelPackagingList[index] = { airWeightLimit:undefined, packagingTypes:[], channelPriceStepClearanceList:[],}
}
item.channelPriceStepClearanceList.forEach((itemm, indexx) => {
let p = { "channelId":'',
let p = {
"channelId":'',
"clearancePrice":'',
"clearancePriceUnit":'',
"clearanceVolumeUnit":'',
"endNum":'',
"packagingId":'',
"startNum":'',
"weightUnit":''}
"weightUnit":''
}
if(!this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx]){
this.form.channelPackagingList[index].channelPriceStepClearanceList[indexx] = p;
}
......
......@@ -130,8 +130,8 @@
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" @pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="title" :visible.sync="open" width="550px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="110px">
<el-dialog :title="title" :visible.sync="open" width="850px" append-to-body>
<el-form v-if="open" ref="form" :model="form" :rules="rules" label-width="110px">
<el-form-item :label="$t('商品类型')" prop="typeId">
<el-select v-model="form.typeId" :placeholder="$t('选择商品类型')" clearable>
<el-option v-for="types in typeList" :key="types.id" :label="types.titleZh" :value="types.id" />
......@@ -148,15 +148,6 @@
<el-form-item :label="$t('商品图片')" prop="img">
<image-upload v-model="form.imgs" />
<!-- <el-col :span="8">
<el-input v-model="form.imgs" :placeholder="$t('请上传图片')" disabled />
</el-col> -->
<!-- <el-upload action="#" :http-request="requestUpload" :show-file-list="false" :before-upload="beforeUpload">
<el-button size="small">{{ $t('上传图片') }}<i class="el-icon-upload el-icon--right"></i>
</el-button>
</el-upload> -->
</el-form-item>
<el-form-item prop="auditStatus" :label="$t('是否审核')">
......@@ -224,9 +215,6 @@
</el-input>
</el-form-item>
<el-form-item :label="$t('可参与优惠')">
<!-- <el-select multiple v-model="form.couponlds" size="5" style="min-width: 300px; border:1px solid #DCDFE6; border-radius:4px">-->
<!-- <el-option v-for="item in preferentialList" :value="item.couponId" :label="item.titleZh" :key="item.couponId" :disabled="item.mandatory">{{item.titleZh}}</el-option>-->
<!-- </el-select>-->
<div style="width: 300px;height: 400px;border: 1px solid;overflow-y: auto">
<div @click="selectMoveAbout(item)" style="display: flex;justify-content: space-between; align-items: center;" :style="{'cursor':item.mandatory ? 'no-drop' : 'pointer' }" v-for="item in preferentialList" :key="item.couponId" >
<div>
......@@ -236,12 +224,26 @@
</div>
</div>
</el-form-item>
<packaging-type key-arr="priceStepClearanceList" v-model="form">
<el-button @click="visible = true; open = false;" type="text">选择空运模板</el-button>
</packaging-type>
<p v-if="lineNum">
<span>
复制模板线路价格:{{lineNum}}个
</span>
<span style="color: #0a84ff;cursor: pointer;">
查看《#选择空运商品模板名称#》路线价格
</span>
</p>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">{{$t('确定')}}</el-button>
<el-button @click="cancel">{{$t('取消')}}</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="visible" >
<product-dialog @copyLine="copyLine"></product-dialog>
</el-dialog>
</div>
</template>
......@@ -261,14 +263,19 @@ import {DICT_TYPE, getDictDatas} from '@/utils/dict';
import {AuditStatusEnum, CommonStatusEnum} from '@/utils/constants';
import {uploadFile} from "@/api/infra/file";
import ImageUpload from '@/components/ImageUpload'
import PackagingType from "@/views/ecw/channel/componrnts/packaging-type.vue";
import ProductDialog from "@/views/ecw/product/product-dialog.vue";
export default {
name: "EcwProductIndex",
components: {
ProductDialog,
PackagingType,
ImageUpload
},
data() {
return {
visible:false,
// 选中数组
ids: [],
// 非单个禁用
......@@ -313,7 +320,9 @@ export default {
status: null,
},
// 表单参数
form: {},
form: {
},
// 表单校验
rules: {
typeId: [{ required: true, message: this.$t("商品类型不能为空"), trigger: "change" }],
......@@ -335,7 +344,8 @@ export default {
packagingList: getDictDatas(DICT_TYPE.ECW_PACKAGING_TYPE),
locationList: getDictDatas(DICT_TYPE.ECW_CONTAINER_LOCATION),
preferentialList:[],
exceptionProductId:0//新增商品异常传的id
exceptionProductId:0,//新增商品异常传的id
lineNum:0
};
},
......@@ -403,6 +413,51 @@ export default {
},
methods: {
copyLine(val , bol){
let copy = ()=>{
this.form.airWeightLimit = val.airWeightLimit;
val.priceStepClearanceList.forEach((item ,index) =>{
if(this.form.priceStepClearanceList[index]){
this.form.priceStepClearanceList[index].clearancePrice = item.clearancePrice
this.form.priceStepClearanceList[index].clearancePriceUnit = item.clearancePriceUnit
this.form.priceStepClearanceList[index].clearanceVolumeUnit = item.clearanceVolumeUnit
}else {
let p = {
"channelId":'',
"clearancePrice":item.clearancePrice,
"clearancePriceUnit":item.clearancePriceUnit,
"clearanceVolumeUnit":item.clearanceVolumeUnit,
"endNum":'',
"packagingId":'',
"startNum":'',
"weightUnit":''
}
this.form.priceStepClearanceList.push(p)
}
})
}
this.visible = false;
if(bol){
this.$confirm(`请确认是否要将#${this.$l(val,'title')}#的所有路线价格复制到当前商品#${this.$l(this.form,'title')}#中?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.form.priceLineCount = val.id;
this.lineNum = val.priceStepClearanceCount;
this.form.priceLineCount = val.id;
this.isCopyProductPriceTemplate = true;
copy()
this.open = true;
}).catch(() => {
this.open = true;
});
}else {
this.open = true;
copy()
}
this.$forceUpdate()
},
/** 获取产品属性列表 */
getAttrList() {
getProductAttrList().then(response => {
......@@ -477,7 +532,12 @@ export default {
requirements: 0,
needBook: 0,
couponIds:[],
airWeightLimit:undefined,
priceStepClearanceList:[],
isCopyProductPriceTemplate:false,
productTemplateId:undefined,
};
this.lineNum = 0
this.resetForm("form");
},
/** 搜索按钮操作 */
......@@ -511,6 +571,7 @@ export default {
const id = row.id;
getProduct(id).then(response => {
this.form = {...response.data,couponIds:[]};
this.form.channelPriceStepClearanceList = this.form.priceStepClearanceList;
let attrArray = this.form.attrId?this.form.attrId.split(','):[];
for (let index in attrArray) {
let value = attrArray[index];
......@@ -540,9 +601,14 @@ export default {
this.form.attrId = this.form.attrArray.join(',');
// 修改的提交
if (this.form.id != null) {
this.form.priceStepClearanceList.forEach(i =>{
i.productId = this.form.id
})
if(this.exceptionProductId){
this.form.productId = this.exceptionProductId
this.form.status = 0
}else {
this.form.productId = this.form.id
}
updateProduct(this.form).then(response => {
this.$modal.msgSuccess(this.$t("修改成功"));
......
This diff is collapsed.
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