|
@@ -22,97 +22,109 @@
|
|
<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;">
|
|
- <el-radio-group v-model="formItem.radio">
|
|
|
|
|
|
+ <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.radio === 3 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
- <el-button type="primary" :hidden="!hiddenItem" autofocussize="mini" size="mini" icon="el-icon-plus" @click="handleShopDialogVisible(index)">选择供应商</el-button>
|
|
|
|
- <el-table :data="formItem.shopData" border :hidden="hiddenItem" width="1000">
|
|
|
|
- <el-table-column prop="name" label="供应商名称" align="center" width="300" />
|
|
|
|
- <el-table-column prop="sname" label="供应商简称" align="center" width="200" />
|
|
|
|
- <el-table-column prop="linkMan" label="联系人" align="center" width="100" />
|
|
|
|
- <el-table-column prop="contractMobile" label="手机号" align="center" width="150">
|
|
|
|
- <template slot-scope="{ row }">
|
|
|
|
- {{ row.contractMobile ? row.contractMobile : '---' }}
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column label="操作" align="center">
|
|
|
|
- <el-button type="text" @click="deleteShop(index)">删除</el-button>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
|
|
+ <el-form-item label="供应商" :hidden="formItem.couponType === 3 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
+ <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>
|
|
|
|
+ </template>
|
|
|
|
+ <template v-else>
|
|
|
|
+ <el-table :data="formItem.shopData" border width="1000">
|
|
|
|
+ <el-table-column prop="name" label="供应商名称" align="center" width="300" />
|
|
|
|
+ <el-table-column prop="sname" label="供应商简称" align="center" width="200" />
|
|
|
|
+ <el-table-column prop="linkMan" label="联系人" align="center" width="100" />
|
|
|
|
+ <el-table-column prop="contractMobile" label="手机号" align="center" width="150">
|
|
|
|
+ <template slot-scope="{ row }">
|
|
|
|
+ {{ row.contractMobile ? row.contractMobile : '---' }}
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="操作" align="center">
|
|
|
|
+ <el-button type="text" @click="deleteShop(index)">删除</el-button>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </el-table>
|
|
|
|
+ </template>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="优惠券金额:" :prop="`formList.${index}.couponAmount`" :rules="rules.couponAmount">
|
|
<el-form-item label="优惠券金额:" :prop="`formList.${index}.couponAmount`" :rules="rules.couponAmount">
|
|
<el-input v-model="formItem.couponAmount" style="width: 150px" size="mini" />
|
|
<el-input v-model="formItem.couponAmount" style="width: 150px" size="mini" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="优惠条件:" :prop="`formList.${index}.touchPrice`" :rules="rules.touchPrice">
|
|
<el-form-item label="优惠条件:" :prop="`formList.${index}.touchPrice`" :rules="rules.touchPrice">
|
|
- <el-input v-model="formItem.touchPrice" style="width: 200px" size="mini">
|
|
|
|
|
|
+ <el-input v-model="formItem.touchPrice" style="width: 220px" size="mini">
|
|
<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.radio === 0 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
|
|
+ <el-form-item label="优惠商品:" :hidden="formItem.couponType === 0 ? false : true" style="margin-bottom: 10px;">
|
|
<el-radio-group v-model="formItem.productType">
|
|
<el-radio-group v-model="formItem.productType">
|
|
- <el-radio :label="1">全商城商品</el-radio>
|
|
|
|
- <el-radio :label="2">指定商品</el-radio>
|
|
|
|
|
|
+ <el-radio :label="'1'">全商城商品</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.radio === 0 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
- <el-button type="primary" icon="el-icon-sort" size="mini" @click="handleOnInputBlur(formItem,index)">一键排序</el-button>
|
|
|
|
- <el-button type="primary" icon="el-icon-plus" size="mini" @click="dialogGoodVisible = true">添加商品</el-button>
|
|
|
|
- <el-form-item :hidden="hiddenProduct">
|
|
|
|
- <el-table :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" width="150" />
|
|
|
|
- <el-table-column property="sort" label="网站状态" align="center" width="80">
|
|
|
|
- <template slot-scope="{row}">
|
|
|
|
- <el-switch v-model="row.pcStatus" :active-value="1" :inactive-value="0" active-color="#1890ff" inactive-color="#DCDFE6" @change="handlePcStatusChange(row)" />
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column property="pcStatus" label="小程序状态" align="center" width="80">
|
|
|
|
- <template slot-scope="{row}">
|
|
|
|
- <el-switch v-model="row.appletsStatus" :active-value="1" :inactive-value="0" active-color="#1890ff" inactive-color="#DCDFE6" @change="handleAppStatusChange(row)" />
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- <el-table-column property="appletsStatus" 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 property="addTime" label="添加时间" align="center" width="100" />
|
|
|
|
- <el-table-column label="操作" align="center">
|
|
|
|
- <template>
|
|
|
|
- <el-button type="text">删除</el-button>
|
|
|
|
- </template>
|
|
|
|
- </el-table-column>
|
|
|
|
- </el-table>
|
|
|
|
- </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>
|
|
- <el-form-item label="优惠品类:" :hidden="formItem.radio === 1 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
- <template>
|
|
|
|
- <el-radio v-model="formItem.categoryType" label="1">产品</el-radio>
|
|
|
|
- <el-radio v-model="formItem.categoryType" label="2">仪器</el-radio>
|
|
|
|
- </template>
|
|
|
|
|
|
+ <el-form-item label="优惠品类:" :hidden="formItem.couponType ===1 ? false : true" style="margin-bottom: 10px;">
|
|
|
|
+ <el-radio-group v-model="formItem.categoryType">
|
|
|
|
+ <el-radio :label="'1'">产品</el-radio>
|
|
|
|
+ <el-radio :label="'2'">仪器</el-radio>
|
|
|
|
+ </el-radio-group>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-button class="delete_label" :disabled="disabled1" icon="el-icon-delete" size="mini" type="danger" @click="handleDelete(formItem,index)">删除</el-button>
|
|
<el-button class="delete_label" :disabled="disabled1" icon="el-icon-delete" size="mini" type="danger" @click="handleDelete(formItem,index)">删除</el-button>
|
|
</div>
|
|
</div>
|
|
</el-form>
|
|
</el-form>
|
|
<div class="el-dialog__footer">
|
|
<div class="el-dialog__footer">
|
|
- <el-button @click="goBack">返回</el-button>
|
|
|
|
<el-button type="primary" @click="onSubmit('couponFrom')">保存</el-button>
|
|
<el-button type="primary" @click="onSubmit('couponFrom')">保存</el-button>
|
|
</div>
|
|
</div>
|
|
<!-- 供应商弹框 -->
|
|
<!-- 供应商弹框 -->
|
|
@@ -124,35 +136,40 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-import { svipCoupon, saveVipCoupon } from '@/api/member/member'
|
|
|
|
|
|
+import { svipCoupon, saveVipCoupon, delCoupon } from '@/api/member/member'
|
|
import goodDialog from './components/good-dialog'
|
|
import goodDialog from './components/good-dialog'
|
|
import shopDialog from './components/shop-dialog'
|
|
import shopDialog from './components/shop-dialog'
|
|
const defaultForm = () => {
|
|
const defaultForm = () => {
|
|
return {
|
|
return {
|
|
- shop: {
|
|
|
|
- shopId: 0
|
|
|
|
- }, // 供应商信息
|
|
|
|
|
|
+ shopId: 0,
|
|
shopData: [],
|
|
shopData: [],
|
|
- radio: 0,
|
|
|
|
|
|
+ couponType: 0,
|
|
couponAmount: '',
|
|
couponAmount: '',
|
|
touchPrice: '',
|
|
touchPrice: '',
|
|
- productType: 1,
|
|
|
|
- categoryType: 1,
|
|
|
|
|
|
+ productType: '1',
|
|
|
|
+ categoryType: '1',
|
|
associateList: []// 指定商品信息
|
|
associateList: []// 指定商品信息
|
|
}
|
|
}
|
|
}
|
|
}
|
|
export default {
|
|
export default {
|
|
- name: 'Edit',
|
|
|
|
|
|
+ name: 'MemberEdit',
|
|
components: { goodDialog, shopDialog },
|
|
components: { goodDialog, shopDialog },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
form: {
|
|
form: {
|
|
formList: []
|
|
formList: []
|
|
},
|
|
},
|
|
|
|
+ formParams: {
|
|
|
|
+ id: '',
|
|
|
|
+ month: '',
|
|
|
|
+ endMonth: '',
|
|
|
|
+ status: '',
|
|
|
|
+ configure: 1, // 专属优惠券配置 1是、0否
|
|
|
|
+ coupons: []
|
|
|
|
+ },
|
|
doctorId: '',
|
|
doctorId: '',
|
|
editType: 'add',
|
|
editType: 'add',
|
|
time: '',
|
|
time: '',
|
|
- hiddenItem: true,
|
|
|
|
dialogTableVisible: false,
|
|
dialogTableVisible: false,
|
|
shopTotal: 0,
|
|
shopTotal: 0,
|
|
rows: [],
|
|
rows: [],
|
|
@@ -160,7 +177,6 @@ export default {
|
|
shopTableData: [],
|
|
shopTableData: [],
|
|
// 商品列表
|
|
// 商品列表
|
|
dialogProductVisible: false,
|
|
dialogProductVisible: false,
|
|
- hiddenProduct: true,
|
|
|
|
productTableData: [],
|
|
productTableData: [],
|
|
productTotal: 0,
|
|
productTotal: 0,
|
|
addIndex: 0,
|
|
addIndex: 0,
|
|
@@ -169,7 +185,8 @@ export default {
|
|
rules: {
|
|
rules: {
|
|
couponAmount: [{ required: true, message: '优惠券金额不能为空', trigger: 'blur' }],
|
|
couponAmount: [{ required: true, message: '优惠券金额不能为空', trigger: 'blur' }],
|
|
touchPrice: [{ required: true, message: '优惠条件不能为空', trigger: 'blur' }]
|
|
touchPrice: [{ required: true, message: '优惠条件不能为空', trigger: 'blur' }]
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ delFlag: false
|
|
}
|
|
}
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -181,72 +198,123 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
created() {
|
|
- this.doctorId = parseInt(this.$route.query.id)
|
|
|
|
this.editType = this.$route.query.type || 'edit'
|
|
this.editType = this.$route.query.type || 'edit'
|
|
console.log('editType', this.editType)
|
|
console.log('editType', this.editType)
|
|
this.initForm(this.editType)
|
|
this.initForm(this.editType)
|
|
- console.log(this.editType)
|
|
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
initForm(type) {
|
|
initForm(type) {
|
|
if (type === 'add') {
|
|
if (type === 'add') {
|
|
- // for (let i = 0; i < 3; i++) {
|
|
|
|
- // this.form.formList.push(defaultForm())
|
|
|
|
- // }
|
|
|
|
- this.svipCoupon(1, 0)
|
|
|
|
|
|
+ console.log('add')
|
|
|
|
+ this.svipCoupon(type, 1, 0)
|
|
} else {
|
|
} else {
|
|
- this.svipCoupon(0, this.doctorId)
|
|
|
|
console.log('edit')
|
|
console.log('edit')
|
|
|
|
+ this.svipCoupon(type, 0, this.$route.query.id)
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- async svipCoupon(configure, id) {
|
|
|
|
|
|
+ async svipCoupon(type, configure, id) {
|
|
const res = await svipCoupon({ id: id, configure: configure })
|
|
const res = await svipCoupon({ id: id, configure: configure })
|
|
- console.log('RES', res.data)
|
|
|
|
|
|
+ const data = res.data.svipcouponForm
|
|
|
|
+ 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())
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
},
|
|
},
|
|
handleShopDialogVisible(index) {
|
|
handleShopDialogVisible(index) {
|
|
// 显示选择供应商弹窗
|
|
// 显示选择供应商弹窗
|
|
this.addIndex = index
|
|
this.addIndex = index
|
|
this.dialogShopVisible = true
|
|
this.dialogShopVisible = true
|
|
},
|
|
},
|
|
|
|
+ handleGoodDialogVisible(index) {
|
|
|
|
+ // 显示选择商品弹窗
|
|
|
|
+ this.addIndex = index
|
|
|
|
+ this.dialogGoodVisible = true
|
|
|
|
+ },
|
|
// 清除供应商
|
|
// 清除供应商
|
|
deleteShop(index) {
|
|
deleteShop(index) {
|
|
- this.hiddenItem = true
|
|
|
|
this.form.formList[index].shopData = []
|
|
this.form.formList[index].shopData = []
|
|
},
|
|
},
|
|
handleShopConfirm(data) {
|
|
handleShopConfirm(data) {
|
|
// 确认选择供应商
|
|
// 确认选择供应商
|
|
- console.log('addIndex', this.addIndex)
|
|
|
|
- console.log('data', data)
|
|
|
|
|
|
+ this.form.formList[this.addIndex].shopId = data.shopId
|
|
this.form.formList[this.addIndex].shopData.push(data)
|
|
this.form.formList[this.addIndex].shopData.push(data)
|
|
- console.log('shopData', this.form.formList[this.addIndex].shopData)
|
|
|
|
- this.hiddenItem = false
|
|
|
|
|
|
+ console.log('formList', this.form.formList[this.addIndex])
|
|
this.handleShopCancel()
|
|
this.handleShopCancel()
|
|
},
|
|
},
|
|
handleGoodConfirm(data) {
|
|
handleGoodConfirm(data) {
|
|
// 确认选择商品
|
|
// 确认选择商品
|
|
console.log('data', data)
|
|
console.log('data', data)
|
|
console.log('addIndex', this.addIndex)
|
|
console.log('addIndex', this.addIndex)
|
|
- this.form.formList[this.addIndex].associateList.push(data)
|
|
|
|
- console.log('addIndex', this.form.formList[this.addIndex])
|
|
|
|
- console.log('formList', this.form.formList)
|
|
|
|
- this.hiddenProduct = false
|
|
|
|
|
|
+ const from = this.form.formList[this.addIndex]
|
|
|
|
+ from.associateList.push(data)
|
|
|
|
+ console.log('from', this.form.formList)
|
|
this.handleGoodCancel()
|
|
this.handleGoodCancel()
|
|
},
|
|
},
|
|
|
|
+ handleDeletePros(formItem, index) {
|
|
|
|
+ // 删除商品
|
|
|
|
+ this.$confirm('确定删除吗?', '提示', {
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).then(() => {
|
|
|
|
+ formItem.associateList.splice(index, 1)
|
|
|
|
+ })
|
|
|
|
+ },
|
|
onSubmit(formName) {
|
|
onSubmit(formName) {
|
|
this.$refs[formName].validate(valid => {
|
|
this.$refs[formName].validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ this.handleFormParams()
|
|
this.$confirm('是否提交数据', '提示', {
|
|
this.$confirm('是否提交数据', '提示', {
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
type: 'warning'
|
|
}).then(() => {
|
|
}).then(() => {
|
|
- this.saveVipCoupon(this.form.formList)
|
|
|
|
|
|
+ console.log('formParams', this.formParams)
|
|
|
|
+ if (this.editType === 'add') {
|
|
|
|
+ this.formParams.configure = 1
|
|
|
|
+ } else {
|
|
|
|
+ this.formParams.configure = 1
|
|
|
|
+ }
|
|
|
|
+ this.saveVipCoupon(this.formParams)
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ handleFormParams() {
|
|
|
|
+ // 处理参数
|
|
|
|
+ this.formParams.coupons = this.form.formList.map((el) => {
|
|
|
|
+ if (el.associateList && el.associateList.length > 0) {
|
|
|
|
+ el.associateList = el.associateList.map((pro) => {
|
|
|
|
+ return {
|
|
|
|
+ sort: pro.sort,
|
|
|
|
+ pcStatus: pro.pcStatus,
|
|
|
|
+ appletsStatus: pro.appletsStatus,
|
|
|
|
+ name: pro.name,
|
|
|
|
+ shopName: pro.shopName,
|
|
|
|
+ mainImage: pro.mainImage,
|
|
|
|
+ productId: pro.productId
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ return el
|
|
|
|
+ })
|
|
|
|
+ },
|
|
async saveVipCoupon(params) {
|
|
async saveVipCoupon(params) {
|
|
// 保存超级会员优惠券
|
|
// 保存超级会员优惠券
|
|
await saveVipCoupon(params)
|
|
await saveVipCoupon(params)
|
|
@@ -271,35 +339,50 @@ export default {
|
|
},
|
|
},
|
|
handleDelete(item, index) {
|
|
handleDelete(item, index) {
|
|
// 删除单挑优惠券
|
|
// 删除单挑优惠券
|
|
- this.formList.splice(index, 1)
|
|
|
|
|
|
+ if (this.delFlag) {
|
|
|
|
+ this.delCoupon(item.id, index)
|
|
|
|
+ } else {
|
|
|
|
+ this.form.formList.splice(index, 1)
|
|
|
|
+ }
|
|
},
|
|
},
|
|
- handleOnInputBlur(formItem, row, index) {
|
|
|
|
|
|
+ async delCoupon(id, index) {
|
|
|
|
+ // 保存超级会员优惠券
|
|
|
|
+ await delCoupon(id)
|
|
|
|
+ this.form.formList.splice(index, 1)
|
|
|
|
+ },
|
|
|
|
+ handleOnInputBlur(formItem) {
|
|
// 商品排序
|
|
// 商品排序
|
|
- console.log('formItem', formItem)
|
|
|
|
- console.log('row', row)
|
|
|
|
- console.log('index', index)
|
|
|
|
|
|
+ formItem.associateList.sort(this.sortByEnent('sort'))
|
|
|
|
+ },
|
|
|
|
+ sortByEnent(i) {
|
|
|
|
+ // 排序
|
|
|
|
+ return function(a, b) {
|
|
|
|
+ return a[i] - b[i] // a[i] - b[i]为正序,倒叙为 b[i] - a[i]
|
|
|
|
+ }
|
|
},
|
|
},
|
|
handlePcStatusChange(row) {
|
|
handlePcStatusChange(row) {
|
|
// PC状态开启关闭
|
|
// PC状态开启关闭
|
|
- if (row.pcStatus === 0) {
|
|
|
|
- row.pcStatus = 1
|
|
|
|
|
|
+ console.log('row', row)
|
|
|
|
+ if (row.pcStatus === '0') {
|
|
|
|
+ row.pcStatus = '1'
|
|
} else {
|
|
} else {
|
|
- row.pcStatus = 0
|
|
|
|
|
|
+ row.pcStatus = '0'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
handleAppStatusChange(row) {
|
|
handleAppStatusChange(row) {
|
|
// 小程序状态开启关闭
|
|
// 小程序状态开启关闭
|
|
- if (row.appletsStatus === 0) {
|
|
|
|
- row.appletsStatus = 1
|
|
|
|
|
|
+ if (row.appletsStatus === '0') {
|
|
|
|
+ row.appletsStatus = '1'
|
|
} else {
|
|
} else {
|
|
- row.appletsStatus = 0
|
|
|
|
|
|
+ row.appletsStatus = '0'
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- goBack() {
|
|
|
|
- // 调用全局挂载的方法,关闭当前标签页
|
|
|
|
- // this.$store.dispatch('tagsView/delView', this.$route)
|
|
|
|
- // 返回上一步路由,返回上一个标签页
|
|
|
|
- this.$router.go(-1)
|
|
|
|
|
|
+ disabled3(array) {
|
|
|
|
+ if (array && array.length >= 2) {
|
|
|
|
+ return false
|
|
|
|
+ } else {
|
|
|
|
+ return true
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|