2025.03.13 工作代码提交
This commit is contained in:
parent
134facabb2
commit
c3d184b8b5
|
@ -209,10 +209,11 @@ const mine = {
|
|||
},
|
||||
|
||||
/**
|
||||
* 支付
|
||||
* 支付宝支付
|
||||
* @param {Object} param
|
||||
*/
|
||||
recharge(param) {
|
||||
alipayPay(param) {
|
||||
console.log('alipayPay',param)
|
||||
return util.request({
|
||||
url: '/user/alipay/recharge',
|
||||
query: param.query,
|
||||
|
@ -221,6 +222,19 @@ const mine = {
|
|||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 微信支付
|
||||
* @param {Object} param
|
||||
*/
|
||||
wechatPay(param) {
|
||||
return util.request({
|
||||
url: '/user/wxPay/unifiedOrder',
|
||||
query: param.query,
|
||||
method: 'POST',
|
||||
load: true,
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取收益列表
|
||||
* @param {Object} param
|
||||
|
|
|
@ -6,7 +6,8 @@ const config = {
|
|||
// host: 'h5api',
|
||||
// #endif
|
||||
// #ifndef H5
|
||||
host: 'http://91f.xyz:8080',
|
||||
// host: 'http://91f.xyz:8080',
|
||||
host: 'http://fc25a42.r24.cpolar.top',
|
||||
// #endif
|
||||
// 是否vivo显示
|
||||
showVivo: true,
|
||||
|
|
|
@ -213,7 +213,7 @@ const util = {
|
|||
responseType: params.responseType || 'text',
|
||||
// 请求成功返回
|
||||
success: res => {
|
||||
// console.log('request success', url, res, params.data ? params.data : '')
|
||||
console.log('request success', url, res, params.data ? params.data : '')
|
||||
// 关闭加载效果
|
||||
if (params.load) {
|
||||
uni.hideLoading()
|
||||
|
|
|
@ -82,6 +82,12 @@
|
|||
"payment" : {
|
||||
"alipay" : {
|
||||
"__platform__" : [ "ios", "android" ]
|
||||
},
|
||||
"appleiap" : {},
|
||||
"weixin" : {
|
||||
"__platform__" : [ "ios", "android" ],
|
||||
"appid" : "wxe58baf0d5b31d33b",
|
||||
"UniversalLinks" : "https://91f.xyz"
|
||||
}
|
||||
},
|
||||
"share" : {},
|
||||
|
|
|
@ -96,7 +96,7 @@
|
|||
<view class="app">
|
||||
<view class="list">
|
||||
<view class="li" v-for="(item,index) in list.data" :key="index">
|
||||
<view class="item rows ptb30 plr20 bfff">
|
||||
<view class="item rows ptb30 plr30 bfff">
|
||||
<view class="col oh f1">
|
||||
<view class="c333 f36">{{item.reason}}</view>
|
||||
<view class="mt20 c666 f28">{{item.createTime}}</view>
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
*/
|
||||
|
||||
import {
|
||||
reactive
|
||||
ref,
|
||||
reactive,
|
||||
computed,
|
||||
} from 'vue';
|
||||
import util from '@/common/js/util';
|
||||
import api from '@/api/index.js';
|
||||
|
@ -19,24 +21,55 @@
|
|||
const form = reactive({
|
||||
totalAmount: '',
|
||||
})
|
||||
// 支付列表
|
||||
const paymentList = reactive([{
|
||||
img: '/static/shop-alipay-payment.png',
|
||||
name: '支付宝',
|
||||
provider: 'alipay',
|
||||
apiRequest: (event) => {
|
||||
return api.mine.alipayPay(event)
|
||||
}
|
||||
},
|
||||
{
|
||||
img: '/static/shop-weixin-pay.png',
|
||||
name: '微信支付',
|
||||
provider: 'wxpay',
|
||||
apiRequest: (event) => {
|
||||
return api.mine.wechatPay(event)
|
||||
}
|
||||
},
|
||||
])
|
||||
// 支付列表下标
|
||||
const paymentIndex = ref(0)
|
||||
// 当前支付方式
|
||||
const payment = computed(() => paymentList[paymentIndex.value])
|
||||
|
||||
onLoad((option) => {
|
||||
if(option.amount) form.totalAmount = option.amount
|
||||
if (option.amount) form.totalAmount = option.amount
|
||||
})
|
||||
|
||||
/**
|
||||
* 选择支付方式
|
||||
* @param {Object} event
|
||||
*/
|
||||
function handlePaymentIndex(event) {
|
||||
const index = event.detail.value
|
||||
if (paymentIndex.value === index) return
|
||||
paymentIndex.value = index
|
||||
}
|
||||
|
||||
// 充值
|
||||
function handleSubmit() {
|
||||
console.log('handleSubmit')
|
||||
// 验证
|
||||
util.isAuth({
|
||||
success: rs => {
|
||||
payment()
|
||||
handlePayment()
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 调用支付
|
||||
function payment() {
|
||||
function handlePayment() {
|
||||
const data = {
|
||||
...form
|
||||
}
|
||||
|
@ -45,17 +78,17 @@
|
|||
util.alert('金额不正确')
|
||||
return
|
||||
}
|
||||
console.log('payment')
|
||||
|
||||
api.mine.recharge({
|
||||
// 调用支付方式
|
||||
payment.value.apiRequest({
|
||||
query: {
|
||||
...data,
|
||||
},
|
||||
}).then(rs => {
|
||||
console.log('recharge rs', rs)
|
||||
console.log('payment rs', rs)
|
||||
if (rs.code == 200) {
|
||||
uni.requestPayment({
|
||||
provider: 'alipay',
|
||||
provider: payment.value.provider,
|
||||
orderInfo: rs.msg,
|
||||
success: rs => {
|
||||
console.log('requestPayment', rs)
|
||||
|
@ -94,11 +127,13 @@
|
|||
<view class="line ptb20">
|
||||
<view class="key f36">充值方式</view>
|
||||
<view class="value payment mt10">
|
||||
<view class="list rows">
|
||||
<image class="wh60" src="/static/shop-alipay-payment.png" mode="aspectFit" />
|
||||
<view class="f1 mlr20 c333 f30">支付宝</view>
|
||||
<uni-icons type="circle-filled" color="#20D200" size="40rpx" />
|
||||
</view>
|
||||
<picker :range="paymentList" range-key="name" @change="handlePaymentIndex">
|
||||
<view class="list rows ptb10">
|
||||
<image class="wh60" :src="payment.img" mode="aspectFit" />
|
||||
<view class="f1 mlr20 c333 f30">{{payment.name}}</view>
|
||||
<uni-icons type="right" color="#999" size="40rpx" />
|
||||
</view>
|
||||
</picker>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
|
|
@ -3,7 +3,8 @@ import {
|
|||
} from 'vite';
|
||||
import uni from '@dcloudio/vite-plugin-uni';
|
||||
|
||||
let target = 'http://91f.xyz:8080'
|
||||
// let target = 'http://91f.xyz:8080'
|
||||
let target = 'http://fc25a42.r24.cpolar.top'
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [uni()],
|
||||
|
|
Loading…
Reference in New Issue