|
|
@@ -1,22 +1,19 @@
|
|
|
<template>
|
|
|
<view class="ex-page">
|
|
|
<view class="title">
|
|
|
- 活动状态:<switch style="transform: scale(0.8,0.8)" :checked="rechargeSwitch == 0 ? false : true" @change="rechargeChange" />
|
|
|
- <text v-if="rechargeSwitch == 0">关闭</text><text v-else>开启</text>
|
|
|
- <button class="admin-button-com middle blue" @click="addHb()">新增选项</button>
|
|
|
+ 推荐新客福利:<switch style="transform: scale(0.8,0.8)" :checked="tjFlSwitch == 0 ? false : true" @change="tjChange" />
|
|
|
+ <text v-if="tjFlSwitch == 0">关闭</text><text v-else>开启</text>
|
|
|
</view>
|
|
|
- <view class="recharge-list">
|
|
|
+ <view class="tjFl-list">
|
|
|
|
|
|
- <view v-for="(item, index) in recharge" :key="index">
|
|
|
+ <view v-for="(item, index) in tjFl" :key="index">
|
|
|
|
|
|
<view class="item">
|
|
|
|
|
|
- <view>充值金额:<input v-model="item.amount" @click="discount=''" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />元</view>
|
|
|
- <view>赠送红包:<input v-model="item.num" @click="discount=''" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />个</view>
|
|
|
- <view>每个红包:<input v-model="item.hbAmount" @click="discount=''" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0rpx 10rpx;" />元</view>
|
|
|
+ <view>赠送红包:<input v-model="item.num" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />个</view>
|
|
|
+ <view>每个红包:<input v-model="item.hbAmount" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0rpx 10rpx;" />元</view>
|
|
|
<view>最低消费:<input v-model="item.miniExpend" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />元可用</view>
|
|
|
<view>有效时长:<input v-model="item.valid" placeholder-class="phcolor" class="tui-input" type="digit" style="width:180rpx;border:1px solid #ddd;display:inline-block;margin:0 10rpx 0 10rpx;" />天
|
|
|
- <button class="admin-button-com mini default" @click="delHb(item)" style="margin-left:150rpx;">删除</button>
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
@@ -26,13 +23,13 @@
|
|
|
</view>
|
|
|
|
|
|
<view class="footer">
|
|
|
- <button class="admin-button-com big blue" @click="saveHb()">保存</button>
|
|
|
+ <button class="admin-button-com big blue" @click="saveTjFl()">保存</button>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
<script>
|
|
|
import { mapGetters } from "vuex";
|
|
|
-import { getRechargeHbDetail,saveRechargeHb } from "@/api/recharge";
|
|
|
+import { getDetail,saveTjFl } from "@/api/tj-fl";
|
|
|
export default {
|
|
|
components: {},
|
|
|
mixins: [],
|
|
|
@@ -41,8 +38,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- recharge:[],
|
|
|
- rechargeSwitch:0
|
|
|
+ tjFl:[],
|
|
|
+ tjFlSwitch:0
|
|
|
};
|
|
|
},
|
|
|
onPullDownRefresh() {
|
|
|
@@ -52,12 +49,12 @@ export default {
|
|
|
|
|
|
},
|
|
|
methods: {
|
|
|
- rechargeChange(e) {
|
|
|
+ tjChange(e) {
|
|
|
let value = e.target.value
|
|
|
if(value){
|
|
|
- this.rechargeSwitch = 1
|
|
|
+ this.tjFlSwitch = 1
|
|
|
}else{
|
|
|
- this.rechargeSwitch = 0
|
|
|
+ this.tjFlSwitch = 0
|
|
|
}
|
|
|
},
|
|
|
init(){
|
|
|
@@ -65,48 +62,49 @@ export default {
|
|
|
},
|
|
|
getDetail(){
|
|
|
let that = this
|
|
|
- getRechargeHbDetail().then(res => {
|
|
|
- that.rechargeSwitch = res.data.recharge;
|
|
|
+ getDetail().then(res => {
|
|
|
+ that.tjFlSwitch = res.data.tjFl;
|
|
|
if(!this.$util.isEmpty(res.data.list)){
|
|
|
- that.recharge = res.data.list.map(e=>{
|
|
|
- return {amount:parseFloat(e.amount),num:e.num,hbAmount:parseFloat(e.hbAmount),miniExpend:parseFloat(e.miniExpend),valid:e.valid}
|
|
|
+ that.tjFl = res.data.list.map(e=>{
|
|
|
+ return {num:e.num,hbAmount:parseFloat(e.hbAmount),miniExpend:parseFloat(e.miniExpend),valid:e.valid}
|
|
|
})
|
|
|
}else{
|
|
|
- that.recharge = [
|
|
|
- {amount:5000,num:2,hbAmount:5,miniExpend:200,valid:30}
|
|
|
+ that.tjFl = [
|
|
|
+ {num:1,hbAmount:20,miniExpend:200,valid:10}
|
|
|
]
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- delHb(item){
|
|
|
- if(this.recharge.length <= 1){
|
|
|
- this.$msg("最少需要保留一个")
|
|
|
+ delTjFl(item){
|
|
|
+ if(this.tjFl.length <= 1){
|
|
|
+ this.$msg("最少要一个")
|
|
|
return false
|
|
|
}
|
|
|
- var index = this.recharge.indexOf(item);
|
|
|
+ var index = this.tjFl.indexOf(item);
|
|
|
if (index > -1) {
|
|
|
- this.recharge.splice(index, 1)
|
|
|
+ this.tjFl.splice(index, 1)
|
|
|
this.$msg("删除成功")
|
|
|
}
|
|
|
},
|
|
|
- addHb(){
|
|
|
- if(this.recharge.length > 6){
|
|
|
- this.$msg("最多只能设置6个")
|
|
|
+ addTjFl(){
|
|
|
+ if(this.tjFl.length > 5){
|
|
|
+ this.$msg("最多只能设置5个")
|
|
|
return false
|
|
|
}
|
|
|
- this.recharge.push({amount:'',num:'',hbAmount:'',miniExpend:'',valid:''})
|
|
|
+ this.tjFl.push({num:'',hbAmount:'',miniExpend:'',valid:''})
|
|
|
},
|
|
|
- saveHb(){
|
|
|
- let amountGroup = []
|
|
|
+ saveTjFl(){
|
|
|
let hasError = false
|
|
|
- this.recharge.forEach(e => {
|
|
|
- let currentAmount = parseFloat(e.amount)
|
|
|
- if(amountGroup.indexOf(currentAmount) > -1){
|
|
|
- this.$msg("充值金额"+currentAmount+"重复了")
|
|
|
+ let hbAmountGroup = []
|
|
|
+ this.tjFl.forEach(e => {
|
|
|
+
|
|
|
+ let currentAmount = parseFloat(e.hbAmount)
|
|
|
+ if(hbAmountGroup.indexOf(currentAmount) > -1){
|
|
|
+ this.$msg("红包金额"+currentAmount+"重复了")
|
|
|
hasError = true
|
|
|
return false
|
|
|
}
|
|
|
- amountGroup.push(currentAmount)
|
|
|
+ hbAmountGroup.push(currentAmount)
|
|
|
|
|
|
if(this.$util.isMoney(e.num) == false || e.num%1 !== 0){
|
|
|
this.$msg("请填写红包数量")
|
|
|
@@ -140,7 +138,7 @@ export default {
|
|
|
if(hasError){
|
|
|
return false
|
|
|
}
|
|
|
- saveRechargeHb({data:JSON.stringify(this.recharge),rechargeSwitch:this.rechargeSwitch}).then(res=>{
|
|
|
+ saveTjFl({data:JSON.stringify(this.tjFl),tjFlSwitch:this.tjFlSwitch}).then(res=>{
|
|
|
if(res.code == 1){
|
|
|
this.$msg(res.msg)
|
|
|
setTimeout(() => {
|
|
|
@@ -166,7 +164,7 @@ export default {
|
|
|
right:10rpx;
|
|
|
}
|
|
|
}
|
|
|
- .recharge-list{
|
|
|
+ .tjFl-list{
|
|
|
line-height:80px;
|
|
|
padding-left:20rpx;
|
|
|
font-size:30rpx;
|