功能完善
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<scroll-view scroll-y>
|
||||
<view class='content'>
|
||||
<view class='countdown c-flex-row' v-if='orderBean?.order.payStatus==1'>
|
||||
<view class='countdown c-flex-row' v-if='isPending(orderBean?.order)'>
|
||||
<image :src='assetsUrl("ic_order.png")' />
|
||||
<view class='c-flex-column'>
|
||||
<text>
|
||||
@@ -10,23 +10,23 @@
|
||||
<view class='c-flex-row'>
|
||||
<image :src='assetsUrl("ic_time.png")' />
|
||||
<text>支付剩余时间
|
||||
<text style='color: #F32B2B'>05:23</text>
|
||||
<text style='color: #F32B2B'>{{ dayjs.unix(orderBean?.order?.countdown || 0).format('mm:ss') }}</text>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class='address-view c-flex-column'>
|
||||
<view class='address-view c-flex-column' v-if='orderBean?.order?.address'>
|
||||
<view class='user-info c-flex-row'>
|
||||
<text>默认</text>
|
||||
<text>黄先生</text>
|
||||
<text>155****6532</text>
|
||||
<text v-if='orderBean.order.address.defaultstatus==1'>默认</text>
|
||||
<text>{{ orderBean?.order?.address.name }}</text>
|
||||
<text>{{ orderBean?.order?.address.mobile }}</text>
|
||||
<view style='flex: 1' />
|
||||
<text style='color: #5B96FB'>复制</text>
|
||||
</view>
|
||||
|
||||
<view class='addr c-flex-row'>
|
||||
<image :src='assetsUrl("ic_location.png")' />
|
||||
<text>湖南省 长沙市 详细地址详细地址详细地址</text>
|
||||
<text>{{ orderBean?.order?.address.addr }}</text>
|
||||
</view>
|
||||
<image class='dashed-line' :src='assetsUrl("ic_address_dashed_line.png")' />
|
||||
</view>
|
||||
@@ -93,9 +93,9 @@
|
||||
<text>下单时间:{{ orderBean?.order?.createTime }}</text>
|
||||
</view>
|
||||
|
||||
<view class='bottom-action-view c-flex-row' v-if='orderBean?.order.payStatus==1'>
|
||||
<view class='bottom-action-view c-flex-row' v-if='isPending(orderBean?.order)'>
|
||||
<text @click.stop='cancel' style='display: none'>取消订单</text>
|
||||
<sqb-pay @bindnavigateTo='navigateTo'
|
||||
<sqb-pay @navigateTo='navigateTo'
|
||||
:return_url='buildSqbParams.return_url'
|
||||
:total_amount='buildSqbParams.total_amount'
|
||||
:terminal_sn='buildSqbParams.terminal_sn'
|
||||
@@ -118,6 +118,9 @@ import { OrderBean } from '@/api/order/types';
|
||||
import { parseParameter, sortASCII } from '@/utils';
|
||||
import { hexMD5 } from '@/utils/common/md5';
|
||||
import { useUserStore } from '@/store';
|
||||
import { handlePayResult, isPending } from '@/utils/order';
|
||||
import dayjs from 'dayjs';
|
||||
import { pay } from '@/api/groupbuy';
|
||||
|
||||
const userState = useUserStore();
|
||||
const { terminalInfo } = storeToRefs(userState);
|
||||
@@ -128,12 +131,19 @@ const orderBean = ref<{
|
||||
paymentList: []
|
||||
}>();
|
||||
|
||||
let currentInterval = 0;
|
||||
|
||||
onLoad(async (e: any) => {
|
||||
await uni.showLoading();
|
||||
orderBean.value = await getOrderDetail(e.orderId);
|
||||
handleCountdown();
|
||||
uni.hideLoading();
|
||||
});
|
||||
|
||||
onUnload(() => {
|
||||
clearInterval(currentInterval);
|
||||
});
|
||||
|
||||
const buildSqbParams = computed(() => {
|
||||
const params = sortASCII({
|
||||
client_sn: orderBean.value?.order?.id || '',
|
||||
@@ -152,16 +162,32 @@ const buildSqbParams = computed(() => {
|
||||
|
||||
const navigateTo = (e: any) => {
|
||||
console.log('--------------_>>>>>>navigateTo ', e);
|
||||
uni.redirectTo({
|
||||
url: e.detail.url,
|
||||
fail(e) {
|
||||
uni.showToast({
|
||||
title: '支付失败'
|
||||
});
|
||||
handlePayResult(orderBean.value?.order.id, e, {
|
||||
onSuccess: () => {
|
||||
// pay({
|
||||
// 'orderId': orderBean.value?.order.id,
|
||||
// 'result': 'xxx'
|
||||
// });
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const handleCountdown = () => {
|
||||
clearInterval(currentInterval);
|
||||
let second = 30 * 60;
|
||||
currentInterval = setInterval(() => {
|
||||
if(isPending(orderBean.value?.order)) {
|
||||
orderBean.value!.order!.countdown = second;
|
||||
if(orderBean.value!.order!.countdown <= 0) {
|
||||
orderBean.value!.order!.countdown = 0;
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
second--;
|
||||
}
|
||||
}, 1000);
|
||||
};
|
||||
|
||||
const cancel = () => {
|
||||
};
|
||||
const payment = () => {
|
||||
|
Reference in New Issue
Block a user