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

1318 lines
43 KiB

<template>
<view class="container">
<view v-if="sales.userName !='散客'">
<uni-card :title="sales.userName == null ?'暂无':sales.userName+'('+order.phone+')'">
<view class="uni-body" v-if="sales.province != null">
{{sales.province + sales.city + sales.area + sales.receiveAddress}} </view>
</uni-card>
<button open-type="share" style="font-size: 22rpx;position: absolute;top: 50rpx;right: 70rpx;background: blue;color: #fff;width: 100rpx;height: 50rpx;text-align: center;line-height: 50rpx;border-radius: 7px;">
分享
</button>
</view>
<view v-else>
<uni-card :title="sales.userName == null ?'暂无':sales.userName"
thumbnail="/static/images/dingdan/dd0.png">
</uni-card>
</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" :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.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>{{item1.attributeList | sliceMsg}}</text>
<text>数量:{{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>
<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-size-24">¥</view>
<view class="tui-price-large">{{ sales.totalAmount == null ?'暂无':sales.totalAmount }}</view>
</view>
</view>
<view class="tui-price-flex tui-size32" v-if="type == 0">
<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">
<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">
<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">
<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="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 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">
<u-collapse>
<u-collapse-item v-for="(item,index) in returnList" :key="index" :title="item.returnSale.createTime"
:name="item.returnSale.saleId">
<view style="display: flex;text-align: center;">
<view style="width:50%;">退货金额:{{item.returnSale.totalAmount}}</view>
<view style="width:50%;">拉包工:{{item.returnSale.workerName == null?'暂无':item.returnSale.workerName}}</view>
</view>
<view class="u-collapse-content" v-for="(val, index2) in item.saleDetailDTOList" :key="index2">
<view style="text-align: center;margin-top: 20rpx;">{{val.productName}} </view>
<view style="display: flex;text-align: center;border-top:1px solid #eee;margin-top:20rpx;">
<view style="width:50%;">规格</view>
<view style="width:50%;">数量</view>
</view>
<view v-for="(val1, index3) in val.stockLogList1" :key="index3" v-if="val1.productCount!=0" style="display: flex;text-align: center;">
<view style="width:50%;">{{val1.attributeList | sliceMsg}}</view>
<view style="width:50%;">{{val1.productCount}}</view>
</view>
</view>
</u-collapse-item>
</u-collapse>
</view>
</view>
<view class="tui-order-info boxbg">
<view class="tui-order-title">
回款历史
</view>
<view class="tui-order-content" style="border-bottom: 1px solid #E0E0E0;" v-for="(item,index) in collection"
:key="index">
<view class="tui-order-flex">
<view class="tui-item-title">回款金额:</view>
<view class="tui-item-content">{{ item.amount }}</view>
</view>
<view class="tui-order-flex">
<view class="tui-item-title">操作人:</view>
<view class="tui-item-content">{{ item.createByName }}</view>
</view>
<view class="tui-order-flex">
<view class="tui-item-title">操作时间:</view>
<view class="tui-item-content">{{ item.createTime }}</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 :src="orderXd.orderPicture" @tap="showImage"></image>
</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 == '1' ?'待取货' :sales.status == '2' ?'作废':sales.status == '3' ?'待送达' :sales.status == '4' ?'已完成' :sales.status == '5' ?'下游客户待退货' :sales.status == '00' ?'退货待抢单' :sales.status == '01' ?'退货待取货' :sales.status == '03' ?'退货待送达' :sales.status == '04' ?'待确认退货' :sales.status == '6' ?'待配货' :'挂单'}}
</view>
</view>
</view>
</view>
<u-popup :show="popupShow" @close="close" @open="open" mode="bottom">
<view class="popupBox">
</view>
</u-popup>
<view class="tui-tabbar">
<view class="tui-btn-mr" v-if="sales.status != 6 && sales.status != 2">
<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">
<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 == '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>
<view class="tui-btn-mr" @tap="inputDialogToggle()" v-if="sales.status != 6 && !editNoPrice && sales.status != 2 && sales.noEarn >0">回款</view>
</view>
<!-- 回款金额输入框 -->
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="回款金额" placeholder="请输入回款金额"
@confirm="sureNpPay"></uni-popup-dialog>
</uni-popup>
<!-- 退货确认输入框 -->
<uni-popup ref="returnDialog" type="dialog">
<uni-popup-dialog ref="returnClose" mode="input" title="请再次确认退货金额"
placeholder="请输入退货金额" @confirm="sureReturn"></uni-popup-dialog>
</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 {
maskShopName,
maskPhone
} from '@/utils/global.js'
export default {
data() {
return {
defaultText:'贴包单',
radio1: 0,
sex: [{
text: '是',
value: 0
}, {
text: '否',
value: 2
}],
orderByWorkerCandidates: [],
orderByWorker: '',
bufferData: [],
show: false,
popupShow: false,
sales: {},
order: {},
list: [],
isReturn: false,
orderByWorkerList: [],
inventoryList: [],
shopList: [],
returnList: [],
editNoPrice: false,
newEarn: 0,
qrcodeData: '',
isgys: true,
isReturnPrice: 1,
type: '',
orderXd: [],
collection: [],
lbgName: [],
returnAmount: 0,
shopData: [],
changeA: '',
sAmout: 0,
yNum: 150,
printTotal:1040,
zReturnNum:""
}
},
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() {
return {
title: '查看采购单详情',
imageUrl:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/abdc5c897c4f4fe198b74091a708030b.jpg',
path: '/pages/login/login?saleId=' + this.saleId + '&userId=' + this.order.id
}
},
onShow() {
// 初始化蓝牙模块
wx.openBluetoothAdapter({mode: 'central'})
this.lbgName = JSON.parse(JSON.stringify(this.lbgName))
this.type = uni.getStorageSync('type')
},
onLoad(option) {
this.saleId = option.id
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
this.list = res.result.saleDetailDTOList
for (var i = 0; i < this.list.length; i++) {
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.sales.zongchengben = this.sales.zongchengben.toFixed(2)
this.order = res.result.customer
this.orderXd = res.result.orderXd
this.shopData = res.result.shop
this.getReturnOrder(option.id)
this.collectionList(option.id)
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
}
}
},
methods: {
//回款历史
collectionList(id) {
this.tui.request('/app/dealingRecord/getDealingsRecordList', 'post', {
orderId: id
}, false, true).then(res => {
this.collection = res.result
}).catch(res => {});
},
//打印小票
onPrintSmall(){
let that = this;
that.yNum = 150
let strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLSETMAG(2, 2)
blesdk.addCPCLSETBOLD('bold')
strCmd += blesdk.addCPCLLocation(2);
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, uni.getStorageSync('shopName'))
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', '100', '24', '0', 0, '客户:' + this.order.name)
strCmd += blesdk.addCPCLText('280', '100', '24', '0', 0, this.sales.id)
strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '销售:' + this.sales.createByName)
strCmd += blesdk.addCPCLText('280', '130', '24', '0', 0, '日期:' + this.sales.createTime)
strCmd += blesdk.addCPCLText('0', '150', '24', '0', 0,
'=========================================================')
for(var i=0;i<this.list.length;i++){
if(that.countPrint() < that.printTotal){
strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, this.list[i].productName + '(' +
this.list[i].productSn + ')')
}else{
that.yNum = 0
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, this.list[i].productName + '(' +
this.list[i].productSn + ')')
}
for(var m=0;m<this.list[i].stockLogList1.length;m++){
if(that.countPrint() < that.printTotal){
strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, (that.slicePrint(
this.list[i].stockLogList1[m].attributeList)) + '*' + this.list[i].stockLogList1[m].productCount)
strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + this.list[i].discountAmount)
strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (this.list[i]
.discountAmount * this.list[i].stockLogList1[m].productCount))
}else{
that.yNum = 0
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = ''
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, (that.slicePrint(
this.list[i].stockLogList1[m].attributeList)) + '*' + this.list[i].stockLogList1[m].productCount)
strCmd += blesdk.addCPCLText('280', that.yNum, '24', '0', 0, '单价:' + this.list[i].discountAmount)
strCmd += blesdk.addCPCLText('440', that.yNum, '24', '0', 0, '总价:' + (this.list[i]
.discountAmount * this.list[i].stockLogList1[m].productCount))
}
}
}
if(that.countPrint() < this.printTotal){
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0,
'===============================================================')
}else{
this.yNum = 0
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
strCmd = ''
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0,
'===============================================================')
}
if(that.countPrint() < this.printTotal){
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '总数量:' + this.sales.productCount)
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额' + this.sales.totalAmount)
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.sales.realAmount)
}else{
this.yNum = 0
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
strCmd = ''
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', (this.yNum += 30), '24', '0', 0, '总数量:' + this.sales.productCount)
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额' + this.sales.totalAmount)
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.sales.realAmount)
}
if(that.countPrint() < this.printTotal){
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.sales.alreadyEarn)
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.sales.noEarn))
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.sales.otherExpense))
}else{
this.yNum = 0
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
strCmd = ''
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', (this.yNum += 30), '24', '0', 0, '实收:' + this.sales.alreadyEarn)
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.sales.noEarn))
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.sales.otherExpense))
}
if(this.sales.remark){
if(Math.ceil(Number(this.sales.remark.length) / 20 ) *30 + this.yNum < this.printTotal){
if(this.sales.remark.length >20){
let position = 20;
let part1 = this.sales.remark.substring(0, position);
let part2 = this.sales.remark.substring(position);
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + part1)
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, part2)
}else{
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.sales.remark)
}
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
}else{
this.yNum = 0
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
strCmd = ''
if(this.sales.remark.length >20){
let position = 20;
let part1 = this.sales.remark.substring(0, position);
let part2 = this.sales.remark.substring(position);
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + part1)
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, part2)
}else{
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '备注:' + this.sales.remark)
}
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
}
}else{
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
}
uni.hideLoading();
that.$nextTick(()=>{
uni.navigateBack({
delta: 1
})
})
console.log("传值之前",this.bufferData)
},
//打印贴包单
onPrint(opt) {
let strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 1);
strCmd += blesdk.addCPCLSETMAG(2, 2)
blesdk.addCPCLSETBOLD('bold')
strCmd += blesdk.addCPCLText('40', '30', '24', '0', 0, '沧州明珠商贸城--快衣店')
strCmd += blesdk.addCPCLSETMAG(3, 3)
blesdk.addCPCLSETBOLD('bold')
strCmd += blesdk.addCPCLText('50', '120', '24', '0', 0, '收:' + maskShopName(this.sales.userName))
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('50', '250', '24', '0', 0, maskPhone(this.order.phone))
strCmd += blesdk.addCPCLText('250', '250', '24', '0', 0, '编号:' + this.sales.id)
strCmd += blesdk.addCPCLSETMAG(1, 1)
blesdk.addCPCLSETBOLD('bold')
strCmd += blesdk.addCPCLText('50', '330', '24', '0', 0, this.sales.province + '/' + this.sales.city + '/' +
this.sales.area)
strCmd += blesdk.addCPCLSETMAG(1, 1)
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', '410', '24', '0', 0, part1)
strCmd += blesdk.addCPCLText('50', '440', '24', '0', 0, part2)
}else{
strCmd += blesdk.addCPCLText('50', '410', '24', '0', 0, this.sales.receiveAddress)
}
strCmd += blesdk.addCPCLSETMAG(2, 2)
blesdk.addCPCLSETBOLD('bold')
strCmd += blesdk.addCPCLText('0', '490', '24', '0', 0, '——————————————————————————————')
strCmd += blesdk.addCPCLText('50', '570', '24', '0', 0, '发货方式:' + (this.sales.companyName?this.sales.companyName:'暂无'))
strCmd += blesdk.addCPCLSETMAG(2, 2)
strCmd += blesdk.addCPCLText('0', '650', '24', '0', 0, '——————————————————————————————')
strCmd += blesdk.addCPCLText('50', '730', '24', '0', 0, '店铺:' + maskShopName(this.sales.shopName))
strCmd += blesdk.addCPCLText('50', '810', '24', '0', 0, maskPhone(this.sales.createByPhone))
strCmd += blesdk.addCPCLText('50', '890', '24', '0', 0, '地址:' + this.shopData.shopAddress)
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
uni.hideLoading();
},
//计算打印机当前行高度
countPrint(){
if((this.yNum + 50) >= 1040){
return this.yNum +=50
}else{
return this.yNum += 30
}
},
//截取
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
})
},
sureNpPay(e) {
uni.showLoading({
title: '加载中...'
})
if(e>this.sales.noEarn){
uni.showToast({
title: "回款金额不应超过欠款金额!",
icon: 'none'
})
return
}
if (this.type == 'gys') {
this.tui.request('/app/purchase/editPayPrice', 'post', {
id: this.sales.id,
price: e
}, false, true).then(res => {
uni.showToast({
title: res.message,
icon: 'none'
})
uni.navigateBack();
}).catch(res => {});
} else {
this.sales.alreadyEarn = (this.sales.alreadyEarn * 1) + (this.newEarn * 1);
this.tui.request('/app/sale/editPayPrice', 'post', {
id: this.sales.id,
price: e
}, false, true).then(res => {
uni.showToast({
title: res.message,
icon: 'none'
})
uni.navigateBack();
}).catch(res => {});
}
setTimeout(res => {
uni.hideLoading();
}, 200)
},
//回款金额输入框
inputDialogToggle() {
this.$refs.inputDialog.open()
},
//回款按钮 this.type==gys时,是上游客户欠款接口。否则为销售单欠款接口
editnoEarn() {
this.editNoPrice = true;
},
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: '/pages/index/peopleList?popleType=' + popleType
})
},
//退款接口
getReturnOrder(id) {
let that = this;
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
let returnDat = new Map();
this.inventoryList.forEach(item => {
this.tui.request("/app/return/get/" + item.id, "GET", null, false, false)
.then((res) => {
if (res.code == 200 && res.result != null && res.result !=
undefined) {
that.returnList.push(res.result)
that.shopList.push(...res.result.saleDetailDTOList);
var data = res.result.saleDetailDTOList
for (let i = 0; i < data.length; i++) {
for (let m = 0; m < data[i].stockLogList1
.length; m++) {
if (returnDat.has(data[i].productId + '-' + data[i]
.stockLogList1[m].attributeList) == true) {
returnDat.set(data[i].productId + '-' + data[i]
.stockLogList1[m].attributeList,
returnDat.get(data[i].productId + '-' +
data[i].stockLogList1[m]
.attributeList) + data[i]
.stockLogList1[m].productCount)
} else {
returnDat.set(data[i].productId + '-' + data[i]
.stockLogList1[m].attributeList, data[
i].stockLogList1[m].productCount)
}
}
}
this.zReturnNum = 0
this.$nextTick(()=>{
for (let i = 0; i < that.list.length; i++) {
for (let z = 0; z < that.list[i].stockLogList1.length; z++) {
that.zReturnNum += that.list[i].stockLogList1[z].productCount
if (returnDat.has(that.list[i].productId + '-' + that.list[i].stockLogList1[z].attributeList) == true) {
that.list[i].stockLogList1[z].maxNum = that.list[i].stockLogList1[z].productCount -
returnDat.get(that.list[i].productId + '-' + that.list[i].stockLogList1[z].attributeList)
}else{
that.list[i].stockLogList1[z].maxNum = that.list[i].stockLogList1[z]
.productCount
}
}
}
})
console.log(returnDat);
returnDat.forEach(function(value, key) {
that.zReturnNum -= value
})
console.log('退货',that.zReturnNum)
}
}).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)
}
})
console.log('刷新',that.list)
},
checkBoxChange() {
if (this.radio1 == 2) {
this.lbgName = []
this.changeA = ''
}
},
open() {
this.popupShow = true
},
close() {
this.popupShow = false
},
//调用退货接口
sureReturn() {
// uni.showLoading({
// title: '加载中...'
// })
if(this.sales.productCount - this.zReturnNum == 0){
this.tui.toast("已经超过最大退货数量")
return
}
if (this.radio1 == 0 && this.changeA == '') {
this.tui.toast("请输入取货地址")
return
}
if(this.$refs.returnClose.val == '' || this.$refs.returnClose.val <= 0){
this.tui.toast("金额不能为空")
return
}
let returnNum = 0
for(let i=0;i<this.inventoryList.length;i++){
returnNum += this.inventoryList[i].totalAmount
}
if(this.inventoryList == ''){
if(this.$refs.returnClose.val > this.sales.realAmount){
this.tui.toast('退货金额不能超出可退货金额')
return
}
}else{
if(this.$refs.returnClose.val > this.inventoryList[0].realAmount - returnNum){
this.tui.toast('退货金额不能超出可退货金额')
return
}
}
for (var i = 0; i < this.list.length; i++) {
this.list[i].stockLogList = []
for (var m = 0; m < this.list[i].stockLogList1.length; m++) {
if(this.list[i].stockLogList1[m].returnCount && this.list[i].stockLogList1[m].returnCount > 0){
this.list[i].stockLogList.push(this.list[i].stockLogList1[m])
}
}
}
console.log('list',this.list)
for (var i = 0; i < this.list.length; i++) {
if(this.list[i].stockLogList.length != 0){
for (var m = 0; m < this.list[i].stockLogList.length; m++) {
if(this.list[i].stockLogList[m].returnCount <= 0){
this.tui.toast("退货数量不能为零")
return;
}
this.list[i].stockLogList[m].productCount = this.list[i].stockLogList[m].returnCount
if(this.list[i].stockLogList.length >0){
if (m == 0) {
this.list[i].productCount = this.list[i].stockLogList[m].productCount
} else {
this.list[i].productCount += this.list[i].stockLogList[m].productCount
}
}
}
this.list[i].stockLogList1 = this.list[i].stockLogList
if(this.list[i].stockLogList1.length <= 0){
this.list[i].productCount = 0
}
}else{
}
}
for (var i = 0; i < this.list.length; i++) {
if(this.list[i].stockLogList.length == 0){
this.list.splice(i,1)
}else{
for(var m=0;m<this.list[i].stockLogList1.length;m++){
if(this.list[i].stockLogList1[m].returnCount == null || this.list[i].stockLogList1[m].returnCount ==0){
this.list[i].stockLogList1.splice(m,1)
}
}
}
}
console.log('最后的数组',this.list)
this.sales.saleId = this.sales.id;
this.sales.province = ''
this.sales.city = ''
this.sales.area = ''
this.sales.receiveAddress = this.changeA
this.sales.totalAmount = this.$refs.returnClose.val;
this.sales.transportType = this.radio1
this.tui.request("/app/return/rtg", "post", {
returnSale: this.sales,
returnSaleDetailList: this.list,
transCompany: this.radio1 == 0 ? '99999999' : '',
orderByWorker: this.lbgName.workerId,
isReturnPrice: 1
}, false, false).then((res) => {
uni.showToast({
title: res.message
});
if (res.code == 200) {
uni.navigateBack()
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
setTimeout(res => {
uni.hideLoading();
}, 200)
},
returnGoods() {
// for(let i=0;i<this.list.length;i++){
// this.inventoryList.forEach(item => {
// this.list[i].returnCount = this.list[i].productCount - item.productCount
// })
// }
if (this.isReturn) {
// this.returnAmount = this.sAmout
this.$refs.returnClose.val = this.returnAmount
this.$refs.returnDialog.open()
// this.sureReturn()
} 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: 996;
}
.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 {
flex: 1;
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;
}
</style>