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

2774 lines
104 KiB

<template>
<view class="container">
<view>
<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 ?'暂无':sales.userName"
thumbnail="/static/images/dingdan/dd0.png">
</uni-card>
<button v-if="isShare ==false" open-type="share"
style="font-size: 22rpx;position: absolute;top: 50rpx;right: 70rpx;background: blue;color: #fff;border-radius: 7px;">
分享
</button>
</view>
<view class="tui-order-item boxbg">
<view class="content-box">
<view class="shop-box" style="border-top:5px solid #eee;" v-for="(item,index) in list" :key="index">
<view class="shop-name" style="position: relative;">
<img class="img-radius" @tap.stop="getChildrenPic(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>单价:{{item.discountAmount == null ? '暂无':item.discountAmount}}
数量:{{item.productCount == null ? '暂无':item.productCount}}
总价:{{item.productCount * item.discountAmount}}</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 returnList" :key="index">
<view class="shop-box" style="border-top:5px solid #eee;"
v-for="(item1,index1) in item.saleDetailDTOList" :key="index1">
<view class="shop-name" style="position: relative;">
<img class="img-radius" @tap.stop="getChildrenPic(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>单价:{{item1.discountAmount == null ? '暂无':item1.discountAmount}}
数量:{{item1.productCount == null ? '暂无':item1.productCount}}
总价:{{item1.productCount * item1.discountAmount}}</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>
</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" 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" 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" 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">
<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">
<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" 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" 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" 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" 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" 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">
<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">
<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" 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" 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" 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="isReturn">
<view class="tui-flex-shrink">退货金额</view>
<view class="tui-goods-price">
<view class="tui-size-24">¥</view>
<input type="digit" style="width: 150rpx;text-align: right;border-bottom: 1px solid #eee;" v-model='returnAmount' @input="getReturnA">
</view>
</view> -->
<!-- <view class="tui-price-flex tui-size32" 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">{{ qkdk}}</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>
</view>
<!-- 小静家的临时二维码 -->
<view
v-if="shopId == '1819168666252611584' || shopId == '1818888277105709056' || shopId == '1809982397626847232' || shopId == '1810586326525939712'"
style="width: 100%;height: 150px;text-align: center;display: flex;">
<view style="float: left;display: flex;flex-direction: column;width: 33.3%;">
<view>
<img show-menu-by-longpress
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/af15c928b37049109781d3c0fc6a03bd.png" alt=""
style="width: 200rpx;height: 200rpx;background-size: 100%;">
</view>
<view>店铺微信</view>
</view>
<view style="float: left;display: flex;flex-direction: column;width: 33.3%;">
<view>
<img show-menu-by-longpress
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/bf7fed39c47c43ab9ffb9343cf7d99d4.png" alt=""
style="width: 200rpx;height: 200rpx;background-size: 100%;">
</view>
<view>微信收款码</view>
</view>
<view style="float: left;display: flex;flex-direction: column;width: 33.3%;">
<view>
<img show-menu-by-longpress
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/bf7fed39c47c43ab9ffb9343cf7d99d4.png" alt=""
style="width: 200rpx;height: 200rpx;background-size: 100%;">
</view>
<view>支付宝收款码</view>
</view>
</view>
<!-- 亿点的临时二维码 -->
<view v-if="shopId == '1821033146834096129'"
style="width: 100%;height: 150px;text-align: center;display: flex;">
<view style="float: left;display: flex;flex-direction: column;width: 25%;">
<view>
<img show-menu-by-longpress
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/eb2716b9b08f43b58bba5605567b1ada.png" alt=""
style="width: 160rpx;height: 160rpx;background-size: 100%;">
</view>
<view>店铺微信</view>
</view>
<view style="float: left;display: flex;flex-direction: column;width: 25%;">
<view>
<img show-menu-by-longpress
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/f663092872a44b89a3bd3f6de190f44b.png" alt=""
style="width: 160rpx;height: 160rpx;background-size: 100%;">
</view>
<view>微信收款码</view>
</view>
<view style="float: left;display: flex;flex-direction: column;width: 25%;">
<view>
<img show-menu-by-longpress
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/974c29ce02d74c879c0c9f2a31b1e6fb.png" alt=""
style="width: 160rpx;height: 160rpx;background-size: 100%;">
</view>
<view>支付宝收款码</view>
</view>
<view style="float: left;display: flex;flex-direction: column;width: 25%;">
<view>
<img show-menu-by-longpress
src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/406ec497eea3498d8326381b368f17f4.png" alt=""
style="width: 160rpx;height: 160rpx;background-size: 100%;">
</view>
<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>
<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 class="tui-btn-mr" v-if="sales.status == '4'" @click="returnGoods">{{ !isReturn ? '退货' : '确认退货'}} -->
</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>
</template>
<script>
import util from '@/components/kk-printer/utils/util.js';
import * as blesdk from '@/components/kk-printer/utils/bluetoolth.js';
import kkPrinter from '@/components/kk-printer/index.vue';
import gbk from '@/components/kk-printer/utils/printUtil-GBK.js';
import {
maskShopName,
maskPhone
} from '@/utils/global.js'
export default {
data() {
return {
defaultText: '贴包单',
radio1: 0,
bigImg: [],
shopId: '',
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'),
sales: {},
dealingsRecord: {},
order: {},
list: [],
newData: [],
isReturn: false,
orderByWorkerList: [],
inventoryList: [],
shopList: [],
returnList: [],
editNoPrice: false,
newEarn: 0,
shopRemark: [],
qrcodeData: '',
isgys: true,
printHeight: 0,
isReturnPrice: 1,
type: '',
orderXd: [],
collection: [],
returnPrice: 0,
shopMoblie:'',
returnNum: 0,
lbgName: [],
returnAmount: 0,
shopData: [],
changeA: '',
sAmout: 0,
yNum: 150,
printTotal: 1040,
deviceType: 'ios',
qrArr: [],
isShare: false,
isDownKH: false,
addressArr: [],
jinjuPhone: '', //金桔家单独改成这个电话
modal_qr: false,
qrCodeUrl: 'https://u.wechat.com/EOzom56XQ_1MKeVPPqgwMlI', // 要生成的二维码值
}
},
components: {
kkPrinter
},
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;
},
maxNum(val) {
if (val >= 10) {
return 10
} else if (val < 0) {
return 0
}
}
},
onShareAppMessage() {
//禁止转发
// wx.updateShareMenu({
// isPrivateMessage: true,
// success () { },
// fail () {}
// })
return {
title: this.shopName + '的采购单',
imageUrl: 'https://jewel-shop.oss-cn-beijing.aliyuncs.com/b28b3d46c21d4f60a334b25f56175cf3.jpg',
path: '/package1/index/orderDetail?popleType=khName&id=' + this.sales.id + '&shopId=' + uni
.getStorageSync('shopId') + '&shopName=' + this.shopName
}
},
onShow() {
// 初始化蓝牙模块
wx.openBluetoothAdapter({
mode: 'central'
})
this.lbgName = JSON.parse(JSON.stringify(this.lbgName))
let that = this;
},
onLoad(option) {
var that = this;
if (option.shopId && option.shopId != uni.getStorageSync('shopId')) {
this.isDownKH = true
}
this.saleId = option.id
this.isShare = option.shopId ? true : false
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", null, false, false).then((res) => {
if (res.code == 200 && res.result != null && res.result != undefined) {
this.sales = res.result.sale
if (res.result.dealingsRecord != null) {
this.dealingsRecord = res.result.dealingsRecord
}
this.list = res.result.saleDetailDTOList
for (var i = 0; i < this.list.length; i++) {
if (this.list[i].realPrice != '' && this.list[i].discountAmount == null) {
this.list[i].discountAmount = this.list[i].realPrice
}
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
}
}
this.list[i].chengben = this.list[i].productCount * this.list[i].purchasePrice
}
this.sales.zongchengben = 0
for (var i = 0; i < this.list.length; i++) {
this.sales.zongchengben += this.list[i].chengben
}
this.newData = JSON.parse(JSON.stringify(this.list))
this.sales.zongchengben = this.sales.zongchengben.toFixed(2)
this.order = res.result.customer
this.orderXd = res.result.orderXd
this.shopData = res.result.shop
this.splitTextIntoChunks(res.result.shop.shopAddress, 30)
this.getReturnOrder(option.id)
if (res.result.sale.status == '2') {
this.tui.toast('该订单已撤销')
}
} else {
if (res.code == 500 && res.message == 'java.lang.NullPointerException') {
this.tui.toast('该订单已撤销,无法查看')
} else {
this.tui.toast(res.message)
}
}
}).catch((res) => {})
}
}
this.shopId = option.shopId || 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()
}
},
methods: {
// 展示二维码
showQrcode() {
let _this = this;
this.modal_qr = true;
console.log('$refs', _this.$refs.qrcodePopup)
for (let i = 0; i < _this.$refs.qrcodePopup.length; i++) {
_this.$refs.qrcodePopup[i].crtQrCode()
}
},
//传入组件的方法
hideQrcode() {
this.modal_qr = false;
},
//获取子图
getChildrenPic(img) {
let that = this;
this.tui.request("/app/productPicture/getProductPictureByProductId", "POST", {
productId: img.productId,
}, false, true).then((res) => {
if (res.code == 200) {
img.productPictures = []
for (let i = 0; i < res.result.length; i++) {
let data = {
productPicture: res.result[i].productPicture
}
img.productPictures.push(data)
}
setTimeout(res1 => {
console.log(img)
that.largeImg(img)
}, 400);
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
largeImg(img) {
console.log('img', img)
if (img.productPicture == null && img.productPictures == null) {
this.tui.toast("暂无可展示的图片", 1000)
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) {
this.shopName = res.result.shopName;
console.log(this.shopName)
this.shopRemark = res.result.remark.split('\n');
console.log('shopRemark', this.shopRemark)
this.jinjuPhone = res.result.contactPhone
let qrCode = res.result.shopIcon
// let qrCode = '店铺https://u.wechat.com/EOzom56XQ_1MKeVPPqgwMlI?uVsMiaUpfpOk8MxSE19t4ao0TCVrd,微信wxp://f2f0QYU_-Jjd882vOWEqu7GA8F9Vbo_ftIqsS9muVsMiaUpfpOk8MxSE19t4ao0TCVrd,收款https://life.qujie365.com/smpay/unionpay/index.html?qrcode=80000013007399283719457'
if (qrCode != '') {
let data = qrCode.split(',')
for (let i = 0; i < data.length; i++) {
var weixin = data[i].indexOf("微信");
var dianpu = data[i].indexOf("店铺");
var zifubao = data[i].indexOf("支付");
var yinlian = data[i].indexOf("收款");
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 => {
that.showQrcode();
}, 1000)
}
}
}).catch((res) => {})
},
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;
console.log('newData', that.newData)
this.printHeight = 960
for (let i = 0; i < that.newData.length; i++) {
this.printHeight += 40
for (let m = 0; m < that.newData[i].stockLogList1.length; m++) {
this.printHeight += 40
}
}
if (that.qrArr.length > 0) {
this.printHeight += 360
}
if (that.shopRemark.length > 0) {
this.printHeight += that.shopRemark.length * 40
}
if (that.sales.remark) {
this.printHeight += 100
}
},
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
console.log('addressArr', this.addressArr)
})
},
//打印小票
onPrintSmall() {
let that = this;
console.log('printHeight', this.printHeight)
let strCmd = ''
let pageNum = 1
let Xindex = 0
that.yNum = 405
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')
strCmd += blesdk.addCPCLText('0', '300', '24', '0', 0, '客户:' + (that.order.name ? that.order.name : '散客'))
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('500', '300', '24', '0', 0, '单号:' + that.sales.id)
strCmd += blesdk.addCPCLText('0', '350', '24', '0', 0, '销售员:' + that.sales.createByName)
strCmd += blesdk.addCPCLText('500', '350', '24', '0', 0, '日期:' + that.sales.createTime)
strCmd += blesdk.addCPCLText('0', '390', '24', '0', 0,
'-----------------------------------------------------------------------------------')
strCmd += blesdk.addCPCLText('10', that.yNum += 40, '24', '0', 0, '货号(名称)')
strCmd += blesdk.addCPCLText('320', that.yNum, '24', '0', 0, '规格')
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, '数量')
strCmd += blesdk.addCPCLText('620', that.yNum, '24', '0', 0, '单价')
strCmd += blesdk.addCPCLText('720', that.yNum, '24', '0', 0, '总价')
for (var i = 0; i < that.newData.length; i++) {
if (that.yNum + 25 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 25) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 25), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 25, '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 25, '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++
console.log('商品pageNum', pageNum)
console.log('规格', that.yNum)
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++
console.log('规格pageNum', pageNum)
if (that.newData[i].stockLogList1[m].isReturn) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【退】' + that
.newData[i].productSn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【退】' + that
.newData[i].productSn +
'(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
} else {
if (that.newData[i].productName == that.newData[i].productSn && that.order.name !=
'散客') {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1) { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【补】' + that
.newData[i].productSn)
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【销】' + that
.newData[i].productSn)
}
} else {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【补】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【销】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
}
}
if (that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') {
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均色') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均色/g, '分色')
}
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均码') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均码/g, '分码')
}
}
strCmd += blesdk.addCPCLText('320', that.yNum, '24', '0', 0, that
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].productCount)
if (that.newData[i].stockLogList1[m].isReturn) {
strCmd += blesdk.addCPCLText('620', that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].discountAmount)
} else {
strCmd += blesdk.addCPCLText('620', that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
}
strCmd += blesdk.addCPCLText('720', that.yNum, '24', '0', 0, (that.newData[i]
.discountAmount * that.newData[i].stockLogList1[m].productCount))
console.log('【销】', that.yNum)
} else {
console.log('规格不等于pageNum', pageNum)
if (that.newData[i].stockLogList1[m].isReturn) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【退】' + that
.newData[i].productSn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【退】' + that
.newData[i].productSn +
'(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
} else {
if (that.newData[i].productName == that.newData[i].productSn && that.order.name !=
'散客') {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1) { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【补】' + that
.newData[i].productSn)
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【销】' + that
.newData[i].productSn)
}
} else {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【补】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【销】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
}
}
if (that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') {
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均色') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均色/g, '分色')
}
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均码') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均码/g, '分码')
}
}
strCmd += blesdk.addCPCLText('320', that.yNum, '24', '0', 0, that
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].productCount)
if (that.newData[i].stockLogList1[m].isReturn) {
strCmd += blesdk.addCPCLText('620', that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].discountAmount)
} else {
strCmd += blesdk.addCPCLText('620', that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
}
strCmd += blesdk.addCPCLText('720', that.yNum, '24', '0', 0, (that.newData[i]
.discountAmount * that.newData[i].stockLogList1[m].productCount))
console.log('【销】', that.yNum)
}
}
} else {
console.log('规格', that.yNum)
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++
console.log('规格pageNum', pageNum)
if (that.newData[i].stockLogList1[m].isReturn) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【退】' + that
.newData[i].productSn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【退】' + that
.newData[i].productSn +
'(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
} else {
if (that.newData[i].productName == that.newData[i].productSn) {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【补】' + that
.newData[i].productSn)
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【销】' + that
.newData[i].productSn)
}
} else {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【补】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【销】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
}
}
if (that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') {
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均色') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均色/g, '分色')
}
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均码') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均码/g, '分码')
}
}
strCmd += blesdk.addCPCLText('320', that.yNum, '24', '0', 0, that
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].productCount)
if (that.newData[i].stockLogList1[m].isReturn) {
strCmd += blesdk.addCPCLText('620', that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].discountAmount)
} else {
strCmd += blesdk.addCPCLText('620', that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
}
strCmd += blesdk.addCPCLText('720', that.yNum, '24', '0', 0, (that.newData[i]
.discountAmount * that.newData[i].stockLogList1[m].productCount))
console.log('【销】', that.yNum)
} else {
console.log('规格不等于pageNum', pageNum)
if (that.newData[i].stockLogList1[m].isReturn) {
if (that.newData[i].productName == that.newData[i].productSn) {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【退】' + that
.newData[i].productSn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【退】' + that
.newData[i].productSn +
'(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
} else {
if (that.newData[i].productName == that.newData[i].productSn) {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【补】' + that
.newData[i].productSn)
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【销】' + that
.newData[i].productSn)
}
} else {
if (that.newData[i].stockLogList1[m].isPurchasedBefore == 1 && that.order.name !=
'散客') { //买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【补】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
} else { // 0是没买过
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, (Xindex +=1)+'.'+'【销】' + that
.newData[i].productSn + '(' + (that.newData[i]
.productName == null ? '' : that.newData[i].productName) + ')')
}
}
}
if (that.shopId == '1820269107191353344' || that.shopId == '1818888277105709056') {
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均色') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均色/g, '分色')
}
if (that.newData[i].stockLogList1[m].attributeList.indexOf('均码') != -1) {
that.newData[i].stockLogList1[m].attributeList = that.newData[i].stockLogList1[m]
.attributeList.replace(/均码/g, '分码')
}
}
strCmd += blesdk.addCPCLText('320', that.yNum, '24', '0', 0, that
.slicePrint(that.newData[i].stockLogList1[m].attributeList))
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].productCount)
if (that.newData[i].stockLogList1[m].isReturn) {
strCmd += blesdk.addCPCLText('620', that.yNum, '24', '0', 0, that.newData[i]
.stockLogList1[m].discountAmount)
} else {
strCmd += blesdk.addCPCLText('620', that.yNum, '24', '0', 0, that.newData[i]
.discountAmount)
}
strCmd += blesdk.addCPCLText('720', that.yNum, '24', '0', 0, (that.newData[i]
.discountAmount * that.newData[i].stockLogList1[m].productCount))
console.log('【销】', that.yNum)
}
}
}
}
// strCmd += blesdk.addCPCLPrint();
// that.bufferData.push(strCmd);
// that.yNum = 0
// strCmd = blesdk.CreatCPCLPage(1080, 700, 1, 0);
if (that.yNum + 25 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 25) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 25), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 25, '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 25, '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLLocation(0);
if (this.shopId == '1820391948796694529') {
if (that.yNum + 54 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd +=
blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '销售数量:' + that.sales.productCount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
// strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
.balanceDeductionAmount))
// strCmd += blesdk.addCPCLText('600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '销售数量:' + that.sales.productCount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
// strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
.balanceDeductionAmount))
// strCmd += blesdk.addCPCLText('600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
}
console.log('销售数量', that.yNum)
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 54 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
}
console.log('退货数量', that.yNum)
if (that.yNum + 54 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '欠款抵退货:' + that.sales
.debtDeductionAmount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
.saleDeductionAmount)
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '之前欠款:' + that.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '之前欠款:0')
}
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '欠款抵退货:' + that.sales
.debtDeductionAmount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
.saleDeductionAmount)
// strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
// .balanceDeductionAmount))
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('580', (that.yNum), '24', '0', 0, '之前欠款:' + that.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('580', (that.yNum), '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('580', (that.yNum), '24', '0', 0, '之前欠款:0')
}
}
console.log('欠款抵退货', that.yNum)
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 54 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单应收:' + that.sales.realAmount)
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计欠款:0')
}
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单应收:' + that.sales.realAmount)
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '累计欠款:0')
}
}
if (that.yNum + 54 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 54) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 54), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('580', that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn)
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('580', that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn)
}
}else if(this.shopId == '1821406205034237952' || this.shopId == '1810179818189361152') { //董大姐
if (that.yNum + 64 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, '合计:')
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.sales.productCount+'件')
strCmd += blesdk.addCPCLText('700', that.yNum, '24', '0', 0, '¥'+that.sales.totalAmount)
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0, '合计:')
strCmd += blesdk.addCPCLText('520', that.yNum, '24', '0', 0, that.sales.productCount+'件')
strCmd += blesdk.addCPCLText('700', that.yNum, '24', '0', 0, '¥'+that.sales.totalAmount)
}
if (that.yNum + 60 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '本单应收:' +that.sales.realAmount +'('+ this.convertToChineseNumeral(that.sales.realAmount)+')')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '本单应收:' +that.sales.realAmount +'('+ this.convertToChineseNumeral(that.sales.realAmount)+')')
}
if (that.yNum + 60 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn + '(' + this.convertToChineseNumeral(that.sales.alreadyEarn)+ ')')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '本单实收:' + that.sales
.alreadyEarn + '(' + this.convertToChineseNumeral(that.sales.alreadyEarn)+ ')')
}
if (that.yNum + 60 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum+=60, '24', '0', 0, '之前欠款:' + that.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('0', that.yNum+=60, '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum+=60, '24', '0', 0, '之前欠款:0')
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计欠款:0')
}
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('0', (that.yNum+=60), '24', '0', 0, '之前欠款:' + that.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('0', (that.yNum+=60), '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('0', (that.yNum+=60), '24', '0', 0, '之前欠款:0')
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('540', that.yNum, '24', '0', 0, '累计欠款:0')
}
}
if (that.yNum + 60 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 60) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 60), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
console.log('销售数量', that.yNum)
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 30 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 30) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 30), 1, 0, 162);
that.yNum = 0
pageNum++
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if(that.returnPrice > 0){
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
}
} else {
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单欠款:' + (that.sales.noEarn))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn))
}
if(that.returnPrice > 0){
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('580', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
}
}
console.log('退货数量', that.yNum)
} else {
if (that.yNum + 84 >= 1990 * pageNum) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 84) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 84), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd +=
blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '销售数量:' + that.sales.productCount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
// strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
.balanceDeductionAmount))
// strCmd += blesdk.addCPCLText('600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '销售数量:' + that.sales.productCount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售金额:' + that.sales.totalAmount)
// strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
.balanceDeductionAmount))
// strCmd += blesdk.addCPCLText('600', (that.yNum - 20), '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
}
console.log('销售数量', that.yNum)
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 84 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 84) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 84), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '退货数量:' + that.returnNum)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '退货金额:' + that.returnPrice)
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '其他费用:' + (that.sales.otherExpense))
}
console.log('退货数量', that.yNum)
if (that.yNum + 84 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 84) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 84), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '欠款抵退货:' + that.sales
.debtDeductionAmount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
.saleDeductionAmount)
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, '之前欠款:' + that.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('600', that.yNum, '24', '0', 0, '之前欠款:0')
}
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 60, '24', '0', 0, '欠款抵退货:' + that.sales
.debtDeductionAmount)
strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '销售抵退货:' + that.sales
.saleDeductionAmount)
// strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '余额抵销售:' + (that.sales
// .balanceDeductionAmount))
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.dealingsRecord.lastDebtAmount >= 0) {
strCmd += blesdk.addCPCLText('610', (that.yNum - 10), '24', '0', 0, '之前欠款:' + that
.dealingsRecord
.lastDebtAmount)
} else if (that.dealingsRecord.lastDebtAmount < 0) {
strCmd += blesdk.addCPCLText('610', (that.yNum - 10), '24', '0', 0, '之前余额:' + Math.abs(that
.dealingsRecord
.lastDebtAmount))
} else {
strCmd += blesdk.addCPCLText('610', (that.yNum - 10), '24', '0', 0, '之前欠款:0')
}
}
console.log('欠款抵退货', that.yNum)
if (that.yNum + 94 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 94) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 94), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单应收:' + that.sales.realAmount+'('+that.convertToChineseNumeral(that.sales.realAmount)+')')
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单应收:' + that.sales.realAmount+'(' + that.convertToChineseNumeral(that.sales.realAmount)+')')
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '本单实收:' + that.sales.alreadyEarn)
}
if (that.yNum + 114 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 114) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 114), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单欠款:' + that.sales.noEarn + '('+ that.convertToChineseNumeral(that.sales.noEarn) +')')
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn) + '('+ that.convertToChineseNumeral(Math.abs(that.sales.noEarn)) +')')
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计欠款:0')
}
} else {
strCmd += blesdk.addCPCLSETMAG(1, 2)
if (that.sales.noEarn >= 0) {
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单欠款:' + (that.sales.noEarn) + '('+ that.convertToChineseNumeral(that.sales.noEarn) +')')
} else {
strCmd += blesdk.addCPCLText('0', that.yNum += 70, '24', '0', 0, '本单余额:' + Math.abs(that.sales
.noEarn) + '('+ that.convertToChineseNumeral(Math.abs(that.sales.noEarn)) +')')
}
if (that.dealingsRecord.balanceDue >= 0) {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计欠款:' + that.dealingsRecord
.balanceDue)
} else if (that.dealingsRecord.balanceDue < 0) {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计余额:' + Math.abs(that
.dealingsRecord.balanceDue))
} else {
strCmd += blesdk.addCPCLText('610', that.yNum, '24', '0', 0, '累计欠款:0')
}
}
}
if (that.yNum + 40 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 40) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 40), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.yNum += 40, '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.sales.remark) {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '订单备注:' + that.sales.remark)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.sales.remark) {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '订单备注:' + that.sales.remark)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
}
//店铺地址
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
for (let i = 0; i < this.addressArr.length; i++) {
// strCmd += blesdk.addCPCLText('50', yNum += 40, '24', '0', 0, this.addressArr[i])
if (i == 0) {
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + this.addressArr[
i])
} else {
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, this.addressArr[i])
}
}
} else {
for (let i = 0; i < this.addressArr.length; i++) {
// strCmd += blesdk.addCPCLText('50', yNum += 40, '24', '0', 0, this.addressArr[i])
if (i == 0) {
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + this.addressArr[
i])
} else {
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, this.addressArr[i])
}
}
}
//店铺电话
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (this.shopId == '1820391948796694529') {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + this.jinjuPhone)
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + this.jinjuPhone)
}
}else if (this.shopId == '1834512626093264897' || this.shopId == '1810179818189361152') {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:13191998128')
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:13191998128')
}
} else {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + (uni.getStorageSync(
'shopOwnerPhone') ? uni.getStorageSync('shopOwnerPhone') : uni.getStorageSync(
'username')))
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + (uni.getStorageSync(
'shopOwnerPhone') ? uni.getStorageSync('shopOwnerPhone') : uni.getStorageSync(
'username')))
}
}
//物流
if (this.sales.companyName != null) {
strCmd += blesdk.addCPCLSETMAG(1, 1)
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '发货方式:' + this.sales
.companyName + ' ' + this.sales.companyPhone)
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '发货方式:' + this.sales
.companyName + ' ' + this.sales.companyPhone)
}
}
//店铺备注
if (this.shopRemark.length > 0) {
for (let i = 0; i < this.shopRemark.length; i++) {
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, this.shopRemark[i])
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, this.shopRemark[i])
}
}
}
if (that.yNum + 64 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 64) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 64), 1, 0, 162);
that.yNum = 0
pageNum++
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
'-----------------------------------------------------------------------------------')
} else {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
'-----------------------------------------------------------------------------------')
}
if (that.yNum + 300 >= 1990) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(1080, (this.printHeight - that.yNum + 270) >= 1990 ? 1990 : (this
.printHeight - that.yNum + 270), 1, 0, 162);
that.yNum = 0
pageNum++
if (that.qrArr.length != 0) {
//店铺微信/微信收款/支付宝收款/收款码收款(店铺,微信,支付,收款)
for (let i = 0; i < that.qrArr.length; i++) {
//店铺二维码
if (i == 0) {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),'24','0', 0, that.qrArr[i].name)
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),
that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText(that.countWidth(i, 900 / that.qrArr.length), (that.yNum -=
40),'24','0', 0, that.qrArr[i].name)
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
}
if (that.qrArr.length == (i + 1)) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
}
} else {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
} else {
if (that.qrArr.length != 0) {
//店铺微信/微信收款/支付宝收款/收款码收款(店铺,微信,支付,收款)
for (let i = 0; i < that.qrArr.length; i++) {
//店铺二维码
if (i == 0) {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),'24','0', 0, that.qrArr[i].name)
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),
that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
} else {
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText(that.countWidth(i, 900 / that.qrArr.length), (that.yNum -=
40),'24','0', 0, that.qrArr[i].name)
strCmd += blesdk.addCPCLQRCode(that.countWidth(i, 900 / that.qrArr.length), (that.yNum +=
40),
that
.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
}
if (that.qrArr.length == (i + 1)) {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
}
} else {
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
}
console.log(that.bufferData)
this.$nextTick(() => {
console.log('that.yNum', that.yNum)
console.log('bufferData', that.bufferData)
that.bufferData = []
})
},
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);
});
},
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();
})
},
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');
}
}
})
},
//计算打印机当前行高度
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++) {
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
}
for (let i = 0; i < that.newData.length; i++) {
if (that.newData[i].productId == res.result
.saleDetailDTOList[j].productId) {
isTure = false
that.newData[i].stockLogList1.push(...res
.result.saleDetailDTOList[j]
.stockLogList1)
}
}
if (isTure) {
that.newData.push(res.result.saleDetailDTOList[
j])
}
}
}
}).catch((res) => {})
})
} else {
for (let i = 0; i < that.list.length; i++) {
for (let z = 0; z < that.list[i].stockLogList1.length; z++) {
that.list[i].stockLogList1[z].maxNum = that.list[i].stockLogList1[z]
.productCount
}
}
}
} else {
this.tui.toast(res.message)
}
})
this.$nextTick(() => {
setTimeout(res => {
this.getPrintHeight()
}, 500)
})
},
// 金额转大写
convertToChineseNumeral(money) {
let fu = false
console.log('金额转大写',money)
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
}
console.log('金额转大写',chineseStr)
return chineseStr
},
getAllGoodsList() {
let that = this;
this.newData = JSON.parse(JSON.stringify(this.list))
for (let j = 0; j < this.shopList.length; j++) {
let isTure = true
for (let m = 0; m < this.shopList[j].stockLogList1.length; m++) {
this.shopList[j].stockLogList1[m].isReturn = true
}
for (let i = 0; i < this.newData.length; i++) {
if (this.newData[i].productId == this.shopList[j].productId) {
isTure = false
this.newData[i].stockLogList1 = [...this.newData[i].stockLogList1, ...this.shopList[j]
.stockLogList1
]
}
}
if (isTure) {
this.newData.push(this.shopList[j])
}
}
},
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">
.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;
}
.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;
// padding-right: 40rpx;
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;
}
</style>