feat: 支付

This commit is contained in:
黄泽群
2026-07-23 14:00:22 +08:00
committed by charles
parent 15dd3d7b5b
commit 3629555911
8 changed files with 1098 additions and 1018 deletions
@@ -1,13 +1,13 @@
<template> <template>
<view class="mine_order_info_warp" :style="{ <view class="mine_order_info_warp">
height: height,
}">
<up-loading-page :loading="listLoading"></up-loading-page> <up-loading-page :loading="listLoading"></up-loading-page>
<view class="order_info_header"> <view class="order_info_header">
<up-image src="/static/common/left_b.png" width="20" height="19" bgColor="#f1f6ff00" @click="jumpLeft"></up-image> <up-image src="/static/common/left_b.png" width="20" height="19" bgColor="#f1f6ff00"
@click="jumpLeft"></up-image>
<view class="header_status"> <view class="header_status">
<view style="margin-top: 10rpx"> <view style="margin-top: 10rpx">
<up-image src="/static/common/order_status_1.png" width="20" height="19" bgColor="#f1f6ff00"></up-image> <up-image src="/static/common/order_status_1.png" width="20" height="19"
bgColor="#f1f6ff00"></up-image>
</view> </view>
<text class="msg">{{ getValue(ORDER_STATUS, orderInfo.status) }}</text> <text class="msg">{{ getValue(ORDER_STATUS, orderInfo.status) }}</text>
</view> </view>
@@ -22,8 +22,8 @@
orderInfo.sumAmount orderInfo.sumAmount
}}</text> }}</text>
<text style="font-size: 20rpx; font-weight: bold; margin-left: 20rpx">订单</text> <text style="font-size: 20rpx; font-weight: bold; margin-left: 20rpx">订单</text>
<text style="font-size: 28rpx; font-weight: bold; margin-left: 10rpx">{{ formatDate1(orderInfo.expireTime) <text
}}</text> style="font-size: 28rpx; font-weight: bold; margin-left: 10rpx">{{ formatDate1(orderInfo.expireTime) }}</text>
<text style="font-size: 20rpx; font-weight: bold">&nbsp;自动取消</text> <text style="font-size: 20rpx; font-weight: bold">&nbsp;自动取消</text>
</view> </view>
</view> </view>
@@ -33,7 +33,8 @@
<!-- 物流单号 --> <!-- 物流单号 -->
<view class="address_info"> <view class="address_info">
<view class="address_data_warp"> <view class="address_data_warp">
<up-image src="/static/common/waybill.png" width="20" height="20" bgColor="#f1f6ff00"></up-image> <up-image src="/static/common/waybill.png" width="20" height="20"
bgColor="#f1f6ff00"></up-image>
<view class="address_info_name">订单编号:</view> <view class="address_info_name">订单编号:</view>
<view class="address_info_mobile" style="margin-right: 20rpx">{{ <view class="address_info_mobile" style="margin-right: 20rpx">{{
orderInfo.orderNum orderInfo.orderNum
@@ -47,7 +48,8 @@
<view class="address_warp"> <view class="address_warp">
<view class="address_info"> <view class="address_info">
<view class="address_data_warp"> <view class="address_data_warp">
<up-image src="/static/common/address.png" width="20" height="20" bgColor="#f1f6ff00"></up-image> <up-image src="/static/common/address.png" width="20" height="20"
bgColor="#f1f6ff00"></up-image>
<view class="address_info_name">{{ orderInfo.name }}</view> <view class="address_info_name">{{ orderInfo.name }}</view>
<view class="address_info_mobile">{{ orderInfo.phone }}</view> <view class="address_info_mobile">{{ orderInfo.phone }}</view>
</view> </view>
@@ -63,7 +65,8 @@
<view class="order_comm order_product_warp"> <view class="order_comm order_product_warp">
<!-- 头部 --> <!-- 头部 -->
<view class="order_product_header"> <view class="order_product_header">
<up-image :src="orderInfo.shopLogo" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image> <up-image :src="orderInfo.shopLogo" width="22" height="22" bgColor="#f1f6ff00"
shape="circle"></up-image>
<view class="order_product_title">{{ orderInfo.shopName }}</view> <view class="order_product_title">{{ orderInfo.shopName }}</view>
</view> </view>
<!-- 产品详情 --> <!-- 产品详情 -->
@@ -75,7 +78,8 @@
<view class="content_info_title">{{ pItem.title }}</view> <view class="content_info_title">{{ pItem.title }}</view>
<view class="content_info_tag">{{ pItem.goodsSpece }}</view> <view class="content_info_tag">{{ pItem.goodsSpece }}</view>
<view> <view>
<text class="content_info_description" v-for="dItem in pItem.description" :key="dItem"> <text class="content_info_description" v-for="dItem in pItem.description"
:key="dItem">
{{ dItem }} {{ dItem }}
</text> </text>
</view> </view>
@@ -91,8 +95,8 @@
<view class="item_value"> <view class="item_value">
<view>{{ pItem.expressNo }} </view> <view>{{ pItem.expressNo }} </view>
<view style="margin-left: 10rpx"> <view style="margin-left: 10rpx">
<up-image src="/static/common/copy.png" width="14" height="14" bgColor="#f1f6ff00" <up-image src="/static/common/copy.png" width="14" height="14"
@click="copyData(pItem.expressNo)"></up-image> bgColor="#f1f6ff00" @click="copyData(pItem.expressNo)"></up-image>
</view> </view>
</view> </view>
</view> </view>
@@ -105,24 +109,17 @@
<view class="order_comm order_data_warp"> <view class="order_comm order_data_warp">
<view class="data_item"> <view class="data_item">
<view class="item_title">商品总价</view> <view class="item_title">商品总价</view>
<view class="item_value" v-if="!orderInfo.buyDeductionValue">¥{{ orderInfo.sumAmount }}</view> <view class="item_value">¥{{ orderInfo.sumAmount }}</view>
<view class="item_value" v-else>数字积分{{ orderInfo.buyDeductionValue }} +¥{{ orderInfo.sumAmount }}</view>
</view> </view>
<view class="data_item"> <view class="data_item">
<view class="item_title">快递运费</view> <view class="item_title">快递运费</view>
<view class="item_value">¥{{ orderInfo.postage }}</view> <view class="item_value">¥{{ orderInfo.postage }}</view>
</view> </view>
<view class="data_item" v-if="orderInfo.buyDeductionValue">
<view class="item_title">数字积分</view>
<view class="item_value" style="color: #7934F6">{{ orderInfo.buyDeductionValue }}数字积分</view>
</view>
<view class="data_item"> <view class="data_item">
<view class="item_title">平台优惠<text class="copy_order_coupon" v-if="orderInfo.coupon">优惠券</text></view> <view class="item_title">平台优惠<text class="copy_order_coupon" v-if="orderInfo.coupon">优惠券</text>
</view>
<view class="item_value">-¥0.00</view> <view class="item_value">-¥0.00</view>
</view> </view>
<view class="data_item"> <view class="data_item">
<view class="item_title">应付款</view> <view class="item_title">应付款</view>
<view class="item_value pay_amount">¥{{ orderInfo.sumAmount + orderInfo.postage }}</view> <view class="item_value pay_amount">¥{{ orderInfo.sumAmount + orderInfo.postage }}</view>
@@ -164,14 +161,18 @@
" height="12" bgColor="#f1f6ff00"></up-image> " height="12" bgColor="#f1f6ff00"></up-image>
</view> </view>
</view> </view>
<view> <view @click.native="
previewQrcode(
`https://chaininsight.antdigital.com/search?unionId=2647&projectName=VBGAKNJB&content=${orderInfo.antChainHash}`
)
">
<up-qrcode <up-qrcode
:val="`https://chaininsight.antdigital.com/search?unionId=2647&projectName=VBGAKNJB&content=${orderInfo.antChainHash}`" :val="`https://chaininsight.antdigital.com/search?unionId=2647&projectName=VBGAKNJB&content=${orderInfo.antChainHash}`"
:size="63" :size="63"></up-qrcode>
@click.stop="previewQrcode(`https://chaininsight.antdigital.com/search?unionId=2647&projectName=VBGAKNJB&content=${orderInfo.antChainHash}`)"></up-qrcode>
</view> </view>
</view> </view>
<!-- 支付方式 --> <!-- 支付方式 -->
<view class="order_way_warp" @click="wayShowFun(true)" v-if="orderInfo.status === ORDER_TYPE.UNPAID"> <view class="order_way_warp" @click="wayShowFun(true)" v-if="orderInfo.status === ORDER_TYPE.UNPAID">
<view>支付方式</view> <view>支付方式</view>
<view class="order_way_right"> <view class="order_way_right">
@@ -184,7 +185,8 @@
[ORDER_TYPE.UNPAID, ORDER_TYPE.NOT_RECEIVE].includes(orderInfo.status) [ORDER_TYPE.UNPAID, ORDER_TYPE.NOT_RECEIVE].includes(orderInfo.status)
"> ">
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.UNSHIPPED">取消订单</view> --> <!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.UNSHIPPED">取消订单</view> -->
<view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.UNPAID" @click="goPay">去付款</view> <view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.UNPAID" @click="goPay">去付款
</view>
<!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.COMPLETED">申请退款</view> --> <!-- <view class="operate_comm operate_but_1" v-if="orderInfo.status === ORDER_TYPE.COMPLETED">申请退款</view> -->
<view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.NOT_RECEIVE" <view class="operate_comm operate_but_2" v-if="orderInfo.status === ORDER_TYPE.NOT_RECEIVE"
@click="confirmReceiptOk(orderInfo)">确认收货</view> @click="confirmReceiptOk(orderInfo)">确认收货</view>
@@ -211,20 +213,21 @@
</view> </view>
<up-radio :name="item.type" activeColor="#FF7C41"> </up-radio> <up-radio :name="item.type" activeColor="#FF7C41"> </up-radio>
</view> </view>
<view class="balance_comm_msg" v-if="item.type === 'balance' && isShowBalance">当前现金余额不足,如需支付请前往充值</view> <view class="balance_comm_msg" v-if="item.type === 'balance' && isShowBalance">
当前现金余额不足,如需支付请前往充值</view>
</view> </view>
</up-radio-group> </up-radio-group>
<view class="popup_but" @click="wayShow = false"> 确认 </view> <view class="popup_but" @click="wayShow = false"> 确认 </view>
</view> </view>
</up-popup> </up-popup>
<up-toast ref="uToastRef"></up-toast> <up-toast ref="uToastRef"></up-toast>
<QrcodePreview ref="qrcodePreview" :qrcodeVal="qrcodeVal" /> <QrcodePreview ref="qrcodePreviewRef" :qrcodeVal="qrcodeVal" />
</view> </view>
</template> </template>
<script> <script>
import { ORDER_TYPE, ORDER_STATUS, getValue } from "@/utils/enumUtils.js"; import { ORDER_TYPE, ORDER_STATUS, getValue } from "@/utils/enumUtils.js";
import QrcodePreview from "@/pages/rwa_package/rwa_withdrawal_log/qrcode-preview.vue"; import QrcodePreview from "@/pages/rwa_package/component/qrcode-preview.vue";
import { import {
copyData, copyData,
assembleAddress, assembleAddress,
@@ -245,9 +248,6 @@ import {
} from "@/utils/payUtils.js"; } from "@/utils/payUtils.js";
export default { export default {
components: {
QrcodePreview,
},
computed: { computed: {
ORDER_TYPE() { ORDER_TYPE() {
return ORDER_TYPE; return ORDER_TYPE;
@@ -461,9 +461,13 @@ export default {
previewQrcode(val) { previewQrcode(val) {
console.log("val--", val); console.log("val--", val);
this.qrcodeVal = val; this.qrcodeVal = val;
this.$refs.qrcodePreview.open(); this.$refs.qrcodePreviewRef.open();
}, },
}, },
components: {
QrcodePreview,
},
}; };
</script> </script>
@@ -495,8 +499,8 @@ export default {
} }
.mine_order_info_warp { .mine_order_info_warp {
height: 100vh; // height: 100vh;
// height: calc(100vh - 180rpx); height: calc(100vh - 180rpx);
background-color: $app-bj; background-color: $app-bj;
position: relative; position: relative;
overflow-y: auto; overflow-y: auto;
@@ -25,7 +25,8 @@
<view class="form_item"> <view class="form_item">
<view class="form_item_title">目标账户</view> <view class="form_item_title">目标账户</view>
<view class="recharge_way_warp"> <view class="recharge_way_warp">
<up-radio-group v-model="form.toCategory" placement="column" v-if="wayOption && wayOption.length !== 0"> <up-radio-group v-model="form.toCategory" placement="column"
v-if="wayOption && wayOption.length !== 0">
<view :class="index + 1 < wayOption.length ? 'way_item way_item_but' : 'way_item'" <view :class="index + 1 < wayOption.length ? 'way_item way_item_but' : 'way_item'"
v-for="(item, index) in wayOption" :key="item.id"> v-for="(item, index) in wayOption" :key="item.id">
<view class="way_item_"> <view class="way_item_">
@@ -54,8 +55,14 @@
<script> <script>
import Header from '@/components/header.vue'; import Header from '@/components/header.vue';
import { getExchangeRule, exchange } from '@/api/finance.js'; import {
import { ACCOUNT_CATEGORY, getValue } from '@/utils/enumUtils.js'; getExchangeRule,
exchange
} from '@/api/finance.js';
import {
ACCOUNT_CATEGORY,
getValue
} from '@/utils/enumUtils.js';
export default { export default {
computed: { computed: {
@@ -63,7 +70,9 @@ export default {
return ACCOUNT_CATEGORY; return ACCOUNT_CATEGORY;
}, },
}, },
components: { Header }, components: {
Header
},
data() { data() {
return { return {
form: { form: {
@@ -47,12 +47,22 @@
<script> <script>
import Header from '@/components/header.vue'; import Header from '@/components/header.vue';
import { getRechargeSupportPay, recharge } from '@/api/finance.js'; import {
import { feedback } from '@/api/payment.js'; getRechargeSupportPay,
import { appWxpayFun, zfbPayFun } from '@/utils/payUtils.js' recharge
} from '@/api/finance.js';
import {
feedback
} from '@/api/payment.js';
import {
appWxpayFun,
zfbPayFun
} from '@/utils/payUtils.js'
export default { export default {
components: { Header }, components: {
Header
},
data() { data() {
return { return {
form: { form: {
@@ -114,7 +124,27 @@ export default {
}); });
return; return;
} }
if (params.payway == "wechat") {
// #ifdef MP-WEIXIN
params["payway"] = "wechatMiniProgram";
params["code"] = await new Promise((resolve) => {
uni.login({
provider: "weixin",
onlyAuthorize: true,
success: function(loginRes) {
resolve(loginRes.code);
},
fail: (err) => {
resolve(""); // 登录失败时返回空字符串,避免后续流程中断
},
});
});
// #endif
}
console.log("params---", params); console.log("params---", params);
const result = await recharge(params); const result = await recharge(params);
console.log("result", result); console.log("result", result);
if (result && result.bizcode === 100) { if (result && result.bizcode === 100) {
@@ -3,7 +3,7 @@
<view class="result-modal" v-if="visible"> <view class="result-modal" v-if="visible">
<view class="modal-content"> <view class="modal-content">
<view class="modal-content-result"> <view class="modal-content-result">
<view v-for="item in prize" class="modal-content-result-item"> <view v-for="(item, index) in prize" :key="index" class="modal-content-result-item">
<view class="par-value"> <view class="par-value">
<text v-if="item.type === 'balance'" class="moeny">¥ </text>{{ item.parValue }} <text v-if="item.type === 'balance'" class="moeny">¥ </text>{{ item.parValue }}
</view> </view>
@@ -43,7 +43,7 @@ export default {
} }
</script> </script>
<style scoped> <style scoped lang="scss">
.result-modal { .result-modal {
position: fixed; position: fixed;
top: 0; top: 0;
+17
View File
@@ -275,6 +275,23 @@ export default {
category: 'balance', category: 'balance',
payway: this.curSelect == '0' ? 'wechat' : 'alipay' payway: this.curSelect == '0' ? 'wechat' : 'alipay'
} }
if (params.payway == "wechat") {
// #ifdef MP-WEIXIN
params["payway"] = "wechatMiniProgram";
params["code"] = await new Promise((resolve) => {
uni.login({
provider: "weixin",
onlyAuthorize: true,
success: function (loginRes) {
resolve(loginRes.code);
},
fail: (err) => {
resolve(""); // 登录失败时返回空字符串,避免后续流程中断
},
});
});
// #endif
}
recharge(params).then(result => { recharge(params).then(result => {
if (result && result.bizcode === 100) { if (result && result.bizcode === 100) {
const item = result.data; const item = result.data;
@@ -1,51 +1,29 @@
<template> <template>
<view class="rwa_withdrawal_log"> <view class="rwa_withdrawal_log">
<Header <Header leftTitle="行权记录" left-path-type="navigateTo" :leftPath="leftPath" />
leftTitle="行权记录"
left-path-type="navigateTo"
:leftPath="leftPath"
/>
<view class="_log_content"> <view class="_log_content">
<view class="_log_content_title"> <view class="_log_content_title">
<view>行权账户邮箱/时间</view> <view>行权账户邮箱/时间</view>
<view>金额/状态</view> <view>金额/状态</view>
</view> </view>
<scroll-view <scroll-view scroll-y="true" @scrolltolower="loadMore" style="height: calc(100vh - 300rpx)">
scroll-y="true" <view class="_content_item" v-for="item in logList" :key="item.id"
@scrolltolower="loadMore" v-if="logList && logList.length !== 0">
style="height: calc(100vh - 300rpx)" <view class="_content_item_no _content_item_no_buto">NO.{{ item.tradeNo }}</view>
>
<view
class="_content_item"
v-for="item in logList"
:key="item.id"
v-if="logList && logList.length !== 0"
>
<view class="_content_item_no _content_item_no_buto"
>NO.{{ item.tradeNo }}</view
>
<!-- <view class="_content_item_no _content_item_no_buto" v-if="item.exchNo">股东流水号:{{item.exchNo}}</view> --> <!-- <view class="_content_item_no _content_item_no_buto" v-if="item.exchNo">股东流水号:{{item.exchNo}}</view> -->
<view class="_content_item_but"> <view class="_content_item_but">
<view class="_content_item_left"> <view class="_content_item_left">
<up-image <up-image src="/static/rwa/account.png" width="40" height="40" bgColor="#f1f6ff00" />
src="/static/rwa/account.png"
width="40"
height="40"
bgColor="#f1f6ff00"
/>
<view class="_content_item_left_"> <view class="_content_item_left_">
<view class="_content_item_left_title" <view class="_content_item_left_title">{{ item.name }}-{{ item.account }}</view>
>{{ item.name }}-{{ item.account }}</view
>
<view class="_content_item_left_val">{{ <view class="_content_item_left_val">{{
formatDate(item.ctdate) formatDate(item.ctdate)
}}</view> }}</view>
</view> </view>
</view> </view>
<view class="_content_item_right"> <view class="_content_item_right">
<view class="_content_item_left_title _content_item_left_amount" <view class="_content_item_left_title _content_item_left_amount">{{ item.amount }}
>{{ item.amount }} {{ categotyObj.name || "USDT" }}</view {{ categotyObj.name || "USDT" }}</view>
>
<view class="_content_item_left_status">{{ <view class="_content_item_left_status">{{
getValue(RWA_STATUS, item.status) getValue(RWA_STATUS, item.status)
}}</view> }}</view>
@@ -54,23 +32,15 @@
<view style="border-top: 1rpx solid #f5f5f5; margin: 28rpx 0"></view> <view style="border-top: 1rpx solid #f5f5f5; margin: 28rpx 0"></view>
<view class="code_content" v-if="item.antChainHash"> <view class="code_content" v-if="item.antChainHash">
<view> <view>
<view style="font-size: 28rpx; color: #333; font-weight: bold" <view style="font-size: 28rpx; color: #333; font-weight: bold">您的订单已接入蚂蚁链溯源</view>
>您的订单已接入蚂蚁链溯源</view <view style="font-size: 20rpx; color: #999; margin-bottom: 18rpx">扫描二维码或复制下方链接查看溯源信息</view>
>
<view style="font-size: 20rpx; color: #999; margin-bottom: 18rpx"
>扫描二维码或复制下方链接查看溯源信息</view
>
<view class="code_content_item"> <view class="code_content_item">
<view class="code_content_item_text"> <view class="code_content_item_text">
{{ {{
`https://chaininsight.antdigital.com/search?unionId=2647&projectName=VBGAKNJB&content=${item.antChainHash}` `https://chaininsight.antdigital.com/search?unionId=2647&projectName=VBGAKNJB&content=${item.antChainHash}`
}} }}
</view> </view>
<up-image <up-image style="margin-left: 8rpx" src="/static/rwa/copy.png" width="12" @click="
style="margin-left: 8rpx"
src="/static/rwa/copy.png"
width="12"
@click="
copyData( copyData(
`https://chaininsight.antdigital.com/search?unionId=2647&projectName=VBGAKNJB&content=${item.antChainHash}` `https://chaininsight.antdigital.com/search?unionId=2647&projectName=VBGAKNJB&content=${item.antChainHash}`
) )
@@ -107,13 +77,26 @@
<script> <script>
import Header from "@/components/header.vue"; import Header from "@/components/header.vue";
import { copyData } from "@/utils/index.js"; import {
import { getExchTransferRecord, getAcctBalance } from "@/api/finance.js"; copyData
import { formatDate } from "@/utils/index.js"; } from "@/utils/index.js";
import { RWA_STATUS, getValue } from "@/utils/enumUtils.js"; import {
import QrcodePreview from "@/pages/rwa_package/rwa_withdrawal_log/qrcode-preview.vue"; getExchTransferRecord,
getAcctBalance
} from "@/api/finance.js";
import {
formatDate
} from "@/utils/index.js";
import {
RWA_STATUS,
getValue
} from "@/utils/enumUtils.js";
import QrcodePreview from "@/pages/rwa_package/component/qrcode-preview.vue";
export default { export default {
components: { Header, QrcodePreview }, components: {
Header,
QrcodePreview
},
computed: { computed: {
RWA_STATUS() { RWA_STATUS() {
return RWA_STATUS; return RWA_STATUS;
@@ -252,15 +235,18 @@ export default {
._content_item_no_buto { ._content_item_no_buto {
border-bottom: 1rpx solid #eeeeee; border-bottom: 1rpx solid #eeeeee;
} }
.code_content { .code_content {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
.code_content_item { .code_content_item {
font-size: 20rpx; font-size: 20rpx;
color: #7934f6; color: #7934f6;
display: flex; display: flex;
align-items: center; align-items: center;
.code_content_item_text { .code_content_item_text {
width: 350rpx; width: 350rpx;
overflow: hidden; overflow: hidden;
@@ -271,6 +257,7 @@ export default {
} }
} }
} }
._content_item_but { ._content_item_but {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
+58 -25
View File
@@ -1,5 +1,4 @@
import { feedback } from '@/api/payment.js'; import { feedback } from "@/api/payment.js";
/** /**
* 微信支付 * 微信支付
@@ -10,33 +9,62 @@ import { feedback } from '@/api/payment.js';
export function appWxpayFun(alipay, orderId, orderNum) { export function appWxpayFun(alipay, orderId, orderNum) {
const type = alipay.type; const type = alipay.type;
const orderStr = alipay.orderStr; const orderStr = alipay.orderStr;
console.log("微信支付---",alipay) console.log("微信支付---", alipay,type);
if (type === "app") {// app if (type === "app") {
// app
const orderInfo = { const orderInfo = {
"appid": alipay.appId, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致 appid: alipay.appId, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
"noncestr": alipay.nonceStr, // 随机字符串 noncestr: alipay.nonceStr, // 随机字符串
"package": "Sign=WXPay", // 固定值 package: "Sign=WXPay", // 固定值
"partnerid": alipay.partnerId, // 微信支付商户号 partnerid: alipay.partnerId, // 微信支付商户号
"prepayid": alipay.prepayId, // 统一下单订单号 prepayid: alipay.prepayId, // 统一下单订单号
"timestamp": alipay.timeStamp, // 时间戳(单位:秒) timestamp: alipay.timeStamp, // 时间戳(单位:秒)
"sign": alipay.sign // 签名,这里用的 MD5/RSA 签名 sign: alipay.sign, // 签名,这里用的 MD5/RSA 签名
}; };
uni.requestPayment({ uni.requestPayment({
provider: "wxpay", provider: "wxpay",
orderInfo: orderInfo, orderInfo: orderInfo,
success: function (res) { success: function (res) {
console.log('success:' + res); console.log("success:" + res);
payFeedbackFun(orderId, orderNum, 1); payFeedbackFun(orderId, orderNum, 1);
jumpWayOk(); jumpWayOk();
}, },
fail: function (err) { fail: function (err) {
console.log('fail:', err); console.log("fail:", err);
jumpWayError(); jumpWayError();
} },
}); });
} else if (type === "h5") {// h5 } else if (type === "wechatMiniProgram") {
const orderInfo = {
// "appid": alipay.appId, // 微信开放平台 - 应用 - AppId,注意和微信小程序、公众号 AppId 可能不一致
nonceStr: alipay.nonceStr, // 微信支付商户号
package: alipay.packageValue, // 统一下单订单号
timeStamp: alipay.timeStamp, // 时间戳(单位:秒)
signType: "RSA",
paySign: alipay.sign, // 签名,这里用的 MD5/RSA 签名
};
console.log("微信小程序支付---", orderInfo);
uni.requestPayment({
...orderInfo,
success: function (res) {
console.log("success:" + res);
payFeedbackFun(orderId, orderNum, 1);
jumpWayOk();
},
fail: function (err) {
console.log("fail:", err);
jumpWayError();
},
});
} else if (type === "h5") {
// h5
uni.navigateTo({ uni.navigateTo({
url: `/pages/other_package/payment_processing/payment_processing?link=${encodeURIComponent(orderStr)}&orderNum=` + orderNum // 假设有一个专门的支付页面来处理支付链接 url:
`/pages/other_package/payment_processing/payment_processing?link=${encodeURIComponent(
orderStr
)}&orderNum=` + orderNum, // 假设有一个专门的支付页面来处理支付链接
}); });
} }
} }
@@ -51,13 +79,18 @@ export function zfbPayFun(alipay, orderId, orderNum) {
console.log("alipay", alipay); console.log("alipay", alipay);
const type = alipay.type; const type = alipay.type;
const orderStr = alipay.orderStr; const orderStr = alipay.orderStr;
if (type === "h5") {// h5 if (type === "h5") {
// h5
uni.navigateTo({ uni.navigateTo({
url: `/pages/other_package/payment_processing/payment_processing?link=${encodeURIComponent(orderStr)}&orderNum=` + orderNum // 假设有一个专门的支付页面来处理支付链接 url:
`/pages/other_package/payment_processing/payment_processing?link=${encodeURIComponent(
orderStr
)}&orderNum=` + orderNum, // 假设有一个专门的支付页面来处理支付链接
}); });
} else if (type === "app") { // app } else if (type === "app") {
// app
uni.requestPayment({ uni.requestPayment({
provider: 'alipay', provider: "alipay",
orderInfo: orderStr, orderInfo: orderStr,
success: function (res) { success: function (res) {
console.log("zfbPayFun res", res); console.log("zfbPayFun res", res);
@@ -67,26 +100,26 @@ export function zfbPayFun(alipay, orderId, orderNum) {
fail: function (err) { fail: function (err) {
console.error("支付宝支付error", err); console.error("支付宝支付error", err);
jumpWayError(); jumpWayError();
} },
}); });
} }
// return new Promise((resolve, reject) => { // return new Promise((resolve, reject) => {
// resolve(res); // resolve(res);
// // reject(err); // // reject(err);
// }); // });
}; }
// 跳转到支付成功页面 // 跳转到支付成功页面
export function jumpWayOk() { export function jumpWayOk() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/order_package/order_submit_ok/order_submit_ok", url: "/pages/order_package/order_submit_ok/order_submit_ok",
}) });
} }
// 跳转到支付失败页面 // 跳转到支付失败页面
export function jumpWayError() { export function jumpWayError() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/order_package/order_submit_error/order_submit_error", url: "/pages/order_package/order_submit_error/order_submit_error",
}) });
} }
/** /**
* 支付结果回调 * 支付结果回调
@@ -99,7 +132,7 @@ async function payFeedbackFun(orderId, orderNum, status) {
orderId, orderId,
orderNum, orderNum,
status, status,
} };
console.log("params", params); console.log("params", params);
const response = await feedback(params); const response = await feedback(params);
console.log("payFeedbackFun response", response); console.log("payFeedbackFun response", response);