emis-app/pages/print/courierNote.vue

320 lines
10 KiB
Vue
Raw Normal View History

2023-12-30 15:28:01 +00:00
<template>
2024-05-09 09:34:27 +00:00
<tpx-page>
<tpx-layout>
<template v-slot:body>
2024-05-12 14:34:20 +00:00
<view class="pos-abt-all">
<tpx-scroll-view v-model:resObject="resData" :searchParam="searchParam" :getListFun="getListFun"
2024-07-30 03:09:47 +00:00
ref="listRef" :autoReload="false" :createReload="false"
2024-05-09 09:34:27 +00:00
>
2024-05-12 14:34:20 +00:00
<view class="blcok-white-noradius" style="margin-top: 0;">
<u-row justify="between">
<view style="width: 140rpx;" class="font-weight">运单号</view>
<view style="flex:1;">
<tpx-scan-input v-model:value="searchParam.billCode" placeholder="请输入或扫码"
2024-07-30 03:09:47 +00:00
@scanChange="handleScanValChange" iconPos="right"></tpx-scan-input>
2024-05-09 09:34:27 +00:00
</view>
2024-05-12 14:34:20 +00:00
</u-row>
<u-row justify="between" custom-style="margin-top:20rpx;">
<view style="width: 140rpx;" class="font-weight">下单时间</view>
<view style="flex:1;">
2024-07-30 03:09:47 +00:00
<tpx-date-input ref="dateRef" v-model:value="searchParam._date" placeholder="请选择时间"></tpx-date-input>
2024-05-09 09:34:27 +00:00
</view>
</u-row>
2024-05-12 14:34:20 +00:00
<u-row custom-style="margin-top:20rpx;" justify="end">
<u-row>
<text class="pr-30">是否已打印</text>
<u-switch v-model="searchParam.printFlag" activeValue="1" inactiveValue="0"
active-color="#B12D29" size="34"></u-switch>
</u-row>
</u-row>
2024-07-11 14:25:52 +00:00
<view class="mt-20">
2024-05-12 14:34:20 +00:00
<u-button type="primary" size="large" shape="square" plain="true" @click="handleSearch"
2024-07-11 14:25:52 +00:00
custom-style="height:66rpx;font-size: 30rpx;border-radius: 14rpx;">查询</u-button>
2024-05-12 14:34:20 +00:00
</view>
2024-05-09 09:34:27 +00:00
</view>
2024-05-12 14:34:20 +00:00
<view class="blcok-white-noradius">
2024-06-04 08:19:30 +00:00
<u-row justify="between" custom-style="padding-top:20rpx;">
<view class="com-section">打印配置</view>
2024-08-01 05:52:44 +00:00
<view style="width: 160rpx;">
<u-button @click="handlePreview" custom-style="height: 60rpx;">预览</u-button>
</view>
2024-05-12 14:34:20 +00:00
</u-row>
2024-06-04 08:19:30 +00:00
<view class="clr-prm mt-20">注意:当打印出来寄件分拨或未端分拨返回为空时,请等待5分钟后再补 打印</view>
2024-05-12 14:34:20 +00:00
<view class="mt-20">
<u-checkbox-group v-model="submitParam.printType" placement="column">
<u-row custom-style="flex-wrap: wrap;">
<u-col span="6" v-for="(item, index) in dicData.emis_print_type">
2024-06-04 08:19:30 +00:00
<u-checkbox size="30" labelSize="30" label-color=":#999" activeColor="#B12D29"
:customStyle="{marginBottom: '20rpx'}"
2024-05-12 14:34:20 +00:00
:label="item.title" :name="item.val"
></u-checkbox>
</u-col>
</u-row>
</u-checkbox-group>
</view>
<u-row custom-style="margin-top:30rpx;">
<view style="width: 200rpx;" class="">子单打印区间</view>
<u-row>
<tpx-input customStyle="width:60rpx;" v-model:value="submitParam.subBillCodeRange[0]" :isWhite="true" placeholder="" type="number"></tpx-input>
<text class="pl-10 pr-10">到</text>
<tpx-input customStyle="width:60rpx;" v-model:value="submitParam.subBillCodeRange[1]" :isWhite="true" placeholder="" type="number"></tpx-input>
</u-row>
</u-row>
</view>
<view class="blcok-white-noradius">
2024-08-05 16:59:04 +00:00
<view class="pb-20 com-section" @click="handleSelAll">
<u-row justify="between">
<view>运单列表</view>
<view class="com-chk-icon">
<u-checkbox-group>
<u-checkbox size="26" labelSize="26" label-color=":#999" activeColor="#B12D29"
label="" :checked="resData.list.length > 0 && submitParam.billCode.length == resData.list.length"
></u-checkbox>
</u-checkbox-group>
</view>
2024-05-12 14:34:20 +00:00
</u-row>
</view>
<tpx-checkitems :list="resData.list" v-model:value="submitParam.billCode" v-slot="dlCurrent" type="multiple"
2024-05-22 17:06:55 +00:00
vdataType="array"
2024-05-12 14:34:20 +00:00
>
2024-05-12 16:49:19 +00:00
<view slot class="yditem">
2024-08-05 16:59:04 +00:00
<u-row justify="between">
<u-row @click="setClipboardData(dlCurrent.item.billCode)">
<view>
<u-text :text="`运单号:${dlCurrent.item.billCode}` " size="26"></u-text>
</view>
<view class="pl-10">
<u-icon name="file-text" size="32" custom-style=""></u-icon>
</view>
</u-row>
<view class="com-chk-icon">
<u-checkbox-group>
<u-checkbox size="26" labelSize="26" label-color=":#999" activeColor="#B12D29"
label="" :checked="dlCurrent.checked"
></u-checkbox>
</u-checkbox-group>
</view>
2024-05-12 14:34:20 +00:00
</u-row>
2024-08-05 16:59:04 +00:00
<div class="blcok-grey-sm" style="margin-top: 10rpx;margin-bottom: 0;">
<u-row justify="between">
<view>
<text class="clr-sub pr-10">寄件人</text>
<text>{{dlCurrent.item.sendName}}</text>
</view>
<view>
<text class="clr-sub pr-10">寄件电话</text>
<text>{{dlCurrent.item.sendMobile}}</text>
</view>
</u-row>
<u-row v-if="dlCurrent.item.sendCompany" custom-style="margin-top:6rpx;">
<view>
<text class="clr-sub pr-10">寄件公司</text>
<text>{{dlCurrent.item.sendCompany}}</text>
</view>
</u-row>
<u-row custom-style="margin-top:6rpx;">
<view>
<text class="clr-sub pr-10">寄件地址</text>
<text>{{dlCurrent.item.sendAddress}}</text>
</view>
</u-row>
2024-08-05 17:05:53 +00:00
<view style="background:#d0c3c2;height: 1rpx;margin: 5rpx 0;"></view>
2024-08-05 16:59:04 +00:00
<u-row custom-style="margin-top:6rpx;">
<view>
<text class="clr-sub pr-10">收件地址</text>
<text>{{dlCurrent.item.receiveAddress}}</text>
</view>
</u-row>
<u-row custom-style="margin-top:6rpx;">
<view>
<text class="clr-sub pr-10">目的网点</text>
<text>{{dlCurrent.item.dispatchUnderlingSiteName}}</text>
</view>
</u-row>
</div>
<u-text :text="`下单时间:${dlCurrent.item.sendDate}`" color="#999" size="24"
margin="10rpx 0 0 0"></u-text>
2024-05-12 14:34:20 +00:00
</view>
</tpx-checkitems>
</view>
</tpx-scroll-view>
2024-05-09 09:34:27 +00:00
</view>
</template>
2024-05-12 14:34:20 +00:00
2024-05-09 09:34:27 +00:00
<template v-slot:footer>
<view class="blcok-white-noradius">
<u-row>
2024-08-01 05:52:44 +00:00
<u-button @click="handleSubmitPrint()" type="primary" size="large" shape="square"
2024-05-09 09:34:27 +00:00
custom-style="height:80rpx;font-size: 30rpx;border-radius: 14rpx;margin: 0 10rpx;">打印</u-button>
</u-row>
</view>
</template>
</tpx-layout>
2024-07-24 17:32:26 +00:00
<tpx-bluetooth-print-preview ref="curPrint"></tpx-bluetooth-print-preview>
2024-05-09 09:34:27 +00:00
</tpx-page>
2023-12-30 15:28:01 +00:00
</template>
<script>
2024-05-09 09:34:27 +00:00
import { debounce } from "@/common/util"
import dayjs from "dayjs"
import * as apiService from "@/common/api"
2024-06-08 17:31:07 +00:00
import { checkParams } from "@/common/validate"
2024-08-05 16:59:04 +00:00
import { getAddressDetail } from "@/common/util"
2024-07-24 17:32:26 +00:00
import TpxBluetoothPrintPreview from "@/components/tpx-bluetooth-print/tpx-bluetooth-print-preview"
2023-12-30 15:28:01 +00:00
export default {
2024-07-24 17:32:26 +00:00
components: {
TpxBluetoothPrintPreview,
},
2023-12-30 15:28:01 +00:00
props: {
// hasLeftWin: {
// type: Boolean
// }
},
computed: {
2024-05-09 09:34:27 +00:00
dicData() {
return this.$store.getters.dicData
},
2023-12-30 15:28:01 +00:00
},
data() {
2024-05-09 09:34:27 +00:00
let { dicData } = this.$store.getters
2023-12-30 15:28:01 +00:00
return {
submitParam: {
2024-05-09 09:34:27 +00:00
lang: 'zh',
printType: [],
2024-05-12 14:34:20 +00:00
billCode: [],
2024-05-09 09:34:27 +00:00
subBillCodeRange: []
2023-12-30 15:28:01 +00:00
},
2024-06-08 17:31:07 +00:00
submitValidConfig: {
printType: { required: true, requiredMsg: '请勾选打印配' },
billCode: { required: true, requiredMsg: '请选择运单号' },
},
2023-12-30 15:28:01 +00:00
yinlTypeList: [
2024-05-09 09:34:27 +00:00
{ title: '中文', val: 'zh' },
{ title: '英文', val: 'en' },
2023-12-30 15:28:01 +00:00
],
2024-05-12 14:34:20 +00:00
searchParam: {
printFlag: '0',
billCode: '',
_date: [],
2024-06-21 04:55:51 +00:00
params: {}
2024-05-12 14:34:20 +00:00
},
2024-05-12 12:49:00 +00:00
resData: { list: [] }
2023-12-30 15:28:01 +00:00
}
},
onShareAppMessage() {
return {
}
},
onLoad() {
this.initData();
},
2024-07-30 03:09:47 +00:00
onReady(){
// 默认选择今天
this.$refs.dateRef.handleToolsRangChange('1')
},
2023-12-30 15:28:01 +00:00
onUnload() {
},
methods: {
2024-08-05 16:59:04 +00:00
getAddressDetail,
2024-05-12 14:34:20 +00:00
async getListFun(param){
let cpParam = JSON.parse(JSON.stringify(param))
2024-06-21 04:55:51 +00:00
cpParam.params.beginSendDate = cpParam._date[0]
cpParam.params.endSendDate = cpParam._date[1]
2024-05-12 14:34:20 +00:00
let res = await apiService.queryPrintListSimple(cpParam)
// list增加新字段
res.rows.map(t=> {
t.val = t.billCode
})
return res
},
2023-12-30 15:28:01 +00:00
initData() {
},
2024-07-30 03:09:47 +00:00
triggerListReload(){
this?.$refs?.listRef?.getDataList?.(true) // 重置到第一页数据
},
2024-05-09 09:34:27 +00:00
handleScanValChange: debounce(function(val){
2024-07-30 03:09:47 +00:00
this.triggerListReload()
2024-05-09 09:34:27 +00:00
}),
2024-05-12 14:34:20 +00:00
handleSearch(){
2024-07-30 03:09:47 +00:00
this.triggerListReload()
2024-05-12 14:34:20 +00:00
},
2024-08-01 05:52:44 +00:00
async handleSubmitPrint() {
2024-06-04 08:19:30 +00:00
const imgUrls = await this.getPrintImages()
2024-08-01 05:52:44 +00:00
this.$refs.curPrint.confirmPrint(imgUrls.filter(v=> !!v))
2023-12-30 15:28:01 +00:00
},
handleSelAll() {
2024-05-12 14:34:20 +00:00
if(this.submitParam.billCode.length == this.resData.list.length) {
this.submitParam.billCode = []
2023-12-30 15:28:01 +00:00
} else {
2024-05-12 14:34:20 +00:00
this.submitParam.billCode = this.resData.list.map(item=> item.val)
2023-12-30 15:28:01 +00:00
}
2024-05-09 09:34:27 +00:00
},
async getRealGetWaybillPrintData() {
2024-05-12 14:34:20 +00:00
// 请求后端接口
2024-05-09 09:34:27 +00:00
let param = JSON.parse(JSON.stringify(this.submitParam))
param.printType = param.printType.join(',')
2024-05-12 14:34:20 +00:00
param.billCode = param.billCode.join(',')
2024-05-09 09:34:27 +00:00
param.subBillCodeRange = param.subBillCodeRange.join(',')
2024-06-08 17:31:07 +00:00
await checkParams(param, this.submitValidConfig)
2024-05-11 05:17:59 +00:00
let res = await apiService.getRealGetWaybillPrintData({ ...param, _loading: true })
2024-05-11 05:11:46 +00:00
return res
2024-06-04 08:19:30 +00:00
},
async getPrintImages() {
let res = await this.getRealGetWaybillPrintData()
const imgUrls = res?.data?.map(t=> t.imageUrl) || []
return imgUrls
2024-08-01 05:52:44 +00:00
},
async handlePreview(){
const imgUrls = await this.getPrintImages()
this.$refs.curPrint.showPreview({
imageUrl: imgUrls.filter(v=> !!v)
})
},
2023-12-30 15:28:01 +00:00
}
}
</script>
2024-06-05 06:09:00 +00:00
<script module="acceptance" lang="renderjs">
import { PDFDocument, StandardFonts } from "pdf-lib/dist/pdf-lib.esm.min"
export default {
mounted() {
// const script = document.createElement('script')
// // view 层的页面运行在 www 根目录,其相对路径相对于 www 计算
// script.src = 'static/js/jquery-3.1.1.min.js'
// script.onload = this.initEvent.bind(this, this.$ownerInstance)
// document.head.appendChild(script)
this.initEvent()
},
methods: {
async initEvent(ownerInstance) {
},
}
}
</script>
2023-12-30 15:28:01 +00:00
<style lang="scss">
@import '@/common/uni-nvue.scss';
page {
background-color: #F6F6F6;
height: 100% !important;
}
</style>
<style scoped lang="scss">
.ddhao {
2024-05-12 14:34:20 +00:00
}
.yditem{
padding: 20rpx 0;
border-top: 2px solid #F6F6F6;
2023-12-30 15:28:01 +00:00
}
</style>