功能完善
This commit is contained in:
@@ -44,7 +44,7 @@ const fetchAddressList = async () => {
|
||||
|
||||
const onChecked = (e: any) => {
|
||||
const pages = getCurrentPages();
|
||||
if(pages.length > 2 && pages[pages.length - 2].route?.includes('pages/mall/subs/order/order-confirm')) {
|
||||
if(pages.length >= 2 && pages[pages.length - 2].route?.includes('pages/mall/subs/order/order-confirm')) {
|
||||
userStore.setDeliveryAddress(e);
|
||||
uni.navigateBack();
|
||||
}
|
||||
|
@@ -118,9 +118,8 @@ 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 { getOrderDeadline, handlePayResult, isPending } from '@/utils/order';
|
||||
import dayjs from 'dayjs';
|
||||
import { pay } from '@/api/groupbuy';
|
||||
|
||||
const userState = useUserStore();
|
||||
const { terminalInfo } = storeToRefs(userState);
|
||||
@@ -134,12 +133,16 @@ const orderBean = ref<{
|
||||
let currentInterval = 0;
|
||||
|
||||
onLoad(async (e: any) => {
|
||||
await uni.showLoading();
|
||||
orderBean.value = await getOrderDetail(e.orderId);
|
||||
await fetchData(e.orderId);
|
||||
handleCountdown();
|
||||
uni.hideLoading();
|
||||
});
|
||||
|
||||
const fetchData = async (orderId: string) => {
|
||||
await uni.showLoading();
|
||||
orderBean.value = await getOrderDetail(orderId);
|
||||
uni.hideLoading();
|
||||
};
|
||||
|
||||
onUnload(() => {
|
||||
clearInterval(currentInterval);
|
||||
});
|
||||
@@ -161,29 +164,28 @@ const buildSqbParams = computed(() => {
|
||||
});
|
||||
|
||||
const navigateTo = (e: any) => {
|
||||
console.log('--------------_>>>>>>navigateTo ', e);
|
||||
handlePayResult(orderBean.value?.order.id, e, {
|
||||
onSuccess: () => {
|
||||
// pay({
|
||||
// 'orderId': orderBean.value?.order.id,
|
||||
// 'result': 'xxx'
|
||||
// });
|
||||
fetchData(orderBean.value?.order.id || '');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
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;
|
||||
if(orderBean.value != undefined) {
|
||||
if(isPending(orderBean.value?.order)) {
|
||||
let second = (getOrderDeadline(orderBean.value?.order) - Date.now()) / 1000;
|
||||
orderBean.value.order.countdown = second;
|
||||
if(second <= 0) {
|
||||
fetchData(orderBean.value?.order.id || '');
|
||||
}
|
||||
second--;
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
clearInterval(currentInterval);
|
||||
fetchData(orderBean.value?.order.id || '');
|
||||
}
|
||||
second--;
|
||||
}
|
||||
}, 1000);
|
||||
};
|
||||
|
@@ -14,7 +14,7 @@
|
||||
|
||||
import { ref } from 'vue';
|
||||
import { showToast } from '@/utils';
|
||||
import { isPending } from '@/utils/order';
|
||||
import { getOrderDeadline, isPending } from '@/utils/order';
|
||||
import { getOrderList } from '@/api/order';
|
||||
import OrderItem from '@/pages/mine/subs/order/components/order-item.vue';
|
||||
import { OrderBean } from '@/api/order/types';
|
||||
@@ -64,10 +64,10 @@ const fetchData = async (refresh: boolean = true) => {
|
||||
|
||||
const handleCountdown = (items: OrderBean[]) => {
|
||||
clearInterval(currentInterval);
|
||||
let second = 30 * 60;
|
||||
currentInterval = setInterval(() => {
|
||||
items.forEach(item => {
|
||||
if(isPending(item)) {
|
||||
let second = (getOrderDeadline(item) - Date.now()) / 1000;
|
||||
item.countdown = second;
|
||||
if(item.countdown <= 0) {
|
||||
item.countdown = 0;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<image :src='assetsUrl("bg_member_recharge.png")' />
|
||||
<view class='balance-content'>
|
||||
<text>累计余额(元)</text>
|
||||
<text>¥1</text>
|
||||
<text>¥{{ userInfo?.totalIncoming}}</text>
|
||||
</view>
|
||||
<view class='balance-content'>
|
||||
<text>当前余额(元)</text>
|
||||
|
Reference in New Issue
Block a user