更新优化

This commit is contained in:
魏啾
2024-06-14 18:30:19 +08:00
parent 139e4039a5
commit cba4e6065e
20 changed files with 94 additions and 258 deletions

View File

@@ -8,7 +8,7 @@
<text>账单明细</text>
<uni-icons type="right" style="color: #333;" size="20"></uni-icons>
</view>
<view @click="goUrl('member/index')">
<view @click="goUrlinfo('member/index')">
<text>会员充值</text>
<uni-icons type="right" style="color: #333;" size="20"></uni-icons>
</view>
@@ -20,31 +20,26 @@
<script>
import card from './components/card.vue'
export default {
components:{card},
components: {
card
},
data() {
return {
info:null,
shopId_id: null,
inputshow: 0,
memberlist: {},
listdata: [],
amount: '',
shopUser: {},
userInfo: {},
}
},
onLoad(e) {
this.info = e
if (e.type == 'list') { //从列表进来的
this.paygetShopByMember(e.shopId_id)
} else {
this.paygetShopByMember(e.shopId_id)
}
// this.paygetActive() //列表
console.log(e)
this.shopId_id = e.shopId_id
},
onShow() {
this.paygetShopByMember(this.info.shopId_id)
this.paygetShopByMember(this.shopId_id)
},
methods: {
async paygetShopByMember(w) {
@@ -56,71 +51,21 @@
})
this.userInfo = res.data.list[0]
},
async paygetActive() {
let res = await this.api.paygetActive({
shopId: uni.cache.get('shopUser'),
page: 1,
pageSize: 10
})
try {
this.listdata = res.data.list
this.amount = res.data.list[0].minNum
} catch (e) {
//TODO handle the exception
}
},
async userbalancerechangesub() {
if (this.amount == null || this.amount == '') {
uni.showToast({
title: '金额不能为空',
icon: 'none'
});
return false;
}
let res = await this.api.paymemeberIn({
shopId: uni.cache.get('shopUser'), // 判断显示哪家的作品,
amount: this.amount // 判断显示哪家的作品,
})
if (res) {
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.navigateBack()
}, 1000)
},
fail: (err) => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
setTimeout(res => {
uni.hideLoading()
}, 1000)
}
});
// #endif
}
},
clickinput(a, b) {
console.log(a, b)
this.inputshow = b
this.amount = a.minNum
},
goUrl(url){
uni.pro.navigateTo(url,this.userInfo)
goUrl(url) {
uni.pro.navigateTo(url, this.userInfo)
},
goUrlinfo(url) {
uni.pro.navigateTo(url, {
shopId: this.shopId_id,
type: 'list'
})
}
}
}
</script>