|
@@ -1,7 +1,6 @@
|
|
|
<template>
|
|
|
<view>
|
|
|
- <u-navbar title="我的订单" @leftClick="back" :border="true" :placeholder="true" :autoBack="false"
|
|
|
- leftIconColor="#fff" bgColor="#E96737" />
|
|
|
+ <u-navbar title="我的订单" :border="true" :placeholder="true" :autoBack="true" bgColor="#fff" />
|
|
|
<view class="order">
|
|
|
<view class="flex order-state-search">
|
|
|
<u-tabs @change="changeTab" :scrollable="false" :list="statusArr" lineWidth="30" lineHeight="1"
|
|
@@ -11,7 +10,7 @@
|
|
|
}" :inactiveStyle="{
|
|
|
color: '#333',
|
|
|
transform: 'scale(1)'
|
|
|
- }" itemStyle="padding-left: 25px; padding-right: 25px; height: 44px;">
|
|
|
+ }" itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;">
|
|
|
</u-tabs>
|
|
|
<view class="test"></view>
|
|
|
</view>
|
|
@@ -35,21 +34,16 @@
|
|
|
<image class="img" :src="items.picUrl" mode="aspectFill">
|
|
|
</image>
|
|
|
</view>
|
|
|
- <view class="info">
|
|
|
- <text>{{ items.title }}</text>
|
|
|
- <text>面值:{{ $numberFormat(items.facePrice) }}元</text>
|
|
|
- <text>规格:{{ items.pkgUnit }}张/包 </text>
|
|
|
- </view>
|
|
|
</view>
|
|
|
<view class="order-list-data-item__info__detail__right">
|
|
|
- <text>¥{{ $numberFormat(items.pkgSalePrice) }}</text>
|
|
|
- <text>x {{ items.orderNum }}</text>
|
|
|
+ <view class="title">{{ items.title }}</view>
|
|
|
+ <view class="num">x {{ items.goodsNum }}</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</navigator>
|
|
|
|
|
|
<view class="order-list-data-item__info__total">
|
|
|
- <view>共{{ item.pkgNum }}个票包</view>
|
|
|
+ <view>共{{ item.orderNum }}个商品</view>
|
|
|
<view class="money">
|
|
|
<text>实付:</text>
|
|
|
<text>¥{{ $numberFormat(item.payAmt) }}</text>
|
|
@@ -58,12 +52,12 @@
|
|
|
|
|
|
<view class="order-list-data-item__info__btn" v-if="item.status.value == 0">
|
|
|
<text @click="cancelOrder(item.orderId)">取消订单</text>
|
|
|
- <text @click="payOrder">去支付</text>
|
|
|
+ <text @click="payOrder(item)">去支付</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="flex empty" v-if="!list.length">
|
|
|
+ <view class="flex empty" v-if="!list.length && !loading">
|
|
|
<u-empty text="订单为空" mode="order" />
|
|
|
</view>
|
|
|
</view>
|
|
@@ -78,13 +72,10 @@
|
|
|
data() {
|
|
|
return {
|
|
|
loading: false,
|
|
|
- days: '1',
|
|
|
pageNum: 1,
|
|
|
total: 100,
|
|
|
list: [],
|
|
|
status: null,
|
|
|
- top: '',
|
|
|
-
|
|
|
statusArr: [{
|
|
|
name: '全部'
|
|
|
}, {
|
|
@@ -93,64 +84,96 @@
|
|
|
name: '待发货'
|
|
|
}, {
|
|
|
name: '已发货'
|
|
|
+ }, {
|
|
|
+ name: '已取消'
|
|
|
}, ],
|
|
|
- backNum: ''
|
|
|
};
|
|
|
},
|
|
|
- onLoad(opthios) {
|
|
|
- this.backNum = opthios.back
|
|
|
- },
|
|
|
+ onLoad(opthios) {},
|
|
|
onShow() {
|
|
|
- this.getList()
|
|
|
+ this.pageList()
|
|
|
},
|
|
|
methods: {
|
|
|
- back() {
|
|
|
- if (this.backNum) {
|
|
|
- uni.navigateBack({
|
|
|
- delta: 2
|
|
|
- })
|
|
|
- } else {
|
|
|
- uni.navigateBack({
|
|
|
- delta: 1
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
- getList(flag) {
|
|
|
- let data = {
|
|
|
+ getList() {
|
|
|
+ uni.showLoading({
|
|
|
+ title: '加载中'
|
|
|
+ });
|
|
|
+ this.loading = true
|
|
|
+ $http.post(`/api/v1/mp/user/deliver/order/list?pageNum=${ this.pageNum }&pageSize=20`, {
|
|
|
status: this.status
|
|
|
- }
|
|
|
- $http.post(`/api/v1/mp/channel/mall/order/list?pageNum=${ this.pageNum }&pageSize=15`,
|
|
|
- data).then(res => {
|
|
|
+ }).then(res => {
|
|
|
+ uni.hideLoading();
|
|
|
+ this.loading = false
|
|
|
if (res.code == 0) {
|
|
|
res.rows.forEach(item => {
|
|
|
let items = item.items
|
|
|
items.forEach(item => {
|
|
|
- let picUrlArr = item.picUrl.split(',')
|
|
|
- item.picUrl = env.filePublic + picUrlArr[0]
|
|
|
+ item.picUrl = env.filePublic + item.picUrl
|
|
|
})
|
|
|
item.status = JSON.parse(item.status)
|
|
|
})
|
|
|
this.total = res.total
|
|
|
this.list = this.list.concat(res.rows)
|
|
|
}
|
|
|
+ }).catch(() => {
|
|
|
+ uni.hideLoading();
|
|
|
+ this.loading = false
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ pageList() {
|
|
|
+ this.pageNum = 1
|
|
|
+ this.list = []
|
|
|
+ this.getList()
|
|
|
+ },
|
|
|
+
|
|
|
cancelOrder(id) {
|
|
|
- $http.post('/api/v1/mp/channel/mall/order/cancel', {
|
|
|
+ $http.post('/api/v1/mp/user/deliver/order/cancel', {
|
|
|
orderId: id
|
|
|
}).then(res => {
|
|
|
if (res.code == 0) {
|
|
|
uni.$u.toast('订单取消成功');
|
|
|
- this.pageNum = 1
|
|
|
- this.list = []
|
|
|
- this.getList()
|
|
|
+ this.pageList()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- payOrder() {
|
|
|
-
|
|
|
+ payOrder(item) {
|
|
|
+ let _this = this
|
|
|
+ let payIng = false
|
|
|
+ if (payIng) return
|
|
|
+ $http.post('/api/v1/mp/user/deliver/order/pay', {
|
|
|
+ orderId: item.orderId,
|
|
|
+ payType: 2
|
|
|
+ }).then(ele => {
|
|
|
+ payIng = true
|
|
|
+ if (ele.code == 0) {
|
|
|
+ uni.requestPayment({
|
|
|
+ timeStamp: ele.data.timeStamp,
|
|
|
+ nonceStr: ele.data.nonceStr,
|
|
|
+ package: ele.data.package,
|
|
|
+ signType: ele.data.signType,
|
|
|
+ paySign: ele.data.paySign,
|
|
|
+ success() {
|
|
|
+ uni.showToast({
|
|
|
+ title: '支付成功',
|
|
|
+ icon: 'success',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ _this.pageList()
|
|
|
+ },
|
|
|
+ fail() {
|
|
|
+ payIng = false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ payIng = false
|
|
|
+ uni.$u.toast('支付失败!');
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ payIng = false
|
|
|
+ uni.$u.toast('支付失败!');
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
changeTab(e) {
|
|
@@ -160,18 +183,18 @@
|
|
|
this.status = 0
|
|
|
} else if (e.index == 2) {
|
|
|
this.status = 1
|
|
|
- } else {
|
|
|
+ } else if (e.index == 3) {
|
|
|
this.status = 2
|
|
|
+ } else if (e.index == 4) {
|
|
|
+ this.status = -1
|
|
|
}
|
|
|
- this.pageNum = 1
|
|
|
- this.list = []
|
|
|
- this.getList()
|
|
|
+ this.pageList()
|
|
|
},
|
|
|
},
|
|
|
|
|
|
onReachBottom() {
|
|
|
// 判断是否有数据
|
|
|
- if (this.total >= this.pageNum * 15) {
|
|
|
+ if (this.total > this.pageNum * 20) {
|
|
|
setTimeout(() => {
|
|
|
++this.pageNum
|
|
|
this.getList()
|
|
@@ -183,11 +206,6 @@
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
-<style lang="scss" scoped>
|
|
|
- /deep/ .u-navbar__content__title.u-navbar__content__title {
|
|
|
- color: #FFFFFF;
|
|
|
- }
|
|
|
-</style>
|
|
|
<style lang="scss" scoped>
|
|
|
.order {
|
|
|
padding-bottom: 40rpx;
|
|
@@ -249,42 +267,21 @@
|
|
|
height: 170rpx;
|
|
|
|
|
|
.img {
|
|
|
-
|
|
|
image {
|
|
|
width: 134rpx;
|
|
|
height: 170rpx;
|
|
|
margin-right: 20rpx;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- .info {
|
|
|
- display: flex;
|
|
|
- flex-direction: column;
|
|
|
- justify-content: space-between;
|
|
|
-
|
|
|
- text {
|
|
|
- font-size: 24rpx;
|
|
|
- color: #9D9D9D;
|
|
|
- }
|
|
|
-
|
|
|
- text:first-child {
|
|
|
- color: rgba(16, 16, 16, 100);
|
|
|
- font-size: 28rpx;
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
&__right {
|
|
|
+ flex: 1;
|
|
|
display: flex;
|
|
|
height: 170rpx;
|
|
|
flex-direction: column;
|
|
|
justify-content: space-between;
|
|
|
align-items: flex-end;
|
|
|
-
|
|
|
- text:first-child {
|
|
|
- font-size: 32rpx;
|
|
|
- color: $uni-text-color;
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
}
|