532 lines
12 KiB
Vue
532 lines
12 KiB
Vue
<template>
|
||
<view class="page">
|
||
<u-navbar title="订单详情" :border-bottom="false" :background="bgc" title-color='#000' title-size='36'
|
||
height='45'></u-navbar>
|
||
<view class="card">
|
||
<view class="card_top">
|
||
<view class="txt1" style="display: flex; align-items: center;">
|
||
<image src="https://lxnapi.ccttiot.com/bike/img/static/u96ouf9UVe3BfZY9rWa0" mode="" style="width: 26.94rpx;height: 28rpx;margin-right: 10rpx;"></image> 订单详情
|
||
</view>
|
||
<view class="txt2" :style="{ color: typeReturn(orderInfo.status).color }">
|
||
{{typeReturn(orderInfo.status).text}}
|
||
</view>
|
||
</view>
|
||
<view class="cont">
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
订单编号:
|
||
</span>
|
||
<span class="txt6">
|
||
{{orderInfo.orderNo}}
|
||
</span>
|
||
</view>
|
||
<view class="cont_li">
|
||
<view class="left">
|
||
<span class="txt3">
|
||
收货地址:
|
||
</span>
|
||
<span class="txt4">
|
||
{{orderInfo.deliveryAddress}}
|
||
</span>
|
||
</view>
|
||
<view class="btn2" @click.stop="mapFun(orderInfo.deliveryLat,orderInfo.deliveryLon,orderInfo.deliveryAddress)">
|
||
导航
|
||
</view>
|
||
</view>
|
||
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
门店名称:
|
||
</span>
|
||
<span class="txt6">
|
||
{{orderInfo.storeName}}
|
||
</span>
|
||
</view>
|
||
<view class="cont_li">
|
||
<view class="left">
|
||
<span class="txt3">
|
||
门店地址:
|
||
</span>
|
||
<span class="txt4">
|
||
{{orderInfo.address}}
|
||
</span>
|
||
</view>
|
||
<view class="btn2" @click.stop="mapFun(orderInfo.lat,orderInfo.lng,orderInfo.address)" >
|
||
导航
|
||
</view>
|
||
</view>
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
要求送车到达时间:
|
||
</span>
|
||
<span class="txt6">
|
||
{{timeBack(orderInfo.deliveryTime) }}
|
||
|
||
</span>
|
||
</view>
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
下单时间:
|
||
</span>
|
||
<span class="txt6">
|
||
{{orderInfo.createTime}}
|
||
</span>
|
||
</view>
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
送货人员:
|
||
</span>
|
||
<span class="txt6">
|
||
{{ orderInfo.deliveryman ? orderInfo.deliveryman : '--' }}
|
||
</span>
|
||
</view>
|
||
|
||
</view>
|
||
</view>
|
||
<view class="card">
|
||
<view class="cont">
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
所选车型:
|
||
</span>
|
||
<span class="txt6">
|
||
{{orderInfo.model}}
|
||
</span>
|
||
</view>
|
||
<!-- <view class="cont_li2">
|
||
<span class="txt5">
|
||
租车周期:
|
||
</span>
|
||
<span class="txt6">
|
||
--
|
||
</span>
|
||
</view> -->
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
下单用户:
|
||
</span>
|
||
<span class="txt6">
|
||
{{ orderInfo.realName ? orderInfo.realName : '--' }}
|
||
</span>
|
||
</view>
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
手机号:
|
||
</span>
|
||
<span class="txt6">
|
||
{{orderInfo.phone}}
|
||
</span>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="card">
|
||
<view class="cont">
|
||
<view class="cont_li2" v-if="orderInfo.sn">
|
||
<span class="txt5">
|
||
车辆编号:
|
||
</span>
|
||
<span class="txt6">
|
||
{{orderInfo.sn}}
|
||
</span>
|
||
</view>
|
||
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
配送时间:
|
||
</span>
|
||
<span class="txt6">
|
||
{{timeBack(orderInfo.deliveryTime)}}
|
||
</span>
|
||
</view>
|
||
<view class="cont_li2">
|
||
<span class="txt5">
|
||
送达时间:
|
||
</span>
|
||
<span class="txt6" >
|
||
|
||
{{timeBack(orderInfo.deliveryTime)}}
|
||
</span>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="btn_box">
|
||
<view class="btn" v-if="orderInfo.status==0" @click.stop="getOrder(orderInfo)">
|
||
立即接单
|
||
</view>
|
||
<view class="btn_li" v-if="orderInfo.status==1||orderInfo.status==2">
|
||
<view class="btn1" @click.stop="callPhone(orderInfo.phone)">
|
||
联系客户
|
||
</view>
|
||
<view class="btn2" v-if="orderInfo.status==1" @click.stop="goDeli(orderInfo)">
|
||
立即配送
|
||
</view>
|
||
<view class="btn2" v-if="orderInfo.status==2" @click.stop="overDeli(orderInfo)">
|
||
配送完成
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
bgc: {
|
||
backgroundColor: "#fff",
|
||
},
|
||
orderInfo:{},
|
||
deliveryId:''
|
||
}
|
||
},
|
||
onLoad(e) {
|
||
if(e.deliveryId){
|
||
this.deliveryId=e.deliveryId
|
||
this.getDetail()
|
||
}
|
||
},
|
||
methods: {
|
||
callPhone(phone) {
|
||
uni.makePhoneCall({
|
||
phoneNumber: phone
|
||
})
|
||
|
||
},
|
||
|
||
todetal(item){
|
||
uni.navigateTo({
|
||
url:'/page_Delivery/OrderDetail?orderNo='+item.orderNo
|
||
})
|
||
},
|
||
getDetail(){
|
||
this.$u.get(`appAdmin/deliveryOrderinfo/` + this.deliveryId).then((res) => {
|
||
if (res.code == 200) {
|
||
|
||
this.orderInfo=res.data
|
||
|
||
} else {
|
||
|
||
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
}
|
||
});
|
||
},
|
||
goDeli(item) {
|
||
this.$u.post(`appAdmin/inDelivery?orderNo=` + this.orderInfo.orderNo).then((res) => {
|
||
if (res.code == 200) {
|
||
|
||
this.getDetail()
|
||
uni.showToast({
|
||
title: '开始配送',
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
} else {
|
||
|
||
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
}
|
||
});
|
||
},
|
||
overDeli(item) {
|
||
this.$u.post(`appAdmin/endDelivery?orderNo=` + this.orderInfo.orderNo).then((res) => {
|
||
if (res.code == 200) {
|
||
|
||
this.getDetail()
|
||
uni.showToast({
|
||
title: '配送完成',
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
} else {
|
||
|
||
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
}
|
||
});
|
||
},
|
||
getOrder(item) {
|
||
this.$u.post(`appAdmin/orderTaking?orderNo=` + this.orderInfo.orderNo).then((res) => {
|
||
if (res.code == 200) {
|
||
|
||
this.getDetail()
|
||
uni.showToast({
|
||
title: '接单成功',
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
} else {
|
||
|
||
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
});
|
||
}
|
||
});
|
||
},
|
||
mapFun(lat,lon, txt) {
|
||
|
||
const latitude = Number(lat);
|
||
const longitude = Number(lon);
|
||
console.log(latitude,longitude);
|
||
// 调用 uni.openLocation
|
||
uni.openLocation({
|
||
latitude: latitude, // 纬度 - 目的地/坐标点
|
||
longitude: longitude, // 经度 - 目的地/坐标点
|
||
address: txt // 地址
|
||
});
|
||
},
|
||
typeReturn(num) {
|
||
let result = {
|
||
text: '',
|
||
color: '#4297F3' // 默认颜色
|
||
};
|
||
|
||
if (num == 0) {
|
||
result.text = '待接单';
|
||
result.color = '#F14C4C'; // 待支付颜色
|
||
} else if (num == 1) {
|
||
result.text = '待配送';
|
||
result.color = '#F38C42'; // 超时取消颜色
|
||
} else if (num == 2) {
|
||
result.text = '配送中';
|
||
result.color = '#4297F3'; // 超时取消颜色
|
||
} else if (num == 3) {
|
||
result.text = '已完成';
|
||
result.color = '#000000'; // 超时取消颜色
|
||
} else if (num == 8) {
|
||
result.text = '已取消';
|
||
result.color = '#ccc'; // 超时取消颜色
|
||
}
|
||
|
||
return result;
|
||
},
|
||
timeBack(time) {
|
||
const date = new Date(time);
|
||
|
||
const year = date.getFullYear();
|
||
const month = (date.getMonth() + 1).toString().padStart(2, '0'); // 月份从0开始,所以加1
|
||
const day = date.getDate().toString().padStart(2, '0');
|
||
|
||
const hours = date.getHours().toString().padStart(2, '0');
|
||
const minutes = date.getMinutes().toString().padStart(2, '0');
|
||
const seconds = date.getSeconds().toString().padStart(2, '0');
|
||
|
||
// 格式化为 'YYYY-MM-DD HH:mm:ss'
|
||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
<style lang="scss">
|
||
page {
|
||
background: #F4F5F7;
|
||
}
|
||
|
||
.page {
|
||
.btn_box{
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
position: fixed;
|
||
bottom: 0;
|
||
width: 750rpx;
|
||
height: 160rpx;
|
||
background: #FFFFFF;
|
||
box-shadow: 0rpx 8rpx 20rpx 0rpx rgba(0,0,0,0.3);
|
||
border-radius: 0rpx 0rpx 0rpx 0rpx;
|
||
.btn_li{
|
||
margin-top: 15rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
flex-wrap: nowrap;
|
||
.btn1{
|
||
margin-right: 36rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 200rpx;
|
||
height: 70rpx;
|
||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||
border: 2rpx solid #4297F3;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #4297F3;
|
||
}
|
||
.btn2{
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 400rpx;
|
||
height: 70rpx;
|
||
background: #4297F3;
|
||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #FFFFFF;
|
||
}
|
||
}
|
||
.btn{
|
||
margin-top: 15rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 630rpx;
|
||
height: 70rpx;
|
||
background: #4297F3;
|
||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #FFFFFF;
|
||
}
|
||
}
|
||
.card{
|
||
margin: 0 auto;
|
||
margin-top: 30rpx;
|
||
width: 680rpx;
|
||
// height: 596rpx;
|
||
background: #FFFFFF;
|
||
border-radius: 20rpx;
|
||
|
||
.card_top{
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
padding: 20rpx 26rpx;
|
||
width: 680rpx;
|
||
// height: 78rpx;
|
||
background: #E5E4E4;
|
||
border-radius: 20rpx 20rpx 0 0;
|
||
.txt1{
|
||
font-weight: 400;
|
||
font-size: 32rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
.txt2{
|
||
font-weight: 600;
|
||
font-size: 32rpx;
|
||
color: #F14C4C;
|
||
}
|
||
}
|
||
.cont{
|
||
padding: 14rpx 24rpx;
|
||
.btn_li{
|
||
margin-top: 15rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
flex-wrap: nowrap;
|
||
.btn1{
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 200rpx;
|
||
height: 70rpx;
|
||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||
border: 2rpx solid #4297F3;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #4297F3;
|
||
}
|
||
.btn2{
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 400rpx;
|
||
height: 70rpx;
|
||
background: #4297F3;
|
||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #FFFFFF;
|
||
}
|
||
}
|
||
.btn{
|
||
margin-top: 15rpx;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 630rpx;
|
||
height: 70rpx;
|
||
background: #4297F3;
|
||
border-radius: 10rpx 10rpx 10rpx 10rpx;
|
||
font-weight: 500;
|
||
font-size: 32rpx;
|
||
color: #FFFFFF;
|
||
}
|
||
.cont_li {
|
||
margin-bottom: 14rpx;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: self-start;
|
||
|
||
|
||
.left {
|
||
width: 504rpx;
|
||
display: block;
|
||
|
||
.txt3 {
|
||
// display: inline-block;
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #6f6f6f;
|
||
}
|
||
|
||
.txt4 {
|
||
// display: inline-block;
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #3d3d3d;
|
||
// margin-top: 5rpx;
|
||
}
|
||
}
|
||
|
||
.btn2 {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
width: 80rpx;
|
||
height: 36rpx;
|
||
border-radius: 18rpx;
|
||
border: 1rpx solid #808080;
|
||
font-weight: 400;
|
||
font-size: 24rpx;
|
||
color: #808080;
|
||
margin-left: 10rpx;
|
||
}
|
||
}
|
||
|
||
.cont_li2{
|
||
margin-bottom: 14rpx;
|
||
.txt5{
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #6f6f6f;
|
||
}
|
||
.txt6{
|
||
font-weight: 400;
|
||
font-size: 28rpx;
|
||
color: #3d3d3d;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
</style>
|