11.21前端

This commit is contained in:
@QQNZX 2023-11-21 09:09:52 +08:00
parent 6ecbe933fe
commit 17a7860505
2 changed files with 446 additions and 39 deletions

View File

@ -17,6 +17,15 @@ export function addList(data) {
})
}
export function mmc(id) {
return request({
url: 'business/marketingActivity/cardValue/selectById/'+id,
method: 'get',
})
}
export function listUserGrade(data) {
return request({
url: '/business/userManager/userGrade/list',

View File

@ -271,39 +271,135 @@
</el-form-item>
</el-form>
<!-- 赠送卡券-->
<div class="box-popup">
<div class="dis-bit"><div>赠送卡券(选填)</div> <el-button type="primary" icon="el-icon-plus" round>添加卡券</el-button> </div>
<!-- 选择优惠券-->
<div class="xh-box" >
<div class="box-bt"> <div >选择优惠券</div> <el-button type="primary" icon="el-icon-plus" @click="getlistFavorable()" >新增</el-button> </div>
<div style="margin: 10px 0px">
<el-table
:data="tableDatas"
:data="youhuiquanlist"
border
style="width: 100%">
<el-table-column
prop="date"
prop="giftCardName"
label="卡券名称"
width="180">
width="0">
</el-table-column>
<el-table-column
prop="name"
prop="giftCardType"
label="券类型"
width="180">
width="80">
<template slot-scope="scope">
<span v-if="scope.row.giftCardType == 0" >油品券</span>
<span v-if="scope.row.giftCardType == 1" >商品券</span>
<span v-if="scope.row.giftCardType == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="address"
label="券详情">
prop="date"
label="券详情"
width="80">
<template slot-scope="scope">
<span>{{scope.row.giftCardDetail}}</span>
</template>
</el-table-column>
<el-table-column
prop="address"
label="有效期">
prop="date"
label="有效期(天)"
width="240">
<template slot-scope="scope">
<span v-if="scope.row.timeType == 0" > <el-input-number v-model="scope.row.validityZero" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
<span v-if="scope.row.timeType == 1" > <el-input-number v-model="scope.row.validityOne" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
<span v-if="scope.row.timeType == 2" > <el-input-number v-model="scope.row.validityTwo" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
</template>
</el-table-column>
<el-table-column
prop="address"
label="赠送数量">
prop="date"
label="数量"
width="240">
<template slot-scope="scope">
<el-input-number v-model="scope.row.giftCardTotal" controls-position="right" :min="1" :max="9999"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="deletedata(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 选择兑换券-->
<div class="xh-box" >
<div class="box-bt"> <div >选择兑换券</div> <el-button type="primary" icon="el-icon-plus" @click="getlistExchange()" >新增</el-button> </div>
<div style="margin: 10px 0px">
<el-table
:data="duihuanquanlist"
border
style="width: 100%">
<el-table-column
prop="giftCardName"
label="卡券名称"
width="80">
</el-table-column>
<el-table-column
prop="date"
label="券类型"
width="80">
<template slot-scope="scope">
<span v-if="scope.row.giftCardType == 0" >油品券</span>
<span v-if="scope.row.giftCardType == 1" >商品券</span>
<span v-if="scope.row.giftCardType == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="券详情"
width="80">
<template slot-scope="scope">
<span>{{scope.row.giftCardDetail}}</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
width="240">
<template slot-scope="scope">
<span > <el-input-number v-model="scope.row.giftCardTime" controls-position="right" :min="1" :max="9999"></el-input-number> </span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="数量"
width="240">
<template slot-scope="scope">
<el-input-number v-model="scope.row.giftCardTotal" controls-position="right" :min="1" :max="9999"></el-input-number>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作"
>
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="deletedhdata(scope.row)"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<!-- 附加特权-->
<div class="box-popup">
@ -312,6 +408,7 @@
type="textarea"
placeholder="请输入内容"
maxlength="225"
v-model="form.fringeBenefit"
show-word-limit
>
</el-input>
@ -324,15 +421,168 @@
</div>
</div>
</el-drawer>
<!-- 弹窗-->
<el-dialog title="优惠券列表" :visible.sync="dialogTableVisible">
<div style="display: flex;align-items: center; margin-bottom: 20px ">
<el-input v-model="youhuiquan.name" placeholder="优惠券名称"></el-input>
<el-button type="primary" icon="el-icon-search" @click="getlistFavorable" >搜索</el-button>
</div>
<el-table
:data="tableDatayh"
border
style="width: 100%">
<el-table-column
prop="name"
label="卡券名称"
width="100">
</el-table-column>
<el-table-column
prop="date"
label="券类型"
width="100">
<template slot-scope="scope">
<span v-if="scope.row.type == 0" >油品券</span>
<span v-if="scope.row.type == 1" >商品券</span>
<span v-if="scope.row.type == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="券详情"
width="100">
<template slot-scope="scope">
<span>{{scope.row.fullDeduction}} {{scope.row.discountAmount}} </span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
width="180">
<template slot-scope="scope">
<span v-if="scope.row.timeType == 0" >{{scope.row.validityZero}} </span>
<span v-if="scope.row.timeType == 1" >{{scope.row.validityOne}} </span>
<span v-if="scope.row.timeType == 2" >{{scope.row.validityTwo}} </span>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="chosedata(scope.row)"
>选择</el-button>
</template>
</el-table-column>
</el-table>
<div><pagination
v-show="ytotal>0"
:total="ytotal"
:page.sync="youhuiquan.pageNum"
:limit.sync="youhuiquan.pageSize"
@pagination="getlistFavorable"
/></div>
</el-dialog>
<!-- 兑换券列表-->
<el-dialog title="兑换券列表" :visible.sync="dialogTableVisibledh">
<div style="display: flex;align-items: center; margin-bottom: 20px ">
<el-input v-model="duihuanquan.name" placeholder="兑换券名称"></el-input>
<el-button type="primary" icon="el-icon-search" @click="getlistExchange" >搜索</el-button>
</div>
<el-table
:data="tableDatadh"
border
style="width: 100%">
<el-table-column
prop="name"
label="卡券名称"
width="100">
</el-table-column>
<el-table-column
prop="date"
label="券类型"
width="100">
<template slot-scope="scope">
<span v-if="scope.row.type == 0" >油品券</span>
<span v-if="scope.row.type == 1" >商品券</span>
<span v-if="scope.row.type == 2" >通用券</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="使用说明"
width="100">
<template slot-scope="scope">
<span>{{scope.row.useInstructions}}</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
width="180">
<template slot-scope="scope">
<span >{{scope.row.validity}} </span>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="Favorabledata(scope.row)"
>选择</el-button>
</template>
</el-table-column>
</el-table>
<div><pagination
v-show="dtotal>0"
:total="dtotal"
:page.sync="duihuanquan.pageNum"
:limit.sync="duihuanquan.pageSize"
@pagination="getlistExchange"
/></div>
</el-dialog>
</div>
</template>
<script>
import { getList,addList,eitList,deleteList,listUserGrade } from "@/api/EventMarketing/SaveBlock";
import { getList,addList,eitList,deleteList,listUserGrade,mmc } from "@/api/EventMarketing/SaveBlock";
import {getActiveConsumption, listExchange, listFavorable} from "@/api/EventMarketing/activeConsumption";
export default {
name: 'index',
data(){
return{
pdidlist:[],//id
pddhidlist:[],//id
youhuiquanlist:[],
duihuanquanlist:[],
dialogTableVisible:false,//
dialogTableVisibledh:false,//
tableDatadh:[],//
tableDatayh:[],//
//
youhuiquan:{
name:'',
pageNum: 1,
pageSize: 10,
},
ytotal:0,
//
duihuanquan:{
name:'',
pageNum: 1,
pageSize: 10,
total:0
},
dtotal:0,
isonline: '0',
dialog: false,
rules: {
@ -409,6 +659,8 @@
amountCommission:'',
membershipLevel:'',
percentageCommissions:'',
fringeBenefit:'',
cardValueChildList:[],
},
tableDatas: [],
formLabelWidth: '160px',
@ -427,6 +679,118 @@
this.getlist()
},
methods:{
//
getlistExchange(){
this.tableDatadh = []
listExchange(this.duihuanquan).then(res=>{
if(res.code==200){
this.dialogTableVisibledh = true
this.tableDatadh = res.data.records
this.dtotal = res.data.total
}
})
},
//
getlistFavorable(){
this.tableDatayh = []
listFavorable(this.youhuiquan).then(res=>{
if(res.code == 200){
this.dialogTableVisible = true
this.tableDatayh = res.data.records
this.ytotal = res.data.total
}
})
},
//
Favorabledata(row){
this.dialogTableVisibledh = false
if(this.pddhidlist.indexOf(row.id)>-1 ){
this.$message.error("该兑换卡券已存在")
return
}
this.pddhidlist.push(row.id)
console.log(row)
let data ={
activeGift: 2, // 01 2. 3 4.
goodsIds: "", //id
goodsName:"" , //
goodsTotal: "", //
vouchersId:row.id, //id
giftCardName:row.name, //
giftCardType: row.type, //
validityZero: null,
validityOne: null,
validityTwo:null,
validity:row.validity,
giftCardDetail: row.useInstructions , //
giftCardTime: row.validity, //
giftCardTotal: 1 //
}
this.duihuanquanlist.push(data)
this.$message.success("新增成功")
},
//
chosedata(row){
this.dialogTableVisible = false
if(this.pdidlist.indexOf(row.id)>-1 ){
this.$message.error("该优惠卡券已存在")
return
}
this.pdidlist.push(row.id)
let data ={
activeGift: 1, // 01 2. 3 4.
goodsIds: "", //id
goodsName:"" , //
goodsTotal: "", //
vouchersId:row.id, //id
giftCardName:row.name, //
giftCardType: row.type, //
timeType: row.timeType,
validityZero: row.validityZero,
validityOne: row.validityOne,
validityTwo:row.validityTwo,
giftCardDetail: "满"+ row.fullDeduction+"减 "+row.discountAmount+"元" , //
giftCardTime: "", //
giftCardTotal: 1//
}
this.youhuiquanlist.push(data)
this.$message.success("新增成功")
},
//
deletedata(row){
if(this.youhuiquanlist&&this.youhuiquanlist.length>0){
let delIdx=-1;
for ( let item of this.youhuiquanlist) {
delIdx++;
if (item.id===row.id){
break
}
}
this.pdidlist.splice(delIdx,1);
this.youhuiquanlist.splice(delIdx,1);
}
},
//
deletedhdata(row){
if(this.duihuanquanlist&&this.duihuanquanlist.length>0){
let delIdx=-1;
for ( let item of this.duihuanquanlist) {
delIdx++;
if (item.id===row.id){
break
}
}
this.pddhidlist.splice(delIdx,1);
this.duihuanquanlist.splice(delIdx,1);
}
},
getlist(){
let data = {
@ -439,11 +803,23 @@
this.total = res.data.total;
})
},
handleUpdate(data){
console.log(data)
this.form = data
handleUpdate(row) {
this.chongzhi();
const id = row.id || this.ids
mmc(id).then(response => {
this.form = response.data;
this.youhuiquanlist = response.data.cardValueChildList.filter(item => item.activeGift == '1')
this.duihuanquanlist = response.data.cardValueChildList.filter(item => item.activeGift == '2')
this.dialog = true
});
},
// handleUpdate(data){
// console.log(data)
// this.form = data
// this.dialog = true
// },
chongzhi(){
this.form = {
sort:1,
@ -461,9 +837,12 @@
activeTime:'1',
activeStatus:'1',
paymentValue:'1',
cardValueChildList:[],
fringeBenefit:'',
isonline:0
}
console.log('归零')
this.youhuiquanlist =[]
this.duihuanquanlist =[]
},
addblock(){
this.vipname = []
@ -506,7 +885,11 @@
})
},
// this.form.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '1')
// this.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '2')
submitForm(){
this.form.cardValueChildList = this.youhuiquanlist.concat(this.duihuanquanlist);
if(this.form.id){
eitList(this.form).then(res=>{
if (res.code == 200){
@ -555,6 +938,8 @@
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 15px;
}
.box-popup{
width: 90%;
@ -567,4 +952,17 @@
justify-content: space-between;
margin-bottom: 15px;
}
.box-bt{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 18px;
}
.xh-box{
width: 90%;
margin: 10px auto;
}
</style>