|
@@ -83,10 +83,17 @@
|
|
|
</view>
|
|
|
<view
|
|
|
class="bottom-btn-wrap"
|
|
|
- v-if="orderInfo.payStatus == 0 || orderInfo.payStatus == 2 || orderInfo.payStatus == 3"
|
|
|
+ v-if="(orderInfo.payStatus == 0 || orderInfo.payStatus == 2 || orderInfo.payStatus == 3) && openFlag !== 'open'"
|
|
|
>
|
|
|
<view class="bottom-btn" @click="goPay(orderId)">去支付</view>
|
|
|
</view>
|
|
|
+ <view
|
|
|
+ class="bottom-btn-wrap"
|
|
|
+ v-if="openFlag === 'open' && orderInfo.payStatus == 1"
|
|
|
+ >
|
|
|
+ <view class="bottom-btn" @click="jumpOrderList()">返回订单页</view>
|
|
|
+ </view>
|
|
|
+
|
|
|
<!-- 支付方式 -->
|
|
|
<PaymentMethod
|
|
|
:payWayPop="payWayPop"
|
|
@@ -94,6 +101,13 @@
|
|
|
:jumpUrl="jumpUrl"
|
|
|
@closePaymentMethod="closePaymentMethod"
|
|
|
></PaymentMethod>
|
|
|
+
|
|
|
+ <!-- 加载中遮罩 -->
|
|
|
+ <u-mask :show="loadingMask">
|
|
|
+ <view class="loading-warp">
|
|
|
+ <u-loading mode="flower" size="50"></u-loading>
|
|
|
+ </view>
|
|
|
+ </u-mask>
|
|
|
<u-toast ref="uToast" />
|
|
|
</view>
|
|
|
</template>
|
|
@@ -107,43 +121,52 @@ export default {
|
|
|
data () {
|
|
|
return {
|
|
|
orderId: null,
|
|
|
+ openFlag: null,
|
|
|
// 订单信息
|
|
|
orderInfo: {},
|
|
|
// 立即支付弹框
|
|
|
payWayPop: false,
|
|
|
// 订单列表,一般长度为1的数组
|
|
|
orderList: [],
|
|
|
- // 重定向页面
|
|
|
- jumpUrl: location.href + '&type=open'
|
|
|
+ // 重定向页面
|
|
|
+ jumpUrl: location.href + '&type=open',
|
|
|
+ loadingMask: false
|
|
|
}
|
|
|
},
|
|
|
onLoad (page) {
|
|
|
const orderId = page?.orderId
|
|
|
- // 该标识判断是否是从支付完成页面回调回来
|
|
|
- const openFlag = page?.type
|
|
|
- if (orderId) {
|
|
|
- this.orderId = orderId
|
|
|
- // 如果标识存在,证明需要执行轮询判断支付状态,否则直接查询
|
|
|
- if (openFlag && openFlag === 'open') {
|
|
|
- this.handleGetOrderinfo(orderId, openFlag)
|
|
|
- let time = 0
|
|
|
- this.timer = setInterval(() => {
|
|
|
- time ++
|
|
|
+ // 该标识判断是否是从支付完成页面回调回来
|
|
|
+ const openFlag = page?.type
|
|
|
+ if (orderId) {
|
|
|
+ this.orderId = orderId
|
|
|
+ // 如果标识存在,证明需要执行轮询判断支付状态,否则直接查询
|
|
|
+ if (openFlag && openFlag === 'open') {
|
|
|
+ this.openFlag = openFlag
|
|
|
+ this.loadingMask = true
|
|
|
this.handleGetOrderinfo(orderId, openFlag)
|
|
|
- // 超过60s直接清除轮询
|
|
|
- if (time === 60) {
|
|
|
- clearInterval(this.timer)
|
|
|
- }
|
|
|
- }, 1000)
|
|
|
- } else {
|
|
|
- this.handleGetOrderinfo(orderId)
|
|
|
+ let time = 0
|
|
|
+ this.timer = setInterval(() => {
|
|
|
+ time ++
|
|
|
+ this.handleGetOrderinfo(orderId, openFlag)
|
|
|
+ // 超过60s直接清除轮询
|
|
|
+ if (time === 60) {
|
|
|
+ clearInterval(this.timer)
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ } else {
|
|
|
+ this.handleGetOrderinfo(orderId)
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
},
|
|
|
methods: {
|
|
|
- /**
|
|
|
- * 通过订单id去获取订单信息
|
|
|
- * */
|
|
|
+ jumpOrderList() {
|
|
|
+ this.$u.route({
|
|
|
+ url: 'pages/center/order/order'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 通过订单id去获取订单信息
|
|
|
+ * */
|
|
|
handleGetOrderinfo (orderId, openFlag) {
|
|
|
this.$u.api.getOrderDetail({ id: orderId })
|
|
|
.then(res => {
|
|
@@ -151,6 +174,7 @@ export default {
|
|
|
this.orderInfo = res.data
|
|
|
if (openFlag === 'open') {
|
|
|
if (res.data.payStatus === 1 || res.data.payStatus === 3) {
|
|
|
+ this.loadingMask = false
|
|
|
clearInterval(this.timer)
|
|
|
}
|
|
|
}
|