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.
1743 lines
52 KiB
1743 lines
52 KiB
<!-- 销售商品 -->
|
|
<template>
|
|
<view class="page1">
|
|
<view class="content">
|
|
<view class="content-box">
|
|
<view class="content-list">
|
|
<view class="list-name">客户</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请选择客户" disabled
|
|
style="border-bottom: 1px solid #fff;text-align: center;" v-model="khName.name"
|
|
@tap.stop="goPopleList('khName')">
|
|
<uni-icons type="right" size="16" style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name">销售员</view>
|
|
<uni-data-select class="uni-data-select" :localdata="categoryList" v-model="xsyId"
|
|
placeholder="请选择销售员" @change="categoryChange"></uni-data-select>
|
|
</view>
|
|
</view>
|
|
<view class="content-box">
|
|
<view class="shop-box" style="border-bottom: 1px solid #eee;margin-bottom: 20rpx;">
|
|
<u-grid :col="2" border>
|
|
<u-grid-item index="add" @tap.stop="scanCodeAdd">
|
|
<u-icon name="scan" size="36"></u-icon>
|
|
<text>扫一扫</text>
|
|
</u-grid-item>
|
|
<u-grid-item @tap.stop="goodsAdd">
|
|
<u-icon name="plus" size="28"></u-icon>
|
|
<text>添加商品</text>
|
|
</u-grid-item>
|
|
</u-grid>
|
|
</view>
|
|
<view class="shop-box">
|
|
<view class="content-list">
|
|
<view class="list-name" style="width:150rpx;padding-left:0;">选择价格</view>
|
|
<view class="list-val" style="width:560rpx;display: flex;">
|
|
<radio-group style="display: flex;">
|
|
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in priceItems"
|
|
:key="item.value">
|
|
<view>
|
|
<radio :value="item.value" @tap.stop="priceChange(item.value)"
|
|
:checked="index === priceCurrent" />
|
|
</view>
|
|
<view style="width: 100rpx;">{{item.name}}</view>
|
|
</label>
|
|
</radio-group>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-box">
|
|
<view class="content-list">
|
|
<view class="list-name" style="width:150rpx;padding-left:0;">折扣类型</view>
|
|
<view class="list-val" style="width:560rpx;display: flex;">
|
|
<radio-group @change="discountChange" style="display: flex;">
|
|
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in items"
|
|
:key="item.value">
|
|
<view>
|
|
<radio :value="item.value" :checked="index === discountCurrent" />
|
|
</view>
|
|
<view style="width: 100rpx;">{{item.name}}</view>
|
|
</label>
|
|
</radio-group>
|
|
<view class="discount-num" v-if="discountType == '1'">
|
|
<input type="digit" style="width:150rpx;" v-model="discountNum" @blur="change($event)">
|
|
</view>
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-box" style="border-top:5px solid #eee;" v-for="(value,key) in Array.from(carList)"
|
|
:key="key">
|
|
<view class="shop-name" style="position: relative;">
|
|
<img :src="value[1].productPicture" alt=""
|
|
style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;">
|
|
<view class="shop-productName">
|
|
<view style="color:#FF5809;">品名:{{value[1].productName}} ({{value[1].productSn}})</view>
|
|
<view>单价:{{value[1].discountAmount}} 数量:{{value[1].productCount}} 总价:{{value[1].price}}</view>
|
|
<view v-if="value[1].supplierName !=undefined">供应商:{{value[1].supplierName}}</view>
|
|
</view>
|
|
<view
|
|
style="position: absolute;top: 110rpx;right: 40rpx;color: blue;text-decoration: underline;"
|
|
@tap.stop="clickPrice(value[0])">
|
|
改价
|
|
</view>
|
|
<view style="position: absolute;top: 30rpx;right: 30rpx;" @tap.stop="delShop(value[0])">
|
|
<uni-icons color="red" type="trash" size="26"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="shop-type">
|
|
<view class="shop-collapse-item" v-if="discountType == '0'">
|
|
<view class="collapse-1">
|
|
<text>单价</text>
|
|
<input class="input" type="text" :value='value[1].unitPrice' disabled>
|
|
</view>
|
|
<view class="collapse-1">
|
|
<text>折扣(0-10)</text>
|
|
<input class="input" type="digit" :value='value[1].discount'
|
|
@blur="changeDis($event,value[0])">
|
|
</view>
|
|
<view class="collapse-1">
|
|
<text>折后价</text>
|
|
<input class="input" type="text" :value='value[1].price' disabled>
|
|
</view>
|
|
<view class="collapse-1">
|
|
<text>数量</text>
|
|
<input class="input" type="number" :value='value[1].productCount' disabled>
|
|
</view>
|
|
</view>
|
|
<view class="shop-collapse" v-for="(values,keys) in Array.from(value[1].stockLogList)"
|
|
:key='keys'>
|
|
<view @tap.stop="delShopSpec(value[0],values[0])">
|
|
<uni-icons color="red" type="minus" size="26"></uni-icons>
|
|
</view>
|
|
<text>{{values[0] | sliceMsg}}</text>
|
|
<view style="text-align: left;padding-left: 5px;width:50%;display: flex;">数量:<uni-number-box
|
|
max="100000" style="margin-top:16rpx;" v-model="values[1]"
|
|
@change="GoodsNumChange($event,value[0],values[0])" /></view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="content-box">
|
|
<!-- <view class="price-box-title">
|
|
<text>商品数量:5 </text>
|
|
<text style="text-align: left;padding-left: 40rpx;color: red;">金额:500.00</text>
|
|
</view> -->
|
|
<view class="price-box-list">
|
|
<view class="content-list">
|
|
<view class="list-name">总金额</view>
|
|
<view class="list-val">
|
|
<input type="number" :value="shouldPay" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name">实收金额</view>
|
|
<view class="list-val">
|
|
<input type="number" placeholder="请输入实收金额" :value="relPrice" @blur="changessPrice($event)">
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name">已收金额</view>
|
|
<view class="list-val">
|
|
<input type="number" placeholder="请输入已收金额" :value="priceOk" @blur="changePrice($event)">
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name">欠款</view>
|
|
<view class="list-val">
|
|
<input type="number" :value="noPay" disabled>
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name">其他费用</view>
|
|
<view class="list-val">
|
|
<input type="number" placeholder="如无其他费用可忽略" :value="otherExpense">
|
|
</view>
|
|
</view>
|
|
<view class="content-list">
|
|
<view class="list-name">备注</view>
|
|
<view class="">
|
|
<textarea @input='changeRemark($event)' :value="remark" />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="content-box" style="margin-bottom: 130rpx;">
|
|
<view class="shop-box">
|
|
<view class="" style="border-bottom: 1px solid #eee;">
|
|
<view class="list-name" style="width: 100%;">发货方式</view>
|
|
<view class="list-val" style="display: flex;width: 100%;padding-left:20rpx;">
|
|
<radio-group @change="radioChange" style="display: flex;">
|
|
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in logisticsType"
|
|
:key="item.value">
|
|
<view>
|
|
<radio :value="item.value" :checked="index === current" />
|
|
</view>
|
|
<view>{{item.name}}</view>
|
|
</label>
|
|
</radio-group>
|
|
</view>
|
|
</view>
|
|
<view class="" v-if="radioType != '2'">
|
|
<view class="content-list" v-if="radioType == '0' || radioType == '1'">
|
|
<view class="list-name" style="width:150rpx;padding-left: 0;">
|
|
{{radioType == '0'? '选择物流' :'选择快递'}}</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请选择" disabled :value="wlName.companyName"
|
|
style="border-bottom: 1px solid #fff;text-align: center;padding-right: 54rpx;"
|
|
@tap.stop="goPopleList(radioType == '0'? 'wlName' :'kdName')">
|
|
<uni-icons type="right" size="16"
|
|
style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="radioType == '4'">
|
|
<view class="list-name" style="width:150rpx;padding-left:0;">选择车号</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="请选择" disabled
|
|
style="border-bottom: 1px solid #fff;text-align: center;"
|
|
@tap.stop="goPopleList('fcName')">
|
|
<uni-icons type="right" size="16"
|
|
style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="radioType !=''">
|
|
<view class="list-name" style="padding-left:0;">配送方式</view>
|
|
<view class="list-val" style="line-height: 90rpx;">
|
|
<uni-data-checkbox v-model="value" :localdata="sex"
|
|
@change="checkBoxChange"></uni-data-checkbox>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="radioType1 != '1' && radioType !=''">
|
|
<view class="list-name" style="width:150rpx;padding-left:0;">
|
|
{{radioType == '1'? '快递员' :'拉包工'}}</view>
|
|
<view class="list-val">
|
|
<input type="text" placeholder="可指定人员" disabled
|
|
:value="radioType == '1'? kdyName.workerName : lbgName.workerName"
|
|
style="border-bottom: 1px solid #fff;text-align: center;"
|
|
@tap.stop="goPopleList(radioType == '1'? 'kdyName' :'lbgName')">
|
|
<uni-icons type="right" size="16"
|
|
style="margin-left: 80rpx;line-height: 80rpx;"></uni-icons>
|
|
</view>
|
|
</view>
|
|
<view class="content-list" v-if="radioType == '3'">
|
|
<view class="list-name" style="padding-left:0;">拼包地址</view>
|
|
<view class="">
|
|
<textarea @input='changePbAddress($event)' :value='pbAddress' />
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="bottom-box">
|
|
<view class="bottom-left">
|
|
<text>合计:{{totalAmount}}</text>
|
|
<text style="color: #ffa200;">¥{{shouldPay == null ?0:shouldPay}}</text>
|
|
</view>
|
|
<view class="bottom-right">
|
|
<button class="bottom-btn" @tap.stop="clearAll">清空商品</button>
|
|
<button class="bottom-btn" @tap.stop="goSell">开单</button>
|
|
</view>
|
|
</view>
|
|
<!-- 弹出输入框 -->
|
|
<uni-popup ref="inputDialog" background-color="#fff">
|
|
<view class="popup-pay-content">
|
|
<view class="popup-pay-title">
|
|
<text>选择商品价格</text>
|
|
</view>
|
|
<view class="popup-pay-container" @tap.stop="checkPay(lsprice)">
|
|
<text style="display: inline-block">零售价:¥{{lsprice}}</text>
|
|
</view>
|
|
<view class="popup-pay-container" @tap.stop="checkPay(wholesalePrice)">
|
|
<text style="display: inline-block">批发价:¥{{wholesalePrice}}</text>
|
|
</view>
|
|
<view class="popup-pay-container" style="background: #fff;display: flex;">
|
|
<input type="number" style="height: 100rpx;line-height: 100rpx;color:#000;" placeholder="请输入价格"
|
|
@input="changePay">
|
|
<view style="flex: 1;color: #fff;background: #088FEB;border-radius: 10px;"
|
|
@tap.stop="checkPay(customPrice)">确定</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
<!-- 弹出层 -->
|
|
<view class="tanchuceng">
|
|
<uni-popup ref="shopPopup" background-color="#fff">
|
|
<view class="shop-popup-content">
|
|
<view class="shop-popup-title">
|
|
<view class="shop-popup-title-left">
|
|
<img :src="goodsDetail.productPicture" alt="">
|
|
</view>
|
|
<view class="shop-popup-title-right">
|
|
<view class="shop-popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}}
|
|
</view>
|
|
<view class="shop-popup-title-right-box">{{goodsDetail.productSn}}</view>
|
|
</view>
|
|
</view>
|
|
<view class="shop-popup-container">
|
|
<ul style="border-top:20rpx;">
|
|
<li v-for="(items,index) in goodsDetail.attributeList" :key="index">
|
|
<view class="shop-title-fur">
|
|
<view class="shop-title-name">{{items.name}}</view>
|
|
</view>
|
|
<view class="shop-attrs">
|
|
<uni-data-checkbox :localdata="range"></uni-data-checkbox>
|
|
<text v-for="(itemTag, index1) in items.value" :key="index1"
|
|
@tap.stop="attrNameChange(index,index1) "
|
|
:class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.value}}</text>
|
|
</view>
|
|
</li>
|
|
</ul>
|
|
<view class="shop-checkList" v-for="(item,index) in temporaryList" :key="index">
|
|
<view class="shop-checkList-box">
|
|
{{item.name}}
|
|
</view>
|
|
<uni-number-box max='1000000' v-model="item.productCount" @change="temporaryChange" />
|
|
</view>
|
|
</view>
|
|
<view class="shop-popup-bottom" v-for="(item,index) in temporaryList" :key="index">
|
|
<view class="shop-popup-bottom-left">
|
|
<text>{{zNum}} 件</text>
|
|
<!-- <text>¥{{zPrice}}</text> -->
|
|
</view>
|
|
<view class="shop-popup-bottom-right">
|
|
<view class="bottom-btn" @tap.stop="temporaryCheck">选好了</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</uni-popup>
|
|
</view>
|
|
<!-- 打印弹出 -->
|
|
<uni-popup ref="printerPopup" background-color="#fff">
|
|
<view style="width: 500rpx;height: 300rpx;font-size: 36rpx;">
|
|
<view style="height: 80rpx;text-align: center;line-height: 80rpx;font-weight: bold;">
|
|
提示
|
|
</view>
|
|
<view style="text-align: center;line-height: 50px;height: 100rpx;">
|
|
需要打印销售小票吗?
|
|
</view>
|
|
<view
|
|
style="display: flex;height: 100rpx;margin-top: 20rpx;border-top: 1px solid #eee;position: relative;">
|
|
<view @tap='printChenel'
|
|
style="width:250rpx;line-height: 100rpx;text-align: center;border-right: 1px solid #eee;">
|
|
暂不需要
|
|
</view>
|
|
<kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint"
|
|
style="width: 250rpx;height: 100rpx;line-height: 50px;color: #000;background:#088FEB;position: absolute;bottom: 0;text-align: center;right: 0;"></kk-printer>
|
|
</view>
|
|
</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';
|
|
export default {
|
|
data() {
|
|
return {
|
|
lsprice: 0, //临时零售价
|
|
wholesalePrice: 0, // 临时显示批发价
|
|
price: 0, //总金额
|
|
relPrice: "", //实收金额
|
|
otherExpense: "", // 其他费用
|
|
noPay: 0, //欠款
|
|
discountNum: 10, //整体折扣
|
|
priceCurrent: '',
|
|
goodsDetail: [],
|
|
columns: [],
|
|
keyList: [],
|
|
temporaryList: [],
|
|
zNum: 0,
|
|
bufferData: '',
|
|
zPrice: 0,
|
|
priceOk: '', //已收金额
|
|
value: 0,
|
|
valuexsy: '',
|
|
sex: [{
|
|
text: '平台配送',
|
|
value: 0
|
|
}, {
|
|
text: '自送',
|
|
value: 1
|
|
}],
|
|
priceItems: [{
|
|
value: '0',
|
|
name: '零售价'
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '批发价'
|
|
}
|
|
],
|
|
items: [{
|
|
value: '0',
|
|
name: '单品'
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '整体'
|
|
}
|
|
],
|
|
logisticsType: [{
|
|
value: '0',
|
|
name: '物流'
|
|
},
|
|
{
|
|
value: '1',
|
|
name: '快递'
|
|
},
|
|
{
|
|
value: '3',
|
|
name: '拼包'
|
|
},
|
|
{
|
|
value: '4',
|
|
name: '发车'
|
|
},
|
|
{
|
|
value: '2',
|
|
name: '自提'
|
|
},
|
|
],
|
|
discountType: '', //折扣类型
|
|
discountCurrent: '',
|
|
current: '',
|
|
discCurrent: '', //折扣
|
|
logisticsCurrent: '', //物流
|
|
categoryList: '', //销售员
|
|
radioType: '', //发货方式按钮选择
|
|
khName: [], //客户
|
|
gysName: [], //供应商
|
|
wlName: [], //物流公司/物流/发车
|
|
kdyName: [], //快递员
|
|
lbgName: [], //拉包工姓名
|
|
carList: new Map(), //添加商品页传回来的商品信息
|
|
xsyId: '',
|
|
shouldPay: 0,
|
|
totalAmount: 0,
|
|
customPrice: 0, //选择自定义金额
|
|
remark: '',
|
|
pbAddress: '',
|
|
carList1: [],
|
|
radioType1: 0,
|
|
saleId: '',
|
|
saleDetailList: [],
|
|
yNum: 150,
|
|
clearMsg:'',
|
|
priceType:''
|
|
}
|
|
},
|
|
components: {
|
|
kkPrinter
|
|
},
|
|
onShow() {
|
|
let that = this;
|
|
this.khName = JSON.parse(JSON.stringify(this.khName)) || ''
|
|
this.gysName = JSON.parse(JSON.stringify(this.gysName))
|
|
this.wlName = JSON.parse(JSON.stringify(this.wlName))
|
|
this.kdyName = JSON.parse(JSON.stringify(this.kdyName))
|
|
this.lbgName = JSON.parse(JSON.stringify(this.lbgName))
|
|
if (uni.getStorageSync('carList1') != '') {
|
|
this.carList.clear()
|
|
this.carList1 = JSON.parse(uni.getStorageSync('carList1'))
|
|
this.khName = uni.getStorageSync('khName') ? JSON.parse(uni.getStorageSync('khName')) : ''
|
|
this.remark = this.carList1[0].remark
|
|
this.saleId = this.carList1[0].saleId
|
|
this.xsyId = this.carList1[0].xsyId
|
|
this.createByName = this.carList1[0].createByName
|
|
} else {
|
|
this.carList1 = this.carList1
|
|
}
|
|
if (this.carList1 == '' && this.clearMsg != '1' && !uni.getStorageSync('saoma')) {
|
|
this.carList.clear()
|
|
this.remark = ''
|
|
this.clearMsg = '';
|
|
this.createByName = ''
|
|
this.xsyId = ''
|
|
this.khName = []
|
|
this.saleId = ''
|
|
}
|
|
|
|
for (let i = 0; i < this.carList1.length; i++) {
|
|
if (this.carList.size == 0) { //当前页没有数据
|
|
|
|
let obj = {
|
|
purchasePrice: this.carList1[i].price, //采购价
|
|
price: 0, //总价
|
|
discount: 10, //折扣
|
|
unitPrice: 0, //单价
|
|
discountAmount: 0, //折后价
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
|
|
lsprice: this.carList1[i].lsprice, //零售价
|
|
productCount: 0, //总数量
|
|
productId: this.carList1[i].id,
|
|
productName: this.carList1[i].productName,
|
|
productPicture: this.carList1[i].productPicture,
|
|
productSn: this.carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
stockLogList1: [],
|
|
supplierName: this.carList1[i].supplierName //供应商
|
|
}
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
|
|
}
|
|
this.carList.set(this.carList1[i].id, obj)
|
|
|
|
} else { //当前页有数据
|
|
|
|
if (this.carList.has(this.carList1[i].id) == true) { //商品相同
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i].saleDetailQueryDTO[
|
|
m].attributeList) == true) { //规格相同
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
|
|
m].attributeList, this.carList.get(this.carList1[i].id).stockLogList.get(this
|
|
.carList1[i].saleDetailQueryDTO[m].attributeList) + this.carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[
|
|
m].productCount
|
|
} else { //规格不同
|
|
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
|
|
m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount)
|
|
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[
|
|
m].productCount
|
|
}
|
|
}
|
|
} else { //商品不同
|
|
let obj = {
|
|
purchasePrice: this.carList1[i].price, //采购价
|
|
price: 0,
|
|
discount: 10,
|
|
discountAmount: 0,
|
|
unitPrice: 0, //单价
|
|
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
|
|
lsprice: this.carList1[i].lsprice, //零售价
|
|
productCount: 0,
|
|
productId: this.carList1[i].id,
|
|
productName: this.carList1[i].productName,
|
|
productPicture: this.carList1[i].productPicture,
|
|
stockLogList: new Map(),
|
|
stockLogList1: [],
|
|
productSn: this.carList1[i].productSn,
|
|
supplierName: this.carList1[i].supplierName
|
|
}
|
|
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
|
|
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
|
|
}
|
|
this.carList.set(this.carList1[i].id, obj)
|
|
}
|
|
}
|
|
}
|
|
uni.removeStorageSync('carList1')
|
|
uni.removeStorageSync('khName')
|
|
uni.removeStorageSync('saoma')
|
|
this.carList1 = []
|
|
this.carList.forEach(function(value, key) {
|
|
if (that.priceType == 0) { //零售
|
|
value.unitPrice = value.lsprice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.unitPrice = value.wholesalePrice
|
|
}
|
|
if (that.discountType == 1) { //整体折扣
|
|
value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000
|
|
}
|
|
})
|
|
this.getAllPrice()
|
|
this.getAmountAndWho()
|
|
this.noPay = this.shouldPay
|
|
},
|
|
filters: {
|
|
sliceMsg(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
name += newObj[as] + '/'
|
|
}
|
|
}
|
|
return name;
|
|
}
|
|
},
|
|
onLoad(option) {
|
|
this.xsyList();
|
|
},
|
|
methods: {
|
|
//页面初始化信息处理
|
|
pageMessage() {
|
|
|
|
|
|
},
|
|
//销售员列表
|
|
xsyList() {
|
|
this.tui.request('/app/common/user/findAllUserByShopId', 'get', {
|
|
|
|
}, false, false, true).then((res) => {
|
|
if (res.code !== 200) return
|
|
this.categoryList = res.result.map(item => {
|
|
return {
|
|
value: item.id,
|
|
text: item.nickname
|
|
}
|
|
})
|
|
})
|
|
},
|
|
attrNameChange(index, index1) {
|
|
this.goodsDetail.attributeList[index].value.forEach(item => {
|
|
item.isChecked = false;
|
|
})
|
|
this.goodsDetail.attributeList[index].isChecked = true;
|
|
this.goodsDetail.attributeList[index].value[index1].isChecked = true;
|
|
var name = '',
|
|
evalue = [],
|
|
obj = {}
|
|
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) {
|
|
if (Ien[m].isChecked == true) {
|
|
evalue.push(Ien[m].value)
|
|
name += Ien[m].value + '/'
|
|
}
|
|
}
|
|
}
|
|
this.keyList.map((item, index) => {
|
|
obj[item] = evalue[index]
|
|
})
|
|
let jishuqi = 0;
|
|
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
if (this.goodsDetail.attributeList[i].isChecked == true) {
|
|
jishuqi++
|
|
}
|
|
}
|
|
if (this.goodsDetail.attributeList.length == jishuqi) {
|
|
this.attributeList = {
|
|
attributeList: JSON.stringify(obj),
|
|
productCount: 0,
|
|
name: name,
|
|
price: this.purchasePrice
|
|
}
|
|
|
|
for (let i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
this.goodsDetail.attributeList[i].isChecked = false;
|
|
for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false
|
|
}
|
|
}
|
|
if (this.temporaryList.length == 0) {
|
|
this.temporaryList.push(this.attributeList);
|
|
} else {
|
|
for (var i = 0; i < this.temporaryList.length; i++) {
|
|
if (this.temporaryList[i].name.indexOf(this.attributeList.name) != -1) {
|
|
this.temporaryList[i] = this.attributeList
|
|
return
|
|
} else {
|
|
if (this.temporaryList.length == (i + 1)) {
|
|
this.temporaryList.push(this.attributeList);
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
changessPrice(e) {
|
|
|
|
this.relPrice = e.target.value
|
|
this.noPay = this.relPrice - this.priceOk;
|
|
},
|
|
changePrice(e) {
|
|
this.priceOk = e.target.value
|
|
this.noPay = this.relPrice - e.target.value;
|
|
},
|
|
getImg(key) {
|
|
|
|
|
|
return this.carList.get(key).productPicture
|
|
// value[1].productPicture
|
|
},
|
|
//切换销售员
|
|
categoryChange(e) {
|
|
for (let i = 0; i < this.categoryList.length; i++) {
|
|
if (this.categoryList[i].value == e) {
|
|
this.xsyId = e;
|
|
this.createByName = this.categoryList[i].text
|
|
}
|
|
}
|
|
},
|
|
//扫一扫功能
|
|
scanCodeAdd() {
|
|
// this.clearMsg = '1'
|
|
uni.setStorageSync('saoma','1')
|
|
uni.scanCode({
|
|
success: (res) => {
|
|
|
|
this.toggle('bottom', res.result);
|
|
},
|
|
fail: (res) => {
|
|
// this.clearMsg = '1'
|
|
uni.showToast({
|
|
title: '扫描失败',
|
|
icon: 'none'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//弹出商品规格选择
|
|
toggle(type, id) {
|
|
this.type = type
|
|
if (type == 'bottom') {
|
|
this.getById(id);
|
|
}
|
|
},
|
|
//整体选择是批发价还是零售价
|
|
priceChange(e) {
|
|
let that = this;
|
|
// if(this.carList.size == 0){
|
|
// this.tui.toast("请先选择商品")
|
|
// return
|
|
// }
|
|
this.priceType = e
|
|
this.carList.forEach(function(value, key) {
|
|
that.index = value.productId
|
|
if (e == 0) { //零售
|
|
that.checkPay(value.lsprice)
|
|
} else { //批发
|
|
that.checkPay(value.wholesalePrice)
|
|
}
|
|
})
|
|
},
|
|
//商品上选择是零售价还是批发价
|
|
checkPay(price) {
|
|
let that = this;
|
|
this.carList.get(this.index).discountAmount = price
|
|
this.carList.get(this.index).unitPrice = price;
|
|
that.carList.get(that.index).price = price * that.carList.get(that.index).productCount;
|
|
this.$refs.inputDialog.close()
|
|
this.getAllPrice()
|
|
that.relPrice = that.shouldPay
|
|
},
|
|
//整体选择时使用批发价、零售价,选择整体折扣的方法
|
|
getAmountAndWho(){
|
|
let that = this;
|
|
let price = 0
|
|
this.carList.forEach(function(value, key) {
|
|
if(that.priceType == 0){ //零售
|
|
price = value.lsprice
|
|
}else if(that.priceType == 1){ //批发
|
|
price = value.wholesalePrice
|
|
}
|
|
value.unitPrice = price;
|
|
if (that.discountType == 1) { //整体折扣
|
|
value.discountAmount = value.unitPrice * 10000 * that.discountNum / 10 / 10000
|
|
value.price = value.discountAmount * value.productCount
|
|
}
|
|
})
|
|
this.getAllPrice();
|
|
if(this.relPrice == '' || this.relPrice == 0){
|
|
that.noPay = that.shouldPay
|
|
}else if(this.relPrice != '' && this.priceOk != ''){
|
|
that.noPay = this.relPrice - this.priceOk
|
|
}
|
|
},
|
|
|
|
//通过商品id查询商品详细信息
|
|
getById(id) {
|
|
this.tui.request("/app/product/getById/" + id, "POST", {}, false, true).then((res) => {
|
|
if (res.code == 200) {
|
|
if (res.result.delFlag == 0) {
|
|
this.tui.toast("请将商品上架后再操作!")
|
|
return
|
|
}
|
|
this.goodsDetail = res.result;
|
|
this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
|
|
categoryId: this.goodsDetail.categoryId
|
|
}, false, true).then((res1) => {
|
|
if (res1.code == 200) {
|
|
this.$refs.shopPopup.open('bottom')
|
|
if (typeof(res1.result) == 'string') {
|
|
let newObj = JSON.parse(res1.result)
|
|
let newArr = []
|
|
for (let val in newObj) {
|
|
let valueObj = [];
|
|
for (var i = 0; i < newObj[val].length; i++) {
|
|
valueObj.push({
|
|
value: newObj[val][i],
|
|
isChecked: false
|
|
})
|
|
}
|
|
newArr.push({
|
|
name: val,
|
|
value: valueObj
|
|
})
|
|
}
|
|
this.goodsDetail.attributeList = newArr;
|
|
this.goodsDetail.attributeList.forEach((item, index) => {
|
|
this.columns[index] = item.value;
|
|
this.keyList[index] = item.name;
|
|
})
|
|
}
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
}).catch((res) => {})
|
|
},
|
|
temporaryChange(val) {
|
|
console.log('扫一扫',this.temporaryList)
|
|
this.zNum = 0
|
|
for (var i = 0; i < this.temporaryList.length; i++) {
|
|
this.zNum += this.temporaryList[i].productCount
|
|
}
|
|
},
|
|
//折扣种类选择
|
|
discountChange(e) {
|
|
let that = this;
|
|
// if(this.carList.size == 0){
|
|
// this.tui.toast("请先选择商品")
|
|
// return
|
|
// }
|
|
that.shouldPay = 0
|
|
this.discountType = e.detail.value;
|
|
this.carList.forEach(function(value, key) {
|
|
value.price = value.productCount * value.unitPrice //总价
|
|
value.discount = 10 //折扣
|
|
value.discountAmount = value.unitPrice
|
|
that.shouldPay += value.price
|
|
})
|
|
this.price = this.shouldPay //永远不变的总金额/实际折扣后的总金额
|
|
this.discountNum = 10
|
|
// shouldPay
|
|
for (let i = 0; i < this.items.length; i++) {
|
|
if (this.items[i].value === e.detail.value) {
|
|
this.discountCurrent = i;
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
changeRemark(e) {
|
|
this.remark = e.detail.value
|
|
},
|
|
changePbAddress(e) {
|
|
this.pbAddress = e.detail.value
|
|
},
|
|
//整体折扣数字框改变
|
|
change(e) {
|
|
if(e.detail.value > 10){
|
|
this.discountNum = 10
|
|
}else if(e.detail.value < 0){
|
|
this.discountNum = 0
|
|
}else{
|
|
this.discountNum = e.detail.value
|
|
}
|
|
this.getAmountAndWho()
|
|
|
|
},
|
|
//点击发货方式按钮
|
|
radioChange(e) {
|
|
this.gysName = ''
|
|
this.wlName = ''
|
|
this.kdyName = ''
|
|
this.lbgName = ''
|
|
//快递0 物流1 发车2 拼包3 自送4
|
|
this.radioType = e.detail.value;
|
|
for (let i = 0; i < this.logisticsType.length; i++) {
|
|
if (this.logisticsType[i].value === e.detail.value) {
|
|
this.current = i;
|
|
break;
|
|
}
|
|
}
|
|
},
|
|
//发货方式选择
|
|
goPopleList(popleType) {
|
|
if (popleType == 'kdyName' && this.wlName == '') {
|
|
uni.showToast({
|
|
title: "先选择快递公司",
|
|
icon: 'error'
|
|
})
|
|
return
|
|
}
|
|
let companyType = this.radioType == 1 ? this.wlName.id : ''
|
|
|
|
uni.navigateTo({
|
|
url: '/pages/index/peopleList?popleType=' + popleType + '&companyType=' + companyType
|
|
})
|
|
},
|
|
//弹窗选择规格后,点击弹窗中选好了按钮
|
|
temporaryCheck() {
|
|
let that = this,
|
|
carList1 = []
|
|
|
|
let data = {
|
|
id: this.goodsDetail.id,
|
|
price: this.zPrice,
|
|
num: this.zNum,
|
|
productName: this.goodsDetail.productName,
|
|
productSn: this.goodsDetail.productSn,
|
|
productPicture: this.goodsDetail.productPicture,
|
|
supplierName: this.goodsDetail.supplierName,
|
|
saleDetailQueryDTO: this.temporaryList,
|
|
wholesalePrice: this.goodsDetail.wholesalePrice,
|
|
lsprice: this.goodsDetail.price
|
|
}
|
|
carList1.push(data)
|
|
this.temporaryList = []
|
|
this.purchasePrice = ''
|
|
this.zPrice = ''
|
|
this.zNum = ''
|
|
for (let i = 0; i < this.goodsDetail.attributeList.length; i++) {
|
|
this.goodsDetail.attributeList[i].isChecked = false;
|
|
for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
|
|
this.goodsDetail.attributeList[i].value[m].isChecked = false
|
|
}
|
|
}
|
|
if (this.carList.size == 0) { //当前页没有数据
|
|
for (let i = 0; i < carList1.length; i++) {
|
|
let obj = {
|
|
purchasePrice: carList1[i].price, //采购价
|
|
price: 0, //总价
|
|
discount: 10, //折扣
|
|
unitPrice: 0, //单价
|
|
discountAmount: 0, //折后价
|
|
wholesalePrice: carList1[i].wholesalePrice, //批发价
|
|
lsprice: carList1[i].lsprice, //零售价
|
|
productCount: 0, //总数量
|
|
productId: carList1[i].id,
|
|
productName: carList1[i].productName,
|
|
productPicture: carList1[i].productPicture,
|
|
productSn: carList1[i].productSn,
|
|
stockLogList: new Map(),
|
|
stockLogList1: [],
|
|
supplierName: carList1[i].supplierName //供应商
|
|
}
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount
|
|
}
|
|
this.carList.set(carList1[i].id, obj)
|
|
}
|
|
carList1 = []
|
|
} else { //当前页有数据
|
|
for (let i = 0; i < carList1.length; i++) {
|
|
if (this.carList.has(carList1[i].id) == true) { //商品相同
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i].saleDetailQueryDTO[m]
|
|
.attributeList) == true) { //规格相同
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m]
|
|
.attributeList, this.carList.get(carList1[i].id).stockLogList.get(carList1[i]
|
|
.saleDetailQueryDTO[m].attributeList) + carList1[i].saleDetailQueryDTO[m]
|
|
.productCount)
|
|
this.carList.get(carList1[i].id).productCount += carList1[i].saleDetailQueryDTO[m]
|
|
.productCount
|
|
} else { //规格不同
|
|
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[
|
|
m].attributeList, carList1[i].saleDetailQueryDTO[m].productCount)
|
|
this.carList.get(carList1[i].id).productCount += carList1[i].saleDetailQueryDTO[m]
|
|
.productCount
|
|
}
|
|
}
|
|
} else { //商品不同
|
|
let obj = {
|
|
purchasePrice: carList1[i].price, //采购价
|
|
price: 0,
|
|
discount: 10,
|
|
discountAmount: 0,
|
|
unitPrice: 0, //单价
|
|
wholesalePrice: carList1[i].wholesalePrice, //批发价
|
|
lsprice: carList1[i].lsprice, //零售价
|
|
productCount: 0,
|
|
productId: carList1[i].id,
|
|
productName: carList1[i].productName,
|
|
productPicture: carList1[i].productPicture,
|
|
stockLogList: new Map(),
|
|
stockLogList1: [],
|
|
productSn: carList1[i].productSn,
|
|
supplierName: carList1[i].supplierName
|
|
}
|
|
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
|
|
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, carList1[i]
|
|
.saleDetailQueryDTO[m].productCount)
|
|
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount
|
|
}
|
|
this.carList.set(carList1[i].id, obj)
|
|
}
|
|
|
|
}
|
|
carList1 = []
|
|
|
|
}
|
|
this.carList.forEach(function(value, key) {
|
|
if (that.priceType == 0) { //零售
|
|
value.unitPrice = value.lsprice
|
|
} else if (that.priceType == 1) { //批发
|
|
value.unitPrice = value.wholesalePrice
|
|
}
|
|
if (that.discountType == 1) { //整体折扣
|
|
value.price = value.unitPrice * 10000 * value.productCount * that.discountNum / 10 / 10000
|
|
}
|
|
})
|
|
this.getAllPrice()
|
|
this.getAmountAndWho();
|
|
this.noPay = this.shouldPay
|
|
this.$refs.shopPopup.close()
|
|
|
|
},
|
|
//是否平台取货
|
|
checkBoxChange(e) {
|
|
this.radioType1 = e.detail.value
|
|
},
|
|
//点击加号手动添加商品
|
|
goodsAdd() {
|
|
uni.navigateTo({
|
|
url: '/pages/billing/changeGoods1'
|
|
})
|
|
},
|
|
//点击底部开单按钮
|
|
goSell() {
|
|
if (this.khName == '') {
|
|
this.tui.toast('请选择客户!')
|
|
return
|
|
}
|
|
if (this.xsyId == '') {
|
|
this.tui.toast('请选择销售员!')
|
|
return
|
|
}
|
|
if (this.shouldPay == 0) {
|
|
this.tui.toast('请维护商品金额!')
|
|
return
|
|
}
|
|
if (this.relPrice == (0 || '')) {
|
|
this.tui.toast('请输入实收金额!')
|
|
return
|
|
} else if (this.priceOk == (0 || '')) {
|
|
this.tui.toast('请输入已收金额!')
|
|
return
|
|
}
|
|
if (this.carList.size == 0) {
|
|
this.tui.toast('请添加商品!')
|
|
return
|
|
}
|
|
if (this.radioType != '') {
|
|
if (this.radioType == 0 || this.radioType == 1 || this.radioType == 4) {
|
|
if (this.wlName == '') {
|
|
this.tui.toast('请选择配送公司!')
|
|
return
|
|
}
|
|
// if(this.radioType1 == 0){
|
|
// if(this.lbgName == ''){
|
|
// this.tui.toast('请选择配送人员!')
|
|
// return
|
|
// }
|
|
|
|
// }
|
|
} else if (this.radioType == 3) {
|
|
if (this.pbAddress == '') {
|
|
this.tui.toast('请输入拼包地址!')
|
|
return
|
|
}
|
|
}
|
|
} else {
|
|
this.tui.toast('请选择发货方式!')
|
|
return
|
|
}
|
|
let obj = {
|
|
orderByWorker: this.lbgName.workerId,
|
|
oldSaleId: this.saleId,
|
|
sale: {
|
|
// relPrice:,
|
|
alreadyEarn: this.priceOk, //已付金额
|
|
realAmount: this.relPrice, //实收金额
|
|
noEarn: this.relPrice - this.priceOk, //欠款
|
|
totalAmount: this.shouldPay, //总金额
|
|
area: this.khName.area,
|
|
city: this.khName.city,
|
|
province: this.khName.province,
|
|
payStatus: 1,
|
|
receiveAddress: this.khName.address,
|
|
userId: this.khName.id,
|
|
userName: this.khName.name,
|
|
transportType: this.radioType1 == 1 ? 2 : this.radioType, //this.radioType
|
|
discount: this.discountNum,
|
|
createBy: this.xsyId,
|
|
createByName: this.createByName,
|
|
remark: this.remark,
|
|
otherExpense: this.otherExpense == '' ? 0 : this.otherExpense, //其他费用
|
|
shareAddress: this.pbAddress,
|
|
transCompany: this.wlName.id,
|
|
companyName: this.wlName.companyName,
|
|
},
|
|
saleDetailList: []
|
|
}
|
|
let purchaseDetails = [];
|
|
this.carList.forEach(function(value, key) {
|
|
|
|
value.stockLogList.forEach(function(values, keys) {
|
|
let obj = {
|
|
productCount: values,
|
|
attributeList: keys
|
|
}
|
|
value.stockLogList1.push(obj)
|
|
})
|
|
|
|
purchaseDetails.push(value)
|
|
})
|
|
this.saleDetailList = purchaseDetails;
|
|
obj.saleDetailList = purchaseDetails;
|
|
let url = ''
|
|
if (this.saleId != '') {
|
|
url = '/app/sale/shareToBuyNew'
|
|
} else {
|
|
url = '/app/sale/buyNew'
|
|
}
|
|
this.tui.request(url, "post", obj, false, false).then((res) => {
|
|
if (res.code == 200) {
|
|
uni.showToast({
|
|
title: "开单成功",
|
|
icon: 'none'
|
|
})
|
|
setTimeout(res => {
|
|
this.$refs.printerPopup.open('center')
|
|
}, 1000)
|
|
|
|
} else {
|
|
this.tui.toast(res.message)
|
|
}
|
|
})
|
|
|
|
},
|
|
//打印取消按钮
|
|
printChenel() {
|
|
uni.redirectTo({
|
|
url: "/pages/index/order"
|
|
})
|
|
},
|
|
//打印小票
|
|
onPrint(opt) {
|
|
let that = this;
|
|
let strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
|
|
strCmd += blesdk.addCPCLSETMAG(2, 2)
|
|
blesdk.addCPCLSETBOLD('bold')
|
|
strCmd += blesdk.addCPCLLocation(2); //对齐指令 0-左对齐 1-右对齐 2-居中
|
|
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, uni.getStorageSync('shopName'))
|
|
|
|
strCmd += blesdk.addCPCLSETMAG(1, 1)
|
|
strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中
|
|
strCmd += blesdk.addCPCLText('0', '100', '24', '0', 0, '客户:' + this.khName.name)
|
|
strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '销售:' + this.createByName)
|
|
strCmd += blesdk.addCPCLText('280', '130', '24', '0', 0, '日期:' + this.formatDate(new Date(),
|
|
'YYYY-MM-DD')) //+
|
|
strCmd += blesdk.addCPCLText('0', '150', '24', '0', 0,
|
|
'=========================================================')
|
|
|
|
this.carList.forEach(function(value, key) {
|
|
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, value.productName + '(' +
|
|
value.productSn + ')' + '折扣:' + (value.discount < 10 ? value.discount : '无折扣'))
|
|
value.stockLogList.forEach(function(value1, key1) {
|
|
strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, (that.slicePrint(
|
|
key1)) + '*' + value1)
|
|
strCmd += blesdk.addCPCLText('200', that.yNum, '24', '0', 0, '单价:' + value.lsprice)
|
|
strCmd += blesdk.addCPCLText('360', that.yNum, '24', '0', 0, '总价:' + (value
|
|
.lsprice * value1))
|
|
})
|
|
})
|
|
|
|
strCmd += blesdk.addCPCLText('0', this.yNum += 20, '24', '0', 0,
|
|
'===============================================================')
|
|
strCmd += blesdk.addCPCLText('0', this.yNum += 30, '24', '0', 0, '总数量:' + this.totalAmount)
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额' + this.shouldPay)
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.relPrice)
|
|
strCmd += blesdk.addCPCLText('0', this.yNum += 30, '24', '0', 0, '实收:' + this.priceOk)
|
|
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + this.noPay)
|
|
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + this.otherExpense)
|
|
strCmd += blesdk.addCPCLText('0', this.yNum += 30, '24', '0', 0, '备注:' + this.remark)
|
|
|
|
|
|
strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中
|
|
strCmd += blesdk.addCPCLPrint();
|
|
this.bufferData = strCmd;
|
|
uni.redirectTo({
|
|
url: "/pages/index/order"
|
|
})
|
|
},
|
|
//截取
|
|
slicePrint(val) {
|
|
var name = ''
|
|
if (typeof(val) == 'string') {
|
|
let newObj = JSON.parse(val)
|
|
for (let as in newObj) {
|
|
name += newObj[as] + '/'
|
|
}
|
|
}
|
|
return name;
|
|
},
|
|
formatDate(date, fmt) {
|
|
var o = {
|
|
'M+': date.getMonth() + 1, //月份
|
|
'D+': date.getDate(), //日
|
|
'H+': date.getHours(), //小时
|
|
'm+': date.getMinutes(), //分
|
|
's+': date.getSeconds(), //秒
|
|
'q+': Math.floor((date.getMonth() + 3) / 3), //季度
|
|
'S': date.getMilliseconds() //毫秒
|
|
};
|
|
if (/(Y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length));
|
|
for (var k in o)
|
|
if (new RegExp('(' + k + ')').test(fmt))
|
|
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k])
|
|
.length)));
|
|
return fmt;
|
|
},
|
|
//编辑每一个的单价
|
|
clickPrice(index) {
|
|
this.index = index
|
|
this.wholesalePrice = this.carList.get(this.index).wholesalePrice
|
|
this.lsprice = this.carList.get(this.index).lsprice
|
|
this.$refs.inputDialog.open()
|
|
},
|
|
//输入商品自定义金额
|
|
changePay(e) {
|
|
this.customPrice = e.detail.value
|
|
},
|
|
//更改单品折扣
|
|
changeDis(e, id) {
|
|
let that = this;
|
|
let carlist = this.carList.get(id)
|
|
if(e.detail.value > 10){
|
|
carlist.discount = 10;
|
|
}else if(e.detail.value < 0){
|
|
carlist.discount = 0;
|
|
}else{
|
|
carlist.discount = e.detail.value;
|
|
}
|
|
console.log(carlist.discount)
|
|
|
|
carlist.discountAmount = carlist.unitPrice * carlist.discount / 10
|
|
carlist.price = carlist.unitPrice * carlist.discount / 10 * carlist.productCount
|
|
this.getAllPrice()
|
|
},
|
|
//删除整条商品
|
|
delShop(id) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条商品吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
if (that.carList.has(id) == true) {
|
|
that.carList.delete(id)
|
|
}
|
|
that.$forceUpdate()
|
|
that.getAllPrice()
|
|
that.getAmountAndWho()
|
|
}
|
|
}
|
|
})
|
|
|
|
},
|
|
//删除商品下的某一个规格
|
|
delShopSpec(id, name) {
|
|
var that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定删除此条商品吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
console.log(that.carList.get(id))
|
|
that.carList.get(id).productCount -= that.carList.get(id).stockLogList.get(name);
|
|
that.carList.get(id).stockLogList.delete(name);
|
|
that.carList.get(id).price = that.carList.get(id).productCount * that.carList.get(id).unitPrice
|
|
if (that.carList.get(id).stockLogList.size == 0) {
|
|
that.carList.delete(id)
|
|
}
|
|
that.getAllPrice()
|
|
that.getAmountAndWho()
|
|
}
|
|
that.$forceUpdate()
|
|
}
|
|
})
|
|
|
|
},
|
|
//计算总金额和总数量
|
|
getAllPrice(){
|
|
let that = this;
|
|
this.shouldPay = 0
|
|
this.totalAmount = 0
|
|
|
|
this.carList.forEach(function(value, key) {
|
|
that.shouldPay = that.shouldPay + value.price
|
|
that.totalAmount = that.totalAmount + value.productCount
|
|
})
|
|
this.relPrice = this.shouldPay
|
|
that.noPay = this.relPrice - this.priceOk
|
|
},
|
|
//修改已选规格的数量
|
|
GoodsNumChange(e, index, index1) {
|
|
let that = this;
|
|
this.carList.get(index).stockLogList.set(index1, e)
|
|
this.carList.get(index).productCount = 0
|
|
this.carList.get(index).stockLogList.forEach(function(value, key) {
|
|
that.carList.get(index).productCount = that.carList.get(index).productCount + value
|
|
if (that.discountType == 0) { //单品折扣
|
|
that.carList.get(index).price = that.carList.get(index).productCount * that.carList.get(index)
|
|
.unitPrice * that.carList.get(index).discount / 10
|
|
}else{
|
|
that.carList.get(index).price = that.carList.get(index).productCount * that.carList.get(index)
|
|
.unitPrice
|
|
}
|
|
})
|
|
that.getAllPrice()
|
|
that.getAmountAndWho();
|
|
},
|
|
//清空全部数据
|
|
clearAll() {
|
|
let that = this;
|
|
uni.showModal({
|
|
title: "提示",
|
|
content: "确定清空全部已选商品吗?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.carList.clear()
|
|
that.remark = ''
|
|
that.temporaryList = []
|
|
that.purchasePrice = 0
|
|
that.zPrice = 0
|
|
that.zNum = 0
|
|
that.shouldPay = 0
|
|
that.gysName = []
|
|
that.wlName = []
|
|
that.kdyName = []
|
|
that.lbgName = []
|
|
that.relPrice = 0
|
|
that.priceOk = 0
|
|
that.noPay = 0
|
|
that.otherExpense = 0
|
|
that.totalAmount = 0
|
|
that.createByName = ''
|
|
that.xsyId = ''
|
|
this.saleId = ''
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
page,
|
|
.page1 {
|
|
height: 100%;
|
|
}
|
|
|
|
.popup-pay-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 15px;
|
|
width: 500rpx;
|
|
height: auto;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.content {
|
|
border-top: 1px solid #eee;
|
|
overflow-y: scroll;
|
|
max-height: 100vh;
|
|
}
|
|
|
|
.content-box {
|
|
width: 100%;
|
|
height: auto;
|
|
background: #fff;
|
|
margin-bottom: 20rpx;
|
|
|
|
}
|
|
|
|
.popup-pay-title {
|
|
font-size: 36rpx;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
position: relative;
|
|
}
|
|
|
|
.popup-pay-container {
|
|
margin-top: 20rpx;
|
|
height: 100rpx;
|
|
border-radius: 10px;
|
|
background: #088FEB;
|
|
line-height: 100rpx;
|
|
text-align: center;
|
|
border-bottom: 1px solid #eee;
|
|
border-top: 1px solid #eee;
|
|
color: #fff;
|
|
}
|
|
|
|
.content-list {
|
|
width: 95%;
|
|
margin: 0 auto;
|
|
display: flex;
|
|
height: 80rpx;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.content-list:last-child {
|
|
border-bottom: none;
|
|
height: auto;
|
|
}
|
|
|
|
.list-name {
|
|
width: 200rpx;
|
|
text-align: left;
|
|
line-height: 40px;
|
|
height: 80rpx;
|
|
padding-left: 20rpx;
|
|
}
|
|
|
|
.list-val {
|
|
width: 560rpx;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
}
|
|
|
|
.list-val input {
|
|
width: 400rpx;
|
|
height: 60rpx;
|
|
display: inline-block;
|
|
line-height: 60rpx;
|
|
float: left;
|
|
margin-top: 10rpx;
|
|
padding-left: 20rpx;
|
|
border-bottom: 1px solid #088FEB;
|
|
}
|
|
|
|
.uni-data-select {
|
|
width: 80%;
|
|
text-align: center;
|
|
}
|
|
|
|
.uni-select {
|
|
border: none !important;
|
|
border-radius: 0 !important;
|
|
}
|
|
|
|
.uni-select__input-placeholder {
|
|
color: #6a6a6a;
|
|
font-size: 28rpx !important;
|
|
width: 400rpx;
|
|
}
|
|
|
|
.uni-select__input-box {
|
|
.uni-icons {
|
|
margin-left: 50rpx;
|
|
margin-right: 5px;
|
|
}
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.discount-num {
|
|
width: 160rpx;
|
|
}
|
|
|
|
.shop-productName {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
padding-left: 20rpx;
|
|
}
|
|
|
|
.shop-productName view {
|
|
height: 55rpx;
|
|
}
|
|
|
|
.checklist-group {
|
|
height: 80rpx !important;
|
|
}
|
|
|
|
// .shop-name {
|
|
// .uni-icons {
|
|
// color: #088FEB !important;
|
|
// }
|
|
// }
|
|
|
|
.shop-collapse {
|
|
display: flex;
|
|
height: 80rpx;
|
|
font-size: 26rpx;
|
|
line-height: 80rpx;
|
|
}
|
|
|
|
.shop-collapse text {
|
|
width: 40%;
|
|
text-align: center;
|
|
// padding-right: 40rpx;
|
|
border-right: 1px solid #eee;
|
|
}
|
|
|
|
.shop-collapse-item {
|
|
display: flex;
|
|
text-align: center;
|
|
background: #eee;
|
|
height: 110rpx;
|
|
|
|
.input {
|
|
border: 1px solid #eee;
|
|
background: #fff;
|
|
height: 60rpx;
|
|
}
|
|
}
|
|
|
|
.price-box-title {
|
|
width: 95%;
|
|
height: 80rpx;
|
|
line-height: 80rpx;
|
|
margin: 0 auto;
|
|
display: flex;
|
|
text-align: center;
|
|
border-bottom: 1px solid #eee;
|
|
}
|
|
|
|
.price-box-title text {
|
|
flex: 1;
|
|
}
|
|
|
|
.uni-list-cell {
|
|
display: flex;
|
|
margin-right: 20rpx;
|
|
}
|
|
|
|
|
|
|
|
|
|
.bottom-box {
|
|
width: 100%;
|
|
position: absolute;
|
|
bottom: 0rpx;
|
|
display: flex;
|
|
background: #fff;
|
|
border-top: 1px solid #eee;
|
|
height: 110rpx;
|
|
z-index: 98;
|
|
}
|
|
|
|
.bottom-left {
|
|
flex: 1;
|
|
height: 110rpx;
|
|
line-height: 110rpx;
|
|
}
|
|
|
|
.bottom-right {
|
|
width: 60%;
|
|
display: flex;
|
|
|
|
.bottom-btn {
|
|
margin: 0;
|
|
padding: 0;
|
|
width: 45%;
|
|
line-height: 35px;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
margin-top: 10rpx;
|
|
color: #fff;
|
|
font-size: 28rpx;
|
|
border-radius: 0;
|
|
}
|
|
|
|
.bottom-btn:first-child {
|
|
background: linear-gradient(90deg, #FF9797, #FFC1E0);
|
|
border-top-left-radius: 70rpx;
|
|
border-bottom-left-radius: 70rpx;
|
|
margin-left: 20rpx;
|
|
}
|
|
|
|
.bottom-btn:last-child {
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
border-top-right-radius: 70rpx;
|
|
border-bottom-right-radius: 70rpx;
|
|
}
|
|
}
|
|
|
|
.bottom-left text {
|
|
line-height: 84rpx;
|
|
display: inline-block;
|
|
padding-left: 20rpx;
|
|
}
|
|
|
|
.bottom-btn {
|
|
width: 320rpx;
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
color: #fff;
|
|
border-radius: 50rpx;
|
|
height: 85rpx;
|
|
margin-top: 15rpx;
|
|
}
|
|
|
|
textarea {
|
|
margin: 20rpx;
|
|
border: 1px solid #eee;
|
|
height: 150rpx;
|
|
width: 500rpx;
|
|
}
|
|
|
|
.shop-popup-content {
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 15px;
|
|
height: 1200rpx;
|
|
background-color: #fff;
|
|
}
|
|
|
|
.shop-popup-title {
|
|
display: flex;
|
|
height: 180rpx;
|
|
border-bottom: 1px solid #eee;
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.shop-popup-title-left {
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
}
|
|
|
|
.shop-popup-title-left img {
|
|
width: 150rpx;
|
|
height: 150rpx;
|
|
|
|
}
|
|
|
|
.shop-popup-title-right {
|
|
width: 400rpx;
|
|
margin-left: 30rpx;
|
|
}
|
|
|
|
.shop-popup-title-right-box {
|
|
height: 50rpx;
|
|
line-height: 50rpx;
|
|
}
|
|
|
|
.shop-popup-container {
|
|
width: 100%;
|
|
background: #fff;
|
|
height: 50rpx;
|
|
}
|
|
|
|
.shop-title-fur {
|
|
width: 95%;
|
|
height: 70rpx;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.shop-title-name {
|
|
font-size: 30rpx;
|
|
width: 50%;
|
|
float: left;
|
|
height: 70rpx;
|
|
line-height: 70rpx;
|
|
}
|
|
|
|
.shop-attrs {
|
|
text {
|
|
display: inline-block;
|
|
border: 1px solid #5fd9ee;
|
|
margin: 20rpx;
|
|
background-color: #fff;
|
|
color: #5fd9ee;
|
|
width: 100rpx;
|
|
line-height: 70rpx;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
}
|
|
|
|
.checkedText {
|
|
background-color: $u-primary;
|
|
color: #fff;
|
|
}
|
|
}
|
|
|
|
.shop-checkList {
|
|
display: flex;
|
|
height: 50rpx;
|
|
font-size: 28rpx;
|
|
line-height: 50rpx;
|
|
margin: 20rpx 0;
|
|
}
|
|
|
|
.shop-checkList-box {
|
|
height: 50rpx;
|
|
width: 60%;
|
|
}
|
|
|
|
.shop-popup-bottom {
|
|
width: 100%;
|
|
height: 100rpx;
|
|
position: fixed;
|
|
bottom: 0;
|
|
display: flex;
|
|
}
|
|
|
|
.shop-popup-bottom-left {
|
|
width: 50%;
|
|
line-height: 80rpx;
|
|
}
|
|
|
|
.shop-popup-bottom-right {
|
|
width: 50%;
|
|
line-height: 100rpx;
|
|
|
|
.bottom-btn {
|
|
width: 70%;
|
|
line-height: 35px;
|
|
height: 70rpx;
|
|
text-align: center;
|
|
color: #fff;
|
|
font-size: 28rpx;
|
|
margin: 0 auto;
|
|
background: linear-gradient(90deg, #60F3FF, #088FEB);
|
|
border-radius: 70rpx;
|
|
}
|
|
}
|
|
|
|
// .uni-select__input-text{
|
|
// text-align: center !important;
|
|
// padding-left: 80rpx;
|
|
// }
|
|
.uni-data-checklist {
|
|
.checklist-box {
|
|
margin-left: 100rpx !important;
|
|
}
|
|
|
|
.checklist-box:last-child {
|
|
margin-left: 46rpx !important;
|
|
}
|
|
}
|
|
|
|
.uni-numbox {
|
|
input {
|
|
padding-left: 0;
|
|
}
|
|
}
|
|
</style>
|