| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311 |
- <template>
- <view class="content">
- <view class="inner y-bc">
- <view class="box-img y-bc">
- <image src="@/static/images/wallet/withdrawal_successful.png"></image>
- <view class="title">{{statusTitle}}</view>
- <text class="desc">{{statusDesc}}</text>
- </view>
- <view class="btn-box">
- <view class="btn" @click="navTo">提现记录</view>
- <view class="btn back" v-if="canConfirmReceipt" @click="confirmReceipt">确认收款</view>
- <view class="btn back" v-if="canWithdrawAgain" @click="withdrawAgain">再次提现</view>
- <view class="btn back" v-if="!canWithdrawAgain && !canConfirmReceipt" @click="goBack()">返回</view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import {getRedPacketLogByCode} from '@/api/integral.js'
- export default {
- data() {
- return {
- order:null,
- orderCode: null,
- wxMerchantTransfer:null,
- }
- },
- computed: {
- // 根据订单状态显示标题
- statusTitle() {
- if (!this.order || this.order.status === undefined) {
- return '提现申请成功';
- }
- const status = Number(this.order.status);
- //console.log("提现状态",this.order.status,status)
- // -3取消中 -2取消 -1失败 0发送中 1已发送 2取消 3转账处理中 4待收款用户确认 5转账结果尚未明确
- if (status === -3) {
- return '取消中';
- } else if (status === -2 || status === 2) {
- return '已取消';
- } else if (status === -1) {
- return '提现失败';
- } else if (status === 0) {
- return '发送中';
- } else if (status === 1) {
- return '提现申请成功';
- } else if (status === 3) {
- return '转账处理中';
- } else if (status === 4) {
- return '待确认收款';
- } else if (status === 5) {
- return '待确认收款';
- } else {
- return '提现申请成功';
- }
- },
- // 根据订单状态显示描述
- statusDesc() {
- if (!this.order || this.order.status === undefined) {
- return '预计两小时到账';
- }
- const status = Number(this.order.status);
- if (status === -3) {
- return this.order.remark || '提现正在取消中';
- } else if (status === -2 || status === 2) {
- return this.order.remark || '提现已取消';
- } else if (status === -1) {
- return this.order.remark || '提现失败,请重试';
- } else if (status === 0) {
- return this.order.remark || '提现请求已发送,正在处理中';
- } else if (status === 1) {
- return this.order.remark || '预计两小时到账';
- } else if (status === 3) {
- return this.order.remark || '转账正在处理中,请稍候';
- } else if (status === 4) {
- return '待收款确认,请在24小时内确认收款';
- } else if (status === 5) {
- return '转账结果尚未明确,请在24小时内确认收款';
- } else {
- return '预计两小时到账';
- }
- },
- // 是否可以再次提现(失败、取消等状态可以再次提现)
- canWithdrawAgain() {
- if (!this.order || this.order.status === undefined) {
- return false;
- }
- const status = Number(this.order.status);
- // 失败(-1)、取消(-2,2)状态可以再次提现
- return status === -1 || status === -2 || status === 2;
- },
- // 是否可以确认收款(状态4和5可以拉起微信收款确认页面)
- canConfirmReceipt() {
- if (!this.order || this.order.status === undefined) {
- return false;
- }
- const status = Number(this.order.status);
- // 状态4和5可以确认收款
- return status === 4 || status === 5;
- }
- },
- onLoad(option) {
- // 兼容旧的order参数
- if (option.order) {
- try {
- this.order = JSON.parse(option.order);
- } catch (e) {
- console.error('解析order参数失败:', e);
- }
- }
- // 获取orderCode参数
- if (option.orderCode) {
- this.orderCode = option.orderCode;
- // 确认收款后查询订单状态
- this.getRedPacketLogByCode(option.orderCode);
- }
- this.wxMerchantTransfer = uni.requireNativePlugin('wxMerchantTransfer');
- },
- onShow() {
- // 如果页面显示时已有orderCode,再次查询订单状态(用户从微信返回时)
- if (this.orderCode) {
- this.getRedPacketLogByCode(this.orderCode);
- }
- },
- methods: {
- // 查询订单状态
- getRedPacketLogByCode(code) {
- if (!code) return;
- getRedPacketLogByCode({ orderCode: code }).then(res => {
- if (res.code == 200) {
- //console.log("订单状态查询结果:", res);
- // 可以根据订单状态更新UI或进行其他操作
- if (res.data) {
- this.order = res.data;
- }
- } else {
- console.warn("查询订单状态失败:", res.msg);
- }
- }, err => {
- console.error("查询订单状态错误:", err);
- });
- },
- goBack() {
- uni.navigateBack()
- },
- navTo(){
- uni.navigateTo({
- url:'/pages/user/wallet/recordList'
- })
- },
- copyOrderSn(text) {
- // 复制方法
- uni.setClipboardData({
- data:text,
- success:()=>{
- uni.showToast({
- title:'内容已成功复制到剪切板',
- icon:'none'
- })
- }
- });
- },
- goOrderDetails(id){
- uni.redirectTo({
- url: "/pages_user/user/storeOrderDetail?id="+id
- })
- },
- // 再次提现
- withdrawAgain() {
- uni.navigateBack();
- },
- // 确认收款(拉起微信收款确认页面)
- confirmReceipt() {
- if (!this.order) {
- uni.showToast({
- title: '订单信息不完整',
- icon: 'none'
- });
- return;
- }
- const appId = this.order.appId;
- const mchId = this.order.mchId;
- const packageValue = this.order.packageInfo;
- if (!appId || !mchId || !packageValue) {
- uni.showToast({
- title: '缺少必要参数,无法确认收款',
- icon: 'none'
- });
- return;
- }
-
- // #ifdef APP-PLUS
- const params = {
- appId: String(appId),
- mchId: String(mchId),
- package: String(packageValue)
- };
- console.log('拉起微信收款确认页面,参数:', params);
- this.wxMerchantTransfer.open(params, (res) => {
- console.log('确认收款回调结果:', res);
- if (res.code === 0) {
- // 确认收款成功,重新查询订单状态
- if (this.orderCode) {
- setTimeout(() => {
- this.getRedPacketLogByCode(this.orderCode);
- }, 1000);
- }
- } else if (res.code === -3) {
- const resultMessage = (res.message || '').toLowerCase();
- if (resultMessage.includes('not installed') || resultMessage.includes('未安装')) {
- uni.showModal({
- title: '提示',
- content: '请先安装微信客户端',
- showCancel: false
- });
- } else {
- uni.showModal({
- title: '提示',
- content: res.message || '当前微信版本不支持,请升级后重试',
- showCancel: false
- });
- }
- } else {
- uni.showModal({
- title: '确认收款失败',
- content: res.message || '请稍后重试',
- showCancel: false
- });
- }
- });
-
-
-
- // #endif
-
- // #ifndef APP-PLUS
- uni.showToast({
- icon: 'none',
- title: '此功能仅在 APP 中可用',
- });
- // #endif
- }
- }
- }
- </script>
- <style lang="scss">
- page{
- height: 100%;
- background-color: #FFFFFF;
- }
- .content{
- height: 100%;
- display: flex;
- flex-direction: column;
- justify-content:flex-start;
- .inner{
- padding:24rpx;
- image{
- width: 224rpx;
- height: 160rpx;
- }
- .box-img{
- margin-top: 160rpx;
- .title{
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 48rpx;
- color: #222222;
- margin-top: 64rpx;
- margin-bottom: 10rpx;
- }
- .desc{
- font-family: PingFang SC, PingFang SC;
- font-weight: 500;
- font-size: 28rpx;
- color: #757575;
- }
- }
- }
- .btn-box{
- margin-top:60rpx;
- box-sizing: border-box;
- display: flex;
- align-items: center;
- justify-content: center;
- flex-wrap: wrap;
- gap: 24rpx;
- .btn{
- min-width: 254rpx;
- height: 88rpx;
- padding: 0 32rpx;
- border-radius: 44rpx 44rpx 44rpx 44rpx;
- border: 2rpx solid #FF5C03;
- display: flex;
- align-items: center;
- justify-content: center;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 32rpx;
- color: #FF5C03;
- &.back{
- background: #FF5C03;
- color: #fff;
- }
- }
- }
- }
-
- </style>
|