修改充值优惠逻辑
This commit is contained in:
parent
afda33bd77
commit
161a27bd01
|
@ -9,18 +9,9 @@
|
||||||
|
|
||||||
<el-table-column fixed prop="payClassifyId" label="编号" width="50">
|
<el-table-column fixed prop="payClassifyId" label="编号" width="50">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column prop="memberImg" label="图片">
|
|
||||||
<template slot-scope="scope">
|
|
||||||
<img :src="scope.row.memberImg" width="60" height="60" />
|
|
||||||
</template>
|
|
||||||
</el-table-column> -->
|
|
||||||
<el-table-column prop="price" label="充值金额">
|
<el-table-column prop="price" label="充值金额">
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="giveNum" label="赠送优惠券数量">
|
<el-table-column prop="money" label="到账金额">
|
||||||
</el-table-column>
|
|
||||||
<!-- <el-table-column prop="sort" label="排序">
|
|
||||||
</el-table-column> -->
|
|
||||||
<el-table-column prop="coupon.couponName" label="赠送优惠券">
|
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" width="180">
|
<el-table-column label="操作" width="180">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
|
@ -40,47 +31,34 @@
|
||||||
</el-pagination>
|
</el-pagination>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog :title="title" :visible.sync="dialogFormVisible" center>
|
<el-dialog :title="title" :visible.sync="dialogFormVisible" center>
|
||||||
<!-- <div style="margin-bottom: 10px;display: flex;">
|
|
||||||
<span style="width: 200px;display: inline-block;text-align: right;">图片:</span>
|
|
||||||
<div style=" width:148px;height:148px;border: 1px dashed #c0ccda;border-radius: 6px;text-align: center;line-height: 148px;">
|
|
||||||
<el-upload
|
|
||||||
class="avatar-uploader"
|
|
||||||
v-model="memberImg"
|
|
||||||
action="https://admin.sjajk.com/sqx_fast/alioss/upload"
|
|
||||||
:show-file-list="false"
|
|
||||||
:on-success="handleAvatarSuccess"
|
|
||||||
>
|
|
||||||
<img v-if="memberImg" :src="memberImg" class="avatar" style="border-radius: 6px;width: 148px;height: 148px;"/>
|
|
||||||
<i v-else class="el-icon-plus avatar-uploader-icon"></i>
|
|
||||||
</el-upload>
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
<div style="margin-bottom: 10px;">
|
<div style="margin-bottom: 10px;">
|
||||||
<span style="width: 200px;display: inline-block;text-align: right;">充值金额:</span>
|
<span style="width: 200px;display: inline-block;text-align: right;">充值金额:</span>
|
||||||
<el-input style="width:50%;" v-model="price" placeholder="请输入充值金额"></el-input>
|
<el-input style="width:50%;" v-model="price" placeholder="请输入充值金额"></el-input>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 10px;">
|
<div style="margin-bottom: 10px;">
|
||||||
<span style="width: 200px;display: inline-block;text-align: right;">赠送优惠券数量:</span>
|
<span style="width: 200px;display: inline-block;text-align: right;">到账金额:</span>
|
||||||
<el-input style="width:50%;" v-model="giveNum" placeholder="请输入赠送优惠券数量"></el-input>
|
<el-input style="width:50%;" v-model="money" placeholder="请输入到账金额"></el-input>
|
||||||
</div>
|
</div>
|
||||||
<div style="margin-bottom: 10px;">
|
<el-button type="primary" plain class="button-new-tag" size="small" @click="couponIdBtn()">选择优惠券</el-button>
|
||||||
<span style="width: 200px;display: inline-block;text-align: right;">赠送的优惠券:</span>
|
|
||||||
<!-- <el-button size="small" v-if="couponName!=''">{{couponName}}</el-button> -->
|
<el-table v-loading="tableDataLoading" :data="yhjTableData">
|
||||||
<span v-if="couponName!=''">
|
<el-table-column fixed prop="couponId" label="编号" width="50">
|
||||||
<el-tag v-for="tag in couponName.split(',')" :key="tag" closable @close="closes()" :type="tag">
|
</el-table-column>
|
||||||
{{tag}}
|
<el-table-column prop="couponName" label="优惠卷名称">
|
||||||
</el-tag>
|
</el-table-column>
|
||||||
</span>
|
<el-table-column prop="giveNum" label="优惠卷数量">
|
||||||
|
<template slot-scope="scope">
|
||||||
<!-- <el-input style="width:50%;" v-model="couponName" placeholder="请输入赠送的优惠券" disabled></el-input> -->
|
<el-input type="number" v-model="scope.row.giveNum" placeholder="请输入优惠券数量" @change="handleYhjNum(scope.row)"></el-input>
|
||||||
<el-button type="primary" plain class="button-new-tag" size="small" @click="couponIdBtn()">选择优惠券
|
</template>
|
||||||
</el-button>
|
</el-table-column>
|
||||||
</div>
|
<el-table-column label="操作" width="180">
|
||||||
<!-- <div style="margin-bottom: 10px;">
|
<template slot-scope="scope">
|
||||||
<span style="width: 200px;display: inline-block;text-align: right;">排序:</span>
|
<el-button size="mini" type="danger"
|
||||||
<el-input style="width:50%;" v-model="sort" placeholder="请输入排序"
|
@click="deletesYhj(scope.row)">删除
|
||||||
onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')"></el-input>
|
</el-button>
|
||||||
</div> -->
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
<el-button @click="dialogFormVisible = false">取 消</el-button>
|
||||||
<el-button type="primary" @click="addNoticeTo()">确 定</el-button>
|
<el-button type="primary" @click="addNoticeTo()">确 定</el-button>
|
||||||
|
@ -126,11 +104,12 @@
|
||||||
tableDataLoading: true,
|
tableDataLoading: true,
|
||||||
dialogFormVisible: false,
|
dialogFormVisible: false,
|
||||||
tableData: [],
|
tableData: [],
|
||||||
|
yhjTableData: [],
|
||||||
tableDataY: {},
|
tableDataY: {},
|
||||||
price: '',
|
price: '',
|
||||||
memberImg: '',
|
memberImg: '',
|
||||||
memberId: '',
|
memberId: '',
|
||||||
giveNum: '',
|
money: '',
|
||||||
couponId: '',
|
couponId: '',
|
||||||
couponName: '',
|
couponName: '',
|
||||||
sort: '',
|
sort: '',
|
||||||
|
@ -168,21 +147,32 @@
|
||||||
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
//上传成功
|
//优惠卷数量校验
|
||||||
handleAvatarSuccess(file) {
|
handleYhjNum(row){
|
||||||
this.memberImg = file.data
|
var giveNum = row.giveNum
|
||||||
|
if(giveNum<1){
|
||||||
|
this.$notify({
|
||||||
|
title: '提示',
|
||||||
|
duration: 1800,
|
||||||
|
message: '优惠券数量不能小于1',
|
||||||
|
type: 'warning'
|
||||||
|
});
|
||||||
|
row.giveNum = 1;
|
||||||
|
return
|
||||||
|
}
|
||||||
},
|
},
|
||||||
Notice() {
|
Notice() {
|
||||||
this.page = 1
|
this.page = 1
|
||||||
this.dataSelect()
|
this.dataSelect()
|
||||||
},
|
},
|
||||||
addNotice() {
|
addNotice() {
|
||||||
this.giveNum = ''
|
this.money = ''
|
||||||
this.memberId = ''
|
this.memberId = ''
|
||||||
this.price = ''
|
this.price = ''
|
||||||
this.couponId = ''
|
this.couponId = ''
|
||||||
this.sort = ''
|
this.sort = ''
|
||||||
this.couponName = ''
|
this.couponName = ''
|
||||||
|
this.yhjTableData = [];
|
||||||
this.title = '添加'
|
this.title = '添加'
|
||||||
this.dialogFormVisible = true
|
this.dialogFormVisible = true
|
||||||
},
|
},
|
||||||
|
@ -216,25 +206,25 @@
|
||||||
if(this.couponName==''){
|
if(this.couponName==''){
|
||||||
this.couponId = ''
|
this.couponId = ''
|
||||||
}
|
}
|
||||||
if(this.couponId != ''||this.giveNum != ''){
|
if(this.couponId != ''||this.money != ''){
|
||||||
if (this.giveNum == '') {
|
if (this.money == '') {
|
||||||
this.$notify({
|
this.$notify({
|
||||||
title: '提示',
|
title: '提示',
|
||||||
duration: 1800,
|
duration: 1800,
|
||||||
message: '请输入数量',
|
message: '请输入到账金额',
|
||||||
type: 'warning'
|
|
||||||
});
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (this.couponId == '') {
|
|
||||||
this.$notify({
|
|
||||||
title: '提示',
|
|
||||||
duration: 1800,
|
|
||||||
message: '请选择赠送的优惠券',
|
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
});
|
});
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// if (this.couponId == '') {
|
||||||
|
// this.$notify({
|
||||||
|
// title: '提示',
|
||||||
|
// duration: 1800,
|
||||||
|
// message: '请选择赠送的优惠券',
|
||||||
|
// type: 'warning'
|
||||||
|
// });
|
||||||
|
// return
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
// this.classify = 1
|
// this.classify = 1
|
||||||
|
@ -247,12 +237,13 @@
|
||||||
url: this.$http.adornUrl(url),
|
url: this.$http.adornUrl(url),
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: this.$http.adornData({
|
data: this.$http.adornData({
|
||||||
'giveNum': this.giveNum,
|
'money': this.money,
|
||||||
'memberId': this.memberId,
|
'memberId': this.memberId,
|
||||||
'price': this.price,
|
'price': this.price,
|
||||||
'sort': this.sort,
|
'sort': this.sort,
|
||||||
'couponId': this.couponId,
|
'couponId': this.couponId,
|
||||||
'payClassifyId': this.payClassifyId,
|
'payClassifyId': this.payClassifyId,
|
||||||
|
'detailList':this.yhjTableData,
|
||||||
})
|
})
|
||||||
}).then(({
|
}).then(({
|
||||||
data
|
data
|
||||||
|
@ -289,15 +280,10 @@
|
||||||
}
|
}
|
||||||
this.dialogFormVisible = true
|
this.dialogFormVisible = true
|
||||||
this.payClassifyId = rows.payClassifyId
|
this.payClassifyId = rows.payClassifyId
|
||||||
if(rows.giveNum){
|
if(rows.money){
|
||||||
this.giveNum = rows.giveNum
|
this.money = rows.money
|
||||||
}else{
|
}else{
|
||||||
this.giveNum = ''
|
this.money = ''
|
||||||
}
|
|
||||||
if(rows.giveNum){
|
|
||||||
this.couponId = rows.couponId
|
|
||||||
}else{
|
|
||||||
this.couponId = ''
|
|
||||||
}
|
}
|
||||||
if(rows.sort){
|
if(rows.sort){
|
||||||
this.sort = rows.sort
|
this.sort = rows.sort
|
||||||
|
@ -311,6 +297,8 @@
|
||||||
}else{
|
}else{
|
||||||
this.couponName = ''
|
this.couponName = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.yhjTableData = rows.detailList;
|
||||||
|
|
||||||
this.price = rows.price
|
this.price = rows.price
|
||||||
this.title = '修改'
|
this.title = '修改'
|
||||||
|
@ -341,6 +329,12 @@
|
||||||
})
|
})
|
||||||
}).catch(() => {})
|
}).catch(() => {})
|
||||||
},
|
},
|
||||||
|
//删除一级
|
||||||
|
deletesYhj(row) {
|
||||||
|
let arr = this.yhjTableData;
|
||||||
|
let newArr = arr.filter(item => item !== row);
|
||||||
|
this.yhjTableData = newArr;
|
||||||
|
},
|
||||||
//获取优惠券数据
|
//获取优惠券数据
|
||||||
dataSelectY() {
|
dataSelectY() {
|
||||||
this.tableDataLoading = true
|
this.tableDataLoading = true
|
||||||
|
@ -365,8 +359,27 @@
|
||||||
this.dialogFormVisible4 = true
|
this.dialogFormVisible4 = true
|
||||||
},
|
},
|
||||||
couponIdBtnQ(rows) {
|
couponIdBtnQ(rows) {
|
||||||
this.couponName = rows.couponName
|
var list = {couponName:rows.couponName,couponId:rows.couponId,giveNum:1};
|
||||||
this.couponId = rows.couponId
|
|
||||||
|
var yhjTableData = this.yhjTableData;
|
||||||
|
var sfjx = 0;
|
||||||
|
for(var i=0;i<yhjTableData.length;i++){
|
||||||
|
if(rows.couponId == yhjTableData[i].couponId){
|
||||||
|
sfjx = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(sfjx==1){
|
||||||
|
this.$message({
|
||||||
|
message: "此优惠卷重复,不可添加!",
|
||||||
|
type: 'warning',
|
||||||
|
duration: 1500,
|
||||||
|
onClose: () => {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var yn = this.yhjTableData.includes(list);
|
||||||
|
this.yhjTableData.push(list)
|
||||||
this.dialogFormVisible4 = false
|
this.dialogFormVisible4 = false
|
||||||
},
|
},
|
||||||
closes(){
|
closes(){
|
||||||
|
|
Loading…
Reference in New Issue