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.

289 lines
6.4 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<template>
<view class='ordercontainer'>
<!-- <view>
<u-navbar :custom-back="toMe" :is-back="true" :is-fixed='true' title-color="black" :border-bottom="false" title="我的订单"
:background="{'background':'#FFFFFF'}">
</u-navbar>
</view> -->
<view class="tabsnav">
<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>
</view>
<view class="orderlist">
<!-- 1条数据开始 -->
<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>
<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">
<!-- -->
<text class="deleteorder" @click="copyText('单号')" v-if="item.status==1">物流查询</text>
<text class="deleteorder" @click="edit(item)" v-if="item.can_update">修改</text>
<text class="orderinform">通知收件人</text>
</view>
</view>
</view>
</block>
<!-- 1条数据结束 -->
</view>
</view>
</template>
<script>
import {
isNull
} from '@/common/util.js'
export default {
data() {
return {
list: [{
name: '全部',
status: '',
}, {
name: '待发货',
status: 0
}, {
name: '已发货',
status: 1
}],
status: '',
current: 0,
orderList: [],
showData: true
}
},
onLoad() {
this.getOrderList()
},
methods: {
change(index) {
this.current = index;
this.status = this.list[index].status
this.getOrderList()
},
toDetail(item) {
uni.setStorageSync('order_detail', item)
uni.navigateTo({
url: '/packages/myorder/infoconfirm'
})
},
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
},
edit(item) {
uni.setStorageSync('vuex_update_card', item)
uni.navigateTo({
url: '/packages/order/order?hasCard=true&type=edit'
})
},
// 复制文本到剪贴板
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);
// 可以添加错误处理或用户友好的提示
}
})
}
}
}
</script>
<style lang="scss">
.ordercontainer {
background: #f0efed;
width: 100%;
height: 100vh;
overflow-y: scroll;
}
.tabsnav {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 80rpx;
z-index: 999;
overflow: hidden;
text-align: center;
// padding: 0 33rpx;
}
.tabsnav {
/deep/ .u-tab-item {
z-index: 2;
}
}
.orderlist {
padding: 82rpx 50rpx 56rpx;
}
.orderitem {
overflow: hidden;
margin-bottom: 25rpx;
background: url(../../static/libg.jpg) no-repeat center center;
background-size: cover;
border-radius: 10rpx;
box-shadow: 0 5px 15px rgba(0, 0, 0, .47);
padding: 12rpx;
}
.ordertop {
display: flex;
padding: 13rpx 20rpx 23rpx;
justify-content: space-between;
}
.ordertop text {
font-size: 24rpx;
color: #f2d6c1;
}
.orderinfo {
background: #fff;
padding: 24rpx;
border-radius: 10rpx;
}
.orderbrief {
display: flex;
padding-bottom: 24rpx;
}
.orderimg {
border: 1rpx solid rgba(186, 139, 69, .6);
border-radius: 10rpx;
overflow: hidden;
width: 150rpx;
height: 150rpx;
background: #fff;
text-align: center;
}
.orderimg image {
width: 100%;
height: auto;
vertical-align: middle;
}
.orderright {
padding-left: 32rpx;
width: 430rpx;
font-size: 24rpx;
color: #000;
padding-top: 20rpx;
}
.ordertitle {
height: 40rpx;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
line-height: 40rpx;
}
.ordersmalltext {
text-align: justify;
}
.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;
}
.ordertime view text.orderweek {
color: #b62828;
margin: 0 10rpx;
}
.ordertab {
display: flex;
justify-content: flex-end;
}
.ordertab text {
display: inline-block;
width: 160rpx;
height: 50rpx;
margin-left: 22rpx;
border-radius: 50rpx;
text-align: center;
line-height: 50rpx;
border: 1rpx solid #cececd;
font-size: 24rpx;
color: #000;
}
.ordertab text.orderinform {
color: #ba8b45;
margin-right: 0;
}
.nodata {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
</style>