积分抵扣、霸王餐、优惠券分享新增

This commit is contained in:
GaoHao
2024-11-07 15:02:44 +08:00
parent bec723cd69
commit 7b81e2ffb0
29 changed files with 2375 additions and 887 deletions

View File

@@ -23,30 +23,32 @@
<view class="customAmount" v-if="shopUserInfo.isUser == 1">
<view class="customAmount_left">
<text class="customAmount_left_tip"></text>
<u-input
<input
type="number"
v-model="amount"
inputAlign="left"
:placeholder="`充${minNum}送${handselNum}`"
:placeholder="`充${amount}送${giftAmount}`"
:customStyle="{border: '0'}"
></u-input>
controlled="true"
@input="amountChange"
></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 +110,7 @@
isProtocol: false,
listdata: [],
amount: 0,
minNum: 0,
handselNum: 0,
giftAmount: 0,
userInfo: {},
shopUserInfo: null,
shopId: '',
@@ -118,33 +119,38 @@
{name: "明细", url: "member/billDetails",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/detail.png"},
{name: "管理", url: "member/storedManage",icon: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/manage.png"}
],
type: "",
}
},
async onLoad(e) {
async onLoad(options) {
// if ( e.type == 'list' || e.type == 'index') {
// this.shopId = e.shopId;
// this.init();
// }
console.log(e)
uni.cache.set('forceUpdate',1)
if (e.q) {
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
// #ifdef MP-WEIXIN
if (options.q) {
this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
uni.cache.set('shopId',this.shopId)
this.tokenShow = false;
// 等待登录结果返回
// if (!uni.cache.get('token')) {
// await this.$onLaunched;
// }
this.shopInfo();
this.paygetActive()
} else{
this.shopId = e.shopId;
uni.cache.set('shopId',this.shopId)
this.shopInfo();
this.paygetActive()
}
// #endif
// #ifdef MP-ALIPAY
if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId }
uni.cache.set('shopId',this.shopId)
// #endif
if (options.shopId) {
this.shopId = options.shopId
uni.cache.set('shopId',this.shopId)
}
if (options.type) {
this.type = options.type
}
if ( options.amount ) { this.amount = options.amount; }
this.shopInfo();
this.paygetActive()
},
methods: {
/**
@@ -193,20 +199,43 @@
let res = await this.api.paygetActive({
shopId: this.shopId,
page: 1,
pageSize: 10
pageSize: 99
})
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
@@ -295,12 +324,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;
},
/**
@@ -315,6 +342,7 @@
});
return false;
}
console.log(this.amount)
if (this.amount == null || this.amount == '') {
uni.showToast({
title: '金额不能为空',
@@ -331,7 +359,13 @@
}
let res = await this.api.paymemeberIn({
shopId: this.shopId, // 判断显示哪家的作品,
amount: this.amount // 判断显示哪家的作品,
amount: this.amount ,// 判断显示哪家的作品,
// #ifdef MP-WEIXIN
payType: 'wechatPay',
// #endif
// #ifdef MP-ALIPAY
payType: 'aliPay',
// #endif
})
if (res.code == 0) {
uni.showLoading({
@@ -356,15 +390,20 @@
uni.requestSubscribeMessage({
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() {
if ( pages.length > 1) {
_this.shopInfo()
if ( _this.type && _this.type == "topUpActivity") {
uni.pro.navigateBack()
} else {
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
}, 500)
if ( pages.length > 1) {
_this.shopInfo()
} else {
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
}, 500)
}
}
},
})
@@ -453,7 +492,7 @@
justify-content: space-between;
align-items: center;
margin-bottom: 32rpx;
padding: 14rpx 16rpx;
padding: 22rpx 16rpx 22rpx 32rpx;
background-color: #fff;
border-radius: 8rpx;
.customAmount_left{