shjz-applet/pages/cargo/cargo.vue

334 lines
10 KiB
Vue

<template>
<view class="pad-x100">
<!-- 头部 -->
<status-nav :ifReturn="false" navBarTitle="货物" :marginBottom="0"></status-nav>
<!-- 搜索 -->
<view class="cargo-search-bg pad-sx35 pad-zy40 radius8 border-box" :style="{top:statusHeight+50+'px'}">
<view class="cargo-search radius30 border-box flex">
<image src="/static/icon/icon-search.png" mode="widthFix"></image>
<input class="input font24" type="text" v-model="coding" placeholder="请输入运单号搜索" placeholder-style="color:#b4b4b4"/>
<view class="submit-btn background-red font24 flex" @tap="submitEv">确认</view>
</view>
</view>
<!-- 物流信息 -->
<view class="cargo pad-sx30 pad-zy25 radius8 border-box" v-if="isLoading">
<view class="cargo-title" v-if="!isTips">
<title-pull nameTxt="线路信息详细"></title-pull>
</view>
<view class="cargo-txt">
<!-- 收货地址 -->
<view class="address" v-if="address!==''">
<view class="txt flex">
<view class="icon background-red radius100 font24 flex">收</view>
<view class="title font24">收货地址:{{address}}</view>
</view>
<view class="item border-box"></view>
</view>
<!-- 已签收 -->
<view class="cargo-list signed-list" v-if="signed.length">
<view class="txt flex">
<view class="icon background-red radius100 flex"><image src="/static/icon/icon-signed.png" mode="widthFix" style="width: 24rpx; height: 23rpx;"></image></view>
<view class="title font28 bold">已签收</view>
</view>
<view class="item pad-sx10 border-box flex" v-for="(item,index) in signed" :key="index">
<view class="point radius100 background-grey" :class="index==0?'opacity':''"></view>
<view class="info">
<view class="cargo-tags font24">{{item.tags}}</view>
<view class="cargo-time font20 opacity-06">{{item.time}}</view>
</view>
</view>
</view>
<!-- 待取件 -->
<view class="cargo-list" v-if="wait.length">
<view class="txt flex">
<view class="icon background-grey radius100 flex"><image src="/static/icon/icon-wait.png" mode="widthFix" style="width: 25rpx; height: 24rpx;"></image></view>
<view class="title font28 bold">待取件</view>
</view>
<view class="item pad-sx10 border-box flex" v-for="(item,index) in wait" :key="index">
<view class="point radius100 background-grey" :class="index==0?'opacity':''"></view>
<view class="info">
<view class="cargo-tags font24">{{item.tags}}</view>
<view class="cargo-time font20 opacity-06">{{item.time}}</view>
</view>
</view>
</view>
<!-- 派送中 -->
<view class="cargo-list" v-if="deliver.length">
<view class="txt flex">
<view class="icon background-grey radius100 flex"><image src="/static/icon/icon-deliver.png" mode="widthFix" style="width: 25rpx; height: 23rpx;"></image></view>
<view class="title font28 bold">已到达</view>
</view>
<view class="item pad-sx10 border-box flex" v-for="(item,index) in deliver" :key="index">
<view class="point radius100 background-grey" :class="index==0?'opacity':''"></view>
<view class="info">
<view class="cargo-tags font24">{{item.tags}}</view>
<view class="cargo-time font20 opacity-06">{{item.time}}</view>
</view>
</view>
</view>
<!-- 运输中 -->
<view class="cargo-list" v-if="transit.length">
<view class="txt flex">
<view class="icon background-grey radius100 flex"><image src="/static/icon/icon-transit.png" mode="widthFix" style="width: 29rpx; height: 23rpx;"></image></view>
<view class="title font28 bold">已到达口岸</view>
</view>
<view class="item pad-sx10 border-box flex" v-for="(item,index) in transit" :key="index">
<view class="point radius100 background-grey" :class="index==0?'opacity':''"></view>
<view class="info">
<view class="cargo-tags font24">{{item.tags}}</view>
<view class="cargo-time font20 opacity-06">{{item.time}}</view>
</view>
</view>
</view>
<!-- 仓库处理中 -->
<view class="cargo-list" v-if="handle.length">
<view class="txt flex">
<view class="icon background-grey radius100 flex"><image src="/static/icon/icon-handle.png" mode="widthFix" style="width: 27rpx; height: 24rpx;"></image></view>
<view class="title font28 bold">已发运</view>
</view>
<view class="item pad-sx10 border-box flex" v-for="(item,index) in handle" :key="index">
<view class="point radius100 background-grey" :class="index==0?'opacity':''"></view>
<view class="info">
<view class="cargo-tags font24">{{item.tags}}</view>
<view class="cargo-time font20 opacity-06">{{item.time}}</view>
</view>
</view>
</view>
<!-- 已下单 -->
<view class="cargo-list" v-if="placed.length"><!-- placed-list -->
<view class="txt flex">
<view class="icon background-grey radius100 flex"><image src="/static/icon/icon-placed.png" mode="widthFix" style="width: 22rpx; height: 22rpx;"></image></view>
<view class="title font28 bold">已头程开航</view>
</view>
<view class="item pad-sx10 border-box flex" v-for="(item,index) in placed" :key="index">
<view class="point radius100 background-grey" :class="index==0?'opacity':''"></view>
<view class="info">
<view class="cargo-tags font24">{{item.tags}}</view>
<view class="cargo-time font20 opacity-06">{{item.time}}</view>
</view>
</view>
</view>
</view>
<!-- 提示信息 -->
<view class="tips-txt font24" v-if="isTips">暂未查询到相关线路信息</view>
</view>
<!-- 底部图片 -->
<view class="cargo-img pad-sx25 pad-zy20 border-box">
<image src="/static/public/cargo.jpg" mode="widthFix"></image>
</view>
<!-- 尾部 -->
<foot-tab :current="3"></foot-tab>
</view>
</template>
<script>
import titlePull from '@/components/title/title-pull.vue';
export default {
components:{
titlePull
},
data() {
return {
screenHeight:uni.getSystemInfoSync().screenHeight,
statusHeight:uni.getSystemInfoSync().statusBarHeight,
coding:'',// 订单号 SHA095534
address:'',// 收货地址
signed:[],// 已签收
wait:[],// 待取件
deliver:[],// 派送中
transit:[],// 运输中
handle:[],// 仓库处理中
placed:[],// 已下单
isTips:false,
isLoading:false,
}
},
onLoad(op) {
},
methods: {
submitEv(){
uni.showLoading({
title:'加载中'
})
this.address = '',// 收货地址
this.signed = [],// 已签收
this.wait = [],// 待取件
this.deliver = [],// 派送中
this.transit = [],// 运输中
this.handle = [],// 仓库处理中
this.placed = [],// 已下单
this.$requst.get('/api/index/getBillDateByBillCode',{code:this.coding}).then(res=>{
if(res.code==0){
console.log(res,'线路信息');
//FirstDate 头程开航日
//DispatchDate 发运日期
// ArrivePortDate 到达口岸日期
// ExpArriveDate 到达日期
if(res.data.FirstDate){
if(res.data.FirstDate!==''){
let placedObj = {tags:'商品已头程开航',time:res.data.FirstDate};
this.placed.push(placedObj);
}else{
this.placed = [];
}
}
if(res.data.DispatchDate){
if(res.data.DispatchDate!==''){
let handleObj = {tags:'商品已发运',time:res.data.DispatchDate};
this.handle.push(handleObj);
}else{
this.handle = [];
}
}
if(res.data.ArrivePortDate){
if(res.data.ArrivePortDate!==''){
let transitObj = {tags:'商品已到达口岸',time:res.data.ArrivePortDate};
this.transit.push(transitObj);
}else{
this.transit = []
}
}
if(res.data.ExpArriveDate){
if(res.data.ExpArriveDate!==''){
let deliverObj = {tags:'商品已到达',time:res.data.ExpArriveDate};
this.deliver.push(deliverObj);
}else{
this.deliver = []
}
}
if(!res.data.FirstDate && !res.data.DispatchDate && !res.data.ArrivePortDate && !res.data.ExpArriveDate){
this.isTips = true;
}
}
uni.hideLoading();
this.isLoading = true;
})
}
}
}
</script>
<style scoped>
.background-red{
background-color: #da0005;
}
.background-grey{
background-color: #e5e5e5;
}
/* 搜索 */
.cargo-search-bg{
background-color: #ffffff;
width: 100%;
margin-bottom: 20rpx;
position: sticky;
left: 0;
z-index: 9;
}
.cargo-search{
justify-content: space-between;
align-items: center;
height: 60rpx;
border: 2rpx solid #eeeeee;
overflow: hidden;
}
.cargo-search>image{
width: 25rpx;
height: 25rpx;
margin: 0 10rpx 0 20rpx;
}
.cargo-search>.input{
width: calc(100% - 155rpx);
color: #666666;
}
.cargo-search>.submit-btn{
justify-content: center;
align-items: center;
width: 100rpx;
height: 100%;
color: #ffffff;
border-radius: 0 29rpx 29rpx 0;
letter-spacing: 4rpx;
text-indent: 4rpx;
}
/* 详细 */
.cargo{
background-color: #ffffff;
}
.cargo-title{
margin: 10rpx 0 35rpx;
}
.address .icon{
justify-content: center;
align-items: center;
width: 42rpx;
height: 42rpx;
margin: 0 38rpx 0 10rpx;
color: #ffffff;
}
.address .txt{
align-items: center;
height: 42rpx;
}
.address .item{
width: calc(100% - 50rpx);
height: 61rpx;
margin-left: 30rpx;
border-left: 2rpx solid #e5e5e5;
}
.cargo-list .txt{
align-items: center;
height: 48rpx;
}
.cargo-list .icon{
justify-content: center;
align-items: center;
width: 48rpx;
height: 48rpx;
margin: 0 34rpx 0 8rpx;
color: #ffffff;
}
.cargo-list .item{
width: calc(100% - 46rpx);
margin-left: 32rpx;
border-left: 2rpx solid #e5e5e5;
line-height: 1.5;
}
.cargo-list .item:last-child{
padding-bottom: 42rpx;
}
.cargo-list .item .point{
width: 12rpx;
height: 12rpx;
margin: 12rpx 53rpx 0 -7rpx;
}
.cargo-list .item .info{
width: calc(100% - 65rpx);
}
.cargo-list .item .cargo-time{
margin-top: 10rpx;
}
.placed-list .item:nth-last-of-type(2){
padding-bottom: 38rpx;
}
.placed-list .item:last-child{
padding-top: 0;
border-left: 2rpx solid rgba(229,229,229,0);
margin-top: -18rpx;
}
/* 底部图片 */
.cargo-img{
width: 100%;
}
.cargo-img>image{
width: 100%;
}
/* 提示 */
.tips-txt{
text-align: center;
color: #999999;
}
</style>