OfficeApp/pages/logistics/logisticDetil.vue
2023-08-09 17:26:01 +08:00

313 lines
6.1 KiB
Vue

<template>
<view class="content">
<view v-if='showLoading'>
<u-loading-page :loading="showLoading"></u-loading-page>
</view>
<view v-else>
<view class="order">
<u-loading-page :loading="showLoading"></u-loading-page>
<p>订单号:{{goodsDetil.logistics.order_sn}}</p>
<view class='phone'>收货时间 : &nbsp;{{goodsDetil.record[0].create_time}} </view>
<!-- 已送达 -->
<view class="left" v-if="goodsDetil.logistics.status>=2">
<view class="list">
<text>
收货时间
</text>
<view>
{{goodsDetil.record[0].create_time}}
</view>
</view>
<view class="list">
<text>
收获详情
</text>
<view>
<view>
{{goodsDetil.logistics.user_address}}
</view>
<view>
{{goodsDetil.logistics.user_name||"顾客电话"}}
</view>
<view>
{{goodsDetil.record[0].create_time}}
</view>
</view>
</view>
<view class="list">
<text>
取货详情
</text>
<view>
<view>
{{goodsDetil.logistics.shop_address||"商家地址"}}
</view>
<view>
{{goodsDetil.logistics.shop_phone||"商家电话"}}
</view>
<view>
{{goodsDetil.record[1].create_time}}
</view>
</view>
</view>
<view class="list">
<text>
订单详情
</text>
<view>
<view v-for="(item,index) in goodsDetil.record" :key="item.create_time">
<view>
{{item.content}}
</view>
<view>
{{item.create_time}}
</view>
</view>
</view>
</view>
<view class="pro_list">
<text style="color: #999;width: 15vw;">
商品信息
</text>
<view>
<view class="goods_tit" v-for="(item,index) in goodsDetil.product">
<text style="width: 60vw;margin: 0;padding: 0;">{{item.goods_name}}</text>
<text>X{{item.product_num}}{{item.goods_unit}}</text>
</view>
</view>
</view>
</view>
<!-- 已取货 -->
<view class="left" v-else>
<view class="list">
<text>
用户名称
</text>
<view>
{{goodsDetil.logistics.user_name}}
</view>
</view>
<view class="list" style="margin: 10rpx 0;">
<text style="width: 16vw;">
收货地址
</text>
<view>
<view>
{{goodsDetil.logistics.user_address}}
</view>
</view>
</view>
<view class="list">
<text>
物流信息
</text>
<view>
<view v-for="(item,index) in goodsDetil.record">
{{item.content}}
<view>
{{item.create_time}}
</view>
</view>
</view>
</view>
<view class="pro_list">
<text style="color: #999;width: 15vw;">
商品信息
</text>
<view>
<view class="goods_tit" v-for="(item,index) in goodsDetil.product">
<text style="width: 60vw;margin: 0;padding: 0;">{{item.goods_name}}</text>
<text>X{{item.product_num}}{{item.goods_unit}}</text>
</view>
</view>
</view>
</view>
<view class="total">
<text>共计{{goodsDetil.product_count}}件商品 </text>
</view>
<u-button v-if='goodsDetil.logistics.status==1' @click="showPop=true" type="primary"
style="background-color: #34A853;border: none;">已送达</u-button>
</view>
<view class="cil_left">
</view>
<view class="cil_right">
</view>
<u-modal :show="showPop" @confirm="confirm" content="请确认货物已送达" @close="showPop=false"
:closeOnClickOverlay="true"></u-modal>
<u-toast ref="uToast"></u-toast>
</view>
</view>
</view>
</template>
<script>
import {
doneDelivery
} from "@/api/logistics.js"
import {
getDetil
} from "@/api/logistics.js"
export default {
data() {
return {
showPop: false,
showLoading: true,
goodsDetil: undefined,
flag: 0,
}
},
methods: {
confirm() {
let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
doneDelivery({
user_id: id,
// user_id: id,
logistics_id: this.goodsDetil.logistics.id
}).then(res => {
this.showToast()
setTimeout(() => {
uni.navigateBack()
}, 2000)
})
this.showPop = false
},
showToast() {
this.$refs.uToast.show({
type: 'success',
title: '成功主题(带图标)',
message: "操作成功",
iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
})
},
},
onLoad(options) {
// console.log(options.id)
getDetil({
logistics_id: options.id
}).then(res => {
this.showLoading = false
this.goodsDetil = res.data
console.log(this.goodsDetil)
})
},
}
</script>
<style lang='scss' scoped>
.content {
background-color: #F5F5F5;
padding: 2vh 2vw;
}
.order {
position: relative;
background-color: white;
margin: 20rpx 0;
border-radius: 15rpx;
height: auto;
padding: 2vh 3vw;
box-sizing: border-box;
p {
font-family: "PingFang SC-Medium";
font-size: 32rpx;
font-weight: bold;
}
.phone {
color: #999999;
padding: 10rpx 0;
border-bottom: 1px dashed blue;
font-size: 20rpx;
}
.left {
.list {
display: flex;
view {
flex: 8;
view {
margin-bottom: 10rpx;
}
}
text {
flex: 2;
}
/* view {
view {
margin-bottom: 10rpx;
}
}
text {
margin-right: 20rpx;
width: 30vw;
color: #999;
} */
}
}
.pro_list {
display: flex;
text {
margin-right: 20rpx;
}
}
.total {
/* font-family: "宋体"; */
margin: 20rpx 0;
color: #3274F9;
font-weight: bold;
font-size: 32rpx;
text-align: right;
}
.cil_left {
width: 30rpx;
height: 30rpx;
background-color: #F5F5F5;
border-radius: 30rpx;
position: absolute;
top: 110rpx;
left: -15rpx;
}
.cil_right {
width: 30rpx;
height: 30rpx;
background-color: #F5F5F5;
border-radius: 30rpx;
position: absolute;
top: 110rpx;
right: -15rpx;
}
.goods_tit {
display: flex;
justify-content: space-between;
}
}
</style>