|
@@ -1,6 +1,12 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <div class="filter-container">
|
|
|
+ <div v-if="editType === 'add'" class="filter-container">
|
|
|
+ <div class="filter-control">
|
|
|
+ <span style="color: red;">在本页面,对每三个月给超级会员自动发放的优惠券进行配置,配置完成后下一阶段才生效(最少配置1个,最多5个)。</span>
|
|
|
+ <el-button type="primary">新增优惠券</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div v-else class="filter-container">
|
|
|
<div class="filter-control">
|
|
|
<span>优惠月份:</span>
|
|
|
<el-date-picker
|
|
@@ -10,56 +16,51 @@
|
|
|
start-placeholder="开始月份"
|
|
|
end-placeholder="结束月份"
|
|
|
/>
|
|
|
- </div>
|
|
|
- <div class="filter-control">
|
|
|
- <el-button type="primary">新增优惠券</el-button>
|
|
|
+ <el-button type="primary" style="margin-left: 30px;">新增优惠券</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <el-card class="box-card">
|
|
|
- <el-form :model="form" label-width="100px">
|
|
|
- <el-form-item label="优惠券:">
|
|
|
- <el-radio-group v-model="form.radio">
|
|
|
+ <el-card v-for="(item,index) in formList" :key="item" class="box-card" style="position: relative;">
|
|
|
+ <el-form :model="item" label-width="100px">
|
|
|
+ <el-form-item label="优惠券:" style="margin-bottom: 10px;">
|
|
|
+ <el-radio-group v-model="item.radio">
|
|
|
<el-radio :label="0">活动券</el-radio>
|
|
|
<el-radio :label="1">品类券</el-radio>
|
|
|
<el-radio :label="3">店铺券</el-radio>
|
|
|
</el-radio-group>
|
|
|
- <el-button class="delete_label" type="primary" size="mini">删除</el-button>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="供应商" :hidden="form.radio === 3 ? false : true">
|
|
|
- <el-button type="text" :hidden="!hiddenItem" @click="findShopList()">选择供应商</el-button>
|
|
|
- <el-table :data="shopData" border :hidden="hiddenItem">
|
|
|
- <el-table-column prop="name" label="供应商名称" />
|
|
|
- <el-table-column prop="sname" label="供应商简称" width="150px" />
|
|
|
- <el-table-column prop="linkMan" label="联系人" />
|
|
|
- <el-table-column prop="contractMobile" label="手机号" width="120px">
|
|
|
+ <el-form-item label="供应商" :hidden="item.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="item.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="150" />
|
|
|
+ <el-table-column prop="linkMan" label="联系人" align="center" width="100" />
|
|
|
+ <el-table-column prop="contractMobile" label="手机号" align="center" width="120">
|
|
|
<template slot-scope="{ row }">
|
|
|
{{ row.contractMobile ? row.contractMobile : '---' }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作">
|
|
|
+ <el-table-column label="操作" align="center" width="100">
|
|
|
<template slot-scope="{ row }">
|
|
|
<el-button type="text" @click="deleteShop(row)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="优惠券金额:">
|
|
|
- <el-input style="width: 150px" size="mini" />
|
|
|
+ <el-form-item label="优惠券金额:" style="margin-bottom: 10px;">
|
|
|
+ <el-input v-model="item.couponAmount" style="width: 150px" size="mini" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="优惠条件:">
|
|
|
- <span>订单商品总额满</span><el-input style="width: 150px" size="mini" />
|
|
|
+ <el-form-item label="优惠条件:" style="margin-bottom: 10px;">
|
|
|
+ <span>订单商品总额满:</span>
|
|
|
+ <el-input v-model="item.touchPrice" style="width: 150px" size="mini" />
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="优惠商品:" :hidden="form.radio === 0 ? false : true">
|
|
|
- <el-radio-group v-model="form.productType">
|
|
|
+ <el-form-item label="优惠商品:" :hidden="form.radio === 0 ? false : true" style="margin-bottom: 10px;">
|
|
|
+ <el-radio-group v-model="item.productType">
|
|
|
<el-radio :label="1">全商城商品</el-radio>
|
|
|
<el-radio :label="2">指定商品</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
- <el-form-item :hidden="form.productType === 2 && form.radio === 0 ? false : true">
|
|
|
- <template>
|
|
|
- <el-button @click="deleteProduct()">删除</el-button>
|
|
|
- <el-button type="primary" @click="productList()">添加</el-button>
|
|
|
- </template>
|
|
|
+ <el-form-item :hidden="item.productType === 2 && item.radio === 0 ? false : true" style="margin-bottom: 10px;">
|
|
|
+ <el-button type="primary" size="mini" @click="productList()">添加</el-button>
|
|
|
<el-form-item :hidden="hiddenProduct">
|
|
|
<el-table :data="productTable" border @select="handleSelect">
|
|
|
<el-table-column type="selection" width="55" />
|
|
@@ -90,149 +91,46 @@
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="优惠品类:" :hidden="form.radio === 1 ? false : true">
|
|
|
+ <el-form-item label="优惠品类:" :hidden="item.radio === 1 ? false : true" style="margin-bottom: 10px;">
|
|
|
<template>
|
|
|
- <el-radio v-model="form.categoryType" label="">产品</el-radio>
|
|
|
- <el-radio v-model="form.categoryType" label="2">仪器</el-radio>
|
|
|
+ <el-radio v-model="item.categoryType" label="1">产品</el-radio>
|
|
|
+ <el-radio v-model="item.categoryType" label="2">仪器</el-radio>
|
|
|
</template>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
+ <el-button class="delete_label" icon="el-icon-delete" size="mini" type="danger">删除</el-button>
|
|
|
</el-card>
|
|
|
<!-- 供应商弹框 -->
|
|
|
- <el-dialog title="选择供应商" :visible.sync="dialogTableVisible" width="50%">
|
|
|
- <div class="filter-container">
|
|
|
- <div class="filter-control">
|
|
|
- <span>供应商Id:</span>
|
|
|
- <el-input
|
|
|
- v-model="shopForm.shopId"
|
|
|
- placeholder="供应商Id"
|
|
|
- clearable
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="filter-control">
|
|
|
- <span>供应商名称:</span>
|
|
|
- <el-input
|
|
|
- v-model="shopForm.name"
|
|
|
- placeholder="供应商名称"
|
|
|
- clearable
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="filter-control">
|
|
|
- <span>供应商简称:</span>
|
|
|
- <el-input
|
|
|
- v-model="shopForm.sname"
|
|
|
- placeholder="供应商简称"
|
|
|
- clearable
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="filter-control">
|
|
|
- <el-button type="primary" @click="findShopList()">搜索</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <el-table ref="table" :data="shopTableData" height="350px" @select="handleSelect">
|
|
|
- <el-table-column type="selection" width="55" />
|
|
|
- <el-table-column property="shopId" label="供应商Id" width="150" />
|
|
|
- <el-table-column property="name" label="供应商名称" width="150" />
|
|
|
- <el-table-column property="sname" label="供应商简称" width="200">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- {{ row.sname ? row.sname : '---' }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column property="linkMan" label="联系人" />
|
|
|
- <el-table-column property="contractMobile" label="手机号">
|
|
|
- <template slot-scope="{ row }">
|
|
|
- {{ row.contractMobile ? row.contractMobile : '---' }}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <div slot="footer">
|
|
|
- <el-button type="primary" @click="pushShop()">确定</el-button>
|
|
|
- <el-button type="primary" @click="dialogTableVisible = false">取消</el-button>
|
|
|
- </div>
|
|
|
- <!-- 页码 -->
|
|
|
- <pagination
|
|
|
- :total="shopTotal"
|
|
|
- :page-sizes="[20, 30, 50, 100]"
|
|
|
- :page-size="20"
|
|
|
- :page.sync="shopForm.pageNum"
|
|
|
- :limit.sync="shopForm.pageSize"
|
|
|
- @pagination="findShopList"
|
|
|
- />
|
|
|
- </el-dialog>
|
|
|
+ <shop-dialog v-if="dialogShopVisible" ref="shopDialog" @cancel="handleShopCancel" @confirm="handleShopConfirm" />
|
|
|
<!-- 商品弹框 -->
|
|
|
- <el-dialog title="选择商品" :visible.sync="dialogProductVisible" width="50%">
|
|
|
- <div class="filter-container">
|
|
|
- <div class="filter-control">
|
|
|
- <span>商品Id:</span>
|
|
|
- <el-input
|
|
|
- v-model="productForm.productId"
|
|
|
- placeholder="商品Id"
|
|
|
- clearable
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="filter-control">
|
|
|
- <span>商品名称:</span>
|
|
|
- <el-input
|
|
|
- v-model="productForm.name"
|
|
|
- placeholder="商品名称"
|
|
|
- clearable
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="filter-control">
|
|
|
- <span>供应商:</span>
|
|
|
- <el-input
|
|
|
- v-model="productForm.shopName"
|
|
|
- placeholder="供应商"
|
|
|
- clearable
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="filter-control">
|
|
|
- <el-button type="primary" @click="productList()">搜索</el-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <el-table ref="table" :data="productTableData" height="350px" @select="handleSelect">
|
|
|
- <el-table-column type="selection" width="55" />
|
|
|
- <el-table-column property="productId" label="商品Id" width="150" />
|
|
|
- <el-table-column property="mainImage" label="商品图片" width="150">
|
|
|
- <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="商品名称" width="200" />
|
|
|
- <el-table-column property="shopName" label="供应商" />
|
|
|
- </el-table>
|
|
|
- <div slot="footer">
|
|
|
- <el-button type="primary" @click="pushProduct()">确定</el-button>
|
|
|
- <el-button type="primary" @click="dialogTableVisible = false">取消</el-button>
|
|
|
- </div>
|
|
|
- <!-- 页码 -->
|
|
|
- <pagination
|
|
|
- :total="productTotal"
|
|
|
- :page-sizes="[20, 30, 50, 100]"
|
|
|
- :page-size="20"
|
|
|
- :page.sync="productForm.pageNum"
|
|
|
- :limit.sync="productForm.pageSize"
|
|
|
- @pagination="productList"
|
|
|
- />
|
|
|
- </el-dialog>
|
|
|
+ <good-dialog v-if="dialogGoodVisible" ref="goodDialog" @cancel="handleGoodCancel" @confirm="handleGoodConfirm" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { fetchFindShop, fetchProductList } from '@/api/member/member'
|
|
|
|
|
|
+import goodDialog from './components/good-dialog'
|
|
|
+import shopDialog from './components/shop-dialog'
|
|
|
+const defaultForm = {
|
|
|
+ shop: {
|
|
|
+ shopId: 0
|
|
|
+ }, // 供应商信息
|
|
|
+ shopData: [],
|
|
|
+ radio: 0,
|
|
|
+ couponAmount: '',
|
|
|
+ touchPrice: '',
|
|
|
+ productType: 1,
|
|
|
+ categoryType: 1,
|
|
|
+ associateList: []// 指定商品信息
|
|
|
+}
|
|
|
export default {
|
|
|
- name: 'MemberDetail',
|
|
|
+ name: 'Edit',
|
|
|
+ components: { goodDialog, shopDialog },
|
|
|
data() {
|
|
|
return {
|
|
|
+ formList: [],
|
|
|
+ doctorId: '',
|
|
|
+ editType: 'add',
|
|
|
time: '',
|
|
|
form: {
|
|
|
radio: 0,
|
|
@@ -242,42 +140,41 @@ export default {
|
|
|
shopData: [],
|
|
|
hiddenItem: true,
|
|
|
dialogTableVisible: false,
|
|
|
- shopForm: {
|
|
|
- shopId: '', // 供应商id
|
|
|
- name: '', // 供应商名称
|
|
|
- sname: '', // 供应商简称
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 20
|
|
|
- },
|
|
|
shopTotal: 0,
|
|
|
rows: [],
|
|
|
// 供应商列表
|
|
|
shopTableData: [],
|
|
|
// 商品列表
|
|
|
dialogProductVisible: false,
|
|
|
- productForm: {
|
|
|
- productId: '', // 商品id
|
|
|
- name: '', // 商品名称
|
|
|
- shopName: '', // 供应商名称
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 20
|
|
|
- },
|
|
|
hiddenProduct: true,
|
|
|
productTable: [],
|
|
|
productTableData: [],
|
|
|
- productTotal: 0
|
|
|
+ productTotal: 0,
|
|
|
+ addShopIndex: 0,
|
|
|
+ dialogShopVisible: false,
|
|
|
+ dialogGoodVisible: false
|
|
|
}
|
|
|
},
|
|
|
created() {
|
|
|
-
|
|
|
+ this.doctorId = parseInt(this.$route.query.id)
|
|
|
+ this.editType = this.$route.query.type || 'edit'
|
|
|
+ console.log('editType', this.editType)
|
|
|
+ this.initForm(this.editType)
|
|
|
+ console.log(this.editType)
|
|
|
},
|
|
|
methods: {
|
|
|
- // 获取供应商列表
|
|
|
- async findShopList() {
|
|
|
- this.dialogTableVisible = true
|
|
|
- const res = await fetchFindShop(this.shopForm)
|
|
|
- this.shopTableData = res.data.results
|
|
|
- this.shopTotal = res.data.totalRecord
|
|
|
+ initForm(type) {
|
|
|
+ if (type === 'add') {
|
|
|
+ this.formList.push(defaultForm)
|
|
|
+ console.log('formList', this.formList)
|
|
|
+ } else {
|
|
|
+ console.log('edit')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleShopDialogVisible(index) {
|
|
|
+ // 显示选择供应商弹窗
|
|
|
+ this.addShopIndex = index
|
|
|
+ this.dialogShopVisible = true
|
|
|
},
|
|
|
// 选择供应商
|
|
|
handleSelect(selection, row) {
|
|
@@ -298,13 +195,6 @@ export default {
|
|
|
this.hiddenItem = true
|
|
|
this.shopData = []
|
|
|
},
|
|
|
- // 商品列表
|
|
|
- async productList() {
|
|
|
- this.dialogProductVisible = true
|
|
|
- const res = await fetchProductList(this.productForm)
|
|
|
- this.productTableData = res.data.results
|
|
|
- this.productTotal = res.data.totalRecord
|
|
|
- },
|
|
|
// 添加商品数据
|
|
|
pushProduct() {
|
|
|
this.productTable.push(this.rows)
|
|
@@ -316,6 +206,27 @@ export default {
|
|
|
deleteProduct() {
|
|
|
this.productTable = []
|
|
|
this.hiddenProduct = true
|
|
|
+ },
|
|
|
+ handleShopConfirm(data) {
|
|
|
+ // 确认选择供应商
|
|
|
+ console.log('data', data)
|
|
|
+ this.formList[this.addShopIndex].shopData.push(data)
|
|
|
+ this.hiddenItem = false
|
|
|
+ this.handleShopCancel()
|
|
|
+ },
|
|
|
+ handleGoodConfirm(data) {
|
|
|
+ // 确认选择商品
|
|
|
+ console.log('data', data)
|
|
|
+ },
|
|
|
+ handleShopCancel() {
|
|
|
+ // 取消选择供应商
|
|
|
+ this.dialogShopVisible = false
|
|
|
+ this.$refs.shopDialog.visible = false
|
|
|
+ },
|
|
|
+ handleGoodCancel() {
|
|
|
+ // 取消编辑商品
|
|
|
+ this.dialogGoodVisible = false
|
|
|
+ this.$refs.goodDialog.visible = false
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -323,6 +234,8 @@ export default {
|
|
|
|
|
|
<style>
|
|
|
.delete_label{
|
|
|
- margin-left: 50px;
|
|
|
+ position: absolute;
|
|
|
+ right: 2%;
|
|
|
+ top: 20px;
|
|
|
}
|
|
|
</style>
|