|
@@ -56,6 +56,8 @@
|
|
|
<el-form-item v-if="addData.type === 2" label="使用范围:" prop="useArea">
|
|
|
<el-radio-group v-model="addData.useArea" :disabled="readonly">
|
|
|
<el-radio :label="2">进票门店</el-radio>
|
|
|
+ <el-radio :label="1">指定门店</el-radio>
|
|
|
+ <el-radio :label="0">所有门店</el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
<el-form-item v-else label="使用范围:" prop="useArea">
|
|
@@ -71,7 +73,7 @@
|
|
|
</el-row>
|
|
|
<el-row :gutter="18">
|
|
|
<el-col :span="18" :offset="2">
|
|
|
- <div v-if="addData.useArea === 1" style="padding: 0 20px">
|
|
|
+ <div v-if="addData.useArea === 1 && addData.type === 1" style="padding: 0 20px">
|
|
|
<el-table :data="addData.ticketBoxList" height="300px">
|
|
|
<el-table-column label="盲票ID" prop="boxId" min-width="90" />
|
|
|
<el-table-column label="盲票图片" prop="picUrl" align="center">
|
|
@@ -88,12 +90,12 @@
|
|
|
</el-table-column>
|
|
|
<el-table-column label="盲票类型" prop="type">
|
|
|
<template slot-scope="{row}">
|
|
|
- {{ JSON.parse(row.type).desc }}
|
|
|
+ {{ row.type && JSON.parse(row.type).desc }}
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="盲票状态" prop="status">
|
|
|
<template slot-scope="{row}">
|
|
|
- <el-tag :type="JSON.parse(row.status).value === 'on' ? 'success' : 'info'">{{ JSON.parse(row.status).desc }}</el-tag>
|
|
|
+ <el-tag :type="row.status && JSON.parse(row.status).value === 'on' ? 'success' : 'info'">{{ row.status && JSON.parse(row.status).desc }}</el-tag>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column v-if="!readonly" prop="date" label="操作">
|
|
@@ -105,6 +107,27 @@
|
|
|
<br>
|
|
|
<el-button v-if="!readonly" type="primary" size="small" plain @click="funSelectShow">选择盲票</el-button> <span style="margin-left: 10px">已选盲票({{ addData.ticketBoxList.length }})</span>
|
|
|
</div>
|
|
|
+<!-- =========================================================================-->
|
|
|
+ <div v-if="addData.useArea === 1 && addData.type === 2" style="padding: 0 20px">
|
|
|
+ <el-table :data="channelList" height="300px">
|
|
|
+ <el-table-column label="门店编号" prop="channelId" min-width="90" />
|
|
|
+ <el-table-column label="门店名称" prop="name" />
|
|
|
+ <el-table-column label="手机号码" prop="mobile" />
|
|
|
+ <el-table-column label="上级渠道" prop="parentsName"/>
|
|
|
+ <el-table-column label="认证状态" prop="status">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <el-tag :type="row.certifyStatus && JSON.parse(row.certifyStatus).value === 'y' ? 'success' : 'info'">{{ row.certifyStatus && JSON.parse(row.certifyStatus).desc }}</el-tag>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column v-if="!readonly" prop="date" label="操作">
|
|
|
+ <template slot-scope="{ $index }">
|
|
|
+ <el-button type="text" class="del" @click="channelList.splice($index, 1)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <br>
|
|
|
+ <el-button v-if="!readonly" type="primary" size="small" plain @click="funChannelShow">选择门店</el-button> <span style="margin-left: 10px">已选门店({{ channelList.length }})</span>
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
|
|
@@ -117,11 +140,14 @@
|
|
|
|
|
|
<!-- 弹出层 -->
|
|
|
<SelectTicket :select-show="selectShow" :value="addData.ticketBoxList" :excludeBoxIds="excludeBoxIds" @close="selectShow = false" @selectTicket="selectTicket" v-if="selectShow"/>
|
|
|
+ <!-- 弹出层 -->
|
|
|
+ <ChannelTicket :channel-show="channelShow" :value="channelList" :excludeChannelIds="excludeChannelIds" @close="channelShow = false" @channelTicket="channelTicket" v-if="channelShow"/>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import Upload from '@/components/ImageUpload'
|
|
|
import SelectTicket from './components/selectTicket'
|
|
|
+import ChannelTicket from './components/channelTicket'
|
|
|
import { publicFileGetUrl } from '@/api/common'
|
|
|
import { getCouponDetail, addCoupon } from '@/api/business/coupon'
|
|
|
import { accDiv, accMul } from '@/utils/util'
|
|
@@ -130,13 +156,15 @@ export default {
|
|
|
name: 'CouponAdd',
|
|
|
components: {
|
|
|
Upload,
|
|
|
- SelectTicket
|
|
|
+ SelectTicket,
|
|
|
+ ChannelTicket
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
IMG_URL: publicFileGetUrl,
|
|
|
id: this.$route.query.id,
|
|
|
readonly: this.$route.name === 'CouponQuery',
|
|
|
+ channelList: [],
|
|
|
addData: {
|
|
|
ticketBoxList:[],
|
|
|
useArea: 5,
|
|
@@ -147,7 +175,9 @@ export default {
|
|
|
},
|
|
|
addIng: false,
|
|
|
excludeBoxIds: [],
|
|
|
+ excludeChannelIds: [],
|
|
|
selectShow: false,
|
|
|
+ channelShow: false,
|
|
|
rules: {
|
|
|
title: [{ required: true, message: '请输入券名称', trigger: 'blur' }],
|
|
|
type: [{ required: true, message: '请输入券类型', trigger: 'blur' }],
|
|
@@ -179,7 +209,7 @@ export default {
|
|
|
created() {
|
|
|
if (this.id) {
|
|
|
getCouponDetail(this.id).then(res => {
|
|
|
- const { couponId, title, quantity, discount, channelSharedRate, minOrderAmt, dueDays, description, ticketBoxList } = res.data
|
|
|
+ const { couponId, title, quantity, discount, channelSharedRate, minOrderAmt, dueDays, description, ticketBoxList, channelList } = res.data
|
|
|
this.addData = {
|
|
|
type: JSON.parse(res.data.type).value,
|
|
|
useArea: JSON.parse(res.data.useArea).value,
|
|
@@ -187,6 +217,7 @@ export default {
|
|
|
minOrderAmt: accDiv(minOrderAmt, 100),
|
|
|
couponId, title, quantity, channelSharedRate, dueDays, description, ticketBoxList
|
|
|
}
|
|
|
+ this.channelList = channelList
|
|
|
})
|
|
|
}
|
|
|
},
|
|
@@ -195,9 +226,16 @@ export default {
|
|
|
this.excludeBoxIds = this.addData.ticketBoxList.map(item => { return item.boxId })
|
|
|
this.selectShow = true
|
|
|
},
|
|
|
+ funChannelShow(){
|
|
|
+ this.excludeChannelIds = this.channelList.map(item => { return item.channelId })
|
|
|
+ this.channelShow = true
|
|
|
+ },
|
|
|
selectTicket(select) {
|
|
|
this.addData.ticketBoxList = this.addData.ticketBoxList.concat(select)
|
|
|
},
|
|
|
+ channelTicket(select) {
|
|
|
+ this.channelList = this.channelList.concat(select)
|
|
|
+ },
|
|
|
update() {
|
|
|
if (this.addData.type == 1) {
|
|
|
if(this.addData.useArea !== 0 && this.addData.useArea !== 1 && this.addData.useArea !== 3 && this.addData.useArea !== 4) {
|
|
@@ -208,7 +246,7 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
} else if (this.addData.type == 2) {
|
|
|
- if(this.addData.useArea !== 2) {
|
|
|
+ if(this.addData.useArea !== 2 && this.addData.useArea !== 0 && this.addData.useArea !== 1 ) {
|
|
|
this.$message({
|
|
|
message: '请选择使用范围!',
|
|
|
type: 'warning'
|
|
@@ -219,9 +257,16 @@ export default {
|
|
|
this.$refs.addItem.validate((valid, items) => {
|
|
|
if (valid) {
|
|
|
this.addIng = true
|
|
|
- if(this.addData.useArea === 1) {
|
|
|
+ if(this.addData.useArea === 1 && this.addData.type === 1) {
|
|
|
this.addData.boxIds = this.addData.ticketBoxList.map(item => { return item.boxId }).toString()
|
|
|
}
|
|
|
+ if(this.addData.useArea === 1 && this.addData.type === 2) {
|
|
|
+ let arr = []
|
|
|
+ for (let i = 0; i < this.channelList.length; i++) {
|
|
|
+ arr.push(this.channelList[i].channelId)
|
|
|
+ }
|
|
|
+ this.addData.channelIdList = arr
|
|
|
+ }
|
|
|
const { discount, minOrderAmt, ...rest } = this.addData
|
|
|
addCoupon({...rest, ...{ discount: accMul(discount, 100), minOrderAmt: accMul(minOrderAmt, 100),}}).then(res => {
|
|
|
this.addIng = false
|