You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

284 lines
6.2 KiB

2 years ago
<template>
<view class='ordercontainer'>
2 years ago
<view class="tabsnav">
1 year ago
<u-tabs :list="list" :is-scroll="true" bg-color="#f0efed" bar-width="24" bar-height="24" gutter="53"
font-size="24" inactive-color="#000" :active-item-style="{fontSize:'30rpx',color:'#ba8b45'}"
:bar-style="{ right:'-36rpx',position:'relative',bottom:'32rpx',background:'#5b5b5a'}"
:current="current" @change="change"></u-tabs>
2 years ago
</view>
1 year ago
<view class="orderlist">
<!-- 1条数据开始 -->
1 year ago
<view v-if="showData" class="nodata">
<u-empty mode="data"></u-empty>
</view>
<block v-else>
<view class="orderitem" v-for="(item,index) in orderList">
<view class="ordertop">
<text>运单号{{item.express_number?item.express_number:'-'}}</text>
<text>{{item.status==0?'待发货':'已发货'}}</text>
</view>
<view class="orderinfo">
<view class="orderbrief" @click="toDetail(item)">
<view class="orderimg">
<image
:src="item.sku?(item.sku.image_url?item.sku.image_url:require('@/static/logo-xietaitai.png')):require('@/static/logo-xietaitai.png')"
mode="widthFix"></image>
</view>
<view class="orderright">
<view class="ordertitle">{{item.sku?item.sku.name:''}}</view>
<view class="ordersmalltext">{{item.sku?item.sku.specs:''}}</view>
</view>
</view>
1 year ago
<view class="ordertime" @click="toDetail(item)">
<text>预计送达时间</text>
<view>{{item.send_date?$moment(item.send_date).format("M月DD日"):''}}<text
class="orderweek">{{item.week?'['+item.week+']':''}}</text>{{item.hh?item.hh:''}}
</view>
</view>
<view class="ordertab">
1 year ago
<!-- -->
<text class="deleteorder" @click="copyText('单号')" v-if="item.status==1"></text>
1 year ago
<text class="deleteorder" @click="edit(item)" v-if="item.can_update"></text>
<text class="orderinform">通知收件人</text>
</view>
</view>
2 years ago
</view>
1 year ago
</block>
<!-- 1条数据结束 -->
2 years ago
</view>
</view>
</template>
<script>
1 year ago
import {
isNull
} from '@/common/util.js'
2 years ago
export default {
1 year ago
2 years ago
data() {
return {
list: [{
1 year ago
name: '全部',
status: '',
2 years ago
}, {
1 year ago
name: '待发货',
status: 0
}, {
1 year ago
name: '已发货',
status: 1
}],
status: '',
current: 0,
orderList: [],
showData: true
2 years ago
}
},
onLoad() {
2 years ago
this.getOrderList()
2 years ago
},
methods: {
change(index) {
1 year ago
this.current = index;
this.status = this.list[index].status
2 years ago
this.getOrderList()
2 years ago
},
1 year ago
toDetail(item) {
2 years ago
uni.setStorageSync('order_detail', item)
uni.navigateTo({
1 year ago
url: '/packages/myorder/infoconfirm'
})
1 year ago
},
getOrderList() {
if (this.status === '') {
this.$u.api.getUserOrder().then(res => {
this.orderList = res
this.showData = res.length > 0 ? false : true
})
console.log(this.orderList.length)
} else {
this.$u.api.getUserOrder({
status: this.status
}).then(res => {
this.orderList = res
this.showData = res.length > 0 ? false : true
})
}
// this.listArea = res.regions
2 years ago
},
1 year ago
edit(item){
uni.setStorageSync('vuex_update_card',item)
1 year ago
uni.navigateTo({
1 year ago
url:'/packages/order/order?hasCard=true&type=edit'
2 years ago
})
1 year ago
},
// 复制文本到剪贴板
copyText(text) {
uni.setClipboardData({
data: '123',
success: function () {
console.log('复制成功');
// 可以添加用户友好的提示例如使用uni.showToast提示复制成功
uni.showToast({
title: '复制成功',
icon: 'success',
duration: 2000
});
},
fail: function (e) {
console.log('复制失败',e);
// 可以添加错误处理或用户友好的提示
}
})
1 year ago
}
2 years ago
}
}
</script>
1 year ago
<style lang="scss">
.ordercontainer {
background: #f0efed;
width: 100%;
height: 100vh;
1 year ago
overflow-y: scroll;
2 years ago
}
1 year ago
2 years ago
.tabsnav {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 80rpx;
2 years ago
z-index: 999;
overflow: hidden;
text-align: center;
// padding: 0 33rpx;
2 years ago
}
1 year ago
.tabsnav {
1 year ago
/deep/ .u-tab-item {
z-index: 2;
2 years ago
}
}
1 year ago
.orderlist {
padding: 82rpx 50rpx 56rpx;
}
1 year ago
.orderitem {
overflow: hidden;
margin-bottom: 25rpx;
background: url(../../static/libg.jpg) no-repeat center center;
background-size: cover;
border-radius: 10rpx;
1 year ago
box-shadow: 0 5px 15px rgba(0, 0, 0, .47);
padding: 12rpx;
}
1 year ago
.ordertop {
display: flex;
padding: 13rpx 20rpx 23rpx;
justify-content: space-between;
}
1 year ago
.ordertop text {
font-size: 24rpx;
color: #f2d6c1;
}
1 year ago
.orderinfo {
background: #fff;
padding: 24rpx;
border-radius: 10rpx;
}
1 year ago
.orderbrief {
display: flex;
padding-bottom: 24rpx;
}
1 year ago
.orderimg {
border: 1rpx solid rgba(186, 139, 69, .6);
border-radius: 10rpx;
overflow: hidden;
width: 150rpx;
height: 150rpx;
background: #fff;
text-align: center;
}
1 year ago
.orderimg image {
width: 100%;
height: auto;
vertical-align: middle;
}
1 year ago
.orderright {
padding-left: 32rpx;
width: 430rpx;
font-size: 24rpx;
color: #000;
padding-top: 20rpx;
}
1 year ago
.ordertitle {
height: 40rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 40rpx;
}
1 year ago
.ordersmalltext {
text-align: justify;
}
1 year ago
.ordertime {
display: flex;
justify-content: space-between;
line-height: 36rpx;
font-size: 24rpx;
color: #000;
padding-bottom: 10rpx;
border-bottom: 1rpx solid #ececec;
margin-bottom: 26rpx;
}
1 year ago
.ordertime view text.orderweek {
color: #b62828;
margin: 0 10rpx;
}
1 year ago
.ordertab {
display: flex;
justify-content: flex-end;
}
1 year ago
.ordertab text {
display: inline-block;
width: 160rpx;
height: 50rpx;
1 year ago
margin-left:22rpx;
border-radius: 50rpx;
text-align: center;
line-height: 50rpx;
border: 1rpx solid #cececd;
font-size: 24rpx;
color: #000;
}
1 year ago
.ordertab text.orderinform {
color: #ba8b45;
margin-right: 0;
}
1 year ago
.nodata {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
2 years ago
</style>