Authored by bevishuang

fix some bug

... ... @@ -95,6 +95,13 @@
<checkbox label="闪购寄存" :disabled="readonly"></checkbox>
</checkbox-group>
</i-form-item>
<i-form-item label="购买渠道" prop="useLimitType">
<checkbox-group v-model="formData.businessClientLabel" @on-change="getChannelCheckBox">
<checkbox label="UFO" :disabled="readonly"></checkbox>
<checkbox label="闲鱼" :disabled="readonly"></checkbox>
</checkbox-group>
</i-form-item>
</i-form>
</i-modal>
</template>
... ... @@ -148,6 +155,14 @@
'3-N': '闪购发货',
'3-Y':'闪购寄存'
};
const businessClientTypeMap = {
'UFO': 'ufo',
'闲鱼': 'h5/xianyu'
};
const businessClientLabelMap = {
'ufo': 'UFO',
'h5/xianyu': '闲鱼',
};
export default {
components: {},
... ... @@ -177,7 +192,8 @@
// skupForbidTypeLable:[],
// skupForbidType: ''
skupAllowTypeLabel: [],
skupAllowType: ''
skupAllowType: '',
businessClient: ''
},
ruleValidate: {
couponType: {required: true, validator: (rule, value, callback) => {
... ... @@ -255,7 +271,9 @@
useLimitValue: 0,
time: ['', ''],
skupAllowTypeLabel: [],
skupAllowType: ''
skupAllowType: '',
businessClientLabel: [],
businessClient: ''
// skupForbidTypeLable:[],
// skupForbidType: ''
};
... ... @@ -282,6 +300,14 @@
skupAllowTypeLabel.push(allowLabelMap[arr[i]]);
}
}
let businessClientTypeLabel = [];
if (coupon.businessClient) {
let arr = coupon.businessClient.split(',');
for(let i = 0; i < arr.length; i++) {
businessClientTypeLabel.push(businessClientLabelMap[arr[i]]);
}
}
initData = {
id,
couponName: coupon.couponName,
... ... @@ -296,7 +322,9 @@
useLimitValue: coupon.useLimitValue,
time: [dayjs.unix(coupon.startTime).format('YYYY-MM-DD HH:mm:ss'), dayjs.unix(coupon.endTime).format('YYYY-MM-DD HH:mm:ss')],
skupAllowTypeLabel: skupAllowTypeLabel,
skupAllowType: coupon.skupAllowType
skupAllowType: coupon.skupAllowType,
businessClientLabel: businessClientTypeLabel,
businessClient: coupon.businessClient //购买渠道
};
} else {
result.message && this.$Message.warning(result.message);
... ... @@ -320,12 +348,24 @@
let arr = [];
for (let i = 0; i < this.formData.skupAllowTypeLabel.length; i++) {
let allowType = this.formData.skupAllowTypeLabel[i];
console.log(allowType);
arr.push(allowTypeMap[allowType]);
}
console.log(arr);
this.formData.skupAllowType = arr.join(',');
},
getChannelCheckBox(){
let arr = [];
for (let i = 0; i < this.formData.businessClientLabel.length; i++) {
let businessClientType = this.formData.businessClientLabel[i];
console.log(businessClientType);
arr.push(businessClientTypeMap[businessClientType]);
}
console.log(arr);
this.formData.businessClient = arr.join(',');
},
async saveData(params) {
if (this.allreadonly) {
this.visiable = false;
... ... @@ -346,7 +386,8 @@
useLimitType: parseInt(params.useLimitType) >= 0 ? params.useLimitType : void 0,
startTime: params.time[0] ? dayjs(params.time[0]).unix() : void 0,
endTime: params.time[1] ? dayjs(params.time[1]).unix() : void 0,
skupAllowType: params.skupAllowType
skupAllowType: params.skupAllowType,
businessClient: params.businessClient,
});
console.log('result=', result);
... ... @@ -365,7 +406,8 @@
},
onBeforeUpload(file) {
const fileExt = file.name.split('.').pop().toLocaleLowerCase();
if (fileExt !== 'XLSX') {
console.log(fileExt)
if (fileExt !== 'xlsx') {
this.$Message.warning('文件格式错误');
return false;
}
... ...