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