支付宝优化更新

This commit is contained in:
GaoHao
2024-10-31 09:07:26 +08:00
parent b2abe69e37
commit bec723cd69
12 changed files with 845 additions and 135 deletions

View File

@@ -27,27 +27,26 @@
type="number"
v-model="amount"
inputAlign="left"
:placeholder="`充${amount}送${giftAmount}`"
:placeholder="`充${minNum}送${handselNum}`"
: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.amount}}</text></view>
<view class="rechargeList_item_gift" v-show="index === inputshow">
<view class="rechargeList_item_amount"><text>{{item.minNum}}</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>{{inputshow}}</text>
<text>{{ item.giftAmount }}</text>
<text></text>
<text>{{ item.handselNum }}</text>
</view>
</view>
<view class="rechargeList_item_handsel" v-show="index !== inputshow">赠送{{item.giftAmount}}</view>
<view class="rechargeList_item_handsel" v-show="index != inputshow">赠送{{item.handselNum}}</view>
</view>
</view>
@@ -109,7 +108,8 @@
isProtocol: false,
listdata: [],
amount: 0,
giftAmount: 0,
minNum: 0,
handselNum: 0,
userInfo: {},
shopUserInfo: null,
shopId: '',
@@ -118,38 +118,33 @@
{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(options) {
async onLoad(e) {
// if ( e.type == 'list' || e.type == 'index') {
// this.shopId = e.shopId;
// this.init();
// }
console.log(e)
uni.cache.set('forceUpdate',1)
// #ifdef MP-WEIXIN
if (options.q) {
this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
if (e.q) {
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
uni.cache.set('shopId',this.shopId)
this.tokenShow = false;
}
// #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
// 等待登录结果返回
// 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()
}
if (options.type) {
this.type = options.type
}
if ( options.amount ) { this.amount = options.amount; }
this.shopInfo();
this.paygetActive()
},
methods: {
/**
@@ -198,44 +193,20 @@
let res = await this.api.paygetActive({
shopId: this.shopId,
page: 1,
pageSize: 99
pageSize: 10
})
try {
this.listdata = res.data.list;
this.giftList = this.listdata[0].gives;
this.giftAmount = this.listdata[0].giftAmount
if ( this.type == 'topUpActivity') {
this.amountChange()
} else {
this.amount = this.listdata[0].amount;
}
this.amount = this.listdata[0].minNum;
this.minNum = this.listdata[0].minNum;
this.handselNum = this.listdata[0].handselNum
} 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
@@ -324,10 +295,12 @@
* @param {Object} b
*/
clickinput(a, b) {
console.log(a, b)
this.inputshow = b;
this.giftList = a.gives;
this.amount = a.amount;
this.giftAmount = a.giftAmount;
this.amount = a.minNum;
this.minNum = a.minNum;
this.handselNum = a.handselNum;
},
/**
@@ -383,20 +356,15 @@
uni.requestSubscribeMessage({
tmplIds:["AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() {
if ( _this.type && _this.type == "topUpActivity") {
uni.pro.navigateBack()
if ( pages.length > 1) {
_this.shopInfo()
} else {
if ( pages.length > 1) {
_this.shopInfo()
} else {
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
}, 500)
}
setTimeout(res => {
uni.switchTab({
url: '/pages/index/index'
})
}, 500)
}
},
})