emis-sapp/pages/post/query.vue

243 lines
6.5 KiB
Vue
Raw Normal View History

2023-12-16 17:34:29 +00:00
<template>
2024-06-03 08:45:36 +00:00
<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>
2024-09-19 05:48:21 +00:00
</view>
2024-06-03 08:45:36 +00:00
</template>
2024-09-19 05:48:21 +00:00
<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>
2024-06-03 08:45:36 +00:00
<div v-if="modelInfo.billCode" style="min-height: 100%;display: flex;flex-direction: column;">
<view style="position: relative;">
<view class="mp-aside">
2024-09-19 05:48:21 +00:00
<bpd-send-site-tmp :value="modelInfo" :showInfoBtn="canViewImg" ></bpd-send-site-tmp>
2024-06-03 08:45:36 +00:00
</view>
2024-08-17 15:45:55 +00:00
<view class="mp-aside">
<!-- <view class="">
2024-06-03 08:45:36 +00:00
<bpd-pic-preview-tmp :list="modelInfo.billPicGoodsRmk" label="货物图片"></bpd-pic-preview-tmp>
2023-12-16 17:34:29 +00:00
</view>
2024-06-03 08:45:36 +00:00
<view class="mt-30">
<bpd-pic-preview-tmp :list="modelInfo.billPicSendRmk" label="揽收底单图片"></bpd-pic-preview-tmp>
2024-08-17 15:45:55 +00:00
</view> -->
2024-06-03 08:45:36 +00:00
2024-08-17 15:45:55 +00:00
<view class="">
<bpd-pic-preview-tmp :list="modelInfo.billPicDispatchRmk" label="签收底单" :canView="canViewImg" :checkViewFun="handleViewImgCheck"></bpd-pic-preview-tmp>
2023-12-16 17:34:29 +00:00
</view>
2024-08-17 15:45:55 +00:00
</view>
2023-12-16 17:34:29 +00:00
</view>
2024-06-03 08:45:36 +00:00
<view class="dt-block">
<view class="mb-20">
2024-06-14 12:46:07 +00:00
<buns-locus-pos :billCode="searchParam.billCode" ref="lcusRef"></buns-locus-pos>
2024-06-03 08:45:36 +00:00
</view>
2023-12-16 17:34:29 +00:00
</view>
2024-06-03 08:45:36 +00:00
</div>
2023-12-16 17:34:29 +00:00
2024-06-03 08:45:36 +00:00
<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">
2024-09-01 01:57:54 +00:00
<u-code-input v-model="danCheckModal.validCode" maxlength="4" space="20" fontSize="36" size="80"></u-code-input>
2024-06-03 08:45:36 +00:00
</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>
2023-12-16 17:34:29 +00:00
</template>
2024-09-19 05:48:21 +00:00
<script>
import dayjs from "dayjs"
2024-06-03 08:45:36 +00:00
import { debounce } from "@/common/util"
2024-09-19 05:48:21 +00:00
import * as apiService from "@/common/api"
import { setSessionSystemInfo, getSessionSystemInfo } from "@/session"
import BpdSendSiteTmp from "@/components/buns-post-detail-templates/bpd-send-site-tmp"
2024-06-03 08:45:36 +00:00
import BpdPicPreviewTmp from "@/components/buns-post-detail-templates/bpd-pic-preview-tmp"
2023-12-16 17:34:29 +00:00
export default {
props: {
// hasLeftWin: {
// type: Boolean
// }
},
2024-06-03 08:45:36 +00:00
computed: {
dicData() {
return this.$store.getters.dicData
},
},
2024-09-19 05:48:21 +00:00
components: { BpdSendSiteTmp, BpdPicPreviewTmp, },
2023-12-16 17:34:29 +00:00
data() {
return {
2024-08-17 15:45:55 +00:00
canViewImg: false,
2024-06-03 08:45:36 +00:00
queryOption: {
billCode: '', // 运单id
},
modelInfo: {
},
2023-12-16 17:34:29 +00:00
danCheckModal: {
show: false
2024-09-19 05:48:21 +00:00
},
historyList: getSessionSystemInfo()?.postQueryHistory || [],
2023-12-16 17:34:29 +00:00
searchParam: {
2024-06-03 08:45:36 +00:00
billCode: ''
2023-12-16 17:34:29 +00:00
}
}
},
onShareAppMessage() {
return {
2024-06-03 08:45:36 +00:00
2023-12-16 17:34:29 +00:00
}
},
2024-06-03 08:45:36 +00:00
onLoad(option) {
this.queryOption = option
this.searchParam.billCode = option.billCode
2023-12-16 17:34:29 +00:00
this.initData();
},
onUnload() {},
methods: {
2024-06-03 08:45:36 +00:00
2023-12-16 17:34:29 +00:00
initData() {
},
2024-06-03 08:45:36 +00:00
handleScanValChange: debounce(function(val){
val && (this.handleSearch(val))
2024-09-19 05:48:21 +00:00
}),
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 })
if(resData.estimateDate){
resData.estimateDate = dayjs(resData.estimateDate).format('YYYY-MM-DD')
}
2024-06-03 08:45:36 +00:00
// 通过对象合并才能修改父级 数据
2024-09-19 05:48:21 +00:00
Object.assign(this.modelInfo, resData || {})
2024-08-17 15:45:55 +00:00
// 判断是否有权限查看图片
this.canViewImg = this.modelInfo.customerCode == this.$store.getters.userInfo.customerCode
2024-06-14 12:46:07 +00:00
setTimeout(()=> {
this.$refs.lcusRef.initData()
}, 300)
2023-12-16 17:34:29 +00:00
},
2024-08-17 15:45:55 +00:00
handleViewImgCheck(){
this.danCheckModal.show = true
this.danCheckModal.validCode = ''
let curPromise = new Promise((resolve)=> {
this.danCheckModal.submitResolve = resolve
})
return curPromise
},
2023-12-16 17:34:29 +00:00
handleSubmitDanCheck() {
2024-08-17 15:45:55 +00:00
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('验证错误,请检查')
}
2023-12-16 17:34:29 +00:00
}
}
}
</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>