|
|
|
|
<template>
|
|
|
|
|
<view class="order_box">
|
|
|
|
|
<view class="order_title">
|
|
|
|
|
<p @click="handleTab('')" class="tit" :class="active == '' ? 'actived' : ''">全部</p>
|
|
|
|
|
<p @click="handleTab(1)" class="tit" :class="active == 1 ? 'actived' : ''">待付款</p>
|
|
|
|
|
<p @click="handleTab(2)" class="tit" :class="active == 2 ? 'actived' : ''">待发货</p>
|
|
|
|
|
<p @click="handleTab(3)" class="tit" :class="active == 3 ? 'actived' : ''">待收货</p>
|
|
|
|
|
<p @click="handleTab(4)" class="tit" :class="active == 4 ? 'actived' : ''">已完成</p>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="order_content" v-for="(item,index) in orderData" :key="index">
|
|
|
|
|
<view class="order_item" @click="handleCheck(item)">
|
|
|
|
|
<view class="top_title">
|
|
|
|
|
<p class="title">壹人壹枕</p>
|
|
|
|
|
<p class="status_txt" v-if="item.status == 1" style="color: #D73232;">待付款</p>
|
|
|
|
|
<p class="status_txt" v-if="item.status == 2" style="color: #3E97F1;">待发货</p>
|
|
|
|
|
<p class="status_txt" v-if="item.status == 3" style="color: #D73232;">待收货</p>
|
|
|
|
|
<p class="status_txt" v-if="item.status == 4" style="color: #A5A5A5;">已完成</p>
|
|
|
|
|
<p class="status_txt" v-if="item.status == 0" style="color: #A5A5A5;">已取消</p>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="top_content">
|
|
|
|
|
<view class="left_cont">
|
|
|
|
|
<image class="img_box" :src="imgPrefix + 'zhentou_bag.png'" mode=""></image>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="right_cont">
|
|
|
|
|
<p class="right_title">{{item.goodsName}}</p>
|
|
|
|
|
<p class="bot_right">
|
|
|
|
|
<span style="font-size: 22rpx;color: #666;">共{{item.goodsNum}}件</span>
|
|
|
|
|
<span>
|
|
|
|
|
<span style="font-size: 22rpx;color: #333;">¥</span><span
|
|
|
|
|
style="font-size: 28rpx;color: #333;">{{item.goodsPrice}}</span>
|
|
|
|
|
</span>
|
|
|
|
|
</p>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<!-- <view class="sh_box" v-if="item.status == 4">
|
|
|
|
|
<view class="img_box">
|
|
|
|
|
<image class="image" src="../../../static/image/address.png" mode=""></image>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="add_box">
|
|
|
|
|
{{item.content}}
|
|
|
|
|
</view>
|
|
|
|
|
<view class="turn_box">
|
|
|
|
|
<image class="image" src="../../../static/image/jiantou.png" mode=""></image>
|
|
|
|
|
</view>
|
|
|
|
|
</view> -->
|
|
|
|
|
<view class="pay_box">
|
|
|
|
|
<p class="pay_txt">实付款</p>
|
|
|
|
|
<p class="mon_txt"><span style="font-size: 22rpx;">¥</span><span style="font-size: 34rpx;">699.0</span></p>
|
|
|
|
|
</view>
|
|
|
|
|
<view class="btn_box">
|
|
|
|
|
<p class="btn" v-if="item.status == 3 || item.status == 4" @click.stop="handleWuliu(item)">查看物流</p>
|
|
|
|
|
<p class="btn confirm" v-if="item.status == 3" @click.stop="handleConfirm(item)">确认收货</p>
|
|
|
|
|
<p class="btn" v-if="item.status == 1" @click.stop="cancelOrder(item)">取消订单</p>
|
|
|
|
|
<p class="btn confirm" @click.stop="goPay(item)" v-if="item.status == 1">立即支付</p>
|
|
|
|
|
<p class="btn confirm info" v-if="item.status == 2" @click.stop="handleInfo(item)">完善定制信息</p>
|
|
|
|
|
<p class="btn" v-if="item.status == 0" @click.stop="handleDelete(item)">删除订单</p>
|
|
|
|
|
<p class="btn confirm" v-if="item.status == 0">再次定制</p>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
</view>
|
|
|
|
|
<uni-load-more iconType="circle" :status="status" @clickLoadMore="loadMore"
|
|
|
|
|
:content-text="contentText"></uni-load-more>
|
|
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
imgPrefix: getApp().globalData.imgPrefix,
|
|
|
|
|
active: '',
|
|
|
|
|
orderData: [],
|
|
|
|
|
current: 0,
|
|
|
|
|
size: 10,
|
|
|
|
|
hasMore: true,
|
|
|
|
|
status: '',
|
|
|
|
|
contentText: {
|
|
|
|
|
contentdown: "点击查看更多",
|
|
|
|
|
contentrefresh: "正在加载...",
|
|
|
|
|
contentnomore: "没有更多数据了",
|
|
|
|
|
},
|
|
|
|
|
userInfo: {}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
onLoad() {
|
|
|
|
|
let userInfo = uni.getStorageSync('userInfo');
|
|
|
|
|
if(userInfo) {
|
|
|
|
|
this.userInfo = JSON.parse(userInfo);
|
|
|
|
|
this.loadMore();
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
//支付成功回调
|
|
|
|
|
doPaySuccess(orderNo) {
|
|
|
|
|
uni.request({
|
|
|
|
|
url:getApp().globalData.baseUrl + '/blade-desk/order/paySuccessCallback',
|
|
|
|
|
method:'POST',
|
|
|
|
|
data: {
|
|
|
|
|
id: orderNo
|
|
|
|
|
},
|
|
|
|
|
header:{
|
|
|
|
|
'Blade-Auth': 'bearer ' + uni.getStorageSync('token')
|
|
|
|
|
},
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if(res.data.code == 200){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '订单支付成功',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
let idx = this.orderData.findIndex(item => { return item.id == orderNo; })
|
|
|
|
|
if(idx > -1) {
|
|
|
|
|
this.orderData[idx].status = 2;
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
//支付
|
|
|
|
|
goPay(orderInfo) {
|
|
|
|
|
uni.showLoading({
|
|
|
|
|
title: '支付中',
|
|
|
|
|
mask: true
|
|
|
|
|
})
|
|
|
|
|
uni.request({
|
|
|
|
|
url: getApp().globalData.baseUrl + '/app/createOrder',
|
|
|
|
|
method: 'POST',
|
|
|
|
|
data: {
|
|
|
|
|
openId: getApp().globalData.openId,
|
|
|
|
|
outTradeNo: orderInfo.orderNo
|
|
|
|
|
},
|
|
|
|
|
header: {
|
|
|
|
|
'Blade-Auth': 'bearer ' + uni.getStorageSync('token')
|
|
|
|
|
},
|
|
|
|
|
success: (res) => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
if (res.data.code == 200) {
|
|
|
|
|
uni.requestPayment({
|
|
|
|
|
provider: 'wxpay',
|
|
|
|
|
orderInfo: orderInfo,
|
|
|
|
|
timeStamp: res.data.data.timeStamp,
|
|
|
|
|
nonceStr: res.data.data.nonceStr,
|
|
|
|
|
package: res.data.data.package,
|
|
|
|
|
signType: res.data.data.signType,
|
|
|
|
|
paySign: res.data.data.paySign,
|
|
|
|
|
success: (res1) => {
|
|
|
|
|
console.log(res1)
|
|
|
|
|
if(res1.errMsg == 'requestPayment:ok') {
|
|
|
|
|
this.doPaySuccess(orderInfo.id);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '支付失败',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
fail: (res2) => {
|
|
|
|
|
console.log(res2)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
complete: () => {
|
|
|
|
|
uni.hideLoading();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 查看物流
|
|
|
|
|
handleWuliu(row) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/pages/pages_zhentou/order/express?logisticsNo=" + row.logisticsNo + '&company=' + row.logisticsCompany + '&companyCode=' +row.logisticsCompanyCode
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 完善定制信息,跳转表单页面
|
|
|
|
|
handleInfo(item){
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url:"/pages/pages_zhentou/form/form?phone=" + item.buyerPhone + '&pageFrom=order' + '&orderNo='+ item.orderNo + '&orderNum=' + item.goodsNum
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 取消订单
|
|
|
|
|
cancelOrder(row){
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: '确认取消该订单?',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
uni.request({
|
|
|
|
|
url:getApp().globalData.baseUrl + '/blade-desk/order/cancel?id=' + row.id,
|
|
|
|
|
method:'POST',
|
|
|
|
|
header:{
|
|
|
|
|
'Blade-Auth': 'bearer ' + uni.getStorageSync('token')
|
|
|
|
|
},
|
|
|
|
|
success: (res) => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
if(res.data.code == 200){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '订单取消成功',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
setTimeout(() =>{
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
},500)
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
// 删除订单
|
|
|
|
|
handleDelete(row){
|
|
|
|
|
uni.showModal({
|
|
|
|
|
title: '提示',
|
|
|
|
|
content: '确认删除订单吗?',
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (res.confirm) {
|
|
|
|
|
uni.request({
|
|
|
|
|
url:getApp().globalData.baseUrl + '/blade-desk/order/remove?ids=' + row.id,
|
|
|
|
|
method:"POST",
|
|
|
|
|
header:{
|
|
|
|
|
'Blade-Auth': 'bearer ' + uni.getStorageSync('token')
|
|
|
|
|
},
|
|
|
|
|
success: (res) => {
|
|
|
|
|
console.log(res)
|
|
|
|
|
if(res.data.code == 200){
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: '订单删除成功',
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
setTimeout(() =>{
|
|
|
|
|
uni.navigateBack()
|
|
|
|
|
},500)
|
|
|
|
|
}else{
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
} else if (res.cancel) {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
loadMore() {
|
|
|
|
|
if (this.hasMore) {
|
|
|
|
|
this.current = this.current + 1;
|
|
|
|
|
this.status = 'loading';
|
|
|
|
|
uni.request({
|
|
|
|
|
url: getApp().globalData.baseUrl + '/blade-desk/order/page?buyerPhone=' + this.userInfo.phone + '&status=' + this.active + '¤t=' + this.current + '&size=' + this
|
|
|
|
|
.size,
|
|
|
|
|
method: 'GET',
|
|
|
|
|
header: {
|
|
|
|
|
'Blade-Auth': 'bearer ' + uni.getStorageSync('token')
|
|
|
|
|
},
|
|
|
|
|
success: (res) => {
|
|
|
|
|
if (res.data.code == 200) {
|
|
|
|
|
this.orderData = this.orderData.concat(res.data.data.records);
|
|
|
|
|
if (res.data.data.records.length == 0 || res.data.data.total < this.size) {
|
|
|
|
|
this.hasMore = false;
|
|
|
|
|
this.status = 'nomore';
|
|
|
|
|
} else {
|
|
|
|
|
this.status = 'more';
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
uni.showToast({
|
|
|
|
|
title: res.data.msg,
|
|
|
|
|
icon: 'none'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
handleTab(val) {
|
|
|
|
|
this.active = val;
|
|
|
|
|
this.current = 0;
|
|
|
|
|
this.orderData = [];
|
|
|
|
|
this.hasMore = true;
|
|
|
|
|
this.loadMore();
|
|
|
|
|
},
|
|
|
|
|
// 查看详情
|
|
|
|
|
handleCheck(row) {
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
url: "/pages/pages_zhentou/order/checkOrder?id=" + row.id
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
|
.order_box {
|
|
|
|
|
.order_title {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100rpx;
|
|
|
|
|
background: #fff;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-around;
|
|
|
|
|
|
|
|
|
|
.tit {
|
|
|
|
|
padding-bottom: 10rpx;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
color: #333;
|
|
|
|
|
|
|
|
|
|
&.actived {
|
|
|
|
|
border-bottom: 5rpx solid #D73232;
|
|
|
|
|
color: #D73232;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.order_content {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: auto;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
|
|
|
|
|
.order_item {
|
|
|
|
|
width: 690rpx;
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
border-radius: 30rpx;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
margin-top: 30rpx;
|
|
|
|
|
padding-bottom: 30rpx;
|
|
|
|
|
|
|
|
|
|
.top_title {
|
|
|
|
|
padding: 30rpx 31rpx 25rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
|
|
|
|
.title {
|
|
|
|
|
font-size: 28rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.status_txt {
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.top_content {
|
|
|
|
|
width: 630rpx;
|
|
|
|
|
height: 160rpx;
|
|
|
|
|
background: #F8F8F8;
|
|
|
|
|
border-radius: 20rpx;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
display: flex;
|
|
|
|
|
|
|
|
|
|
.left_cont {
|
|
|
|
|
width: 160rpx;
|
|
|
|
|
height: 160rpx;
|
|
|
|
|
|
|
|
|
|
.img_box {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.right_cont {
|
|
|
|
|
width: 470rpx;
|
|
|
|
|
padding: 0rpx 30rpx;
|
|
|
|
|
|
|
|
|
|
.right_title {
|
|
|
|
|
margin-top: 20rpx;
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.bot_right {
|
|
|
|
|
margin-top: 49rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.sh_box {
|
|
|
|
|
width: 630rpx;
|
|
|
|
|
height: 70rpx;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
margin-top: 20rpx;
|
|
|
|
|
background: #F8F8F8;
|
|
|
|
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
|
|
.img_box {
|
|
|
|
|
width: 40rpx;
|
|
|
|
|
height: 40rpx;
|
|
|
|
|
margin-left: 18rpx;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.image {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.add_box {
|
|
|
|
|
width: 85%;
|
|
|
|
|
font-size: 24rpx;
|
|
|
|
|
color: #666;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.turn_box {
|
|
|
|
|
width: 40rpx;
|
|
|
|
|
height: 40rpx;
|
|
|
|
|
|
|
|
|
|
.image {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pay_box {
|
|
|
|
|
width: 100%;
|
|
|
|
|
margin-top: 36rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
|
|
|
|
.mon_txt {
|
|
|
|
|
margin-right: 30rpx;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.pay_txt {
|
|
|
|
|
font-size: 26rpx;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.btn_box {
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 60rpx;
|
|
|
|
|
margin: 35rpx 0 0;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: flex-end;
|
|
|
|
|
|
|
|
|
|
.btn {
|
|
|
|
|
width: 161rpx;
|
|
|
|
|
height: 60rpx;
|
|
|
|
|
background: #FFFFFF;
|
|
|
|
|
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
|
|
|
|
opacity: 1;
|
|
|
|
|
border: 1rpx solid #A5A5A5;
|
|
|
|
|
margin-right: 30rpx;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
color: #666666;
|
|
|
|
|
|
|
|
|
|
&.confirm {
|
|
|
|
|
border: 1rpx solid #D73232;
|
|
|
|
|
color: #D73232;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&.info {
|
|
|
|
|
width: 210rpx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|