123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <template>
- <view class="page-content">
- <uv-navbar title="收银台" :placeholder="true" titleStyle="font-weight: bold" :fixed="true" @leftClick="handleBack" />
- <view class="content">
- <view class="money-info flex flex-col align-center justify-center">
- <view class="">
- <text class="unit">¥</text>
- <text class="money">{{ price }}</text>
- </view>
- <view class="tip">待支付金额</view>
- </view>
- <view class="goods-info">
- <view class="goods-info-item flex justify-between">
- <text class="tip">商品名称</text>
- <text>会员卡</text>
- </view>
- <view class="goods-info-item flex justify-between">
- <text class="tip">商品金额</text>
- <text>¥{{ price }}</text>
- </view>
- </view>
- <view v-if="!isIOS" class="tip">选择支付方式</view>
- </view>
- <view v-if="!isIOS" class="channel-list">
- <uv-radio-group v-model="payType" placement="column" iconPlacement="right" shape="square" size="24" iconSize="18">
- <uv-radio v-if="isAndroid" :name="1">
- <view class="flex align-center" slot="label">
- <image class="channel-icon" mode="widthFix" src="@/static/wechat-pay.png" />
- <text>微信支付</text>
- </view>
- </uv-radio>
- <uv-radio v-if="isIOS" :name="2">
- <view class="flex align-center" slot="label">
- <image class="channel-icon" mode="widthFix" src="@/static/apple-pay.png" />
- <text>苹果支付</text>
- </view>
- </uv-radio>
- </uv-radio-group>
- </view>
- <view class="btn-wrap">
- <uv-button type="primary" size="large" @click="handlePay">确认支付 ¥{{ price }}</uv-button>
- </view>
- </view>
- </template>
- <script setup>
- import { ref } from 'vue';
- import config from '@/config';
- import { usePayment } from '@/hooks/usePayment.js';
- import { useEnvStore } from '@/hooks/useEnvStore';
- const {isAndroid, isIOS, isWap2App, isH5} = useEnvStore();
- const { price, payment, iosPayment, onOrderSucceed, onOrderFailed, onOrderTimeout } = usePayment();
- const payType = ref(1);
- const dividerStyle = {
- "margin": "10px 0"
- };
- function handlePay() {
- if (isAndroid.value) {
- payment();
- } else {
- iosPayment();
- }
- }
- function handleBack() {
- uni.navigateBack();
- }
- </script>
- <style lang="scss">
- .page-content {
- background-color: #f6f5f5;
- }
- .flex {
- display: flex;
- }
- .flex-row {
- flex-direction: row;
- }
- .flex-col {
- flex-direction: column;
- }
- .align-center {
- align-items: center;
- }
- .align-end {
- align-items: flex-end;
- }
- .justify-between {
- justify-content: space-between;
- }
- .content {
- padding: 0 28px;
- }
- .money-info {
- padding: 30px 0;
- }
- .unit {
- font-size: 20px;
- }
- .money {
- font-size: 48px;
- font-weight: bold;
- letter-spacing: 2px;
- }
- .tip {
- color: #7c7c7c;
- font-size: 15px;
- }
- .goods-info {
- margin-bottom: 26px;
- }
- .goods-info-item {
- &+& {
- margin-top: 10px;
- }
- }
- .channel-list {
- margin: 10px 18px 0 18px;
- border-radius: 12px;
- background-color: #ffffff;
- padding: 12px;
- }
- .u-radio+.u-radio {
- margin-top: 10px;
- }
- .u-radio:last-child {
- border-bottom: none !important;
- }
- .channel-icon {
- width: 40px;
- height: 40px;
- margin-right: 8px;
- }
- .btn-wrap {
- margin-top: 36px;
- padding: 0 24px;
- }
- </style>
|