新增营销系统、分销系统、会员功能、门店、提现功能
This commit is contained in:
@ -7,9 +7,9 @@
|
||||
-->
|
||||
<script setup>
|
||||
import { useRouter } from "@/hooks/useRouter";
|
||||
import { computed, ref, unref,nextTick } from "vue";
|
||||
import { onLoad, onPageScroll, onReachBottom } from "@dcloudio/uni-app";
|
||||
import { checkPay } from "@/api/order";
|
||||
import { computed, nextTick, ref, unref } from "vue";
|
||||
import { onLoad, onReachBottom } from "@dcloudio/uni-app";
|
||||
import {checkPay, orderInfo} from "@/api/order";
|
||||
import { CacheKey } from "@/utils/config";
|
||||
import Header from '@/components/Header/index.vue'
|
||||
import Recommend from '@/components/Recommend/index.vue'
|
||||
@ -20,7 +20,8 @@ import ListLoadLoading from "@/components/ListLoadLoading/index.vue"
|
||||
import { lazyLoading, payError, paySuccess } from "@/utils/images";
|
||||
|
||||
const {getParams, goBack, push, pushToTab} = useRouter()
|
||||
const {loading,hideLoading} = useInterface()
|
||||
const {loading, hideLoading} = useInterface()
|
||||
const campaignType = ref(0) // 1拼团 2秒杀 3砍价 4拼团成团
|
||||
const type = ref(0) // 支付状态 : 0支付中 1支付成功 2支付失败
|
||||
const {scrollTop} = useScroll()
|
||||
const title = computed(() => {
|
||||
@ -35,7 +36,7 @@ const modalRef = ref()
|
||||
/**
|
||||
* 打开弹窗
|
||||
*/
|
||||
function showModal(){
|
||||
function showModal() {
|
||||
unref(modalRef).show()
|
||||
}
|
||||
|
||||
@ -52,10 +53,17 @@ async function queryOrderStatus() {
|
||||
try {
|
||||
const payInfoStr = uni.getStorageSync(CacheKey.PAY_INFO);
|
||||
// 没有订单缓存直接跳到订单页面
|
||||
if (!payInfoStr) return toOrderList(0)
|
||||
|
||||
if (!payInfoStr) {
|
||||
return orderType.value === 2 ? toMyBalance() : toOrderList(0)
|
||||
}
|
||||
const parse = JSON.parse(payInfoStr);
|
||||
const res = await checkPay(parse);
|
||||
if(parse.options && parse.options.isGroup){
|
||||
campaignType.value = 1
|
||||
}
|
||||
const res = await checkPay({
|
||||
...parse.payData,
|
||||
uni:parse.payData.orderId || ''
|
||||
});
|
||||
if (!res) {
|
||||
// 支付失败重新查询
|
||||
if (retryTime.value > 0) {
|
||||
@ -67,6 +75,14 @@ async function queryOrderStatus() {
|
||||
}
|
||||
return
|
||||
}
|
||||
// todo 查询订单详情
|
||||
if(parse.options && parse.options.isGroup){
|
||||
const order = await orderInfo({key:parse.payData.orderId})
|
||||
if(order && order._status._type === '8'){
|
||||
campaignType.value=4
|
||||
}
|
||||
console.log(campaignType.value)
|
||||
}
|
||||
type.value = 1
|
||||
uni.removeStorageSync(CacheKey.PAY_INFO)
|
||||
} finally {
|
||||
@ -76,20 +92,32 @@ async function queryOrderStatus() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 去订单列表
|
||||
* @param type 0 待支付 1 待发货
|
||||
* @param status 0 待支付 1 待发货 5待成团
|
||||
*/
|
||||
function toOrderList(type) {
|
||||
push({url: '/pages/orderList/orderList'}, {data: {type}, type: 'reLaunch'})
|
||||
function toOrderList(status) {
|
||||
// 支付成功才走
|
||||
if(type.value===1){
|
||||
if(campaignType.value === 1){
|
||||
status = 5
|
||||
}
|
||||
if(campaignType.value === 4){
|
||||
status=1
|
||||
}
|
||||
}
|
||||
push({url: '/pages/orderList/orderList'}, {data: {type:status}, type: 'reLaunch'})
|
||||
}
|
||||
|
||||
function toMyBalance() {
|
||||
push({url: '/views/account/balance/index'}, {data: {}, type: 'reLaunch'})
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回首页
|
||||
*/
|
||||
function toBackHome() {
|
||||
pushToTab({url: '/pages/index/index'})
|
||||
pushToTab({url: '/root/index/index'})
|
||||
}
|
||||
|
||||
const recommendRef = ref(null)
|
||||
@ -98,10 +126,16 @@ onReachBottom(() => {
|
||||
unref(recommendRef).onReachBottom && unref(recommendRef).onReachBottom();
|
||||
})
|
||||
|
||||
const orderType = ref(1) // 1商品 2充值
|
||||
|
||||
onLoad(async (options) => {
|
||||
// type
|
||||
orderType.value = options.type
|
||||
// const params = getParams(options)
|
||||
// campaignType.value = params.campaignType
|
||||
// H5 和 APP 需要弹窗去确认
|
||||
// #ifdef H5
|
||||
await nextTick(()=>{
|
||||
await nextTick(() => {
|
||||
showModal()
|
||||
})
|
||||
// #endif
|
||||
@ -132,10 +166,15 @@ onLoad(async (options) => {
|
||||
v-if="Number(type)===2"
|
||||
:src="payError"
|
||||
/>
|
||||
<view class="text" v-if="[1,2].includes(Number(type))">
|
||||
<view
|
||||
class="text"
|
||||
v-if="[1,2].includes(Number(type))">
|
||||
{{ title }}
|
||||
</view>
|
||||
<ListLoadLoading v-else :show-line="false" text="查询中..." />
|
||||
<ListLoadLoading
|
||||
v-else
|
||||
:show-line="false"
|
||||
text="查询中..." />
|
||||
</view>
|
||||
<view class="button-group flex flex-ai__center flex-jc__center">
|
||||
<view
|
||||
@ -145,24 +184,39 @@ onLoad(async (options) => {
|
||||
>
|
||||
继续逛逛
|
||||
</view>
|
||||
<view
|
||||
class="animation-button button"
|
||||
v-if="Number(type)===1"
|
||||
@click="toOrderList(1)"
|
||||
>
|
||||
查看订单
|
||||
</view>
|
||||
<view
|
||||
class="animation-button button"
|
||||
v-if="Number(type)===2"
|
||||
@click="toOrderList(0)"
|
||||
>
|
||||
重新支付
|
||||
</view>
|
||||
<template v-if="orderType !== 1">
|
||||
<view
|
||||
class="animation-button button"
|
||||
v-if="Number(type)===1"
|
||||
@click="toOrderList(1)"
|
||||
>
|
||||
查看订单
|
||||
</view>
|
||||
<view
|
||||
class="animation-button button"
|
||||
v-if="Number(type)===2"
|
||||
@click="toOrderList(0)"
|
||||
>
|
||||
重新支付
|
||||
</view>
|
||||
</template>
|
||||
<template v-else>
|
||||
<view
|
||||
class="animation-button button"
|
||||
v-if="Number(type)===1"
|
||||
@click="toMyBalance"
|
||||
>
|
||||
我的余额
|
||||
</view>
|
||||
</template>
|
||||
</view>
|
||||
<!-- 商品推荐 -->
|
||||
<Recommend ref="recommendRef" />
|
||||
<Modal ref="modalRef" content="请确认支付是否完成?" @confirm="queryOrderStatus" @cancel="queryOrderStatus" />
|
||||
<Modal
|
||||
ref="modalRef"
|
||||
content="请确认支付是否完成?"
|
||||
@confirm="queryOrderStatus"
|
||||
@cancel="queryOrderStatus" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -176,7 +230,7 @@ onLoad(async (options) => {
|
||||
.status-main {
|
||||
@include usePadding(0, 130);
|
||||
width: 100%;
|
||||
font-size:36rpx;
|
||||
font-size: 36rpx;
|
||||
|
||||
.icon {
|
||||
width: 170rpx;
|
||||
|
Reference in New Issue
Block a user