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.
5632 lines
224 KiB
5632 lines
224 KiB
<template>
|
|
<view class="container">
|
|
<cmd-nav-bar iconOne="chevron-left" @iconOne="goToInfo" :title="shopName" background-color="#fff"></cmd-nav-bar>
|
|
<view v-if="sales.status == '2' && isShare==true"
|
|
style="width: 100%;height: 100%;position: fixed;top:0;text-align:center;padding-top:40%;z-index: 999;background: #fff;">
|
|
该笔订单已被撤销,无法查看
|
|
</view>
|
|
<view v-if="enDayShow" @tap="bigFWHPic" style="width:100%;height:60rpx;margin-top:180rpx;">
|
|
<u-notice-bar mode='horizontal' bgColor="#088FEB" color="#eee" :text="textArr"></u-notice-bar>
|
|
</view>
|
|
<view style="position: relative;" :style="{'margin-top':enDayShow?'0':'200rpx'}">
|
|
<uni-card v-if="sales.userName !='散客'"
|
|
:title="sales.userName == null ?'暂无':sales.userName+'('+(order.phone==undefined?'':order.phone)+')'">
|
|
<view class="uni-body">
|
|
{{sales.province== null?'':sales.province + sales.city== null?'':sales.city + sales.area== null?'':sales.area + sales.receiveAddress== null?'':sales.receiveAddress== null?'':sales.receiveAddress}}
|
|
</view>
|
|
</uni-card>
|
|
<uni-card v-else
|
|
:title="sales.userName == null ?'暂无':(shopId == '1863043415453863936')?'客户':sales.userName"
|
|
thumbnail="/static/images/dingdan/dd0.png">
|
|
</uni-card>
|
|
<button v-if="isShare ==false" open-type="share" @click.stop
|
|
style="font-size: 22rpx;position: absolute;top: 32rpx;right: 70rpx;background: blue;color: #fff;border-radius: 7px;">
|
|
分享
|
|
</button>
|
|
<button v-if="isShare ==false" @tap="getData()"
|
|
style="font-size: 22rpx;position: absolute;top: 32rpx;right: 200rpx;background: blue;color: #fff;border-radius: 7px;">
|
|
分享图片
|
|
</button>
|
|
<view v-if="isShare !=false && sales.status == '7'"
|
|
style="font-size: 32rpx;position: absolute;top: 40rpx;right: 60rpx;color:red">
|
|
该订单为挂单
|
|
</view>
|
|
</view>
|
|
<view class="tui-order-item boxbg">
|
|
<view style="display: flex;">
|
|
<view style="width: 70%;">
|
|
<view @tap="downloadImg"
|
|
style="width: 209rpx;height: 68rpx;color: #088FEB;line-height: 68rpx;text-align: center;">
|
|
一键下载商品图
|
|
</view>
|
|
</view>
|
|
<view style="text-align: right;padding-right: 20rpx;height: 60rpx;flex:1">
|
|
<!-- <radio @tap.stop="sizeHengFn" :checked="isSizeHeng"/>
|
|
<text>尺码横排</text>-->
|
|
<view style="width: 200rpx;">
|
|
<uni-data-select :clear="false" class="uni-data-select" :localdata="payTypeList"
|
|
v-model="payType1" placeholder="切换样式" @change="payTypeChange" style="width: 60%;">
|
|
</uni-data-select>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="content-box">
|
|
<view v-for="(item,index) in list" :key="index" class="shop-box" v-if="payType1 == '1'">
|
|
<view class="shop-name" style="position: relative;">
|
|
<img class="img-radius" @tap.stop="largeImg(item)" :src="item.productPicture" alt=""
|
|
style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;" v-if="item.productPicture">
|
|
<view class="noPic" v-else>暂无图片</view>
|
|
<view class="shop-productName">
|
|
<view style="color:#FF5809;">{{item.productName ? item.productName :''}}
|
|
({{item.productSn == null ? '暂无':item.productSn}})</view>
|
|
<view v-if="shopId != '1960543009070256129'">
|
|
单价:{{item.discountAmount == null ? '暂无':item.discountAmount}}
|
|
数量:{{item.productCount == null ? '暂无':item.productCount}}
|
|
总价:{{(item.productCount * item.discountAmount).toFixed(2)}}
|
|
</view>
|
|
<view v-else>
|
|
直播价:{{item.discountAmount == null ? '暂无':item.discountAmount}}
|
|
数量:{{item.productCount == null ? '暂无':item.productCount}}
|
|
总价:{{(item.productCount * item.discountAmount).toFixed(2)}}
|
|
</view>
|
|
<view v-if="item.supplierName !=undefined">
|
|
供应商:{{item.supplierName == null ? '暂无':item.supplierName}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-type">
|
|
<view class="shop-collapse" v-if="item1.productCount != 0"
|
|
v-for="(item1,index1) in item.stockLogList1" :key='index1'>
|
|
<text v-if="item1.isPurchasedBefore == 1&& sales.userName !='散客'"
|
|
style="display: inline-block;width:15%;">【补】</text>
|
|
<text
|
|
v-if="item1.isPurchasedBefore == 0 || (item1.isPurchasedBefore == 1&& sales.userName =='散客')"
|
|
style="display: inline-block;width:15%;">【销】</text>
|
|
<text style="display: inline-block;width:50%;">{{item1.attributeList | sliceMsg}}</text>
|
|
<text style="display: inline-block;width:35%;">数量:{{item1.productCount}}</text>
|
|
<!-- <u-number-box integer v-if="isReturn" :max="item1.productCount - " :min="0" -->
|
|
<u-number-box integer v-if="isReturn && item1.maxNum != 0" :max="item1.maxNum" :min="0"
|
|
v-model="item1.returnCount"></u-number-box>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view v-for="(item,index) in newData" :key="index" class="shop-box" v-if="payType1 == '2'"
|
|
style="border-top:5px solid #eee;">
|
|
<view>
|
|
<view style="color:#FF5809;height: 50rpx;line-height: 50rpx;">
|
|
<view style="width: 50%;text-align:center;float: left;">
|
|
{{item.productSn == null ? '暂无':item.productSn}}({{item.productName ? item.productName :''}})
|
|
</view>
|
|
<view style="width: 50%;text-align:center;float: left;">
|
|
数量:{{item.productCount == null ? '暂无':item.productCount}}
|
|
</view>
|
|
</view>
|
|
|
|
<view style="border-bottom: 1px solid #eee;padding-bottom: 10rpx;height: 50rpx;line-height: 50rpx;">
|
|
<view v-if="shopId != '1960543009070256129'" style="width: 50%;text-align:center;float: left;">
|
|
单价:{{item.discountAmount == null ? '暂无':item.discountAmount}}
|
|
</view>
|
|
<view v-else style="width: 50%;text-align:center;float: left;">
|
|
直播价:{{item.discountAmount == null ? '暂无':item.discountAmount}}
|
|
</view>
|
|
<view style="width: 50%;text-align:center;float: left;">
|
|
总价:{{(item.productCount * item.discountAmount).toFixed(2)}}
|
|
</view>
|
|
|
|
|
|
</view>
|
|
</view>
|
|
<view class="shop-type" style="margin: 0 auto 20rpx;text-align: center;">
|
|
<view style="display: flex;height: 50rpx;line-height: 50rpx;border-bottom: 1px solid #eee;">
|
|
<view style="width: 200rpx;border-right: 1px solid #eee;border-left: 1px solid #eee;">颜色</view>
|
|
<view v-for="(item1,index1) in newData[index].sizeList" :key='index1' style="flex: 1;border-right: 1px solid #eee;">
|
|
<text v-if="shopId != '1820269107191353344' && shopId != '1810179818189361152'">
|
|
{{item1}}
|
|
</text>
|
|
<text v-else>
|
|
{{item1 | sliceJun}}
|
|
</text>
|
|
</view>
|
|
<!-- <view style="flex: 1;">数量</view> -->
|
|
</view>
|
|
<view :style="{color:value[0].indexOf('退') != -1?'red':'#000'}"
|
|
v-for="(value,key) in Array.from(newData[index].sizePrintList)" :key='key'
|
|
style="display: flex;height: 50rpx;line-height: 50rpx;border-bottom: 1px solid #eee;">
|
|
<view v-if="shopId != '1820269107191353344' && shopId != '1810179818189361152'"
|
|
style="width: 200rpx;border-right: 1px solid #eee;border-left: 1px solid #eee;">
|
|
{{value[0]}}
|
|
</view>
|
|
<view v-else style="width: 200rpx;border-right: 1px solid #eee;border-left: 1px solid #eee;">{{value[0] | sliceJun}}</view>
|
|
<view v-for="(item2,index2) in newData[index].sizeList" :key='index2' style="flex: 1;border-right: 1px solid #eee;">
|
|
<view>
|
|
{{(value[1].get(item2) == undefined || (value[1].get(item2) != undefined && value[1].get(item2).split(":")[0] == undefined))?'-' : value[1].get(item2).split(":")[0]}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view v-for="(item,index) in returnList" :key="index" v-if="payType1 == '1'">
|
|
<view class="shop-box" v-for="(item1,index1) in item.saleDetailDTOList" :key="index1">
|
|
<view class="shop-name" style="position: relative;">
|
|
<img class="img-radius" @tap.stop="largeImg(item1)" :src="item1.productPicture" alt=""
|
|
style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;"
|
|
v-if="item1.productPicture">
|
|
<view class="noPic" v-else>暂无图片</view>
|
|
<view class="shop-productName">
|
|
<view style="color:#000;">【退】{{item1.productName ? item1.productName :''}}
|
|
({{item1.productSn == null ? '暂无':item1.productSn}})
|
|
</view>
|
|
<view v-if="shopId != '1960543009070256129'">
|
|
单价:{{item1.discountAmount == null ? '暂无':item1.discountAmount}}
|
|
数量:{{item1.productCount == null ? '暂无':item1.productCount}}
|
|
总价:{{(item1.productCount * item1.discountAmount).toFixed(2)}}
|
|
</view>
|
|
<view v-else>
|
|
直播价:{{item1.discountAmount == null ? '暂无':item1.discountAmount}}
|
|
数量:{{item1.productCount == null ? '暂无':item1.productCount}}
|
|
总价:{{(item1.productCount * item1.discountAmount).toFixed(2)}}
|
|
</view>
|
|
<view v-if="item1.supplierName !=undefined">
|
|
供应商:{{item1.supplierName == null ? '暂无':item1.supplierName}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-type">
|
|
<view class="shop-collapse" v-if="item2.productCount != 0"
|
|
v-for="(item2,index2) in item1.stockLogList1" :key='index2'>
|
|
<text style="display: inline-block;width:15%;">【退】</text>
|
|
<text style="display: inline-block;width:50%;">{{item2.attributeList | sliceMsg}}</text>
|
|
<text style="display: inline-block;width:35%;">数量:{{item2.productCount}}</text>
|
|
<!-- <u-number-box integer v-if="isReturn" :max="item2.productCount - " :min="0" -->
|
|
<u-number-box integer v-if="isReturn && item2.maxNum != 0" :max="item2.maxNum" :min="0"
|
|
v-model="item2.returnCount"></u-number-box>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
<uni-table border stripe emptyText="暂无更多数据" v-if="payType1 == '0'">
|
|
<uni-tr style="background: #eee;">
|
|
<uni-th align="center" width="105" style="font-size: 11px">货号</uni-th>
|
|
<uni-th align="center" width="95" style="font-size: 11px">名称</uni-th>
|
|
<uni-th align="center" width="95" style="font-size: 11px">规格</uni-th>
|
|
<uni-th align="center" width="45" style="font-size: 11px">数量</uni-th>
|
|
<uni-th align="center" width="45" style="font-size: 11px" v-if="shopId != '1960543009070256129'">单价</uni-th>
|
|
<uni-th align="center" width="45" style="font-size: 11px" v-else>直播价</uni-th>
|
|
<uni-th align="center" width="65" style="font-size: 11px">小计</uni-th>
|
|
</uni-tr>
|
|
<uni-tr v-for="(item,index) in listHeng" :key="index">
|
|
<uni-td style="font-size: 11px" align="center" width="105"
|
|
:style="{color:item.productSn.indexOf('退') != -1?'red':'#000'}">
|
|
{{item.productSn == null ? '暂无':item.productSn}}
|
|
</uni-td>
|
|
<uni-td style="font-size: 11px" align="center"
|
|
width="95">{{item.productName == null ? '暂无':item.productName}}</uni-td>
|
|
<uni-td align="center" width="95">
|
|
{{item.attributeList | sliceMsg}}
|
|
</uni-td>
|
|
<uni-td style="font-size: 11px" align="center" width="45">{{item.productCount}}</uni-td>
|
|
<uni-td style="font-size: 11px" align="center"
|
|
width="45">{{item.discountAmount == null ? '暂无':item.discountAmount}}</uni-td>
|
|
<uni-td style="font-size: 11px" align="center"
|
|
width="65">{{(item.discountAmount * item.productCount).toFixed(2)}}</uni-td>
|
|
</uni-tr>
|
|
</uni-table>
|
|
</view>
|
|
<view class="tui-goods-info">
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20">
|
|
<view class="tui-flex-shrink">收款方式</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-price-large">
|
|
{{ sales.payType == null ?'暂无':sales.payType == 0 ?'现金收款':sales.payType == 1 ?'微信收款':sales.payType == 2 ?'支付宝收款':sales.payType == 3 ?'银行卡转账':sales.payType == 4 ?'收款码收款':'' }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" style="margin-top:20rpx;font-weight:bold;">
|
|
<view class="tui-flex-shrink">总件数</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-price-large">{{ sales.productCount == null ?'暂无':sales.productCount }}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" style="font-weight:bold;">
|
|
<view class="tui-flex-shrink">销售金额</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ sales.totalAmount == null ?'暂无':sales.totalAmount }}</view>
|
|
</view>
|
|
</view>
|
|
<view v-if="Math.abs(returnNum) > 0" class="tui-price-flex tui-size32 tui-pbtm20"
|
|
style="font-weight:bold;">
|
|
<view class="tui-flex-shrink">退货数量</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ returnNum == null ?'暂无':returnNum }}</view>
|
|
</view>
|
|
</view>
|
|
<view v-if="Math.abs(returnNum) > 0" class="tui-price-flex tui-size32 tui-pbtm20"
|
|
style="font-weight:bold;">
|
|
<view class="tui-flex-shrink">退货金额</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ returnPrice == null ?'暂无':returnPrice }}</view>
|
|
</view>
|
|
</view>
|
|
|
|
<!-- <view class="tui-price-flex tui-size32" v-if="userType == 0 && isDownKH == false">
|
|
<view class="tui-flex-shrink">总成本</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ sales.zongchengben == null ?'暂无':sales.zongchengben }}</view>
|
|
</view>
|
|
</view> -->
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="dealingsRecord.lastDebtAmount > 0">
|
|
<view class="tui-flex-shrink">之前欠款</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">
|
|
{{ dealingsRecord.lastDebtAmount == null ?'暂无':dealingsRecord.lastDebtAmount }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="dealingsRecord.lastDebtAmount < 0">
|
|
<view class="tui-flex-shrink">之前余额</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">
|
|
{{ dealingsRecord.lastDebtAmount == null ?'暂无':Math.abs(dealingsRecord.lastDebtAmount) }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20">
|
|
<view class="tui-flex-shrink">实收金额</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ sales.realAmount == null ?'暂无':sales.realAmount}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20">
|
|
<view class="tui-flex-shrink"></view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-price-large">
|
|
{{ sales.realAmount == null ?'暂无':sales.realAmount | convertToChineseNumeral1}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20">
|
|
<view class="tui-flex-shrink">已收金额</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ sales.alreadyEarn == null ?'暂无':sales.alreadyEarn}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20">
|
|
<view class="tui-flex-shrink"></view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-price-large">
|
|
{{ sales.alreadyEarn == null ?'暂无':sales.alreadyEarn | convertToChineseNumeral1 }}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="sales.balanceDeductionAmount > 0">
|
|
<view class="tui-flex-shrink">余额抵销售</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">
|
|
{{ sales.balanceDeductionAmount == null ?'暂无':sales.balanceDeductionAmount }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="sales.saleDeductionAmount > 0">
|
|
<view class="tui-flex-shrink">销售抵退货</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">
|
|
{{ sales.saleDeductionAmount == null ?'暂无':sales.saleDeductionAmount }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="sales.debtDeductionAmount > 0">
|
|
<view class="tui-flex-shrink">欠款抵退货</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">
|
|
{{ sales.debtDeductionAmount == null ?'暂无':sales.debtDeductionAmount }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="dealingsRecord.balanceDue >= 0">
|
|
<view class="tui-flex-shrink">累计欠款</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">
|
|
{{ dealingsRecord.balanceDue == null ?'':dealingsRecord.balanceDue }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="dealingsRecord.balanceDue < 0">
|
|
<view class="tui-flex-shrink">累计余额</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">
|
|
{{ dealingsRecord.balanceDue == null ?'':Math.abs(dealingsRecord.balanceDue) }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20">
|
|
<view class="tui-flex-shrink">其他费用</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ sales.otherExpense == null ?'暂无':sales.otherExpense}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20">
|
|
<view class="tui-flex-shrink">备注</view>
|
|
<view class="tui-goods-price">
|
|
<uni-tooltip :content="sales.remark == null ?'暂无':sales.remark" placement="left">
|
|
<view
|
|
style="font-size: 13px;width: 200px;height: 40rpx;overflow: hidden;text-align: right;">
|
|
{{ sales.remark == null ?'':sales.remark}}
|
|
</view>
|
|
<text style="color: blue;" v-if="sales.remark != null">查看更多</text>
|
|
</uni-tooltip>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="sales.noEarn >= 0">
|
|
<view class="tui-flex-shrink">本单欠款</view>
|
|
<view class="tui-goods-price tui-primary-color">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ sales.noEarn == null ?'暂无':sales.noEarn}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="sales.noEarn >= 0">
|
|
<view class="tui-flex-shrink"></view>
|
|
<view class="tui-goods-price tui-primary-color">
|
|
<view class="tui-price-large">
|
|
{{ sales.noEarn == null ?'暂无':sales.noEarn | convertToChineseNumeral1}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="sales.noEarn < 0">
|
|
<view class="tui-flex-shrink">本单余额</view>
|
|
<view class="tui-goods-price tui-primary-color">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ sales.noEarn == null ?'暂无':Math.abs(sales.noEarn)}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="sales.noEarn < 0">
|
|
<view class="tui-flex-shrink"></view>
|
|
<view class="tui-goods-price tui-primary-color">
|
|
<view class="tui-price-large">
|
|
{{ sales.noEarn == null ?'暂无':Math.abs(sales.noEarn) | convertToChineseNumeral1}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32 tui-pbtm20" v-if="isReturn">
|
|
<view class="tui-flex-shrink">退货金额</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-size-24">¥</view>
|
|
<view class="tui-price-large">{{ changeAmount}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32" v-if="editNoPrice">
|
|
<view class="tui-flex-shrink">还款金额</view>
|
|
<view class="tui-goods-price">
|
|
<view class="tui-price-large"><uni-easyinput type="digit" v-model="newEarn" trim="all"
|
|
@change="getNoPay" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32" v-if="isReturn">
|
|
<view class="tui-flex-shrink">平台取货</view>
|
|
<view class="tui-goods-price">
|
|
<uni-data-checkbox v-model="radio1" :localdata="sex"
|
|
@change="checkBoxChange"></uni-data-checkbox>
|
|
</view>
|
|
</view>
|
|
<!-- && orderByWorkerCandidates.length > 0 -->
|
|
<view class="tui-price-flex tui-size32" v-if="isReturn && radio1 == 0">
|
|
<view class="tui-flex-shrink">配送人员</view>
|
|
<view class="tui-goods-price">
|
|
<input type="text" v-model="lbgName.workerName" @tap.stop="goPopleList('lbgName')"
|
|
placeholder="可指定拉包工" disabled
|
|
style="height:75rpx;line-height:84rpx;border-bottom: 1px solid #088fe0;text-align: center;">
|
|
</view>
|
|
</view>
|
|
<view class="tui-price-flex tui-size32" v-if="isReturn && radio1 == 0">
|
|
<view class="tui-flex-shrink">取货地址</view>
|
|
<view class="tui-goods-price">
|
|
<input type="text" @input="changeAddress" placeholder="请输入取货地址"
|
|
style="height:75rpx;line-height:84rpx;border-bottom: 1px solid #088fe0;text-align: center;">
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-order-info boxbg" v-if="isgys">
|
|
<view class="tui-order-title">
|
|
物流信息
|
|
</view>
|
|
<view class="tui-order-content">
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">订单号:</view>
|
|
<view class="tui-item-content">{{ sales.id }}</view>
|
|
</view>
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">物流单:</view>
|
|
<!-- <view class="tui-item-content">{{ order.kdOrderId }}</view> -->
|
|
<image :show-menu-by-longpress="true" :src="orderXd.orderPicture" @tap="showImage"></image>
|
|
</view>
|
|
<view style="color:red">*长按图片可分享给您的客户</view>
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">创建时间:</view>
|
|
<view class="tui-item-content">{{ sales.createTime }}</view>
|
|
</view>
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">配送方式:</view>
|
|
<view class="tui-item-content">
|
|
{{ sales.transportType == 0 ? '物流' : sales.transportType == 1 ? '快递' : sales.transportType == 2 ? '自送' : sales.transportType == 3 ? '拼包':sales.transportType == null ? '暂无':'厢货' }}
|
|
</view>
|
|
</view>
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">配送公司:</view>
|
|
<view class="tui-item-content">
|
|
{{ sales.companyName == null ?'暂无':sales.companyName}} <text
|
|
style="color: blue;text-decoration-line: underline;"
|
|
@tap="makeCall(sales.companyPhone)">({{sales.companyPhone == null ?'':sales.companyPhone}})</text>
|
|
</view>
|
|
</view>
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">配送人员:</view>
|
|
<view class="tui-item-content">
|
|
{{orderXd.worker.workerName == null ?'暂无':orderXd.worker.workerName }} <text
|
|
style="color: blue;text-decoration-line: underline;" @tap="makeCall(orderXd.worker.mobile)">
|
|
({{orderXd.worker.mobile == null ?'暂无':orderXd.worker.mobile}})</text>
|
|
</view>
|
|
</view>
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">配送状态:</view>
|
|
<view class="tui-item-content">
|
|
{{sales.status == '0' ?'待抢单' :sales.status == '2' ?'作废' :sales.status == '1' ?'待取货' :sales.status == '3' ?'待送达' :sales.status == '4' ?'已完成' :sales.status == '5' ?'下游客户待退货' :sales.status == '00' ?'退货待抢单' :sales.status == '01' ?'退货待取货' :sales.status == '03' ?'退货待送达' :sales.status == '04' ?'待确认退货' :sales.status == '6' ?'待配货':sales.status == '8' ?'待物流上门':sales.status == '9' ?'已完成' :'挂单'}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="tui-order-info boxbg" v-if="isgys">
|
|
<view class="tui-order-title">
|
|
店铺信息
|
|
</view>
|
|
<view class="tui-order-content">
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">店铺地址:</view>
|
|
<view class="tui-item-content">{{ shopAddress }}</view>
|
|
</view>
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">店铺电话:</view>
|
|
<view class="tui-item-content">{{ shopOwnerPhone }}</view>
|
|
</view>
|
|
<view class="tui-order-flex">
|
|
<view class="tui-item-title">店铺备注:</view>
|
|
<view class="tui-item-content">{{ shopRemark1 }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<u-popup :show="popupShow" @close="close" @open="open" mode="bottom">
|
|
<view class="popupBox">
|
|
</view>
|
|
</u-popup>
|
|
<view class="tui-tabbar" v-if="isShare ==false">
|
|
<view class="tui-btn-mr" v-if="sales.status != 6 && sales.status != 2 && sales.status != '7'">
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'贴包单'"
|
|
@onPrint="onPrint"></kk-printer>
|
|
</view>
|
|
<view class="tui-btn-mr" v-if="sales.status != 6 && sales.status != 2 && sales.status != '7'">
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'打印小票'"
|
|
@onPrintSmall="onPrintSmall"></kk-printer>
|
|
<!-- <view @tap="onPrintSmallHeng">打印小票</view> -->
|
|
</view>
|
|
<view class="tui-btn-mr" @click="changePeiHuo" v-if="sales.status == '4' && shopName == '杰娜世家' && (sales.distributionFlag == null || sales.distributionFlag == '0')">确认配货</view>
|
|
<view class="tui-btn-mr" v-if="sales.status == '0' || sales.status == '1'" @click="cancelOrder('qxdd')">取消订单
|
|
</view>
|
|
<!-- 下面这个取消订单,只是名字叫取消订单,其实是挂单和待配货的删除 -->
|
|
<view class="tui-btn-mr" v-if="sales.status == '7'" @click="deleteOrder()">取消订单</view>
|
|
<view class="tui-btn-mr"
|
|
v-if="sales.status == '0' || sales.status == '1' || sales.status == '00' || sales.status == '01'"
|
|
@click="cancelOrder('qxps')">取消配送</view>
|
|
</view>
|
|
|
|
<!-- 弹出多图轮播 -->
|
|
<uni-popup ref="imgPopup" background-color="#fff">
|
|
<view class="showImg-box">
|
|
<swiper indicator-dots class="swiper-box" @change="lunbochange" circular autoplay
|
|
:current="swiperDotIndex">
|
|
<swiper-item v-for="(item, index) in bigImg" :key="index">
|
|
<view class="swiper-item">
|
|
<image mode='aspectFit' show-menu-by-longpress :src="item.productPicture" alt=""
|
|
style="width: 100%;height: 100%;border-radius: 10px;" />
|
|
</image>
|
|
</view>
|
|
</swiper-item>
|
|
</swiper>
|
|
</view>
|
|
</uni-popup>
|
|
<view style="width: 93%;margin: 0 auto;display: flex;">
|
|
<uqrcode v-if="qrArr.length > 0" :hide='true' ref="uqrcode" size="160" sizeUnit="rpx" canvas-id="qrcode"
|
|
:value="QrUrl">
|
|
</uqrcode>
|
|
|
|
<view v-for="(item,index) in newQRList" :key="index" v-if="newQRList.length > 0">
|
|
<image show-menu-by-longpress :src="item.path" alt=""
|
|
style="margin: 0 0 0 16rpx;width: 160rpx;height: 160rpx;" />
|
|
</image>
|
|
<view style="text-align: center;font-size: 24rpx;">{{qrArr[index].name}}</view>
|
|
</view>
|
|
</view>
|
|
<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 v-if="isSelfOrder == false"
|
|
style="width: 100%;height: 100%;position: fixed;top: 0;background: #fff;text-align: center;padding-top: 45%;z-index: 120;">
|
|
暂无查看权限
|
|
</view> -->
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import util from '@/components/kk-printer/utils/util.js';
|
|
import * as blesdk from '@/components/kk-printer/utils/bluetoolth.js';
|
|
import kkPrinter from '@/components/kk-printer/index.vue';
|
|
import gbk from '@/components/kk-printer/utils/printUtil-GBK.js';
|
|
import cmdNavBar from "@/components/cmd-nav-bar/cmd-nav-bar.vue";
|
|
|
|
import {
|
|
maskShopName,
|
|
maskPhone,
|
|
wxLogin
|
|
} from '@/utils/global.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: uni.getStorageSync('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'),
|
|
businessDistrictLevel:"",
|
|
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: [],
|
|
shopList: [],
|
|
returnList: [],
|
|
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', // 要生成的二维码值
|
|
}
|
|
},
|
|
components: {
|
|
kkPrinter,
|
|
cmdNavBar
|
|
},
|
|
computed: {
|
|
changeAmount() {
|
|
if (this.isReturn) {
|
|
let sum = 0
|
|
this.list.forEach(item1 => {
|
|
item1.stockLogList1.forEach(v => {
|
|
if (v.returnCount) {
|
|
sum = v.returnCount * item1.discountAmount + sum
|
|
}
|
|
});
|
|
})
|
|
this.sAmout = sum.toFixed(2) //临时存储退货信息,用于用户删除了输入框值后重新赋值
|
|
this.returnAmount = sum.toFixed(2)
|
|
return this.returnAmount
|
|
} else {
|
|
return 0
|
|
}
|
|
},
|
|
},
|
|
filters: {
|
|
sliceMsg(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
name += newObj[as] + '/'
|
|
}
|
|
}
|
|
return name;
|
|
},
|
|
sliceJun(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
name = val.replace(/均/g, '分')
|
|
}
|
|
if (name == '分') {
|
|
name = '分码'
|
|
}
|
|
return name;
|
|
},
|
|
maxNum(val) {
|
|
if (val >= 10) {
|
|
return 10
|
|
} else if (val < 0) {
|
|
return 0
|
|
}
|
|
},
|
|
// 金额转大写
|
|
convertToChineseNumeral1(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 onShareAppMessage() {
|
|
//禁止转发
|
|
// wx.updateShareMenu({
|
|
// isPrivateMessage: true,
|
|
// success () { },
|
|
// fail () {}
|
|
// })
|
|
let titleText = this.shopName + ' ' + this.sales.createTime.split(' ')[0] + '\n销售单'
|
|
const imageUrl = await this.senrPath()
|
|
return {
|
|
title: titleText,
|
|
imageUrl: imageUrl,
|
|
path: '/package1/index/orderDetail?popleType=khName&id=' + this.sales.id + '&shopId=' + uni
|
|
.getStorageSync('shopId') + '&shopName=' + this.shopName + '&shopOwnerPhone=' + this
|
|
.shopOwnerPhone + '&mini_program_openid=' + this.order.miniProgramOpenid + '&unionid=' + this.order
|
|
.unionid + '&official_account_openid=' + this.order.officialAccountOpenid + '&customId=' + this
|
|
.order.id + '&userId=' + this.order.userId
|
|
}
|
|
},
|
|
onShow() {
|
|
let that = this
|
|
// 初始化蓝牙模块
|
|
wx.openBluetoothAdapter({
|
|
mode: 'central'
|
|
})
|
|
uni.authorize({
|
|
scope: 'scope.writePhotosAlbum',
|
|
success() {
|
|
|
|
},
|
|
fail() {
|
|
this.tui.toast("您未授权,图片上传功能可能会出现错误")
|
|
}
|
|
})
|
|
if (this.isDownKH) {
|
|
this.getUserInfo()
|
|
}
|
|
if(uni.getStorageSync('shopName').indexOf('杰娜世家') != -1){
|
|
this.payType1 = "2"
|
|
}
|
|
this.lbgName = JSON.parse(JSON.stringify(this.lbgName))
|
|
},
|
|
onLoad(option) {
|
|
var that = this;
|
|
//isDownKH 是否为下游客户登录
|
|
if (option.shopId && option.shopId != uni.getStorageSync('shopId')) {
|
|
this.isDownKH = true
|
|
} else {
|
|
this.isSelfOrder = true
|
|
}
|
|
if (option.needPushMsg) {
|
|
this.needPushMsg = option.needPushMsg
|
|
}
|
|
this.saleId = option.id
|
|
this.userId = option.userId
|
|
this.customId = option.customId
|
|
this.isShare = option.shopId ? true : false
|
|
this.mini_program_openid = option.mini_program_openid
|
|
if (option.id != null && option.id != undefined && option.id != "") {
|
|
if (option.type == 'gys') {
|
|
this.type = option.type;
|
|
this.tui.request("/app/purchase/getPurchaseAllData", "post", {
|
|
id: option.id
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
this.isgys = false
|
|
this.sales = res.result.purchase
|
|
this.list = res.result.purchaseDetails
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
} else {
|
|
this.tui.request("/app/sale/get/" + option.id, "GET", {
|
|
customerId: this.customId
|
|
}, false, false).then((res) => {
|
|
if (res.code == 200 && res.result != null && res.result != undefined) {
|
|
|
|
if (res.result.sale.status == '2') {
|
|
that.tui.toast('该订单已撤销')
|
|
}
|
|
this.order = res.result.customer
|
|
|
|
if (this.isDownKH == true && res.result.customer.name != '散客') {
|
|
/*
|
|
微信登录判断开始
|
|
*/
|
|
this.contrastOpneId()
|
|
/*
|
|
微信登录判断结束
|
|
*/
|
|
}else if(res.result.customer.name == '散客'){
|
|
this.isSelfOrder = true
|
|
}
|
|
this.sales = res.result.sale
|
|
//推送开单通知
|
|
if (that.needPushMsg == 'true' && res.result.customer.officialAccountOpenid != null) {
|
|
let content = {
|
|
thing4: res.result.sale.shopName, //店铺名称
|
|
time3: res.result.sale.createTime, //充值时间
|
|
thing5: res.result.sale.userName, //顾客姓名
|
|
amount1: res.result.sale.totalAmount //充值金额
|
|
}
|
|
that.tui.request("/social/wechat/sendWechatTempMessage", "post", {
|
|
tempId: 'xAoOMfWdnT8pwfj_OOskJGKQHVU-8_AYwx1A5I5wBTM',
|
|
title: '新订单通知',
|
|
content: JSON.stringify(content),
|
|
pagePath: '/package1/index/orderDetail?popleType=khName&id=' + that
|
|
.sales.id + '&shopId=' + uni.getStorageSync('shopId') +
|
|
'&shopName=' + that.shopName + '&shopOwnerPhone=' + that
|
|
.shopOwnerPhone + '&mini_program_openid=' + that.order
|
|
.miniProgramOpenid + '&unionid=' + that.order.unionid +
|
|
'&official_account_openid=' + that.order.officialAccountOpenid +
|
|
'&customId=' + that.order.id + '&userId=' + that.order.userId,
|
|
upNewType: "",
|
|
userId: res.result.customer.userId,
|
|
categoryId: ""
|
|
}, false, false).then((res11) => {
|
|
if (res11.code == 200) {
|
|
|
|
} else {
|
|
that.tui.toast(res11.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
if (res.result.sale.status == "7") {
|
|
this.isShare = true
|
|
}
|
|
if (res.result.dealingsRecord != null) {
|
|
this.dealingsRecord = res.result.dealingsRecord
|
|
}
|
|
if(res.result.sale.discount != null && res.result.sale.discount<10){ //判断订单是否有折扣,整体折扣和单品折扣,都变为true
|
|
|
|
this.zhengtizhekou = true
|
|
}
|
|
this.list = res.result.saleDetailDTOList
|
|
this.getChildrenPic()
|
|
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(option.id)
|
|
|
|
} else {
|
|
if (res.code == 500 && res.message == 'java.lang.NullPointerException') {
|
|
this.tui.toast('该订单已撤销,无法查看')
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
|
|
}
|
|
}).catch((res) => {
|
|
|
|
})
|
|
}
|
|
}
|
|
this.shopOwnerPhone = option.shopOwnerPhone ? option.shopOwnerPhone : uni.getStorageSync('shopOwnerPhone')
|
|
this.shopId = (option.shopId != '' && option.shopId != undefined) ? option.shopId : (uni.getStorageSync(
|
|
'shopId') != '' && uni.getStorageSync('shopId') != undefined) ? uni.getStorageSync('shopId') : ""
|
|
this.shopName = option.shopName ? option.shopName : uni.getStorageSync('shopName')
|
|
uni.getSystemInfo({
|
|
success(res) {
|
|
that.deviceType = res.osName
|
|
|
|
}
|
|
})
|
|
uni.setNavigationBarTitle({
|
|
title: this.shopName
|
|
});
|
|
if (option.oneShareData) {
|
|
this.isShare = true
|
|
this.shopAddress = JSON.parse(option.oneShareData).shopAddress
|
|
this.shopMoblie = JSON.parse(option.oneShareData).shopMoblie || ''
|
|
} else {
|
|
this.analysisQrCode()
|
|
}
|
|
/* setTimeout(ress=>{
|
|
this.getData()
|
|
},4000) */
|
|
},
|
|
methods: {
|
|
// 金额转大写
|
|
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
|
|
},
|
|
//更新配货状态
|
|
changePeiHuo(){
|
|
let that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: '要将该订单状态改为配货完成吗?',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.tui.request("/app/sale/updateDistributionFlag","post", {
|
|
saleId:that.sales.id,
|
|
distributionFlag:'1'
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
duration: 1000,
|
|
title: "更改成功",
|
|
mask: true
|
|
})
|
|
setTimeout(res=>{
|
|
let pages = getCurrentPages();
|
|
let prevPage = pages[pages.length - 2];
|
|
for(let i=0;i<prevPage.$vm.inventoryList.length;i++){
|
|
if(prevPage.$vm.inventoryList[i].id == that.sales.id){
|
|
prevPage.$vm.inventoryList[i].distributionFlag = '1'
|
|
}
|
|
}
|
|
uni.navigateBack({
|
|
delta: 1
|
|
})
|
|
},1000)
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
}
|
|
})
|
|
},
|
|
async contrastOpneId() {
|
|
let openid1 = uni.getStorageSync('miniProgramOpenid')
|
|
let openid2 = this.mini_program_openid
|
|
|
|
if (openid1 != '' && openid1 != undefined && openid1 != null) {
|
|
if (openid2 != undefined && openid2 != "undefined" && openid2 != 'null' && openid2 != '' && openid2 !=
|
|
null) {
|
|
if (openid1 != openid2) {
|
|
//缓存和分享的openid不一致
|
|
// this.tui.toast('暂无查看权限', 1000)
|
|
// return
|
|
} else {
|
|
this.isSelfOrder = true
|
|
this.$forceUpdate()
|
|
}
|
|
} else {
|
|
//调接口传customId更新userid
|
|
this.updateUserId()
|
|
this.isSelfOrder = true
|
|
this.$forceUpdate()
|
|
}
|
|
} else {
|
|
if(!uni.getStorageSync('shopId')){
|
|
await this.getOpenId(this.customId, uni.getStorageSync('id') ? uni.getStorageSync('id') : this.userId)
|
|
}
|
|
openid1 = uni.getStorageSync('miniProgramOpenid')
|
|
if (openid2 != undefined && openid2 != "undefined" && openid2 != 'null' && openid2 != '' && openid2 != null) {
|
|
if (openid1 != openid2) {
|
|
//缓存和分享的openid不一致
|
|
// this.tui.toast('暂无查看权限', 1000)
|
|
// return
|
|
} else {
|
|
this.isSelfOrder = true
|
|
this.$forceUpdate()
|
|
}
|
|
} else {
|
|
//调接口传customId更新userid
|
|
this.updateUserId()
|
|
this.isSelfOrder = true
|
|
this.$forceUpdate()
|
|
}
|
|
}
|
|
},
|
|
updateUserId() {
|
|
this.tui.request("/app/customer/updateUserId", "post", {
|
|
customerId: this.customId,
|
|
userId: uni.getStorageSync('id')
|
|
}, false, true).then((res) => {
|
|
if (res.code != 200) {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
async getUserInfo() {
|
|
this.tui.request("/user/getUserInfo", "post", {
|
|
miniProgramOpenid: uni.getStorageSync('miniProgramOpenid')
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result.officialAccountOpenid == 'null' || res.result.officialAccountOpenid == null || res.result.officialAccountOpenid == undefined || res.result.officialAccountOpenid =='') {
|
|
this.enDayShow = true
|
|
} else {
|
|
uni.setStorageSync('officialAccountOpenid', res.result.officialAccountOpenid)
|
|
this.enDayShow = false
|
|
}
|
|
}
|
|
}).catch((err) => {
|
|
|
|
})
|
|
},
|
|
//获取小程序openid
|
|
getOpenId(customId, userId) {
|
|
let that = this;
|
|
return new Promise((resolve, reject) => {
|
|
uni.login({
|
|
provider: 'weixin',
|
|
success(res) {
|
|
uni.getUserInfo({
|
|
provider: 'weixin',
|
|
success: function(infoRes) {
|
|
|
|
that.tui.request("/user/login", "post", {
|
|
jsCode: res.code,
|
|
customId: customId,
|
|
userId: userId,
|
|
wechatName: infoRes.userInfo.nickName,
|
|
userType: "2"
|
|
}, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
|
|
uni.setStorageSync("hiver_token", res
|
|
.result.accessToken)
|
|
uni.setStorageSync("wayValue", "2")
|
|
uni.setStorageSync("nickname", res.result
|
|
.user.nickname)
|
|
uni.setStorageSync("id", res.result.user
|
|
.id)
|
|
uni.setStorageSync('unionid', res.result
|
|
.user.unionid)
|
|
uni.setStorageSync('miniProgramOpenid', res
|
|
.result.user
|
|
.miniProgramOpenid)
|
|
uni.setStorageSync('officialAccountOpenid',
|
|
res.result.user
|
|
.officialAccountOpenid)
|
|
|
|
if((res.result.user.officialAccountOpenid == 'null' || res.result.user.officialAccountOpenid == null || res.result.user.officialAccountOpenid == undefined || res.result.user.officialAccountOpenid == '') && this.order.name != '散客'){
|
|
that.enDayShow = true
|
|
that.$forceUpdate()
|
|
}
|
|
return resolve(res.result)
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
|
|
},
|
|
fail(err1) {
|
|
|
|
}
|
|
});
|
|
|
|
},
|
|
fail(err) {
|
|
|
|
}
|
|
});
|
|
});
|
|
|
|
},
|
|
// 展示二维码
|
|
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))
|
|
if(that.shopId == '1960543009070256129'){
|
|
ctx.fillText('直播价', that.returnRealSize(1875), that.returnRealSize(800))
|
|
}else{
|
|
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 == '1810179818189361152') && 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)
|
|
if(that.shopId == '1960543009070256129'){
|
|
ctx.fillText('直播价', that.returnRealSize(1950), dataheigth)
|
|
}else{
|
|
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 == '1810179818189361152') &&
|
|
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 == '1810179818189361152') {
|
|
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)
|
|
/* let qrarr = []
|
|
for(let k = 0;k<this.qrArr.length;i++)
|
|
if(that.shopId == '1848242501496999936' || that.shopId == '1811579958284390400'){
|
|
let data = {
|
|
name : '店铺微信',
|
|
path : 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/8e305338798c4152a89e3351eaf6c84e.png',
|
|
}
|
|
qrarr.push(data)
|
|
}else{
|
|
let data = {
|
|
name : '店铺微信',
|
|
path : 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/4280d25c885847ca9fc0cccbc936ad1a.png',
|
|
}
|
|
qrarr.push(data)
|
|
}
|
|
if(that.shopId == '1848242501496999936' || that.shopId == '1811579958284390400'){
|
|
let data1 = {
|
|
name : '微信收款码',
|
|
path : 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/3456337911cd4c759e4237da6aefaa01.png',
|
|
}
|
|
qrarr.push(data1)
|
|
}
|
|
if(that.shopId == '1848242501496999936' || that.shopId == '1811579958284390400'){
|
|
let data2 = {
|
|
name : '银行收款码',
|
|
path : 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/d3f594face1e432fb9b4a0e4fd8ed685.png',
|
|
}
|
|
qrarr.push(data2)
|
|
}else{
|
|
let data2 = {
|
|
name : '银行收款码',
|
|
path : 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/f34a7c8e2ba44f5dbc8d199d12b1d841.png',
|
|
}
|
|
qrarr.push(data2)
|
|
} */
|
|
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';
|
|
}
|
|
},
|
|
//切换样式
|
|
payTypeChange(e) {
|
|
for (let i = 0; i < this.payTypeList.length; i++) {
|
|
if (this.payTypeList[i].value == e) {
|
|
this.payType1 = e;
|
|
}
|
|
}
|
|
},
|
|
//传入组件的方法
|
|
hideQrcode() {
|
|
this.modal_qr = false;
|
|
},
|
|
//获取子图
|
|
getChildrenPic() {
|
|
let that = this;
|
|
for (let i = 0; i < that.list.length; i++) {
|
|
that.tui.request("/app/productPicture/getProductPictureByProductId", "POST", {
|
|
productId: that.list[i].productId,
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
that.list[i].productPictures = []
|
|
for (let m = 0; m < res.result.length; m++) {
|
|
let data = {
|
|
productPicture: res.result[m].productPicture
|
|
}
|
|
that.list[i].productPictures.push(data)
|
|
}
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
}
|
|
|
|
},
|
|
largeImg(img) {
|
|
if ((img.productPicture == null && img.productPictures == null) || (img.productPicture == '' && img
|
|
.productPictures == null)) {
|
|
this.tui.toast("暂无可展示的图片", 300)
|
|
return
|
|
}
|
|
this.bigImg = []
|
|
if (img.productPicture != null) {
|
|
let data = {
|
|
productPicture: img.productPicture
|
|
}
|
|
this.bigImg.push(data)
|
|
}
|
|
if (img.productPictures != null) {
|
|
for (let i = 0; i < img.productPictures.length; i++) {
|
|
this.bigImg.push(img.productPictures[i])
|
|
}
|
|
}
|
|
this.$refs.imgPopup.open()
|
|
},
|
|
lunbochange(e) {
|
|
this.current = e.detail.current
|
|
},
|
|
//打印小票二维码,分割二维码字符串
|
|
analysisQrCode() {
|
|
let that = this;
|
|
that.tui.request("/app/shop/getShopInfoById", "post", {
|
|
id: this.shopId,
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
// 客户上传的二维码走这里
|
|
// 判断res.result.shopIcon.indexOf('@_@') != -1
|
|
// 通过@_@符号区分,拿到二维码后,通过下面的方法处理试试行不行
|
|
/* x: 文字方块左上角X座标,单位dot
|
|
y: 文字方块左上角Y座标,单位dot
|
|
data{
|
|
threshold,// 0/1提取的灰度级
|
|
width,//图像宽度
|
|
height,//图像高度
|
|
imageData , //图像数据
|
|
}
|
|
*/
|
|
// blesdk.addCPCLImageCmd(x,y,data)
|
|
// uni.downloadFile({
|
|
// url: imgA,
|
|
// success: (res2) => {
|
|
|
|
// }
|
|
// });
|
|
|
|
// end
|
|
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
|
|
// businessDistrictLevel值为"1"时,是新款长机头打印机
|
|
this.businessDistrictLevel = res.result.businessDistrictLevel
|
|
this.jinjuPhone = res.result.contactPhone
|
|
let qrCode = res.result.shopIcon
|
|
// let qrCode =
|
|
// '田一@_@https://u.wechat.com/EOzom56XQ_1MKeVPPqgwMlI?uVsMiaUpfpOk8MxSE19t4ao0TCVrd'
|
|
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
|
|
let scale = 0
|
|
uni.getSystemInfo({
|
|
success(res) {
|
|
scale = res.devicePixelRatio
|
|
}
|
|
})
|
|
if (this.printingMethod == '1') {
|
|
if (that.shopId == '1822829636942434305' || that.shopId ==
|
|
'1810179818189361152') {
|
|
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)
|
|
|
|
},
|
|
fail: err => {
|
|
|
|
}
|
|
});
|
|
}, 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
|
|
},
|
|
|
|
getPrintWidth(width,add){
|
|
return Number(width) + add
|
|
},
|
|
//打印小票
|
|
onPrintSmall() {
|
|
let that = this;
|
|
let strCmd = ''
|
|
let pageNum = 1
|
|
let Xindex = 0
|
|
let xNum = 0
|
|
if(this.businessDistrictLevel == "1"){
|
|
xNum = 30
|
|
}
|
|
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 == '1810179818189361152') {
|
|
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(that.getPrintWidth('500',xNum) , '250', '24', '0', 0, '收款方式:' + orderPayType)
|
|
}
|
|
if (this.shopName == '杰娜世家' || this.shopName == '老早测试') {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , '250', '24', '0', 0, '客户地址:' + that.order.address)
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , '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(that.getPrintWidth('500',xNum) , '300', '24', '0', 0, '单号:' + that.sales.id)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , '350', '24', '0', 0, '销售员:' + that.sales.createByName)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('500',xNum) , '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(that.getPrintWidth('0',xNum) , '390', '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('10',xNum) , that.yNum += 40, '24', '0', 0, '货号(名称)')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, '规格')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, '数量')
|
|
if(this.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, '折扣')
|
|
}
|
|
if(that.shopId == '1960543009070256129'){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, '直播价')
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, '单价')
|
|
}
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, '总价')
|
|
} else if (this.printingMethod == '2') {
|
|
that.yNum = 370
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , '370', '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('10',xNum) , that.yNum += 40, '24', '0', 0, '货号(名称)')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, '数量')
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('510',xNum) , that.yNum, '24', '0', 0, '折扣')
|
|
if(that.shopId == '1960543009070256129'){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('600',xNum) , that.yNum, '24', '0', 0, '直播价')
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('600',xNum) , that.yNum, '24', '0', 0, '单价')
|
|
}
|
|
|
|
}else{
|
|
if(that.shopId == '1960543009070256129'){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('575',xNum) , that.yNum, '24', '0', 0, '直播价')
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('575',xNum) , that.yNum, '24', '0', 0, '单价')
|
|
}
|
|
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , that.yNum, '24', '0', 0, '总价')
|
|
}
|
|
|
|
|
|
if(this.shopId == '1843114735801864192' || this.shopId == '1810179818189361152'){
|
|
let colorHeight = 25
|
|
//华秀家的退货商品单独显示在最下面
|
|
for (var i = 0; i < that.newData.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++
|
|
|
|
for (var m = 0; m < that.newData[i].stockLogList1.length; m++) {
|
|
if(that.newData[i].stockLogList1[m].isReturn != true){
|
|
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].productName == that.newData[i].productSn && that.order.name !=
|
|
'散客') {
|
|
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1) { //买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【补】' + that
|
|
.newData[i].productSn)
|
|
} else { // 0是没买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【销】' + that
|
|
.newData[i].productSn + '(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
}
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.discountAmount * that.newData[i].stockLogList1[m].productCount))
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
if (that.newData[i].productName == that.newData[i].productSn && that.order.name !=
|
|
'散客') {
|
|
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1) { //买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【补】' + that
|
|
.newData[i].productSn)
|
|
} else { // 0是没买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【销】' + that
|
|
.newData[i].productSn + '(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
}
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , 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.newData[i].stockLogList1[m].isReturn != true){
|
|
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(that.getPrintWidth('0',xNum) , that.yNum += colorHeight, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
}
|
|
|
|
} else {
|
|
if (this.printingMethod != '2') {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += colorHeight, '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++
|
|
|
|
if (that.newData[i].productName == that.newData[i].productSn) {
|
|
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order
|
|
.name !=
|
|
'散客') { //买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【补】' + that
|
|
.newData[i].productSn)
|
|
} else { // 0是没买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【销】' + that
|
|
.newData[i].productSn + '(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
}
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.discountAmount * that.newData[i].stockLogList1[m].productCount))
|
|
}
|
|
} else {
|
|
|
|
if (that.newData[i].productName == that.newData[i].productSn) {
|
|
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order
|
|
.name !=
|
|
'散客') { //买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【补】' + that
|
|
.newData[i].productSn)
|
|
} else { // 0是没买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【销】' + that
|
|
.newData[i].productSn + '(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
}
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.discountAmount * that.newData[i].stockLogList1[m].productCount))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if(that.sales.productCount > 0){
|
|
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(that.getPrintWidth('0',xNum) , that.yNum += colorHeight, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
}
|
|
|
|
} else {
|
|
if (this.printingMethod != '2') {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += colorHeight, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
}
|
|
}
|
|
|
|
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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, '销售合计:')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, that.sales.productCount + '件')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, '销售合计:')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, that.sales.productCount + '件')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
|
|
}
|
|
}
|
|
|
|
|
|
if(that.returnNum >0){
|
|
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(that.getPrintWidth('0',xNum) , that.yNum += colorHeight, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
}
|
|
|
|
} else {
|
|
if (this.printingMethod != '2') {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += colorHeight, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
for (var i = 0; i < that.newData.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++
|
|
|
|
for (var m = 0; m < that.newData[i].stockLogList1.length; m++) {
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
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].productName == that.newData[i].productSn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) +
|
|
'.' + '【退】' + that
|
|
.newData[i].productSn)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) +
|
|
'.' + '【退】' + that
|
|
.newData[i].productSn +
|
|
'(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) +
|
|
'.' + '【退】' + that
|
|
.newData[i].productSn)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) +
|
|
'.' + '【退】' + that
|
|
.newData[i].productSn +
|
|
'(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , 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.newData[i].stockLogList1[m].isReturn) {
|
|
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].productName == that.newData[i].productSn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【退】' + that
|
|
.newData[i].productSn)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【退】' + that
|
|
.newData[i].productSn +
|
|
'(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
}
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【退】' + that
|
|
.newData[i].productSn)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【退】' + that
|
|
.newData[i].productSn +
|
|
'(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
}
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.discountAmount * that.newData[i].stockLogList1[m].productCount))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}else{
|
|
for (var i = 0; i < that.newData.length; i++) {
|
|
let colorHeight = 25
|
|
if (that.shopId == '1822829636942434305' || that.shopId == '1810179818189361152') {
|
|
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(that.getPrintWidth('0',xNum) , that.yNum += colorHeight, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
}
|
|
|
|
} else {
|
|
if (this.printingMethod != '2') {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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 ==
|
|
'1810179818189361152') {
|
|
fountSize = '1'
|
|
}
|
|
if (that.newData[i].productName == that.newData[i].productSn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', fountSize, 0, that
|
|
.newData[i].productSn)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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 ==
|
|
'1810179818189361152') {
|
|
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 ==
|
|
'1810179818189361152') {
|
|
fountSize = '1'
|
|
colorHeight = 58
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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 == '1810179818189361152') && 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 ==
|
|
'1810179818189361152') {
|
|
fountSize = '1'
|
|
widthSize = 470
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(startWith.toString(),xNum) , 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(that.getPrintWidth('562',xNum) , that.yNum, '24', fountSize, 0, '数量')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('628',xNum) , that.yNum, '24', fountSize, 0, '折扣')
|
|
if(that.shopId == '1960543009070256129'){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('694',xNum) , that.yNum, '24', fountSize, 0, '直播价')
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('694',xNum) , that.yNum, '24', fountSize, 0, '单价')
|
|
}
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('770',xNum) , that.yNum, '24', fountSize, 0, '总价')
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('578',xNum) , that.yNum, '24', fountSize, 0, '数量')
|
|
if(that.shopId == '1960543009070256129'){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('644',xNum) , that.yNum, '24', fountSize, 0, '直播价')
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('644',xNum) , that.yNum, '24', fountSize, 0, '单价')
|
|
}
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('720',xNum) , that.yNum, '24', fountSize, 0, '总价')
|
|
}
|
|
let begin = 0
|
|
that.newData[i].sizePrintList.forEach(function(value, key) {
|
|
colorHeight = 64
|
|
if (that.shopId == '1822829636942434305' || that.shopId ==
|
|
'1810179818189361152') {
|
|
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 ==
|
|
'1810179818189361152') && key == '均色') {
|
|
key = '分色'
|
|
}
|
|
let beginHeight = 40
|
|
let widthSize = 420
|
|
let fountSize = '0'
|
|
if ((that.shopId == '1822829636942434305' || that.shopId ==
|
|
'1810179818189361152')) {
|
|
beginHeight = 58
|
|
}
|
|
begin++
|
|
if (that.shopId == '1822829636942434305' || that.shopId ==
|
|
'1810179818189361152') {
|
|
fountSize = '1'
|
|
widthSize = 470
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth(childStartWith.toString(),xNum) , that.yNum, '24', fountSize,
|
|
0, printSizeCount[0] == undefined ? '' : Number(printSizeCount[0]))
|
|
childStartWith += Math.floor(widthSize / 8)
|
|
}
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('562',xNum) , that.yNum, '24', fountSize, 0, allCount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('628',xNum) , that.yNum, '24', fountSize, 0, that.newData[i].printDiscount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('694',xNum) , that.yNum, '24', fountSize, 0, discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('770',xNum) , that.yNum, '24', fountSize, 0, (allCount *
|
|
discountAmount))
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('578',xNum) , that.yNum, '24', fountSize, 0, allCount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('644',xNum) , that.yNum, '24', fountSize, 0, discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('720',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【销】' + that.newData[i].productSn)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, buyCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('510',xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('600',xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('575',xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , that.yNum, '24', '0', 0, buyCount * that.newData[i]
|
|
.discountAmount)
|
|
} else {
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【销】' + that.newData[i].productSn + '(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, buyCount)
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('510',xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('600',xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('575',xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【退】' + that.newData[i].productSn)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, returnCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('510',xNum) , that.yNum, '24', '0', 0, "")
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('600',xNum) , that.yNum, '24', '0', 0, returnPrice)
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('575',xNum) , that.yNum, '24', '0', 0, returnPrice)
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , that.yNum, '24', '0', 0, returnCount * returnPrice)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【退】' + that.newData[i].productSn + '(' + (that.newData[i]
|
|
.productName == null ? '' : that.newData[i].productName) + ')')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, returnCount)
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('510',xNum) , that.yNum, '24', '0', 0, "")
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('600',xNum) , that.yNum, '24', '0', 0, returnPrice)
|
|
}else{
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('575',xNum) , that.yNum, '24', '0', 0, returnPrice)
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) +
|
|
'.' + '【退】' + that
|
|
.newData[i].productSn)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【补】' + that
|
|
.newData[i].productSn)
|
|
} else { // 0是没买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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 == '1810179818189361152') {
|
|
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(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) +
|
|
'.' + '【退】' + that
|
|
.newData[i].productSn)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【补】' + that
|
|
.newData[i].productSn)
|
|
} else { // 0是没买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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 == '1810179818189361152') {
|
|
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(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【退】' + that
|
|
.newData[i].productSn)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【补】' + that
|
|
.newData[i].productSn)
|
|
} else { // 0是没买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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 == '1810179818189361152') {
|
|
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(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【退】' + that
|
|
.newData[i].productSn)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, (Xindex +=
|
|
1) + '.' + '【补】' + that
|
|
.newData[i].productSn)
|
|
} else { // 0是没买过
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , 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 == '1810179818189361152') {
|
|
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(that.getPrintWidth(guige,xNum) , that.yNum, '24', '0', 0, that
|
|
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
|
|
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(shuliang,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].productCount)
|
|
|
|
if(that.zhengtizhekou){
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zhekou,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.printDiscount)
|
|
}
|
|
if (that.newData[i].stockLogList1[m].isReturn) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.stockLogList1[m].discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , that.yNum, '24', '0', 0, (that.newData[i]
|
|
.stockLogList1[m].discountAmount * that.newData[i].stockLogList1[m]
|
|
.productCount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(danjia,xNum) , that.yNum, '24', '0', 0, that.newData[i]
|
|
.discountAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(zongjia,xNum) , 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 ==
|
|
'1810179818189361152') {
|
|
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(that.getPrintWidth('0',xNum) , that.yNum += lineSize, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '销售数量:' + that.sales.productCount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
|
|
// strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
|
|
.balanceDeductionAmount))
|
|
// strCmd += blesdk.addCPCLText(that.getPrintWidth(,xNum) '600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
|
|
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '销售数量:' + that.sales.productCount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
|
|
// strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
|
|
.balanceDeductionAmount))
|
|
// strCmd += blesdk.addCPCLText(that.getPrintWidth(,xNum) '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(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '退货数量:' + that.returnNum)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '退货数量:' + that.returnNum)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '欠款抵退货:' + that.sales
|
|
.debtDeductionAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
|
|
.saleDeductionAmount)
|
|
strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
if (that.dealingsRecord.lastDebtAmount >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '之前欠款:' + that.dealingsRecord
|
|
.lastDebtAmount)
|
|
} else if (that.dealingsRecord.lastDebtAmount < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '之前余额:' + Math.abs(that
|
|
.dealingsRecord
|
|
.lastDebtAmount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '之前欠款:0')
|
|
}
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '欠款抵退货:' + that.sales
|
|
.debtDeductionAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
|
|
.saleDeductionAmount)
|
|
// strCmd += blesdk.addCPCLText(that.getPrintWidth(,xNum) '610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
|
|
// .balanceDeductionAmount))
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
if (that.dealingsRecord.lastDebtAmount >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , (that.yNum), '24', '0', 0, '之前欠款:' + that.dealingsRecord
|
|
.lastDebtAmount)
|
|
} else if (that.dealingsRecord.lastDebtAmount < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , (that.yNum), '24', '0', 0, '之前余额:' + Math.abs(that
|
|
.dealingsRecord
|
|
.lastDebtAmount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , (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(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单应收:' + that.sales.realAmount)
|
|
if (that.sales.noEarn >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '本单余额:' + Math.abs(that.sales
|
|
.noEarn))
|
|
}
|
|
if (that.dealingsRecord.balanceDue >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
|
|
.balanceDue)
|
|
} else if (that.dealingsRecord.balanceDue < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
|
|
.dealingsRecord.balanceDue))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '累计欠款:0')
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单应收:' + that.sales.realAmount)
|
|
if (that.sales.noEarn >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '本单余额:' + Math.abs(that.sales
|
|
.noEarn))
|
|
}
|
|
if (that.dealingsRecord.balanceDue >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
|
|
.balanceDue)
|
|
} else if (that.dealingsRecord.balanceDue < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
|
|
.dealingsRecord.balanceDue))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , 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(that.getPrintWidth('580',xNum) , that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
|
|
.alreadyEarn)
|
|
} else {
|
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, '合计:')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('520',xNum) , that.yNum, '24', '0', 0, that.sales.productCount + '件')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('700',xNum) , that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, '合计:')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('520',xNum) , that.yNum, '24', '0', 0, that.sales.productCount + '件')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('700',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '本单应收:' + that.sales.realAmount +
|
|
'(' + this.convertToChineseNumeral(that.sales.realAmount) + ')')
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
|
|
.alreadyEarn + '(' + this.convertToChineseNumeral(that.sales.alreadyEarn) + ')')
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '之前欠款:' + that.dealingsRecord
|
|
.lastDebtAmount)
|
|
} else if (that.dealingsRecord.lastDebtAmount < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '之前余额:' + Math.abs(that
|
|
.dealingsRecord
|
|
.lastDebtAmount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '之前欠款:0')
|
|
}
|
|
|
|
if (that.dealingsRecord.balanceDue >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('540',xNum) , that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
|
|
.balanceDue)
|
|
} else if (that.dealingsRecord.balanceDue < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('540',xNum) , that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
|
|
.dealingsRecord.balanceDue))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('540',xNum) , that.yNum, '24', '0', 0, '累计欠款:0')
|
|
}
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
if (that.dealingsRecord.lastDebtAmount >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , (that.yNum += 60), '24', '0', 0, '之前欠款:' + that
|
|
.dealingsRecord
|
|
.lastDebtAmount)
|
|
} else if (that.dealingsRecord.lastDebtAmount < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , (that.yNum += 60), '24', '0', 0, '之前余额:' + Math.abs(that
|
|
.dealingsRecord
|
|
.lastDebtAmount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , (that.yNum += 60), '24', '0', 0, '之前欠款:0')
|
|
}
|
|
|
|
if (that.dealingsRecord.balanceDue >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('540',xNum) , that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
|
|
.balanceDue)
|
|
} else if (that.dealingsRecord.balanceDue < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('540',xNum) , that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
|
|
.dealingsRecord.balanceDue))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('540',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
|
|
.noEarn))
|
|
}
|
|
if (that.returnPrice > 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
|
|
}
|
|
} else {
|
|
if (that.sales.noEarn >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
|
|
.noEarn))
|
|
}
|
|
if (that.returnPrice > 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
|
|
}
|
|
}
|
|
|
|
} else if (this.printingMethod == '2' || this.shopId ==
|
|
'1843114735801864192' || this.shopId == '1810179818189361152') {
|
|
//华秀
|
|
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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, '合计:')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, that.sales.productCount + '件')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , that.yNum, '24', '0', 0, '¥' + that.sales.totalAmount)
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, '合计:')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, that.sales.productCount + '件')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, '退货合计:')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, that.returnNum + '件')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , that.yNum, '24', '0', 0, '¥' + that.returnPrice)
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0, '退货合计:')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('420',xNum) , that.yNum, '24', '0', 0, that.returnNum + '件')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('730',xNum) , that.yNum, '24', '0', 0, '¥' + that.returnPrice)
|
|
}
|
|
}
|
|
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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '之前欠款:' + that
|
|
.dealingsRecord
|
|
.lastDebtAmount)
|
|
} else if (that.dealingsRecord.lastDebtAmount < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '之前余额:' + Math.abs(that
|
|
.dealingsRecord
|
|
.lastDebtAmount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '之前欠款:0')
|
|
}
|
|
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('248',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '之前欠款:' + that
|
|
.dealingsRecord
|
|
.lastDebtAmount)
|
|
} else if (that.dealingsRecord.lastDebtAmount < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '之前余额:' + Math.abs(that
|
|
.dealingsRecord
|
|
.lastDebtAmount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '之前欠款:0')
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('248',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '累计欠款:' + that
|
|
.dealingsRecord
|
|
.balanceDue)
|
|
} else if (that.dealingsRecord.balanceDue < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '累计余额:' + Math.abs(that
|
|
.dealingsRecord.balanceDue))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '累计欠款:0')
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('248',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '累计欠款:' + that
|
|
.dealingsRecord
|
|
.balanceDue)
|
|
} else if (that.dealingsRecord.balanceDue < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '累计余额:' + Math.abs(that
|
|
.dealingsRecord.balanceDue))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '累计欠款:0')
|
|
}
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('248',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
|
|
.noEarn))
|
|
}
|
|
if (that.returnPrice > 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
|
|
}
|
|
} else {
|
|
if (that.sales.noEarn >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
|
|
.noEarn))
|
|
}
|
|
if (that.returnPrice > 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('580',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '销售数量:' + that.sales.productCount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
|
|
// strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
|
|
.balanceDeductionAmount))
|
|
// strCmd += blesdk.addCPCLText(that.getPrintWidth(,xNum) '600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
|
|
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '销售数量:' + that.sales.productCount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
|
|
// strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
|
|
.balanceDeductionAmount))
|
|
// strCmd += blesdk.addCPCLText(that.getPrintWidth(,xNum) '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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '退货数量:' + that.returnNum)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '退货数量:' + that.returnNum)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '欠款抵退货:' + that.sales
|
|
.debtDeductionAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
|
|
.saleDeductionAmount)
|
|
strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
if (that.dealingsRecord.lastDebtAmount >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('600',xNum) , that.yNum, '24', '0', 0, '之前欠款:' + that.dealingsRecord
|
|
.lastDebtAmount)
|
|
} else if (that.dealingsRecord.lastDebtAmount < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('600',xNum) , that.yNum, '24', '0', 0, '之前余额:' + Math.abs(that
|
|
.dealingsRecord
|
|
.lastDebtAmount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('600',xNum) , that.yNum, '24', '0', 0, '之前欠款:0')
|
|
}
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 60, '24', '0', 0, '欠款抵退货:' + that.sales
|
|
.debtDeductionAmount)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('300',xNum) , that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
|
|
.saleDeductionAmount)
|
|
// strCmd += blesdk.addCPCLText(that.getPrintWidth(,xNum) '610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
|
|
// .balanceDeductionAmount))
|
|
strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
if (that.dealingsRecord.lastDebtAmount >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , (that.yNum - 10), '24', '0', 0, '之前欠款:' + that
|
|
.dealingsRecord
|
|
.lastDebtAmount)
|
|
} else if (that.dealingsRecord.lastDebtAmount < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , (that.yNum - 10), '24', '0', 0, '之前余额:' + Math.abs(that
|
|
.dealingsRecord
|
|
.lastDebtAmount))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , (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(that.getPrintWidth('0',xNum) , that.yNum += 70, '24', '0', 0, '本单应收:' + that.sales.realAmount +
|
|
'(' + that.convertToChineseNumeral(that.sales.realAmount) + ')')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , that.yNum, '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
|
|
|
|
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 70, '24', '0', 0, '本单应收:' + that.sales.realAmount +
|
|
'(' + that.convertToChineseNumeral(that.sales.realAmount) + ')')
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 70, '24', '0', 0, '本单欠款:' + that.sales.noEarn +
|
|
'(' + that.convertToChineseNumeral(that.sales.noEarn) + ')')
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('610',xNum) , that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
|
|
.balanceDue)
|
|
} else if (that.dealingsRecord.balanceDue < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
|
|
.dealingsRecord.balanceDue))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , that.yNum, '24', '0', 0, '累计欠款:0')
|
|
}
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 2)
|
|
if (that.sales.noEarn >= 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.yNum += 70, '24', '0', 0, '本单欠款:' + (that.sales
|
|
.noEarn) + '(' + that.convertToChineseNumeral(that.sales.noEarn) + ')')
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('610',xNum) , that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
|
|
.balanceDue)
|
|
} else if (that.dealingsRecord.balanceDue < 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
|
|
.dealingsRecord.balanceDue))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('610',xNum) , 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(that.getPrintWidth('0',xNum) , that.yNum += 40, '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.countPrint(), '24', '0', 0, '订单备注:' + that.sales.remark)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.countPrint(), '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
}
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
if (that.sales.remark) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , that.countPrint(), '24', '0', 0, '订单备注:' + that.sales.remark)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth(,xNum) '50', yNum += 40, '24', '0', 0, this.addressArr[i])
|
|
if (i == 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , (that.yNum += 30), '24', '0', 0, '店铺地址:' + this.addressArr[
|
|
i])
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , (that.yNum += 30), '24', '0', 0, this.addressArr[i])
|
|
}
|
|
|
|
}
|
|
} else {
|
|
for (let i = 0; i < this.addressArr.length; i++) {
|
|
// strCmd += blesdk.addCPCLText(that.getPrintWidth(,xNum) '50', yNum += 40, '24', '0', 0, this.addressArr[i])
|
|
if (i == 0) {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , (that.yNum += 30), '24', '0', 0, '店铺地址:' + this.addressArr[
|
|
i])
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , (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(that.getPrintWidth('0',xNum) , that.countPrint(), '24', '0', 0, '店铺电话:' + this.jinjuPhone)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.countPrint(), '24', '0', 0, '店铺电话:13191998128')
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.countPrint(), '24', '0', 0, '店铺电话:' + (uni.getStorageSync(
|
|
'shopOwnerPhone') ? uni.getStorageSync('shopOwnerPhone') : uni.getStorageSync(
|
|
'username')))
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.countPrint(), '24', '0', 0, '发货方式:' + this.sales
|
|
.companyName + ' ' + this.sales.companyPhone)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.countPrint(), '24', '0', 0, this.shopRemark[i])
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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(that.getPrintWidth('0',xNum) , that.countPrint(), '24', '0', 0,
|
|
'-----------------------------------------------------------------------------------')
|
|
} else {
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth('0',xNum) , 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.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum +=
|
|
40), '24', '0', 0, that.qrArr[i].name)
|
|
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){
|
|
strCmd += blesdk.addCPCLQRCode(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum +=
|
|
40),that.qrArr[i].level, '2', 6, that.qrArr[i].path) //二维码
|
|
}else{
|
|
strCmd += blesdk.addCPCLQRCode(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum +=
|
|
40),that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
|
|
}
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum -=
|
|
40), '24', '0', 0, that.qrArr[i].name)
|
|
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){
|
|
strCmd += blesdk.addCPCLQRCode(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum +=
|
|
40), that.qrArr[i].level, '2', 6, that.qrArr[i].path) //二维码
|
|
}else{
|
|
strCmd += blesdk.addCPCLQRCode(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (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.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum +=
|
|
40), '24', '0', 0, that.qrArr[i].name)
|
|
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){
|
|
strCmd += blesdk.addCPCLQRCode(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum +=
|
|
40),
|
|
that.qrArr[i].level, '2', 6, that.qrArr[i].path) //二维码
|
|
}else{
|
|
strCmd += blesdk.addCPCLQRCode(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum +=
|
|
40),
|
|
that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
|
|
}
|
|
|
|
} else {
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLText(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum -=
|
|
40), '24', '0', 0, that.qrArr[i].name)
|
|
if(uni.getStorageSync('shopId') == '1890655721893269507' || uni.getStorageSync('shopId') == '1844355592815251456'){
|
|
strCmd += blesdk.addCPCLQRCode(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (that.yNum +=
|
|
40),that.qrArr[i].level, '2', 6, that.qrArr[i].path) //二维码
|
|
}else{
|
|
strCmd += blesdk.addCPCLQRCode(that.getPrintWidth(that.countWidth(i, 900 / that.qrArr.length),xNum) , (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(() => {
|
|
if(uni.getStorageSync('shopName') == '杰娜世家'){
|
|
that.changePrintCount()
|
|
}
|
|
that.bufferData = []
|
|
})
|
|
|
|
},
|
|
changePrintCount(){
|
|
let that = this;
|
|
that.tui.request("/app/sale/updatePrintCount","post", {
|
|
saleId:this.saleId
|
|
}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
let pages = getCurrentPages();
|
|
let prevPage = pages[pages.length - 2];
|
|
for(let i=0;i<prevPage.$vm.inventoryList.length;i++){
|
|
if(prevPage.$vm.inventoryList[i].id == that.sales.id){
|
|
prevPage.$vm.inventoryList[i].printCount += 1
|
|
}
|
|
}
|
|
uni.showLoading({
|
|
title: '打印中...'
|
|
})
|
|
} else {
|
|
that.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
countWidth(num, len) {
|
|
return num * len
|
|
},
|
|
replaceCharAfterNumber(str, charToFind, charToReplace) {
|
|
// 正则表达式匹配字符前是否有数字,并且该字符与charToFind相同
|
|
const regex = new RegExp(`\\d${charToFind}`, 'g');
|
|
// 使用replace方法进行替换
|
|
return str.replace(regex, (match) => {
|
|
// 将匹配到的字符中的指定字符替换为charToReplace
|
|
return match.replace(charToFind, charToReplace);
|
|
});
|
|
},
|
|
convertImageToBitmap(imagePath) {
|
|
return new Promise((resolve, reject) => {
|
|
const ctx = uni.createCanvasContext('myCanvas1', this);
|
|
uni.getImageInfo({
|
|
src: imagePath,
|
|
success: (res) => {
|
|
// 设置画布的宽高为图片的宽高
|
|
ctx.width = res.width;
|
|
ctx.height = res.height;
|
|
// 绘制图片
|
|
ctx.drawImage(res.path, 0, 0, res.width, res.height);
|
|
// 将绘制的内容转为位图数据
|
|
ctx.getImageData(0, 0, res.width, res.height, (imageData) => {
|
|
resolve(imageData);
|
|
}, reject);
|
|
},
|
|
fail: reject
|
|
});
|
|
});
|
|
},
|
|
goPrint(type) {
|
|
let strCmd = ''
|
|
strCmd = blesdk.CreatCPCLPage(1080, 1040, 1, 1);
|
|
strCmd += blesdk.addCPCLSETMAG(3, 3)
|
|
blesdk.addCPCLSETBOLD('bold')
|
|
strCmd += blesdk.addCPCLLocation(2);
|
|
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '沧州明珠商贸城--快衣店')
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2)
|
|
strCmd += blesdk.addCPCLLocation(0);
|
|
blesdk.addCPCLSETBOLD('bold')
|
|
strCmd += blesdk.addCPCLText('50', '150', '24', '0', 0, '收货人:' + maskShopName(this.sales.userName))
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2)
|
|
strCmd += blesdk.addCPCLLocation(0);
|
|
strCmd += blesdk.addCPCLText('50', '230', '24', '0', 0, '电话:' + maskPhone(this.order.phone))
|
|
strCmd += blesdk.addCPCLText('50', '310', '24', '0', 0, '编号:' + this.sales.id)
|
|
if (this.sales.province) {
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2)
|
|
blesdk.addCPCLSETBOLD('bold')
|
|
strCmd += blesdk.addCPCLLocation(0);
|
|
strCmd += blesdk.addCPCLText('50', '390', '24', '0', 0, this.sales.province + '/' + this.sales.city +
|
|
'/' +
|
|
this.sales.area)
|
|
}
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2)
|
|
strCmd += blesdk.addCPCLLocation(0);
|
|
if (type == 'confirm') {
|
|
strCmd += blesdk.addCPCLText('50', '470', '24', '0', 0, "*****")
|
|
} else {
|
|
if (this.sales.receiveAddress) {
|
|
if (this.sales.receiveAddress.length > 20) {
|
|
let position = 20;
|
|
let part1 = this.sales.receiveAddress.substring(0, position);
|
|
let part2 = this.sales.receiveAddress.substring(position);
|
|
strCmd += blesdk.addCPCLText('50', '470', '24', '0', 0, part1)
|
|
strCmd += blesdk.addCPCLText('50', '550', '24', '0', 0, part2)
|
|
} else {
|
|
strCmd += blesdk.addCPCLText('50', '470', '24', '0', 0, this.sales.receiveAddress)
|
|
}
|
|
}
|
|
}
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2)
|
|
strCmd += blesdk.addCPCLLocation(0);
|
|
blesdk.addCPCLSETBOLD('bold')
|
|
strCmd += blesdk.addCPCLText('0', '600', '24', '0', 0, '——————————————————————————————')
|
|
strCmd += blesdk.addCPCLText('50', '680', '24', '0', 0, '发货方式:' + (this.sales.companyName ? this.sales
|
|
.companyName : '暂无'))
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2)
|
|
strCmd += blesdk.addCPCLLocation(0);
|
|
strCmd += blesdk.addCPCLText('0', '760', '24', '0', 0, '——————————————————————————————')
|
|
strCmd += blesdk.addCPCLText('50', '840', '24', '0', 0, '店铺:' + this.sales.shopName)
|
|
strCmd += blesdk.addCPCLText('50', '920', '24', '0', 0, this.sales.createByPhone)
|
|
let yNum = 920
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLLocation(0);
|
|
for (let i = 0; i < this.addressArr.length; i++) {
|
|
strCmd += blesdk.addCPCLText('50', yNum += 60, '24', '0', 0, this.addressArr[i])
|
|
}
|
|
strCmd += blesdk.addCPCLLocation(0);
|
|
strCmd += blesdk.addCPCLPrint();
|
|
this.bufferData.push(strCmd);
|
|
this.xierushuju(this.bufferData)
|
|
this.$nextTick(() => {
|
|
this.bufferData = []
|
|
uni.hideLoading();
|
|
})
|
|
},
|
|
downloadImg() {
|
|
let that = this;
|
|
for (let i = 0; i < that.list.length; i++) {
|
|
uni.showLoading({
|
|
title: '保存中...',
|
|
mask: true
|
|
})
|
|
uni.downloadFile({
|
|
url: that.list[i].productPicture,
|
|
success: (res) => {
|
|
uni.saveImageToPhotosAlbum({
|
|
filePath: res.tempFilePath,
|
|
success: function() {
|
|
for (let m = 0; m < that.list[i].productPictures.length; m++) {
|
|
uni.downloadFile({
|
|
url: that.list[i].productPictures[m]
|
|
.productPicture,
|
|
success: (res) => {
|
|
uni.saveImageToPhotosAlbum({
|
|
filePath: res.tempFilePath,
|
|
success() {
|
|
if (that.list[i]
|
|
.productPictures
|
|
.length == (m + 1)
|
|
) {
|
|
uni.hideLoading()
|
|
}
|
|
},
|
|
fail() {
|
|
uni.hideLoading()
|
|
}
|
|
});
|
|
},
|
|
fail() {
|
|
uni.hideLoading()
|
|
}
|
|
});
|
|
}
|
|
setTimeout(res => {
|
|
uni.hideLoading()
|
|
}, 1000)
|
|
},
|
|
fail(err) {
|
|
uni.hideLoading()
|
|
|
|
}
|
|
});
|
|
},
|
|
fail() {
|
|
uni.hideLoading()
|
|
}
|
|
});
|
|
}
|
|
},
|
|
createQRCode(qrCodeText) {
|
|
const that = this
|
|
// 生成二维码图片
|
|
QRCode.toDataURL(qrCodeText, {
|
|
errorCorrectionLevel: 'H'
|
|
}, function(err, url) {
|
|
if (err) console.error(err)
|
|
that.qrCodeImage = url
|
|
})
|
|
},
|
|
xierushuju() {
|
|
let that = this;
|
|
//写入数据
|
|
if (this.defaultText == '打印小票') {
|
|
that.$emit('onPrintSmall');
|
|
} else if (this.defaultText == '确认打印') {
|
|
that.$emit('goPrint');
|
|
} else {
|
|
that.$emit('onPrint');
|
|
}
|
|
|
|
that.$nextTick(() => {
|
|
var dataStr = ''
|
|
for (let m = 0; m < that.bufferData.length; m++) {
|
|
dataStr += that.bufferData[m]
|
|
}
|
|
const maxChunk = that.deviceType == 'android' ? 20 : 180;
|
|
const delay = that.deviceType == 'android' ? 20 : 180;
|
|
|
|
let buffer = gbk.strToGBKByte(dataStr)
|
|
for (let i = 0, j = 0, length = buffer.byteLength; i < length; i += maxChunk, j++) {
|
|
let subPackage = buffer.slice(i, i + maxChunk <= length ? (i + maxChunk) : length);
|
|
setTimeout(that._writeBLECharacteristicValue, j * delay, subPackage);
|
|
}
|
|
|
|
})
|
|
return;
|
|
},
|
|
_writeBLECharacteristicValue(buffer) {
|
|
let that = this;
|
|
wx.writeBLECharacteristicValue({
|
|
deviceId: uni.getStorageSync('deviceId'),
|
|
serviceId: uni.getStorageSync('serviceId'),
|
|
characteristicId: uni.getStorageSync('characteristicId'),
|
|
value: buffer,
|
|
success(res) {
|
|
|
|
|
|
},
|
|
fail(res) {
|
|
|
|
wx.closeBLEConnection({
|
|
deviceId: uni.getStorageSync('deviceId'),
|
|
success(res) {
|
|
|
|
}
|
|
})
|
|
if (uni.getStorageSync('deviceId')) {
|
|
|
|
that.xierushuju()
|
|
} else {
|
|
that.jiantingshebei()
|
|
}
|
|
}
|
|
})
|
|
uni.hideLoading();
|
|
},
|
|
//打印贴包单
|
|
onPrint(opt) {
|
|
let that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "要隐藏客户信息吗?",
|
|
cancelText: '不隐藏',
|
|
confirmText: '隐藏',
|
|
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.goPrint('confirm');
|
|
}
|
|
if (res.cancel) {
|
|
that.goPrint('cancel');
|
|
}
|
|
}
|
|
})
|
|
},
|
|
bigFWHPic(){
|
|
uni.previewImage({
|
|
urls: [this.FWHPic]
|
|
})
|
|
},
|
|
//计算打印机当前行高度
|
|
countPrint() {
|
|
// if ((this.yNum + 50) >= 1040) {
|
|
// return this.yNum += 50
|
|
// } else {
|
|
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;
|
|
},
|
|
makeCall(phone) {
|
|
uni.makePhoneCall({
|
|
phoneNumber: phone + ''
|
|
});
|
|
},
|
|
changeAddress(e) {
|
|
this.changeA = e.detail.value
|
|
},
|
|
//点击图片放大
|
|
showImage() {
|
|
uni.previewImage({
|
|
urls: [this.orderXd.orderPicture],
|
|
current: this.orderXd.orderPicture
|
|
})
|
|
},
|
|
getNoPay(en) {
|
|
if (en != undefined) {
|
|
if (0 < en && en <= this.sales.noEarn) {
|
|
this.sales.noEarn = this.sales.newEarn - en;
|
|
} else {
|
|
uni.showToast({
|
|
title: '请输入正确金额',
|
|
icon: "none"
|
|
});
|
|
}
|
|
}
|
|
},
|
|
//发货方式选择
|
|
goPopleList(popleType) {
|
|
uni.navigateTo({
|
|
url: '/package1/index/peopleList?popleType=' + popleType
|
|
})
|
|
},
|
|
//退款接口
|
|
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.inventoryList = res.result
|
|
this.returnPrice = 0
|
|
this.returnNum = 0
|
|
this.inventoryList.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.returnList.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])
|
|
}
|
|
}
|
|
this.$nextTick(() => {
|
|
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)
|
|
setTimeout(res => {
|
|
this.getPrintHeight()
|
|
}, 1000)
|
|
})
|
|
}
|
|
}).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
|
|
}
|
|
}
|
|
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)
|
|
})
|
|
}
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
})
|
|
|
|
},
|
|
checkBoxChange() {
|
|
if (this.radio1 == 2) {
|
|
this.lbgName = []
|
|
this.changeA = ''
|
|
}
|
|
},
|
|
open() {
|
|
this.popupShow = true
|
|
},
|
|
close() {
|
|
this.popupShow = false
|
|
},
|
|
returnGoods() {
|
|
if (this.isReturn) {
|
|
// this.returnAmount = this.sAmout
|
|
if (this.radio1 == 0 && this.changeA == '') {
|
|
this.tui.toast("请输入取货地址")
|
|
return
|
|
}
|
|
this.$refs.returnClose.val = this.returnAmount
|
|
this.$refs.returnDialog.open()
|
|
} else {
|
|
|
|
this.isReturn = true;
|
|
}
|
|
},
|
|
getPrice(price) {
|
|
price = price || 0;
|
|
return price.toFixed(2)
|
|
},
|
|
logistics() {
|
|
this.tui.href("/pages/my/logistics/logistics")
|
|
},
|
|
// 取消订单
|
|
cancelOrder(type) {
|
|
this.tui.modal("提示", "您确定要取消吗?", true, (res) => {
|
|
if (res) {
|
|
var data = {},
|
|
url
|
|
if (type == 'qxdd') {
|
|
data = {
|
|
status: 2,
|
|
orderId: this.sales.id
|
|
}
|
|
url = '/app/sale/status'
|
|
} else {
|
|
if (this.sales.status == '0' || this.sales.status == '1') {
|
|
//开单取消配送
|
|
data = {
|
|
status: 4,
|
|
orderId: this.sales.id
|
|
}
|
|
url = '/app/sale/status'
|
|
} else {
|
|
data = {
|
|
orderId: this.inventoryList[0].id
|
|
}
|
|
url = '/app/return/cancelOrder'
|
|
}
|
|
|
|
}
|
|
this.tui.request(url, "POST", data, true, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.tui.toast("取消成功")
|
|
uni.navigateBack()
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res1) => {})
|
|
}
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page{
|
|
font-size: 24rpx;
|
|
}
|
|
.btn-wrap {
|
|
width: 164rpx;
|
|
height: 80rpx;
|
|
border-radius: 16upx;
|
|
border: 2upx solid $u-primary;
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.container {
|
|
padding-bottom: 118rpx;
|
|
|
|
.boxbg {
|
|
background-color: #fff;
|
|
margin: 30upx;
|
|
padding: 20upx;
|
|
border-radius: 10upx;
|
|
box-shadow: 0px 1px 10px 2px #e2e2e2;
|
|
}
|
|
|
|
.tui-order-item {
|
|
.u-collapse-content {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
line-height: 30px;
|
|
}
|
|
|
|
.tui-goods-item {
|
|
width: 100%;
|
|
padding: 20rpx 30rpx;
|
|
box-sizing: border-box;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
|
|
.tui-goods-img {
|
|
width: 180rpx;
|
|
height: 180rpx;
|
|
display: block;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.tui-goods-center {
|
|
flex: 1;
|
|
padding: 20rpx 8rpx;
|
|
box-sizing: border-box;
|
|
|
|
.tui-goods {
|
|
word-break: break-all;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
display: -webkit-box;
|
|
-webkit-box-orient: vertical;
|
|
-webkit-line-clamp: 2;
|
|
line-height: 32rpx;
|
|
}
|
|
|
|
.tui-goods-name {
|
|
font-weight: 700;
|
|
max-width: 310rpx;
|
|
font-size: 26rpx;
|
|
}
|
|
|
|
.tui-goods-attr {
|
|
font-size: 22rpx;
|
|
color: #888888;
|
|
padding-top: 20rpx;
|
|
}
|
|
|
|
}
|
|
|
|
.tui-price-right {
|
|
text-align: right;
|
|
font-size: 26upx;
|
|
font-weight: 700;
|
|
line-height: 30rpx;
|
|
padding-top: 160rpx;
|
|
}
|
|
}
|
|
|
|
.tui-goods-info {
|
|
width: 100%;
|
|
padding: 30rpx;
|
|
box-sizing: border-box;
|
|
background: #fff;
|
|
line-height: 26px;
|
|
|
|
.tui-price-flex {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.tui-size32 {
|
|
font-size: 32rpx;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.tui-size-24 {
|
|
font-size: 24rpx;
|
|
}
|
|
|
|
.tui-price-large {
|
|
font-size: 32rpx;
|
|
|
|
.lineText {
|
|
text-decoration: line-through;
|
|
font-size: 12px;
|
|
color: #888;
|
|
}
|
|
}
|
|
|
|
.tui-flex-shrink {
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.tui-goods-price {
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: flex-end;
|
|
justify-content: flex-end;
|
|
font-size: 24rpx;
|
|
}
|
|
|
|
.tui-primary-color {
|
|
color: #EB0909;
|
|
}
|
|
|
|
.tui-pbtm20 {
|
|
padding-bottom: 20rpx;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
.tui-order-info {
|
|
margin-top: 20rpx;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.tui-color-red {
|
|
color: #E41F19;
|
|
padding-right: 30rpx;
|
|
}
|
|
|
|
|
|
|
|
|
|
.uni-select {
|
|
border: none !important;
|
|
}
|
|
|
|
|
|
|
|
|
|
.tui-size24 {
|
|
padding-bottom: 20rpx;
|
|
font-size: 24rpx;
|
|
line-height: 24rpx;
|
|
color: #888;
|
|
}
|
|
|
|
|
|
|
|
|
|
.tui-order-title {
|
|
position: relative;
|
|
font-size: 28upx;
|
|
line-height: 28upx;
|
|
padding-left: 16upx;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.uni-tooltip {
|
|
display: flex;
|
|
}
|
|
|
|
.tui-order-title::before {
|
|
content: '';
|
|
position: absolute;
|
|
left: 0;
|
|
top: 0;
|
|
border-left: 8upx solid $u-primary;
|
|
height: 120%;
|
|
border-radius: 4upx;
|
|
}
|
|
|
|
.tui-order-content {
|
|
width: 100%;
|
|
padding: 24rpx 30rpx;
|
|
box-sizing: border-box;
|
|
background: #fff;
|
|
font-size: 24rpx;
|
|
line-height: 30rpx;
|
|
}
|
|
|
|
.tui-order-flex {
|
|
display: flex;
|
|
padding-top: 18rpx;
|
|
}
|
|
|
|
.tui-order-flex:first-child {
|
|
padding-top: 0
|
|
}
|
|
|
|
.tui-item-title {
|
|
width: 132rpx;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.tui-item-content {
|
|
color: #666;
|
|
line-height: 32rpx;
|
|
}
|
|
|
|
.tui-safe-area {
|
|
height: 1rpx;
|
|
padding-bottom: env(safe-area-inset-bottom);
|
|
}
|
|
|
|
.tui-tabbar {
|
|
width: 100%;
|
|
height: 98rpx;
|
|
background: #fff;
|
|
position: fixed;
|
|
left: 0;
|
|
bottom: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: flex-end;
|
|
font-size: 26rpx;
|
|
box-shadow: 0 0 1px rgba(0, 0, 0, .3);
|
|
padding-bottom: env(safe-area-inset-bottom);
|
|
z-index: 99;
|
|
}
|
|
|
|
.tui-btn-mr {
|
|
width: 130rpx;
|
|
height: 60rpx;
|
|
background: #088FEB;
|
|
color: #fff;
|
|
border-radius: 10px;
|
|
line-height: 60rpx;
|
|
text-align: center;
|
|
margin-right: 30rpx;
|
|
}
|
|
|
|
.tui-contact {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 28rpx;
|
|
}
|
|
|
|
.tui-contact image {
|
|
width: 36rpx;
|
|
height: 36rpx;
|
|
margin-right: 16rpx;
|
|
}
|
|
|
|
.content-box {
|
|
width: 100%;
|
|
height: auto;
|
|
background: #fff;
|
|
margin-bottom: 20rpx;
|
|
|
|
}
|
|
|
|
.shop-box {
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.shop-name {
|
|
width: 100%;
|
|
height: 200rpx;
|
|
line-height: 80rpx;
|
|
border-top: 1px solid #eee;
|
|
border-bottom: 1px solid #eee;
|
|
font-size: 28rpx;
|
|
font-weight: bold;
|
|
display: flex;
|
|
}
|
|
|
|
.shop-productName {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding-left: 20rpx;
|
|
}
|
|
|
|
.shop-productName view {
|
|
height: 55rpx;
|
|
}
|
|
|
|
.shop-collapse {
|
|
display: flex;
|
|
height: 80rpx;
|
|
font-size: 26rpx;
|
|
line-height: 80rpx;
|
|
}
|
|
|
|
.shop-collapse text {
|
|
text-align: center;
|
|
border-right: 1px solid #eee;
|
|
}
|
|
|
|
.noPic {
|
|
border-radius: 10px;
|
|
width: 140rpx;
|
|
height: 140rpx;
|
|
margin: 30rpx 0 0 30rpx;
|
|
text-align: center;
|
|
line-height: 140rpx;
|
|
color: #777;
|
|
background: #eee;
|
|
}
|
|
|
|
.checklist-box {
|
|
margin-right: 0 !important;
|
|
margin-left: 50rpx !important;
|
|
}
|
|
|
|
.showImg-box {
|
|
width: 700rpx;
|
|
height: 1000rpx;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.swiper-box {
|
|
height: 1000rpx;
|
|
}
|
|
|
|
.swiper-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 1000rpx;
|
|
color: #fff;
|
|
background-color: #cee1fd;
|
|
border-radius: 10px;
|
|
}
|
|
|
|
.uni-table-td {
|
|
font-size: 11px !important;
|
|
}
|
|
|
|
.uni-table-th {
|
|
font-size: 11px !important;
|
|
}
|
|
|
|
.uni-card__header {
|
|
height: 120rpx;
|
|
}
|
|
</style>
|