oil-station/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue
2024-11-19 17:57:08 +08:00

1145 lines
39 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="app-containers">
<div class="card-box">
<div class="d-s">
<div class="gang"></div>
<div style="font-weight: bold">电子储值卡</div>
</div>
<div style="display: flex;justify-content: space-between;box-sizing: border-box;align-items: center;padding: 1px">
<div class="left-c">简化加油流程提升服务引领成品油零售市场进入便捷新时代</div>
<div style="margin: 10px 0px">
<el-button type="primary" @click="addCrule()" >编辑储值卡规则</el-button>
<el-button type="primary" @click="addblock()">新增储值卡活动</el-button>
</div>
</div>
<el-table :data="tableData" align="center" style="width: 100%">
<el-table-column label="序号" type="index" align="center"> </el-table-column>
<el-table-column prop="activeName" label="活动名称" align="center" width="165">
</el-table-column>
<el-table-column prop="createBy" label="会员等级" align="center">
<template slot-scope="scope">
<span v-if="scope.row.groupOriented == 1">普通群体</span>
<span v-if="scope.row.groupOriented == 2">等级会员</span>
</template>
</el-table-column>
<el-table-column prop="bidBalance" label="充值金额" align="center"> </el-table-column>
<el-table-column prop="giftBalance" label="赠送金额" align="center"> </el-table-column>
<el-table-column prop="points" label="赠送积分" align="center"> </el-table-column>
<el-table-column prop="growthValue" label="赠送成长值" align="center"> </el-table-column>
<!-- <el-table-column label="活动信息" align="center">-->
<!-- <el-table-column prop="rechargeBalance" label="充值金额" align="center" > </el-table-column>-->
<!-- <el-table-column prop="giftBalance" label="赠送金额" align="center" > </el-table-column>-->
<!-- <el-table-column prop="points" label="赠送积分" align="center" > </el-table-column>-->
<!-- <el-table-column prop="growthValue" label="赠送成长值" align="center" > </el-table-column>-->
<!-- </el-table-column>-->
<el-table-column prop="startTime" label="活动时间" align="center" width="165">
<template slot-scope="scope">
<span v-if="scope.row.activeTime == 1">不限时间</span>
<span v-if="scope.row.activeTime == 2">{{scope.row.startTime }}-{{scope.row.endTime }}</span>
</template>
</el-table-column>
<el-table-column prop="activityProgress" label="活动状态" align="center" >
<template slot-scope="scope">
<span v-if="scope.row.isonline == 0"> <el-tag>已上架</el-tag></span>
<span v-if="scope.row.isonline == 1"> <el-tag>已下架</el-tag></span>
</template>
</el-table-column>
<el-table-column label="销售信息" align="center">
<el-table-column prop="rechargeBalance" label="充值本金(元)" align="center" > </el-table-column>
<el-table-column prop="giftBalance" label="赠送金额(元)" align="center" > </el-table-column>
<el-table-column prop="participationNo" label="会员人数" align="center" > </el-table-column>
<!-- <el-table-column prop="growthValue" label="赠送成长值" align="center" > </el-table-column>-->
</el-table-column>
<el-table-column prop="createBy" label="操作人" align="center"> </el-table-column>
<el-table-column prop="createTime" label="创建时间" align="center" width="160"> </el-table-column>
<el-table-column prop="date" label="操作" align="center" >
<template slot-scope="scope">
<el-button
size="mini"
type="text"
@click="handleUpdate(scope.row)"
>修改</el-button>
<el-button
size="mini"
type="text"
@click="handleDelete(scope.row)"
slot="reference"
>
<span v-if="scope.row.isonline == 1" >上架</span>
<span v-if="scope.row.isonline == 0" >下架</span>
</el-button>
<el-button
size="mini"
type="text"
@click="viewOrder(scope.row.id)"
>查看订单记录</el-button>
<!-- </el-popconfirm>-->
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="pageNo"
:limit.sync="pageSize"
@pagination="getlist"
/>
</div>
<el-drawer
title="订单记录"
:visible.sync="orderShow"
size="55%"
center>
<div class="box-der">
<div class="d-b">
<div class="d-s">
<el-input v-model="order.orderNo" style="width: 200px;margin-right: 10px" placeholder="请输入订单号"></el-input>
<el-select v-model="order.ordertype" placeholder="请选择" style="width: 200px;margin-right: 10px">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
<el-date-picker
v-model="dataRange"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
format="yyyy-MM-dd"
value-format="yyyy-MM-dd"
>
</el-date-picker>
</div>
<el-button type="primary" icon="el-icon-search" @click="RecordList()" >搜索</el-button>
</div>
<el-table
:data="orderData"
border
style="width: 100%">
<el-table-column
label="序号"
type="index"
>
</el-table-column>
<el-table-column
prop="paymentNo"
label="订单号"
>
</el-table-column>
<el-table-column
prop="mobile"
label="会员手机号"
>
</el-table-column>
<el-table-column
prop="bidBalance"
label="充值本金">
</el-table-column>
<el-table-column
prop="amount"
label="赠送金额">
</el-table-column>
<el-table-column
prop="points"
label="赠送积分">
</el-table-column>
<el-table-column
prop="growthValue"
label="赠送成长值">
</el-table-column>
<el-table-column
prop="status"
label="订单状态">
</el-table-column>
<el-table-column
prop="updateTime"
label="订单完成时间">
</el-table-column>
</el-table>
<pagination
v-show="orderTotal>0"
:total="orderTotal"
:page.sync="order.pageNo"
:limit.sync="order.pageSize"
@pagination="RecordList"
/>
</div>
</el-drawer>
<el-dialog
:title="titles"
:visible.sync="dialog"
width="50%"
ref="drawer"
center
>
<div class="demo-drawer__content">
<el-form :model="form" ref="ruleForm" :rules="rules" :inline="true" :label-position="labelPosition" label-width="100px" >
<el-form-item label="活动名称" prop="activeName">
<el-input style="width: 270px" v-model="form.activeName"></el-input>
</el-form-item>
<el-form-item label="充值" label-width="" prop="rechargeBalance">
<div style="width:270px">
<el-input type="number" v-model="form.rechargeBalance" autocomplete="off">
<template slot="append">元</template>
</el-input>
</div>
</el-form-item>
<el-form-item label="赠送" label-width="" prop="">
<div style="width: 270px">
<el-input type="number" v-model="form.giftBalance" autocomplete="off">
<template slot="append">元</template>
</el-input>
</div>
</el-form-item>
<el-form-item label="赠送积分" :label-width="formLabelWidth" prop="">
<div style="width: 270px">
<el-input type="number" v-model="form.points" autocomplete="off">
<template slot="append">分</template>
</el-input>
</div>
</el-form-item>
<el-form-item label="赠送成长值" :label-width="formLabelWidth" prop="">
<div style="width: 270px">
<el-input type="number" v-model="form.growthValue" autocomplete="off">
<template slot="append">成长值</template>
</el-input>
</div>
</el-form-item>
<el-form-item label="活动状态" :label-width="formLabelWidth" prop="activeStatus">
<el-radio-group v-model="form.isonline" @input="changeIsOnline">
<el-radio label="0">上架</el-radio>
<el-radio label="1">下架</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="提成金额" v-if="form.royaltyType == 2" :label-width="formLabelWidth" prop="amountCommission">
<el-input v-model="form.amountCommission" autocomplete="off">
<template slot="append">元</template>
</el-input>
</el-form-item>
<el-form-item label="提成比例" v-if="form.royaltyType == 3" :label-width="formLabelWidth" prop="percentageCommissions">
<el-input v-model="form.percentageCommissions" autocomplete="off">
<template slot="append">%</template>
</el-input>
</el-form-item>
<div style="display: flex;align-items: center;justify-content: space-between">
<el-form-item label="活动时间" :label-width="formLabelWidth" prop="activeTime">
<el-radio-group v-model="form.activeTime" >
<el-radio label="1">不限时间</el-radio>
<el-radio label="2">自定义时间</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="时间范围" v-if="form.activeTime == 2" :label-width="formLabelWidth" prop="endTime" style="margin-right: 45px">
<el-date-picker
v-model="form.startTime"
type="datetime"
style="width: 150px"
placeholder="开始日期">
</el-date-picker>
-
<el-date-picker
v-model="form.endTime"
type="datetime"
style="width: 150px"
placeholder="结束日期">
</el-date-picker>
</el-form-item>
</div>
<el-form-item label="赠送优惠券" :label-width="formLabelWidth" style="margin-bottom: 0px">
<el-button type="primary" style="margin-left: 30px" size="mini" @click="getlistFavorable()" >添加</el-button>
</el-form-item>
</el-form>
<!-- 选择优惠券-->
<div class="xh-box" >
<div style="margin: 10px 0px">
<el-table
:data="youhuiquanlist"
border
style="width: 100%">
<el-table-column
prop="giftCardName"
label="卡券名称"
width="0">
</el-table-column>
<el-table-column
prop="giftCardType"
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="instruction"
label="使用说明"
width="0">
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)">
<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="date"
label="数量"
width="240">
<template slot-scope="scope">
<el-input-number v-model="scope.row.giftCardTotal" controls-position="right" :min="1" :max="scope.row.tfTotal - scope.row.tfGetNum"></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="box-popup">
<div class="dis-bit">附加特权</div>
<el-input
type="textarea"
placeholder="请输入内容"
maxlength="225"
v-model="form.fringeBenefit"
show-word-limit
>
</el-input>
</div>
<div class="demo-drawer__footer">
<el-button @click="cancelForm">取 消</el-button>
<el-button type="primary" @click="submitForm('ruleForm')">保 存</el-button>
</div>
</div>
</el-dialog>
<!-- 弹窗-->
<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="卡券名称"
>
</el-table-column>
<el-table-column
prop="date"
label="券类型"
>
<template slot-scope="scope">
<dict-tag :options="dict.type.CardCoupon_type" :value="scope.row.type"/>
</template>
</el-table-column>
<el-table-column
prop="date"
label="券详情"
>
<template slot-scope="scope">
<span>{{scope.row.useType=='1'?'订单金额':'实付金额'+'满'+scope.row.reachAmount+'优惠'+scope.row.reduceAmount}}</span>
</template>
</el-table-column>
<el-table-column
prop="date"
label="有效期(天)"
>
<template slot-scope="scope">
<span>{{scope.row.effectiveDateStart}}~{{scope.row.effectiveDateEnd}}</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="Crule" center>
<el-form :model="ruleForm" ref="ruleForm1" :rules="rules" label-width="100px" class="demo-ruleForm" :label-position="labelPosition">
<el-form-item label="名称" prop="name">
<el-input disabled v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="权益说明" prop="desc">
<el-input type="textarea" v-model="ruleForm.qyDetail"></el-input>
</el-form-item>
<el-form-item label="规则说明" prop="desc">
<el-input type="textarea" v-model="ruleForm.gzDetail"></el-input>
</el-form-item>
<el-form-item label="适用油品油号" prop="oilLimit">
<div class="d-s" style="cursor: pointer">
<div class="d-s" @click="ruleForm.oilLimit = 1">
<img src="../../../assets/images/wx.png" v-if="ruleForm.oilLimit != 1" style="width: 20px;height: 20px;">
<img src="../../../assets/images/xz.png" v-if="ruleForm.oilLimit == 1" style="width: 20px;height: 20px;">
<div style="width: 60px;">不限</div>
</div>
<div class="d-s" @click="ruleForm.oilLimit = 2" >
<img src="../../../assets/images/wx.png" v-if="ruleForm.oilLimit != 2" style="width: 20px;height: 20px;">
<img src="../../../assets/images/xz.png" v-if="ruleForm.oilLimit == 2" style="width: 20px;height: 20px;">
<div style="width: 60px;">自定义</div>
<el-select v-if="ruleForm.oilLimit == 2" v-model="ruleForm.oilNumber" placeholder="请选择油品油号(可多选)" multiple style="margin-left: 10px; width: 700px;">
<el-option :label="item.oilName" :value="item.oilId" v-for="(item,index) in oilnumList" :key="index"></el-option>
</el-select>
</div>
</div>
</el-form-item>
<!-- <el-form-item label="适用商品" prop="productLimit">-->
<!-- <div class="d-s" style="cursor: pointer">-->
<!-- <div class="d-s" @click="ruleForm.productLimit = 1">-->
<!-- <img src="../../../assets/images/wx.png" v-if="ruleForm.productLimit != 1" style="width: 20px;height: 20px;">-->
<!-- <img src="../../../assets/images/xz.png" v-if="ruleForm.productLimit == 1" style="width: 20px;height: 20px;">-->
<!-- <div>不限</div>-->
<!-- </div>-->
<!-- <div class="d-s" @click="ruleForm.productLimit = 2">-->
<!-- <img src="../../../assets/images/wx.png" v-if="ruleForm.productLimit != 2" style="width: 20px;height: 20px;">-->
<!-- <img src="../../../assets/images/xz.png" v-if="ruleForm.productLimit == 2" style="width: 20px;height: 20px;">-->
<!-- <div>自定义</div>-->
<!-- <el-select v-if="ruleForm.productLimit == 2" v-model="ruleForm.productIds" placeholder="请选择商品名称(可多选)" style="margin-left: 10px">-->
<!-- <el-option-->
<!-- v-for="item in goodsList"-->
<!-- :key="item.id+''"-->
<!-- :label="item.name"-->
<!-- :value="item.id+''"></el-option>-->
<!-- </el-select>-->
<!-- </div>-->
<!-- </div>-->
<!-- </el-form-item>-->
</el-form>
<div slot="footer" class="dialog-footer" style="text-align: center">
<el-button @click="cancel">取 消</el-button>
<el-button type="primary" @click="submitForms('ruleForm1')">保 存</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import {
getList,
addList,
eitList,
deleteList,
listUserGrade,
mmc,
deletedelById,
cardValueRule,
saveOrUpdate,
cardValueRecordList,
cardValueRecordLists,
updateStatus
} from "@/api/EventMarketing/SaveBlock";
import {oilNumberList1} from "@/api/order/oilnumgun";
import {getActiveConsumption, listExchange, listFavorable} from "@/api/EventMarketing/activeConsumption";
import {delLJGoods, listLJGoods} from "@/api/convenienceStore/ljgoods";
export default {
name: 'index',
dicts: ['CardCoupon_type', 'putType_type', 'oilNumber_type'],
props:['type'],
data(){
return{
ruleForm: {
name: '',
region: '',
oilLimit:1,
productLimit:1,
timeLimit:1,
date2: '',
delivery: false,
type: [],
resource: '',
desc: '',
oilNumber:[]
},
Crule:false,
orderShow:false,
orderTotal:0,
order:{
orderNo:'',
ordertype:'',
cardValueId:'',
pageNo:1,
pageSize:10,
storeId:''
},
dataRange:[],
orderData: [{
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, ],
titles:'',
labelPosition:'right',
pdidlist:[],//判断优惠券id
pddhidlist:[],//判断兑换券id
youhuiquanlist:[],
duihuanquanlist:[],
dialogTableVisible:false,//优惠券
dialogTableVisibledh:false,//兑换券
tableDatadh:[],//兑换券
tableDatayh:[],//优惠券
//请求优惠券列表时的参数
youhuiquan:{
name:'',
status:'1',
pageNum: 1,
pageSize: 10,
},
ytotal:0,
//请求兑换券列表时的参数
duihuanquan:{
name:'',
pageNum: 1,
pageSize: 10,
total:0
},
dtotal:0,
isonline: '0',
dialog: false,
rules: {
name: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
startTime: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
endTime: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
participationNo: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
activeName: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
refuelMoney: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
growthValue: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
points: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
giftBalance: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
membershipLevel:[
{ required: true, message: '不能为空', trigger: 'blur' },
],
rechargeBalance: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
groupOriented: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
sort: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
employeeCommission: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
royaltyType: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
resource: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
activeTime: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
activeStatus: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
paymentValue: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
amountCommission: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
percentageCommissions: [
{ required: true, message: '不能为空', trigger: 'blur' },
],
},
isOnLine:false,
form: {
sort:1,
groupOriented:'1',
rechargeBalance:'',
giftBalance:'',
points:'',
growthValue:'',
refuelMoney:'',
participationNo:0,
employeeCommission:'1',
royaltyType:'1',
isonline:'0',
resource:'1',
activeTime:'1',
activeStatus:'1',
paymentValue:'1',
amountCommission:'',
membershipLevel:[],
percentageCommissions:'',
fringeBenefit:'',
cardValueChildList:[],
},
tableDatas: [],
oilnumList:[],
formLabelWidth: '100px',
timer: null,
options: [ ],
total:0,
pageNo:1,
pageSize:5,
value: '',
tableData: [ ],
vipname:[],
// 商品列表
goodsList:[]
}
},
created() {
this.getlist()
if (this.type){
this.dialog = true
}
this.getGoodsList()
},
mounted() {
},
methods:{
getGoodsList(){
listLJGoods({page:1,pageSize:10000,status:'qy',isRecovery:0}).then(response => {
this.goodsList = response.data.records;
});
},
addCrule(){
this.Crule =! this.Crule
cardValueRule({type:'0'}).then(res=>{
this.ruleForm = res.data
this.ruleForm.oilNumber = res.data.oilNumber.split(',')
})
oilNumberList1().then(res=>{
console.log(res)
this.oilnumList = res.data.records
})
},
submitForms(ruleForm1 ) {
this.$refs[ruleForm1].validate((valid) => {
if (valid) {
this.ruleForm.oilNumber = this.ruleForm.oilNumber.join(',')
saveOrUpdate(this.ruleForm).then(res=>{
if(res.code == 200){
this.$message.success('成功')
this.Crule = false
}
})
} else {
console.log('error submit!!');
return false;
}
});
},
resetForm(formName) {
this.$refs[formName].resetFields();
this.Crule = false
},
// 请求兑换券
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
}
})
},
changeIsOnline(val){
if (this.form.isonline==1) {
this.form.activeStatus = '2'
this.isOnLine = true
}else {
this.isOnLine = false
}
},
// 兑换券券列表选择
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, //活动奖品 0赠送积分1赠送优惠券 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.cardDetail , //券详情
giftCardTime: row.validity, //券有效期
giftCardTotal: 1, //券数量
instruction: row.useInstructions, //使用说明
}
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, //活动奖品 0赠送积分1赠送优惠券 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.cardDetail , //券详情
giftCardTime: "", //券有效期
giftCardTotal: 1,//券数量
instruction: row.instruction,//使用说明
tfTotal: row.tfTotal,
tfGetNum: row.tfGetNum,
}
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);
}
},
viewOrder(id){
this.orderShow =! this.orderShow
this.order.cardValueId = id
this.RecordList()
},
RecordList(){
console.log(this.dataRange)
cardValueRecordLists({
cardValueId: this.order.cardValueId,
dataRange: this.dataRange,
orderNo:this.order.orderNo
}).then(res=>{
this.orderData = res.data
this.order.total = res.data.total
})
},
getlist(){
let data = {
// isonline:this.isonline,
pageNo:this.pageNo,
pageSize:this.pageSize,
}
getList(data).then(res=>{
this.tableData = res.data.records
this.total = res.data.total;
})
},
handleUpdate(row) {
this.titles = "修改储值卡活动"
let data = {
pageNo:1,
pageSize:30,
}
listUserGrade(data).then(res=>{
this.vipname = res.data.records
})
this.chongzhi();
const id = row.id || this.ids
mmc(id).then(response => {
this.form = response.data;
this.youhuiquanlist = response.data.cardValueChildList
this.duihuanquanlist = response.data.cardValueChildList.filter(item => item.activeGift == '2')
this.dialog = true
if (this.form.isonline==1) {
this.isOnLine = true
}else {
this.isOnLine = false
}
});
},
chongzhi(){
this.form = {
sort:1,
membershipLevel:[],
groupOriented: '1',
rechargeBalance:'',
giftBalance:'',
points:'',
growthValue:'',
refuelMoney:'',
participationNo:0,
employeeCommission:'1',
royaltyType:'1',
resource:'1',
activeTime:'1',
activeStatus:'1',
paymentValue:'1',
cardValueChildList:[],
fringeBenefit:'',
isonline:'0'
}
this.youhuiquanlist =[]
this.duihuanquanlist =[]
},
addblock(){
this.isOnLine = false
this.titles = "新增储值卡活动"
this.vipname = []
let data = {
pageNo:1,
pageSize:30,
}
listUserGrade(data).then(res=>{
this.vipname = res.data.records
})
this.chongzhi()
this.dialog = true
},
posteid(data){
eitList(data).then(res=>{
if (res.code === 200){
this.$message({
message: '修改成功',
type: 'success'
});
this.getlist()
}else {
this.$message.error('修改失败');
}
})
},
handleDelete(data){
let resData = JSON.parse(JSON.stringify(data))
let ddata = {
isonline : "1",
id:data.id
}
updateStatus(ddata).then(res=>{
if (res.code === 200){
this.$message({
message: '操作成功',
type: 'success'
});
this.getlist()
}else {
this.$message.error('修改失败');
}
})
},
handleDeletes(data){
let resData = JSON.parse(JSON.stringify(data))
let ddata = {
isonline : "0",
id:resData.id
}
eitList(ddata).then(res=>{
if (res.code === 200){
this.$message({
message: '上线成功',
type: 'success'
});
this.getlist()
}else {
this.$message.error('修改失败');
}
})
},
Deletesl(data){
let resData = JSON.parse(JSON.stringify(data))
if(resData.isonline == 0){
this.$message({
message: '上线不能删除,需先下线',
type: 'error'
});
return
}
this.$modal.confirm('确定删除此条电子储值卡信息?').then(function() {
return deletedelById(resData.id);
}).then(() => {
this.pageNo = 1
this.getlist()
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
// this.form.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '1')
// this.tableDatas = response.data.activeConsumptionChildList.filter(item => item.activeGift == '2')
submitForm(ruleForm){
this.$refs[ruleForm].validate((valid) => {
if (valid) {
this.form.cardValueChildList = this.youhuiquanlist.concat(this.duihuanquanlist);
if (this.form.id) {
eitList(this.form).then(res => {
if (res.code == 200) {
this.$message({
message: '修改成功',
type: 'success'
});
this.getlist()
} else {
this.$message.error('修改失败');
}
})
} else {
addList(this.form).then(res => {
if (res.code == 200) {
this.$message({
message: '新增成功',
type: 'success'
});
this.getlist()
} else {
this.$message.error('新增失败');
}
})
}
this.dialog = false
this.chongzhi()
}else {
console.log('error submit!!');
return false;
}
});
},
cancelForm() {
this.loading = false;
this.dialog = false;
clearTimeout(this.timer);
},
cancel(){
this.Crule = false;
},
}
}
</script>
<style scoped lang="scss">
.box-der{
box-sizing: border-box;
padding: 15px;
}
.d-b{
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
margin-bottom: 10px;
}
.d-s{
display: flex;
align-items: center;
}
.gang{
width: 2px;
height: 13px;
background: #FF9655;
margin-right: 5px;
}
.demo-drawer__footer{
width: 100%;
display: flex;
align-items: center;
justify-content: center;
box-sizing: border-box;
padding: 15px;
}
.box-popup{
}
.dis-bit{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 15px;
font-weight: bold;
}
.box-bt{
width: 100%;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 18px;
}
.demo-drawer__content{
width: 100%;
box-sizing: border-box;
padding: 0px 20px;
}
.title_{
width: 100%;
display: flex;
align-items: center;
font-size: 20px;
font-weight: bold;
justify-content: center;
margin-bottom: 20px;
}
.card-box{
width: 100%;
background: #fff;
box-sizing: border-box;
padding: 15px;
border-radius: 10px;
}
.left-c{
background: rgba(255,150,85,0.15);
font-size: 12px;
color: #FF9655;
box-sizing: border-box;
padding: 4px 15px ;
}
</style>