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