Files
BlockChainH5/pages/store/return.vue
2021-09-23 17:38:06 +08:00

172 lines
5.3 KiB
Vue

<template>
<view>
<!-- 订单分类 -->
<scroll-view class="nav" scroll-x="true" scroll-with-animation="true">
<view :class="['nav-item', selectNavId === item.id ? 'nav-item-selected':'']" v-for="(item,index) in navList" :key="index" @click="selectNav(item.id)">
{{item.name}}
</view>
</scroll-view>
<!-- 订单列表 -->
<store-order v-if="returnInfo.length > 0" :list="returnInfo" />
<view v-else class="pack-center">
<image src="../../static/icons/order-null.png"></image>
<view>您还没有相关订单</view>
</view>
</view>
</template>
<script>
import { storeReturn, storeSign, storeToken } from '@/apis/interfaces/store'
import storeOrder from '@/components/store-order/store-order'
export default {
comments:{
storeOrder
},
data() {
return {
returnInfo : '' ,// 列表
navList : [{
name : '待审核',
id : 'apply'
},{
name : '待返货',
id : 'deliver'
},{
name : '待签收',
id : 'delivered'
},{
name : '已签收',
id : 'signed'
},
{
name : '待确认退货',
id : 'process'
},
{
name : '完成退货',
id : 'completed'
}
],
selectNavId : 'apply'
}
},
created() {
},
onShow() {
// 获取退货单列表
this.returnData();
},
methods: {
// 退货单列表
returnData(){
storeReturn(this.selectNavId).then(res=>{
this.returnInfo = res.data
})
},
// 选择订单
selectNav(id) {
if (this.selectNavId !== id) {
this.selectNavId = id
this.returnData()
}
},
// 签收订单
goSign(orderNo,index) {
uni.showModal({
title: '是否签收此订单?',
success: res => {
if(res.confirm) {
storeSign(orderNo).then(() => {
uni.showToast({
icon: 'none',
title: '签收成功'
})
setTimeout(()=>{
this.returnData()
},3000)
}).catch(err => {
uni.showToast({
icon: 'none',
title: err.message
})
})
}
}
})
},
// 确认退货
goReToken(orderNo,index) {
uni.showModal({
title: '是否确认退货此订单?',
success: res => {
if(res.confirm) {
storeToken(orderNo).then(() => {
uni.showToast({
icon: 'none',
title: '退货成功'
})
setTimeout(()=>{
this.returnData()
},3000)
}).catch(err => {
uni.showToast({
icon: 'none',
title: err.message
})
})
}
}
})
}
}
}
</script>
<style lang="scss" scoped>
// 订单nav
.nav {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
box-sizing: border-box;
white-space: nowrap;
font-size: $title-size*0.95;
padding: 0 30rpx;
background-color: #fff;
color: #666;
position: sticky;
top: 0rpx;
z-index: 1;
.nav-item {
display: inline-block;
border-bottom: solid 4rpx #fff;
padding: 30rpx 10rpx;
margin-right: 10rpx;
}
.nav-item-selected {
border-bottom: solid 4rpx $main-color;
color: $main-color;
}
}
// 暂无订单
.pack-center {
text-align: center;
font-size: $title-size-sm;
color: $text-gray;
padding-top: 50%;
image {
width: $uni-img-size-lg * 2;
height:$uni-img-size-lg * 2;
border-radius: $uni-border-radius-circle;
margin-bottom: $margin;
}
}
</style>