wangfukang 2 years ago
parent
commit
0a768b1516
  1. BIN
      pages/.DS_Store
  2. 189
      pages/billing/changeGoods1.vue
  3. 1
      pages/index/checkShop.vue
  4. 11
      pages/index/index.vue
  5. 2
      pages/index/waitStorage.vue
  6. 1
      pages/index/waitStorageDetail.vue
  7. 5
      pages/inventory/changeGoods1.vue
  8. 683
      pages/inventory/goodsList1.vue
  9. 7
      pages/inventory/inventory.vue
  10. 14
      pages/inventory/inventoryDetail.vue

BIN
pages/.DS_Store

Binary file not shown.

189
pages/billing/changeGoods1.vue

@ -4,7 +4,7 @@
<uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none" <uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none"
@confirm="search" @blur="search" @clear="clearSearch" /> @confirm="search" @blur="search" @clear="clearSearch" />
</view> </view>
<view class="content-box" style="height:100%;margin-bottom: 100rpx;"> <view class="content-box" style="height:97%;">
<view class="content-left"> <view class="content-left">
<view class="left-box" v-if="gateType == ''" v-for="(item, index) in indexList" :key="index" <view class="left-box" v-if="gateType == ''" v-for="(item, index) in indexList" :key="index"
:class="item.parentId ? 'left-box-hover':''" @tap="clickLeftBtn(index)"> :class="item.parentId ? 'left-box-hover':''" @tap="clickLeftBtn(index)">
@ -173,7 +173,26 @@
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
</view> </view>
<uni-popup ref="goodsNumDialog" background-color="#fff">
<view class="add-popup-content">
<view class="add-popup-title">
<text>请输入拿货数量</text>
<uni-icons @tap='$refs.goodsNumDialog.close()' type="closeempty" color='red' size="16"
style="height:40rpx;line-height: 40rpx;position: absolute !important;bottom:0;right: 30rpx;"></uni-icons>
</view>
<view class="add-popup-container">
<view>
<text style="color:red;font-size:22rpx;">*您的此款商品只有一个规格,可直接输入拿货数量即可</text>
</view>
<input type="number" v-model="goodsNum" :focus="focus" style="width: 100%;border: 1px solid #eee;height: 80rpx;padding-left: 20rpx;margin:20rpx 0;font-size: 25rpx;line-height: 80rpx;"
placeholder="请输入此商品拿货数量">
<view class="add-popup-bottom">
<view class="add-popup-btn" @tap="oneGoodsToCarList">确认</view>
</view>
</view>
</view>
</uni-popup>
<!-- 购物车弹出层 --> <!-- 购物车弹出层 -->
<uni-popup ref="carPopup" background-color="#fff" @change="change"> <uni-popup ref="carPopup" background-color="#fff" @change="change">
<view class="popup-content"> <view class="popup-content">
@ -228,7 +247,8 @@
components: {}, components: {},
data() { data() {
return { return {
indexList: [], indexList: [],
focus:false,
pageNum: 1, //分页的页码 pageNum: 1, //分页的页码
shopList: [], shopList: [],
shopList1:[], shopList1:[],
@ -238,17 +258,18 @@
shopId: '', //店铺id, shopId: '', //店铺id,
checkbox: [], //需要分享的商品id checkbox: [], //需要分享的商品id
temporaryNum: 0, temporaryNum: 0,
allChangeNum:0, allChangeNum:0,
oneGoodsSpec:[],
goodsDetail: [], goodsDetail: [],
attrNameList: [], attrNameList: [],
temporaryList: [], temporaryList: [],
isPlusAndMinus:false, isPlusAndMinus:false,
carList: [], carList: [],
evalue: [],
attributeList: [], attributeList: [],
purchasePrice: 0, purchasePrice: 0,
zPrice: 0, zPrice: 0,
zNum: 0, zNum: 0,
goodsNum:'',
storageType: '', storageType: '',
carNum: 0, carNum: 0,
carType: 0, carType: 0,
@ -666,7 +687,7 @@
data = { data = {
categoryId: "", categoryId: "",
searchStr: this.searchName, searchStr: this.searchName,
pageNum: this.pageNum, pageNum: 1,
pageSize: '10' pageSize: '10'
} }
}else{ }else{
@ -735,7 +756,6 @@
this.goodsList = [] this.goodsList = []
this.allChangeNum = 0 this.allChangeNum = 0
this.checkGoods(item); this.checkGoods(item);
this.$refs.popup.open('bottom')
} }
}, },
@ -759,7 +779,7 @@
} }
await this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", { await this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
categoryId: this.goodsDetail.categoryId categoryId: this.goodsDetail.attrId
}, false, true).then((res1) => { }, false, true).then((res1) => {
if (res1.code == 200) { if (res1.code == 200) {
if (typeof(res1.result) == 'string') { if (typeof(res1.result) == 'string') {
@ -798,32 +818,45 @@
value: valueObj value: valueObj
}) })
} }
this.goodsDetail.attributeList = newArr; this.focus = false
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) { if(newArr[0].value.length == 1 && newArr[1].value.length == 1){
let oldCheck = false console.log('只有一个',newArr)
let oldValue = [] this.oneGoodsSpec = newArr
for (var m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) { // this.oneGoodsToCarList(newArr)
if(this.goodsDetail.attributeList[i].value[m].isChecked == true){ this.$refs.goodsNumDialog.open('center')
oldCheck = true this.$nextTick(() => {
oldValue.push(this.goodsDetail.attributeList[i].value[m].value) this.focus = true
} })
} }else{
if(oldCheck){ this.$refs.popup.open('bottom')
let specs1 = { this.goodsDetail.attributeList = newArr;
specs:[] for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
let oldCheck = false
let oldValue = []
for (var m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
if(this.goodsDetail.attributeList[i].value[m].isChecked == true){
oldCheck = true
oldValue.push(this.goodsDetail.attributeList[i].value[m].value)
}
} }
if(oldCheck){
specs1.specs = oldValue let specs1 = {
this.goodsList.push(specs1) specs:[]
}else{ }
let specs1 = {
specs:[] specs1.specs = oldValue
this.goodsList.push(specs1)
}else{
let specs1 = {
specs:[]
}
this.goodsList.push(specs1)
} }
this.goodsList.push(specs1) oldCheck = false
oldValue = []
} }
oldCheck = false
oldValue = []
} }
} }
} else { } else {
@ -832,6 +865,64 @@
}).catch((res) => {}) }).catch((res) => {})
this.getKCList(item.id); this.getKCList(item.id);
}, },
oneGoodsToCarList(){
let that = this;
// this.oneGoodsSpec //规格
// this.goodsNum //数量
this.evalue = []
var value = []
var name = ''
let value1 = "{"
name = this.oneGoodsSpec[0].value[0].value + '/' + this.oneGoodsSpec[1].value[0].value
value1 += '"'+this.oneGoodsSpec[0].name + '":"' + this.oneGoodsSpec[0].value[0].value + '",'
value1 += '"'+this.oneGoodsSpec[1].name + '":"' + this.oneGoodsSpec[1].value[0].value + '"'
value1 += "}"
value.push(value1)
this.evalue.push(name)
for (var i = 0; i < value.length; i++) {
this.attributeList = {
attributeList: value[i],
productCount: this.goodsNum,
productNum:0,
name: this.evalue[i],
price: this.goodsDetail.purchasePrice
}
this.temporaryList.push(this.attributeList);
}
let data = {
id: this.goodsDetail.id,
price: this.zPrice,
num: this.zNum,
categoryId:this.goodsDetail.categoryId,
productName: this.goodsDetail.productName,
productSn: this.goodsDetail.productSn,
productPicture: this.goodsDetail.productPicture,
supplierName: this.goodsDetail.supplierName,
saleDetailQueryDTO: this.temporaryList,
saleDetailQueryDTO1: [],
wholesalePrice: this.goodsDetail.wholesalePrice,
lsprice: this.goodsDetail.price
}
if (this.carList.length == 0) {
this.carList.push(data)
} else {
let aa = true;
for (let i = 0; i < this.carList.length; i++) {
if (this.carList[i].id == data.id) {
this.carList[i] = data
aa = false
}
}
if (aa) {
this.carList.push(data)
}
}
this.$nextTick(()=>{
that.$refs.goodsNumDialog.close()
that.goodsNum = ''
})
},
//库存商品详情 //库存商品详情
getKCList(id) { getKCList(id) {
this.yanseList = new Map() this.yanseList = new Map()
@ -1229,7 +1320,8 @@
.content-right { .content-right {
flex: 1; flex: 1;
overflow-y: scroll; overflow-y: scroll;
padding-bottom: 100rpx;
} }
.right-box { .right-box {
@ -1466,5 +1558,38 @@
.zuni-numbox .zuni-numbox--disabled { .zuni-numbox .zuni-numbox--disabled {
color: #c0c0c0 !important; color: #c0c0c0 !important;
cursor: not-allowed; cursor: not-allowed;
}
.add-popup-content {
align-items: center;
justify-content: center;
padding: 15px;
width: 500rpx;
height: 410rpx;
background-color: #fff;
}
.add-popup-title {
font-size: 36rpx;
font-weight: bold;
text-align: center;
position: relative;
}
.add-popup-container {
margin-top: 20rpx;
}
.add-popup-bottom {
display: flex;
height: 80rpx;
color: #fff;
line-height: 80rpx;
margin-top: 30rpx;
}
.add-popup-btn {
flex: 1;
text-align: center;
background: linear-gradient(90deg, #60F3FF, #088FEB);
} }
</style> </style>

1
pages/index/checkShop.vue

@ -86,6 +86,7 @@
uni.setStorageSync('shopName', this.name) uni.setStorageSync('shopName', this.name)
uni.setStorageSync('shopAddress', res.result.shopAddress) uni.setStorageSync('shopAddress', res.result.shopAddress)
uni.setStorageSync('shopIcon', res.result.shopIcon) uni.setStorageSync('shopIcon', res.result.shopIcon)
uni.setStorageSync('type', res.result.userType)
this.tui.toast('切换店铺成功', 2000, true) this.tui.toast('切换店铺成功', 2000, true)
setTimeout(() => { setTimeout(() => {
uni.reLaunch({ uni.reLaunch({

11
pages/index/index.vue

@ -135,7 +135,7 @@
<u-cell icon="account-fill" url="/package1/index/order?type=dingdan" title="销售单历史" clickable <u-cell icon="account-fill" url="/package1/index/order?type=dingdan" title="销售单历史" clickable
isLink arrow-direction="left"></u-cell> isLink arrow-direction="left"></u-cell>
<view class="border-line"></view> <view class="border-line"></view>
<u-cell v-if="shopName == '老王测试店铺' || shopName == '田一的店'" icon="integral-fill" url="/package1/AI/addAiList" title="管理员登录" clickable isLink <u-cell v-if="shopName == '老王测试店铺' || shopName == '田一的店' || shopName == '青星'|| shopName == '侧视颠仆'" icon="integral-fill" url="/package1/AI/addAiList" title="管理员登录" clickable isLink
arrow-direction="left"></u-cell> arrow-direction="left"></u-cell>
<!-- <u-cell icon="integral-fill" url="" title="电费缴纳" clickable isLink <!-- <u-cell icon="integral-fill" url="" title="电费缴纳" clickable isLink
arrow-direction="left"></u-cell> arrow-direction="left"></u-cell>
@ -233,10 +233,6 @@
return val; return val;
} }
}, },
onShow() {
this.getSaleInfo()
},
onLoad() { onLoad() {
let that = this; let that = this;
wx.getLocation({ wx.getLocation({
@ -266,7 +262,7 @@
uni.setStorageSync("publicize", day) uni.setStorageSync("publicize", day)
this.$refs.publicizepopup.open('center') this.$refs.publicizepopup.open('center')
} }
this.getSaleInfo()
}, },
onTabItemTap(e) { onTabItemTap(e) {
this.getSaleInfo() this.getSaleInfo()
@ -276,7 +272,8 @@
this.$refs.publicizepopup.close() this.$refs.publicizepopup.close()
}, },
getSaleInfo() { getSaleInfo() {
this.shopInfo = {} this.shopInfo = {}
this.inventoryList = []
this.tui.request("/app/sale/getShopAll", "POST", { this.tui.request("/app/sale/getShopAll", "POST", {
pageVo: { pageVo: {
pageSize: 5, pageSize: 5,

2
pages/index/waitStorage.vue

@ -16,7 +16,7 @@
<view class="uni-body"><text class="cardText"> <view class="uni-body"><text class="cardText">
入库人:</text>{{item.createByName == null ?'暂无':item.createByName}} 入库人:</text>{{item.createByName == null ?'暂无':item.createByName}}
</view> </view>
<view class="uni-body" v-if="type==0"> <view class="uni-body" v-if="item.inStorageStatus != 0 && type==0">
<text class="cardText">总成本:</text> <text class="cardText">总成本:</text>
<text class="priceText">{{item.shouldPay == null ?'暂无':item.shouldPay}} </text> <text class="priceText">{{item.shouldPay == null ?'暂无':item.shouldPay}} </text>
<text decode class="cardText">{{'&nbsp;&nbsp;&nbsp;&nbsp; 欠款: '}} </text> <text decode class="cardText">{{'&nbsp;&nbsp;&nbsp;&nbsp; 欠款: '}} </text>

1
pages/index/waitStorageDetail.vue

@ -329,6 +329,7 @@
//计算价格 //计算价格
changePrice(val) { changePrice(val) {
let that = this; let that = this;
this.$refs.inputClose.value = ''
that.shouldPay = 0 that.shouldPay = 0
that.goodsList[that.index].purchasePrice = val that.goodsList[that.index].purchasePrice = val
that.goodsList[that.index].price = val * that.goodsList[that.index].productCount; that.goodsList[that.index].price = val * that.goodsList[that.index].productCount;

5
pages/inventory/changeGoods1.vue

@ -682,7 +682,7 @@
} }
this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", { this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", {
categoryId: this.goodsDetail.categoryId categoryId: this.goodsDetail.attrId
}, false, true).then((res1) => { }, false, true).then((res1) => {
if (res1.code == 200) { if (res1.code == 200) {
if (typeof(res1.result) == 'string') { if (typeof(res1.result) == 'string') {
@ -839,7 +839,8 @@
//弹窗选择规格后,点击弹窗中选好了按钮 //弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() { temporaryCheck() {
this.evalue = [] this.evalue = []
let data = { let data = {
attrId:this.goodsDetail.attrId,
id: this.goodsDetail.id, id: this.goodsDetail.id,
price: this.goodsDetail.price, price: this.goodsDetail.price,
categoryId:this.goodsDetail.categoryId, categoryId:this.goodsDetail.categoryId,

683
pages/inventory/goodsList1.vue

@ -110,8 +110,7 @@
库存 库存
</text> </text>
</view> </view>
<view <view style="font-size: 30rpx;color: #000;font-weight: bold;width: 152rpx;display: inline-block;text-align: right;">
style="font-size: 30rpx;color: #000;font-weight: bold;width: 152rpx;display: inline-block;text-align: right;">
数量 数量
</view> </view>
</view> </view>
@ -127,12 +126,12 @@
<text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])"> <text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])">
{{numData(values[0])[1]}} {{numData(values[0])[1]}}
</text> </text>
<text <text style="width: 25%;font-size: 22rpx;">
style="width: 25%;font-size: 22rpx;">{{values[1].productNum == null ?'无库存':values[1].productNum}}</text> {{values[1].productNum == null ?'无库存':values[1].productNum}}
</text>
<view style="text-align: left;padding-left: 5px;width:50%;display: flex;"> <view style="text-align: left;padding-left: 5px;width:50%;display: flex;">
<uni-number-box min="-10000" max="100000" style="margin-top:9rpx;border-right:0;" <uni-number-box min="-10000" max="100000" style="margin-top:9rpx;border-right:0;"
v-model="values[1].productCount" v-model="values[1].productCount" @change="GoodsNumChange($event,value,values[0])"/>
@change="GoodsNumChange($event,value,values[0])" />
</view> </view>
</view> </view>
</view> </view>
@ -187,10 +186,16 @@
</uni-data-select> </uni-data-select>
</view> </view>
<view class="content-list"> <view class="content-list">
<view class="list-name" id="idss">总金额</view> <view class="list-name" id="idss">销售总额</view>
<view class="list-val"> <view class="list-val">
<input type="digit" v-model="shouldPay" disabled> <input type="digit" v-model="shouldPay" disabled>
</view> </view>
</view>
<view class="content-list">
<view class="list-name" id="idss">退货金额</view>
<view class="list-val">
<input type="digit" v-model="returnPay">
</view>
</view> </view>
<view class="content-list"> <view class="content-list">
<view class="list-name">实收金额</view> <view class="list-name">实收金额</view>
@ -326,18 +331,27 @@
<view class="popup-pay-title"> <view class="popup-pay-title">
<text>选择商品价格</text> <text>选择商品价格</text>
</view> </view>
<view class="popup-pay-container" @tap.stop="checkPay(lsprice)"> <view class="popup-pay-container" @tap.stop="checkPay(lsprice,'')">
<text style="display: inline-block">零售价:¥{{lsprice}}</text> <text style="display: inline-block">零售价:¥{{lsprice}}</text>
</view> </view>
<view class="popup-pay-container" @tap.stop="checkPay(wholesalePrice)"> <view class="popup-pay-container" @tap.stop="checkPay(wholesalePrice,'')">
<text style="display: inline-block">批发价:¥{{wholesalePrice}}</text> <text style="display: inline-block">批发价:¥{{wholesalePrice}}</text>
</view>
<view class="popup-pay-title" style="font-size: 18px;margin-top: 10px;border-top: 1px solid #eee;padding: 10px;border-bottom: 1px solid #eee;">
<text>自定义价格</text>
</view> </view>
<view class="popup-pay-container" style="background: #fff;display: flex;width: 100%;"> <view class="popup-pay-container" style="background: #fff;display: flex;width: 100%;height: 70rpx;color: #000;border: none;line-height: 70rpx;">
<input type="digit" style="height: 100rpx;line-height: 100rpx;color:#000;width: 296rpx;" <view style="width:120rpx;text-align: left;">售价:</view>
placeholder="请输入价格" @input="changePay"> <input type="digit" style="height: 70rpx;line-height: 70rpx;color: #000;width: 296rpx;border-bottom: 1px solid #eee;"
<view style="flex: 1;color: #fff;background: #088FEB;border-radius: 10px;width: 144rpx;" placeholder="请输入售价" @input="changePay">
@tap.stop="checkPay(customPrice)">确定</view> </view>
</view> <view class="popup-pay-container" style="background: #fff;display: flex;width: 100%;height: 70rpx;color: #000;border: none;line-height: 70rpx;">
<view style="width:120rpx;">退货价:</view>
<input type="digit" style="height: 70rpx;line-height: 70rpx;color: #000;width: 296rpx;border-bottom: 1px solid #eee;"
placeholder="请输入退货价" @input="changeReturnPay">
</view>
<view style="width: 100%;color: #fff;height: 70rpx;background: #088FEB;border-radius: 5px;font-size: 30rpx;text-align: center;line-height: 70rpx;margin-top: 20rpx;"
@tap.stop="checkPay(customPrice,returnPrice)">确定</view>
</view> </view>
</uni-popup> </uni-popup>
<!-- <canvas canvas-id="myCanvas"></canvas> --> <!-- <canvas canvas-id="myCanvas"></canvas> -->
@ -446,7 +460,7 @@
<view style="height: 150rpx;line-height: 150rpx;text-align: center;">暂无拿货历史</view> <view style="height: 150rpx;line-height: 150rpx;text-align: center;">暂无拿货历史</view>
</view> </view>
<view class="popup-bottom" v-if="historyList != null"> <view class="popup-bottom" v-if="historyList != null">
<view class="popup-btn" @tap="checkPay(historyList.discountAmount)">一键使用历史价格</view> <view class="popup-btn" @tap="checkPay(historyList.discountAmount,'')">一键使用历史价格</view>
</view> </view>
</view> </view>
</uni-popup> </uni-popup>
@ -685,9 +699,11 @@
lbgName: [], //拉包工姓名 lbgName: [], //拉包工姓名
carList: new Map(), //添加商品页传回来的商品信息 carList: new Map(), //添加商品页传回来的商品信息
xsyId: '', xsyId: '',
shouldPay: 0, shouldPay: 0,
returnPay:0,
totalAmount: 0, totalAmount: 0,
customPrice: 0, //选择自定义金额 customPrice: 0, //选择自定义金额
returnPrice:0,
remark: '', remark: '',
pbAddress: '', pbAddress: '',
yanseList: new Map(), yanseList: new Map(),
@ -727,11 +743,21 @@
kkPrinter kkPrinter
}, },
onHide(){ onHide(){
console.log('1加载了啊') console.log("1111")
this.recordState = false this.recordState = false
setTimeout(res=>{
uni.closeBLEConnection({
deviceId:uni.getStorageSync('deviceId'),
success(res) {
console.log(res)
},fail(err){
console.log(err)
}
})
},5000)
}, },
onShow() { onShow() {
console.log('加载了啊')
this.recordState = false this.recordState = false
// 初始化蓝牙模块 // 初始化蓝牙模块
wx.openBluetoothAdapter({ wx.openBluetoothAdapter({
@ -870,23 +896,22 @@
}, },
handleData() { handleData() {
let that = this; let that = this;
for (let i = 0; i < this.carList1.length; i++) { for (let i = 0; i < this.carList1.length; i++) {
if (this.carList1[i].saleDetailQueryDTO) { if (this.carList1[i].saleDetailQueryDTO) {
if (this.carList.size == 0) { //当前页没有数据 if (this.carList.size == 0) { //当前页没有数据
let obj = { let obj = {
purchasePrice: this.carList1[i].price, //采购价 purchasePrice: this.carList1[i].price, //采购价
price: 0, //总价 price: 0, //总价
discount: 10, //折扣 discount: 10, //折扣
categoryId: this.carList1[i].categoryId, categoryId: this.carList1[i].categoryId,
unitPrice: this.carList1[i].unitPrice || 0, //单价 unitPrice: this.carList1[i].unitPrice || 0, //单价
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 discountAmount: this.carList1[i].wholesalePrice || 0, //折后价
returnPrice:this.carList1[i].wholesalePrice || 0,
disNoAmount: 0, //折前价,用于计算整体折扣 disNoAmount: 0, //折前价,用于计算整体折扣
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 wholesalePrice: this.carList1[i].wholesalePrice, //批发价
lsprice: this.carList1[i].lsprice, //零售价 lsprice: this.carList1[i].lsprice, //零售价
productCount: 0, //总数量 productCount: 0, //总数量
returnCount:0, //退货数量
productId: this.carList1[i].id, productId: this.carList1[i].id,
productName: this.carList1[i].productName, productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture, productPicture: this.carList1[i].productPicture,
@ -904,8 +929,13 @@
.saleDetailQueryDTO[m].stockCount .saleDetailQueryDTO[m].stockCount
} }
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount if(this.carList1[i].saleDetailQueryDTO[m].productCount < 0){ //退货数量
obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount)
}else{
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
}
} }
this.carList.set(this.carList1[i].id, obj) this.carList.set(this.carList1[i].id, obj)
} else { //当前页有数据 } else { //当前页有数据
@ -952,10 +982,13 @@
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i] this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i]
.saleDetailQueryDTO[ .saleDetailQueryDTO[
m].attributeList, data1) m].attributeList, data1)
}
if(this.carList1[i].saleDetailQueryDTO[m].productCount < 0){ //退货数量
this.carList.get(this.carList1[i].id).returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount)
}else{
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
} }
this.carList.get(this.carList1[i].id).productCount += this.carList1[i]
.saleDetailQueryDTO[
m].productCount
} }
} else { //商品不同 } else { //商品不同
let obj = { let obj = {
@ -963,12 +996,14 @@
price: 0, price: 0,
discount: 10, discount: 10,
categoryId: this.carList1[i].categoryId, categoryId: this.carList1[i].categoryId,
discountAmount: this.carList1[i].wholesalePrice || 0, discountAmount: this.carList1[i].wholesalePrice || 0,
returnPrice: this.carList1[i].wholesalePrice || 0,
disNoAmount: 0, //折前价,用于计算整体折扣 disNoAmount: 0, //折前价,用于计算整体折扣
unitPrice: this.carList1[i].unitPrice || 0, //单价 unitPrice: this.carList1[i].unitPrice || 0, //单价
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 wholesalePrice: this.carList1[i].wholesalePrice, //批发价
lsprice: this.carList1[i].lsprice, //零售价 lsprice: this.carList1[i].lsprice, //零售价
productCount: 0, productCount: 0,
returnCount:0,
productId: this.carList1[i].id, productId: this.carList1[i].id,
productName: this.carList1[i].productName, productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture, productPicture: this.carList1[i].productPicture,
@ -990,8 +1025,12 @@
} }
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1) obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.name = this.carList1[i].saleDetailQueryDTO[m].name obj.name = this.carList1[i].saleDetailQueryDTO[m].name
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount if(this.carList1[i].saleDetailQueryDTO[m].productCount < 0){ //退货数量
obj.returnCount += Math.abs(this.carList1[i].saleDetailQueryDTO[m].productCount)
}else{
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
}
} }
this.carList.set(this.carList1[i].id, obj) this.carList.set(this.carList1[i].id, obj)
} }
@ -1032,7 +1071,8 @@
setTimeout(res => { setTimeout(res => {
uni.hideLoading(); uni.hideLoading();
}, 300) }, 300)
} }
console.log('退货金额',this.carList)
}, },
invenRadio() { invenRadio() {
@ -1053,7 +1093,8 @@
productId: this.carList1[i].productId, productId: this.carList1[i].productId,
categoryId: this.carList1[i].categoryId, categoryId: this.carList1[i].categoryId,
unitPrice: this.carList1[i].wholesalePrice || 0, //单价 unitPrice: this.carList1[i].wholesalePrice || 0, //单价
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 discountAmount: this.carList1[i].wholesalePrice || 0, //折后价
returnPrice: this.carList1[i].wholesalePrice || 0,
disNoAmount: 0, //折前价,用于计算整体折扣 disNoAmount: 0, //折前价,用于计算整体折扣
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 wholesalePrice: this.carList1[i].wholesalePrice, //批发价
lsprice: this.carList1[i].price, //零售价 lsprice: this.carList1[i].price, //零售价
@ -1117,7 +1158,8 @@
categoryId: this.carList1[i].categoryId, categoryId: this.carList1[i].categoryId,
productId: this.carList1[i].productId, productId: this.carList1[i].productId,
unitPrice: this.carList1[i].wholesalePrice || 0, //单价 unitPrice: this.carList1[i].wholesalePrice || 0, //单价
discountAmount: this.carList1[i].wholesalePrice || 0, //折后价 discountAmount: this.carList1[i].wholesalePrice || 0, //折后价
returnPrice: this.carList1[i].wholesalePrice || 0,
disNoAmount: 0, //折前价,用于计算整体折扣 disNoAmount: 0, //折前价,用于计算整体折扣
wholesalePrice: this.carList1[i].wholesalePrice, //批发价 wholesalePrice: this.carList1[i].wholesalePrice, //批发价
lsprice: this.carList1[i].price, //零售价 lsprice: this.carList1[i].price, //零售价
@ -1676,9 +1718,10 @@
'实件': '10件', '实件': '10件',
'景': '#', '景': '#',
'警': '#', '警': '#',
'颈': '#', '颈': '#',
'括号':'货号'
}; };
const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|金色|井|时间|事件|世间|实践|实件|景|警|颈)/g; const regex = /(零|一|二|两|三|四|五|六|七|八|九|杠|刚|军色|叉|金色|井|时间|事件|世间|实践|实件|景|警|颈|括号)/g;
return str.replace(regex, match => chineseNumToArabic[match]); return str.replace(regex, match => chineseNumToArabic[match]);
}, },
//编辑挂单信息 //编辑挂单信息
@ -1711,6 +1754,9 @@
if(convertedStr.indexOf(',') == 0){ if(convertedStr.indexOf(',') == 0){
console.log('位置',convertedStr.indexOf(',')) console.log('位置',convertedStr.indexOf(','))
convertedStr = convertedStr.substr(1) convertedStr = convertedStr.substr(1)
}
if (convertedStr.startsWith("号")) {
convertedStr = "货号" + convertedStr.substr(1);
} }
this.getMsg = convertedStr this.getMsg = convertedStr
this.tui.request("/app/sale/buyAi", "POST", { this.tui.request("/app/sale/buyAi", "POST", {
@ -1841,9 +1887,11 @@
await this.carList.forEach(function(value, key) { await this.carList.forEach(function(value, key) {
that.index = value.productId || value.id that.index = value.productId || value.id
if (e == '0') { //零售 if (e == '0') { //零售
value.discountAmount = value.lsprice value.discountAmount = value.lsprice
value.returnPrice= value.lsprice
} else { //批发 } else { //批发
value.discountAmount = value.wholesalePrice value.discountAmount = value.wholesalePrice
value.returnPrice= value.wholesalePrice
} }
}) })
await this.getAllPrice() await this.getAllPrice()
@ -1854,7 +1902,7 @@
this.$forceUpdate() this.$forceUpdate()
}, },
//商品上选择是零售价还是批发价 //商品上选择是零售价还是批发价
checkPay(price) { checkPay(price,returnPrice) {
if (price == undefined || price == null) { if (price == undefined || price == null) {
this.tui.toast("暂无拿货记录") this.tui.toast("暂无拿货记录")
@ -1863,7 +1911,10 @@
let that = this; let that = this;
let num = this.carList.get(this.index) let num = this.carList.get(this.index)
num.discountAmount = price num.discountAmount = price
if(returnPrice != ''){
num.returnPrice = returnPrice
}
num.unitPrice = price; num.unitPrice = price;
num.price = price * num.productCount; num.price = price * num.productCount;
this.$refs.inputDialog.close() this.$refs.inputDialog.close()
@ -2239,7 +2290,8 @@
discount: 10, //折扣 discount: 10, //折扣
unitPrice: 0, //单价 unitPrice: 0, //单价
categoryId: carList1[i].categoryId, categoryId: carList1[i].categoryId,
discountAmount: carList1[i].wholesalePrice || 0, //折后价 discountAmount: carList1[i].wholesalePrice || 0, //折后价
returnPrice: carList1[i].wholesalePrice || 0,
disNoAmount: 0, //折前价,用于计算整体折扣 disNoAmount: 0, //折前价,用于计算整体折扣
wholesalePrice: carList1[i].wholesalePrice, //批发价 wholesalePrice: carList1[i].wholesalePrice, //批发价
lsprice: carList1[i].lsprice, //零售价 lsprice: carList1[i].lsprice, //零售价
@ -2304,7 +2356,8 @@
purchasePrice: carList1[i].price, //采购价 purchasePrice: carList1[i].price, //采购价
price: 0, price: 0,
discount: 10, discount: 10,
discountAmount: carList1[i].wholesalePrice || 0, discountAmount: carList1[i].wholesalePrice || 0,
returnPrice: carList1[i].wholesalePrice || 0,
disNoAmount: 0, //折前价,用于计算整体折扣 disNoAmount: 0, //折前价,用于计算整体折扣
unitPrice: 0, //单价 unitPrice: 0, //单价
categoryId: carList1[i].categoryId, categoryId: carList1[i].categoryId,
@ -2424,6 +2477,9 @@
} }
if(convertedStr.indexOf(',') == 0){ if(convertedStr.indexOf(',') == 0){
convertedStr = convertedStr.substr(1) convertedStr = convertedStr.substr(1)
}
if (convertedStr.startsWith("号")) {
convertedStr = "货号" + convertedStr.substr(1);
} }
if (that.voiceText == '' || that.voiceText == null) { if (that.voiceText == '' || that.voiceText == null) {
that.voiceText = convertedStr that.voiceText = convertedStr
@ -2457,7 +2513,8 @@
} }
} }
}, },
showPrice() { showPrice() {
let that = this;
if (this.khName == '') { if (this.khName == '') {
this.tui.toast('请选择客户!') this.tui.toast('请选择客户!')
return return
@ -2496,11 +2553,23 @@
} else { } else {
this.tui.toast('请选择发货方式!') this.tui.toast('请选择发货方式!')
return return
} }
let printHeight = 800
this.carList.forEach(function(value, key) {
printHeight += 30
value.stockLogList.forEach(function(value1, key1) {
printHeight += 30
})
})
this.printTotal = printHeight
this.bufferData = []
let strCmd = this.getPrintData()
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
this.$refs.showPopup.open() this.$refs.showPopup.open()
}, },
//点击底部开单按钮 //点击底部开单按钮
goSell(print) { async goSell(print) {
let that = this; let that = this;
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
@ -2535,51 +2604,121 @@
companyName: this.wlName.shippingMethod || this.wlName.companyName, companyName: this.wlName.shippingMethod || this.wlName.companyName,
companyPhone: this.wlName.mobile companyPhone: this.wlName.mobile
}, },
saleDetailList: [] saleDetailList: [],
saleReturnDTO:[]
} }
let purchaseDetails = []; let purchaseDetails = [];
this.carList.forEach(function(value, key) { let returnList = [];
console.log('carList',this.carList)
await this.carList.forEach(function(value, key) {
let returnGoods = []
let goodsList = []
value.stockLogList.forEach(function(values, keys) { value.stockLogList.forEach(function(values, keys) {
if (values <= 0) { if (values.productCount == 0) {
that.tui.toast("商品数量不能为零!") that.tui.toast("商品数量不能为零!")
return; return;
}
console.log('values',values)
if(values.productCount < 0){
console.log()
let obj1 = {
productCount: values.productCount,
attributeList: keys
}
returnGoods.push(obj1)
}else{
let obj1 = {
productCount: values.productCount,
attributeList: keys
}
goodsList.push(obj1)
} }
let obj = {
productCount: values.productCount, })
attributeList: keys that.$nextTick(()=>{
} if(returnGoods.length > 0){
value.stockLogList1.push(obj) let data = {
categoryId: value.categoryId,
disNoAmount: value.disNoAmount,
discount: value.discount,
discountAmount: value.discountAmount,
lsprice: value.lsprice,
price: value.price,
productCount: value.productCount,
productId: value.productId,
productName: value.productName,
productPicture: value.productPicture,
productSn: value.productSn,
purchasePrice: value.purchasePrice,
returnCount: value.returnCount,
returnPrice: value.returnPrice,
stockLogList: value.stockLogList,
stockLogList1: returnGoods,
supplierName: value.supplierName,
unitPrice: value.unitPrice,
wholesalePrice: value.wholesalePrice
}
returnList.push(data)
}
if(goodsList.length > 0){
let data = {
categoryId: value.categoryId,
disNoAmount: value.disNoAmount,
discount: value.discount,
discountAmount: value.discountAmount,
lsprice: value.lsprice,
price: value.price,
productCount: value.productCount,
productId: value.productId,
productName: value.productName,
productPicture: value.productPicture,
productSn: value.productSn,
purchasePrice: value.purchasePrice,
returnCount: value.returnCount,
returnPrice: value.returnPrice,
stockLogList: value.stockLogList,
stockLogList1: goodsList,
supplierName: value.supplierName,
unitPrice: value.unitPrice,
wholesalePrice: value.wholesalePrice
}
purchaseDetails.push(data)
}
}) })
})
purchaseDetails.push(value) await that.$nextTick(()=>{
}) setTimeout(res=>{
this.saleDetailList = purchaseDetails; obj.saleDetailList = purchaseDetails;
obj.saleDetailList = purchaseDetails; obj.saleReturnDTO = returnList;
let url = '' let url = ''
if (this.saleId != '') { if (this.saleId != '') {
url = '/app/sale/shareToBuyNew' url = '/app/sale/shareToBuyNew'
} else { } else {
url = '/app/sale/buyNew' url = '/app/sale/buyNew'
} }
this.tui.request(url, "post", obj, false, false).then((res) => { this.tui.request(url, "post", obj, false, false).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({
title: "开单成功", title: "开单成功",
icon: 'none' icon: 'none'
}) })
if (print != 'print') { if (print != 'print') {
setTimeout(res => { setTimeout(res => {
this.$refs.showPopup.close() this.$refs.showPopup.close()
that.clearAll1() that.clearAll1()
uni.switchTab({ uni.switchTab({
url: '/pages/index/index' url: '/pages/index/index'
}); });
}, 1000) }, 1000)
} }
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
} }
})
},500)
}) })
setTimeout(res => { setTimeout(res => {
uni.hideLoading(); uni.hideLoading();
}, 1000) }, 1000)
@ -2591,236 +2730,111 @@
// url: '/pages/index/index' // url: '/pages/index/index'
// }); // });
// }, // },
//打印小票 //打印小票
onPrint(opt) { async onPrint(opt) {
let that = this; let that = this;
this.goSell('print') await this.goSell('print')
let strCmd = ''
that.yNum = 150 this.$nextTick(() => {
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); uni.hideLoading();
strCmd += blesdk.addCPCLSETMAG(2, 2) that.$refs.showPopup.close()
blesdk.addCPCLSETBOLD('bold') that.bufferData = []
strCmd += blesdk.addCPCLLocation(2); that.clearAll1()
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, uni.getStorageSync('shopName')) uni.switchTab({
url: '/pages/index/index'
strCmd += blesdk.addCPCLSETMAG(1, 1) });
strCmd += blesdk.addCPCLLocation(0); })
strCmd += blesdk.addCPCLText('0', '100', '24', '0', 0, '客户:' + this.khName.name) },
// strCmd += blesdk.addCPCLText('280', '100', '24', '0', 0, this.sales.id) getPrintData(){
strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '销售:' + this.createByName) let that = this;
strCmd += blesdk.addCPCLText('280', '130', '24', '0', 0, '日期:' + this.formatDate(new Date(), let strCmd = ''
'YYYY-MM-DD')) //+ that.yNum = 300
strCmd += blesdk.addCPCLText('0', '150', '24', '0', 0, strCmd = blesdk.CreatCPCLPage(1000, this.printTotal, 1, 0);
'=========================================================') strCmd += blesdk.addCPCLSETMAG(2, 2)
blesdk.addCPCLSETBOLD('bold')
this.carList.forEach(function(value, key) { strCmd += blesdk.addCPCLLocation(2);
if (that.countPrint() < that.printTotal) { strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '')
strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, value.productName + '(' + strCmd += blesdk.addCPCLSETMAG(2, 2)
value.productSn + ')') blesdk.addCPCLSETBOLD('bold')
} else { strCmd += blesdk.addCPCLLocation(2);
that.yNum = 0 strCmd += blesdk.addCPCLText('0', '110', '24', '0', 0, uni.getStorageSync('shopName'))
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd); strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLLocation(0); blesdk.addCPCLSETBOLD('bold')
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, value.productName + strCmd += blesdk.addCPCLText('0', '190', '24', '0', 0, '客户:' + that.khName.name)
'(' + strCmd += blesdk.addCPCLSETMAG(1, 1)
value.productSn + ')') strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLText('0', '240', '24', '0', 0, '销售员:' + that.createByName)
} strCmd += blesdk.addCPCLText('500', '240', '24', '0', 0, '日期:' + that.formatDate(new Date(),
value.stockLogList.forEach(function(value1, key1) { 'YYYY-MM-DD')) //+
if (that.countPrint() < that.printTotal) { strCmd += blesdk.addCPCLText('0', '300', '24', '0', 0,
strCmd += blesdk.addCPCLText('0', that.yNum, '24', '0', 0, '□ ' + (that '=====================================================================================')
.slicePrint(
key1)) + '*' + value1.productCount) that.carList.forEach(function(value, key) {
strCmd += blesdk.addCPCLText('240', that.yNum, '24', '0', 0, '单价:' + value strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, value.productName + '(' +
.discountAmount) value.productSn + ')')
strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '总价:' + (value value.stockLogList.forEach(function(value1, key1) {
.discountAmount * value1.productCount)) strCmd += blesdk.addCPCLText('0', that.yNum += 30, '24', '0', 0, '□ ' + (that
} else { .slicePrint(key1)))
that.yNum = 0 strCmd += blesdk.addCPCLText('220', that.yNum, '24', '0', 0, '数量:'+ value1.productCount)
strCmd += blesdk.addCPCLPrint(); strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '单价:' + value
that.bufferData.push(strCmd); .discountAmount)
strCmd = '' strCmd += blesdk.addCPCLText('650', that.yNum, '24', '0', 0, '总价:' + (value
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); .discountAmount * value1.productCount))
strCmd += blesdk.addCPCLLocation(0); })
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '□ ' + (that })
.slicePrint(key1)) + '*' + value1.productCount) strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
strCmd += blesdk.addCPCLText('240', that.yNum, '24', '0', 0, '单价:' + value '==========================================================================================')
.discountAmount) strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '总数量:' + that.totalAmount)
strCmd += blesdk.addCPCLText('400', that.yNum, '24', '0', 0, '总价:' + (value strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '总金额:' + that.shouldPay)
.discountAmount * value1.productCount)) strCmd += blesdk.addCPCLText('630', that.yNum, '24', '0', 0, '应收:' + that.relPrice)
} strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '实收:' + that.priceOk)
}) strCmd += blesdk.addCPCLText('300', that.yNum, '24', '0', 0, '欠款:' + (that.relPrice - that.priceOk)
}) .toFixed(2))
if (that.countPrint() < that.printTotal) { strCmd += blesdk.addCPCLText('630', that.yNum, '24', '0', 0, '其他费用:' + (that.otherExpense == '' ? 0 :
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, that.otherExpense))
'===============================================================') if(that.remark != ''){
} else { if (that.remark.length > 20) {
this.yNum = 0 let position = 20;
strCmd += blesdk.addCPCLPrint(); let part1 = that.remark.substring(0, position);
this.bufferData.push(strCmd); let part2 = that.remark.substring(position);
strCmd = '' strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '备注:' + part1)
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0); strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, part2)
strCmd += blesdk.addCPCLLocation(0); } else {
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '备注:' + that.remark)
'===============================================================') }
}
if (that.countPrint() < that.printTotal) {
strCmd += blesdk.addCPCLText('0', this.countPrint(), '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)
} 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.totalAmount)
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '总金额:' + this.shouldPay)
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '应收:' + this.relPrice)
}
if (that.countPrint() < that.printTotal) {
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '实收:' + this.priceOk)
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk)
.toFixed(2))
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 :
this.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.priceOk)
strCmd += blesdk.addCPCLText('200', this.yNum, '24', '0', 0, '欠款:' + (this.relPrice - this.priceOk)
.toFixed(2))
strCmd += blesdk.addCPCLText('400', this.yNum, '24', '0', 0, '其他费用:' + (this.otherExpense == '' ? 0 :
this.otherExpense))
}
if (Math.ceil(Number(this.remark.length) / 20) * 30 + this.yNum < that.printTotal) {
if (this.remark.length > 20) {
let position = 20;
let part1 = this.remark.substring(0, position);
let part2 = this.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.remark)
}
} else {
this.yNum = 0
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
strCmd = ''
if (this.remark.length > 20) {
let position = 20;
let part1 = this.remark.substring(0, position);
let part2 = this.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.remark)
}
}
if (that.countPrint() < that.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() < that.printTotal) {
strCmd += blesdk.addCPCLText('0', this.countPrint(), '24', '0', 0, '店铺地址:' + uni.getStorageSync(
'shopAddress'))
} 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', (that.yNum += 30), '24', '0', 0, '店铺地址:' + uni.getStorageSync(
'shopAddress'))
}
//店铺电话
if (that.countPrint() < that.printTotal) {
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + uni.getStorageSync(
'username'))
} 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, '店铺电话:' + uni.getStorageSync(
'username'))
} }
if(this.qrArr.length != 0){
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0,
'=========================================================================================')
//店铺地址
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', (that.yNum += 30), '24', '0', 0, '店铺地址:' + uni.getStorageSync(
'shopAddress'))
//店铺电话
strCmd += blesdk.addCPCLSETMAG(1, 1)
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '店铺电话:' + uni.getStorageSync(
'username'))
if(that.qrArr.length != 0){
//店铺微信/微信收款/支付宝收款/收款码收款(店铺,微信,支付,收款) //店铺微信/微信收款/支付宝收款/收款码收款(店铺,微信,支付,收款)
for (let i = 0; i < this.qrArr.length; i++) { for (let i = 0; i < that.qrArr.length; i++) {
//店铺二维码 //店铺二维码
console.log(that.qrArr[i]) console.log('11111')
console.log(that.yNum) strCmd += blesdk.addCPCLQRCode(that.countWidth(i,1000/that.qrArr.length), (that.yNum + 80), that.qrArr[i].level, '2', 4, that.qrArr[i].path) //二维码
console.log(that.countWidth(i,600/that.qrArr.length)) strCmd += blesdk.addCPCLSETMAG(1, 1)
if ((that.yNum + 200) < that.printTotal) { strCmd += blesdk.addCPCLText(that.countWidth(i,1000/that.qrArr.length), (that.yNum + 240), '24', '0', 0, that.qrArr[i].name)
console.log('11111') strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLQRCode(that.countWidth(i,600/that.qrArr.length), (that.yNum + 50), that.qrArr[i].level, '2', 3, that.qrArr[i].path) //二维码
strCmd += blesdk.addCPCLText(that.countWidth(i,600/that.qrArr.length), (that.yNum + 180), '24', '0', 0, that.qrArr[i].name)
strCmd += blesdk.addCPCLLocation(0);
if(this.qrArr.length == (i+1)){
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
} else {
console.log('2222')
// that.yNum = 0
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
strCmd = ''
strCmd = blesdk.CreatCPCLPage(600, 1040, 1, 0);
strCmd += blesdk.addCPCLLocation(0);
strCmd += blesdk.addCPCLQRCode(that.countWidth(i,600/that.qrArr.length) , 30, that.qrArr[i].level, '2', 3, that.qrArr[i].path) //二维码
strCmd += blesdk.addCPCLText(that.countWidth(i,600/that.qrArr.length), 180, '24', '0', 0, that.qrArr[i].name)
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
} }
}else{
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
} }
return strCmd;
uni.hideLoading();
this.$nextTick(() => {
console.log('bufferData',that.bufferData)
that.$refs.showPopup.close()
that.bufferData = []
that.clearAll1()
uni.switchTab({
url: '/pages/index/index'
});
})
}, },
countWidth(num,len){ countWidth(num,len){
// if(num == 0){ // if(num == 0){
@ -2831,11 +2845,11 @@
}, },
//计算打印机当前行高度 //计算打印机当前行高度
countPrint() { countPrint() {
if ((this.yNum + 50) >= 1040) { // if ((this.yNum + 50) >= 1040) {
return this.yNum += 50 // return this.yNum += 50
} else { // } else {
return this.yNum += 30 return this.yNum += 30
} // }
}, },
//截取 //截取
slicePrint(val) { slicePrint(val) {
@ -2871,6 +2885,10 @@
this.wholesalePrice = this.carList.get(this.index).wholesalePrice this.wholesalePrice = this.carList.get(this.index).wholesalePrice
this.lsprice = this.carList.get(this.index).lsprice this.lsprice = this.carList.get(this.index).lsprice
this.$refs.inputDialog.open() this.$refs.inputDialog.open()
},
//输入商品自定义退货金额
changeReturnPay(e) {
this.returnPrice = e.detail.value
}, },
//输入商品自定义金额 //输入商品自定义金额
changePay(e) { changePay(e) {
@ -2959,27 +2977,40 @@
let that = this; let that = this;
this.shouldPay = 0 this.shouldPay = 0
this.totalAmount = 0 this.totalAmount = 0
that.returnPay = 0
this.carList.forEach(function(value, key) { this.carList.forEach(function(value, key) {
that.shouldPay = Number(that.shouldPay) + Number(value.price) that.shouldPay = Number(that.shouldPay) + Number(value.price)
that.returnPay = Number(that.returnPay) + (Number(value.returnPrice) * Math.abs(Number(value.returnCount)))
that.totalAmount = that.totalAmount + value.productCount if(value.productCount > 0){
that.totalAmount = that.totalAmount + value.productCount
}
}) })
that.shouldPay = that.shouldPay.toFixed(2) that.shouldPay = that.shouldPay.toFixed(2)
that.returnPay = that.returnPay.toFixed(2)
this.relPrice = this.shouldPay this.relPrice = this.shouldPay
this.priceOk = this.shouldPay this.priceOk = this.shouldPay - that.returnPay
this.$forceUpdate() this.$forceUpdate()
that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk) that.noPay = this.relPrice - (this.priceOk == '' ? 0 : this.priceOk) - this.returnPay
that.noPay = that.noPay.toFixed(2) that.noPay = that.noPay.toFixed(2)
}, },
//修改已选规格的数量 //修改已选规格的数量
GoodsNumChange(e, index, index1) { GoodsNumChange(e, index, index1) {
let that = this; let that = this;
this.carList.get(index[0]).stockLogList.get(index1).productCount = e if(e < 0){
this.carList.get(index[0]).productCount = 0
this.carList.get(index[0]).stockLogList.get(index1).productCount = e
}else{
this.carList.get(index[0]).stockLogList.get(index1).productCount = e
}
this.carList.get(index[0]).productCount = 0
this.carList.get(index[0]).returnCount = 0
this.carList.get(index[0]).stockLogList.forEach(function(value, key) { this.carList.get(index[0]).stockLogList.forEach(function(value, key) {
that.carList.get(index[0]).productCount = that.carList.get(index[0]).productCount + value if(value.productCount < 0){
.productCount that.carList.get(index[0]).returnCount = that.carList.get(index[0]).returnCount + Math.abs(value.productCount)
}else{
that.carList.get(index[0]).productCount = that.carList.get(index[0]).productCount + value.productCount
}
if (that.discountType == 0) { //单品折扣 if (that.discountType == 0) { //单品折扣
// that.carList.get(index[0]).price = that.carList.get(index[0]).productCount * (that.carList.get( // that.carList.get(index[0]).price = that.carList.get(index[0]).productCount * (that.carList.get(
// index[0]).discountAmount * (that.carList.get(index[0]).discount / 10)) // index[0]).discountAmount * (that.carList.get(index[0]).discount / 10))

7
pages/inventory/inventory.vue

@ -38,8 +38,8 @@
</view> </view>
<view class="title-right"> <view class="title-right">
<view class="title-right-top title-btn" @tap.stop="onGridClick('1')"> <view class="title-right-top title-btn" @tap.stop="onGridClick('2')">
新增入库 新增商品
</view> </view>
<view class="title-right-bottom title-btn" @tap.stop="onGridClick('3')"> <view class="title-right-bottom title-btn" @tap.stop="onGridClick('3')">
更多 更多
@ -138,9 +138,6 @@
<view class="popup-pay-container" @tap="onGridClick('0')"> <view class="popup-pay-container" @tap="onGridClick('0')">
<text style="display: inline-block">分类管理</text> <text style="display: inline-block">分类管理</text>
</view> </view>
<view class="popup-pay-container" @tap="onGridClick('2')">
<text style="display: inline-block">新增商品</text>
</view>
<view class="popup-pay-container" @tap="onGridClick('4')"> <view class="popup-pay-container" @tap="onGridClick('4')">
<text style="display: inline-block">批量打印商品码</text> <text style="display: inline-block">批量打印商品码</text>
</view> </view>

14
pages/inventory/inventoryDetail.vue

@ -157,7 +157,7 @@
@confirm="changePrice"></uni-popup-dialog> @confirm="changePrice"></uni-popup-dialog>
</uni-popup> </uni-popup>
<view v-if="isPrint" class="bottom-btn"> <view v-if="isPrint" class="bottom-btn">
<kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint1" :printNum="printNum" :defaultText="'打印'"></kk-printer> <kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint" :printNum="printNum" :defaultText="'打印'"></kk-printer>
</view> </view>
<!-- 右下角悬浮按钮 --> <!-- 右下角悬浮按钮 -->
<uni-fab v-if="!isPrint" ref="fab" :content="content" :horizontal="horizontal" <uni-fab v-if="!isPrint" ref="fab" :content="content" :horizontal="horizontal"
@ -249,6 +249,18 @@
}, },
components: { components: {
kkPrinter kkPrinter
},
onHide(){
setTimeout(res=>{
uni.closeBLEConnection({
deviceId:uni.getStorageSync('deviceId'),
success(res) {
console.log(res)
},fail(err){
console.log(err)
}
})
},5000)
}, },
onLoad(option) { onLoad(option) {
// 初始化蓝牙模块 // 初始化蓝牙模块

Loading…
Cancel
Save