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.

341 lines
7.8 KiB

2 years ago
<template>
1 year ago
<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> -->
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')"
1 year ago
></image>
1 year ago
</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)">
1 year ago
<text>预计发货时间</text>
1 year ago
<view>{{item.send_date?$moment(item.send_date).format("M月DD日"):''}}<text
1 year ago
class="orderweek">{{item.week?'['+item.week+']':''}}</text>
<!-- {{item.hh?item.hh:''}} -->
1 year ago
</view>
</view>
1 year ago
<view class="ordertab">
<!-- -->
<text class="deleteorder" @click="copyText(item)" v-if="item.status==1"></text>
1 year ago
<text class="deleteorder" @click="edit(item)" v-if="item.status===0"></text>
1 year ago
<text class="orderinform" @click="copyText(item,'send')"></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: [],
1 year ago
showData: true,
updateFalse:'',
2 years ago
}
},
1 year ago
onLoad() {
const configs = uni.getStorageSync('configs')
configs.map(item=>{
if(item.key==='updateFalse'){
this.updateFalse = item.value
}
})
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
1 year ago
},
1 year ago
edit(item) {
if(item.can_update){
uni.setStorageSync('vuex_update_card', item)
uni.navigateTo({
url: '/packages/order/order?hasCard=true&type=edit'
})
}else{
uni.showToast({
title: this.updateFalse || '不可更改',
icon: 'none',
duration: 2000
});
}
1 year ago
},
// 复制文本到剪贴板
1 year ago
copyText(item,type) {
// 通知收件人
let message = ''
if(type=='send'){
1 year ago
message = `${item.contact}先生/女士,您兑换的${item.sku.name}${item.sku.specs})将于${item.send_date}发货,请保持电话${item.mobile}畅通。`
1 year ago
}else{
message = item.express_number
1 year ago
}
1 year ago
uni.setClipboardData({
1 year ago
data: message,
success: function() {
if(type=='send'){
uni.showToast({
title: '复制成功,快发给好友吧。',
icon: 'none',
duration: 2000
});
}else{
uni.showToast({
title: '单号复制成功',
icon: 'none',
duration: 2000,
1 year ago
});
if(item.express_type.appid){
setTimeout(function(){
uni.navigateToMiniProgram({
appId: item.express_type.appid, // 小程序appid
path: '', // 打开的页面路径,若为空则打开首页
extraData: {
// 需要传递给小程序的数据
},
success(res) {
// 打开成功的回调
},
fail(err) {
// 打开失败的回调
}
})
},2000)
}
1 year ago
}
1 year ago
},
1 year ago
fail: function(e) {
uni.showToast({
title: '单号复制失败',
icon: 'none',
duration: 2000
});
1 year ago
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%;
1 year ago
height: 100%;
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>