Authored by baoss

优惠券表单页修改 review by bevishuang

... ... @@ -9,14 +9,22 @@
<i-spin v-if="loading"></i-spin>
<i-form v-else ref="formCoupon" :rules="ruleValidate" :model="formData" :label-width="80">
<i-form-item class="form-group" label="优惠券类型"></i-form-item>
<i-form-item label="用户类型" prop="userType">
<radio-group v-model="formData.userType" @on-change="changeUserType">
<radio :label="1" :disabled="!!formData.id">买家</radio>
<radio :label="2" :disabled="!!formData.id">卖家</radio>
</radio-group>
</i-form-item>
<div :key="formData.userType">
<i-form-item label="优惠券类型" prop="couponType">
<i-select style="width: 100px;" v-model="formData.couponType" :disabled="readonly">
<i-option :value="0">请选择</i-option>
<i-option :value="100">活动券</i-option>
<i-option :value="110">运费券</i-option>
<i-option v-for="item in counponOptions" :value="item.value" :key="item.value">{{ item.label }}</i-option>
<!-- <i-option :value="100">活动券</i-option>
<i-option :value="110">运费券</i-option> -->
</i-select>
</i-form-item>
<i-form-item class="form-group" label="基本信息"></i-form-item>
<i-form-item label="Token" v-if="couponToken">{{couponToken}}</i-form-item>
<i-form-item label="名称" prop="couponName">
... ... @@ -137,17 +145,19 @@
<i-form-item label="可用商品类型">
<checkbox-group v-model="formData.skupAllowTypeLabel" @on-change="getCheckBox">
<!-- <checkbox label="线下店订单" :disabled="readonly"></checkbox>-->
<checkbox label="极速发货" :disabled="readonly"></checkbox>
<checkbox v-for = "(val, key) in allowTypeLabelList" :key="formData.userType+key" :label="val" :disabled="readonly"></checkbox>
<!-- <checkbox label="极速发货" :disabled="readonly"></checkbox>
<checkbox label="极速寄存" :disabled="readonly"></checkbox>
<checkbox label="预售" :disabled="readonly"></checkbox>
<checkbox label="瑕疵" :disabled="readonly"></checkbox>
<checkbox label="二手" :disabled="readonly"></checkbox>
<checkbox label="二手" :disabled="readonly"></checkbox> -->
<!-- <checkbox label="鉴定" :disabled="readonly"></checkbox>-->
<checkbox label="海外直邮" :disabled="readonly"></checkbox>
<!-- <checkbox label="海外直邮" :disabled="readonly"></checkbox>
<checkbox label="现货发货" :disabled="readonly"></checkbox>
<checkbox label="现货寄存" :disabled="readonly"></checkbox>
<checkbox label="闪购发货" :disabled="readonly"></checkbox>
<checkbox label="闪购寄存" :disabled="readonly"></checkbox>
<checkbox label="闪购寄存" :disabled="readonly"></checkbox> -->
</checkbox-group>
</i-form-item>
... ... @@ -163,6 +173,7 @@
<i-form-item label="展示在详情页" prop="isShowInDetail">
<checkbox v-model="formData.isShowInDetail" :disabled="allreadonly" @on-change="setIsShowInDetail"></checkbox>
</i-form-item>
</div>
</i-form>
</i-modal>
</template>
... ... @@ -187,7 +198,32 @@ const forbidenLabelMap = {
5: "全新瑕疵",
3: "闪购"
};
const userCouponType = {
buyer: [{
value: 100,
label: '活动券'
},
{
value: 110,
label: '运费券'
}],
seller: [{
value: 120,
label: 'UFO卖家券'
}]
}
const sellerAllowType = {
现货发货: "1-N",
预售: "4",
瑕疵: "5",
二手: "6"
};
const sellerAllowLabel = {
"1-N": "现货发货",
"4": "预售",
"5": "瑕疵",
"6": "二手",
};
const allowTypeMap = {
// '线下店订单': '2',
极速发货: "9-N",
... ... @@ -224,42 +260,55 @@ const businessClientLabelMap = {
ufo: "UFO",
"h5/xianyu": "闲鱼"
};
export default {
components: {},
name: "ModalCreateCoupon",
data() {
return {
readonly: false,
allreadonly: false,
visiable: false,
loading: false,
posting: true,
uploadTxt: "",
couponToken: "",
formData: {
const initFormData = {
id: 0,
couponName: "",
couponType: 0,
couponNum: 0,
couponType: 0,
useNum: 1,
couponAmount: 0,
useLimitType: 0,
remark: "",
productLimitType: 2,
productLimitValue: "",
productLimitType: 2,
useLimitValue: 0,
time: ["", ""],
receiveTime: ["", ""],
// skupForbidTypeLable:[],
// skupForbidType: ''
skupAllowTypeLabel: [],
skupAllowType: "",
businessClientLabel: [],
businessClient: "",
checkRequired: 0,
isCheckRequired: true,
isCheckRequired: false,
// 是否展示在详情页
isShowInDetail: false
isShowInDetail: false,
// skupForbidTypeLable:[],
// skupForbidType: ''
};
export default {
components: {},
name: "ModalCreateCoupon",
data() {
return {
readonly: false,
allreadonly: false,
visiable: false,
loading: false,
posting: true,
uploadTxt: "",
couponToken: "",
formData: {
userType: 1,
...initFormData
},
buyerFormDataCache: {
userType: 1,
...initFormData
},
sellerFormDataCache: {
userType: 2,
...initFormData
},
ruleValidate: {
couponType: {
... ... @@ -360,6 +409,14 @@ export default {
}
};
},
computed: {
allowTypeLabelList: function() {
return this.formData.userType === 1 ? allowLabelMap : sellerAllowLabel
},
counponOptions: function() {
return this.formData.userType === 1 ? userCouponType.buyer : userCouponType.seller
}
},
methods: {
async show(id, readonly, allreadonly) {
// console.log(id)
... ... @@ -368,28 +425,8 @@ export default {
this.posting = this.visiable = true;
this.$refs.formCoupon.resetFields();
this.couponToken = "";
let initData = {
id: 0,
couponName: "",
couponNum: 0,
couponType: 0,
useNum: 1,
couponAmount: 0,
useLimitType: 0,
remark: "",
productLimitValue: "",
productLimitType: 2,
useLimitValue: 0,
time: ["", ""],
skupAllowTypeLabel: [],
skupAllowType: "",
businessClientLabel: [],
businessClient: "",
checkRequired: 0,
isShowInDetail: false
// skupForbidTypeLable:[],
// skupForbidType: ''
};
let initData = initFormData
initData.userType = 1
if (id) {
this.loading = true;
... ... @@ -425,6 +462,7 @@ export default {
console.log('=====:'+isCheckRequired)
initData = {
id,
userType: 1,
couponName: coupon.couponName,
couponNum: coupon.couponNum,
couponType: coupon.couponType || 0,
... ... @@ -483,6 +521,17 @@ export default {
setIsShowInDetail(checked) {
this.formData.isShowInDetail = checked
},
changeUserType(val) {
if(val === 2) {
this.buyerFormDataCache = {...this.formData, userType: 1}
this.formData = this.sellerFormDataCache
} else {
this.sellerFormDataCache = {...this.formData, userType: 2}
this.formData = this.buyerFormDataCache
}
// console.log(initFormData)
// console.log(this.formData)
},
getCheckBox() {
// checkbox勾选取消的监测
let arr = [];
... ...