2025.03.13 工作代码提交

This commit is contained in:
sx 2025-03-14 12:52:08 +08:00
parent 134facabb2
commit c3d184b8b5
7 changed files with 77 additions and 20 deletions

View File

@ -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

View File

@ -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,

View File

@ -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()

View File

@ -82,6 +82,12 @@
"payment" : {
"alipay" : {
"__platform__" : [ "ios", "android" ]
},
"appleiap" : {},
"weixin" : {
"__platform__" : [ "ios", "android" ],
"appid" : "wxe58baf0d5b31d33b",
"UniversalLinks" : "https://91f.xyz"
}
},
"share" : {},

View File

@ -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>

View File

@ -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>

View File

@ -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()],