emis-sapp/pages/post/query.vue
2025-08-15 16:52:14 +08:00

250 lines
7.0 KiB
Vue

<template>
<tpx-page>
<tpx-layout>
<template v-slot:header>
<view class="pgb-header">
<view class="com-jianju">
<tpx-scan-input v-model:value="searchParam.billCode" placeholder="请输入单号或扫码"
@change="handleScanValChange" iconPos="right"></tpx-scan-input>
</view>
</view>
</template>
<template v-slot:body>
<view v-if="historyList && historyList.length > 0" class="pgb-header mt-20" style="padding-bottom: 10rpx;">
<view class="com-jianju">
<tpx-tags :list="historyList" @onItemClick="handleHisItem"></tpx-tags>
</view>
</view>
<div v-if="modelInfo.billCode" style="min-height: 100%;display: flex;flex-direction: column;">
<view style="position: relative;">
<view class="mp-aside">
<bpd-send-site-tmp :value="modelInfo" :showInfoBtn="canViewImg" ></bpd-send-site-tmp>
</view>
<view class="mp-aside">
<!-- <view class="">
<bpd-pic-preview-tmp :list="modelInfo.billPicGoodsRmk" label="货物图片"></bpd-pic-preview-tmp>
</view>
<view class="mt-30">
<bpd-pic-preview-tmp :list="modelInfo.billPicSendRmk" label="揽收底单图片"></bpd-pic-preview-tmp>
</view> -->
<view class="">
<bpd-pic-preview-tmp :list="modelInfo.billPicDispatchRmk" label="签收底单" :canView="canViewImg" :checkViewFun="handleViewImgCheck"></bpd-pic-preview-tmp>
</view>
</view>
</view>
<view class="dt-block">
<view class="dt-tle">
<view class="t1">物流动态</view>
<view class="t2">
<u-button @click="goto(`post/locus?billCode=${searchParam.billCode}`)" shape="circle" :plain="true" custom-style="height: 50rpx;font-size:28rpx;">查看轨迹</u-button>
</view>
</view>
<u-line margin="20rpx 0 20rpx"></u-line>
<view class="mb-20">
<buns-locus-pos :billCode="searchParam.billCode" ref="lcusRef"></buns-locus-pos>
</view>
</view>
</div>
<view v-if="!modelInfo.billCode">
<tpx-empty></tpx-empty>
</view>
</template>
</tpx-layout>
<tpx-dialog type="type-dialog" v-model:show="danCheckModal.show" title="输入号码后4位">
<view style="position: relative;height: 360rpx; width: 500rpx;">
<tpx-layout>
<template v-slot:body>
<view class="mt-20">
<u-row justify="center">
<text class="font-28 clr-sub">输入寄件人或收件人于机号码后四位</text>
</u-row>
</view>
<view class="mt-40">
<u-row justify="center">
<u-code-input v-model="danCheckModal.validCode" maxlength="4" space="20" fontSize="36" size="80"></u-code-input>
</u-row>
</view>
</template>
<template v-slot:footer>
<view class="blcok-white-noradius" style="margin-top: 0;margin-bottom: 0;">
<u-button @click="handleSubmitDanCheck" type="primary" size="large" shape="circle"
custom-style="height:80rpx;font-size: 30rpx;">
确认
</u-button>
</view>
</template>
</tpx-layout>
</view>
</tpx-dialog>
</tpx-page>
</template>
<script>
import dayjs from "dayjs"
import { debounce } from "@/common/util"
import * as apiService from "@/common/api"
import { setSessionSystemInfo, getSessionSystemInfo } from "@/session"
import BpdSendSiteTmp from "@/components/buns-post-detail-templates/bpd-send-site-tmp"
import BpdPicPreviewTmp from "@/components/buns-post-detail-templates/bpd-pic-preview-tmp"
export default {
props: {
// hasLeftWin: {
// type: Boolean
// }
},
computed: {
dicData() {
return this.$store.getters.dicData
},
},
components: { BpdSendSiteTmp, BpdPicPreviewTmp, },
data() {
return {
canViewImg: false,
queryOption: {
billCode: '', // 运单id
},
modelInfo: {
},
danCheckModal: {
show: false
},
historyList: getSessionSystemInfo()?.postQueryHistory || [],
searchParam: {
billCode: ''
}
}
},
onShareAppMessage() {
return {
}
},
onLoad(option) {
this.queryOption = option
this.searchParam.billCode = option.billCode
this.initData();
},
onUnload() {},
methods: {
initData() {
},
handleScanValChange: debounce(function(val){
val && (this.handleSearch(val))
}),
handleHisItem(item){
this.searchParam.billCode = item.val
this.handleSearch()
},
async handleSearch() {
let res = await apiService.getOrderDetail({...this.searchParam, _loading: true})
let resData = res.data
let maxHisLen = 5 // 最多记录个数
if(resData.billCode && this.historyList?.filter?.(t=> t.val == resData.billCode)?.length == 0) {
this.historyList.unshift({ title: resData.billCode, val: resData.billCode })
this.historyList.length > maxHisLen && (this.historyList.length = maxHisLen);
}
// 更新缓存
setSessionSystemInfo({ postQueryHistory: this.historyList })
let estimateDate = resData.estimateDate
// 已签收取 签收时间
resData.waybillStatus == 50 && (estimateDate = resData.signDate)
estimateDate && (resData.estimateDate = dayjs(estimateDate).format('YYYY-MM-DD'))
// 通过对象合并才能修改父级 数据
Object.assign(this.modelInfo, resData || {})
// 判断是否有权限查看图片
this.canViewImg = this.modelInfo.customerCode == this.$store.getters.userInfo.customerCode
setTimeout(()=> {
this.$refs.lcusRef.initData()
}, 300)
},
handleViewImgCheck(){
this.danCheckModal.show = true
this.danCheckModal.validCode = ''
let curPromise = new Promise((resolve)=> {
this.danCheckModal.submitResolve = resolve
})
return curPromise
},
handleSubmitDanCheck() {
let senderPhoneCode = (this.modelInfo.sender?.phone + '').substr(-4);
let recieverPhoneCode = (this.modelInfo.reciever?.phone + '').substr(-4)
let { validCode } = this.danCheckModal
if(validCode == senderPhoneCode || validCode == recieverPhoneCode){
this.danCheckModal.show = false
this.canViewImg = true
this.showLoading()
setTimeout(()=> {
this.hideLoading()
this.danCheckModal.submitResolve(true)
}, 1500)
} else {
this.danCheckModal.validCode = ''
this.showToast('验证错误,请检查')
}
}
}
}
</script>
<style lang="scss">
@import '@/common/uni-nvue.scss';
page {
background-color: #F6F6F6;
height: 100% !important;
}
.pgb-header {
// padding-top: --status-bar-height;
padding-top: 30rpx;
padding-bottom: 30rpx;
background-color: #FFF;
position: relative;
}
</style>
<style scoped lang="scss">
.mp-aside{
margin: 30rpx;
padding: 30rpx;
background: #FFFFFF;
border-radius: 20rpx;
}
.dt-block {
flex: 1;
padding: 30rpx;
background-color: #FFF;
position: relative;
}
.dt-tle {
display: flex;
flex-direction: row;
justify-content: space-between;
.t1 {
font-size: 30rpx;
font-weight: 600;
}
.t2 {
font-size: 30rpx;
}
}
</style>