1534 行
41 KiB
Vue
1534 行
41 KiB
Vue
<!-- 收银台页面 -->
|
||
<template>
|
||
<s-layout title="收银台" :bgStyle="{ color: '#f6f7fb' }">
|
||
<view class="cashier-container">
|
||
<!-- 1. 顶部待支付金额卡片 -->
|
||
<view class="amount-card ss-flex-col ss-col-center">
|
||
<view class="amount-label">{{ currentAmountLabel }}</view>
|
||
<view class="amount-val-wrap ss-flex ss-col-bottom ss-row-center">
|
||
<text class="currency-symbol">¥</text>
|
||
<text class="amount-integer">{{ priceParts.integer }}</text>
|
||
<text class="amount-decimal">.{{ priceParts.decimal }}</text>
|
||
</view>
|
||
|
||
<!-- 倒计时胶囊 / 状态提示 -->
|
||
<view class="status-capsule-wrap ss-m-t-20">
|
||
<view
|
||
class="status-capsule ticking ss-flex ss-col-center"
|
||
v-if="state.payStatus === 1 && countdownStr"
|
||
>
|
||
<text class="cicon-alarm ss-m-r-8"></text>
|
||
<text class="capsule-text">支付剩余时间 {{ countdownStr }}</text>
|
||
</view>
|
||
<view
|
||
class="status-capsule expired ss-flex ss-col-center"
|
||
v-else-if="state.payStatus === -1"
|
||
>
|
||
<text class="cicon-info ss-m-r-8"></text>
|
||
<text class="capsule-text">订单支付已超时失效</text>
|
||
</view>
|
||
<view
|
||
class="status-capsule paid ss-flex ss-col-center"
|
||
v-else-if="state.payStatus === 2"
|
||
>
|
||
<text class="cicon-check-round ss-m-r-8"></text>
|
||
<text class="capsule-text">该订单已支付成功</text>
|
||
</view>
|
||
<view
|
||
class="status-capsule loading ss-flex ss-col-center"
|
||
v-else-if="state.payStatus === 0"
|
||
>
|
||
<text class="cicon-loading ss-m-r-8"></text>
|
||
<text class="capsule-text">正在检测支付环境...</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 订单详情微信息栏 -->
|
||
<view
|
||
class="order-meta-box ss-flex-col ss-m-t-28"
|
||
v-if="state.orderInfo.order_sn"
|
||
>
|
||
<view class="order-meta-row ss-flex ss-row-between ss-col-center">
|
||
<text class="meta-label">订单编号</text>
|
||
<view class="meta-val-box ss-flex ss-col-center">
|
||
<text class="meta-sn">{{ state.orderInfo.order_sn }}</text>
|
||
<button
|
||
class="ss-reset-button copy-btn ss-flex ss-col-center"
|
||
@tap="onCopyOrderSn"
|
||
>
|
||
<text class="cicon-copy-o ss-m-r-4"></text>
|
||
<text>复制</text>
|
||
</button>
|
||
</view>
|
||
</view>
|
||
<view
|
||
class="order-meta-row ss-flex ss-row-between ss-col-center ss-m-t-12"
|
||
v-if="orderSubject"
|
||
>
|
||
<text class="meta-label">订单内容</text>
|
||
<text class="meta-val ellipsis-1">{{ orderSubject }}</text>
|
||
</view>
|
||
<!-- 历史已付金额明细 -->
|
||
<view
|
||
class="order-meta-row ss-flex ss-row-between ss-col-center ss-m-t-12"
|
||
v-if="alreadyPaidFee > 0"
|
||
>
|
||
<text class="meta-label">已付金额</text>
|
||
<text class="meta-val text-success font-bold">¥{{ alreadyPaidFee.toFixed(2) }}</text>
|
||
</view>
|
||
<!-- 开启混合支付时的抵扣明细 -->
|
||
<view
|
||
class="order-meta-row ss-flex ss-row-between ss-col-center ss-m-t-12"
|
||
v-if="isMixedPaySupported && useMixedPay && deductMoney > 0"
|
||
>
|
||
<text class="meta-label">余额抵扣</text>
|
||
<text class="meta-val text-orange font-bold">-¥{{ deductMoney.toFixed(2) }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 2. 支付方式选择卡片 -->
|
||
<view class="payment-card">
|
||
<view class="card-header ss-flex ss-row-between ss-col-center">
|
||
<view class="header-left ss-flex ss-col-center">
|
||
<view class="accent-bar"></view>
|
||
<text class="header-title">选择支付方式</text>
|
||
</view>
|
||
<view class="header-right ss-flex ss-col-center">
|
||
<text class="cicon-safe-check-o safe-icon"></text>
|
||
<text class="safe-text">官方通道安全保障</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 余额不足全额支付时:专属余额混合支付抵扣卡片 -->
|
||
<view
|
||
class="mixed-pay-card ss-flex ss-row-between ss-col-center ss-m-t-24"
|
||
v-if="isMixedPaySupported"
|
||
>
|
||
<view class="mixed-left ss-flex ss-col-center">
|
||
<view class="mixed-icon-wrap ss-flex ss-row-center ss-col-center">
|
||
<image
|
||
class="mixed-icon-img"
|
||
:src="sheep.$url.static('/assets/addons/shopro/uniapp/pay/wallet.png')"
|
||
mode="aspectFit"
|
||
></image>
|
||
</view>
|
||
<view class="mixed-info ss-flex-col">
|
||
<view class="mixed-title-row ss-flex ss-col-center">
|
||
<text class="mixed-title">余额混合支付</text>
|
||
<text class="mixed-tag">组合立省</text>
|
||
</view>
|
||
<text class="mixed-desc">
|
||
可用余额 ¥{{ userBalance.toFixed(2) }},本单可抵扣 ¥{{ deductMoney.toFixed(2) }}
|
||
</text>
|
||
</view>
|
||
</view>
|
||
<view class="mixed-right ss-flex ss-col-center">
|
||
<switch
|
||
:checked="useMixedPay"
|
||
@change="onToggleMixedPay"
|
||
color="var(--ui-BG-Main, #ff3000)"
|
||
style="transform: scale(0.8); transform-origin: right center;"
|
||
/>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 支付列表 -->
|
||
<view class="payment-list">
|
||
<view
|
||
class="pay-option-item ss-flex ss-row-between ss-col-center"
|
||
:class="{
|
||
'is-active': state.payment === item.value,
|
||
'is-disabled': item.disabled,
|
||
}"
|
||
v-for="item in visiblePayMethods"
|
||
:key="item.value"
|
||
@tap="onSelectPay(item)"
|
||
>
|
||
<!-- 左侧品牌与信息 -->
|
||
<view class="method-left ss-flex ss-col-center">
|
||
<image
|
||
class="method-icon"
|
||
:src="
|
||
item.disabled
|
||
? sheep.$url.static(
|
||
'/assets/addons/shopro/uniapp/pay/cod_disabled.png',
|
||
)
|
||
: sheep.$url.static(item.icon)
|
||
"
|
||
mode="aspectFit"
|
||
></image>
|
||
|
||
<view class="method-info ss-flex-col">
|
||
<view class="title-row ss-flex ss-col-center">
|
||
<text class="method-title">{{ item.title }}</text>
|
||
<!-- 微信支付推荐标签 -->
|
||
<text
|
||
class="method-tag recommend-tag"
|
||
v-if="item.value === 'wechat' && isWechatEnv"
|
||
>
|
||
推荐
|
||
</text>
|
||
<!-- 混合支付下第三方需补足金额标签 -->
|
||
<text
|
||
class="method-tag mixed-amount-tag"
|
||
v-if="isMixedPaySupported && useMixedPay && ['wechat', 'alipay', 'apple'].includes(item.value)"
|
||
>
|
||
需付 ¥{{ thirdPayFee.toFixed(2) }}
|
||
</text>
|
||
</view>
|
||
|
||
<!-- 余额支付专享余额状态展示 -->
|
||
<view
|
||
class="balance-info-row ss-flex ss-col-center ss-m-t-8"
|
||
v-if="item.value === 'money'"
|
||
>
|
||
<text class="balance-text"
|
||
>当前余额: ¥{{ userBalance.toFixed(2) }}</text
|
||
>
|
||
|
||
<!-- 余额充足 -->
|
||
<view
|
||
class="balance-badge success ss-flex ss-col-center"
|
||
v-if="isBalanceEnough"
|
||
>
|
||
<text class="cicon-check ss-m-r-4"></text>
|
||
<text>余额充足</text>
|
||
</view>
|
||
|
||
<!-- 混合支付抵扣中 -->
|
||
<view
|
||
class="balance-badge mixed ss-flex ss-col-center"
|
||
v-else-if="isMixedPaySupported && useMixedPay"
|
||
>
|
||
<text class="cicon-check ss-m-r-4"></text>
|
||
<text>已启用抵扣</text>
|
||
</view>
|
||
|
||
<!-- 余额不足 -->
|
||
<view
|
||
class="balance-badge danger ss-flex ss-col-center"
|
||
v-else
|
||
>
|
||
<text class="cicon-info ss-m-r-4"></text>
|
||
<text>余额不足</text>
|
||
</view>
|
||
|
||
<!-- 快捷充值引导入口 -->
|
||
<view
|
||
class="recharge-link-btn ss-flex ss-col-center ss-m-l-10"
|
||
v-if="!isBalanceEnough && canRecharge"
|
||
@tap.stop="onGoRecharge"
|
||
>
|
||
<text>去充值</text>
|
||
<text class="cicon-forward"></text>
|
||
</view>
|
||
|
||
<!-- 快捷开启混合支付入口 -->
|
||
<view
|
||
class="mixed-link-btn ss-flex ss-col-center ss-m-l-10"
|
||
v-if="isMixedPaySupported && !useMixedPay"
|
||
@tap.stop="onEnableMixedPay"
|
||
>
|
||
<text>开启混合支付</text>
|
||
<text class="cicon-forward"></text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 余额充足时的扣款提示 -->
|
||
<view
|
||
class="balance-deduct-tip ss-m-t-4"
|
||
v-if="item.value === 'money' && isBalanceEnough && remainPayFee > 0"
|
||
>
|
||
<text>支付后剩余 ¥{{ remainingBalance }}</text>
|
||
</view>
|
||
|
||
<!-- 其他支付通道副文案 -->
|
||
<view
|
||
class="method-desc ss-m-t-6"
|
||
v-if="item.value !== 'money'"
|
||
>
|
||
<text
|
||
v-if="item.value === 'offline' && item.disabled"
|
||
class="disabled-desc"
|
||
>
|
||
当前订单部分商品不支持货到付款
|
||
</text>
|
||
<text v-else>{{ item.subTitle }}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 右侧自定义单选标记 -->
|
||
<view class="method-right ss-flex ss-col-center">
|
||
<view
|
||
class="custom-check-box ss-flex ss-row-center ss-col-center"
|
||
:class="{
|
||
checked: state.payment === item.value,
|
||
disabled: item.disabled,
|
||
}"
|
||
>
|
||
<text
|
||
class="_icon-check"
|
||
v-if="state.payment === item.value"
|
||
></text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 3. 安全背书卡片 -->
|
||
<view class="security-banner ss-flex-col ss-col-center ss-row-center">
|
||
<view class="security-line ss-flex ss-col-center">
|
||
<text class="cicon-safe-check-o banner-icon"></text>
|
||
<text class="banner-title">恒联数通 · 全程资金安全支付保障</text>
|
||
</view>
|
||
<text class="banner-sub ss-m-t-8"
|
||
>官方持牌支付通道 · 银行级数据加密防护</text
|
||
>
|
||
</view>
|
||
|
||
<!-- 底部安全留白撑高 -->
|
||
<view class="footer-placeholder"></view>
|
||
|
||
<!-- 4. 底部吸底结算操作栏 -->
|
||
<view class="fixed-footer ss-flex ss-col-center ss-row-between">
|
||
<button
|
||
class="ss-reset-button pay-action-btn ss-flex ss-row-center ss-col-center"
|
||
:class="{
|
||
'btn-disabled': isButtonDisabled,
|
||
'btn-warning':
|
||
state.payment === 'money' &&
|
||
!isBalanceEnough &&
|
||
state.payStatus === 1,
|
||
}"
|
||
:disabled="isButtonDisabled"
|
||
@tap="onPay"
|
||
>
|
||
<text
|
||
class="cicon-loading ss-m-r-10 rotating"
|
||
v-if="state.isSubmitting"
|
||
></text>
|
||
<text>{{ payButtonText }}</text>
|
||
</button>
|
||
</view>
|
||
</view>
|
||
</s-layout>
|
||
</template>
|
||
<script setup>
|
||
import { computed, reactive, ref, onUnmounted } from "vue";
|
||
import { onLoad, onShow, onHide, onUnload } from "@dcloudio/uni-app";
|
||
import sheep from "@/sheep";
|
||
import { cloneDeep } from "lodash";
|
||
|
||
// 1. 用户信息与余额相关计算
|
||
const userInfo = computed(() => sheep.$store("user").userInfo || {});
|
||
const userBalance = computed(() => {
|
||
const m = parseFloat(userInfo.value.money);
|
||
return isNaN(m) ? 0 : m;
|
||
});
|
||
|
||
// 订单原始总应付金额
|
||
const payTotalFee = computed(() => {
|
||
const f = parseFloat(state.orderInfo?.pay_fee);
|
||
return isNaN(f) ? 0 : f;
|
||
});
|
||
|
||
// 订单当前剩余应付金额
|
||
const remainPayFee = computed(() => {
|
||
const rf =
|
||
state.orderInfo?.remain_pay_fee !== undefined
|
||
? parseFloat(state.orderInfo.remain_pay_fee)
|
||
: parseFloat(state.orderInfo?.pay_fee);
|
||
return isNaN(rf) ? 0 : Math.max(0, rf);
|
||
});
|
||
|
||
// 历史已付金额
|
||
const alreadyPaidFee = computed(() => {
|
||
const diff = payTotalFee.value - remainPayFee.value;
|
||
return diff > 0 ? diff : 0;
|
||
});
|
||
|
||
// 余额是否充足(是否可全额支付当前剩余待付金额)
|
||
const isBalanceEnough = computed(() => {
|
||
return userBalance.value >= remainPayFee.value && remainPayFee.value > 0;
|
||
});
|
||
|
||
// 扣减后剩余余额(若全额使用余额支付)
|
||
const remainingBalance = computed(() => {
|
||
const rem = userBalance.value - remainPayFee.value;
|
||
return rem >= 0 ? rem.toFixed(2) : "0.00";
|
||
});
|
||
|
||
// 是否支持混合支付:商品订单、有可用余额但不足以全额付清、且剩余待付款大于0
|
||
const isMixedPaySupported = computed(() => {
|
||
return (
|
||
state.orderType === "goods" &&
|
||
userBalance.value > 0 &&
|
||
userBalance.value < remainPayFee.value &&
|
||
remainPayFee.value > 0
|
||
);
|
||
});
|
||
|
||
// 用户是否启用混合支付开关(满足条件时默认开启)
|
||
const useMixedPay = ref(true);
|
||
|
||
// 混合支付下抵扣的余额金额
|
||
const deductMoney = computed(() => {
|
||
if (!isMixedPaySupported.value || !useMixedPay.value) return 0;
|
||
return Math.min(userBalance.value, remainPayFee.value);
|
||
});
|
||
|
||
// 混合支付下第三方渠道需补足支付的金额
|
||
const thirdPayFee = computed(() => {
|
||
const diff = remainPayFee.value - deductMoney.value;
|
||
return diff > 0 ? diff : 0;
|
||
});
|
||
|
||
// 顶部卡片展示的当前待付金额
|
||
const currentDueFee = computed(() => {
|
||
if (isMixedPaySupported.value && useMixedPay.value && deductMoney.value > 0) {
|
||
return thirdPayFee.value;
|
||
}
|
||
return remainPayFee.value;
|
||
});
|
||
|
||
// 顶部金额标题
|
||
const currentAmountLabel = computed(() => {
|
||
if (isMixedPaySupported.value && useMixedPay.value && deductMoney.value > 0) {
|
||
return "在线待付金额";
|
||
}
|
||
if (alreadyPaidFee.value > 0) {
|
||
return "剩余应付金额";
|
||
}
|
||
return "应付金额";
|
||
});
|
||
|
||
// 金额拆分整数与小数
|
||
const priceParts = computed(() => {
|
||
const num = currentDueFee.value;
|
||
if (isNaN(num)) return { integer: "0", decimal: "00" };
|
||
const str = num.toFixed(2);
|
||
const parts = str.split(".");
|
||
return {
|
||
integer: parts[0] || "0",
|
||
decimal: parts[1] || "00",
|
||
};
|
||
});
|
||
|
||
// 运行环境检测
|
||
const isWechatEnv = computed(() => {
|
||
return ["WechatMiniProgram", "WechatOfficialAccount"].includes(
|
||
sheep.$platform.name,
|
||
);
|
||
});
|
||
|
||
// 是否支持充值功能
|
||
const canRecharge = computed(() => {
|
||
const rechargePayment = sheep.$store("app").platform.recharge_payment || [];
|
||
return rechargePayment.length > 0;
|
||
});
|
||
|
||
// 2. 页面响应式状态
|
||
const state = reactive({
|
||
orderId: "",
|
||
orderType: "goods", // goods=商品订单, recharge=充值订单
|
||
payment: "", // 当前选中的支付通道
|
||
orderInfo: {}, // 订单详情
|
||
payStatus: 0, // 0=检测中, 1=待支付, -1=已过期, -2=未查询到订单, 2=已支付
|
||
isSubmitting: false, // 是否正在提交支付
|
||
payMethods: [], // 支付方式配置列表
|
||
loading: false,
|
||
});
|
||
|
||
// 允许的支付方式配置
|
||
const allowedPayment = computed(() => {
|
||
if (state.orderType === "recharge") {
|
||
return sheep.$store("app").platform.recharge_payment || [];
|
||
}
|
||
return sheep.$store("app").platform.payment || [];
|
||
});
|
||
|
||
// 初始支付方式模板
|
||
const initialPayMethods = [
|
||
{
|
||
icon: "/assets/addons/shopro/uniapp/pay/wechat.png",
|
||
title: "微信支付",
|
||
subTitle: "微信快捷支付 · 安全省心",
|
||
value: "wechat",
|
||
disabled: false,
|
||
},
|
||
{
|
||
icon: "/assets/addons/shopro/uniapp/pay/alipay.png",
|
||
title: "支付宝支付",
|
||
subTitle: "数亿用户的快捷支付首选",
|
||
value: "alipay",
|
||
disabled: false,
|
||
},
|
||
{
|
||
icon: "/assets/addons/shopro/uniapp/pay/wallet.png",
|
||
title: "余额支付",
|
||
subTitle: "使用账户可用余额直接抵扣",
|
||
value: "money",
|
||
disabled: false,
|
||
},
|
||
{
|
||
icon: "/assets/addons/shopro/uniapp/pay/apple.png",
|
||
title: "Apple Pay",
|
||
subTitle: "Apple 专属极速支付通道",
|
||
value: "apple",
|
||
disabled: false,
|
||
},
|
||
{
|
||
icon: "/assets/addons/shopro/uniapp/pay/cod.png",
|
||
title: "货到付款",
|
||
subTitle: "送货上门 · 现场验货付款",
|
||
value: "offline",
|
||
disabled: false,
|
||
},
|
||
];
|
||
|
||
// 过滤后的可视支付通道
|
||
const visiblePayMethods = computed(() => {
|
||
return state.payMethods.filter((item) =>
|
||
allowedPayment.value.includes(item.value),
|
||
);
|
||
});
|
||
|
||
// 订单内容文案摘要
|
||
const orderSubject = computed(() => {
|
||
if (state.orderType === "recharge") {
|
||
return "账户钱包余额充值";
|
||
}
|
||
const items = state.orderInfo?.items;
|
||
if (Array.isArray(items) && items.length > 0) {
|
||
const firstItem = items[0];
|
||
const title = firstItem.goods_title || firstItem.title || "商品";
|
||
if (items.length === 1) {
|
||
return title;
|
||
}
|
||
return `${title} 等共 ${items.length} 件商品`;
|
||
}
|
||
return state.orderInfo.order_title || "商城商品订单";
|
||
});
|
||
|
||
// 支付方式名称映射
|
||
function getMethodTitle(val) {
|
||
const map = {
|
||
wechat: "微信支付",
|
||
alipay: "支付宝",
|
||
money: "余额支付",
|
||
apple: "Apple Pay",
|
||
offline: "货到付款",
|
||
};
|
||
return map[val] || "在线支付";
|
||
}
|
||
|
||
// 3. 实时平滑倒计时逻辑
|
||
let countdownTimer = null;
|
||
const countdownStr = ref("");
|
||
|
||
function startCountdown(expiredTime) {
|
||
stopCountdown();
|
||
|
||
if (!expiredTime || expiredTime === 0) {
|
||
countdownStr.value = "";
|
||
return;
|
||
}
|
||
|
||
let targetTime = Number(expiredTime);
|
||
// 兼容 10 位时间戳(秒)和 13 位时间戳(毫秒)
|
||
if (targetTime < 10000000000) {
|
||
targetTime *= 1000;
|
||
}
|
||
|
||
const calcTime = () => {
|
||
const now = Date.now();
|
||
const diff = Math.floor((targetTime - now) / 1000);
|
||
|
||
if (diff <= 0) {
|
||
countdownStr.value = "00:00";
|
||
state.payStatus = -1; // 超时失效
|
||
stopCountdown();
|
||
return;
|
||
}
|
||
|
||
const h = Math.floor(diff / 3600);
|
||
const m = Math.floor((diff % 3600) / 60);
|
||
const s = diff % 60;
|
||
|
||
const pad = (n) => String(n).padStart(2, "0");
|
||
if (h > 0) {
|
||
countdownStr.value = `${pad(h)}:${pad(m)}:${pad(s)}`;
|
||
} else {
|
||
countdownStr.value = `${pad(m)}:${pad(s)}`;
|
||
}
|
||
};
|
||
|
||
calcTime();
|
||
countdownTimer = setInterval(calcTime, 1000);
|
||
}
|
||
|
||
function stopCountdown() {
|
||
if (countdownTimer) {
|
||
clearInterval(countdownTimer);
|
||
countdownTimer = null;
|
||
}
|
||
}
|
||
|
||
// 4. 智能选择默认支付方式
|
||
function autoSelectPayment() {
|
||
const list = visiblePayMethods.value.filter((item) => !item.disabled);
|
||
if (!list.length) {
|
||
state.payment = "";
|
||
return;
|
||
}
|
||
|
||
// 若开启了混合支付,优先确保选择有效的第三方通道(非 money)
|
||
if (isMixedPaySupported.value && useMixedPay.value) {
|
||
if (
|
||
state.payment &&
|
||
state.payment !== "money" &&
|
||
list.some((item) => item.value === state.payment)
|
||
) {
|
||
return;
|
||
}
|
||
|
||
if (isWechatEnv.value) {
|
||
const wechatItem = list.find((item) => item.value === "wechat");
|
||
if (wechatItem) {
|
||
state.payment = "wechat";
|
||
return;
|
||
}
|
||
}
|
||
|
||
const alipayItem = list.find((item) => item.value === "alipay");
|
||
if (alipayItem) {
|
||
state.payment = "alipay";
|
||
return;
|
||
}
|
||
|
||
const nonMoneyItem = list.find((item) => item.value !== "money");
|
||
if (nonMoneyItem) {
|
||
state.payment = nonMoneyItem.value;
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 若当前已选中的支付方式依然可用且非禁用
|
||
if (state.payment && list.some((item) => item.value === state.payment)) {
|
||
if (state.payment === "money" && !isBalanceEnough.value) {
|
||
const wechatItem = list.find((item) => item.value === "wechat");
|
||
if (wechatItem) {
|
||
state.payment = "wechat";
|
||
return;
|
||
}
|
||
}
|
||
return;
|
||
}
|
||
|
||
// 智能选择优先级 1:微信环境(小程序/公众号)且微信支付可用
|
||
if (isWechatEnv.value) {
|
||
const wechatItem = list.find((item) => item.value === "wechat");
|
||
if (wechatItem) {
|
||
state.payment = "wechat";
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 智能选择优先级 2:若余额充足且支持余额支付
|
||
if (isBalanceEnough.value) {
|
||
const moneyItem = list.find((item) => item.value === "money");
|
||
if (moneyItem) {
|
||
state.payment = "money";
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 智能选择优先级 3:微信支付
|
||
const wechatItem = list.find((item) => item.value === "wechat");
|
||
if (wechatItem) {
|
||
state.payment = "wechat";
|
||
return;
|
||
}
|
||
|
||
// 智能选择优先级 4:支付宝支付
|
||
const alipayItem = list.find((item) => item.value === "alipay");
|
||
if (alipayItem) {
|
||
state.payment = "alipay";
|
||
return;
|
||
}
|
||
|
||
// 智能选择优先级 5:若余额不足,避免首选余额,优先选择非余额通道
|
||
if (!isBalanceEnough.value) {
|
||
const nonMoneyItem = list.find((item) => item.value !== "money");
|
||
if (nonMoneyItem) {
|
||
state.payment = nonMoneyItem.value;
|
||
return;
|
||
}
|
||
}
|
||
|
||
// 兜底选择列表第一项
|
||
state.payment = list[0].value;
|
||
}
|
||
|
||
// 5. 混合支付开关与交互
|
||
function onToggleMixedPay(e) {
|
||
useMixedPay.value = e.detail.value;
|
||
if (useMixedPay.value) {
|
||
if (state.payment === "money") {
|
||
const nonMoney = visiblePayMethods.value.find(
|
||
(i) => !i.disabled && i.value !== "money",
|
||
);
|
||
if (nonMoney) {
|
||
state.payment =
|
||
isWechatEnv.value &&
|
||
visiblePayMethods.value.some((i) => i.value === "wechat")
|
||
? "wechat"
|
||
: nonMoney.value;
|
||
}
|
||
}
|
||
} else {
|
||
if (state.payment === "money" && !isBalanceEnough.value) {
|
||
sheep.$helper.toast("已关闭混合支付,当前可用余额不足以全额付款");
|
||
}
|
||
}
|
||
}
|
||
|
||
function onEnableMixedPay() {
|
||
useMixedPay.value = true;
|
||
if (state.payment === "money") {
|
||
const nonMoney = visiblePayMethods.value.find(
|
||
(i) => !i.disabled && i.value !== "money",
|
||
);
|
||
if (nonMoney) {
|
||
state.payment =
|
||
isWechatEnv.value &&
|
||
visiblePayMethods.value.some((i) => i.value === "wechat")
|
||
? "wechat"
|
||
: nonMoney.value;
|
||
}
|
||
}
|
||
sheep.$helper.toast("已开启余额混合支付");
|
||
}
|
||
|
||
// 6. 点击切换支付方式
|
||
function onSelectPay(item) {
|
||
if (item.disabled) {
|
||
if (item.value === "offline") {
|
||
sheep.$helper.toast("当前订单不支持货到付款");
|
||
}
|
||
return;
|
||
}
|
||
|
||
if (item.value === "money") {
|
||
if (isBalanceEnough.value) {
|
||
state.payment = "money";
|
||
return;
|
||
}
|
||
|
||
if (isMixedPaySupported.value) {
|
||
if (!useMixedPay.value) {
|
||
uni.showModal({
|
||
title: "混合支付推荐",
|
||
content: `当前可用余额 ¥${userBalance.value.toFixed(2)} 不足全额支付该订单(待付 ¥${remainPayFee.value.toFixed(2)})。是否启用【余额混合支付】抵扣 ¥${deductMoney.value.toFixed(2)},剩余 ¥${(remainPayFee.value - deductMoney.value).toFixed(2)} 通过微信/支付宝支付?`,
|
||
confirmText: "启用混合支付",
|
||
cancelText: "去充值",
|
||
confirmColor: "var(--ui-BG-Main, #ff3000)",
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
onEnableMixedPay();
|
||
} else {
|
||
onGoRecharge();
|
||
}
|
||
},
|
||
});
|
||
} else {
|
||
sheep.$helper.toast("已启用余额抵扣,请选择补足方式(如微信或支付宝)");
|
||
}
|
||
return;
|
||
}
|
||
|
||
sheep.$helper.toast("可用余额不足,可前往充值或切换支付方式");
|
||
return;
|
||
}
|
||
|
||
state.payment = item.value;
|
||
}
|
||
|
||
// 7. 复制订单号
|
||
function onCopyOrderSn() {
|
||
if (!state.orderInfo?.order_sn) return;
|
||
sheep.$helper.copyText(state.orderInfo.order_sn);
|
||
sheep.$helper.toast("订单号已复制");
|
||
}
|
||
|
||
// 8. 前往充值页面
|
||
function onGoRecharge() {
|
||
sheep.$router.go("/pages/pay/recharge");
|
||
}
|
||
|
||
// 9. 检查订单支付状态
|
||
function checkPayStatus() {
|
||
if (state.orderInfo.status === "unpaid") {
|
||
state.payStatus = 1;
|
||
if (state.orderInfo.ext?.expired_time) {
|
||
startCountdown(state.orderInfo.ext.expired_time);
|
||
}
|
||
return;
|
||
}
|
||
if (["closed", "cancel"].includes(state.orderInfo.status)) {
|
||
state.payStatus = -1;
|
||
return;
|
||
}
|
||
if (["paid", "completed"].includes(state.orderInfo.status)) {
|
||
state.payStatus = 2;
|
||
return;
|
||
}
|
||
state.payStatus = 2;
|
||
}
|
||
|
||
// 10. 获取充值订单信息
|
||
async function setRechargeOrder(id) {
|
||
state.loading = true;
|
||
try {
|
||
const { data, code } = await sheep.$api.trade.order(id);
|
||
if (code === 1) {
|
||
state.orderInfo = data || {};
|
||
state.payMethods = cloneDeep(initialPayMethods);
|
||
checkPayStatus();
|
||
autoSelectPayment();
|
||
} else {
|
||
state.payStatus = -2;
|
||
}
|
||
} catch (e) {
|
||
state.payStatus = -2;
|
||
} finally {
|
||
state.loading = false;
|
||
}
|
||
}
|
||
|
||
// 11. 获取商品订单信息
|
||
async function setGoodsOrder(id) {
|
||
state.loading = true;
|
||
try {
|
||
const { data, code } = await sheep.$api.order.detail(id);
|
||
if (code === 1) {
|
||
state.orderInfo = data || {};
|
||
const methods = cloneDeep(initialPayMethods);
|
||
|
||
// 货到付款状态控制
|
||
if (state.orderInfo.ext?.offline_status === "none") {
|
||
const offIdx = methods.findIndex((m) => m.value === "offline");
|
||
if (offIdx !== -1) methods.splice(offIdx, 1);
|
||
} else if (state.orderInfo.ext?.offline_status === "disabled") {
|
||
const off = methods.find((m) => m.value === "offline");
|
||
if (off) off.disabled = true;
|
||
}
|
||
|
||
state.payMethods = methods;
|
||
checkPayStatus();
|
||
autoSelectPayment();
|
||
} else {
|
||
state.payStatus = -2;
|
||
}
|
||
} catch (e) {
|
||
state.payStatus = -2;
|
||
} finally {
|
||
state.loading = false;
|
||
}
|
||
}
|
||
|
||
// 12. 底部按钮文案与可用性计算
|
||
const isButtonDisabled = computed(() => {
|
||
if (state.isSubmitting) return true;
|
||
if (state.payStatus !== 1) return true;
|
||
return false;
|
||
});
|
||
|
||
const payButtonText = computed(() => {
|
||
if (state.isSubmitting) {
|
||
return "正在发起支付...";
|
||
}
|
||
if (state.payStatus === 0) {
|
||
return "检测支付环境中...";
|
||
}
|
||
if (state.payStatus === -1) {
|
||
return "订单已超时关闭";
|
||
}
|
||
if (state.payStatus === 2) {
|
||
return "订单已支付完成";
|
||
}
|
||
if (state.payStatus === -2) {
|
||
return "未找到有效订单";
|
||
}
|
||
|
||
// 选中余额支付且余额不足时
|
||
if (state.payment === "money" && !isBalanceEnough.value) {
|
||
return isMixedPaySupported.value ? "余额不足 · 开启混合支付" : "余额不足 · 去充值";
|
||
}
|
||
|
||
// 混合支付模式
|
||
if (isMixedPaySupported.value && useMixedPay.value && deductMoney.value > 0) {
|
||
const title = getMethodTitle(state.payment);
|
||
return `混合支付 · ${title}付 ¥${thirdPayFee.value.toFixed(2)} (已抵余额¥${deductMoney.value.toFixed(2)})`;
|
||
}
|
||
|
||
return `立即支付 ¥${remainPayFee.value.toFixed(2)}`;
|
||
});
|
||
|
||
// 13. 支付流程核心入口
|
||
async function onPay() {
|
||
if (state.payStatus !== 1 || state.isSubmitting) return;
|
||
|
||
if (!state.payment) {
|
||
sheep.$helper.toast("请选择支付方式");
|
||
return;
|
||
}
|
||
|
||
// 混合支付流程
|
||
if (isMixedPaySupported.value && useMixedPay.value && deductMoney.value > 0) {
|
||
if (state.payment === "money") {
|
||
sheep.$helper.toast("请选择补足剩余款项的支付通道(微信或支付宝)");
|
||
return;
|
||
}
|
||
if (state.payment === "offline") {
|
||
sheep.$helper.toast("货到付款不支持混合支付");
|
||
return;
|
||
}
|
||
|
||
const title = getMethodTitle(state.payment);
|
||
uni.showModal({
|
||
title: "混合支付确认",
|
||
content: `本次将扣除账户可用余额 ¥${deductMoney.value.toFixed(2)},并通过 ${title} 支付剩余 ¥${thirdPayFee.value.toFixed(2)}。确定发起支付吗?`,
|
||
confirmText: "确认支付",
|
||
cancelText: "取消",
|
||
confirmColor: "var(--ui-BG-Main, #ff3000)",
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
submitPayment({ money: deductMoney.value });
|
||
}
|
||
},
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 纯余额支付流程
|
||
if (state.payment === "money") {
|
||
if (!isBalanceEnough.value) {
|
||
if (isMixedPaySupported.value) {
|
||
onEnableMixedPay();
|
||
} else {
|
||
uni.showModal({
|
||
title: "余额不足",
|
||
content: `当前可用余额为 ¥${userBalance.value.toFixed(2)},不足以支付该订单(待付 ¥${remainPayFee.value.toFixed(2)}),是否前往充值?`,
|
||
confirmText: "去充值",
|
||
cancelText: "取消",
|
||
confirmColor: "var(--ui-BG-Main, #ff3000)",
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
onGoRecharge();
|
||
}
|
||
},
|
||
});
|
||
}
|
||
return;
|
||
}
|
||
|
||
uni.showModal({
|
||
title: "余额支付确认",
|
||
content: `本次将扣除 ¥${remainPayFee.value.toFixed(2)},支付后账户剩余 ¥${remainingBalance.value}。确定支付吗?`,
|
||
confirmText: "确认支付",
|
||
cancelText: "取消",
|
||
confirmColor: "var(--ui-BG-Main, #ff3000)",
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
submitPayment();
|
||
}
|
||
},
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 货到付款流程
|
||
if (state.payment === "offline") {
|
||
uni.showModal({
|
||
title: "提示",
|
||
content: "确定要选择货到付款下单吗?",
|
||
confirmText: "确定下单",
|
||
cancelText: "取消",
|
||
confirmColor: "var(--ui-BG-Main, #ff3000)",
|
||
success: (res) => {
|
||
if (res.confirm) {
|
||
submitPayment();
|
||
}
|
||
},
|
||
});
|
||
return;
|
||
}
|
||
|
||
// 微信支付、支付宝支付等常规全额通道
|
||
submitPayment();
|
||
}
|
||
|
||
// 提交支付
|
||
async function submitPayment(options = {}) {
|
||
state.isSubmitting = true;
|
||
try {
|
||
await sheep.$platform.pay(
|
||
state.payment,
|
||
state.orderType,
|
||
state.orderInfo.order_sn,
|
||
options,
|
||
);
|
||
} catch (err) {
|
||
console.error("支付发起异常:", err);
|
||
} finally {
|
||
state.isSubmitting = false;
|
||
}
|
||
}
|
||
|
||
// 14. 生命周期钩子
|
||
onLoad((options) => {
|
||
// 微信公众号 iOS 路由刷新边缘兼容
|
||
if (
|
||
sheep.$platform.name === "WechatOfficialAccount" &&
|
||
sheep.$platform.os === "ios" &&
|
||
!sheep.$platform.landingPage.includes("pages/pay/index")
|
||
) {
|
||
location.reload();
|
||
return;
|
||
}
|
||
|
||
let id = options.orderSN || options.id || "";
|
||
state.orderId = id;
|
||
|
||
if (options.type === "recharge") {
|
||
state.orderType = "recharge";
|
||
setRechargeOrder(id);
|
||
} else {
|
||
state.orderType = "goods";
|
||
setGoodsOrder(id);
|
||
}
|
||
|
||
// 主动获取最新的用户资产与余额
|
||
sheep.$store("user").getInfo();
|
||
});
|
||
|
||
onShow(() => {
|
||
// 页面重新可见时(如充值返回),同步刷新用户余额与订单环境
|
||
sheep.$store("user").getInfo();
|
||
});
|
||
|
||
onHide(() => {
|
||
stopCountdown();
|
||
});
|
||
|
||
onUnload(() => {
|
||
stopCountdown();
|
||
});
|
||
|
||
onUnmounted(() => {
|
||
stopCountdown();
|
||
});
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
.cashier-container {
|
||
min-height: 100vh;
|
||
padding-top: 20rpx;
|
||
}
|
||
|
||
// 1. 顶部金额卡片
|
||
.amount-card {
|
||
background: #ffffff;
|
||
border-radius: 24rpx;
|
||
padding: 44rpx 32rpx 36rpx;
|
||
margin: 0 24rpx 24rpx;
|
||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.03);
|
||
|
||
.amount-label {
|
||
font-size: 26rpx;
|
||
color: #999999;
|
||
letter-spacing: 1rpx;
|
||
}
|
||
|
||
.amount-val-wrap {
|
||
margin-top: 16rpx;
|
||
color: #ff3000;
|
||
font-family:
|
||
OPPOSANS,
|
||
-apple-system,
|
||
sans-serif;
|
||
line-height: 1;
|
||
|
||
.currency-symbol {
|
||
font-size: 38rpx;
|
||
font-weight: bold;
|
||
margin-right: 6rpx;
|
||
margin-bottom: 4rpx;
|
||
}
|
||
|
||
.amount-integer {
|
||
font-size: 66rpx;
|
||
font-weight: bold;
|
||
}
|
||
|
||
.amount-decimal {
|
||
font-size: 42rpx;
|
||
font-weight: bold;
|
||
margin-bottom: 2rpx;
|
||
}
|
||
}
|
||
|
||
// 状态胶囊标签
|
||
.status-capsule-wrap {
|
||
.status-capsule {
|
||
padding: 8rpx 24rpx;
|
||
border-radius: 30rpx;
|
||
font-size: 24rpx;
|
||
font-weight: 500;
|
||
|
||
&.ticking {
|
||
background: #fff5f2;
|
||
color: #ff5000;
|
||
border: 1rpx solid rgba(255, 80, 0, 0.2);
|
||
}
|
||
|
||
&.expired {
|
||
background: #f5f5f5;
|
||
color: #999999;
|
||
border: 1rpx solid #e0e0e0;
|
||
}
|
||
|
||
&.paid {
|
||
background: #f6ffed;
|
||
color: #52c41a;
|
||
border: 1rpx solid #b7eb8f;
|
||
}
|
||
|
||
&.loading {
|
||
background: #f0f5ff;
|
||
color: #2f54eb;
|
||
border: 1rpx solid #adc6ff;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 订单信息栏
|
||
.order-meta-box {
|
||
width: 100%;
|
||
background: #fafbfe;
|
||
border-radius: 16rpx;
|
||
padding: 20rpx 24rpx;
|
||
box-sizing: border-box;
|
||
|
||
.order-meta-row {
|
||
width: 100%;
|
||
|
||
.meta-label {
|
||
font-size: 24rpx;
|
||
color: #888888;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.meta-sn {
|
||
font-size: 24rpx;
|
||
color: #333333;
|
||
font-family: OPPOSANS, monospace;
|
||
}
|
||
|
||
.meta-val {
|
||
font-size: 24rpx;
|
||
color: #333333;
|
||
max-width: 440rpx;
|
||
text-align: right;
|
||
|
||
&.text-success {
|
||
color: #52c41a;
|
||
}
|
||
|
||
&.text-orange {
|
||
color: #fa8c16;
|
||
}
|
||
|
||
&.font-bold {
|
||
font-weight: 600;
|
||
}
|
||
}
|
||
|
||
.copy-btn {
|
||
margin-left: 16rpx;
|
||
font-size: 22rpx;
|
||
color: var(--ui-BG-Main, #ff5722);
|
||
background: rgba(255, 87, 34, 0.08);
|
||
border-radius: 18rpx;
|
||
padding: 2rpx 14rpx;
|
||
line-height: 36rpx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// 2. 支付方式选择卡片
|
||
.payment-card {
|
||
background: #ffffff;
|
||
border-radius: 24rpx;
|
||
padding: 32rpx 30rpx;
|
||
margin: 0 24rpx 24rpx;
|
||
box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.03);
|
||
|
||
.card-header {
|
||
padding-bottom: 24rpx;
|
||
border-bottom: 1rpx solid #f2f3f7;
|
||
|
||
.header-left {
|
||
.accent-bar {
|
||
width: 8rpx;
|
||
height: 32rpx;
|
||
background: linear-gradient(
|
||
180deg,
|
||
var(--ui-BG-Main, #ff5722),
|
||
var(--ui-BG-Main-gradient, #ff3000)
|
||
);
|
||
border-radius: 4rpx;
|
||
margin-right: 14rpx;
|
||
}
|
||
|
||
.header-title {
|
||
font-size: 30rpx;
|
||
font-weight: bold;
|
||
color: #222222;
|
||
}
|
||
}
|
||
|
||
.header-right {
|
||
.safe-icon {
|
||
font-size: 26rpx;
|
||
color: #52c41a;
|
||
margin-right: 6rpx;
|
||
}
|
||
|
||
.safe-text {
|
||
font-size: 22rpx;
|
||
color: #52c41a;
|
||
}
|
||
}
|
||
}
|
||
|
||
// 专属混合支付卡片
|
||
.mixed-pay-card {
|
||
background: linear-gradient(135deg, #fff9f6 0%, #fff4ef 100%);
|
||
border: 2rpx solid rgba(255, 87, 34, 0.22);
|
||
border-radius: 18rpx;
|
||
padding: 20rpx 22rpx;
|
||
box-sizing: border-box;
|
||
|
||
.mixed-left {
|
||
flex: 1;
|
||
|
||
.mixed-icon-wrap {
|
||
width: 56rpx;
|
||
height: 56rpx;
|
||
background: #ffffff;
|
||
border-radius: 50%;
|
||
margin-right: 18rpx;
|
||
box-shadow: 0 2rpx 8rpx rgba(255, 87, 34, 0.12);
|
||
|
||
.mixed-icon-img {
|
||
width: 38rpx;
|
||
height: 38rpx;
|
||
}
|
||
}
|
||
|
||
.mixed-info {
|
||
flex: 1;
|
||
|
||
.mixed-title-row {
|
||
.mixed-title {
|
||
font-size: 28rpx;
|
||
font-weight: bold;
|
||
color: #333333;
|
||
}
|
||
|
||
.mixed-tag {
|
||
font-size: 20rpx;
|
||
font-weight: 500;
|
||
color: #ffffff;
|
||
background: linear-gradient(90deg, #ff7a45, #ff4d4f);
|
||
padding: 2rpx 10rpx;
|
||
border-radius: 6rpx;
|
||
margin-left: 12rpx;
|
||
line-height: 28rpx;
|
||
}
|
||
}
|
||
|
||
.mixed-desc {
|
||
font-size: 22rpx;
|
||
color: #777777;
|
||
margin-top: 6rpx;
|
||
font-family: OPPOSANS, sans-serif;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
.payment-list {
|
||
.pay-option-item {
|
||
padding: 28rpx 0;
|
||
border-bottom: 1rpx solid #f6f7fb;
|
||
transition: all 0.2s ease;
|
||
|
||
&:last-child {
|
||
border-bottom: none;
|
||
padding-bottom: 8rpx;
|
||
}
|
||
|
||
&.is-disabled {
|
||
opacity: 0.55;
|
||
}
|
||
|
||
.method-left {
|
||
flex: 1;
|
||
|
||
.method-icon {
|
||
width: 52rpx;
|
||
height: 52rpx;
|
||
margin-right: 22rpx;
|
||
flex-shrink: 0;
|
||
}
|
||
|
||
.method-info {
|
||
flex: 1;
|
||
|
||
.title-row {
|
||
.method-title {
|
||
font-size: 28rpx;
|
||
font-weight: 500;
|
||
color: #222222;
|
||
}
|
||
|
||
.method-tag {
|
||
font-size: 20rpx;
|
||
padding: 2rpx 10rpx;
|
||
border-radius: 6rpx;
|
||
margin-left: 12rpx;
|
||
line-height: 28rpx;
|
||
|
||
&.recommend-tag {
|
||
background: #e6f7ff;
|
||
color: #1890ff;
|
||
border: 1rpx solid #91d5ff;
|
||
}
|
||
|
||
&.mixed-amount-tag {
|
||
background: #fff7e6;
|
||
color: #fa8c16;
|
||
border: 1rpx solid #ffd591;
|
||
font-weight: 600;
|
||
}
|
||
}
|
||
}
|
||
|
||
.method-desc {
|
||
font-size: 22rpx;
|
||
color: #999999;
|
||
line-height: 32rpx;
|
||
|
||
.disabled-desc {
|
||
color: #ff4d4f;
|
||
}
|
||
}
|
||
|
||
// 余额支付特定展示区
|
||
.balance-info-row {
|
||
font-size: 24rpx;
|
||
line-height: 1.2;
|
||
|
||
.balance-text {
|
||
color: #555555;
|
||
font-weight: 500;
|
||
font-family: OPPOSANS, sans-serif;
|
||
}
|
||
|
||
.balance-badge {
|
||
padding: 2rpx 8rpx;
|
||
border-radius: 6rpx;
|
||
font-size: 20rpx;
|
||
margin-left: 10rpx;
|
||
|
||
&.success {
|
||
background: #f6ffed;
|
||
color: #52c41a;
|
||
border: 1rpx solid #b7eb8f;
|
||
}
|
||
|
||
&.mixed {
|
||
background: #e6f7ff;
|
||
color: #1890ff;
|
||
border: 1rpx solid #91d5ff;
|
||
font-weight: 500;
|
||
}
|
||
|
||
&.danger {
|
||
background: #fff2f0;
|
||
color: #ff4d4f;
|
||
border: 1rpx solid #ffccc7;
|
||
}
|
||
}
|
||
|
||
.recharge-link-btn {
|
||
font-size: 22rpx;
|
||
color: var(--ui-BG-Main, #ff5722);
|
||
font-weight: 600;
|
||
background: rgba(255, 87, 34, 0.08);
|
||
padding: 4rpx 12rpx;
|
||
border-radius: 16rpx;
|
||
|
||
.cicon-forward {
|
||
font-size: 18rpx;
|
||
margin-left: 2rpx;
|
||
}
|
||
}
|
||
|
||
.mixed-link-btn {
|
||
font-size: 22rpx;
|
||
color: #fa8c16;
|
||
font-weight: 600;
|
||
background: rgba(250, 140, 22, 0.1);
|
||
padding: 4rpx 12rpx;
|
||
border-radius: 16rpx;
|
||
|
||
.cicon-forward {
|
||
font-size: 18rpx;
|
||
margin-left: 2rpx;
|
||
}
|
||
}
|
||
}
|
||
|
||
.balance-deduct-tip {
|
||
font-size: 22rpx;
|
||
color: #52c41a;
|
||
}
|
||
}
|
||
}
|
||
|
||
.method-right {
|
||
margin-left: 20rpx;
|
||
|
||
.custom-check-box {
|
||
width: 40rpx;
|
||
height: 40rpx;
|
||
border-radius: 50%;
|
||
border: 2rpx solid #d4d7de;
|
||
box-sizing: border-box;
|
||
background: #ffffff;
|
||
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
||
|
||
&.checked {
|
||
background: var(--ui-BG-Main, #ff3000);
|
||
border-color: var(--ui-BG-Main, #ff3000);
|
||
color: #ffffff;
|
||
font-size: 24rpx;
|
||
font-weight: bold;
|
||
}
|
||
|
||
&.disabled {
|
||
background: #f5f5f5;
|
||
border-color: #e4e7ed;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
// 3. 底部安全保障背书
|
||
.security-banner {
|
||
padding: 30rpx 20rpx;
|
||
margin-bottom: 20rpx;
|
||
|
||
.security-line {
|
||
.banner-icon {
|
||
font-size: 30rpx;
|
||
color: #8c8c8c;
|
||
margin-right: 8rpx;
|
||
}
|
||
|
||
.banner-title {
|
||
font-size: 24rpx;
|
||
color: #8c8c8c;
|
||
font-weight: 500;
|
||
letter-spacing: 0.5rpx;
|
||
}
|
||
}
|
||
|
||
.banner-sub {
|
||
font-size: 20rpx;
|
||
color: #bfbfbf;
|
||
}
|
||
}
|
||
|
||
// 4. 底部占位与吸底按钮
|
||
.footer-placeholder {
|
||
height: calc(140rpx + env(safe-area-inset-bottom));
|
||
}
|
||
|
||
.fixed-footer {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
background: #ffffff;
|
||
padding: 16rpx 32rpx;
|
||
padding-bottom: calc(16rpx + env(safe-area-inset-bottom));
|
||
box-shadow: 0 -4rpx 16rpx rgba(0, 0, 0, 0.05);
|
||
z-index: 99;
|
||
|
||
.pay-action-btn {
|
||
width: 100%;
|
||
height: 88rpx;
|
||
border-radius: 44rpx;
|
||
background: linear-gradient(
|
||
90deg,
|
||
var(--ui-BG-Main, #ff5722),
|
||
var(--ui-BG-Main-gradient, #ff3000)
|
||
);
|
||
color: #ffffff;
|
||
font-size: 32rpx;
|
||
font-weight: 600;
|
||
box-shadow: 0 8rpx 20rpx rgba(255, 48, 0, 0.25);
|
||
transition: opacity 0.2s;
|
||
|
||
&:active {
|
||
opacity: 0.9;
|
||
}
|
||
|
||
&.btn-disabled {
|
||
background: #e4e7ed !important;
|
||
color: #909399 !important;
|
||
box-shadow: none !important;
|
||
}
|
||
|
||
&.btn-warning {
|
||
background: linear-gradient(90deg, #ffa940, #fa8c16) !important;
|
||
box-shadow: 0 8rpx 20rpx rgba(250, 140, 22, 0.25) !important;
|
||
}
|
||
|
||
.rotating {
|
||
animation: spin 1s linear infinite;
|
||
}
|
||
}
|
||
}
|
||
|
||
@keyframes spin {
|
||
0% {
|
||
transform: rotate(0deg);
|
||
}
|
||
100% {
|
||
transform: rotate(360deg);
|
||
}
|
||
}
|
||
</style>
|