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.
 
 
 
 
 

4260 lines
162 KiB

<template>
<view class="page1">
<view style="position: fixed;top: 0;z-index: 101;height: 50px;width: 100%;display: flex;background: #fff;">
<view style="display: flex;font-size: 15px;">
<view class="color-box">
下游待配货
<view class="color-piece" style="background:#E6E6FA;"></view>
</view>
<view class="color-box">
挂单
<view class="color-piece" style="background:#C1FFC1;"></view>
</view>
<view class="color-box">
作废
<view class="color-piece" style="background:#777;"></view>
</view>
<view class="color-box">
待库房配货
<view class="color-piece" style="background:#FFEC8B;"></view>
</view>
<view class="color-box">
库房配货完成
<view class="color-piece" style="background:#87CEFA;"></view>
</view>
</view>
<view class="top-btn" @tap="openPopup('')">
标签
</view>
<view class="top-btn" style="float: left;" @tap="clearSearch">
清空
</view>
<view class="top-btn" style="float: left;" @tap="getOrderInfoList('sreach')">
查询
</view>
<view class="top-btn" @tap="goKaiDan">
</view>
</view>
<view style="position: fixed;top: 50px;z-index: 101;width:100%;height: 70px;background: #fff;">
<view style="height: 60px;">
<view style="width: 450px;display: flex;line-height: 50px;float: left;">
<uni-datetime-picker style="margin-bottom:10px;" v-model="range" type="daterange" @change="searchList" />
</view>
<view style="width: 220px;display: flex;line-height: 50px;float: left;">
客户:<input @input="sreachName($event)" @focus="inputFocus($event)" type="text" v-model="customName" style="border:1px solid #eee;height: 50px;width: 150px;">
</view>
<view style="width: 285px;display: flex;line-height: 50px;float: left;">
状态:<!-- <input type="text" style="border:1px solid #eee;height: 50px;width: 150px;"> -->
<uni-data-select class="uni-data-select" :localdata="statusList" v-model="listStatus"
placeholder="订单状态">
</uni-data-select>
</view>
<view @tap="faBookShow = false" v-if="faBookShow" style="z-index:98;position: fixed;top: 0;left: 0;width: 100%;height: 100%;">
<view class="book-mask" v-if="faBookShow">
<view v-if="customList.length == 0"
style="color: #777;width: 100%;height: 50px;line-height: 50px;text-align: center;">
暂无匹配项
</view>
<view v-for="(item,index) in customList" :key="index" @tap="checkName(item)" v-else
style="height: 50px;line-height: 50px;">
{{item.name}}
</view>
</view>
</view>
</view>
</view>
<view class="table" style="margin-top: 120px;overflow: scroll;">
<view class="table-content">
<view class="table-th">
<view style="width: 50px;">操作</view>
<view style="width: 140px;">标签</view>
<view @tap.stop="changeSort" style="position: relative;">
日期
<uni-icons type="up" size="14" v-if="timeOrder == 1"
style="position: absolute;top: 0;right: 15px;"></uni-icons>
<uni-icons type="down" size="14" v-if="timeOrder == 0"
style="position: absolute;top: 0;right: 15px;"></uni-icons>
</view>
<view>客户</view>
<view style="width: 50px;">打印</view>
<view style="width: 100px;">打印次数</view>
<view style="width: 50px;">配货</view>
<view style="width: 100px;">销售数量</view>
<view>销售总额</view>
<view style="width: 100px;">退货数量</view>
<view>退货总额</view>
</view>
<view class="table-tr" v-for="(item,index) in inventoryList" :key="index" :style="{'background':item.status == '7'?'#C1FFC1':item.status == '2'?'#777':(item.status == '4' && item.distributionFlag == '0')?'#FFEC8B':(item.status == '4' && item.distributionFlag == '1')?'#87CEFA':item.status == '6'?'#E6E6FA':'#FFFFE0'}">
<view style="width: 50px;background: #fff;">
<uni-icons @tap.stop="changeShowBtn(index)" type="list" color="#777" size='30'></uni-icons>
<view v-if="item.isShowBtn" style="width: auto;height: 50px;background: #777;position: absolute;bottom: -52px;left: 20px;z-index: 99;border: 1px solid #eee;border-radius: 10px;padding-top: 5px;">
<view class="operate-btn" @tap.stop="isPrint(item.id,item.userId,index)" style="background:red;">
打印
</view>
<view v-if="item.status == '4'" class="operate-btn" @tap.stop="cancelOrder(item,'',index)" style="background:#088FEB;">
撤销
</view>
<view v-if="item.status == '4'" class="operate-btn" @tap.stop="cancelOrder(item,'goPay',index)" style="background:#FF9797;">
撤销并复制
</view>
<view v-if="item.status == '7'" class="operate-btn" @tap.stop="goGoods(item)" style="background:#60F3FF;">
去开单
</view>
<view class="operate-btn" @tap="goDetail(item.id,item.userId,index)" style="background:#6A5ACD;">
查看详情
</view>
<view class="operate-btn" v-if="item.status == 2" @tap.stop="againOrder(item)" style="background:#6A5ACD;">
重新开单
</view>
</view>
</view>
<view style="width: 140px;display: flex;background: #fff;">
<view @longpress="delOrderLable(index,index1)" @tap.stop="openPopup(index)" v-for="(item1,index1) in item.lableList" :key="index1" v-if="item.lableList && item.lableList.length>0"
style="width: 70px;height: 40px;font-size: 16px;">
<view :style="{'background':item1.lableColor}" style="border: none;width: 60px;height: 35px;padding: 0 5px;color: #fff;display: inline-block;text-align: center;line-height: 35px;margin: 2.5px 0 0 5px;border-radius: 40px;">{{item1.lableContent}}</view>
</view>
<view @tap.stop="openPopup(index)" v-if="item.lableList == null || item.lableList.length<=1" style="flex: 1;">
<uni-icons type="plusempty" size="30"></uni-icons>
</view>
</view>
<view style="overflow: hidden;" @tap.stop="showTime(item.createTime)">{{item.createTime | sliceTime}}</view>
<view>{{item.userName}}</view>
<view style="width: 50px;">{{item.printCount > 0?'是':'否'}}</view>
<view style="width: 100px;">{{item.printCount}}</view>
<view style="width: 50px;">{{(item.distributionFlag == '0' || item.distributionFlag == null) && item.status == '4'?'否':item.status != '4'?'-':item.distributionFlag == '1' && item.status == '4'?'是':'-'}}</view>
<view style="width: 100px;">{{item.productCount}}</view>
<view>{{item.totalAmount}}</view>
<view style="width: 100px;">{{item.returnSaleProductCount== 0?'':item.returnSaleProductCount}}</view>
<view>{{item.returnSaleTotalAmount == null?'':item.returnSaleTotalAmount}}</view>
</view>
<u-loadmore :status="status" />
</view>
</view>
<!-- 弹出标签选择 -->
<uni-popup ref="signPopup" background-color="#fff" @change="changeSignPopup" :is-mask-click="true">
<view class="sign-popup" style="margin-bottom: 0;">
<view style="height: 40px;font-size: 18px;font-weight: bold;line-height: 40px;text-align: center;">
更改标签
</view>
<view style="width: 95%;height: 315px;padding-bottom: 45px;margin: 20px auto 0;">
<view v-for="(item,index) in signList" :key="index" @longpress="isEditOrDel(item)" @tap="clickLable(index)"
style="height: 40px;margin: 20px 10px 0 0 ;display: inline-block;text-align: center;line-height: 40px;border-radius: 10px;" :style="{'background':item.lableColor}">
<view style="height: 40px;padding: 0 5px;color: #fff;position: relative;">
{{item.lableContent}}
<view v-if="item.checked" style="width: 30px;height: 30px;position: absolute;right: -13px;top: -18px;">
<uni-icons type="checkbox" color="green"></uni-icons>
</view>
</view>
</view>
</view>
<view style="position: absolute;bottom: 10px;left:5px;height: 50px;width: 95%;background: #fff;display: flex;padding: 0 5px;">
<view @tap="$refs.lablePopup.open()" :style="{'width':isAddLableBtn?'100%':'50%'}"
style="height: 50px;line-height: 50px;text-align: center;background: linear-gradient(90deg, #FF9797, #FFC1E0);color: #fff;margin: 0 auto;">
新增标签
</view>
<view v-if="isAddLableBtn == false" @tap="confirmLable()"
style="width: 50%;height: 50px;line-height: 50px;text-align: center;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;margin: 0 auto;">
确认
</view>
</view>
</view>
</uni-popup>
<!-- 删除标签弹窗 -->
<uni-popup ref="editLablePopup" background-color="#fff" :is-mask-click="true">
<view class="sign-popup" style="margin-bottom: 0;width: 350px;">
<view style="height: 40px;font-size: 18px;font-weight: bold;line-height: 40px;text-align: center;">
提醒
</view>
<view style="width: 95%;height: 150px;padding-bottom: 45px;margin: 20px auto 0;text-align: center;">
您要进行什么操作?
</view>
<view style="position: absolute;bottom: 10px;left:5px;height: 50px;width: 95%;background: #fff;display: flex;padding: 0 5px;">
<view @tap="delLable"
style="width: 50%;height: 50px;line-height: 50px;text-align: center;background: linear-gradient(90deg, #FF9797, #FFC1E0);color: #fff;margin: 0 auto;">
删除
</view>
<view @tap="editLable"
style="width: 50%;height: 50px;line-height: 50px;text-align: center;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;margin: 0 auto;">
编辑
</view>
</view>
</view>
</uni-popup>
<!-- 新增标签弹窗 -->
<uni-popup ref="lablePopup" background-color="#fff" @change="changeAddLable" :is-mask-click="true">
<view class="sign-popup" style="margin-bottom: 0;width: 500px;">
<view style="height: 80px;font-size: 26px;font-weight: bold;line-height: 80px;text-align: center;">
{{isEdit?'修改':'新增'}}标签
</view>
<view style="height: 315px;padding-bottom: 45px;margin: 20px auto 0;">
<view style="width: 95%;height: 40px;line-height: 40px;display: flex;">
<view style="width: 30%;text-align: center">
标签内容:
</view>
<input maxlength='2' type="text" v-model="lableText" placeholder="请输入标签内容" style="height: 40px;border: 1px solid #dcdcdc;padding-left: 20px;width: 70%;" />
</view>
<view style="width: 95%;display: flex;">
<view style="width: 30%;text-align: center;padding-top: 20px;">
标签颜色:
</view>
<view style="width: 70%">
<view v-for="(item,index) in colorList" :key="index" @tap="clickNewLable(index)"
style="width: 50px;height: 40px;margin: 20px 30px 0 0 ;display: inline-block;text-align: center;line-height: 40px;border-radius: 10px;" :style="{'background':item.name,'border':(item.checked&&item.name == '#FF3030')?'3px solid yellow':(item.checked&&item.name != '#FF3030')?'3px solid red':'none'}">
</view>
</view>
</view>
</view>
<view style="position: absolute;bottom: 10px;height: 50px;width: 100%;background: #fff;z-index: 99;">
<view @tap="addLable"
style="width: 95%;height: 50px;line-height: 50px;text-align: center;background: linear-gradient(90deg, #60F3FF, #088FEB);border-radius: 10px;color: #fff;margin: 0 auto;">
确认新增
</view>
</view>
</view>
</uni-popup>
<!-- 打印提醒弹窗 -->
<uni-popup ref="printPopup" background-color="#fff" :is-mask-click="true">
<view style="width: 300px;margin-bottom: 0;border-radius: 10px;height: 200px;">
<view style="height: 50px;font-size: 21px;font-weight: bold;line-height: 50px;text-align: center;">
提示
</view>
<view style="font-size: 21px;line-height: 81px;text-align: center;padding: 0 27px 0;font-weight: bold;">
是否打印该订单?
</view>
<view style="width: 100%;height: 60px;line-height: 60px;text-align: center;border-radius: 0;background: linear-gradient(90deg, #60F3FF, #088FEB);color: #fff;display: flex;position: absolute;bottom: 0;">
<view style="width:50%;" @tap="$refs.printPopup.close()">取消</view>
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'打印小票'"
@onPrintSmall="onPrintSmall" style="width:50%;background: linear-gradient(90deg, #FF9797, #FFC1E0);"></kk-printer>
</view>
</view>
</uni-popup>
<uqrcode v-if="qrArr.length > 0" :hide='true' ref="uqrcode" size="160" sizeUnit="rpx" canvas-id="qrcode"
:value="QrUrl">
</uqrcode>
<view v-if="isShare == false && canvasshow == true">
<canvas canvas-id="myCanvas" :style="{height:myCanvasHeight,width:myCanvasWidth}"></canvas>
</view>
<view style="position: absolute;top: -1500px;z-index: -1;opacity: 0;">
<canvas canvas-id="myCanvas1" style="width: 1515px; height: 1210px;"></canvas>
</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';
export default {
data() {
return {
enDayShow:false,
textArr:['您还未关注快衣店服务号,暂无法接收充值及上新提醒,点击关注'],
FWHPic:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f2ba2080aaa54c618c2e47df4f220087.png',
defaultText: '贴包单',
radio1: 0,
isSelfOrder: false,
isshanglu: true,
isSizeHeng: false,
canvasshow: false,
bigImg: [],
shopId: uni.getStorageSync('shopId'),
shopName: '',
QrUrl: '', //二维码临时存放
newQRList: [], // 生成的二维码临时路径的数组
newQRList1: [], // 生成的二维码临时路径的数组
qrCodeImage: '',
swiperDotIndex: 0,
sex: [{
text: '是',
value: 0
}, {
text: '否',
value: 2
}],
orderByWorkerCandidates: [],
orderByWorker: '',
bufferData: [],
userType: uni.getStorageSync('type'),
show: false,
popupShow: false,
shopAddress: uni.getStorageSync('shopAddress'),
shopOwnerPhone: uni.getStorageSync('shopOwnerPhone'),
shopRemark1: uni.getStorageSync('shopRemark'),
sales: {},
dealingsRecord: {},
order: {},
list: [],
newData: [],
listHeng: [],
lettrList: ['XS', 'S', 'M', 'L', 'XL', '2XL', 'XXL', '3XL', 'XXXL', '4XL', 'XXXXL', '5XL', 'XXXXXL', '6XL',
'XXXXXXL', '7XL', 'XXXXXXXL'
],
isReturn: false,
orderByWorkerList: [],
inventoryList: [],
inventoryReturnList:[],
shopList: [],
returnList1: [],
editNoPrice: false,
newEarn: 0,
shopRemark: [],
fontsmailDcl: 0,
isgys: true,
printHeight: 0,
myCanvasHeight: '',
myCanvasWidth: '',
isReturnPrice: 1,
type: '',
orderXd: [],
collection: [],
returnPrice: 0,
shopMoblie: '',
smailSize: 0,
returnNum: 0,
lbgName: [],
returnAmount: 0,
smailDcl: 1,
shopData: [],
changeA: '',
sAmout: 0,
yNum: 150,
picOk: false,
printingMethod: '0',
printHeight1: 0,
printWidth1: 0,
printTotal: 1040,
deviceType: 'ios',
payType1: 1,
payTypeList: [{
value: 1,
text: "切换样式"
}, {
value: 1,
text: "展示图片"
}, {
value: 0,
text: "表格样式"
}, {
value: 2,
text: "尺码横排"
}],
qrArr: [],
isShare: false,
isDownKH: false,
userId: '',
customId: "",
needPushMsg: false,
mini_program_openid: '',
unionid: '',
official_account_openid: '',
zhengtizhekou:false,
addressArr: [],
jinjuPhone: '', //金桔家单独改成这个电话
modal_qr: false,
qrCodeUrl: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/8e305338798c4152a89e3351eaf6c84e.png', // 要生成的二维码值
timeOrder:0,
lableIndex:0,
signIndex:[],
isAddLableBtn:true,
orderIndex:'',
customName:'',
faBookShow: false,
lableText:'',
checkColor:'',
isEdit:false,
signList:[],
statusList: [{
value: 2,
text: "作废"
}, {
value: 6,
text: "待配货"
}, {
value: 7,
text: "挂单"
}, {
value: 4,
text: "已完成"
}, {
value: 0,
text: "库房未配货"
}, {
value: 1,
text: "库房配货完"
}],
colorList:[{
name:'green',
checked:false
},{
name:'blue',
checked:false
},{
name:'orange',
checked:false
},{
name:'#6A5ACD',
checked:false
},{
name:'#FFC1C1',
checked:false
},{
name:'#FF3030',
checked:false
},{
name:'#1E90FF',
checked:false
},{
name:'#9C9C9C',
checked:false
},{
name:'#008B8B',
checked:false
},{
name:'#1C1C1C',
checked:false
}],
range:[],
status: 'loadmore',
page: 1,
totalPages: 0,
customList: [],
listStatus:'',
isCancel:false,
returnList:new Map()
}
},
onReachBottom() {
if (this.page >= this.totalPages) return;
this.status = 'loading';
this.page = ++this.page;
this.getOrderInfoList();
},
components: {
kkPrinter
},
filters: {
sliceTime(val) {
var name = ''
if (typeof(val) == 'string') {
name = val.split(' ')[0];
}
return name;
}
},
onShow(){
// 初始化蓝牙模块
wx.openBluetoothAdapter({
mode: 'central'
})
if(uni.getStorageSync('noReload') == true){
uni.removeStorageSync('noReload')
}else{
this.inventoryList = []
this.page = 1
this.getOrderInfoList()
}
this.getLableList()
},
methods: {
changeSort(){
if (this.timeOrder == 0) {
this.timeOrder = 1
} else if (this.timeOrder == 1) {
this.timeOrder = 0
}
this.getOrderInfoList('sreach')
},
async goGoods(item){
var that = this;
if(item.aiNotRecognition != '' && item.aiNotRecognition != null){
uni.showModal({
title: "提示",
content: item.aiNotRecognition + '确认去开单吗?',
success: function(res) {
if (res.confirm) {
that.goSaleGoods(item)
}
}
})
}else if(item.aiNotRecognition == '' && item.saleDetailDTOList == null){
uni.showModal({
title: "提示",
content: '未识别到商品,确认去开单吗?',
success: function(res) {
if (res.confirm) {
that.goSaleGoods(item)
}
}
})
}else{
await this.getReturnOrder1(item.id)
uni.showModal({
title: "提示",
content: '确认去开单吗?',
success: function(res) {
if (res.confirm) {
that.goSaleGoods(item)
}
}
})
}
},
changeShowBtn(index){
if(this.lableIndex != index){
this.inventoryList[this.lableIndex].isShowBtn = false
this.lableIndex = index
}
if(this.inventoryList[index].isShowBtn == undefined || this.inventoryList[index].isShowBtn == false){
this.inventoryList[index].isShowBtn = true
}else{
this.inventoryList[index].isShowBtn = false
}
this.$forceUpdate()
},
showTime(time){
uni.showToast({
title: "订单时间:" + time,
icon: 'none'
})
},
isPrint(id,customId,index){
uni.showLoading({
title: '加载中...',
mask: true
})
this.inventoryList[index].isShowBtn = false
this.printId = id
this.printCustomId = customId
this.qrArr = []
this.getOrderInfo()
setTimeout(res => {
uni.hideLoading()
this.$refs.printPopup.open()
}, 500)
},
// 取消订单
async cancelOrder(item,type,index) {
let that = this;
await this.getReturnOrder1(item.id)
await this.tui.modal("提示", "您确定要撤销订单吗?", true, (res) => {
if (res) {
that.cancelOk(item,type,index)
}else{
that.returnList = new Map()
}
})
},
//带参数跳转到开单页
goSaleGoods(item,type) {
let dataList = []
if(!item.saleDetailDTOList){
item.saleDetailDTOList = []
}
this.returnList.forEach(function(value, key) {
item.saleDetailDTOList.push(value)
})
item.discount = item.discount==null?10:item.discount
if (item.saleDetailDTOList) {
for (let i = 0; i < item.saleDetailDTOList.length; i++) {
let obj = {}
let attrMap = new Map()
let newSaleDetailDTOList = []
let num = 0
for (let m = 0; m < item.saleDetailDTOList[i].stockLogList1.length; m++) {
if (attrMap.has(item.saleDetailDTOList[i].stockLogList1[m].attributeList) == true) {
let hasCount = attrMap.get(item.saleDetailDTOList[i].stockLogList1[m].attributeList)
newSaleDetailDTOList[hasCount].productCount = Number(newSaleDetailDTOList[hasCount]
.productCount) + Number(item.saleDetailDTOList[i].stockLogList1[m].productCount)
if(this.isCancel == true){
newSaleDetailDTOList[hasCount].stockCount = newSaleDetailDTOList[hasCount].stockCount + newSaleDetailDTOList[hasCount].productCount
}
} else {
item.saleDetailDTOList[i].stockLogList1[m].name = this.sliceMsg(item.saleDetailDTOList[i]
.stockLogList1[m].attributeList)
if(this.isCancel == true){
item.saleDetailDTOList[i].stockLogList1[m].stockCount = item.saleDetailDTOList[i].stockLogList1[m].stockCount + item.saleDetailDTOList[i].stockLogList1[m].productCount
}
newSaleDetailDTOList.push(item.saleDetailDTOList[i].stockLogList1[m])
attrMap.set(item.saleDetailDTOList[i].stockLogList1[m].attributeList, num)
num++
}
}
obj.saleDetailQueryDTO = newSaleDetailDTOList
obj.num = 0
obj.customerCategoryRule = item.saleDetailDTOList[i].customerCategoryRule != null ?JSON.parse(item.saleDetailDTOList[i].customerCategoryRule):null
obj.id = item.saleDetailDTOList[i].productId
obj.price = item.saleDetailDTOList[i].price
if(item.status == '6'){
obj.buyCount = item.saleDetailDTOList[i].buyCount
}else{
obj.buyCount = item.saleDetailDTOList[i].buyCount - 1
}
obj.lsprice = item.saleDetailDTOList[i].price
obj.categoryId = item.saleDetailDTOList[i].categoryId
obj.zPrice = item.saleDetailDTOList[i].discountAmount
obj.attrId = item.saleDetailDTOList[i].attrId
obj.discountAmount = item.saleDetailDTOList[i].discountAmount
obj.productName = item.saleDetailDTOList[i].productName
if(item.saleDetailDTOList[i].productPicture != null && item.saleDetailDTOList[i].productPicture != ''){
obj.productPicture = item.saleDetailDTOList[i].productPicture + '?time=' + new Date().getTime()
}else{
obj.productPicture = ""
}
obj.productSn = item.saleDetailDTOList[i].productSn
obj.wholesalePrice = item.saleDetailDTOList[i].wholesalePrice
obj.returnPrice = item.saleDetailDTOList[i].returnPrice
obj.saleId = item.id
obj.remark = item.remark
obj.xsyId = item.createBy
obj.createByName = item.createByName
if(type == 'cancel'){
obj.unitPrice = this.getUnitPrice(item,item.saleDetailDTOList[i])
}else{
obj.unitPrice = item.saleDetailDTOList[i].discountAmount
}
dataList.push(obj)
}
} else {
let obj = {}
obj.num = 0
obj.price = 0
obj.saleId = item.id
obj.remark = item.remark
obj.xsyId = item.createBy
obj.createByName = item.createByName
dataList.push(obj)
}
this.$nextTick(()=>{
this.tui.request("/app/debt/selectByUserId", "post", {
shopId:uni.getStorageSync('shopId'),
userId:item.userId
}, false, true).then((res) => {
if (res.code == 200) {
this.returnList = new Map()
res.result.noEarn = res.result.amountOwed
res.result.name = res.result.userName
res.result.id = item.userId
uni.setStorageSync('khName', JSON.stringify(res.result))
uni.setStorageSync('carList1', JSON.stringify(dataList))
if(type == 'cancel'){
uni.setStorageSync('discountAll', item.discount != null ?item.discount:10)
}
uni.setStorageSync('hangOrder', true)
uni.navigateTo({
url: '/package2/inventory/goodsList1HENG'
})
}
})
})
},
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + '/'
}
}
return name;
},
getUnitPrice(item,items){
if(item.discount != 10){
if(item.discount == null || item.discount == 0 || item.discount ==undefined){
return items.discountAmount
}else{
return ((items.discountAmount * 10000) / (item.discount * 100) / 10).toFixed(2)
}
}else if(items.discount!= 10){
if(items.discount == null || items.discount == 0 || items.discount ==undefined){
return items.discountAmount
}else{
return ((items.discountAmount * 10000) / (items.discount * 100) / 10).toFixed(2)
}
}else{
return items.discountAmount || items.wholesalePrice
}
},
// 取消订单
cancelOk(item,type,index) {
let that = this;
that.inventoryList[index].isShowBtn = false
that.tui.request('/app/sale/cancelSale', "POST", {
id:item.id
}, true, true).then((res1) => {
if (res1.code == 200) {
if (type == 'goPay') {
this.isCancel = true
that.goSaleGoods(item,'cancel')
} else {
that.inventoryList[index].status = "2"
that.$forceUpdate()
uni.showToast({
title: "撤销成功",
icon: 'none',
duration:1000
})
}
} else {
that.tui.toast(res.message)
}
}).catch((res1) => {})
},
//退款接口
async getReturnOrder1(id) {
let that = this;
await this.tui.request("/app/return/list", "post", {
remark: 3,
saleId: id
}, false, false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
if (res.result != '') {
res.result.forEach(item => {
this.tui.request("/app/return/get/" + item.id, "GET", null, false,false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
for(let i=0;i<res.result.saleDetailDTOList.length;i++){
res.result.saleDetailDTOList[i].returnPrice = res.result.saleDetailDTOList[i].discountAmount
res.result.saleDetailDTOList[i].stockLogList = new Map()
that.returnList.set(res.result.saleDetailDTOList[i].productId,res.result.saleDetailDTOList[i])
for(let m=0;m<res.result.saleDetailDTOList[i].stockLogList1.length;m++){
res.result.saleDetailDTOList[i].stockLogList1[m].productCount = 0-res.result.saleDetailDTOList[i].stockLogList1[m].productCount
that.returnList.get(res.result.saleDetailDTOList[i].productId).stockLogList.set(res.result.saleDetailDTOList[i].stockLogList1[m].attributeList,res.result.saleDetailDTOList[i].stockLogList1[m])
}
}
}
}).catch((res) => {})
})
}
} else {
this.tui.toast(res.message)
}
})
},
getOrderInfo(){
let that = this;
this.tui.request("/app/sale/get/" + this.printId, "GET", {
customerId: this.printCustomId
}, false, false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
if (res.result.sale.status == '2') {
this.tui.toast('该订单已撤销')
}
this.order = res.result.customer
this.sales = res.result.sale
if (res.result.sale.status == "7") {
this.isShare = true
}
if (res.result.dealingsRecord != null) {
this.dealingsRecord = res.result.dealingsRecord
}
if(res.result.sale.discount<10){ //判断订单是否有折扣,整体折扣和单品折扣,都变为true
this.zhengtizhekou = true
}
this.list = res.result.saleDetailDTOList
for (var i = 0; i < that.list.length; i++) {
if (that.list[i].realPrice != '' && that.list[i].discountAmount == null) {
that.list[i].discountAmount = that.list[i].realPrice
}
if(res.result.sale.discount < 10){
this.list[i].printDiscount = res.result.sale.discount
}else if(that.list[i].discount < 10){
this.zhengtizhekou = true
this.list[i].printDiscount = that.list[i].discount
}else{
this.list[i].printDiscount = ''
}
var isZiMu = false
var isNumber = false
var colorList = new Map()
var sizeNumList = []
let notNum = []
if (that.list[i].stockLogList1.length > 0) {
for (var m = 0; m < that.list[i].stockLogList1.length; m++) {
var attr = that.list[i].stockLogList1[m].attributeList
var newObj = JSON.parse(attr)
for (var as in newObj) {
if (as == '尺码' && that.isLetterOrDigit(newObj[as].replace(/码/g, '')) ==
'Letter') {
isZiMu = true
}
if (as == '尺码' && that.isLetterOrDigit(newObj[as].replace(/码/g, '')) ==
'Digit') {
isNumber = true
}
if (as == '尺码' && sizeNumList.indexOf(newObj[as].replace(/码/g, '')) ==
-1) {
if (as == '尺码' && that.isLetterOrDigit(newObj[as].replace(/码/g,
'')) == 'Digit') {
sizeNumList.push(newObj[as].replace(/码/g, ''))
} else {
if (notNum.indexOf(newObj[as].replace(/码/g, '')) == -1) {
notNum.push(newObj[as].replace(/码/g, ''))
}
}
}
if (as == '颜色') {
if (colorList.has(newObj[as])) {
colorList.get(newObj[as]).push(that.list[i].stockLogList1[m])
} else {
let listChild = []
listChild.push(that.list[i].stockLogList1[m])
colorList.set(newObj[as], listChild)
}
}
}
}
}
if (notNum.length > 0) {
sizeNumList = sizeNumList.concat(notNum)
}
var newStockList = []
if (isNumber) {
sizeNumList = sizeNumList.sort((a, b) => a - b);
colorList.forEach(function(value, key) {
for (var j = 0; j < sizeNumList.length; j++) {
for (var m = 0; m < value.length; m++) {
var newObj = JSON.parse(value[m].attributeList)
var size = ''
var color = ''
for (var as in newObj) {
if (as == '尺码') {
size = newObj[as].replace(/码/g, '')
}
}
if (size == sizeNumList[j]) {
newStockList.push(value[m])
value.splice(m, 1)
break
}
}
}
if (value.length > 0) {
newStockList = newStockList.concat(value)
}
})
that.list[i].stockLogList1 = newStockList
}
if (isZiMu) {
colorList.forEach(function(value, key) {
for (var j = 0; j < that.lettrList.length; j++) {
for (var m = 0; m < value.length; m++) {
var newObj = JSON.parse(value[m].attributeList)
var size = ''
var color = ''
for (var as in newObj) {
if (as == '尺码') {
size = newObj[as].replace(/码/g, '')
}
}
if (size == that.lettrList[j]) {
newStockList.push(value[m])
value.splice(m, 1)
break
}
}
}
if (value.length > 0) {
newStockList = newStockList.concat(value)
}
})
that.list[i].stockLogList1 = newStockList
}
for (var m = 0; m < this.list[i].stockLogList1.length; m++) {
if (this.list[i].productCount == null) {
this.list[i].productCount = this.list[i].stockLogList1[m].productCount
} else {
this.list[i].productCount += this.list[i].stockLogList1[m].productCount
}
let hasBuy = ''
if (this.list[i].stockLogList1[m].isPurchasedBefore == 0 || (this.list[i]
.stockLogList1[m].isPurchasedBefore == 1 && this.sales.userName == '散客'
)) {
hasBuy = '【销】'
}
if (this.list[i].stockLogList1[m].isPurchasedBefore == 1 && this.sales
.userName != '散客') {
hasBuy = '【补】'
}
let tableData = {
productSn: hasBuy + this.list[i].productSn,
productName: this.list[i].productName,
productCount: this.list[i].stockLogList1[m].productCount,
attributeList: this.list[i].stockLogList1[m].attributeList,
discountAmount: this.list[i].discountAmount
}
that.listHeng.push(tableData)
}
this.list[i].chengben = this.list[i].productCount * this.list[i].purchasePrice
}
this.newData = JSON.parse(JSON.stringify(this.list))
this.orderXd = res.result.orderXd
this.shopData = res.result.shop
this.splitTextIntoChunks(res.result.shop.shopAddress, 30)
this.getReturnOrder(this.printId)
this.analysisQrCode()
} else {
if (res.code == 500 && res.message == 'java.lang.NullPointerException') {
this.tui.toast('该订单已撤销,无法查看')
} else {
this.tui.toast(res.message)
}
}
}).catch((res) => {})
},
// 展示二维码
showQrcode() {
for (let i = 0; i < _this.$refs.qrcodePopup.length; i++) {
_this.$refs.qrcodePopup[i].crtQrCode()
}
},
senrPath() {
return new Promise(async (resolve, reject) => {
let that = this
uni.showLoading({
title: '生成中...'
})
const ctx = uni.createCanvasContext('myCanvas1', this);
//背景图
let imgA =
'https://jewel-shop.oss-cn-beijing.aliyuncs.com/38568f1580bc423698d2a499197a5b44.png';
uni.downloadFile({
url: imgA,
success: (res2) => {
if (res2.statusCode === 200) {
// // 绘制第一张图片
ctx.drawImage(res2.tempFilePath, 0, 0, 1515, 1210);
ctx.draw(true);
// 设置字体样式
ctx.font = 'bold 80px SimSun';
// 设置文字颜色
ctx.fillStyle = '#FF5809';
let beginHeight = 450
if (that.sales.productCount != null && that.sales.productCount !=
'') {
var textWidth = 350;
// 计算居中位置
beginHeight += 100
// 绘制文字
ctx.fillText('销售', textWidth, beginHeight);
ctx.draw(true)
// 设置字体样式
ctx.font = 'bold 60px SimSun';
// 设置文字颜色
ctx.fillStyle = '#FF5809';
beginHeight += 90
var text = '总件数:' + that.sales.productCount + ' 总金额:' +
that.sales.totalAmount
// 绘制文字
ctx.fillText(text, textWidth, beginHeight);
ctx.draw(true)
}
if (that.returnNum != null && that.returnNum != '') {
beginHeight += 110
var textWidth = 350;
// 绘制文字
// 设置字体样式
ctx.font = 'bold 80px SimSun';
// 设置文字颜色
ctx.fillStyle = '#FF5809';
ctx.fillText('退货', textWidth, beginHeight);
ctx.draw(true)
beginHeight += 90
// 设置字体样式
ctx.font = 'bold 60px SimSun';
// 设置文字颜色
ctx.fillStyle = '#FF5809';
var text = '总件数:' + that.returnNum + ' 总金额:' + that
.returnPrice
// 绘制文字
ctx.fillText(text, textWidth, beginHeight);
ctx.draw(true)
}
if (that.sales.realAmount != null) {
var textWidth = 350;
beginHeight += 120
// 绘制文字
// 设置字体样式
ctx.font = 'bold 80px SimSun';
// 设置文字颜色
ctx.fillStyle = 'black';
ctx.fillText('本单应收:' + that.sales.realAmount, textWidth,
beginHeight);
ctx.draw(true)
}
if (that.sales.alreadyEarn != null) {
beginHeight += 100
var textWidth = 350;
// 绘制文字
// 设置字体样式
ctx.font = 'bold 80px SimSun';
// 设置文字颜色
ctx.fillStyle = 'black';
ctx.fillText('本单实收:' + that.sales.alreadyEarn, textWidth,
beginHeight);
ctx.draw(true)
beginHeight += 120
}
setTimeout(ress => {
uni.canvasToTempFilePath({
x: 0,
y: 0,
width: 1515,
height: 1210,
destWidth: 1515,
destHeight: 1210,
canvasId: 'myCanvas1',
success: (res3) => {
uni.hideLoading()
return resolve(res3.tempFilePath)
}
});
}, 500)
}
}
});
})
},
returnRealSize(size) {
if (this.smailDcl >= 1) {
return Number((size / this.smailDcl).toFixed(2))
} else {
return size
}
},
returnFontSize(size) {
return Number((size / this.smailDcl).toFixed(0)) - 1
},
getData() {
let that = this
if (that.picOk) {
uni.showLoading({
title: '图片绘制中...'
})
} else {
this.tui.toast('账单生成中...')
return
}
let dataHeight = that.printHeight1
this.canvasshow = true
const ctx = uni.createCanvasContext('myCanvas', this);
ctx.fillStyle = "#FFFFFF"
ctx.fillRect(0, 0, that.printWidth1, dataHeight)
//店铺名
// 设置字体样式
ctx.font = 'bold ' + that.returnFontSize(150) + 'px SimSun';
// 设置文字颜色
ctx.fillStyle = 'black';
var text = this.shopName + ' 销售单';
var textWidth = ctx.measureText(text).width;
// 计算居中位置
var x = (that.printWidth1 - textWidth) / 2;
// 绘制文字
ctx.fillText(text, x, that.returnRealSize(300));
ctx.draw(true)
// 设置字体样式
ctx.font = 'bold ' + that.returnFontSize(60) + 'px SimSun';
// 设置文字颜色
ctx.fillStyle = 'black';
// 客户
ctx.fillText('客户:' + (((that.shopId == '1863043415453863936') &&
that.order.name == '散客') ? '客户' : that.order.name ? that.order.name : '散客'), that
.returnRealSize(20), that.returnRealSize(500))
ctx.fillText('单号:' + that.sales.id, that.returnRealSize(1450), that.returnRealSize(500))
// 销售员
ctx.fillText('销售员:' + that.sales.createByName, that.returnRealSize(20), that.returnRealSize(600))
ctx.fillText('日期:' + that.sales.createTime, that.returnRealSize(1450), that.returnRealSize(600))
// 横线
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), that.returnRealSize(700))
// 数据
if (this.printingMethod == '0' || this.printingMethod == '2') {
ctx.fillText('货号(名称)', that.returnRealSize(20), that.returnRealSize(800))
ctx.fillText('规格', that.returnRealSize(1040), that.returnRealSize(800))
ctx.fillText('数量', that.returnRealSize(1590), that.returnRealSize(800))
ctx.fillText('单价', that.returnRealSize(1875), that.returnRealSize(800))
ctx.fillText('总价', that.returnRealSize(2140), that.returnRealSize(800))
// 横线
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), that.returnRealSize(900))
}
let dataheigth = that.returnRealSize(700)
let dataheigth1 = that.returnRealSize(900)
let moretime = 0
let Xindex = 0
for (var i = 0; i < that.newData.length; i++) {
if (this.printingMethod == '1') {
moretime += 140
dataheigth += that.returnRealSize(100)
//货号
if (that.newData[i].productName == that.newData[i].productSn) {
ctx.fillText(that.newData[i].productSn, that.returnRealSize(20), dataheigth)
} else {
ctx.fillText(that.newData[i].productSn + '(' + (that.newData[i].productName == null ? '' : that
.newData[i].productName) + ')', that.returnRealSize(20), dataheigth)
}
dataheigth += that.returnRealSize(100)
//尺码头
ctx.fillText('颜色', that.returnRealSize(20), dataheigth)
let startWith = that.returnRealSize(450)
for (let a = 0; a < that.newData[i].sizeList.length; a++) {
if ((that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') && that
.newData[i].sizeList[a] == '均') {
that.newData[i].sizeList[a] = '分码'
}
ctx.fillText(that.newData[i].sizeList[a], startWith, dataheigth)
startWith += Math.floor(that.returnRealSize(1250) / 8)
}
ctx.fillText('数量', that.returnRealSize(1700), dataheigth)
ctx.fillText('单价', that.returnRealSize(1950), dataheigth)
ctx.fillText('总价', that.returnRealSize(2200), dataheigth)
let begin = 0
that.newData[i].sizePrintList.forEach(function(value, key) {
moretime += 70
dataheigth += that.returnRealSize(100)
if ((that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') &&
key == '均色') {
key = '分色'
}
ctx.fillText(key, that.returnRealSize(20), dataheigth)
let childStartWith = that.returnRealSize(450)
let allCount = 0
let discountAmount = 0
for (let a = 0; a < that.newData[i].sizeList.length; a++) {
let printSizeCount = []
if (that.newData[i].sizeList[a] == '分码') {
that.newData[i].sizeList[a] = '均'
}
if (value.has(that.newData[i].sizeList[a])) {
printSizeCount = value.get(that.newData[i].sizeList[a]).split(':')
discountAmount = printSizeCount[1] == undefined ? '' : printSizeCount[1]
}
allCount += printSizeCount[0] == undefined ? 0 : Number(printSizeCount[0])
that.newData[i].allCount = allCount
ctx.fillText(printSizeCount[0] == undefined ? '' : Number(printSizeCount[0]),
childStartWith, dataheigth)
childStartWith += Math.floor(that.returnRealSize(1250) / 8)
}
ctx.fillText(allCount, that.returnRealSize(1700), dataheigth)
ctx.fillText(discountAmount, that.returnRealSize(1950), dataheigth)
ctx.fillText((allCount * discountAmount), that.returnRealSize(2200), dataheigth)
})
// 横线
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), dataheigth += that.returnRealSize(100))
} else {
for (var m = 0; m < that.newData[i].stockLogList1.length; m++) {
moretime += 80
dataheigth1 += that.returnRealSize(100)
if (that.newData[i].stockLogList1[m].isReturn) {
if (that.newData[i].productName == that.newData[i].productSn) {
ctx.fillText((Xindex += 1) + '.' + '【退】' + that.newData[i].productSn, that
.returnRealSize(20), dataheigth1)
} else {
ctx.fillText((Xindex += 1) + '.' + '【退】' + that.newData[i].productSn + '(' + (that
.newData[i].productName == null ? '' : that.newData[i].productName) + ')',
that.returnRealSize(20), dataheigth1)
}
} else {
if (that.newData[i].productName == that.newData[i].productSn && that.order.name != '散客') {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1) { //买过
ctx.fillText((Xindex += 1) + '.' + '【补】' + that.newData[i].productSn, that
.returnRealSize(20), dataheigth1)
} else { // 0是没买过
ctx.fillText((Xindex += 1) + '.' + '【销】' + that.newData[i].productSn, that
.returnRealSize(20), dataheigth1)
}
} else {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order.name !=
'散客') { //买过
ctx.fillText((Xindex += 1) + '.' + '【补】' + that.newData[i].productSn + '(' + (that
.newData[i].productName == null ? '' : that.newData[i].productName) +
')', that.returnRealSize(20), dataheigth1)
} else { // 0是没买过
ctx.fillText((Xindex += 1) + '.' + '【销】' + that.newData[i].productSn + '(' + (that
.newData[i].productName == null ? '' : that.newData[i].productName) +
')', that.returnRealSize(20), dataheigth1)
}
}
}
if (that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') {
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均色') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均色/g, '分色')
}
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均码') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均码/g, '分码')
}
}
ctx.fillText(that.slicePrint(that.newData[i].stockLogList1[m].attributeList), that
.returnRealSize(1040), dataheigth1)
ctx.fillText(that.newData[i].stockLogList1[m].productCount, that.returnRealSize(1590),
dataheigth1)
if (that.newData[i].stockLogList1[m].isReturn) {
ctx.fillText(that.newData[i].stockLogList1[m].discountAmount, that.returnRealSize(1875),
dataheigth1)
ctx.fillText((that.newData[i].stockLogList1[m].discountAmount * that.newData[i]
.stockLogList1[m].productCount), that.returnRealSize(2140), dataheigth1)
} else {
ctx.fillText(that.newData[i].discountAmount, that.returnRealSize(1875), dataheigth1)
ctx.fillText((that.newData[i].discountAmount * that.newData[i].stockLogList1[m]
.productCount), that.returnRealSize(2140), dataheigth1)
}
// 横线
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), dataheigth1 += that.returnRealSize(100))
}
}
}
let lastHeight = 0
if (this.printingMethod == '1') {
lastHeight = dataheigth
} else {
lastHeight = dataheigth1
}
ctx.fillText('合计:', that.returnRealSize(20), lastHeight += that.returnRealSize(100))
ctx.fillText(that.sales.productCount + '件', that.returnRealSize(1700), lastHeight)
ctx.fillText(that.sales.totalAmount, that.returnRealSize(2200), lastHeight)
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), lastHeight += that.returnRealSize(100))
ctx.draw(true)
// 设置字体样式
ctx.font = 'bold ' + that.returnFontSize(70) + 'px SimSun';
// 设置文字颜色
ctx.fillStyle = 'black';
ctx.fillText('本单应收:' + that.sales.realAmount + '(' + this.convertToChineseNumeral(that.sales.realAmount) +
')', that.returnRealSize(20), lastHeight += that.returnRealSize(100))
if (that.dealingsRecord.lastDebtAmount >= 0) {
ctx.fillText('之前欠款:' + that.dealingsRecord.lastDebtAmount, that.returnRealSize(1700), lastHeight)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
ctx.fillText('之前余额:' + Math.abs(that.dealingsRecord.lastDebtAmount), that.returnRealSize(1700),
lastHeight)
} else {
ctx.fillText('之前欠款:0', that.returnRealSize(1700), lastHeight)
}
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), lastHeight += that.returnRealSize(100))
ctx.fillText('本单实收:' + that.sales.alreadyEarn + '(' + this.convertToChineseNumeral(that.sales
.alreadyEarn) + ')', that.returnRealSize(20), lastHeight += that.returnRealSize(100))
if (that.dealingsRecord.balanceDue >= 0) {
ctx.fillText('累计欠款:' + that.dealingsRecord.balanceDue, that.returnRealSize(1700), lastHeight)
} else if (that.dealingsRecord.balanceDue < 0) {
ctx.fillText('累计余额:' + Math.abs(that.dealingsRecord.balanceDue), that.returnRealSize(1700), lastHeight)
} else {
ctx.fillText('累计欠款:0', that.returnRealSize(1700), lastHeight)
}
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), lastHeight += that.returnRealSize(100))
ctx.draw(true)
// 设置字体样式
ctx.font = 'bold ' + that.returnFontSize(60) + 'px SimSun';
// 设置文字颜色
ctx.fillStyle = 'black';
if (that.sales.noEarn >= 0) {
ctx.fillText('本单欠款:' + (that.sales.noEarn), that.returnRealSize(20), lastHeight += that.returnRealSize(
100))
} else {
ctx.fillText('本单余额:' + Math.abs(that.sales.noEarn), that.returnRealSize(20), lastHeight += that
.returnRealSize(100))
}
if (that.returnPrice > 0) {
ctx.fillText('退货数量:' + that.returnNum, that.returnRealSize(900), lastHeight)
ctx.fillText('退货金额:' + that.returnPrice, that.returnRealSize(1700), lastHeight)
}
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), lastHeight += that.returnRealSize(100))
if (that.sales.remark) {
ctx.fillText('订单备注:' + that.sales.remark, that.returnRealSize(20), lastHeight += that.returnRealSize(
100))
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), lastHeight += that.returnRealSize(100))
}
ctx.fillText('店铺地址:' + this.addressArr, that.returnRealSize(20), lastHeight += that.returnRealSize(100))
if (this.shopId == '1820391948796694529' || this.shopId == '1848966744035692545' || this.shopId ==
'1850038419279974400') {
ctx.fillText('店铺电话:' + this.jinjuPhone, that.returnRealSize(20), lastHeight += that.returnRealSize(
100))
} else if (this.shopId == '1834512626093264897') {
ctx.fillText('店铺电话:13191998128', that.returnRealSize(20), lastHeight += that.returnRealSize(100))
} else {
ctx.fillText('店铺电话:' + (uni.getStorageSync('shopOwnerPhone') ? uni.getStorageSync('shopOwnerPhone') :
uni.getStorageSync('username')), that.returnRealSize(20), lastHeight += that
.returnRealSize(100))
}
if (this.sales.companyName != null) {
ctx.fillText('发货方式:' + this.sales.companyName + ' ' + this.sales.companyPhone, that.returnRealSize(20),
lastHeight += that.returnRealSize(100))
}
if (this.shopRemark.length > 0) {
for (let i = 0; i < this.shopRemark.length; i++) {
ctx.fillText(this.shopRemark[i], that.returnRealSize(20), lastHeight += that.returnRealSize(100))
}
}
ctx.fillText(
'-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------',
that.returnRealSize(20), lastHeight += that.returnRealSize(100))
ctx.draw(true)
let begineidth = that.returnRealSize(20)
let wenheight = lastHeight + that.returnRealSize(150)
lastHeight += that.returnRealSize(200)
for (let a = 0; a < that.qrArr.length; a++) {
setTimeout(ress => {
uni.downloadFile({
url: that.qrArr[a].imgUrl,
success: (res2) => {
if (res2.statusCode === 200) {
ctx.fillText(that.qrArr[a].name, begineidth, wenheight)
ctx.drawImage(res2.tempFilePath, begineidth, lastHeight, that
.returnRealSize(400), that.returnRealSize(400));
ctx.draw(true)
begineidth += that.returnRealSize(640)
}
}
});
}, 800 * (a + 1) + moretime)
}
setTimeout(ress => {
uni.canvasToTempFilePath({
x: 0,
y: 0,
width: this.printWidth1,
height: this.printHeight1,
destWidth: this.printWidth1,
destHeight: this.printHeight1,
canvasId: 'myCanvas',
success: (res3) => {
this.canvasshow = false
this.tempFilePath = res3.tempFilePath
uni.previewImage({
urls: [res3.tempFilePath]
})
uni.hideLoading()
}
});
}, 1000 * that.qrArr.length + moretime)
},
isLetterOrDigit(character) {
if (/[a-zA-Z]/.test(character)) {
return 'Letter';
} else if (/[0-9]/.test(character)) {
return 'Digit';
} else {
return 'Neither';
}
},
//传入组件的方法
hideQrcode() {
this.modal_qr = false;
},
//打印小票二维码,分割二维码字符串
analysisQrCode() {
let that = this;
that.tui.request("/app/shop/getShopInfoById", "post", {
id: this.shopId,
}, false, true).then((res) => {
if (res.code == 200) {
this.printingMethod = res.result.printingMethod == null ? '0' : res.result.printingMethod;
this.shopName = res.result.shopName;
this.shopRemark = res.result.remark.split('\n');
this.shopAddress = res.result.shopAddress
this.shopRemark1 = res.result.remark
this.jinjuPhone = res.result.contactPhone
let qrCode = res.result.shopIcon
if (qrCode != '') {
let data = qrCode.split(',')
for (let i = 0; i < data.length; i++) {
if (qrCode.indexOf('@_@') != -1) {
let obj = {
name: data[i].split('@_@')[0],
path: data[i].split('@_@')[1],
imgUrl: data[i].split('@_@')[2],
level: "M"
}
this.qrArr.push(obj)
} else {
var weixin = data[i].indexOf("微信");
var dianpu = data[i].indexOf("店铺");
var zifubao = data[i].indexOf("支付");
var yinlian = data[i].indexOf("收款");
var duizhang = data[i].indexOf("对账");
if (duizhang != -1) {
var result = data[i].substring(duizhang + 2);
let obj = {
name: '查看对账单',
path: result,
level: "M"
}
this.qrArr.push(obj)
}
if (dianpu != -1) {
var result = data[i].substring(dianpu + 2);
let obj = {
name: '店铺微信',
path: result,
level: "M"
}
this.qrArr.push(obj)
}
if (weixin != -1) {
var result = data[i].substring(weixin + 2);
let obj = {
name: '微信收款码',
path: result,
level: "M"
}
this.qrArr.push(obj)
}
if (zifubao != -1) {
var result = data[i].substring(zifubao + 2);
let obj = {
name: '支付宝收款码',
path: result,
level: "Q"
}
this.qrArr.push(obj)
}
if (yinlian != -1) {
var result = data[i].substring(yinlian + 2);
let obj = {
name: '银行收款码',
path: result,
level: "M"
}
this.qrArr.push(obj)
}
}
}
setTimeout(res => {
if (this.qrArr.length > 0) {
that.getQRCode();
}
}, 1000)
}
}
}).catch((res) => {})
},
goToInfo() {
let pages = getCurrentPages();
if (pages.length > 1) {
uni.navigateBack({
delta: 1
})
} else {
uni.reLaunch({
url: '/pages/index/home'
})
}
},
deleteOrder() {
var that = this;
uni.showModal({
title: "提示",
content: "确定删除此条挂单吗?",
success: function(res) {
if (res.confirm) {
that.tui.request("/app/sale/delById", "post", {
id: that.saleId,
}, false, true).then((res) => {
if (res.code == 200) {
setTimeout(res => {
uni.showToast({
title: "删除成功",
icon: 'none'
})
}, 1000)
uni.navigateBack();
} else {
uni.showToast({
title: "删除失败",
icon: 'none'
})
}
}).catch((res) => {})
}
}
})
},
getPrintHeight() {
let that = this;
this.printHeight = 960
this.printHeight1 = 1900
this.printWidth1 = 2500
if (this.printingMethod == '1') {
if (that.shopId == '1822829636942434305' || that.shopId ==
'1818888277105709056') {
for (let i = 0; i < that.newData.length; i++) {
this.printHeight1 += 300
this.printHeight += 100
this.printHeight += that.newData[i].sizePrintList.size * 90
this.printHeight1 += that.newData[i].sizePrintList.size * 100
}
} else {
for (let i = 0; i < that.newData.length; i++) {
this.printHeight1 += 300
this.printHeight += 90
this.printHeight += that.newData[i].sizePrintList.size * 40
this.printHeight1 += that.newData[i].sizePrintList.size * 100
}
}
} else {
this.printHeight1 += 200
for (let i = 0; i < that.newData.length; i++) {
this.printHeight += 40
for (let m = 0; m < that.newData[i].stockLogList1.length; m++) {
this.printHeight1 += 200
this.printHeight += 40
}
}
}
if (that.qrArr.length > 0) {
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){ //原创家二维码放大了
this.printHeight += 452
}else{
this.printHeight += 360
}
this.printHeight1 += 1000
}
if (that.shopRemark.length > 0) {
this.printHeight += that.shopRemark.length * 40
this.printHeight1 += that.shopRemark.length * 100
}
if (that.sales.remark) {
this.printHeight += 100
this.printHeight1 += 100
}
let smailBegin = 4000
if (that.deviceType == 'ios') {
smailBegin = 2500
}
this.smailDcl = Number(Number(this.printHeight1 / smailBegin).toFixed(2))
this.printHeight1 = smailBegin
this.myCanvasHeight = this.printHeight1 + 'px'
if (this.smailDcl >= 1) {
this.printWidth1 = Number(Number(this.printWidth1 / this.smailDcl).toFixed(0))
}
this.myCanvasWidth = this.printWidth1 + 'px'
setTimeout(res => {
that.picOk = true
}, 1000)
},
//生成二维码
getQRCode() {
let that = this
for (let i = 0; i < that.qrArr.length; i++) {
setTimeout(res1 => {
that.QrUrl = that.qrArr[i].path
let data = {
name: that.qrArr[i].name,
path: ""
}
setTimeout(res1 => {
this.$refs.uqrcode.toTempFilePath({
success: res => {
data.path = res.tempFilePath
that.newQRList1.push(data)
that.newQRList.push(data)
}
});
}, 500 * i)
}, 1000 * i)
}
},
splitTextIntoChunks(text, chunkSize) {
let result = [];
for (let i = 0; i < text.length; i += chunkSize) {
result.push(text.slice(i, i + chunkSize));
}
this.$nextTick(() => {
this.addressArr = result
})
},
sizeHengFn() {
this.isSizeHeng = !this.isSizeHeng
},
//打印小票
onPrintSmall() {
let that = this;
this.$refs.printPopup.close();
let strCmd = ''
let pageNum = 1
let Xindex = 0
if (this.printingMethod == '0') {
that.yNum = 405
} else {
that.yNum = 350
}
strCmd = blesdk.CreatCPCLPage(1080, this.printHeight >= (1990 * pageNum) ? 1990 : this.printHeight, 1, 0,
0);
strCmd += blesdk.addCPCLSETMAG(4, 4)
blesdk.addCPCLSETBOLD('bold')
strCmd += blesdk.addCPCLLocation(2);
strCmd += blesdk.addCPCLText('0', '120', '24', '0', 0, this.shopName)
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLLocation(0);
blesdk.addCPCLSETBOLD('bold')
if (this.shopId == '1865592366551928832' || this.shopId == '1818888277105709056') {
let orderPayType = this.sales.payType == null ? '暂无' : this.sales.payType == 0 ? '现金收款' : this.sales
.payType == 1 ? '微信收款' : this.sales.payType == 2 ? '支付宝收款' : this.sales.payType == 3 ? '银行卡转账' :
this.sales.payType == 4 ? '收款码收款' : ''
strCmd += blesdk.addCPCLText('500', '250', '24', '0', 0, '收款方式:' + orderPayType)
}
if (this.shopName == '杰娜世家' || this.shopName == '老早测试') {
strCmd += blesdk.addCPCLText('0', '250', '24', '0', 0, '客户地址:' + that.order.address)
}
strCmd += blesdk.addCPCLText('0', '300', '24', '0', 0, '客户:' + ((
this.shopId == '1863043415453863936' && that.order.name == '散客') ? '客户' : that.order
.name ? that.order.name : '散客'))
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('500', '300', '24', '0', 0, '单号:' + that.sales.id)
strCmd += blesdk.addCPCLText('0', '350', '24', '0', 0, '销售员:' + that.sales.createByName)
strCmd += blesdk.addCPCLText('500', '350', '24', '0', 0, '日期:' + that.sales.createTime)
let guige = '420'
let shuliang = '600'
if(this.zhengtizhekou){
guige = '350'
shuliang = '530'
}
let zhekou = '600'
let danjia = '660'
let zongjia = '730'
if (this.printingMethod == '0') {
strCmd += blesdk.addCPCLText('0', '390', '24', '0', 0,
'-----------------------------------------------------------------------------------')
strCmd += blesdk.addCPCLText('10', that.yNum += 40, '24', '0', 0, '货号(名称)')
strCmd += blesdk.addCPCLText(guige, that.yNum, '24', '0', 0, '规格')
strCmd += blesdk.addCPCLText(shuliang, that.yNum, '24', '0', 0, '数量')
if(this.zhengtizhekou){
strCmd += blesdk.addCPCLText(zhekou, that.yNum, '24', '0', 0, '折扣')
}
strCmd += blesdk.addCPCLText(danjia, that.yNum, '24', '0', 0, '单价')
strCmd += blesdk.addCPCLText(zongjia, that.yNum, '24', '0', 0, '总价')
} else if (this.printingMethod == '2') {
that.yNum = 370
strCmd += blesdk.addCPCLText('0', '370', '24', '0', 0,
'-----------------------------------------------------------------------------------')
strCmd += blesdk.addCPCLText('10', that.yNum += 40, '24', '0', 0, '货号(名称)')
strCmd += blesdk.addCPCLText('420', that.yNum, '24', '0', 0, '数量')
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText('510', that.yNum, '24', '0', 0, '折扣')
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, '单价')
}else{
strCmd += blesdk.addCPCLText('575', that.yNum, '24', '0', 0, '单价')
}
strCmd += blesdk.addCPCLText('730', that.yNum, '24', '0', 0, '总价')
}
for (var i = 0; i < that.newData.length; i++) {
let colorHeight = 25
if (that.shopId == '1822829636942434305' || that.shopId == '1818888277105709056') {
colorHeight = 50
}
if (that.yNum + colorHeight >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + colorHeight) >= 1990 ? 1990 : (
this
.printHeight - that.yNum + colorHeight), 1, 0, 162);
that.yNum = 0
pageNum++
if (this.printingMethod != '2') {
strCmd += blesdk.addCPCLText('0', that.yNum += colorHeight, '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
} else {
if (this.printingMethod != '2') {
strCmd += blesdk.addCPCLText('0', that.yNum += colorHeight, '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
}
if (this.printingMethod == '1') {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (
this.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
}
let fountSize = '0'
if (that.shopId == '1822829636942434305' || that.shopId ==
'1818888277105709056') {
fountSize = '1'
}
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', fountSize, 0, that
.newData[i].productSn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', fountSize, 0, that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
colorHeight = 64
if (that.shopId == '1822829636942434305' || that.shopId ==
'1818888277105709056') {
colorHeight = 80
}
if (that.yNum + colorHeight >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + colorHeight) >= 1990 ?
1990 : (
this.printHeight - that.yNum + colorHeight), 1, 0, 180);
that.yNum = 0
pageNum++
}
colorHeight = 40
if (that.shopId == '1822829636942434305' || that.shopId ==
'1818888277105709056') {
fountSize = '1'
colorHeight = 58
}
strCmd += blesdk.addCPCLText('0', that.yNum += colorHeight, '24', fountSize, 0, '颜色')
let startWith = 180
for (let a = 0; a < that.newData[i].sizeList.length; a++) {
if ((that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') && that
.newData[i].sizeList[a] == '均') {
that.newData[i].sizeList[a] = '分码'
}
strCmd += blesdk.addCPCLSETBOLD('400')
let fountSize = '0'
let widthSize = 420
if (that.shopId == '1822829636942434305' || that.shopId ==
'1818888277105709056') {
fountSize = '1'
widthSize = 470
}
strCmd += blesdk.addCPCLText(startWith.toString(), that.yNum, '24', fountSize, 0, that.newData[
i]
.sizeList[a])
strCmd += blesdk.addCPCLSETBOLD('0')
startWith += Math.floor(widthSize / 8)
}
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText('562', that.yNum, '24', fountSize, 0, '数量')
strCmd += blesdk.addCPCLText('628', that.yNum, '24', fountSize, 0, '折扣')
strCmd += blesdk.addCPCLText('694', that.yNum, '24', fountSize, 0, '单价')
strCmd += blesdk.addCPCLText('770', that.yNum, '24', fountSize, 0, '总价')
}else{
strCmd += blesdk.addCPCLText('578', that.yNum, '24', fountSize, 0, '数量')
strCmd += blesdk.addCPCLText('644', that.yNum, '24', fountSize, 0, '单价')
strCmd += blesdk.addCPCLText('720', that.yNum, '24', fountSize, 0, '总价')
}
let begin = 0
that.newData[i].sizePrintList.forEach(function(value, key) {
colorHeight = 64
if (that.shopId == '1822829636942434305' || that.shopId ==
'1818888277105709056') {
colorHeight = 90
}
if (that.yNum + colorHeight >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (that.printHeight - that.yNum + colorHeight) >=
1990 ? 1990 : (
that.printHeight - that.yNum + colorHeight), 1, 0, 180);
that.yNum = 0
pageNum++
}
if ((that.shopId == '1820269107191353344' || that.shopId ==
'1818888277105709056') && key == '均色') {
key = '分色'
}
let beginHeight = 40
let widthSize = 420
let fountSize = '0'
if ((that.shopId == '1822829636942434305' || that.shopId ==
'1818888277105709056')) {
beginHeight = 58
}
begin++
if (that.shopId == '1822829636942434305' || that.shopId ==
'1818888277105709056') {
fountSize = '1'
widthSize = 470
}
strCmd += blesdk.addCPCLText('0', that.yNum += beginHeight, '24', fountSize, 0, key)
let childStartWith = 180
let allCount = 0
let discountAmount = 0
for (let a = 0; a < that.newData[i].sizeList.length; a++) {
let printSizeCount = []
if (that.newData[i].sizeList[a] == '分码') {
that.newData[i].sizeList[a] = '均'
}
if (value.has(that.newData[i].sizeList[a])) {
printSizeCount = value.get(that.newData[i].sizeList[a]).split(':')
discountAmount = printSizeCount[1] == undefined ? '' : printSizeCount[1]
}
allCount += printSizeCount[0] == undefined ? 0 : Number(printSizeCount[0])
that.newData[i].allCount = allCount
strCmd += blesdk.addCPCLText(childStartWith.toString(), that.yNum, '24', fountSize,
0, printSizeCount[0] == undefined ? '' : Number(printSizeCount[0]))
childStartWith += Math.floor(widthSize / 8)
}
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText('562', that.yNum, '24', fountSize, 0, allCount)
strCmd += blesdk.addCPCLText('628', that.yNum, '24', fountSize, 0, that.newData[i].printDiscount)
strCmd += blesdk.addCPCLText('694', that.yNum, '24', fountSize, 0, discountAmount)
strCmd += blesdk.addCPCLText('770', that.yNum, '24', fountSize, 0, (allCount *
discountAmount))
}else{
strCmd += blesdk.addCPCLText('578', that.yNum, '24', fountSize, 0, allCount)
strCmd += blesdk.addCPCLText('644', that.yNum, '24', fountSize, 0, discountAmount)
strCmd += blesdk.addCPCLText('720', that.yNum, '24', fountSize, 0, (allCount *
discountAmount))
}
})
} else if (this.printingMethod == '2') {
let returnCount = 0
let buyCount = 0
let returnPrice = 0
let buyPrice = 0
for (var m = 0; m < that.newData[i].stockLogList1.length; m++) {
if (that.newData[i].stockLogList1[m].isReturn) {
returnPrice = that.newData[i].stockLogList1[m].discountAmount
returnCount += that.newData[i].stockLogList1[m].productCount
} else {
buyCount += that.newData[i].stockLogList1[m].productCount
}
}
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
}
if (buyCount > 0) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that.newData[i].productSn)
strCmd += blesdk.addCPCLText('420', that.yNum, '24', '0', 0, buyCount)
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText('510', that.yNum, '24', '0', 0, that.newData[i]
.printDiscount)
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
}else{
strCmd += blesdk.addCPCLText('575', that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
}
strCmd += blesdk.addCPCLText('730', that.yNum, '24', '0', 0, buyCount * that.newData[i]
.discountAmount)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
strCmd += blesdk.addCPCLText('420', that.yNum, '24', '0', 0, buyCount)
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText('510', that.yNum, '24', '0', 0, that.newData[i]
.printDiscount)
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
}else{
strCmd += blesdk.addCPCLText('575', that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
}
strCmd += blesdk.addCPCLText('730', that.yNum, '24', '0', 0, buyCount * that.newData[i]
.discountAmount)
}
}
if (returnCount > 0) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【退】' + that.newData[i].productSn)
strCmd += blesdk.addCPCLText('420', that.yNum, '24', '0', 0, returnCount)
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText('510', that.yNum, '24', '0', 0, "")
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, returnPrice)
}else{
strCmd += blesdk.addCPCLText('575', that.yNum, '24', '0', 0, returnPrice)
}
strCmd += blesdk.addCPCLText('730', that.yNum, '24', '0', 0, returnCount * returnPrice)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【退】' + that.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
strCmd += blesdk.addCPCLText('420', that.yNum, '24', '0', 0, returnCount)
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText('510', that.yNum, '24', '0', 0, "")
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, returnPrice)
}else{
strCmd += blesdk.addCPCLText('575', that.yNum, '24', '0', 0, returnPrice)
}
strCmd += blesdk.addCPCLText('730', that.yNum, '24', '0', 0, returnCount * returnPrice)
}
}
} else {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
for (var m = 0; m < that.newData[i].stockLogList1.length; m++) {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ?
1990 : (
this.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
if (that.newData[i].stockLogList1[m].isReturn) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) +
'.' + '【退】' + that
.newData[i].productSn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) +
'.' + '【退】' + that
.newData[i].productSn +
'(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
} else {
if (that.newData[i].productName == that.newData[i].productSn && that.order.name !=
'散客') {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1) { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【补】' + that
.newData[i].productSn)
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that
.newData[i].productSn)
}
} else {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order
.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【补】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
}
}
if (that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') {
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均色') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[
m]
.attributeList.replace(/均色/g, '分色')
}
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均码') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[
m]
.attributeList.replace(/均码/g, '分码')
}
}
strCmd += blesdk.addCPCLText(guige, that.yNum, '24', '0', 0, that
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
strCmd += blesdk.addCPCLText(shuliang, that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].productCount)
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText(zhekou, that.yNum, '24', '0', 0, that.newData[i]
.printDiscount)
}
if (that.newData[i].stockLogList1[m].isReturn) {
strCmd += blesdk.addCPCLText(danjia, that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].discountAmount)
strCmd += blesdk.addCPCLText(zongjia, that.yNum, '24', '0', 0, (that.newData[i]
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
.productCount))
} else {
strCmd += blesdk.addCPCLText(danjia, that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
strCmd += blesdk.addCPCLText(zongjia, that.yNum, '24', '0', 0, (that.newData[i]
.discountAmount * that.newData[i].stockLogList1[m].productCount))
}
} else {
if (that.newData[i].stockLogList1[m].isReturn) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) +
'.' + '【退】' + that
.newData[i].productSn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) +
'.' + '【退】' + that
.newData[i].productSn +
'(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
} else {
if (that.newData[i].productName == that.newData[i].productSn && that.order.name !=
'散客') {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1) { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【补】' + that
.newData[i].productSn)
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that
.newData[i].productSn)
}
} else {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order
.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【补】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
}
}
if (that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') {
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均色') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[
m]
.attributeList.replace(/均色/g, '分色')
}
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均码') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[
m]
.attributeList.replace(/均码/g, '分码')
}
}
strCmd += blesdk.addCPCLText(guige, that.yNum, '24', '0', 0, that
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
strCmd += blesdk.addCPCLText(shuliang, that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].productCount)
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText(zhekou, that.yNum, '24', '0', 0, that.newData[i]
.printDiscount)
}
if (that.newData[i].stockLogList1[m].isReturn) {
strCmd += blesdk.addCPCLText(danjia, that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].discountAmount)
strCmd += blesdk.addCPCLText(zongjia, that.yNum, '24', '0', 0, (that.newData[i]
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
.productCount))
} else {
strCmd += blesdk.addCPCLText(danjia, that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
strCmd += blesdk.addCPCLText(zongjia, that.yNum, '24', '0', 0, (that.newData[i]
.discountAmount * that.newData[i].stockLogList1[m].productCount))
}
}
}
} else {
for (var m = 0; m < that.newData[i].stockLogList1.length; m++) {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ?
1990 : (
this.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
if (that.newData[i].stockLogList1[m].isReturn) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【退】' + that
.newData[i].productSn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【退】' + that
.newData[i].productSn +
'(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
} else {
if (that.newData[i].productName == that.newData[i].productSn) {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order
.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【补】' + that
.newData[i].productSn)
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that
.newData[i].productSn)
}
} else {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order
.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【补】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
}
}
if (that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') {
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均色') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[
m]
.attributeList.replace(/均色/g, '分色')
}
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均码') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[
m]
.attributeList.replace(/均码/g, '分码')
}
}
strCmd += blesdk.addCPCLText(guige, that.yNum, '24', '0', 0, that
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
strCmd += blesdk.addCPCLText(shuliang, that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].productCount)
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText(zhekou, that.yNum, '24', '0', 0, that.newData[i]
.printDiscount)
}
if (that.newData[i].stockLogList1[m].isReturn) {
strCmd += blesdk.addCPCLText(danjia, that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].discountAmount)
strCmd += blesdk.addCPCLText(zongjia, that.yNum, '24', '0', 0, (that.newData[i]
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
.productCount))
} else {
strCmd += blesdk.addCPCLText(danjia, that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
strCmd += blesdk.addCPCLText(zongjia, that.yNum, '24', '0', 0, (that.newData[i]
.discountAmount * that.newData[i].stockLogList1[m].productCount))
}
} else {
if (that.newData[i].stockLogList1[m].isReturn) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【退】' + that
.newData[i].productSn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【退】' + that
.newData[i].productSn +
'(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
} else {
if (that.newData[i].productName == that.newData[i].productSn) {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order
.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【补】' + that
.newData[i].productSn)
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that
.newData[i].productSn)
}
} else {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order
.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【补】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=
1) + '.' + '【销】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
}
}
if (that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') {
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均色') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[
m]
.attributeList.replace(/均色/g, '分色')
}
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均码') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[
m]
.attributeList.replace(/均码/g, '分码')
}
}
strCmd += blesdk.addCPCLText(guige, that.yNum, '24', '0', 0, that
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
strCmd += blesdk.addCPCLText(shuliang, that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].productCount)
if(that.zhengtizhekou){
strCmd += blesdk.addCPCLText(zhekou, that.yNum, '24', '0', 0, that.newData[i]
.printDiscount)
}
if (that.newData[i].stockLogList1[m].isReturn) {
strCmd += blesdk.addCPCLText(danjia, that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].discountAmount)
strCmd += blesdk.addCPCLText(zongjia, that.yNum, '24', '0', 0, (that.newData[i]
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
.productCount))
} else {
strCmd += blesdk.addCPCLText(danjia, that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
strCmd += blesdk.addCPCLText(zongjia, that.yNum, '24', '0', 0, (that.newData[i]
.discountAmount * that.newData[i].stockLogList1[m].productCount))
}
}
}
}
}
}
// strCmd += blesdk.addCPCLPrint();
// that.bufferData.push(strCmd);
// that.yNum = 0
// strCmd = blesdk.CreatCPCLPage(1080, 700, 1, 0);
let lineSize = 25
if (that.shopId == '1822829636942434305' || that.shopId ==
'1818888277105709056') {
lineSize = 40
}
if (that.yNum + lineSize >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + lineSize) >= 1990 ? 1990 : (this
.printHeight - that.yNum + lineSize), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += lineSize, '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += lineSize, '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLLocation(0);
//金桔家金额区域显示
if (this.shopId == '1820391948796694529') {
if (that.yNum + 54 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd +=
blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '销售数量:' + that.sales.productCount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
// strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
.balanceDeductionAmount))
// strCmd += blesdk.addCPCLText('600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '销售数量:' + that.sales.productCount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
// strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
.balanceDeductionAmount))
// strCmd += blesdk.addCPCLText('600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
}
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 54 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
}
if (that.yNum + 54 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '欠款抵退货:' + that.sales
.debtDeductionAmount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
.saleDeductionAmount)
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '之前欠款:' + that.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '之前欠款:0')
}
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '欠款抵退货:' + that.sales
.debtDeductionAmount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
.saleDeductionAmount)
// strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
// .balanceDeductionAmount))
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('580', (that.yNum), '24', '0', 0, '之前欠款:' + that.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('580', (that.yNum), '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('580', (that.yNum), '24', '0', 0, '之前欠款:0')
}
}
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 54 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单应收:' + that.sales.realAmount)
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计欠款:0')
}
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单应收:' + that.sales.realAmount)
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计欠款:0')
}
}
if (that.yNum + 54 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('580', that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn)
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('580', that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn)
}
} else if (this.shopId == '1821406205034237952') {
//董大姐家金额单独显示
if (that.yNum + 64 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, '合计:')
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.sales.productCount + '件')
strCmd += blesdk.addCPCLText('700', that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, '合计:')
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.sales.productCount + '件')
strCmd += blesdk.addCPCLText('700', that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
}
if (that.yNum + 60 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '本单应收:' + that.sales.realAmount +
'(' + this.convertToChineseNumeral(that.sales.realAmount) + ')')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '本单应收:' + that.sales.realAmount +
'(' + this.convertToChineseNumeral(that.sales.realAmount) + ')')
}
if (that.yNum + 60 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn + '(' + this.convertToChineseNumeral(that.sales.alreadyEarn) + ')')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn + '(' + this.convertToChineseNumeral(that.sales.alreadyEarn) + ')')
}
if (that.yNum + 60 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '之前欠款:' + that.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '之前欠款:0')
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计欠款:0')
}
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('0', (that.yNum += 60), '24', '0', 0, '之前欠款:' + that
.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('0', (that.yNum += 60), '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('0', (that.yNum += 60), '24', '0', 0, '之前欠款:0')
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计欠款:0')
}
}
if (that.yNum + 60 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 30 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 30) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 30), 1, 0, 162);
that.yNum = 0
pageNum++
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if (that.returnPrice > 0) {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
}
} else {
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if (that.returnPrice > 0) {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
}
}
} else if (this.printingMethod == '2' || this.shopId ==
'1843114735801864192' || this.shopId == '1818888277105709056') {
//华秀
if (this.printingMethod == '2') {
if (that.yNum + 64 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, '合计:')
strCmd += blesdk.addCPCLText('420', that.yNum, '24', '0', 0, that.sales.productCount + '件')
strCmd += blesdk.addCPCLText('730', that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, '合计:')
strCmd += blesdk.addCPCLText('420', that.yNum, '24', '0', 0, that.sales.productCount + '件')
strCmd += blesdk.addCPCLText('730', that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
}
} else {
if (that.yNum + 64 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, '合计:')
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.sales.productCount + '件')
strCmd += blesdk.addCPCLText('700', that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, '合计:')
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.sales.productCount + '件')
strCmd += blesdk.addCPCLText('700', that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
}
}
if (that.yNum + 60 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '之前欠款:' + that
.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '之前欠款:0')
}
strCmd += blesdk.addCPCLText('248', that.yNum, '24', '0', 0, '本单应收:' + that.sales.realAmount +
'(' + this.convertToChineseNumeral(that.sales.realAmount) + ')')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '之前欠款:' + that
.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '之前欠款:0')
}
strCmd += blesdk.addCPCLText('248', that.yNum, '24', '0', 0, '本单应收:' + that.sales.realAmount +
'(' + this.convertToChineseNumeral(that.sales.realAmount) + ')')
}
if (that.yNum + 60 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '累计欠款:' + that
.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '累计欠款:0')
}
strCmd += blesdk.addCPCLText('248', that.yNum, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn + '(' + this.convertToChineseNumeral(that.sales.alreadyEarn) + ')')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '累计欠款:' + that
.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '累计欠款:0')
}
strCmd += blesdk.addCPCLText('248', that.yNum, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn + '(' + this.convertToChineseNumeral(that.sales.alreadyEarn) + ')')
}
if (that.yNum + 60 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 30 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 30) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 30), 1, 0, 162);
that.yNum = 0
pageNum++
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if (that.returnPrice > 0) {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
}
} else {
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if (that.returnPrice > 0) {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
}
}
} else {
//正常的金额显示
if (that.yNum + 84 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 84) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 84), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd +=
blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '销售数量:' + that.sales.productCount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
// strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
.balanceDeductionAmount))
// strCmd += blesdk.addCPCLText('600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '销售数量:' + that.sales.productCount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
// strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
.balanceDeductionAmount))
// strCmd += blesdk.addCPCLText('600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
}
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 84 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 84) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 84), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
}
if (that.yNum + 84 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 84) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 84), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '欠款抵退货:' + that.sales
.debtDeductionAmount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
.saleDeductionAmount)
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, '之前欠款:' + that.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, '之前欠款:0')
}
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '欠款抵退货:' + that.sales
.debtDeductionAmount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
.saleDeductionAmount)
// strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
// .balanceDeductionAmount))
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('610', (that.yNum - 10), '24', '0', 0, '之前欠款:' + that
.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('610', (that.yNum - 10), '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('610', (that.yNum - 10), '24', '0', 0, '之前欠款:0')
}
}
if (that.yNum + 94 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 94) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 94), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单应收:' + that.sales.realAmount +
'(' + that.convertToChineseNumeral(that.sales.realAmount) + ')')
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单应收:' + that.sales.realAmount +
'(' + that.convertToChineseNumeral(that.sales.realAmount) + ')')
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
}
if (that.yNum + 114 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 114) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 114), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单欠款:' + that.sales.noEarn +
'(' + that.convertToChineseNumeral(that.sales.noEarn) + ')')
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn) + '(' + that.convertToChineseNumeral(Math.abs(that.sales.noEarn)) + ')')
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计欠款:0')
}
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单欠款:' + (that.sales
.noEarn) + '(' + that.convertToChineseNumeral(that.sales.noEarn) + ')')
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn) + '(' + that.convertToChineseNumeral(Math.abs(that.sales.noEarn)) + ')')
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计欠款:0')
}
}
}
if (that.yNum + 40 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 40) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 40), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.sales.remark) {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '订单备注:' + that.sales.remark)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.sales.remark) {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '订单备注:' + that.sales.remark)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
}
//店铺地址
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
for (let i = 0; i < this.addressArr.length; i++) {
// strCmd += blesdk.addCPCLText('50', yNum += 40, '24', '0', 0, this.addressArr[i])
if (i == 0) {
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + this.addressArr[
i])
} else {
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, this.addressArr[i])
}
}
} else {
for (let i = 0; i < this.addressArr.length; i++) {
// strCmd += blesdk.addCPCLText('50', yNum += 40, '24', '0', 0, this.addressArr[i])
if (i == 0) {
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + this.addressArr[
i])
} else {
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, this.addressArr[i])
}
}
}
//店铺电话
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (this.shopId == '1820391948796694529' || this.shopId == '1848966744035692545' || this.shopId ==
'1850038419279974400') {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + this.jinjuPhone)
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + this.jinjuPhone)
}
} else if (this.shopId == '1834512626093264897') {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:13191998128')
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:13191998128')
}
} else {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + (uni.getStorageSync(
'shopOwnerPhone') ? uni.getStorageSync('shopOwnerPhone') : uni.getStorageSync(
'username')))
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + (uni.getStorageSync(
'shopOwnerPhone') ? uni.getStorageSync('shopOwnerPhone') : uni.getStorageSync(
'username')))
}
}
//物流
if (this.sales.companyName != null) {
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '发货方式:' + this.sales
.companyName + ' ' + this.sales.companyPhone)
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '发货方式:' + this.sales
.companyName + ' ' + this.sales.companyPhone)
}
}
//店铺备注
if (this.shopRemark.length > 0) {
for (let i = 0; i < this.shopRemark.length; i++) {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, this.shopRemark[i])
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, this.shopRemark[i])
}
}
}
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
let codeHeightPlus = 0
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){ //原创家二维码放大了
codeHeightPlus = that.yNum + 372
}else{
codeHeightPlus = that.yNum + 300
}
if (codeHeightPlus >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
let HeightPlus = 0
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){ //原创家二维码放大了
HeightPlus = this.printHeight - that.yNum + 322
}else{
HeightPlus = this.printHeight - that.yNum + 270
}
strCmd = blesdk.CreatCPCLPage(1080, HeightPlus >= 1990 ? 1990 : HeightPlus, 1, 0, 162);
that.yNum = 0
pageNum++
if (that.qrArr.length != 0) {
//店铺微信/微信收款/支付宝收款/收款码收款(店铺,微信,支付,收款)
for (let i = 0; i < that.qrArr.length; i++) {
//店铺二维码
if (i == 0) {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40), '24', '0', 0, that.qrArr[i].name)
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),that.qrArr[i].level, '2', 6, that.qrArr[i].path) //二维码
}else{
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
}
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText(that.countWidth(i, 900 / that.qrArr.length), (that.yNum -=
40), '24', '0', 0, that.qrArr[i].name)
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40), that.qrArr[i].level, '2', 6, that.qrArr[i].path) //二维码
}else{
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40), that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
}
}
if (that.qrArr.length == (i + 1)) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
}
} else {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
} else {
if (that.qrArr.length != 0) {
//店铺微信/微信收款/支付宝收款/收款码收款(店铺,微信,支付,收款)
for (let i = 0; i < that.qrArr.length; i++) {
//店铺二维码
if (i == 0) {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40), '24', '0', 0, that.qrArr[i].name)
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),
that.qrArr[i].level, '2', 6, that.qrArr[i].path) //二维码
}else{
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),
that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
}
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText(that.countWidth(i, 900 / that.qrArr.length), (that.yNum -=
40), '24', '0', 0, that.qrArr[i].name)
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),that.qrArr[i].level, '2', 6, that.qrArr[i].path) //二维码
}else{
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
}
}
if (that.qrArr.length == (i + 1)) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
}
} else {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
}
this.$nextTick(() => {
that.changePrintCount()
that.bufferData = []
})
},
countWidth(num, len) {
return num * len
},
//计算打印机当前行高度
countPrint() {
return this.yNum += 40
},
//截取
slicePrint(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + '/'
}
}
return name;
},
//退款接口
async getReturnOrder(id) {
let that = this;
await this.tui.request("/app/return/list", "post", {
remark: 3,
saleId: id
}, false, false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
if (res.result != '') {
this.inventoryReturnList = res.result
this.returnPrice = 0
this.returnNum = 0
this.inventoryReturnList.forEach(item => {
this.returnPrice += item.totalAmount
this.returnNum += item.productCount
this.tui.request("/app/return/get/" + item.id, "GET", null, false,
false)
.then((res) => {
if (res.code == 200 && res.result != null && res.result !=
undefined) {
that.returnList1.push(res.result)
that.shopList.push(...res.result.saleDetailDTOList);
for (let j = 0; j < res.result.saleDetailDTOList
.length; j++) {
var isZiMu = false
var isNumber = false
var colorList = new Map()
var sizeNumList = []
if (res.result.saleDetailDTOList[j].stockLogList1
.length > 0) {
for (var m = 0; m < res.result
.saleDetailDTOList[j].stockLogList1
.length; m++) {
var attr = res.result.saleDetailDTOList[j]
.stockLogList1[m].attributeList
var newObj = JSON.parse(attr)
for (var as in newObj) {
if (as == '尺码' && that.isLetterOrDigit(
newObj[as].replace(/码/g, '')
) == 'Letter') {
isZiMu = true
}
if (as == '尺码' && that.isLetterOrDigit(
newObj[as].replace(/码/g, '')
) == 'Digit') {
isNumber = true
}
if (as == '尺码' && sizeNumList.indexOf(
newObj[as].replace(/码/g, '')
) == -1) {
sizeNumList.push(newObj[as]
.replace(/码/g, ''))
}
if (as == '颜色') {
if (colorList.has(newObj[as])) {
colorList.get(newObj[as]).push(
res.result
.saleDetailDTOList[j]
.stockLogList1[m])
} else {
let listChild = []
listChild.push(res.result
.saleDetailDTOList[j]
.stockLogList1[m])
colorList.set(newObj[as],
listChild)
}
}
}
}
}
var newStockList = []
if (isNumber) {
sizeNumList = sizeNumList.sort((a, b) => a -
b);
colorList.forEach(function(value, key) {
for (var j = 0; j < sizeNumList
.length; j++) {
for (var m = 0; m < value
.length; m++) {
var newObj = JSON.parse(
value[m]
.attributeList)
var size = ''
var color = ''
for (var as in newObj) {
if (as == '尺码') {
size = newObj[as]
.replace(/码/g,
'')
}
}
if (size == sizeNumList[
j]) {
newStockList.push(
value[m])
value.splice(m, 1)
break
}
}
}
if (value.length > 0) {
newStockList = newStockList
.concat(value)
}
})
res.result.saleDetailDTOList[j].stockLogList1 =
newStockList
}
if (isZiMu) {
colorList.forEach(function(value, key) {
for (var j = 0; j < that.lettrList
.length; j++) {
for (var m = 0; m < value
.length; m++) {
var newObj = JSON.parse(
value[m]
.attributeList)
var size = ''
var color = ''
for (var as in newObj) {
if (as == '尺码') {
size = newObj[as]
.replace(/码/g,
'')
}
}
if (size == that.lettrList[
j]) {
newStockList.push(
value[m])
value.splice(m, 1)
break
}
}
}
if (value.length > 0) {
newStockList = newStockList
.concat(value)
}
})
res.result.saleDetailDTOList[j].stockLogList1 =
newStockList
}
let isTure = true
res.result.saleDetailDTOList[j].productCount = 0
for (let m = 0; m < res.result.saleDetailDTOList[j]
.stockLogList1.length; m++) {
res.result.saleDetailDTOList[j].productCount +=
res.result.saleDetailDTOList[j]
.stockLogList1[m].productCount
res.result.saleDetailDTOList[j].stockLogList1[
m].isReturn = true
res.result.saleDetailDTOList[j].stockLogList1[
m].discountAmount = res.result
.saleDetailDTOList[j].discountAmount
let tableData = {
productSn: '【退】' + res.result
.saleDetailDTOList[j].productSn,
productName: res.result
.saleDetailDTOList[j].productName,
productCount: res.result
.saleDetailDTOList[j]
.stockLogList1[m].productCount,
attributeList: res.result
.saleDetailDTOList[j]
.stockLogList1[m].attributeList,
discountAmount: res.result
.saleDetailDTOList[j]
.discountAmount
}
that.listHeng.push(tableData)
}
for (let i = 0; i < that.newData.length; i++) {
if (that.newData[i].productId == res.result
.saleDetailDTOList[j].productId) {
isTure = false
that.newData[i].stockLogList1.push(...res
.result.saleDetailDTOList[j]
.stockLogList1)
}
}
if (isTure) {
that.newData.push(res.result.saleDetailDTOList[
j])
}
}
}
}).catch((res) => {})
})
} else {
for (let i = 0; i < that.list.length; i++) {
for (let z = 0; z < that.list[i].stockLogList1.length; z++) {
that.list[i].stockLogList1[z].maxNum = that.list[i].stockLogList1[z]
.productCount
}
}
}
} else {
this.tui.toast(res.message)
}
})
setTimeout(res => {
let that = this
for (let i = 0; i < this.newData.length; i++) {
that.newData[i].sizeList = []
var isZiMu = false
var isNumber = false
var sizeNumList = []
var notNum = []
that.newData[i].sizePrintList = new Map()
for (let j = 0; j < that.newData[i].stockLogList1.length; j++) {
let discountAmount = that.newData[i].discountAmount
let newObj = JSON.parse(that.newData[i].stockLogList1[j].attributeList)
let printSize = new Map()
let color = ''
let statusAttr = '[销] '
if (that.newData[i].stockLogList1[j].isReturn) {
statusAttr = '[退] '
discountAmount = that.newData[i].stockLogList1[j].discountAmount
} else if (that.newData[i].stockLogList1[j].isPurchasedBefore == 1 && that.order
.name != '散客') {
statusAttr = '[补] '
}
for (let as in newObj) {
if (as == '颜色') {
color = statusAttr + newObj[as]
if (that.newData[i].sizePrintList.has(color) == true) {
printSize = that.newData[i].sizePrintList.get(color)
} else {
that.newData[i].sizePrintList.set(color, printSize)
}
}
if (as == '尺码') {
if (newObj[as].indexOf('码') != -1) {
if (that.newData[i].sizeList.indexOf(newObj[as].substr(0, newObj[as]
.indexOf('码'))) == -1) {
that.newData[i].sizeList.push(newObj[as].substr(0, newObj[as]
.indexOf('码')))
}
that.newData[i].sizePrintList.get(color).set(newObj[as].substr(0,
newObj[as].indexOf('码')), that.newData[i].stockLogList1[j]
.productCount + ':' + discountAmount)
} else {
if (that.newData[i].sizeList.indexOf(newObj[as]) == -1) {
that.newData[i].sizeList.push(newObj[as])
}
that.newData[i].sizePrintList.get(color).set(newObj[as], that.newData[
i].stockLogList1[j].productCount + ':' + discountAmount)
}
}
if (as == '尺码' && that.isLetterOrDigit(newObj[as].replace(/码/g, '')) ==
'Letter') {
isZiMu = true
}
if (as == '尺码' && that.isLetterOrDigit(newObj[as].replace(/码/g, '')) ==
'Digit') {
isNumber = true
}
if (as == '尺码' && sizeNumList.indexOf(newObj[as].replace(/码/g, '')) == -1) {
if (as == '尺码' && that.isLetterOrDigit(newObj[as].replace(/码/g, '')) ==
'Digit') {
sizeNumList.push(newObj[as].replace(/码/g, ''))
} else {
if (notNum.indexOf(newObj[as].replace(/码/g, '')) == -1) {
notNum.push(newObj[as].replace(/码/g, ''))
}
}
}
}
}
if (notNum.length > 0) {
sizeNumList = sizeNumList.concat(notNum)
}
if (isZiMu) {
let newStockList = []
for (var j = 0; j < that.lettrList.length; j++) {
for (var m = 0; m < that.newData[i].sizeList.length; m++) {
if (that.newData[i].sizeList[m] == that.lettrList[j]) {
newStockList.push(that.newData[i].sizeList[m])
that.newData[i].sizeList.splice(m, 1)
break
}
}
}
if (that.newData[i].sizeList.length > 0) {
newStockList = newStockList.concat(that.newData[i].sizeList)
}
that.newData[i].sizeList = newStockList
}
if (isNumber) {
let newStockList = []
sizeNumList = sizeNumList.sort((a, b) => a - b);
for (var j = 0; j < sizeNumList.length; j++) {
for (var m = 0; m < that.newData[i].sizeList.length; m++) {
if (that.newData[i].sizeList[m] == sizeNumList[j]) {
newStockList.push(that.newData[i].sizeList[m])
that.newData[i].sizeList.splice(m, 1)
break
}
}
}
if (that.newData[i].sizeList.length > 0) {
newStockList = newStockList.concat(that.newData[i].sizeList)
}
that.newData[i].sizeList = newStockList
}
//this.newData[i].sizeList = [...new Set(this.newData[i].sizeList)]
}
}, 500)
this.$nextTick(() => {
setTimeout(res => {
this.getPrintHeight()
}, 1000)
})
},
// 金额转大写
convertToChineseNumeral(money) {
let fu = false
if (money == 0) {
return '零元整'
}
if (JSON.stringify(money).indexOf('-') != -1) {
money = JSON.stringify(money).split('-')[1]
fu = true
}
const cnNums = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
const cnIntRadice = ['', '拾', '佰', '仟']
const cnIntUnits = ['', '万', '亿', '兆']
const cnDecUnits = ['角', '分', '毫', '厘']
const cnInteger = '整'
const cnIntLast = '元'
const maxNum = 999999999999999.9999
let integerNum
let decimalNum
let chineseStr = ''
let parts
if (money == '') {
return ''
}
money = parseFloat(money)
if (money >= maxNum) {
return ''
}
if (money == 0) {
chineseStr = cnNums[0] + cnIntLast + cnInteger
return chineseStr
}
money = money.toString()
if (money.indexOf('.') == -1) {
integerNum = money
decimalNum = ''
} else {
parts = money.split('.')
integerNum = parts[0]
decimalNum = parts[1].substr(0, 4)
}
if (parseInt(integerNum, 10) > 0) {
let zeroCount = 0
const IntLen = integerNum.length
for (let i = 0; i < IntLen; i++) {
const n = integerNum.substr(i, 1)
const p = IntLen - i - 1
const q = p / 4
const m = p % 4
if (n == '0') {
zeroCount++
} else {
if (zeroCount > 0) {
chineseStr += cnNums[0]
}
zeroCount = 0
chineseStr += cnNums[parseInt(n)] + cnIntRadice[m]
}
if (m == 0 && zeroCount < 4) {
chineseStr += cnIntUnits[q]
}
}
chineseStr += cnIntLast
}
if (decimalNum != '') {
const decLen = decimalNum.length
for (let i = 0; i < decLen; i++) {
const n = decimalNum.substr(i, 1)
if (n != '0') {
chineseStr += cnNums[Number(n)] + cnDecUnits[i]
}
}
}
if (chineseStr == '') {
chineseStr += cnNums[0] + cnIntLast + cnInteger
} else if (decimalNum == '') {
chineseStr += cnInteger
}
if (fu == true) {
chineseStr = '负' + chineseStr
}
return chineseStr
},
// 重新开单订单
async againOrder(item,type,index) {
let that = this;
await this.getReturnOrder1(item.id)
await this.tui.modal("提示", "您确定要重新开单吗?", true, (res) => {
if (res) {
that.goSaleGoods(item)
}
})
},
goDetail(id,userId,index) {
this.inventoryList[index].isShowBtn = false
uni.setStorageSync('noReload',true)
uni.navigateTo({
url: '/package1/index/orderDetail?id=' + id +'&userId='+userId
})
},
changeSignPopup(e){
if(e.show == false){
this.signIndex = []
for(let m=0;m<this.signList.length;m++){
this.signList[m].checked = false
}
}
},
sreachName(e) {
this.faBookShow = true
this.customName = e.detail.value
this.getCustomList(e.detail.value)
},
inputFocus(e){
if(e.target.value != ''){
this.getCustomList(e.target.value)
}else{
this.customList = []
}
this.customId = ''
this.faBookShow = true
},
checkName(item) {
this.customName = item.name
this.faBookShow = false
this.$forceUpdate()
},
//获取客户列表
getCustomList(name) {
this.tui.request("/app/customer/list", "post", {
searchStr:name,
pageNum: 1,
pageSize: 1000,
sort:"",
notBuyDays:""
}, false, false).then((res) => {
if (res.code == 200) {
this.customList = res.result.records
}else{
this.tui.toast(res.message)
}
})
},
//修改打印次数
changePrintCount(){
let that = this;
that.tui.request("/app/sale/updatePrintCount","post", {
saleId:this.printId
}, false, true).then((res) => {
if (res.code == 200) {
that.getOrderInfoList()
uni.showToast({
duration: 1000,
title: "打印成功",
mask: true
})
} else {
that.tui.toast(res.message)
}
}).catch((res) => {})
},
// 订单查询
getOrderInfoList(type) {
if(type == 'sreach'){
this.page = 1
this.inventoryList = []
}
let data = {}
if(this.listStatus == '2' || this.listStatus == '6' || this.listStatus == '7'){
data = {
pageVo: {
pageSize: 15,
pageNumber: this.page
},
fromWhere:'2',
timeOrder:this.timeOrder,
startTime:this.range[0],
endTime:this.range[1],
searchStr:this.customName,
status:this.listStatus,
shopId:uni.getStorageSync('shopId')
}
}else if(this.listStatus == '4'){
data = {
pageVo: {
pageSize: 15,
pageNumber: this.page
},
fromWhere:'2',
timeOrder:this.timeOrder,
startTime:this.range[0],
endTime:this.range[1],
searchStr:this.customName,
status:'4',
shopId:uni.getStorageSync('shopId')
}
}else if(this.listStatus == '0'){
data = {
pageVo: {
pageSize: 15,
pageNumber: this.page
},
fromWhere:'0',
timeOrder:this.timeOrder,
startTime:this.range[0],
endTime:this.range[1],
searchStr:this.customName,
distributionFlag:'0',
shopId:uni.getStorageSync('shopId')
}
}else if(this.listStatus == '1'){
data = {
pageVo: {
pageSize: 15,
pageNumber: this.page
},
fromWhere:'0',
timeOrder:this.timeOrder,
startTime:this.range[0],
endTime:this.range[1],
searchStr:this.customName,
distributionFlag:'1',
shopId:uni.getStorageSync('shopId')
}
}else{
data = {
pageVo: {
pageSize: 15,
pageNumber: this.page
},
fromWhere:'2',
timeOrder:this.timeOrder,
startTime:this.range[0],
endTime:this.range[1],
searchStr:this.customName,
shopId:uni.getStorageSync('shopId')
}
}
this.status = 'loading';
this.tui.request("/app/sale/listPages", "POST", data, false, false).then((res) => {
this.status = 'nomore';
if (res.code == 200) {
if (this.page == 1) {
this.inventoryList = res.result.records
} else {
this.inventoryList = [...this.inventoryList, ...res.result.records]
}
// this.customName = ""
this.totalPages = res.result.pages
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
isEditOrDel(item){
this.checkId = item
this.$refs.editLablePopup.open()
},
editLable(){
let that = this;
that.isEdit = true
this.$refs.editLablePopup.close()
that.$refs.lablePopup.open()
that.lableText = that.checkId.lableContent
that.checkColor = that.checkId.lableColor
for(let i=0;i<that.colorList.length;i++){
if(that.checkId.lableColor == that.colorList[i].name){
that.colorList[i].checked = true
}
}
},
delOrderLable(index,index1){
let that = this;
uni.showModal({
title: "提示",
content: '确定要删除该标签吗?',
success: function(res) {
if (res.confirm) {
that.orderIndex = index
for(let i=0;i<that.inventoryList[index].lableList.length;i++){
if(i != index1){
that.signIndex.push(that.inventoryList[index].lableList[i].id)
}
}
that.confirmLable()
}
}
})
},
clickLable(index){
if(this.isAddLableBtn)return
this.signList[index].checked = !this.signList[index].checked
if(this.signList[index].checked){
if(this.signList[index].checked && this.signIndex.length == 2){
uni.showToast({
duration: 1000,
title: "标签最多只能选择2个",
mask: true,
icon: 'none'
})
this.signList[index].checked = false
}else{
this.signIndex.push(this.signList[index].id)
}
}else{
this.signIndex.splice(this.signIndex.indexOf(this.signList[index].id),1)
}
},
confirmLable(){
let that = this;
uni.showLoading({
title: '加载中...',
mask: true
})
this.tui.request("/app/saleLable/batchSaveSaleLable","post", {
saleId:this.inventoryList[this.orderIndex].id,
lableIds:this.signIndex == ''?null:this.signIndex
}, false, true).then((res) => {
if (res.code == 200) {
this.inventoryList[this.orderIndex].lableList = []
let LinSiList = []
for(let m=0;m<this.signList.length;m++){
this.signList[m].checked = false
for(let i=0;i<this.signIndex.length;i++){
if(this.signIndex[i] == this.signList[m].id){
LinSiList.push(this.signList[m])
}
}
}
setTimeout(res=>{
uni.hideLoading()
that.inventoryList[that.orderIndex].lableList = LinSiList
that.signIndex = []
that.$refs.signPopup.close()
},300)
} else {
uni.hideLoading()
this.tui.toast(res.message)
}
}).catch((res) => {
uni.hideLoading()
})
},
delLable(){
let that = this;
this.$refs.editLablePopup.close()
uni.showModal({
title: "提示",
content: '确定要删除该标签吗?',
success: function(res) {
if (res.confirm) {
that.tui.request("/app/lable/deleteLable","post", {
id:that.checkId.id
}, false, true).then((res) => {
if (res.code == 200) {
that.clearCheck()
that.getLableList()
uni.showToast({
duration: 1000,
title: "删除成功",
mask: true
})
} else {
that.clearCheck()
that.tui.toast(res.message)
}
}).catch((res) => {})
}
}
})
},
getLableList(){
this.tui.request("/app/lable/getLableListByShopId","post", {
shopId:uni.getStorageSync('shopId')
}, false, true).then((res) => {
if (res.code == 200) {
for(let i=0;i<res.result.length;i++){
res.result[i].checked = false
}
this.signList = res.result
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
changeAddLable(e){
if(e.show == false){
this.clearCheck()
this.clickNewLable()
}
},
addLable(){
if(this.lableText == '' || this.checkColor == '')return
let data = {}
if(this.checkId == undefined || this.checkId == ''){
data = {
shopId:uni.getStorageSync('shopId'),
shopName:uni.getStorageSync('shopName'),
lableContent:this.lableText,
lableColor:this.checkColor
}
}else{
data = {
id: this.checkId.id,
shopId:uni.getStorageSync('shopId'),
shopName:uni.getStorageSync('shopName'),
lableContent:this.lableText,
lableColor:this.checkColor
}
}
this.tui.request("/app/lable/saveOrEditLable","post", data, false, false).then((res2) => {
if (res2.code == 200) {
this.clearCheck()
this.clickNewLable()
this.getLableList()
} else {
this.clearCheck()
this.tui.toast(res.message)
}
}).catch((res) => {
this.clearCheck()
})
},
//清空新增标签的选中
clearCheck(){
this.lableText = ''
this.checkColor = ''
this.checkId = ''
this.isEdit = false
this.$refs.lablePopup.close()
},
//选择颜色
clickNewLable(index){
let that = this;
for(let i = 0;i<this.colorList.length;i++){
this.colorList[i].checked = false
}
if(typeof(index) == 'number'){
that.colorList[index].checked = true
that.checkColor = that.colorList[index].name
}
},
//跳转开单页
goKaiDan(){
uni.navigateTo({
url: '/package2/inventory/goodsList1HENG'
})
},
searchList(e) {
if(e.length<1){
this.range = []
}
},
openPopup(index){
if(typeof(index) == 'string'){
this.isAddLableBtn = true
}else{
this.isAddLableBtn = false
}
if(typeof(index) == 'number'){
if(this.inventoryList[index].lableList != null){
for(let i=0;i<this.inventoryList[index].lableList.length;i++){
let id = this.inventoryList[index].lableList[i].id
this.signIndex.push(id)
for(let m=0;m<this.signList.length;m++){
if(id == this.signList[m].id){
this.signList[m].checked = true
}
}
}
}
this.orderIndex = index
}
this.$refs.signPopup.open()
},
clearSearch(){
this.range = []
this.customName = ""
this.listStatus = ""
}
},
}
</script>
<style lang="scss">
page{
font-size: 21px;
}
.top-btn{
height: 40px;
line-height: 40px;
border-radius: 10px;
padding: 0 15px;
// color: #088FEB;
color: #fff;
margin: 5px 10px;
// border: 1px solid #777;
background: #088FEB;
}
.table{
display: flex;
height: auto;
overflow-x: scroll;
width: 100%;
white-space: nowrap;
}
.table-content{
flex: 0 0 auto;
overflow-x: scroll;
padding-bottom:20px;
}
.table-th{
width: 100%;
height: 40px;
line-height: 40px;
background: #088FEB;
color: #fff;
view{
width: 130px;
float: left;
text-align: center;
border-right: 1px solid #fff;
}
}
.table-tr{
flex: 0 0 auto;
width: 100%;
height: 40px;
position: relative;
line-height: 40px;
color: #000;
view{
width: 130px;
height: 40px;
float: left;
text-align: center;
border-bottom: 1px solid #000;
border-right: 1px solid #000;
}
}
.book-mask {
z-index: 99;
position: absolute;
top: 108px;
left: 510px;
width: 200px;
max-height: 200px;
overflow: scroll;
background: #fff;
padding: 10rpx;
border-radius: 5px;
border: 1px solid #e5e5e5;
}
.sign-popup {
width: 250px;
height: auto;
max-height: 450px;
overflow: scroll;
background: #fff;
border-radius: 10px;
position: relative;
margin-bottom: 20px;
}
.uni-data-select {
width: 75%;
text-align: center;
}
.uni-stat__select {
height: 50px;
border: 1px solid #eee;
}
.uni-select__selector-empty, .uni-select__selector-item {
display: flex;
cursor: pointer;
height:50px;
line-height: 50px !important;
font-size: 21px !important;
text-align: center;
padding: 0px 10px;
}
.uni-select {
border: none !important;
border-radius: 0 !important;
height: 40px !important;
padding-left: 0 !important;
}
.uni-select__input-placeholder {
color: #6a6a6a;
font-size: 21px !important;
width: 400rpx;
}
.uni-select__input-text {
font-size: 21px !important;
}
.uni-date__x-input {
height: 40rpx !important;
line-height: 40rpx !important;
font-size: 21px !important;
}
.uni-date-x .range-separator {
height: 40px !important;
line-height: 40px !important;
font-size: 21px !important;
}
.uni-icons {
font-size: 30px !important;
}
.empty-text,.kk-btn-wrap view,.kk-devices-item view{
font-size: 21px !important;
}
.kk-modal{
width: 400px !important;
height: 500px !important;
padding: 20px !important;
}
.operate-btn{
padding: 0 5px;
color: #fff;
border-radius: 5px;
height: 34px;
line-height: 34px;
margin: 0 0 0 10px;
display: inline-block;
}
.uni-calendar__weeks-day-text {
font-size:21px;
}
.color-box{
display: flex;
padding: 0 5px;
height: 50px;
line-height: 50px;
}
.color-piece{
width: 30px;
height: 30px;
margin-top: 10px;
}
.uni-calendar-item__weeks-box-text,.uni-calendar__weeks-day-text,.uni-calendar__header-text{
font-size: 21px !important;
}
.uni-calendar-item__weeks-box-item,.uni-calendar__header-btn-box {
width: 50px !important;
height: 50px !important;
}
.uni-calendar__weeks-day {
height: 50px !important;
}
</style>