调试接口
This commit is contained in:
@ -39,6 +39,7 @@
|
||||
<view class="mt-26rpx mb-20rpx border-b-2rpx border-b-dashed border-[#E5E5E5] mx-18rpx"></view>
|
||||
|
||||
<view class="text-28rpx leading-40rpx text-[#606266] mx-28rpx">
|
||||
<!-- TODO 内容先隐藏 -->
|
||||
<!-- <view class="flex justify-between items-center mb-16rpx">
|
||||
<view>茶艺师</view>
|
||||
<view>茶艺师的昵称</view>
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
<template>
|
||||
<view class="mt-26rpx mx-30rpx">
|
||||
<bill-notice :type="type" :money="10.00" :time="bill.create_time" :order="bill.source_sn"></bill-notice>
|
||||
<bill-notice :type="type" :money="bill.amount" :time="bill.create_time" :order="bill.source_sn"></bill-notice>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
const id = ref<number>(0)
|
||||
const bill = ref({
|
||||
id: 0,
|
||||
amount: 0,
|
||||
change_type: 0,
|
||||
create_time: '',
|
||||
source_sn: ''
|
||||
|
||||
@ -34,14 +34,14 @@
|
||||
<view class="flex items-center">
|
||||
<view class="font-400 text-36rpx leading-50rpx text-[#303133] mr-20rpx mt-40rpx">¥</view>
|
||||
<view class="mt-44rpx">
|
||||
<wd-input type="text" v-model="person" placeholder="请输入金额" no-border custom-input-class="!h-80rpx !text-48rpx !leading-66rpx" >
|
||||
<wd-input type="text" v-model="rechargeMoney" placeholder="请输入金额" no-border custom-input-class="!h-80rpx !text-48rpx !leading-66rpx" >
|
||||
</wd-input>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 推广方式 -->
|
||||
<view class="mt-60rpx">
|
||||
<!-- <view class="mt-60rpx">
|
||||
<view class="mx-30rpx text-32rpx leading-44rpx text-[#303133]">
|
||||
<text class="mr-12rpx">推广方式</text>
|
||||
<text class="text-26rpx leading-36rpx text-[#909399]">(选填)</text>
|
||||
@ -74,9 +74,9 @@
|
||||
</wd-tab>
|
||||
</wd-tabs>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
|
||||
<view class="fixed left-0 right-0 bottom-92rpx z-2 bg-[#4C9F44] text-[#fff] flex justify-center items-center h-90rpx rounded-8rpx mx-60rpx" @click="buy.handleConfirmRecharge">
|
||||
<view class="fixed left-0 right-0 bottom-92rpx z-2 bg-[#4C9F44] text-[#fff] flex justify-center items-center h-90rpx rounded-8rpx mx-60rpx" @click="buy.handleRecharge">
|
||||
确定转入
|
||||
</view>
|
||||
</view>
|
||||
@ -114,13 +114,20 @@
|
||||
|
||||
|
||||
<script lang="ts" setup>
|
||||
const OSS = inject('OSS')
|
||||
import { PayList, PayCategory, PayValue, PayOrderType, PayOrderSource } from '@/utils/pay'
|
||||
import { teaRoomRecharge } from '@/api/tea-room'
|
||||
import { wechatPay } from '@/hooks/usePay'
|
||||
import { prePay, balancePay } from '@/api/pay'
|
||||
import { toast } from '@/utils/toast'
|
||||
|
||||
const pay = ref<number>(PayValue.WeChatPay) // 默认微信支付方式
|
||||
const OSS = inject('OSS')
|
||||
|
||||
// 推广方式
|
||||
const tab = ref<number>(0)
|
||||
const person = ref<string>('') // 个人推广码
|
||||
const showStorePopup = ref<boolean>(false) // 显示门店列表弹窗
|
||||
const rechargeMoney = ref<string>('')
|
||||
|
||||
onLoad(() => {
|
||||
|
||||
@ -137,6 +144,52 @@
|
||||
uni.navigateTo({
|
||||
url: '/pages/notice/pay?type=vip'
|
||||
})
|
||||
},
|
||||
|
||||
// 购买会员
|
||||
handleRecharge: async () => {
|
||||
if (!rechargeMoney.value) {
|
||||
toast.info('请输入转入金额')
|
||||
return
|
||||
}
|
||||
|
||||
uni.showLoading({ title: '支付中...' })
|
||||
try {
|
||||
// 先请求充值接口
|
||||
const res = await teaRoomRecharge(Number(rechargeMoney.value))
|
||||
|
||||
// 预支付
|
||||
const pay = await prePay({
|
||||
from: 'recharge',
|
||||
order_id: res.order_id,
|
||||
pay_way: 2,
|
||||
order_source: PayOrderSource.MINI, //订单来源:1-小程序; 2-h5; 3app
|
||||
order_type: PayOrderType.Recharge
|
||||
})
|
||||
|
||||
wechatPay(pay.pay.config).then((res) => {
|
||||
uni.hideLoading()
|
||||
if (res === 'success') {
|
||||
toast.success('支付成功')
|
||||
setTimeout(() => {
|
||||
uni.navigateBack()
|
||||
}, 800)
|
||||
return
|
||||
} else if (res === 'cancel') {
|
||||
toast.info('已取消支付')
|
||||
return
|
||||
} else {
|
||||
toast.info('支付失败,请重试')
|
||||
return
|
||||
}
|
||||
}).catch(() => {
|
||||
uni.hideLoading()
|
||||
toast.info('支付失败,请重试')
|
||||
})
|
||||
} catch (error) {
|
||||
uni.hideLoading()
|
||||
toast.info('支付失败,请重试')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -105,12 +105,19 @@ import { router } from '@/utils/tools'
|
||||
}
|
||||
const list = ref<Array<any>>([]) // 茶室列表
|
||||
const userMoney = ref<number>(0) // 用户余额
|
||||
const canReset = ref<boolean>(false) // 避免onShow重复加载
|
||||
|
||||
// 日期过滤
|
||||
const value = ref<number>(Date.now())
|
||||
const selectTime = ref<string>('')
|
||||
|
||||
onShow(() => {
|
||||
if (canReset.value) {
|
||||
list.value = []
|
||||
getMescroll().resetUpScroll();
|
||||
}
|
||||
canReset.value = true
|
||||
|
||||
getUserInfo().then(res => {
|
||||
userMoney.value = Number(res.user_money)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user