|
@@ -9,28 +9,39 @@
|
|
<div v-else class="filter-container">
|
|
<div v-else class="filter-container">
|
|
<div class="filter-control">
|
|
<div class="filter-control">
|
|
<span>优惠月份:</span>
|
|
<span>优惠月份:</span>
|
|
- <el-date-picker
|
|
|
|
- v-model="time"
|
|
|
|
- type="monthrange"
|
|
|
|
- range-separator="至"
|
|
|
|
- start-placeholder="开始月份"
|
|
|
|
- end-placeholder="结束月份"
|
|
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="formParams.month"
|
|
|
|
+ placeholder="开始月份"
|
|
|
|
+ clearable
|
|
|
|
+ suffix-icon="el-icon-date"
|
|
|
|
+ :disabled="true"
|
|
|
|
+ style="width:100px;"
|
|
|
|
+ />
|
|
|
|
+ -
|
|
|
|
+ <el-input
|
|
|
|
+ v-model="formParams.endMonth"
|
|
|
|
+ placeholder="结束月份"
|
|
|
|
+ clearable
|
|
|
|
+ suffix-icon="el-icon-date"
|
|
|
|
+ :disabled="true"
|
|
|
|
+ style="width:100px;"
|
|
/>
|
|
/>
|
|
<el-button type="primary" icon="el-icon-plus" size="mini" :disabled="disabled" style="margin-left: 30px;" @click="handleAddList">新增优惠券</el-button>
|
|
<el-button type="primary" icon="el-icon-plus" size="mini" :disabled="disabled" style="margin-left: 30px;" @click="handleAddList">新增优惠券</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<el-form ref="couponFrom" :model="form" label-width="100px">
|
|
<el-form ref="couponFrom" :model="form" label-width="100px">
|
|
<div v-for="(formItem,index) in form.formList" :key="formItem.key" class="form-cell" :data-key="formItem.key">
|
|
<div v-for="(formItem,index) in form.formList" :key="formItem.key" class="form-cell" :data-key="formItem.key">
|
|
- <el-form-item :label="`优惠券${index+1}:`" style="margin-bottom: 10px;">
|
|
|
|
|
|
+ <el-form-item :label="`优惠券${index+1}:`" style="margin-bottom: 10px;" :rules="rules.couponType">
|
|
<el-radio-group v-model="formItem.couponType">
|
|
<el-radio-group v-model="formItem.couponType">
|
|
<el-radio :label="0">活动券</el-radio>
|
|
<el-radio :label="0">活动券</el-radio>
|
|
<el-radio :label="1">品类券</el-radio>
|
|
<el-radio :label="1">品类券</el-radio>
|
|
<el-radio :label="3">店铺券</el-radio>
|
|
<el-radio :label="3">店铺券</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="供应商" :hidden="formItem.couponType === 3 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
|
|
+ <el-form-item label="供应商" :prop="`formList.${index}.shopData`" :hidden="formItem.couponType === 3 ? false : true" :rules="rules.shopData">
|
|
<template v-if="formItem.shopData && formItem.shopData.length === 0">
|
|
<template v-if="formItem.shopData && formItem.shopData.length === 0">
|
|
<el-button type="primary" autofocussize="mini" size="mini" icon="el-icon-plus" @click="handleShopDialogVisible(index)">选择供应商</el-button>
|
|
<el-button type="primary" autofocussize="mini" size="mini" icon="el-icon-plus" @click="handleShopDialogVisible(index)">选择供应商</el-button>
|
|
|
|
+ <el-checkbox-group v-show="false" v-model="formItem.shopData" />
|
|
</template>
|
|
</template>
|
|
<template v-else>
|
|
<template v-else>
|
|
<el-table :data="formItem.shopData" border width="1000">
|
|
<el-table :data="formItem.shopData" border width="1000">
|
|
@@ -56,66 +67,69 @@
|
|
<template slot="prepend" style="padding: 0 10px;">订单商品总额满:</template>
|
|
<template slot="prepend" style="padding: 0 10px;">订单商品总额满:</template>
|
|
</el-input>
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item label="优惠商品:" :hidden="formItem.couponType === 0 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
|
|
+ <el-form-item label="优惠商品:" :hidden="formItem.couponType === 0 ? false : true" style="margin-bottom: 10px;" :rules="rules.productType">
|
|
<el-radio-group v-model="formItem.productType">
|
|
<el-radio-group v-model="formItem.productType">
|
|
<el-radio :label="'1'">全商城商品</el-radio>
|
|
<el-radio :label="'1'">全商城商品</el-radio>
|
|
<el-radio :label="'2'">指定商品</el-radio>
|
|
<el-radio :label="'2'">指定商品</el-radio>
|
|
</el-radio-group>
|
|
</el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
- <el-form-item :hidden="formItem.productType === '2'&& formItem.couponType === 0 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
- <el-button type="primary" icon="el-icon-sort" size="mini" :disabled="disabled3(formItem.associateList)" @click="handleOnInputBlur(formItem,index)">一键排序</el-button>
|
|
|
|
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleGoodDialogVisible(index)">添加商品</el-button>
|
|
|
|
- <el-table v-show="formItem.associateList && formItem.associateList.length>0" :data="formItem.associateList" border>
|
|
|
|
- <el-table-column property="mainImage" label="商品图片" align="center" width="80">
|
|
|
|
- <template slot-scope="{ row }">
|
|
|
|
- <el-popover
|
|
|
|
- placement="top-start"
|
|
|
|
- title=""
|
|
|
|
- width="180"
|
|
|
|
- trigger="hover"
|
|
|
|
- >
|
|
|
|
- <img :src="row.mainImage" alt="" style="width:150px;height:150px;">
|
|
|
|
- <img slot="reference" :src="row.mainImage" alt="" style="width:30px;height:30px;">
|
|
|
|
- </el-popover>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column property="name" label="商品名称" align="center" />
|
|
|
|
- <el-table-column property="shopName" label="供应商" align="center" />
|
|
|
|
- <el-table-column label="网站状态" align="center" width="80">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-switch
|
|
|
|
- v-model="scope.row.pcStatus"
|
|
|
|
- active-color="#1890ff"
|
|
|
|
- inactive-color="#DCDFE6"
|
|
|
|
- active-value="1"
|
|
|
|
- inactive-value="0"
|
|
|
|
- />
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="小程序状态" align="center" width="100">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-switch
|
|
|
|
- v-model="scope.row.appletsStatus"
|
|
|
|
- active-color="#1890ff"
|
|
|
|
- inactive-color="#DCDFE6"
|
|
|
|
- active-value="1"
|
|
|
|
- inactive-value="0"
|
|
|
|
- />
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="排序" align="center" width="100">
|
|
|
|
- <template slot-scope="{row}">
|
|
|
|
- <el-input v-model="row.sort" maxlength="4" minlength="1" />
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="操作" align="center">
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
- <el-button type="text" @click="handleDeletePros(formItem,scope.$index)">删除</el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- </el-form-item>
|
|
|
|
- <el-form-item label="优惠品类:" :hidden="formItem.couponType ===1 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
|
|
+ <template v-if="formItem.productType === '2'&& formItem.couponType === 0">
|
|
|
|
+ <el-form-item label="商品信息" :prop="`formList.${index}.associateList`" :rules="rules.associateList">
|
|
|
|
+ <el-button type="primary" icon="el-icon-sort" size="mini" :disabled="disabled3(formItem.associateList)" @click="handleOnInputBlur(formItem,index)">一键排序</el-button>
|
|
|
|
+ <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleGoodDialogVisible(index)">添加商品</el-button>
|
|
|
|
+ <el-checkbox-group v-show="false" v-model="formItem.associateList" />
|
|
|
|
+ <el-table v-show="formItem.associateList && formItem.associateList.length>0" :data="formItem.associateList" border>
|
|
|
|
+ <el-table-column property="mainImage" label="商品图片" align="center" width="80">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ <el-popover
|
|
|
|
+ placement="top-start"
|
|
|
|
+ title=""
|
|
|
|
+ width="180"
|
|
|
|
+ trigger="hover"
|
|
|
|
+ >
|
|
|
|
+ <img :src="row.mainImage" alt="" style="width:150px;height:150px;">
|
|
|
|
+ <img slot="reference" :src="row.mainImage" alt="" style="width:30px;height:30px;">
|
|
|
|
+ </el-popover>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column property="name" label="商品名称" align="center" />
|
|
|
|
+ <el-table-column property="shopName" label="供应商" align="center" />
|
|
|
|
+ <el-table-column label="网站状态" align="center" width="80">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-switch
|
|
|
|
+ v-model="scope.row.pcStatus"
|
|
|
|
+ active-color="#1890ff"
|
|
|
|
+ inactive-color="#DCDFE6"
|
|
|
|
+ active-value="1"
|
|
|
|
+ inactive-value="0"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="小程序状态" align="center" width="100">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-switch
|
|
|
|
+ v-model="scope.row.appletsStatus"
|
|
|
|
+ active-color="#1890ff"
|
|
|
|
+ inactive-color="#DCDFE6"
|
|
|
|
+ active-value="1"
|
|
|
|
+ inactive-value="0"
|
|
|
|
+ />
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="排序" align="center" width="100">
|
|
|
|
+ <template slot-scope="{row}">
|
|
|
|
+ <el-input v-model="row.sort" maxlength="4" minlength="1" />
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-button type="text" @click="handleDeletePros(formItem,scope.$index)">删除</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </template>
|
|
|
|
+ <el-form-item label="优惠品类:" :hidden="formItem.couponType ===1 ? false : true" :rules="rules.categoryType">
|
|
<el-radio-group v-model="formItem.categoryType">
|
|
<el-radio-group v-model="formItem.categoryType">
|
|
<el-radio :label="'1'">产品</el-radio>
|
|
<el-radio :label="'1'">产品</el-radio>
|
|
<el-radio :label="'2'">仪器</el-radio>
|
|
<el-radio :label="'2'">仪器</el-radio>
|
|
@@ -183,6 +197,12 @@ export default {
|
|
dialogShopVisible: false,
|
|
dialogShopVisible: false,
|
|
dialogGoodVisible: false,
|
|
dialogGoodVisible: false,
|
|
rules: {
|
|
rules: {
|
|
|
|
+ couponType: [{ required: true, message: '请选择优惠券类型', trigger: 'blur' }],
|
|
|
|
+ shopId: [{ required: true, message: '请选择供应商', trigger: 'blur' }],
|
|
|
|
+ productType: [{ required: true, message: '请选择优惠商品', trigger: 'blur' }],
|
|
|
|
+ shopData: [{ required: true, type: 'array', message: '请添加一个供应商', trigger: ['change'] }],
|
|
|
|
+ associateList: [{ required: true, type: 'array', message: '请至少添加一个商品', trigger: ['change'] }],
|
|
|
|
+ categoryType: [{ required: true, message: '请选择优惠品类', trigger: 'blur' }],
|
|
couponAmount: [{ required: true, message: '优惠券金额不能为空', trigger: 'blur' }],
|
|
couponAmount: [{ required: true, message: '优惠券金额不能为空', trigger: 'blur' }],
|
|
touchPrice: [{ required: true, message: '优惠条件不能为空', trigger: 'blur' }]
|
|
touchPrice: [{ required: true, message: '优惠条件不能为空', trigger: 'blur' }]
|
|
},
|
|
},
|
|
@@ -216,21 +236,19 @@ export default {
|
|
const res = await svipCoupon({ id: id, configure: configure })
|
|
const res = await svipCoupon({ id: id, configure: configure })
|
|
const data = res.data.svipcouponForm
|
|
const data = res.data.svipcouponForm
|
|
this.formParams = { ...this.formParams, ...data }
|
|
this.formParams = { ...this.formParams, ...data }
|
|
- this.form.formList = data.coupons
|
|
|
|
- if (type === 'add') {
|
|
|
|
- if (data.coupons.length > 0) {
|
|
|
|
- this.delFlag = true
|
|
|
|
- this.form.formList = data.coupons.map((el) => {
|
|
|
|
- el.shopData = []
|
|
|
|
- if (el.shop) {
|
|
|
|
- el.shopData.push(el.shop)
|
|
|
|
- }
|
|
|
|
- return el
|
|
|
|
- })
|
|
|
|
- } else {
|
|
|
|
- for (let i = 0; i <= 2; i++) {
|
|
|
|
- this.form.formList.push(defaultForm())
|
|
|
|
|
|
+ if (data.coupons.length > 0) {
|
|
|
|
+ this.delFlag = true
|
|
|
|
+ this.form.formList = data.coupons.map((el) => {
|
|
|
|
+ el.shopData = []
|
|
|
|
+ if (el.shop) {
|
|
|
|
+ el.shopData.push(el.shop)
|
|
}
|
|
}
|
|
|
|
+ return el
|
|
|
|
+ })
|
|
|
|
+ console.log('formList', this.form.formList)
|
|
|
|
+ } else {
|
|
|
|
+ for (let i = 0; i <= 2; i++) {
|
|
|
|
+ this.form.formList.push(defaultForm())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -287,7 +305,7 @@ export default {
|
|
if (this.editType === 'add') {
|
|
if (this.editType === 'add') {
|
|
this.formParams.configure = 1
|
|
this.formParams.configure = 1
|
|
} else {
|
|
} else {
|
|
- this.formParams.configure = 1
|
|
|
|
|
|
+ this.formParams.configure = 0
|
|
}
|
|
}
|
|
this.saveVipCoupon(this.formParams)
|
|
this.saveVipCoupon(this.formParams)
|
|
})
|
|
})
|