Commit 690e5d63 by caoyanzhi

update: 自提点调整

parent e51fd312
......@@ -162,6 +162,10 @@ export default {
},
created() {
this.init();
// 组件创建后,如果this.data.shopSelectType == ''时,需要主动触发一下onTypeChange事件,将shopSelectType = 0传给调用方
if (typeof this.data.shopSelectType != 'number' || this.data.shopSelectType == '') {
this.onTypeChange(0);
}
},
mounted() {
document.addEventListener('click', this.onClosePopover, true);
......
......@@ -216,7 +216,7 @@
</el-checkbox-group>
</template>
</el-form-item>
<el-form-item label="设置自提点" v-if="goodsForm.deliveryType == 2 || goodsForm.deliveryList.length == 2">
<el-form-item prop="shopSelectType" label="设置自提点" v-if="goodsForm.deliveryType == 2 || goodsForm.deliveryList.length == 2">
<template>
<select-pickup-store :gift-id="giftId" :is-edit="isEdit" :data="diliveryData" @change="changeStoreSelect"></select-pickup-store>
</template>
......@@ -334,6 +334,16 @@ export default {
callback();
}
};
const valiShopSelectType = (rule, value, callback) => {
const { shopCodeList, shopNum } = this.goodsForm;
if (value == 1 && (!Array.isArray(shopCodeList) || shopCodeList.length == 0)) {
return callback(new Error('请选择自提点'));
}
if (value == 2 && shopNum == 0) {
return callback(new Error('请导入自提点数据'));
}
callback();
};
return {
uploadUrl: uploadUrl,
bread: [
......@@ -372,8 +382,10 @@ export default {
operAuthType: '', // 操作人权限
operAuth: '',
operAuthPre: [],
shopCodeList: [],
deliveryType: [], // 配送方式 1物流发货 2门店自提 3文本券码
shopSelectType: '', // 自提点相关的数据
shopCodeList: [], // 自提点相关的数据
shopNum: '', // 自提点相关的数据
stockUseType: '', // 库存使用类型(0:占用,1:动态 , 2占用+动态)
deliveryList: [],
costPrice: '',
......@@ -392,6 +404,7 @@ export default {
stock: [ { required: true, message: '请输入可占用库存', trigger: 'blur' } ],
// refundFlag: [ { required: true, message: '请选择是否支持退款', trigger: 'change' } ],
deliveryList: [ { required: true, message: '请选择配送方式', trigger: 'change' } ],
shopSelectType: [ { required: true, validator: valiShopSelectType, trigger: 'change' } ],
checkList: [ { required: true, message: '请选择库存消耗方式', trigger: 'change' } ],
// operAuthType: [ { required: true, message: '请选择操作人权限', trigger: 'change' } ],
},
......@@ -437,11 +450,6 @@ export default {
skuBarCode: ''
},
isEdit: false,
diliveryData: {
shopSelectType: '',
shopCodeList: [],
shopNum: '',
},
relationId: '', // 账号分组relationId
isEcho: false, // 控制操作人权限是否回显数据
sceneType: 10, // 场景值,现在测试使用,后期提供确定的
......@@ -492,9 +500,9 @@ export default {
},
// 自提点选择
changeStoreSelect(val){
this.diliveryData.shopSelectType = val.shopSelectType;
this.diliveryData.shopCodeList = val.shopCodeList;
this.diliveryData.shopNum = val.shopNum;
this.goodsForm.shopSelectType = val.shopSelectType;
this.goodsForm.shopCodeList = val.shopCodeList;
this.goodsForm.shopNum = val.shopNum;
},
// 处理库存消耗方式
changeStockUse(value){
......@@ -515,7 +523,7 @@ export default {
getGiftShopList({ id: this.giftId }).then(res => {
if(res.code === '0000'){
res.result.forEach((item) =>{
this.diliveryData.shopCodeList.push(item.shopCode);
this.goodsForm.shopCodeList.push(item.shopCode);
});
}else{
this.$message.error(res.message);
......@@ -545,8 +553,8 @@ export default {
}else{
this.goodsForm.deliveryList = [ this.goodsForm.deliveryType ];
};
this.diliveryData.shopSelectType = resResult.shopSelectType;
this.diliveryData.shopNum = resResult.shopNum != '0' ? resResult.shopNum : '0';
this.goodsForm.shopSelectType = resResult.shopSelectType;
this.goodsForm.shopNum = resResult.shopNum != '0' ? resResult.shopNum : '0';
this.goodsForm.giftImages = resResult.giftImages;
this.goodsForm.stockUseType = resResult.stockUseType;
let img = resResult.giftImages.split(',');
......@@ -1378,12 +1386,10 @@ export default {
operAuth: '', // 操作人权限
deliveryType: this.goodsForm.deliveryType, // 兑换方式
source: 1, // 新建方式 默认手动发布1
shopSelectType: this.diliveryData.shopSelectType, // 门店选择类型
// shopImportUuid: this.diliveryData.shopImportUuid, // 导入门店唯一标识 仅用于新增
shopCodeList: this.diliveryData.shopCodeList, // 门店CodeList
shopSelectType: this.goodsForm.shopSelectType, // 门店选择类型
shopCodeList: this.goodsForm.shopCodeList, // 门店CodeList
stockUseType: this.goodsForm.stockUseType, // 库存使用类型
};
console.log(params);
this.$emit('updateLoading');
this.$refs.accg.save().then(res=>{
if (this.isEdit) {
......@@ -1417,6 +1423,12 @@ export default {
});
}
},
computed: {
diliveryData() {
const { shopSelectType, shopCodeList, shopNum } = this.goodsForm;
return { shopSelectType, shopCodeList, shopNum };
},
},
};
</script>
<style lang="less" scoped>
......
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