充值活动相关增加

This commit is contained in:
GaoHao
2024-10-26 09:23:21 +08:00
parent d6ca0aead6
commit a868117cda
5 changed files with 62 additions and 35 deletions

View File

@@ -27,26 +27,27 @@
type="number"
v-model="amount"
inputAlign="left"
:placeholder="`充${minNum}送${handselNum}`"
:placeholder="`充${amount}送${giftAmount}`"
:customStyle="{border: '0'}"
@input="amountChange"
></u-input>
</view>
<text class="customAmount_right">自定义金额</text>
</view>
<view class="rechargeList">
<view class="rechargeList_f" @click="clickinput(item,index)" v-for="(item,index) in listdata" :key="index">
<view class="rechargeList_item flex-colum " :class="index == inputshow?'active':''">
<view class="rechargeList_item flex-colum " :class="index === inputshow?'active':''">
<view class="rechargeList_item_title">充值</view>
<view class="flex-colum-start">
<view class="rechargeList_item_amount"><text>{{item.minNum}}</text></view>
<view class="rechargeList_item_gift" v-show="index == inputshow">
<view class="rechargeList_item_amount"><text>{{item.amount}}</text></view>
<view class="rechargeList_item_gift" v-show="index === inputshow">
<image class="rechargeList_item_gift_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/gift_icon.png" mode="aspectFill"></image>
<view class="rechargeList_item_gift_text">
<text></text>
<text>{{ item.handselNum }}</text>
<text>{{inputshow}}</text>
<text>{{ item.giftAmount }}</text>
</view>
</view>
<view class="rechargeList_item_handsel" v-show="index != inputshow">赠送{{item.handselNum}}</view>
<view class="rechargeList_item_handsel" v-show="index !== inputshow">赠送{{item.giftAmount}}</view>
</view>
</view>
@@ -108,8 +109,7 @@
isProtocol: false,
listdata: [],
amount: 0,
minNum: 0,
handselNum: 0,
giftAmount: 0,
userInfo: {},
shopUserInfo: null,
shopId: '',
@@ -142,9 +142,11 @@
} else{
this.shopId = e.shopId;
this.type = e.type;
if ( e.amount ) { this.amount = e.amount; }
uni.cache.set('shopId',this.shopId)
this.shopInfo();
this.paygetActive()
}
},
methods: {
@@ -200,14 +202,38 @@
try {
this.listdata = res.data.list;
this.giftList = this.listdata[0].gives;
this.amount = this.listdata[0].minNum;
this.minNum = this.listdata[0].minNum;
this.handselNum = this.listdata[0].handselNum
this.giftAmount = this.listdata[0].giftAmount
if ( this.type == 'topUpActivity') {
this.amountChange()
} else {
this.amount = this.listdata[0].amount;
}
} catch (e) {
//TODO handle the exception
}
},
/**
* 监听金额修改
*/
amountChange () {
let item = this.listdata.filter(item=>this.amount==item.amount)
if ( item.length > 0 ) {
this.listdata.forEach((v,e)=>{
if ( this.amount == v.amount) {
this.inputshow = e;
this.clickinput(v,e)
}
})
} else {
this.inputshow = '';
this.giftList = [];
this.giftAmount = '';
}
},
/**
* 进入明细\管理
* @param {Object} e
@@ -296,12 +322,10 @@
* @param {Object} b
*/
clickinput(a, b) {
console.log(a, b)
this.inputshow = b;
this.giftList = a.gives;
this.amount = a.minNum;
this.minNum = a.minNum;
this.handselNum = a.handselNum;
this.amount = a.amount;
this.giftAmount = a.giftAmount;
},
/**

View File

@@ -3,10 +3,10 @@
<view class="towcontent">
<view class="towcontentlistxitem flex-start">
<view class="towcontentlistxitembox flex-colum"
:class="towcontentclickindex == index?'towcontentlistxitemboxopacity':''"
v-for="(item,index) in listbox" :key="index" @click="towcontentclick(index,item)">
:class="tabIndex == index?'towcontentlistxitemboxopacity':''"
v-for="(item,index) in tabList" :key="index" @click="towcontentclick(index,item)">
<text class="title">{{item.name}}</text>
<image v-if="towcontentclickindex == index"
<image v-if="tabIndex == index"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/today/dg.png" mode="widthFix">
</image>
</view>
@@ -74,27 +74,27 @@
export default {
data() {
return {
listbox: [{
tabList: [{
name: '全部',
type: ''
},
{
name: '未使用',
type: '0'
type: '1'
},
{
name: '已使用',
type: '1'
type: '2'
}
],
towcontentclickindex: 0,
tabIndex: 0,
list: [],
status: "",
};
},
onLoad() {
this.ordermineCouponsthis()
this.getCouponList()
},
methods: {
@@ -105,17 +105,17 @@
* @param {Object} item
*/
towcontentclick(index, item) {
this.towcontentclickindex = index;
this.tabIndex = index;
this.status = item.type;
this.ordermineCouponsthis()
this.getCouponList()
},
/**
* 获取优惠券数据
*/
async ordermineCouponsthis() {
async getCouponList() {
try {
let res = await this.api.getUserConpons({
let res = await this.api.conponList({
userId: uni.cache.get('userInfo').id,
shopId: uni.cache.get('shopId'),
status: this.status