You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1097 lines
41 KiB

<template>
<view class="container">
<view>
<uni-card :title="itemData.companyName" :sub-title="itemData.goStationName +''+itemData.arrivalStationName" :extra="'接站人:'+itemData.receivingUserName"
thumbnail="/static/images/dingdan/dd0.png">
<view class="uni-body">
<text class="cardText">单号</text>
{{itemData.id}}
</view>
<view class="uni-body">
发货人:{{itemData.shipperName == null ? '暂无' : itemData.shipperName}}({{itemData.shipperMobile== null?'':itemData.shipperMobile}})
</view>
<view class="uni-body">
发货地址:{{itemData.shipperAddress}}
</view>
<view class="uni-body">
收货人:{{itemData.receiverName == null ? '暂无' : itemData.receiverName}}({{itemData.receiverMobile== null?'':itemData.receiverMobile}})
</view>
<view class="uni-body">
收货地址:{{itemData.receiverAddress}}
</view>
<view class="uni-body">
物品名称:{{itemData.objectName}}
</view>
<view class="uni-body" style="font-weight: bold;">
<text class="cardText">重量{{itemData.weight}}</text>
<text class="cardText" style="padding-left: 20rpx;">件数{{itemData.count}}</text>
</view>
</uni-card>
</view>
<view class="tui-order-item boxbg">
<view class="tui-goods-info">
<view class="tui-price-flex tui-size32" style="font-weight: bold;">
<view class="tui-flex-shrink">总费用</view>
<view class="tui-goods-price">
<view class="tui-size-24"></view>
<view class="tui-price-large">{{ itemData.allCost == null ?'暂无':itemData.allCost }}</view>
</view>
</view>
<view class="tui-price-flex tui-size32">
<view class="tui-flex-shrink">收款方式</view>
<view class="tui-goods-price">
<view class="tui-price-large">
{{itemData.methodOfSettlement == 0 ?'现金':itemData.methodOfSettlement == 1 ?'月付':itemData.methodOfSettlement == 2 ?'提付':'' }}
</view>
</view>
</view>
<view class="tui-price-flex tui-size32">
<view class="tui-flex-shrink">运输费</view>
<view class="tui-goods-price">
<view class="tui-size-24"></view>
<view class="tui-price-large">{{ itemData.freight == null ?'暂无':itemData.freight }}</view>
</view>
</view>
<view class="tui-price-flex tui-size32">
<view class="tui-flex-shrink">保费</view>
<view class="tui-goods-price">
<view class="tui-size-24"></view>
<view class="tui-price-large">{{ itemData.premium == null ?'暂无':itemData.premium }}</view>
</view>
</view>
<view class="tui-price-flex tui-size32">
<view class="tui-flex-shrink">中转费</view>
<view class="tui-goods-price">
<view class="tui-size-24"></view>
<view class="tui-price-large">{{ itemData.transitFee == null ?'暂无':itemData.transitFee }}</view>
</view>
</view>
<view class="tui-price-flex tui-size32">
<view class="tui-flex-shrink">小费</view>
<view class="tui-goods-price">
<view class="tui-size-24"></view>
<view class="tui-price-large">{{ itemData.tips == null ?'暂无':itemData.tips }}</view>
</view>
</view>
<view class="tui-price-flex tui-size32">
<view class="tui-flex-shrink">工本费</view>
<view class="tui-goods-price">
<view class="tui-size-24"></view>
<view class="tui-price-large">{{ itemData.cost == null ?'暂无':itemData.cost }}</view>
</view>
</view>
<view class="tui-price-flex tui-size32">
<view class="tui-flex-shrink">备注</view>
<view class="tui-goods-price">
<uni-tooltip :content="itemData.remark == null ?'':itemData.remark" placement="left">
<view
style="font-size: 13px;width: 200px;height: 40rpx;overflow: hidden;text-align: right;">
{{ itemData.remark == null ?'':itemData.remark}}
</view>
<text style="color: blue;" v-if="itemData.remark != null">查看更多</text>
</uni-tooltip>
</view>
</view>
<view class="tui-price-flex tui-size32" style="display: flex;flex-direction: column;" v-if="itemData.imagePath != null">
<view class="tui-flex-shrink">图片</view>
<view class="tui-goods-price" style="width: 100%;margin: 20rpx auto 0;" @tap="largeImg(itemData.imagePath)">
<img :src="itemData.imagePath" alt="" style="width: 100%;" />
</view>
</view>
</view>
</view>
<view class="tui-order-info boxbg">
<view class="tui-order-title">
修改记录
</view>
<view class="tui-order-content" v-for="(item,index) in changeList" :key="index">
<view>操作人{{item.createByName}}</view>
<view style="border-bottom: 1px solid #eee;">
操作时间{{item.createTime}}
</view>
<view style="font-size: 30rpx;">
<view v-for="(item1, index1) in item.diffAttrList" v-if="item1.name !='收货人id'&&item1.name !='发货人id'&&item1.name != '线路id' && item1.name != '到达站id' && item1.name != '操作人姓名'">
<view style="border-bottom: 2px solid #eee;display: inline-block;">{{item1.name}}</view>
<view style="display: flex;height: 60rpx;line-height: 60rpx;text-align: center;" v-if="item1.name !='重量历史'">
<view style="color: #777;flex: 1;">{{item1.oldVal}}</view>
<view style="flex: 1;border-bottom: 1px solid #777;line-height: 60rpx;font-size: 22rpx;">
修改为
</view>
<view style="flex: 1;font-weight: bold;">{{item1.newVal}}</view>
</view>
<view style="display: flex;flex-direction:column;height: auto;line-height: 60rpx;text-align: center;" v-if="item1.name =='重量历史'">
<view style="color: #777;overflow-wrap: break-word;">{{item1.oldVal}}</view>
<view style="border-bottom: 1px solid #777;line-height: 60rpx;font-size: 22rpx;">
修改为
</view>
<view style="font-weight: bold;overflow-wrap: break-word;">{{item1.newVal}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="tui-tabbar">
<view class="tui-btn-mr">
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'物流单'"
@onPrint="goPrint"></kk-printer>
</view>
<view class="tui-btn-mr">
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'收货单'"
@onPrint="goPrintList"></kk-printer>
</view>
<view class="tui-btn-mr">
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'小标签'"
@onPrintSmall1="onPrintSmall1"></kk-printer>
</view>
</view>
</view>
</template>
<script>
import util from '@/components/kk-printer/utils/util.js';
import * as blesdk from '@/components/kk-printer/utils/bluetoolth.js';
import kkPrinter from '@/components/kk-printer/index.vue';
import gbk from '@/components/kk-printer/utils/printUtil-GBK.js';
import {
maskShopName,
maskPhone
} from '@/utils/global.js'
export default {
data() {
return {
bigImg: [],
bufferData: [],
deviceType: 'ios',
itemData:{},
changeList:[],
bufferDataSmall:[],
bufferDataList:[],
bufferDataBig:[],
shopRemark:[],
yNum:0,
}
},
components: {
kkPrinter
},
filters: {
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + '/'
}
}
return name;
},
maxNum(val) {
if (val >= 10) {
return 10
} else if (val < 0) {
return 0
}
}
},
onShow() {
// 初始化蓝牙模块
wx.openBluetoothAdapter({
mode: 'central'
})
},
onLoad(option) {
this.itemData = JSON.parse(option.item)
let that = this
let orderNumber = this.itemData.orderNumber
let shipperName = this.itemData.shipperName
let receiverName = this.itemData.receiverName
let arrivalStationName = this.itemData.arrivalStationName
let createTime = this.itemData.createTime
let count = this.itemData.count == 0?1:this.itemData.count
let strCmd = ''
if(uni.getStorageSync('remark')){
let remark = uni.getStorageSync('remark')
this.shopRemark = remark.split('\n');
}
//收货单横向打印
for(let i=1;i<=1;i++){
//let strCmd = blesdk.CreatCPCLPage(600, 480, 1, 0,0);
let strCmd = blesdk.CreatCPCLPage(780, 1590, 1, 0,0);
strCmd += blesdk.addCPCLSETMAG(2, 2)
strCmd += blesdk.addCPCLLocation(2);
strCmd += blesdk.addCPCLText('-30', 1100, '24', '1', 1, '北京洪门货物运输有限公司')
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('50', 1500, '24', '0.5', 1, '开票日期:'+ createTime + ' 发站:总部->广州 卸货地点:沧州 货号:'+orderNumber)
//正文第一行
strCmd += blesdk.addCPCLText('90', 1290, '24', '0', 1, '收货人')
strCmd += blesdk.addCPCLLine(80, 1200, 125, 1200, 2);
strCmd += blesdk.addCPCLText('90', 1180, '24', '0', 1, '张春梅')
strCmd += blesdk.addCPCLLine(80, 1070, 125, 1070, 2);
strCmd += blesdk.addCPCLText('90', 1050, '24', '0', 1, '电话')
strCmd += blesdk.addCPCLLine(80, 970, 125, 970, 2);
strCmd += blesdk.addCPCLText('90', 960, '24', '0', 1, '13521030702')
strCmd += blesdk.addCPCLLine(80, 760, 125, 760, 2);
strCmd += blesdk.addCPCLText('90', 740, '24', '0', 1, '票号')
strCmd += blesdk.addCPCLLine(80, 660, 125, 660, 2);
strCmd += blesdk.addCPCLText('90', 640, '24', '0', 1, '3260304GA8440')
//正文第二行
strCmd += blesdk.addCPCLText('135', 1290, '24', '0', 1, '发货人')
strCmd += blesdk.addCPCLLine(125, 1200, 170, 1200, 2);
strCmd += blesdk.addCPCLText('135', 1180, '24', '0', 1, '周静')
strCmd += blesdk.addCPCLLine(125, 1070, 170, 1070, 2);
strCmd += blesdk.addCPCLText('135', 1050, '24', '0', 1, '电话')
strCmd += blesdk.addCPCLLine(125, 970, 170, 970, 2);
strCmd += blesdk.addCPCLText('135', 960, '24', '0', 1, '13521030702')
strCmd += blesdk.addCPCLLine(125, 760, 170, 760, 2);
strCmd += blesdk.addCPCLText('135', 740, '24', '0', 1, '身份证')
strCmd += blesdk.addCPCLLine(125, 630, 170, 630, 2);
strCmd += blesdk.addCPCLText('135', 620, '24', '0', 1, '130184199705130618')
//正文第三行
strCmd += blesdk.addCPCLText('180', 1290, '24', '0', 1, '货名')
strCmd += blesdk.addCPCLLine(170, 1200, 215, 1200, 2);
strCmd += blesdk.addCPCLText('180', 1180, '24', '0', 1, '件数')
strCmd += blesdk.addCPCLLine(170, 1070, 215, 1070, 2);
strCmd += blesdk.addCPCLText('180', 1050, '24', '0', 1, '付款方式')
strCmd += blesdk.addCPCLLine(170, 900, 215, 900, 2);
strCmd += blesdk.addCPCLText('180', 890, '24', '0', 1, '运费')
strCmd += blesdk.addCPCLLine(170, 800, 215, 800, 2);
strCmd += blesdk.addCPCLText('180', 790, '24', '0', 1, '送货')
strCmd += blesdk.addCPCLLine(170, 700, 215, 700, 2);
strCmd += blesdk.addCPCLText('180', 690, '24', '0', 1, '中转')
strCmd += blesdk.addCPCLLine(170, 600, 215, 600, 2);
strCmd += blesdk.addCPCLText('180', 590, '24', '0', 1, '工本费')
strCmd += blesdk.addCPCLLine(170, 500, 215, 500, 2);
strCmd += blesdk.addCPCLText('180', 490, '24', '0', 1, '保费')
strCmd += blesdk.addCPCLLine(170, 400, 215, 400, 2);
strCmd += blesdk.addCPCLText('180', 390, '24', '0', 1, '垫付')
strCmd += blesdk.addCPCLLine(170, 300, 215, 300, 2);
strCmd += blesdk.addCPCLText('180', 290, '24', '0', 1, '代收款')
strCmd += blesdk.addCPCLLine(170, 200, 215, 200, 2);
strCmd += blesdk.addCPCLText('180', 190, '24', '0', 1, '货到付款')
//正文第四行
strCmd += blesdk.addCPCLText('225', 1290, '24', '0', 1, '服装')
strCmd += blesdk.addCPCLLine(215, 1200, 260, 1200, 2);
strCmd += blesdk.addCPCLText('225', 1180, '24', '0', 1, '1')
strCmd += blesdk.addCPCLLine(215, 1070, 260, 1070, 2);
strCmd += blesdk.addCPCLText('225', 1050, '24', '0', 1, '到付')
strCmd += blesdk.addCPCLLine(215, 900, 260, 900, 2);
strCmd += blesdk.addCPCLText('225', 890, '24', '0', 1, '10')
strCmd += blesdk.addCPCLLine(215, 800, 260, 800, 2);
strCmd += blesdk.addCPCLText('225', 790, '24', '0', 1, '10')
strCmd += blesdk.addCPCLLine(215, 700, 260, 700, 2);
strCmd += blesdk.addCPCLText('225', 690, '24', '0', 1, '10')
strCmd += blesdk.addCPCLLine(215, 600, 260, 600, 2);
strCmd += blesdk.addCPCLText('225', 590, '24', '0', 1, '10')
strCmd += blesdk.addCPCLLine(215, 500, 260, 500, 2);
strCmd += blesdk.addCPCLText('225', 490, '24', '0', 1, '10')
strCmd += blesdk.addCPCLLine(215, 400, 260, 400, 2);
strCmd += blesdk.addCPCLText('225', 390, '24', '0', 1, '10')
strCmd += blesdk.addCPCLLine(215, 300, 260, 300, 2);
strCmd += blesdk.addCPCLText('225', 290, '24', '0', 1, '10')
strCmd += blesdk.addCPCLLine(215, 200, 260, 200, 2);
strCmd += blesdk.addCPCLText('225', 190, '24', '0', 1, '10')
//正文第五行
strCmd += blesdk.addCPCLText('270', 1290, '24', '0', 1, '运费合计:一千六百五十八元正 ¥1958')
strCmd += blesdk.addCPCLLine(260, 700, 305, 700, 2);
strCmd += blesdk.addCPCLText('270', 690, '24', '0', 1, '代收款(大写)·一千六百五十八元正¥:1956')
//正文第六行
strCmd += blesdk.addCPCLText('315', 1290, '24', '0', 1, '备注')
strCmd += blesdk.addCPCLLine(305, 700, 350, 700, 2);
strCmd += blesdk.addCPCLText('315', 690, '24', '0', 1, '特别声明')
//正文第七行
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('360', 1290, '24', '0', 1, '注')
strCmd += blesdk.addCPCLText('390', 1290, '24', '0', 1, '意')
strCmd += blesdk.addCPCLText('420', 1290, '24', '0', 1, '事')
strCmd += blesdk.addCPCLText('450', 1290, '24', '0', 1, '项')
strCmd += blesdk.addCPCLLine(350, 1260, 475, 1260, 2);
strCmd += blesdk.addCPCLText('360', 1250, '24', '0', 1, '1.托运货物必须包装完好、玻璃、陶瓷、塑料制品等易碎易损货物、只负丢失赔偿责任、不负破损赔偿责任。')
strCmd += blesdk.addCPCLText('390', 1250, '24', '0', 1, '2.托运货物必须参加保价运输,如有损坏丢失,属于我部责任范围内、已保价的、按投保价100%赔偿、未参')
strCmd += blesdk.addCPCLText('420', 1250, '24', '0', 1, '加保价、最高按运价的十倍计赔。3.一切货损在总价值的10%内属正常损耗,外包装完好、破损不予以赔偿。')
strCmd += blesdk.addCPCLText('450', 1250, '24', '0', 1, '4.不得在托运货物内夹带危险物品、禁运物品,否则一切损失由托运人负责。5、本单有效期三十天。')
//正文第八行
strCmd += blesdk.addCPCLText('485', 1290, '24', '0', 1, '北京服务热线:010-87205100')
strCmd += blesdk.addCPCLLine(475, 700, 510, 700, 2);
strCmd += blesdk.addCPCLText('485', 690, '24', '0', 1, '沧州:0317-2178206')
//左一竖线
strCmd += blesdk.addCPCLLine(80, 1500, 510, 1500, 2);
//左二竖线
strCmd += blesdk.addCPCLLine(80, 1300, 510, 1300, 2);
//右一竖线
strCmd += blesdk.addCPCLLine(80, 80, 510, 80, 2);
//第一条横线
strCmd += blesdk.addCPCLLine(80, 1500, 80, 80, 2);
//第二条横线
strCmd += blesdk.addCPCLLine(125, 1300, 125, 80, 2);
//第三条横线
strCmd += blesdk.addCPCLLine(170, 1300, 170, 80, 2);
//第四条横线
strCmd += blesdk.addCPCLLine(215, 1300, 215, 80, 2);
//第五条横线
strCmd += blesdk.addCPCLLine(260, 1300, 260, 80, 2);
//第六条横线
strCmd += blesdk.addCPCLLine(305, 1300, 305, 80, 2);
//第七条横线
strCmd += blesdk.addCPCLLine(350, 1300, 350, 80, 2);
//第八条横线
strCmd += blesdk.addCPCLLine(475, 1300, 475, 80, 2);
//第九条横线
strCmd += blesdk.addCPCLLine(520, 1500, 520, 80, 2);
// strCmd += blesdk.addCPCLLine(50, 1500, 250, 100, 2);
/*
strCmd += blesdk.addCPCLLine(10,140,570,140,2) //画线
strCmd += blesdk.addCPCLLine(382,140,382,316,2) //画线
strCmd += blesdk.addCPCLSETMAG(2, 2)
strCmd += blesdk.addCPCLText('20', 160, '24', '0', 0, '到站:'+ arrivalStationName)
strCmd += blesdk.addCPCLLine(10,220,382,220,2) //画线
strCmd += blesdk.addCPCLText('20', 248, '24', '0', 0, '收:'+receiverName)
strCmd += blesdk.addCPCLLine(10,316,570,316,2) //画线
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('20', 336, '24', '0', 0, '共'+ this.itemData.count + '件')
strCmd += blesdk.addCPCLText('112', 336, '24', '0', 0, '自提')
strCmd += blesdk.addCPCLLine(170,316,170,450,2) //画线
strCmd += blesdk.addCPCLText('186', 336, '24', '0', 0, '单号:'+ orderNumber + '-' +i)
strCmd += blesdk.addCPCLLine(10,376,570,376,2) //画线
strCmd += blesdk.addCPCLText('20', 396, '24', '0', 0, this.itemData.receiverMobile == 'undefined' || this.itemData.receiverMobile == null ? '' : this.itemData.receiverMobile)
strCmd += blesdk.addCPCLText('186', 396, '24', '0', 0, '备注:'+this.itemData.remark)
strCmd += blesdk.addCPCLQRCode(400, 150 , 'H', '1', 4, orderNumber) //二维码 */
strCmd += blesdk.addCPCLPrint();
that.bufferDataList.push(strCmd);
}
//小标签单
for(let i=1;i<=count;i++){
let strCmd = blesdk.CreatCPCLPage(600, 480, 1, 0,0);
strCmd += blesdk.addCPCLBox(10,10,570,450,3) //画框
strCmd += blesdk.addCPCLLocation(2);
strCmd += blesdk.addCPCLSETMAG(2, 2)
strCmd += blesdk.addCPCLText('0', 20, '24', '0', 0, this.itemData.companyName)
strCmd += blesdk.addCPCLLine(10,80,570,80,2) //画线
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('20', 100, '24', '0', 0, '开票日期:'+ createTime)
strCmd += blesdk.addCPCLLine(10,140,570,140,2) //画线
strCmd += blesdk.addCPCLLine(382,140,382,316,2) //画线
strCmd += blesdk.addCPCLSETMAG(2, 2)
strCmd += blesdk.addCPCLText('20', 160, '24', '0', 0, '到站:'+ arrivalStationName)
strCmd += blesdk.addCPCLLine(10,220,382,220,2) //画线
strCmd += blesdk.addCPCLText('20', 248, '24', '0', 0, '收:'+receiverName)
strCmd += blesdk.addCPCLLine(10,316,570,316,2) //画线
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('20', 336, '24', '0', 0, '共'+ this.itemData.count + '件')
strCmd += blesdk.addCPCLText('112', 336, '24', '0', 0, '自提')
strCmd += blesdk.addCPCLLine(170,316,170,450,2) //画线
strCmd += blesdk.addCPCLText('186', 336, '24', '0', 0, '单号:'+ orderNumber + '-' +i)
strCmd += blesdk.addCPCLLine(10,376,570,376,2) //画线
strCmd += blesdk.addCPCLText('20', 396, '24', '0', 0, this.itemData.receiverMobile == 'undefined' || this.itemData.receiverMobile == null ? '' : this.itemData.receiverMobile)
strCmd += blesdk.addCPCLText('186', 396, '24', '0', 0, '备注:'+this.itemData.remark)
strCmd += blesdk.addCPCLQRCode(400, 150 , 'H', '1', 4, orderNumber) //二维码
strCmd += blesdk.addCPCLPrint();
that.bufferDataSmall.push(strCmd);
}
//物流单
let strCmd1 = ''
if(uni.getStorageSync('zhiType') == 1){
strCmd1 = blesdk.CreatCPCLPage(600, 1800, 1, 0,0);
strCmd1 += blesdk.addCPCLSETMAG(2, 2)
strCmd1 += blesdk.addCPCLLocation(2);
strCmd1 += blesdk.addCPCLText('30', '30', '24', '0', '0', this.getPrintByte(this.itemData.companyName))
strCmd1 += blesdk.addCPCLSETMAG(1, 1)
strCmd1 += blesdk.addCPCLLocation(0);
let orderNum = that.itemData.orderNumber
if(uni.getStorageSync('transCompany') == '1899370468356526080' || uni.getStorageSync('transCompany') == '1782981706819702784'){
orderNum = that.itemData.orderNumber.split('-')[1] + that.itemData.orderNumber.split('-')[2].replace('-', '');
}
strCmd1 += blesdk.addCPCLSETMAG(2, 2)
strCmd1 += blesdk.addCPCLText('30', '150', '24', '0', '0', ('单号:'+this.getPrintByte(orderNum)))
strCmd1 += blesdk.addCPCLSETMAG(1, 1)
strCmd1 += blesdk.addCPCLText('30', '210', '24', '0', '0', that.timestampToDatetime())
strCmd1 += blesdk.addCPCLLine(25,270,1080,270,2) //画线
strCmd1 += blesdk.addCPCLText('30', '290', '24', '0', '0', ('始发站:' + this.getPrintByte(that.itemData.goStationName)))
strCmd1 += blesdk.addCPCLText('300', '290', '24', '0', '0', ('到达站:' + this.getPrintByte(that.itemData.arrivalStationName)))
strCmd1 += blesdk.addCPCLSETMAG(2, 2)
strCmd1 += blesdk.addCPCLText('30', '340', '24', '0', '0', ('收:'+ this.getPrintByte(that.itemData.receiverName)))
strCmd1 += blesdk.addCPCLSETMAG(1, 2)
strCmd1 += blesdk.addCPCLText('300', '340', '24', '0', '0', (' '+ this.getPrintByte(that.itemData.receiverMobile)))
strCmd1 += blesdk.addCPCLSETMAG(1, 1)
strCmd1 += blesdk.addCPCLText('30', '410', '24', '0', '0', ('地址:'+ this.getPrintByte(that.itemData.receiverAddress)))
strCmd1 += blesdk.addCPCLLine(25,470,1080,470,2) //画线
strCmd1 += blesdk.addCPCLText('30', '490', '24', '0', '0', ('发货人:'+ this.getPrintByte(that.itemData.shipperName)))
strCmd1 += blesdk.addCPCLText('300', '490', '24', '0', '0', ('电话:' + this.getPrintByte(that.itemData.shipperMobile)))
strCmd1 += blesdk.addCPCLLine(25,550,1080,550,2) //画线
strCmd1 += blesdk.addCPCLText('30', '570', '24', '0', '0', ('重量:' + that.getPrintByte(that.itemData
.weight) + 'kg'))
strCmd1 += blesdk.addCPCLText('300', '570', '24', '0', '0', ('件数:' + that.getPrintByte(that.itemData
.count)))
strCmd1 += blesdk.addCPCLText('30', '630', '24', '0', '0', ('运费:' + that.getPrintByte(that.itemData
.freight) + '元'))
strCmd1 += blesdk.addCPCLSETMAG(2, 2)
strCmd1 += blesdk.addCPCLText('300', '620', '24', '0', '0', ('物品:' + that.getPrintByte(that.itemData
.objectName)))
strCmd1 += blesdk.addCPCLSETMAG(1, 1)
strCmd1 += blesdk.addCPCLText('30', '690', '24', '0', '0', ('小费:' + that.getPrintByte(that.itemData
.tips) + '元'))
let jiesuan = ''
if (that.getPrintByte(that.itemData.methodOfSettlement) == '0') {
jiesuan = '现付'
} else if (that.getPrintByte(that.itemData.methodOfSettlement) == '1') {
jiesuan = '月付'
} else if (that.getPrintByte(that.itemData.methodOfSettlement) == '2') {
jiesuan = '提付'
}
strCmd1 += blesdk.addCPCLText('300', '690', '24', '0', '0', ('结算:' + jiesuan))
strCmd1 += blesdk.addCPCLText('30', '750', '24', '0', '0', ('中转费:' + that.getPrintByte(that.itemData
.transitFee) + '元'))
strCmd1 += blesdk.addCPCLText('300', '750', '24', '0', '0', ('落地费:' + that.getPrintByte(that.itemData
.landingFee) + '元'))
strCmd1 += blesdk.addCPCLText('30', '810', '24', '0', '0', ('送货费:' + that.getPrintByte(that.itemData
.deliveryFee) + '元'))
strCmd1 += blesdk.addCPCLText('300', '810', '24', '0', '0', ('保费:' + that.getPrintByte(that.itemData
.premium) + '元'))
strCmd1 += blesdk.addCPCLSETMAG(2, 2)
strCmd1 += blesdk.addCPCLText('30', '860', '24', '0', '0', ('总费用:' + that.getPrintByte(that.itemData
.allCost) + '元'))
strCmd1 += blesdk.addCPCLLine(25,920,1080,920,2) //画线
strCmd1 += blesdk.addCPCLSETMAG(1, 1)
strCmd1 += blesdk.addCPCLText('30', '940', '24', '0', '0', ('备注:'+this.getPrintByte(that.itemData.remark)))
strCmd1 += blesdk.addCPCLText('30' , '1000', '24', '0', '0', '收货人签字:')
strCmd1 += blesdk.addCPCLLine(25,1060,1080,1060,2) //画线
this.yNum = 1060
strCmd1 += blesdk.addCPCLSETMAG(1, 1)
//店铺备注
if (this.shopRemark.length > 0) {
for (let i = 0; i < this.shopRemark.length; i++) {
strCmd1 += blesdk.addCPCLText('30', this.countPrint(), '24', '0', 0, this.shopRemark[i])
}
}
// strCmd1 = blesdk.CreatCPCLPage(600, 1800, 1, 0,0);
// strCmd1 += blesdk.addCPCLSETMAG(2, 2)
// strCmd1 += blesdk.addCPCLLocation(2);
// strCmd1 += blesdk.addCPCLText('30', '30', '24', '0', '0', this.getPrintByte(this.itemData.companyName))
// strCmd1 += blesdk.addCPCLSETMAG(1, 1)
// strCmd1 += blesdk.addCPCLLocation(0);
// let orderNum = this.itemData.orderNumber
// if(uni.getStorageSync('transCompany') == '1899370468356526080' || uni.getStorageSync('transCompany') == '1782981706819702784'){
// orderNum = this.itemData.orderNumber.split('-')[1] + this.itemData.orderNumber.split('-')[2].replace('-', '');
// }
// strCmd1 += blesdk.addCPCLSETMAG(2, 2)
// strCmd1 += blesdk.addCPCLText('30', '150', '24', '0', '0', ('单号:'+this.getPrintByte(orderNum)))
// strCmd1 += blesdk.addCPCLSETMAG(1, 1)
// strCmd1 += blesdk.addCPCLText('30', '210', '24', '0', '0', this.getPrintByte(this.itemData.createTime))
// strCmd1 += blesdk.addCPCLLine(25,270,1080,270,2) //画线
// strCmd1 += blesdk.addCPCLText('30', '290', '24', '0', '0', ('始发站:' + this.getPrintByte(this.itemData.goStationName)))
// strCmd1 += blesdk.addCPCLText('30', '350', '24', '0', '0', ('到达站:' + this.getPrintByte(this.itemData.arrivalStationName)))
// strCmd1 += blesdk.addCPCLSETMAG(2, 2)
// strCmd1 += blesdk.addCPCLText('30', '400', '24', '0', '0', ('收:'+ this.getPrintByte(this.itemData.receiverName)))
// strCmd1 += blesdk.addCPCLSETMAG(1, 2)
// strCmd1 += blesdk.addCPCLText('300', '400', '24', '0', '0', (" " +this.getPrintByte(this.itemData.receiverMobile)))
// strCmd1 += blesdk.addCPCLSETMAG(1, 1)
// strCmd1 += blesdk.addCPCLText('30', '470', '24', '0', '0', ('地址:'+ this.getPrintByte(this.itemData.receiverAddress)))
// strCmd1 += blesdk.addCPCLLine(25,530,1080,530,2) //画线
// strCmd1 += blesdk.addCPCLText('30', '550', '24', '0', '0', ('发:'+ this.getPrintByte(this.itemData.shipperName)))
// strCmd1 += blesdk.addCPCLText('300', '550', '24', '0', '0', ('电话:' + this.getPrintByte(this.itemData.shipperMobile)))
// strCmd1 += blesdk.addCPCLLine(25,610,1080,610,2) //画线
// strCmd1 += blesdk.addCPCLText('30', '630', '24', '0', '0', ('重量:' + that.getPrintByte(that.itemData
// .weight) + 'kg'))
// strCmd1 += blesdk.addCPCLText('300', '630', '24', '0', '0', ('件数:' + that.getPrintByte(that.itemData
// .count)))
// strCmd1 += blesdk.addCPCLText('30', '690', '24', '0', '0', ('运费:' + that.getPrintByte(that.itemData
// .freight)+'元'))
// strCmd1 += blesdk.addCPCLSETMAG(2, 2)
// strCmd1 += blesdk.addCPCLText('300', '680', '24', '0', '0', ('物品:' + that.getPrintByte(that.itemData
// .objectName)))
// strCmd1 += blesdk.addCPCLSETMAG(1, 1)
// strCmd1 += blesdk.addCPCLText('30', '750', '24', '0', '0', ('小费:' + that.getPrintByte(that.itemData
// .tips)+'元'))
// let jiesuan = ''
// if (that.getPrintByte(that.itemData.methodOfSettlement) == '0') {
// jiesuan = '现付'
// } else if (that.getPrintByte(that.itemData.methodOfSettlement) == '1') {
// jiesuan = '月付'
// } else if (that.getPrintByte(that.itemData.methodOfSettlement) == '2') {
// jiesuan = '提付'
// }
// strCmd1 += blesdk.addCPCLText('300', '750', '24', '0', '0', ('结算:' + jiesuan))
// strCmd1 += blesdk.addCPCLText('30', '810', '24', '0', '0', ('中转费:' + that.getPrintByte(that.itemData
// .transitFee)+'元'))
// strCmd1 += blesdk.addCPCLText('300', '810', '24', '0', '0', ('落地费:' + that.getPrintByte(that.itemData
// .landingFee)+'元'))
// strCmd1 += blesdk.addCPCLText('30', '870', '24', '0', '0', ('送货费:' + that.getPrintByte(that.itemData
// .deliveryFee)+'元'))
// strCmd1 += blesdk.addCPCLText('300', '870', '24', '0', '0', ('保费:' + that.getPrintByte(that.itemData
// .premium)+'元'))
// strCmd1 += blesdk.addCPCLLine(25,930,1080,930,2) //画线
// strCmd1 += blesdk.addCPCLText('30', '950', '24', '0', '0', ('备注:'+this.getPrintByte(this.itemData.remark)))
// strCmd1 += blesdk.addCPCLText('30' , '1010', '24', '0', '0', '收货人签字:')
// strCmd1 += blesdk.addCPCLLine(25,1070,1080,1070,2) //画线
// this.yNum = 1070
// strCmd1 += blesdk.addCPCLSETMAG(1, 1)
// //店铺备注
// if (this.shopRemark.length > 0) {
// for (let i = 0; i < this.shopRemark.length; i++) {
// strCmd1 += blesdk.addCPCLText('30', this.countPrint(), '24', '0', 0, this.shopRemark[i])
// }
// }
}else{
strCmd1 = blesdk.CreatCPCLPage(600, 480, 1, 0,0);
strCmd1 += blesdk.addCPCLBox(10,10,570,450,3)
strCmd1 += blesdk.addCPCLSETMAG(2, 2)
strCmd1 += blesdk.addCPCLSETBOLD('2')
strCmd1 += blesdk.addCPCLLocation(0);
strCmd1 += blesdk.addCPCLText('30', '30', '24', '0', '0', this.getPrintByte(this.itemData.companyName))
strCmd1 += blesdk.addCPCLSETMAG(1, 1)
strCmd1 += blesdk.addCPCLSETBOLD('2')
strCmd1 += blesdk.addCPCLText('300', '30', '24', '0', '0', ('单号:'+this.getPrintByte(this.itemData.orderNumber)))
strCmd1 += blesdk.addCPCLSETBOLD('2')
strCmd1 += blesdk.addCPCLBox(25,50,555,50,2) //画框
strCmd1 += blesdk.addCPCLText('30', '90', '24', '0', '0', ('收货人:'+ this.getPrintByte(this.itemData.receiverName)))
strCmd1 += blesdk.addCPCLText('300', '90', '24', '0', '0', ('到达站:' + this.getPrintByte(this.itemData.arrivalStationName)))
strCmd1 += blesdk.addCPCLText('30', '140', '24', '0', '0', ('地址:'+ this.getPrintByte(this.itemData.receiverAddress)))
strCmd1 += blesdk.addCPCLText('300', '140', '24', '0', '0', ('电话:'+ this.getPrintByte(this.itemData.receiverMobile)))
strCmd1 += blesdk.addCPCLLine(25,180,555,180,2) //画线
strCmd1 += blesdk.addCPCLText('30', '190', '24', '0', '0', ('发货人:'+ this.getPrintByte(this.itemData.shipperName)))
strCmd1 += blesdk.addCPCLText('300', '190', '24', '0', '0', ('电话:' + this.getPrintByte(this.itemData.shipperMobile)))
strCmd1 += blesdk.addCPCLLine(25,240,555,240,2) //画线
// strCmd1 += blesdk.addCPCLText('30', '250', '24', '0', '0', ('重量:'+this.getPrintByte(this.itemData.weight)))
// strCmd1 += blesdk.addCPCLText('300', '250', '24', '0', '0', ('件数:'+this.getPrintByte(this.itemData.count)+'件'))
// let jiesuan = ''
// if(this.getPrintByte(this.itemData.methodOfSettlement) == '0'){
// jiesuan = '现金'
// }else if(this.getPrintByte(this.itemData.methodOfSettlement) == '1'){
// jiesuan = '月付'
// }else if(this.getPrintByte(this.itemData.methodOfSettlement) == '2'){
// jiesuan = '提付'
// }
// strCmd1 += blesdk.addCPCLText('30', '290', '24', '0', '0', ('结算方式:'+jiesuan))
if(uni.getStorageSync('transCompany') != '1751796589518786560' && uni.getStorageSync('transCompany') != '1899371352842964992' && uni.getStorageSync('transCompany') != '1782981706819702784'){
strCmd1 += blesdk.addCPCLText('30', '250', '24', '0', '0', ('重量:' + that.getPrintByte(that.itemData
.weight)))
strCmd1 += blesdk.addCPCLText('300', '250', '24', '0', '0', ('件数:' + that.getPrintByte(that.itemData
.count) + '件'))
let jiesuan = ''
if (that.getPrintByte(that.itemData.methodOfSettlement) == '0') {
jiesuan = '现金'
} else if (that.getPrintByte(that.itemData.methodOfSettlement) == '1') {
jiesuan = '月付'
} else if (that.getPrintByte(that.itemData.methodOfSettlement) == '2') {
jiesuan = '提付'
}
strCmd1 += blesdk.addCPCLText('30', '290', '24', '0', '0', ('结算方式:' + jiesuan))
}else{
let beginWidth = 0
let beginNum = 0
if(that.itemData.weight != 0){
if(beginNum == 0){
beginWidth = 30
}else{
beginWidth += 130
}
strCmd1 += blesdk.addCPCLText(beginWidth.toString(), '250', '24', '0', '0', ('重量:' + that.getPrintByte(that.itemData
.weight)))
beginNum = 1
}
if(that.itemData.count != 0){
if(beginNum == 0){
beginWidth = 30
}else{
beginWidth += 130
}
strCmd1 += blesdk.addCPCLText(beginWidth.toString(), '250', '24', '0', '0', ('件数:' + that.getPrintByte(that.itemData
.count)))
beginNum = 1
}
if(that.itemData.freight != 0){
if(beginNum == 0){
beginWidth = 30
}else{
beginWidth += 130
}
strCmd1 += blesdk.addCPCLText(beginWidth.toString(), '250', '24', '0', '0', ('运费:' + that.getPrintByte(that.itemData
.freight)))
beginNum = 1
}
if(that.itemData.tips != 0 && uni.getStorageSync('transCompany') != '1751796589518786560'){
if(beginNum == 0){
beginWidth = 30
}else{
beginWidth += 130
}
strCmd1 += blesdk.addCPCLText(beginWidth.toString(), '250', '24', '0', '0', ('小费:' + that.getPrintByte(that.itemData
.tips)))
beginNum = 1
}
beginWidth = 0
beginNum = 0
let jiesuan = ''
if (that.getPrintByte(that.itemData.methodOfSettlement) == '0') {
jiesuan = '现金'
} else if (that.getPrintByte(that.itemData.methodOfSettlement) == '1') {
jiesuan = '月付'
} else if (that.getPrintByte(that.itemData.methodOfSettlement) == '2') {
jiesuan = '提付'
}
strCmd1 += blesdk.addCPCLText('30', '290', '24', '0', '0', ('结算:' + jiesuan))
if(that.itemData.transitFee != 0){
if(beginNum == 0){
beginWidth = 160
}else{
beginWidth += 130
}
strCmd1 += blesdk.addCPCLText(beginWidth.toString(), '290', '24', '0', '0', ('中转费:' + that.getPrintByte(that.itemData
.transitFee)))
beginNum = 1
}
if(that.itemData.landingFee != 0){
if(beginNum == 0){
beginWidth = 160
}else{
beginWidth += 130
}
strCmd1 += blesdk.addCPCLText(beginWidth.toString(), '290', '24', '0', '0', ('落地费:' + that.getPrintByte(that.itemData
.landingFee)))
beginNum = 1
}
if(that.itemData.deliveryFee != 0){
if(beginNum == 0){
beginWidth = 160
}else{
beginWidth += 130
}
strCmd1 += blesdk.addCPCLText(beginWidth.toString(), '290', '24', '0', '0', ('送货费:' + that.getPrintByte(that.itemData
.deliveryFee)))
beginNum = 1
}
if(that.itemData.objectName != 0){
if(beginNum == 0){
beginWidth = 160
}else{
beginWidth += 130
}
strCmd1 += blesdk.addCPCLText(beginWidth.toString(), '290', '24', '0', '0', ('物品:' + that.getPrintByte(that.itemData
.objectName)))
beginNum = 1
}
}
strCmd1 += blesdk.addCPCLLine(25,330,555,330,2) //画线
strCmd1 += blesdk.addCPCLText('30', '340', '24', '0', '0', ('备注:'+this.getPrintByte(this.itemData.remark)))
strCmd1 += blesdk.addCPCLLine(25,400,555,400,2) //画线
strCmd1 += blesdk.addCPCLText('30' , '410', '24', '0', '0', ('操作人:'+this.getPrintByte(this.itemData.creatBy)))
strCmd1 += blesdk.addCPCLText('300', '410', '24', '0', '0', this.getPrintByte(this.itemData.createTime))
}
strCmd1 += blesdk.addCPCLPrint();
this.bufferDataBig.push(strCmd1);
this.getOrderChangeLog()
},
methods: {
countPrint(){
return this.yNum += 40
},
timestampToDatetime() {
const dateObj = new Date();
const year = dateObj.getFullYear();
const month = dateObj.getMonth() + 1;
const day = dateObj.getDate();
const hours = dateObj.getHours();
const minutes = dateObj.getMinutes();
const seconds = dateObj.getSeconds();
return year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds;
},
goPrint() {
this.bufferData = this.bufferDataBig
// this.xierushuju(this.bufferData)
this.$nextTick(() => {
setTimeout(res => {
this.bufferData = []
}, 1000)
uni.hideLoading();
})
},
goPrintList() {
this.bufferData = this.bufferDataList
// this.xierushuju(this.bufferData)
this.$nextTick(() => {
setTimeout(res => {
this.bufferData = []
}, 10000)
uni.hideLoading();
})
},
largeImg(img) {
uni.previewImage({
urls: [img]
});
},
getPrintByte(data){
if(data == undefined || data == null){
return ''
}else{
if(data == '冀J059DE' || data == '测试勿选'){
return '顺达快运'
}else{
return data
}
}
},
getOrderChangeLog(){
let that = this
uni.request({
url: this.tui.interfaceUrl() + '/app/logisticsOrder/getLogisticsOrderChangeLog?orderId='+this.itemData.id,
header: {
'content-type': 'application/json',
'appWLToken': this.tui.getToken()
},
method: 'GET', //'GET','POST'
dataType: 'json',
success: (res) => {
if(res.data.code == 401){
uni.clearStorage()
uni.navigateTo({
url: '/package2/login/login'
})
}
if(res.data.code == 200){
that.changeList = res.data.result
}
},
fail: (res) => {
this.tui.toast("网络不给力,请稍后再试~")
}
})
},
onPrintSmall1(){
let that = this
that.bufferData = that.bufferDataSmall
this.$nextTick(() => {
setTimeout(res => {
this.bufferData = []
}, 1000)
uni.hideLoading();
})
},
xierushuju() {
let that = this;
//写入数据
if (this.defaultText == '小标签') {
that.$emit('onPrintSmall1');
} else if (this.defaultText == '确认打印') {
that.$emit('goPrint');
} else {
that.$emit('onPrint');
}
that.$nextTick(() => {
var dataStr = ''
for (let m = 0; m < that.bufferData.length; m++) {
dataStr += that.bufferData[m]
}
const maxChunk = that.deviceType == 'android' ? 20 : 180;
const delay = that.deviceType == 'android' ? 20 : 180;
let buffer = gbk.strToGBKByte(dataStr)
for (let i = 0, j = 0, length = buffer.byteLength; i < length; i += maxChunk, j++) {
let subPackage = buffer.slice(i, i + maxChunk <= length ? (i + maxChunk) : length);
setTimeout(that._writeBLECharacteristicValue, j * delay, subPackage);
}
})
return;
},
_writeBLECharacteristicValue(buffer) {
let that = this;
wx.writeBLECharacteristicValue({
deviceId: uni.getStorageSync('deviceId'),
serviceId: uni.getStorageSync('serviceId'),
characteristicId: uni.getStorageSync('characteristicId'),
value: buffer,
success(res) {
},
fail(res) {
wx.closeBLEConnection({
deviceId: uni.getStorageSync('deviceId'),
success(res) {
}
})
if (uni.getStorageSync('deviceId')) {
that.xierushuju()
} else {
that.jiantingshebei()
}
}
})
uni.hideLoading();
}
},
}
</script>
<style lang="scss">
.container {
padding-bottom: 118rpx;
.boxbg {
background-color: #fff;
margin: 30upx;
padding: 20upx;
border-radius: 10upx;
box-shadow: 0px 1px 10px 2px #e2e2e2;
}
.tui-order-item {
.tui-goods-info {
width: 100%;
padding: 30rpx;
box-sizing: border-box;
background: #fff;
line-height: 26px;
.tui-price-flex {
display: flex;
justify-content: space-between;
}
.tui-size32 {
font-size: 32rpx;
font-weight: 500;
}
.tui-size-24 {
font-size: 24rpx;
}
.tui-price-large {
font-size: 32rpx;
}
.tui-flex-shrink {
flex-shrink: 0;
}
.tui-goods-price {
width: 100%;
display: flex;
align-items: flex-end;
justify-content: flex-end;
font-size: 24rpx;
}
.tui-primary-color {
color: #EB0909;
}
.tui-pbtm20 {
padding-bottom: 20rpx;
}
}
}
.tui-order-info {
margin-top: 20rpx;
}
}
.tui-order-title {
position: relative;
font-size: 28upx;
line-height: 28upx;
padding-left: 16upx;
box-sizing: border-box;
}
.uni-tooltip {
display: flex;
}
.tui-order-title::before {
content: '';
position: absolute;
left: 0;
top: 0;
border-left: 8upx solid $u-primary;
height: 120%;
border-radius: 4upx;
}
.tui-order-content {
width: 100%;
padding: 24rpx 30rpx;
box-sizing: border-box;
background: #fff;
font-size: 26rpx;
line-height: 60rpx;
border: 1px solid #eee;
border-radius: 10px;
}
.tui-order-flex {
display: flex;
padding-top: 18rpx;
}
.tui-order-flex:first-child {
padding-top: 0
}
.tui-item-title {
width: 132rpx;
flex-shrink: 0;
}
.tui-item-content {
color: #666;
line-height: 32rpx;
}
.tui-tabbar {
width: 100%;
height: 98rpx;
background: #fff;
position: fixed;
left: 0;
bottom: 0;
display: flex;
align-items: center;
justify-content: flex-end;
font-size: 26rpx;
box-shadow: 0 0 1px rgba(0, 0, 0, .3);
padding-bottom: env(safe-area-inset-bottom);
z-index: 99;
}
.tui-btn-mr {
width: 130rpx;
height: 60rpx;
background: #088FEB;
color: #fff;
border-radius: 10px;
line-height: 60rpx;
text-align: center;
margin-right: 30rpx;
}
.showImg-box {
width: 700rpx;
height: 1000rpx;
border-radius: 10px;
}
.swiper-box {
height: 1000rpx;
}
.swiper-item {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 1000rpx;
color: #fff;
background-color: #cee1fd;
border-radius: 10px;
}
</style>