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.
761 lines
18 KiB
761 lines
18 KiB
<template> |
|
<view class="order_detail"> |
|
<view class="order_content"> |
|
<view class="order_item"> |
|
<view class="top_title"> |
|
<p class="title">壹人壹枕</p> |
|
<p class="status_txt" v-if="orderData.status == 1" style="color: #D73232;">待付款</p> |
|
<p class="status_txt" v-if="orderData.status == 2" style="color: #3E97F1;">待发货</p> |
|
<p class="status_txt" v-if="orderData.status == 3" style="color: #D73232;">待收货</p> |
|
<p class="status_txt" v-if="orderData.status == 4" style="color: #A5A5A5;">已完成</p> |
|
<p class="status_txt" v-if="orderData.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">{{orderData.goodsName}}</p> |
|
<p class="bot_right"> |
|
<span style="font-size: 22rpx;color: #666;">共{{orderData.goodsNum}}件</span> |
|
<span> |
|
<span style="font-size: 22rpx;color: #333;">¥</span><span |
|
style="font-size: 28rpx;color: #333;">{{orderData.goodsPrice}}</span> |
|
</span> |
|
</p> |
|
</view> |
|
</view> |
|
<!-- <view class="sh_box" v-if="orderData.content"> |
|
<view class="img_box"> |
|
<image class="image" src="../../../static/image/address.png" mode=""></image> |
|
</view> |
|
<view class="add_box"> |
|
{{orderData.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;">{{orderData.goodsPrice}}</span></p> |
|
</view> |
|
</view> |
|
</view> |
|
<view class="address_box"> |
|
<p class="info_title">收货地址</p> |
|
<view class="address_top" v-if="addressInfo"> |
|
<view class="isflag" v-if="addressInfo.isDefaultAddress == 1">默认</view> |
|
<view class="txt">{{addressInfo.province}}{{addressInfo.city}}{{addressInfo.district}}</view> |
|
</view> |
|
<view class="address_des" v-if="addressInfo">{{addressInfo.address}}</view> |
|
<view class="address_des" style="color: #666;font-weight: normal;" v-else>请填写收货地址</view> |
|
<view class="address_user" v-if="addressInfo"> |
|
<text class="user_name">{{addressInfo.consignee}}</text> |
|
<text class="user_phone">{{addressInfo.consigneePhone}}</text> |
|
</view> |
|
</view> |
|
<view class="order_info"> |
|
<p class="info_title">订单信息</p> |
|
<p class="info_mess"> |
|
<span class="left_info">下单人:</span> |
|
<span class="right_info">{{orderData.buyerName}}</span> |
|
</p> |
|
<p class="info_mess"> |
|
<span class="left_info">订单编号:</span> |
|
<span class="right_info">{{orderData.orderNo}}</span> |
|
</p> |
|
<p class="info_mess" v-if="orderData.paymentTime"> |
|
<span class="left_info">支付时间:</span> |
|
<span class="right_info">{{orderData.paymentTime}}</span> |
|
</p> |
|
<p class="info_mess" v-if="orderData.status == 4"> |
|
<span class="left_info">收货时间:</span> |
|
<span class="right_info">{{orderData.transactionTime}}</span> |
|
</p> |
|
</view> |
|
<view class="sh_box"> |
|
<view class="sh_img"> |
|
<image class="img" src="../../../static/image/sh_img.png" mode=""></image> |
|
</view> |
|
<view class="sh_txt" @click="returnToServe"> |
|
售后服务 |
|
</view> |
|
</view> |
|
<view class="btn_box"> |
|
<p class="btn" @click="handleWuliu" |
|
v-if="orderData.status == 3 || orderData.status == 4">查看物流</p> |
|
<p class="btn" v-if="orderData.status == 1" @click="cancelOrder">取消订单</p> |
|
<p class="btn" v-if="orderData.status == 2" @click="returnToAddress">修改地址</p> |
|
<p class="btn" v-if="orderData.status == 0" @click="handleDelete">删除订单</p> |
|
<p class="btn confirm" v-if="orderData.status == 3" @click="handleConfirm">确认收货</p> |
|
<p class="btn confirm" v-if="orderData.status == 1" @click="goPay">立即支付</p> |
|
<!-- <p class="btn confirm info" v-if="orderData.status == 3" @click="handleInfo(item)">完善定制信息</p> --> |
|
<p class="btn confirm info" v-if="orderData.status == 2" @click="handleInfo">完善定制信息</p> |
|
<p class="btn confirm" v-if="orderData.status == 0" @click="clickCustom">再次定制</p> |
|
</view> |
|
</view> |
|
</template> |
|
|
|
<script> |
|
export default { |
|
data() { |
|
return { |
|
imgPrefix: getApp().globalData.imgPrefix, |
|
orderData: {}, |
|
orderId: '', |
|
addressInfo: null, |
|
} |
|
}, |
|
onShow() { |
|
if (uni.getStorageSync('orderId')) { |
|
this.orderId = uni.getStorageSync('orderId'); |
|
if (this.orderId) { |
|
this.getDetail(); |
|
uni.removeStorageSync('orderId'); |
|
} |
|
} |
|
}, |
|
onLoad(options) { |
|
this.orderId = options.id; |
|
this.getDetail() |
|
console.log(options) |
|
console.log('进入模块') |
|
}, |
|
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' |
|
}) |
|
this.getDetail(); |
|
} else if (res.data.code == 401) { |
|
this.doLogin() |
|
} else { |
|
uni.showToast({ |
|
title: res.data.msg, |
|
icon: 'none' |
|
}) |
|
} |
|
} |
|
}) |
|
}, |
|
//支付 |
|
goPay() { |
|
uni.showLoading({ |
|
title: '支付中', |
|
mask: true |
|
}) |
|
uni.request({ |
|
url: getApp().globalData.baseUrl + '/app/createOrder', |
|
method: 'POST', |
|
data: { |
|
openId: getApp().globalData.openId, |
|
outTradeNo: this.orderData.orderNo |
|
}, |
|
header: { |
|
'Blade-Auth': 'bearer ' + uni.getStorageSync('token') |
|
}, |
|
success: (res) => { |
|
console.log(res) |
|
if (res.data.code == 200) { |
|
uni.requestPayment({ |
|
provider: 'wxpay', |
|
orderInfo: this.orderData, |
|
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(this.orderData.id); |
|
} else { |
|
uni.showToast({ |
|
title: '支付失败', |
|
icon: 'none' |
|
}) |
|
} |
|
}, |
|
fail: (res2) => { |
|
console.log(res2) |
|
} |
|
}) |
|
} else if (res.data.code == 401) { |
|
this.doLogin() |
|
} else { |
|
uni.showToast({ |
|
title: res.data.msg, |
|
icon: 'none' |
|
}) |
|
} |
|
}, |
|
complete: () => { |
|
uni.hideLoading(); |
|
} |
|
}) |
|
}, |
|
returnToAddress() { |
|
uni.navigateTo({ |
|
url: "/pages/pages_zhentou/myPage/address?consignee=" + this.addressInfo.consignee + |
|
"&phone=" + this.addressInfo.consigneePhone + |
|
"&province=" + this.addressInfo.province + '&city=' + this.addressInfo.city + '&area=' + |
|
this.addressInfo.district + '&from=order' + |
|
'&isDefaultAddress=' + this.addressInfo.isDefaultAddress + "&orderId=" + this.orderId + |
|
'&address=' + this.addressInfo.address |
|
}) |
|
}, |
|
// 获取物流详情 |
|
getDetail() { |
|
uni.request({ |
|
// + this.orderId |
|
url: getApp().globalData.baseUrl + '/blade-desk/order/detail?id=' + this.orderId, |
|
method: 'GET', |
|
header: { |
|
'Blade-Auth': 'bearer ' + uni.getStorageSync('token') |
|
}, |
|
success: (res) => { |
|
console.log(res) |
|
if (res.data.code == 200) { |
|
this.orderData = res.data.data; |
|
this.addressInfo = { |
|
consignee: res.data.data.consignee, |
|
consigneePhone: res.data.data.consigneePhone, |
|
address: res.data.data.address, |
|
province: res.data.data.province, |
|
city: res.data.data.city, |
|
district: res.data.data.district, |
|
isDefaultAddress: res.data.data.isDefaultAddress, |
|
} |
|
} else if (res.data.code == 401) { |
|
this.doLogin() |
|
} else { |
|
uni.showToast({ |
|
title: res.data.msg, |
|
icon: 'none' |
|
}) |
|
} |
|
|
|
} |
|
}) |
|
}, |
|
// 取消订单 |
|
cancelOrder() { |
|
uni.showModal({ |
|
title: '提示', |
|
content: '确认取消该订单?', |
|
success: (res) => { |
|
if (res.confirm) { |
|
uni.request({ |
|
url: getApp().globalData.baseUrl + '/blade-desk/order/cancel?id=' + |
|
this.orderId, |
|
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 if (res.data.code == 401) { |
|
this.doLogin() |
|
} else { |
|
uni.showToast({ |
|
title: res.data.msg, |
|
icon: 'none' |
|
}) |
|
} |
|
} |
|
}) |
|
} else if (res.cancel) { |
|
|
|
} |
|
} |
|
}); |
|
}, |
|
// 确认收货 |
|
handleConfirm() { |
|
let params = { |
|
id: this.orderId |
|
} |
|
uni.showModal({ |
|
title: '提示', |
|
content: '确认收到该商品了吗?', |
|
success: (res) => { |
|
if (res.confirm) { |
|
uni.request({ |
|
url: getApp().globalData.baseUrl + |
|
'/blade-desk/order/confirmReceive?id=' + this.orderId, |
|
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 if (res.data.code == 401) { |
|
this.doLogin() |
|
} else { |
|
uni.showToast({ |
|
title: res.data.msg, |
|
icon: 'none' |
|
}) |
|
} |
|
} |
|
}) |
|
} else if (res.cancel) { |
|
|
|
} |
|
} |
|
}); |
|
}, |
|
// 查看物流 |
|
handleWuliu() { |
|
uni.navigateTo({ |
|
url: "/pages/pages_zhentou/order/express?logisticsNo=" + this.orderData.logisticsNo + |
|
'&company=' + this.orderData.logisticsCompany + '&companyCode=' + this.orderData |
|
.logisticsCompanyCode |
|
}) |
|
}, |
|
// 删除订单 |
|
handleDelete() { |
|
uni.showModal({ |
|
title: '提示', |
|
content: '确认删除订单吗?', |
|
success: (res) => { |
|
if (res.confirm) { |
|
uni.request({ |
|
url: getApp().globalData.baseUrl + '/blade-desk/order/remove?ids=' + |
|
this.orderId, |
|
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 if (res.data.code == 401) { |
|
this.doLogin() |
|
} else { |
|
uni.showToast({ |
|
title: res.data.msg, |
|
icon: 'none' |
|
}) |
|
} |
|
} |
|
}) |
|
} else if (res.cancel) {} |
|
} |
|
}); |
|
}, |
|
// 点击再次定制按钮,跳转到提交订单页面 |
|
clickCustom() { |
|
uni.navigateTo({ |
|
url: '/pages/pages_zhentou/order/confirmOrder' |
|
}) |
|
}, |
|
// 完善定制信息,跳转表单页面 |
|
handleInfo() { |
|
uni.navigateTo({ |
|
url: "/pages/pages_zhentou/form/form?phone=" + this.orderData.buyerPhone + '&pageFrom=order' + |
|
'&orderNo=' + this.orderData.orderNo + '&orderNum=' + this.orderData.goodsNum |
|
}) |
|
}, |
|
// 跳转售后服务 |
|
returnToServe() { |
|
uni.navigateTo({ |
|
url: "/pages/pages_zhentou/contact/contact" |
|
}) |
|
}, |
|
//登录 |
|
doLogin(type) { |
|
uni.showLoading({ |
|
title: '登录中', |
|
mask: true |
|
}); |
|
uni.request({ |
|
url: getApp().globalData.baseUrl + '/blade-auth/getToken', |
|
method: 'POST', |
|
data: { |
|
openId: getApp().globalData.openId, |
|
phone: this.phone |
|
}, |
|
header: { |
|
'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0' |
|
}, |
|
success: (res) => { |
|
if (res.data.code == 200) { |
|
uni.setStorageSync('token', res.data.data.access_token); |
|
} else { |
|
uni.showToast({ |
|
title: res.data.msg, |
|
icon: 'none' |
|
}) |
|
} |
|
}, |
|
complete: () => { |
|
uni.hideLoading(); |
|
} |
|
}) |
|
} |
|
} |
|
} |
|
</script> |
|
|
|
<style lang="scss" scoped> |
|
.order_detail { |
|
width: 100%; |
|
|
|
.order_content { |
|
.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; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
.address_box { |
|
width: 690rpx; |
|
background: #FFFFFF; |
|
border-radius: 30rpx 30rpx 30rpx 30rpx; |
|
margin: 0 auto; |
|
margin-top: 30rpx; |
|
padding: 30rpx 0; |
|
padding-left: 30rpx; |
|
|
|
.info_title { |
|
font-size: 28rpx; |
|
color: #333; |
|
|
|
} |
|
|
|
.address_top { |
|
display: flex; |
|
align-items: center; |
|
margin-top: 30rpx; |
|
|
|
.isflag { |
|
width: 60rpx; |
|
color: #D73232; |
|
font-size: 20rpx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
line-height: 30rpx; |
|
text-align: center; |
|
background: #FFFFFF; |
|
border-radius: 10rpx; |
|
border: 1rpx solid #D73232; |
|
margin-right: 12rpx; |
|
} |
|
|
|
.txt { |
|
line-height: 32rpx; |
|
font-size: 24rpx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
color: #666666; |
|
} |
|
} |
|
|
|
.address_des { |
|
line-height: 40rpx; |
|
font-size: 28rpx; |
|
font-family: PingFang SC-Bold, PingFang SC; |
|
font-weight: bold; |
|
color: #333333; |
|
word-break: break-all; |
|
margin: 20rpx 0; |
|
} |
|
|
|
.address_user { |
|
display: flex; |
|
align-items: center; |
|
line-height: 33rpx; |
|
font-size: 24rpx; |
|
font-family: PingFang SC-Regular, PingFang SC; |
|
font-weight: 400; |
|
|
|
.user_name { |
|
color: #333333; |
|
} |
|
|
|
.user_phone { |
|
color: #999999; |
|
margin-left: 10rpx; |
|
} |
|
} |
|
} |
|
|
|
.order_info { |
|
width: 690rpx; |
|
height: auto; |
|
background: #FFFFFF; |
|
border-radius: 30rpx 30rpx 30rpx 30rpx; |
|
margin: 0 auto; |
|
margin-top: 30rpx; |
|
padding-bottom: 30rpx; |
|
|
|
.info_title { |
|
font-size: 28rpx; |
|
color: #333; |
|
padding-left: 30rpx; |
|
padding-top: 30rpx; |
|
} |
|
|
|
.info_mess { |
|
padding-left: 30rpx; |
|
margin-top: 30rpx; |
|
display: flex; |
|
width: 100%; |
|
|
|
.left_info { |
|
width: 130rpx; |
|
font-size: 26rpx; |
|
color: #666; |
|
} |
|
|
|
.right_info { |
|
margin-left: 28rpx; |
|
} |
|
} |
|
} |
|
|
|
.sh_box { |
|
width: 690rpx; |
|
height: 90rpx; |
|
background: #FFFFFF; |
|
border-radius: 30rpx 30rpx 30rpx 30rpx; |
|
margin: 0 auto; |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
margin-top: 30rpx; |
|
|
|
.sh_img { |
|
width: 44rpx; |
|
height: 44rpx; |
|
|
|
.img { |
|
width: 100%; |
|
height: 100%; |
|
} |
|
} |
|
|
|
.sh_txt { |
|
font-size: 26rpx; |
|
color: #333; |
|
margin-left: 10rpx; |
|
} |
|
} |
|
|
|
.btn_box { |
|
width: 100%; |
|
height: 160rpx; |
|
background: #FFFFFF; |
|
position: fixed; |
|
bottom: 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; |
|
margin-top: 30rpx; |
|
display: flex; |
|
align-items: center; |
|
justify-content: center; |
|
color: #666666; |
|
|
|
&.confirm { |
|
border: 1rpx solid #D73232; |
|
color: #D73232; |
|
} |
|
|
|
&.info { |
|
width: 210rpx; |
|
} |
|
} |
|
} |
|
} |
|
</style> |