平板端快衣店
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.
 
 
 
 
 

603 lines
18 KiB

<template>
<view class="container">
<view>
<uni-card :title="itemData.companyName" :sub-title="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>
</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="'小标签'"
@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:[],
bufferDataBig:[]
}
},
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 = ''
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, '13521030702')
strCmd += blesdk.addCPCLText('186', 396, '24', '0', 0, '备注:的点点滴滴')
strCmd += blesdk.addCPCLQRCode(400, 150 , 'H', '1', 4, orderNumber) //二维码
strCmd += blesdk.addCPCLPrint();
that.bufferDataSmall.push(strCmd);
}
let strCmd1 = ''
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))
// strCmd1 += blesdk.addCPCLText('300', '290', '24', '0', '0', ('总运费:'+this.getPrintByte(this.itemData.allCost)))
// strCmd1 += blesdk.addCPCLText('30', '330', '24', '0', '0', ('保费:'+this.getPrintByte(this.itemData.premium)))
// strCmd1 += blesdk.addCPCLText('300', '330', '24', '0', '0', ('小费:'+this.getPrintByte(this.itemData.tips)))
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: {
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(() => {
console.log(this.bufferData)
setTimeout(res => {
this.bufferData = []
}, 1000)
uni.hideLoading();
})
},
getPrintByte(data){
if(data == undefined || data == null){
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: '/pages/login/login'
})
}
if(res.data.code == 200){
that.changeList = res.data.result
console.log(that.changeList)
}
},
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;
align-items: center;
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>