|
|
@ -2,34 +2,91 @@ |
|
|
|
import { onLoad } from '@dcloudio/uni-app'; |
|
|
|
import { reactive, ref } from "vue"; |
|
|
|
import textLine from "../components/text_line.vue"; |
|
|
|
onLoad(() => { |
|
|
|
|
|
|
|
import { getOrder, orderGet } from "../api"; |
|
|
|
import { routeTo, showModal } from "@/utils/polish"; |
|
|
|
const orderInfo = ref({}); |
|
|
|
onLoad(oprions => { |
|
|
|
getOrderNoFn({ verify_token: oprions?.verify_token ?? '' }) |
|
|
|
.then(orderNo =>{ |
|
|
|
orderGet({ data: { order_no: orderNo, brand_id: oprions?.brand_id ?? '' } }) |
|
|
|
.then(oRes=>{ |
|
|
|
orderInfo.value = oRes?.data ?? {}; |
|
|
|
}) |
|
|
|
}) |
|
|
|
}); |
|
|
|
|
|
|
|
// ef5bc53a8711d876adbfac7710a03f3f |
|
|
|
|
|
|
|
function getOrderNoFn({ verify_token, times = 1, max = 5, interval = 300 }){ |
|
|
|
if(times > max){ |
|
|
|
console.warn('轮询了' + (times - 1) + '次'); |
|
|
|
showModal({ content: '查询超时!' }); |
|
|
|
return Promise.reject('超时') |
|
|
|
} |
|
|
|
times++ |
|
|
|
return getOrder({ data: { verify_token } }) |
|
|
|
.then(res=>{ |
|
|
|
let _orderNo = res?.data?.order_no ?? ''; |
|
|
|
if(_orderNo){ |
|
|
|
return Promise.resolve(_orderNo); |
|
|
|
}else if(res?.code === 0 && res?.data?.order_no === ''){ |
|
|
|
return new Promise(rs=>{ |
|
|
|
setTimeout(_=>{ |
|
|
|
rs(getOrderNoFn({ verify_token, times, max, interval })) |
|
|
|
}, interval) |
|
|
|
}) |
|
|
|
}else { |
|
|
|
return Promise.reject(res); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
function copyBtn(){ |
|
|
|
uni.setClipboardData({ |
|
|
|
data: `${orderInfo.value?.verify_code}` |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 预览核销码 |
|
|
|
function previewCode(){ |
|
|
|
uni.previewImage({ urls: [orderInfo.value?.verify_qrcode] }) |
|
|
|
} |
|
|
|
|
|
|
|
function toOrderDetail(){ |
|
|
|
let _oVal = orderInfo.value; |
|
|
|
routeTo(`/subpackage/order/pages/detail?brand_id=${_oVal?.brand_id ?? ''}&order_no=${_oVal?.order_no ?? ''}`) |
|
|
|
} |
|
|
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
<template> |
|
|
|
<view class="exchange-success"> |
|
|
|
<view class="exchange-success" v-if="orderInfo?.order_no"> |
|
|
|
<view class="es-icon"></view> |
|
|
|
<view class="es-order-btn">查看订单</view> |
|
|
|
<view class="es-order-btn" @click="toOrderDetail">查看订单</view> |
|
|
|
<view class="es-txt">兑换成功</view> |
|
|
|
<view class="es-container"> |
|
|
|
<view class="ec-stadium"> |
|
|
|
<view class="es-logo"></view> |
|
|
|
<view class="es-name">MJ体育(天空篮球从云店)</view> |
|
|
|
<image v-if="orderInfo?.stadium_logo" class="es-logo" mode="aspectFit" :src="orderInfo?.stadium_logo ?? ''"></image> |
|
|
|
<view class="es-name">{{ orderInfo?.stadium_name ?? '' }}</view> |
|
|
|
</view> |
|
|
|
<view class="ec-info"> |
|
|
|
<text-line label="预订项目:">单次卡</text-line> |
|
|
|
<text-line label="预订项目:">{{ orderInfo?.project ?? '-' }}</text-line> |
|
|
|
<text-line label="可用票数:">1</text-line> |
|
|
|
<text-line label="到期时间:">2020-10-16 17:45:20</text-line> |
|
|
|
<text-line label="到期时间:">{{ orderInfo?.EndTime ?? '' }}</text-line> |
|
|
|
</view> |
|
|
|
<view class="ec-line"></view> |
|
|
|
<view class="ec-code"> |
|
|
|
<view class="ec-tip">点击二维码可放大查看</view> |
|
|
|
<image class="ec-img"></image> |
|
|
|
<image |
|
|
|
v-if="orderInfo?.verify_qrcode" |
|
|
|
class="ec-img" |
|
|
|
mode="aspectFit" |
|
|
|
:src="orderInfo?.verify_qrcode" |
|
|
|
@click="previewCode" |
|
|
|
></image> |
|
|
|
<view class="ec-txt"> |
|
|
|
<view class="et-num">验证码:12253 51234</view> |
|
|
|
<view class="et-copy">复制</view> |
|
|
|
<view class="et-num">验证码:{{ orderInfo?.verify_code ?? '' }}</view> |
|
|
|
<view class="et-copy" @click="copyBtn">复制</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="ec-desc"> |
|
|
@ -43,7 +100,7 @@ onLoad(() => { |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="es-share">分享给朋友 </view> |
|
|
|
<view class="es-share" v-if="false">分享给朋友 </view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
@ -85,7 +142,6 @@ onLoad(() => { |
|
|
|
margin-right: 20upx; |
|
|
|
width: 36upx; |
|
|
|
height: 36upx; |
|
|
|
background: skyblue; |
|
|
|
} |
|
|
|
.es-name{ |
|
|
|
flex-grow: 1; |
|
|
|