|
|
@@ -1,11 +1,11 @@
|
|
|
<template>
|
|
|
- <view class="default_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
|
|
|
+ <view class="default_page adffc" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
|
|
|
<cus-header title='我的订单'></cus-header>
|
|
|
<view class="tab adfac">
|
|
|
<view class="tab-pre" :class="{'active':tindex===index}" @click="changeTab(item,index)"
|
|
|
v-for="(item,index) in statusList" :key="index">{{item.name}}</view>
|
|
|
</view>
|
|
|
- <view class="list">
|
|
|
+ <view class="list" v-if="list.length">
|
|
|
<view class="list-pre" v-for="(item,index) in list" :key="index" @click.prevent="handleDetail(item)">
|
|
|
<view class="list-pre-top adfacjb">
|
|
|
<view class="list-pre-top-no">订单号:{{item.orderNo}}</view>
|
|
|
@@ -23,15 +23,23 @@
|
|
|
</view>
|
|
|
<view class="list-pre-btns adf">
|
|
|
<view class="list-pre-btns-pre cancel" v-if="item.orderStatus==0" @click.stop="orderCancel(item)">取消订单</view>
|
|
|
- <view class="list-pre-btns-pre" @click.stop="buyAgain">再次购买</view>
|
|
|
+ <view class="list-pre-btns-pre" @click.stop="handlePay(item)" v-if="item.orderStatus==0">立即支付</view>
|
|
|
+ <view class="list-pre-btns-pre" @click.stop="buyAgain" v-else>再次购买</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
+ <view class="empty adffcacjc" v-else>
|
|
|
+ <page-empty text="暂无订单"></page-empty>
|
|
|
+ </view>
|
|
|
+ <WechatPay ref="wxPay" @confirmPay="toPay" @cancelPay="cancelPay"></WechatPay>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+ import PageEmpty from '@/components/pageEmpty/index.vue'
|
|
|
+ import WechatPay from '@/components/wechatPay/index.vue'
|
|
|
export default {
|
|
|
+ components:{ PageEmpty, WechatPay },
|
|
|
data(){
|
|
|
return {
|
|
|
tindex:0,
|
|
|
@@ -66,19 +74,18 @@
|
|
|
userId:''
|
|
|
},
|
|
|
isOver:false,
|
|
|
- list:[]
|
|
|
+ list:[],
|
|
|
+ orderNo:''
|
|
|
}
|
|
|
},
|
|
|
onReachBottom() {
|
|
|
if(this.isOver) return
|
|
|
this.getList()
|
|
|
},
|
|
|
- onLoad(options) {
|
|
|
- try{
|
|
|
+ onShow() {
|
|
|
+ if(uni.getStorageSync('userInfo')){
|
|
|
this.query.userId = JSON.parse(uni.getStorageSync('userInfo')).id;
|
|
|
- this.getList()
|
|
|
- }catch(e){
|
|
|
- this.query.userId = '';
|
|
|
+ this.init()
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
@@ -121,6 +128,24 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ handlePay(item){
|
|
|
+ this.orderNo = item.orderNo;
|
|
|
+ this.$refs.wxPay.payShow = true;
|
|
|
+ },
|
|
|
+ toPay(){
|
|
|
+ this.$api.post('/pay/createOrder',{
|
|
|
+ orderNo:this.orderNo,
|
|
|
+ openId:JSON.parse(uni.getStorageSync('userInfo')).openId
|
|
|
+ }).then(({data:res})=>{
|
|
|
+ if(!res.hasOwnProperty('paySign')) return this.$showToast('支付失败')
|
|
|
+ this.$refs.wxPay.payShow = false;
|
|
|
+ this.$wxPay(res).then(result => {
|
|
|
+ uni.navigateTo({
|
|
|
+ url:'/pagesPublish/payResult'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
buyAgain(){
|
|
|
uni.navigateTo({
|
|
|
url:'/pagesPublish/rechargeCenter'
|
|
|
@@ -275,5 +300,10 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ .empty{
|
|
|
+ padding-top: 110rpx;
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|