|
|
@@ -17,12 +17,12 @@ |
|
|
|
<view v-for="(item,index) in tabItem.orderList" :key="index" class="order-item" @click="navTo('/pages/order/orderDetail?order_id='+item.order_id)"> |
|
|
|
<view class="i-top b-b"> |
|
|
|
<text class="time">{{item.createtime}}</text> |
|
|
|
<text class="state" :style="{color: item.stateTipColor}">{{item.stateTip + (item.refund_status_text ? ':'+item.refund_status_text : '')}} </text> |
|
|
|
<text class="state" :style="{color: item.stateTipColor}">{{item.stateTip + (item.refund_status_text ? ':'+item.refund_status_text : '')}} |
|
|
|
</text> |
|
|
|
<text v-if="item.state===9" class="del-btn yticon icon-lajitong" @click.stop="deleteOrder(index)"></text> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="goods-box-single" v-for="(goodsItem, goodsIndex) in item.products" |
|
|
|
:key="goodsIndex"> |
|
|
|
<view class="goods-box-single" v-for="(goodsItem, goodsIndex) in item.products" :key="goodsIndex"> |
|
|
|
<image class="goods-img" :src="goodsItem.image" mode="aspectFill"></image> |
|
|
|
<view class="right"> |
|
|
|
<text class="refund" v-if="goodsItem.refund">退款成功</text> |
|
|
@@ -52,7 +52,7 @@ |
|
|
|
<!-- <button class="action-btn" v-if="item.have_received != 0 && item.have_commented != 0">追加评价</button> --> |
|
|
|
<!-- <button class="action-btn" v-if="item.have_paid != 0" @click.stop="button('refund', item)">申请售后</button> --> |
|
|
|
</view> |
|
|
|
<!-- <view class="action-box b-t" v-if="item.state == 9 && item.status == -1"> |
|
|
|
<!-- <view class="action-box b-t" v-if="item.state == 9 && item.status == -1"> |
|
|
|
<button class="action-btn" v-if="item.have_paid != 0" @click.stop="button('refund', item)">查看售后</button> |
|
|
|
</view> --> |
|
|
|
</view> |
|
|
@@ -74,6 +74,7 @@ |
|
|
|
data() { |
|
|
|
return { |
|
|
|
tabCurrentIndex: 0, |
|
|
|
// 0=全部,1=待付款,2=待发货,3=待收货,4=待评价,5=售后 |
|
|
|
navList: [{ |
|
|
|
state: 0, |
|
|
|
text: 'all', |
|
|
@@ -103,14 +104,14 @@ |
|
|
|
// page: 1 |
|
|
|
// }, |
|
|
|
{ |
|
|
|
state: 4, |
|
|
|
state: 3, |
|
|
|
text: 'Completed', |
|
|
|
loadingType: 'more', |
|
|
|
orderList: [], |
|
|
|
page: 1 |
|
|
|
}, |
|
|
|
{ |
|
|
|
state: 5, |
|
|
|
state: 4, |
|
|
|
text: 'Cancelled', |
|
|
|
loadingType: 'more', |
|
|
|
orderList: [], |
|
|
@@ -125,6 +126,7 @@ |
|
|
|
* 修复app端点击除全部订单外的按钮进入时不加载数据的问题 |
|
|
|
* 替换onLoad下代码即可 |
|
|
|
*/ |
|
|
|
console.log(options) |
|
|
|
this.tabCurrentIndex = +options.state; |
|
|
|
// #ifndef MP |
|
|
|
this.loadData() |
|
|
@@ -143,6 +145,9 @@ |
|
|
|
async loadData(source) { |
|
|
|
//这里是将订单挂载到tab列表下 |
|
|
|
let index = this.tabCurrentIndex; |
|
|
|
// let navItem = this.navList.find((item) => { |
|
|
|
// return item.state == (index == 3 ? '4' : index == 4 ? '9' : index); |
|
|
|
// }) |
|
|
|
let navItem = this.navList[index]; |
|
|
|
let state = navItem.state; |
|
|
|
|
|
|
@@ -162,7 +167,7 @@ |
|
|
|
navItem.loadingType = 'loading'; |
|
|
|
|
|
|
|
let result = await this.$api.request('/order/getOrders', 'GET', { |
|
|
|
type: state, |
|
|
|
type: state == 3 ? '4' : state == 4 ? '5' : state, |
|
|
|
page: navItem.page, |
|
|
|
pagesize: this.pageSize |
|
|
|
}); |
|
|
@@ -191,6 +196,7 @@ |
|
|
|
|
|
|
|
//swiper 切换 |
|
|
|
changeTab(e) { |
|
|
|
console.log(e.target) |
|
|
|
this.tabCurrentIndex = e.target.current; |
|
|
|
this.loadData('tabChange'); |
|
|
|
}, |
|
|
@@ -201,25 +207,29 @@ |
|
|
|
//删除订单 |
|
|
|
async deleteOrder(index) { |
|
|
|
let [error, res] = await uni.showModal({ |
|
|
|
cancelText:'Cancel', |
|
|
|
confirmText:'OK', |
|
|
|
cancelText: 'Cancel', |
|
|
|
confirmText: 'OK', |
|
|
|
title: 'Confirm delete order' |
|
|
|
}); |
|
|
|
if (res.confirm) { |
|
|
|
if (res.confirm) { |
|
|
|
// let index = this.tabCurrentIndex; |
|
|
|
// let order_id = this.navList.find((item) => { |
|
|
|
// return item.state == return item.state == (index == 3 ? '4' : index == 4 ? '9' : index); |
|
|
|
// }).orderList[index].order_id; |
|
|
|
let order_id = this.navList[this.tabCurrentIndex].orderList[index].order_id; |
|
|
|
let result = await this.$api.request('/order/delete?order_id=' + order_id) |
|
|
|
if (result) { |
|
|
|
this.navList[this.tabCurrentIndex].orderList.splice(index, 1); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
//取消订单 |
|
|
|
async cancelOrder(item) { |
|
|
|
let that = this; |
|
|
|
let [error, res] = await uni.showModal({ |
|
|
|
cancelText:'Cancel', |
|
|
|
confirmText:'OK', |
|
|
|
cancelText: 'Cancel', |
|
|
|
confirmText: 'OK', |
|
|
|
title: 'Confirm cancel order', |
|
|
|
content: 'Unrecoverable after cancellation', |
|
|
|
}); |
|
|
@@ -240,8 +250,9 @@ |
|
|
|
if (position !== -1) { |
|
|
|
that.navList[0].orderList[position] = item; |
|
|
|
} |
|
|
|
// todo 已取消的添加进已取消列表 |
|
|
|
|
|
|
|
//退款后删除待付款中该项 |
|
|
|
//取消后删除待付款中该项 |
|
|
|
let list = that.navList[1].orderList; |
|
|
|
let index = list.findIndex(val => val.order_id === item.order_id); |
|
|
|
index !== -1 && list.splice(index, 1); |
|
|
@@ -255,8 +266,8 @@ |
|
|
|
async refunded(item) { |
|
|
|
let that = this; |
|
|
|
let [error, res] = await uni.showModal({ |
|
|
|
cancelText:'Cancel', |
|
|
|
confirmText:'OK', |
|
|
|
cancelText: 'Cancel', |
|
|
|
confirmText: 'OK', |
|
|
|
title: 'Confirm refund', |
|
|
|
content: 'Unrecoverable after refund', |
|
|
|
}); |
|
|
@@ -281,7 +292,7 @@ |
|
|
|
that.navList[0].orderList[position] = item; |
|
|
|
} |
|
|
|
|
|
|
|
//取消订单后删除待付款中该项 |
|
|
|
//退款后删除待发货中该项 |
|
|
|
let list = that.navList[2].orderList; |
|
|
|
let index = list.findIndex(val => val.order_id === item.order_id); |
|
|
|
index !== -1 && list.splice(index, 1); |
|
|
@@ -295,8 +306,8 @@ |
|
|
|
async receivedOrder(item) { |
|
|
|
let that = this; |
|
|
|
let [error, res] = await uni.showModal({ |
|
|
|
cancelText:'Cancel', |
|
|
|
confirmText:'OK', |
|
|
|
cancelText: 'Cancel', |
|
|
|
confirmText: 'OK', |
|
|
|
title: 'Confirm receipt' |
|
|
|
}); |
|
|
|
if (res.confirm == true) { |
|
|
@@ -305,12 +316,12 @@ |
|
|
|
}); |
|
|
|
if (res) { |
|
|
|
// 已确认收货 |
|
|
|
|
|
|
|
|
|
|
|
let { |
|
|
|
stateTip, |
|
|
|
stateTipColor |
|
|
|
} = that.orderStateExp(4); |
|
|
|
|
|
|
|
|
|
|
|
// 更新全部订单里面的状态 |
|
|
|
let position = that.navList[0].orderList.findIndex(val => val.order_id === item.order_id); |
|
|
|
if (position !== -1) { |
|
|
@@ -323,7 +334,7 @@ |
|
|
|
have_received: 1 |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//收货订单后删除待收货中该项 |
|
|
|
let list = that.navList[3].orderList; |
|
|
|
let index = list.findIndex(val => val.order_id === item.order_id); |
|
|
@@ -348,12 +359,12 @@ |
|
|
|
case 2: |
|
|
|
stateTip = '待发货'; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
stateTip = '待收货'; |
|
|
|
// case 3: // |
|
|
|
// stateTip = '待收货'; |
|
|
|
// break; |
|
|
|
case 4: // |
|
|
|
stateTip = '已完成'; |
|
|
|
break; |
|
|
|
// case 4: |
|
|
|
// stateTip = '待评价'; |
|
|
|
// break; |
|
|
|
case 5: |
|
|
|
stateTip = '已取消'; |
|
|
|
break; |
|
|
@@ -399,7 +410,8 @@ |
|
|
|
this.receivedOrder(item); |
|
|
|
break; |
|
|
|
case 'evaluate': |
|
|
|
this.$api.navTo('/pages/order/evaluate?product_id='+item.id+'&order_id='+item.order_id+'&image='+item.image+'&title='+item.title+'&spec='+item.spec); |
|
|
|
this.$api.navTo('/pages/order/evaluate?product_id=' + item.id + '&order_id=' + item.order_id + '&image=' + item.image + |
|
|
|
'&title=' + item.title + '&spec=' + item.spec); |
|
|
|
break; |
|
|
|
case 'refund': |
|
|
|
this.$api.navTo('/pages/order/refund?order_id=' + item.order_id); |
|
|
@@ -440,14 +452,14 @@ |
|
|
|
// page: 1 |
|
|
|
// }, |
|
|
|
{ |
|
|
|
state: 4, |
|
|
|
state: 3, |
|
|
|
text: 'Completed', |
|
|
|
loadingType: 'more', |
|
|
|
orderList: [], |
|
|
|
page: 1 |
|
|
|
}, |
|
|
|
{ |
|
|
|
state: 5, |
|
|
|
state: 4, |
|
|
|
text: 'Cancelled', |
|
|
|
loadingType: 'more', |
|
|
|
orderList: [], |
|
|
@@ -598,6 +610,7 @@ |
|
|
|
padding: 0 30upx 0 24upx; |
|
|
|
overflow: hidden; |
|
|
|
position: relative; |
|
|
|
|
|
|
|
.title { |
|
|
|
font-size: $font-base + 2upx; |
|
|
|
color: $font-color-dark; |
|
|
@@ -620,7 +633,8 @@ |
|
|
|
margin: 0 2upx 0 8upx; |
|
|
|
} |
|
|
|
} |
|
|
|
.action-btn{ |
|
|
|
|
|
|
|
.action-btn { |
|
|
|
width: 160rpx; |
|
|
|
height: 60rpx; |
|
|
|
padding: 0; |
|
|
@@ -635,7 +649,8 @@ |
|
|
|
right: 30rpx; |
|
|
|
bottom: 0; |
|
|
|
} |
|
|
|
.refund{ |
|
|
|
|
|
|
|
.refund { |
|
|
|
position: absolute; |
|
|
|
right: 30rpx; |
|
|
|
font-size: 28rpx; |
|
|
|