wangfukang 3 years ago
parent
commit
3d0f5f5a9e
  1. 125
      pages/billing/changeGoods1.vue
  2. 2
      pages/index/addHangOrder.vue
  3. 37
      pages/index/downStearmList.vue
  4. 5
      pages/index/downstream.vue
  5. 104
      pages/index/orderDetail.vue
  6. 4
      pages/index/peopleList.vue
  7. 100
      pages/inventory/AIInventory.vue
  8. 94
      pages/inventory/addinventory.vue
  9. 112
      pages/inventory/changeGoods1.vue
  10. 197
      pages/inventory/goodsList1.vue
  11. 96
      pages/inventory/inventory.vue
  12. 191
      pages/inventory/inventoryDetail.vue
  13. 17
      pages/login/login.vue

125
pages/billing/changeGoods1.vue

@ -2,11 +2,11 @@
<view class="page1">
<view class="title-box">
<uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none"
@confirm="search" />
@confirm="search" @blur="search" @clear="clearSearch" />
</view>
<view class="content-box" :style="{height:height - 240 +'rpx'}">
<view class="content-left">
<view class="left-box" 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)">
<text style="width: 100%;height: 90rpx;line-height: 90rpx;display: inline-block;overflow: hidden;"
:class="item.parentId ? 'red' :''">{{item.categoryName}}</text>
@ -42,6 +42,36 @@
</view>
</view>
</view>
</view>
<view class="right-box" v-for="(item,index) in shopList1" :key="index" @tap="toggle('bottom',item)">
<!-- 当商品的delFlag=0和未入库状态时,显示此遮罩,点击弹出弹窗提示不能操作 -->
<view class="shop-mask" v-if="item.delFlag == 0 || item.purchasePrice==null || item.inStorageStatus == 0" @tap.stop="clickMask"></view>
<view class="box-left">
<img class="img-radius" :src="item.productPicture" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
</view>
<view class="box-right">
<view class="box-right-name">{{item.productName}}</view>
<view class="box-right-num">{{item.productSn}}</view>
<view class="box-right-price">
<view class="price-box" v-if="storageType== 0">
<text>{{item.inStorageStatus==0?'待入库':item.purchasePrice == null ?'新商品':item.purchasePrice}}</text>
<text>采购价</text>
</view>
<view class="price-box">
<text>{{item.wholesalePrice}}</text>
<text>批发价</text>
</view>
<view class="price-box">
<text>{{item.price}}</text>
<text>零售价</text>
</view>
<view class="price-box">
<text>{{item.stockCount}}</text>
<text>库存</text>
</view>
</view>
</view>
</view>
</view>
</view>
@ -104,7 +134,7 @@
<uni-icons color="red" type="minus" size="26"></uni-icons>
</view>
<view class="checkList-box">
<text style="width: 250rpx;display: inline-block;">{{item.name}}</text> <text style="color:#777;font-size: 12px;">库存:{{item.productNum}}</text>
<text style="width: 250rpx;display: inline-block;">{{item.name}}</text> <text style="color:#777;font-size: 12px;">{{item.productNum}}</text>
</view>
<uni-number-box max="100000" v-model="item.productCount" @change="temporaryChange" />
</view>
@ -177,7 +207,8 @@
return {
indexList: [],
pageNum: 1, //分页的页码
shopList: [],
shopList: [],
shopList1:[],
info: 0,
categoryId: '', //分类id
searchName: '', //搜索框输入值
@ -207,7 +238,8 @@
oldTemList:[],
goodsList:[],
newTemList:[],
dataObj :new Map()
dataObj :new Map(),
gateType:''
}
},
filters: {
@ -249,7 +281,7 @@
}
}
this.categoryId = this.indexList[0].id
this.getShareList(this.indexList[0].id);
this.getShareList();
} else {
this.tui.toast(res.message)
}
@ -330,7 +362,6 @@
}
var resultList = []
if(jishuqi == this.goodsList.length){
resultList = this.combination(this.goodsList);
}
var evalue = []
@ -457,27 +488,60 @@
uni.navigateBack({
delta: 1
})
},
//顶部搜索框
search(e) {
if(e.value == ''){
this.searchName = ""
this.getShareList()
}else{
this.searchName = e.value
this.getShareList('search')
}
},
//清空搜索条件
clearSearch(){
this.searchName = ''
this.getShareList()
},
//点击分类获取商品列表
getShareList(id) {
this.tui.request("/app/product/getShareList", "POST", {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '10'
}, false, false).then((res) => {
if (res.code == 200) {
this.shopList = res.result.records
} else {
this.tui.toast(res.message)
}
getShareList(type) {
let data = {}
if(type=='search'){
this.gateType = 'search'
data = {
categoryId: "",
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '100'
}
}else{
this.gateType = ''
data = {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '100'
}
}
this.tui.request("/app/product/getShareList", "POST", data, false, false).then((res) => {
if (res.code == 200) {
if(type=='search'){
this.shopList = []
this.shopList1 = res.result.records
}else{
this.shopList1 = []
this.shopList = res.result.records
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
change() {
this.oldTemList = []
},
//
carChange(e, index, index1) {
this.carNum = 0
for (let i = 0; i < this.carList.length; i++) {
@ -569,9 +633,7 @@
value: valueObj
})
}
console.log(that.dataObj)
this.goodsDetail.attributeList = newArr;
console.log('看看看看',this.goodsDetail.attributeList)
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
let oldCheck = false
let oldValue = []
@ -597,7 +659,6 @@
oldCheck = false
oldValue = []
}
console.log(this.goodsList)
}
} else {
@ -621,11 +682,7 @@
uni.hideLoading();
}, 200)
},
//顶部搜索框
search(res) {
this.searchName = res.value
this.getShareList()
},
//未入库遮罩
clickMask() {
uni.showToast({
@ -643,7 +700,7 @@
}
}
this.categoryId = this.indexList[index].id
this.getShareList(this.indexList[index].id)
this.getShareList()
},
//临时改价
changePrice(val) {
@ -658,7 +715,8 @@
let data = {
id: this.goodsDetail.id,
price: this.zPrice,
num: this.zNum,
num: this.zNum,
categoryId:this.goodsDetail.categoryId,
productName: this.goodsDetail.productName,
productSn: this.goodsDetail.productSn,
productPicture: this.goodsDetail.productPicture,
@ -691,7 +749,8 @@
}
}
this.temporaryList = []
this.temporaryList = []
this.oldTemList = []
this.purchasePrice = ''
this.zPrice = ''
this.zNum = ''

2
pages/index/addHangOrder.vue

@ -319,7 +319,7 @@
}else if(that.voiceText == null){
that.voiceText = res.result
}else{
res.result = '\n' + res.result
res.result = ' ' + res.result
that.voiceText += res.result
}
}

37
pages/index/downStearmList.vue

@ -2,7 +2,7 @@
<view class="page1">
<view class="title-box">
<uni-search-bar class="uni-mt-10" radius="5" placeholder="请输入商品名称/货号" cancelButton="none"
@confirm="search" />
@confirm="search" @blur="search" @clear="clearSearch" />
</view>
<view class="content-box">
<view class="content-right">
@ -146,10 +146,9 @@
</view>
</view>
<view style="padding-bottom: 100rpx;">
<view class="popup-container" v-for="(item1,index1) in item.stockLogList1">
<view class="popup-container" v-for="(item1,index1) in item.stockLogList1" :key="index1">
<view class="checkList">
<view style="margin-right:5%;" @tap="delShopSpec(item.productId,item1.attributeList)"
:key="index1">
<view style="margin-right:5%;" @tap="delShopSpec(item.productId,item1.attributeList)">
<uni-icons color="red" type="minus" size="26"></uni-icons>
</view>
<view class="checkList-box">
@ -407,9 +406,16 @@
}).catch((res) => {})
},
//顶部搜索框
search(res) {
search(res) {
this.pages = 1
this.searchName = res.value
this.getShareList()
},
//清空搜索条件
clearSearch(){
this.pages = 1
this.searchName = ''
this.getShareList()
},
inputDialogToggle() {
this.$refs.inputDialog.open()
@ -505,24 +511,6 @@
delCarData(index) {
this.temporaryList.splice(index, 1);
this.temporaryChange()
// uni.showModal({
// title: "提示",
// content: "确定删除此条商品吗?",
// success: function(res) {
// if(res.confirm){
// 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).purchasePrice
// if(that.carList.get(id).stockLogList.size == 0){
// that.carList.delete(id)
// }
// that.getAllPrice()
// }
// that.$forceUpdate()
// }
// })
},
//删除商品下的某一个规格
delShopSpec(index, index1) {
@ -611,7 +599,8 @@
},
//点击分类获取商品列表
getShareList(id) {
this.status = 'loading';
this.status = 'loading';
// this.shopList = []
this.tui.request("/app/productShare/getShareList", "POST", {
searchStr: this.searchName,
id: this.khid,

5
pages/index/downstream.vue

@ -1,7 +1,7 @@
<template>
<view>
<view class="formBox">
<u-alert description="点击可查看对应每笔入库单" type="primary"></u-alert>
<u-alert description="点击可查看对应每笔销售单" type="primary"></u-alert>
<view class="swipe-action">
<view class="swipe-action__content" @tap="onItemClick(item)" v-for="(item,index) in list" :key="index">
<view class="swipe-action__content__left">
@ -9,7 +9,8 @@
</view>
<view class="swipe-action__content__right">
<view class="swipe-action__content__right__text">欠款总金额:</view>
<view class="swipe-action__content__right__money">{{ item.no_earn == null ?'暂无':item.no_earn }}
<view class="swipe-action__content__right__money">
{{ item.no_earn == null ?'暂无':item.no_earn }}
</view>
</view>
</view>

104
pages/index/orderDetail.vue

@ -1,11 +1,13 @@
<template>
<view class="container">
<view v-if="sales.userName !='散客'">
<uni-card :title="sales.userName == null ?'暂无':sales.userName+'('+order.phone+')'"
thumbnail="/static/images/dingdan/dd0.png">
<uni-card :title="sales.userName == null ?'暂无':sales.userName+'('+order.phone+')'">
<view class="uni-body" v-if="sales.province != null">
{{sales.province + sales.area + sales.city + sales.receiveAddress}} </view>
{{sales.province + sales.city + sales.area + sales.receiveAddress}} </view>
</uni-card>
<button open-type="share" style="font-size: 22rpx;position: absolute;top: 50rpx;right: 70rpx;background: blue;color: #fff;width: 100rpx;height: 50rpx;text-align: center;line-height: 50rpx;border-radius: 7px;">
分享
</button>
</view>
<view v-else>
<uni-card :title="sales.userName == null ?'暂无':sales.userName"
@ -254,9 +256,9 @@
<view class="tui-btn-mr" v-if="sales.status != 6 && sales.status != 2">
<kk-printer ref="kkprinter" :bufferData="bufferData" :defaultText="'打印小票'" @onPrintSmall="onPrintSmall"></kk-printer>
</view>
<view class="tui-btn-mr" v-if="sales.status == 0 || sales.status == 1" @click="cancelOrder('qxdd')">取消订单</view>
<view class="tui-btn-mr" v-if="sales.status == '0' || sales.status == '1'" @click="cancelOrder('qxdd')">取消订单</view>
<view class="tui-btn-mr" v-if="sales.status == '0' || sales.status == '1' || sales.status == '00' || sales.status == '01'" @click="cancelOrder('qxps')">取消配送</view>
<view class="tui-btn-mr" v-if="sales.status == 4" @click="returnGoods">{{ !isReturn ? '退货' : '确认退货'}}</view>
<view class="tui-btn-mr" v-if="sales.status == '4'" @click="returnGoods">{{ !isReturn ? '退货' : '确认退货'}}</view>
<view class="tui-btn-mr" @tap="inputDialogToggle()" v-if="sales.status != 6 && !editNoPrice && sales.status != 2 && sales.noEarn >0">回款</view>
</view>
<!-- 回款金额输入框 -->
@ -319,7 +321,8 @@
changeA: '',
sAmout: 0,
yNum: 150,
printTotal:1040,
printTotal:1040,
zReturnNum:""
}
},
components: {
@ -362,19 +365,22 @@
return 0
}
}
},
onShareAppMessage() {
return {
title: '查看采购单详情',
imageUrl:'https://jewel-shop.oss-cn-beijing.aliyuncs.com/abdc5c897c4f4fe198b74091a708030b.jpg',
path: '/pages/login/login?saleId=' + this.saleId + '&userId=' + this.order.id
}
},
onShow() {
// 初始化蓝牙模块
wx.openBluetoothAdapter({mode: 'central'})
this.lbgName = JSON.parse(JSON.stringify(this.lbgName))
this.type = uni.getStorageSync('type')
// 初始化蓝牙模块
wx.openBluetoothAdapter({ //111
mode: 'central',
success: (res2) => {}
})
this.type = uni.getStorageSync('type')
},
onLoad(option) {
onLoad(option) {
this.saleId = option.id
if (option.id != null && option.id != undefined && option.id != "") {
if (option.type == 'gys') {
this.type = option.type;
@ -758,25 +764,29 @@
i].stockLogList1[m].productCount)
}
}
}
for (let i = 0; i < that.list.length; i++) {
for (let z = 0; z < that.list[i].stockLogList1
.length; z++) {
if (returnDat.has(that.list[i].productId + '-' +
that.list[i].stockLogList1[z].attributeList
) == true) {
that.list[i].stockLogList1[z].maxNum = that
.list[i].stockLogList1[z].productCount -
returnDat.get(that.list[i].productId +
'-' + that.list[i].stockLogList1[z]
.attributeList)
}else{
that.list[i].stockLogList1[z].maxNum = that.list[i].stockLogList1[z]
.productCount
}
}
}
}
this.zReturnNum = 0
this.$nextTick(()=>{
for (let i = 0; i < that.list.length; i++) {
for (let z = 0; z < that.list[i].stockLogList1.length; z++) {
that.zReturnNum += that.list[i].stockLogList1[z].productCount
if (returnDat.has(that.list[i].productId + '-' + that.list[i].stockLogList1[z].attributeList) == true) {
that.list[i].stockLogList1[z].maxNum = that.list[i].stockLogList1[z].productCount -
returnDat.get(that.list[i].productId + '-' + that.list[i].stockLogList1[z].attributeList)
}else{
that.list[i].stockLogList1[z].maxNum = that.list[i].stockLogList1[z]
.productCount
}
}
}
})
console.log(returnDat);
returnDat.forEach(function(value, key) {
that.zReturnNum -= value
})
console.log('退货',that.zReturnNum)
}
}).catch((res) => {})
})
@ -808,9 +818,13 @@
},
//调用退货接口
sureReturn() {
uni.showLoading({
title: '加载中...'
})
// uni.showLoading({
// title: '加载中...'
// })
if(this.sales.productCount - this.zReturnNum == 0){
this.tui.toast("已经超过最大退货数量")
return
}
if (this.radio1 == 0 && this.changeA == '') {
this.tui.toast("请输入取货地址")
return
@ -820,14 +834,22 @@
return
}
let returnNum = 0
if(this.$refs.returnClose.val > this.inventoryList[0].realAmount - returnNum){
this.tui.toast('退货金额不能超出可退货金额')
return
}
for(let i=0;i<this.inventoryList.length;i++){
returnNum += this.inventoryList[i].totalAmount
}
if(this.inventoryList == ''){
if(this.$refs.returnClose.val > this.sales.realAmount){
this.tui.toast('退货金额不能超出可退货金额')
return
}
}else{
if(this.$refs.returnClose.val > this.inventoryList[0].realAmount - returnNum){
this.tui.toast('退货金额不能超出可退货金额')
return
}
}
for (var i = 0; i < this.list.length; i++) {
this.list[i].stockLogList = []
for (var m = 0; m < this.list[i].stockLogList1.length; m++) {
@ -836,7 +858,7 @@
}
}
}
console.log(this.list)
console.log('list',this.list)
for (var i = 0; i < this.list.length; i++) {
if(this.list[i].stockLogList.length != 0){
for (var m = 0; m < this.list[i].stockLogList.length; m++) {

4
pages/index/peopleList.vue

@ -102,11 +102,11 @@
<text style="line-height: 75rpx;" v-if="item.workerName">{{item.workerName}} <text v-if="item.isOnLine == 0" style="color: red;">(已下线)</text></text>
</view>
<view class="standard-box" @tap.stop="toggle('center',item)">
<view class="">
<view class="" v-if="popleType !='kdyName' && popleType !='lbgName'">
<text style="padding-left:40rpx;">收费标准</text>
<uni-icons type="info" color='#088FEB' size="16" style="line-height: 75rpx;"></uni-icons>
</view>
<view class="phone-btn" @tap.stop="clickPhone(item.mobile)" v-if="popleType != 'kdName'">拨打电话</view>
<view class="phone-btn" :style="{'line-height':(popleType !='kdyName' && popleType !='lbgName')?'':'80rpx'}" @tap.stop="clickPhone(item.mobile)" v-if="popleType != 'kdName'">拨打电话</view>
</view>
<!-- <view style="position: absolute;bottom: 0;left: 40rpx;" v-if="popleType == 'fcName' || popleType == 'lbgName' || popleType == 'wlName'">
<text style="line-height: 45rpx;color:red;font-size: 24rpx;" v-if="item.rebateAmount">本单返佣{{item.rebateAmount}}元</text>

100
pages/inventory/AIInventory.vue

@ -76,7 +76,12 @@
<view @tap.stop="delShopSpec(value[0],values[0])">
<uni-icons color="red" type="minus" size="26"></uni-icons>
</view>
<text @tap="checkSpec('颜色',value[0],values[0],numData(values[0])[0])">{{numData(values[0])[0]}}</text><text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])">{{numData(values[0])[1]}}</text>
<text @tap="checkSpec('颜色',value[0],values[0],numData(values[0])[0])">
{{numData(values[0])[0]}}
</text>
<text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])">
{{numData(values[0])[1]}}
</text>
<!-- <text style="color: red;">单价:¥{{item.price}}</text> -->
<view style="text-align: left;padding-left: 5px;width:40%;display: flex;"><uni-number-box
max="100000" style="margin-top:16rpx;" v-model="values[1].productCount"
@ -351,20 +356,41 @@
uni.showLoading({
title: '加载中...'
})
let that = this;
let that = this,
isTrue = false
if(this.merge ==1){
this.$refs.mergePopup.close();
this.carList.get(this.mergeId).productId = this.carList1.id
this.carList.get(this.mergeId).id = this.carList1.id
this.carList.get(this.mergeId).productName = this.carList1.productName
this.carList.get(this.mergeId).productPicture = this.carList1.productPicture
this.carList.get(this.mergeId).productSn = this.carList1.productSn
this.carList.get(this.mergeId).categoryId = this.carList1.categoryId
this.carList.get(this.mergeId).wholesalePrice=this.carList1.wholesalePrice || 0
this.carList.get(this.mergeId).lsprice= this.carList1.price || 0
this.carList.get(this.mergeId).isNew=false
this.carList.set(this.carList1.id,this.carList.get(this.mergeId))
if(this.carList.has(this.carList1.id) == true){ //跟当前页面有相同的商品
that.carList.get(that.mergeId).stockLogList.forEach(function(value1, key1) {
that.carList.get(that.carList1.id).stockLogList.forEach(function(value, key) {
if(key1 == key){
that.carList.get(that.carList1.id).stockLogList.get(key).productCount =
that.carList.get(that.carList1.id).stockLogList.get(key).productCount + value1.productCount
isTrue = true
that.carList.get(that.carList1.id).productCount += value1.productCount
}
})
if(isTrue == false){
that.carList.get(that.carList1.id).stockLogList.set(key1,value1)
that.carList.get(that.carList1.id).productCount += value1.productCount
}
})
}else{
this.carList.get(this.mergeId).productId = this.carList1.id
this.carList.get(this.mergeId).id = this.carList1.id
this.carList.get(this.mergeId).productName = this.carList1.productName
this.carList.get(this.mergeId).productPicture = this.carList1.productPicture
this.carList.get(this.mergeId).productSn = this.carList1.productSn
this.carList.get(this.mergeId).categoryId = this.carList1.categoryId
this.carList.get(this.mergeId).wholesalePrice=this.carList1.wholesalePrice || 0
this.carList.get(this.mergeId).lsprice= this.carList1.price || 0
this.carList.get(this.mergeId).isNew=false
this.carList.set(this.carList1.id,this.carList.get(this.mergeId))
}
this.carList.delete(this.mergeId)
this.getAllPrice()
setTimeout(res => {
uni.hideLoading();
}, 300)
@ -397,24 +423,47 @@
productSn: this.carList1[i].productSn,
stockLogList: new Map(),
stockLogList1: []
}
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
}
// let attrMap = new Map()
// let newSaleDetailDTOList = []
// for(let m = 0; m < item.saleDetailDTOList[i].stockLogList1.length; m++){
// if(attrMap.has(item.saleDetailDTOList[i].stockLogList1[m].attributeList) == true){
// let hasCount = attrMap.get(item.saleDetailDTOList[i].stockLogList1[m].attributeList)
// let trueCount = hasCount.split('-')[0]
// let lastConut = Number(trueCount) + Number(item.saleDetailDTOList[i].stockLogList1[m].productCount)
// newSaleDetailDTOList[hasCount.split('-')[1]].productCount = lastConut
// }else{
// newSaleDetailDTOList.push(item.saleDetailDTOList[i].stockLogList1[m])
// attrMap.set(item.saleDetailDTOList[i].stockLogList1[m].attributeList,item.saleDetailDTOList[i].stockLogList1[m].productCount+'-'+m)
// }
// }
// obj.saleDetailQueryDTO = newSaleDetailDTOList
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
let productCount = this.carList1[i].saleDetailQueryDTO[m].productCount
if(obj.stockLogList.has(this.carList1[i].saleDetailQueryDTO[m].attributeList) ==true){
productCount += obj.stockLogList.get(this.carList1[i].saleDetailQueryDTO[m].attributeList).productCount
}
var data1 = {
productCount: this.carList1[i].saleDetailQueryDTO[m].productCount,
productCount: productCount,
name: this.carList1[i].saleDetailQueryDTO[m].name
}
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
obj.price1 = obj.productCount * this.carList1[i].purchasePrice
}
this.carList.set(this.carList1[i].id, obj)
that.carList.get(that.carList1[i].id).price = that.carList.get(that.carList1[i].id).purchasePrice *
that.carList.get(that.carList1[i].id).productCount;
}
let id = this.carList1[i].isNew ==true ?this.carList1[i].id : this.carList1[i].productId
this.carList.set(id, obj)
that.carList.get(id).price = that.carList.get(id).purchasePrice *
that.carList.get(id).productCount;
}
this.carList1 = []
} else { //当前页有数据
console.log('111')
for (let i = 0; i < this.carList1.length; i++) {
for (let i = 0; i < this.carList1.length; i++) {
let id = this.carList1[i].isNew == true ? this.carList1[i].id : this.carList1[i].productId
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[
@ -470,11 +519,12 @@
obj.name = this.carList1[i].saleDetailQueryDTO[m].name
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
obj.price1 = obj.productCount * this.carList1[i].purchasePrice
}
this.carList.set(this.carList1[i].id, obj)
}
this.carList.set(id, obj)
}
that.carList.get(that.carList1[i].id).price = that.carList.get(that.carList1[i].id).purchasePrice *
that.carList.get(that.carList1[i].id).productCount;
that.carList.get(id).price = that.carList.get(id).purchasePrice *
that.carList.get(id).productCount;
}
@ -1383,7 +1433,7 @@
return
}
if((value.categoryId == '' && value.productId == '') || (value.categoryId == null && value.productId == '')){
that.tui.toast(value.productName + "的分类未维护!")
that.tui.toast(value.productName + "分类未维护!")
return;
}
value.stockLogList.forEach(function(values, keys) {

94
pages/inventory/addinventory.vue

@ -601,7 +601,6 @@
}
},
AiAddSpec(value){
console.log(value)
if(value.categoryId == ''){
this.tui.toast('请先选择商品分类')
return;
@ -985,58 +984,63 @@
})
},
inventorySubmit() {
inventorySubmit() {
let that = this;
if (this.khName == '' || this.carList == '') {
uni.showToast({
title: "请选择供应商后入库!",
icon: 'none'
})
return
} else {
if (this.storageType == 0) {
this.carList.forEach(function(value, key) {
if (value.purchasePrice == '' || value.purchasePrice == 0) {
uni.showToast({
title: value.productName + "的价格必须维护!",
icon: 'none'
})
return
}
})
}
}
let that = this;
let purchase = {
alreadyPay: this.alreadyPay == '' ? 0 : this.alreadyPay, //已付金额
noPay: this.noPay == '' ? 0 : this.noPay, //欠款
shouldPay: this.shouldPay, //应付金额
totalAmount: this.totalAmount, //总数量
remark: this.remark,
otherPay: this.otherPay == '' ? 0 : this.otherPay,
supplierId: this.khName.id, //供应商id和姓名
supplierName: this.khName.consigneeName
}
let purchaseDetails = [];
this.carList.forEach(function(value, key) {
value.stockLogList1 = []
value.stockLogList.forEach(function(values, keys) {
if (values <= 0) {
that.tui.toast("入库数量不能为零!")
return;
}
let obj = {
productCount: values.productCount,
attributeList: keys
}
let isTrue = false;
if (this.storageType == 0) {
this.carList.forEach(function(value, key) {
// console.log('这里',value)
console.log('这里',value.purchasePrice == '' || value.purchasePrice == 0)
if (value.purchasePrice == '' || value.purchasePrice == 0) {
uni.showToast({
title: value.productName + "的价格必须维护!",
icon: 'none'
})
isTrue = true;
return
}
value.stockLogList1.push(obj)
})
purchaseDetails.push(value)
})
console.log(purchaseDetails)
console.log(purchase)
uni.navigateTo({
url: '/package1/inventory/inventoryConfirm?purchase=' + JSON.stringify(purchase) + '&purchaseDetails=' + JSON.stringify(purchaseDetails)
})
}
if(isTrue == false){
let purchase = {
alreadyPay: that.alreadyPay == '' ? 0 : that.alreadyPay, //已付金额
noPay: that.noPay == '' ? 0 : that.noPay, //欠款
shouldPay: that.shouldPay, //应付金额
totalAmount: that.totalAmount, //总数量
remark: that.remark,
otherPay: that.otherPay == '' ? 0 : that.otherPay,
supplierId: that.khName.id, //供应商id和姓名
supplierName: that.khName.consigneeName
}
let purchaseDetails = [];
that.carList.forEach(function(value, key) {
value.stockLogList1 = []
value.stockLogList.forEach(function(values, keys) {
if (values <= 0) {
that.tui.toast("入库数量不能为零!")
return;
}
let obj = {
productCount: values.productCount,
attributeList: keys
}
value.stockLogList1.push(obj)
})
purchaseDetails.push(value)
})
uni.navigateTo({
url: '/package1/inventory/inventoryConfirm?purchase=' + JSON.stringify(purchase) + '&purchaseDetails=' + JSON.stringify(purchaseDetails)
})
}
},
//编辑每一个的单价
clickCollapse(index) {

112
pages/inventory/changeGoods1.vue

@ -6,12 +6,12 @@
</view>
<view class="title-box">
<uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none"
@confirm="search" />
@confirm="search" @blur="search" @clear="clearSearch" />
</view>
</view>
<view class="content-box" :style="{height:height - 360 +'rpx'}">
<view class="content-left">
<view class="left-box" v-for="(item, index) in indexList" :key="item"
<view class="left-box" v-if="gateType == ''" v-for="(item, index) in indexList" :key="index"
:class="item.parentId ? 'left-box-hover':''" @tap="clickLeftBtn(index)">
<text style="width: 100%;height: 90rpx;line-height: 90rpx;display: inline-block;overflow: hidden;"
:class="item.parentId ? 'red' :''">{{item.categoryName}}</text>
@ -48,6 +48,37 @@
</view>
</view>
</view>
</view>
<view class="right-box" v-for="(item,index) in shopList1" :key="index" @tap="toggle('bottom',item)">
<!-- 当商品的delFlag=0和未入库状态时,显示此遮罩,点击弹出弹窗提示不能操作 -->
<view class="shop-mask" v-if="item.delFlag == 0 || item.inStorageStatus == 0"
@tap.stop="clickMask(item)"></view>
<view class="box-left">
<img class="img-radius" :src="item.productPicture" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
</view>
<view class="box-right">
<view class="box-right-name">{{item.productName}}</view>
<view class="box-right-num">{{item.productSn}}</view>
<view class="box-right-price">
<view class="price-box" v-if="storageType == 0">
<text>{{item.inStorageStatus==0?'待入库':item.purchasePrice == null ?'新商品':item.purchasePrice}}</text>
<text>采购价</text>
</view>
<view class="price-box">
<text>{{item.wholesalePrice}}</text>
<text>批发价</text>
</view>
<view class="price-box">
<text>{{item.price}}</text>
<text>零售价</text>
</view>
<view class="price-box">
<text>{{item.stockCount}}</text>
<text>库存</text>
</view>
</view>
</view>
</view>
</view>
</view>
@ -188,12 +219,11 @@
return {
indexList: [],
pageNum: 1, //分页的页码
shopList: [],
shopList: [],
shopList1: [],
info: 0,
categoryId: '', //分类id
searchName: '', //搜索框输入值
shopId: '', //店铺id,
checkbox: [], //需要分享的商品id
temporaryNum: 0,
allChangeNum:0,
goodsDetail: [],
@ -219,6 +249,7 @@
goodsList:[],
newTemList:[],
pecsList:[],
gateType:'',
dataObj :new Map() //拿到的 规格值为key的
}
},
@ -264,7 +295,7 @@
}
}
this.categoryId = this.indexList[0].id
this.getShareList(this.indexList[0].id);
this.getShareList();
} else {
this.tui.toast(res.message)
}
@ -473,20 +504,38 @@
delta: 1
})
},
//点击分类获取商品列表
getShareList(id) {
this.tui.request("/app/product/getShareList", "POST", {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '10'
}, false, false).then((res) => {
if (res.code == 200) {
this.shopList = res.result.records
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
getShareList(type) {
let data = {}
if(type=='search'){
this.gateType = 'search'
data = {
categoryId: "",
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '100'
}
}else{
this.gateType = ''
data = {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '100'
}
}
this.tui.request("/app/product/getShareList", "POST", data, false, false).then((res) => {
if (res.code == 200) {
if(type=='search'){
this.shopList = []
this.shopList1 = res.result.records
}else{
this.shopList1 = []
this.shopList = res.result.records
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
},
//获取弹出层状态
change(e) {
@ -645,9 +694,20 @@
}, 200)
},
//顶部搜索框
search(res) {
this.searchName = res.value
this.getShareList()
search(e) {
if(e.value == ''){
this.searchName = ""
this.getShareList()
}else{
this.searchName = e.value
this.getShareList('search')
}
},
//清空搜索条件
clearSearch(){
this.searchName = ''
this.getShareList()
},
//未入库遮罩
clickMask(item) {
@ -720,7 +780,8 @@
}
}
this.temporaryList = []
this.purchasePrice = ""
this.purchasePrice = ""
this.oldTemList = []
this.zPrice = ''
this.zNum = ''
for (let i = 0; i < this.goodsDetail.attributeList.length; i++) {
@ -751,6 +812,9 @@
that.$forceUpdate()
}
})
},
change() {
this.oldTemList = []
},
//选商品的时候能删除规格
delCarData(index) {

197
pages/inventory/goodsList1.vue

@ -94,20 +94,29 @@
</view>
<view class="shop-checkList" v-if="value[1].stockLogList !=''">
<view class="shop-checkList-box" style="width: 67%;">
<text style="text-align:center;width: 356rpx;display: inline-block;font-size: 30rpx;font-weight: bold;padding-left: 40rpx;">规格</text>
<text style="font-size: 30rpx;color: #000;font-weight: bold;width: 110rpx;display: inline-block;text-align: center;">库存</text>
<text style="text-align:center;width: 400rpx;display: inline-block;font-size: 30rpx;font-weight: bold;padding-left: 40rpx;">
规格
</text>
<text style="font-size: 30rpx;color: #000;font-weight: bold;width: 60rpx;display: inline-block;text-align: center;">
库存
</text>
</view>
<view style="font-size: 30rpx;color: #000;font-weight: bold;width: 140rpx;display: inline-block;text-align: right;">数量</view>
<view style="font-size: 30rpx;color: #000;font-weight: bold;width: 152rpx;display: inline-block;text-align: right;">数量</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>
<text style="width: 15%;">{{values[1].productNum}}</text>
<text @tap="checkSpec('颜色',value[0],values[0],numData(values[0])[0])">
{{numData(values[0])[0]}}
</text>
<text @tap="checkSpec('尺码',value[0],values[0],numData(values[0])[1])">
{{numData(values[0])[1]}}
</text>
<text style="width: 25%;font-size: 22rpx;">{{values[1].productNum == null ?'无库存':values[1].productNum}}</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].productCount"
<uni-number-box max="100000" style="margin-top:9rpx;border-right:0;" v-model="values[1].productCount"
@change="GoodsNumChange($event,value,values[0])" />
</view>
</view>
@ -452,6 +461,27 @@
</view>
</view>
</uni-popup>
<!-- 弹出规格选择 -->
<uni-popup ref="getaPopup" background-color="#fff" :is-mask-click="true">
<view class="type-popup" style="margin-bottom: 0;border-radius: 0;">
<view style="height: 80rpx;font-size: 36rpx;font-weight: bold;line-height: 80rpx;text-align: center;">
修改当前规格
</view>
<view class="card-list">
<ul>
<li v-for="items in attrList" :key="items.id">
<view class="title-fur">
<view class="name">{{items.attributeName}}</view>
</view>
<view class="content-fur">
<view class="content-low" v-for="item in attributeValue" :key="item.id"
@tap="changeSpec(item.value)">{{item.value}}</view>
</view>
</li>
</ul>
</view>
</view>
</uni-popup>
</view>
</template>
@ -464,7 +494,9 @@
let manager = plugin.getRecordRecognitionManager()
export default {
data() {
return {
return {
attrList:[],
attributeValue:[],
lsprice: 0, //临时零售价
wholesalePrice: 0, // 临时显示批发价
price: 0, //总金额
@ -661,6 +693,7 @@
purchasePrice: this.carList1[i].price, //采购价
price: 0, //总价
discount: 10, //折扣
categoryId:this.carList1[i].categoryId,
unitPrice: this.carList1[i].unitPrice || 0, //单价
discountAmount: this.carList1[i].unitPrice || 0, //折后价
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
@ -727,6 +760,7 @@
purchasePrice: this.carList1[i].price, //采购价
price: 0,
discount: 10,
categoryId:this.carList1[i].categoryId,
discountAmount: this.carList1[i].unitPrice || 0,
unitPrice: this.carList1[i].unitPrice || 0, //单价
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
@ -806,6 +840,7 @@
purchasePrice: this.carList1[i].purchasePrice, //采购价
price: 0, //总价
discount: 10, //折扣
categoryId:this.carList1[i].categoryId,
unitPrice: this.carList1[i].price || 0, //单价
discountAmount: this.carList1[i].unitPrice || 0, //折后价
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
@ -859,6 +894,7 @@
purchasePrice: this.carList1[i].purchasePrice, //采购价
price: 0, //总价
discount: 10, //折扣
categoryId:this.carList1[i].categoryId,
unitPrice: this.carList1[i].price || 0, //单价
discountAmount: this.carList1[i].unitPrice || 0, //折后价
wholesalePrice: this.carList1[i].wholesalePrice, //批发价
@ -934,6 +970,81 @@
result = res
})
return result;
},
numData(val){
var name = []
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name.push(newObj[as])
}
}
return name;
},
checkSpec(type,id,attr,value){
this.temporary = [id,attr,type,value]
let num = type == '颜色' ? 0 : 1
this.getGategoryLowList()
},
//初始化获取子分类列表
getGategoryLowList() {
this.attrList = []
let num = this.temporary[2] == '颜色' ? 0 : 1
this.tui.request("/app/productAttribute/selectByCategoryId", "POST", {
categoryId: this.carList.get(this.temporary[0]).categoryId
}, false, true).then((res1) => {
if (res1.code == 200) {
this.attrList.push(res1.result[num])
if (res1.result.length > 0) {
this.attributeValue = []
this.tui.request(
"/app/productAttributeValue/selectByAttributeId",
"get", {
id: this.attrList[0].id
}, false, true).then((res2) => {
if (res2.code == 200) {
this.attributeValue = res2.result;
this.$forceUpdate()
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
}
setTimeout(() => {
this.showList = this.attrList;
}, 1000)
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
this.$forceUpdate()
this.$refs.getaPopup.open()
},
//点击某一个规格,可修改
changeSpec(item){
let that = this;
if(item == ''){
this.tui.toast('请输入要修改的规格值')
return;
}
let data = this.temporary
let specMap = new Map() //新的临时存放值那个更改过的值的数组
this.carList.get(data[0]).stockLogList.forEach(function(value, key) {
if(key == data[1]){
let stringKey = key.replace(data[3],item) //拿到了更改过的key
specMap.set(stringKey,value) //name的值没有改,所有的数组都放在这个下面
that.carList.get(data[0]).stockLogList.delete(data[1])
}
})
if(this.carList.get(data[0]).stockLogList.size > 0){
this.carList.get(data[0]).stockLogList.forEach(function(value, key) {
specMap.set(key,value)
})
}
this.carList.get(data[0]).stockLogList = specMap
this.$forceUpdate()
this.$refs.getaPopup.close()
},
//销售员列表
xsyList() {
@ -1154,10 +1265,24 @@
clearText(){
this.voiceText = ''
},
spliceMsg(res){
let regex = /嗯|啊|儿|各|阿|恩/g;
return res.replace(regex, '')
},
convertChineseToArabic(str) {
const chineseNumToArabic = {
'零': 0, '一': 1, '二': 2, '两': 2, '三': 3,
'四': 4, '五': 5, '六': 6, '七': 7, '八': 8, '九': 9
};
const regex = /(零|一|二|两|三|四|五|六|七|八|九)/g;
return str.replace(regex, match => chineseNumToArabic[match]);
},
//编辑挂单信息
setDetail(e) {
let convertedStr = this.convertChineseToArabic(this.voiceText);
let getMsg = this.spliceMsg(convertedStr)
this.tui.request("/app/sale/buyAi", "POST", {
aiMsg:this.voiceText
aiMsg:getMsg
}, false, true).then((res) => {
if (res.code == 200) {
this.voiceText = ''
@ -1322,11 +1447,6 @@
}
},
AiAddSpec(value){
if(value.categoryId == ''){
this.tui.toast('请先选择商品分类')
return;
}
console.log(value)
this.getById(value.productId || value.id);
},
//通过商品id查询商品详细信息
@ -1624,6 +1744,7 @@
price: 0, //总价
discount: 10, //折扣
unitPrice: 0, //单价
categoryId:carList1[i].categoryId,
discountAmount: 0, //折后价
wholesalePrice: carList1[i].wholesalePrice, //批发价
lsprice: carList1[i].lsprice, //零售价
@ -1699,6 +1820,7 @@
discount: 10,
discountAmount: 0,
unitPrice: 0, //单价
categoryId:carList1[i].categoryId,
wholesalePrice: carList1[i].wholesalePrice, //批发价
lsprice: carList1[i].lsprice, //零售价
productCount: 0,
@ -1857,7 +1979,7 @@
return
}
let obj = {
orderByWorker: this.lbgName.workerId,
orderByWorker: this.lbgName.workerId || this.kdyName.workerId,
oldSaleId: this.saleId || '',
sale: {
// relPrice:,
@ -2868,5 +2990,52 @@
height: 180rpx;
background: #eee;
border-radius: 50%;
}
.type-popup{
width: 500rpx;
height: auto;
background: #fff;
border-radius: 10px;
position: relative;
margin-bottom: 40rpx;
}
.card-list {
width: 95%;
border-radius: 10upx;
background: #fff;
height: auto;
margin: 40rpx auto 0;
}
.title-fur {
width: 95%;
height: 70rpx;
margin: 0 auto;
border-bottom: 1px solid #eee;
}
.name {
font-size: 30rpx;
width: 50%;
float: left;
height: 70rpx;
line-height: 70rpx;
}
.content-fur {
padding-bottom: 25rpx;
}
.content-low {
width: auto;
border: 1px solid #eee;
display: inline-block;
min-width: 90rpx;
padding: 5rpx;
font-size: 35rpx;
text-align: center;
color: #777;
margin: 20rpx 0 0 20rpx;
}
</style>

96
pages/inventory/inventory.vue

@ -37,17 +37,17 @@
</view>
</view>
<view class="search">
<uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none" @confirm="search" @clear="clearSearch" />
<uni-search-bar class="uni-mt-10" radius="5" placeholder="商品名称/货号/供应商" cancelButton="none" @confirm="search" @blur="search" @clear="clearSearch" />
</view>
<view class="content-box">
<view class="content-left">
<view class="left-box" v-for="(item, index) in indexList" :key="item"
<view v-if="gateType == ''" class="left-box" v-for="(item, index) in indexList" :key="index"
:class="item.parentId ? 'left-box-hover':''" @tap="clickLeftBtn(index)">
<text style="width: 100%;height: 90rpx;line-height: 90rpx;display: inline-block;overflow: hidden;" :class="item.parentId ? 'red' :''">{{item.categoryName}}</text>
</view>
</view>
<view class="content-right">
<view class="right-box" v-for="item in shopList" :key="item" @tap="goDetail(item)">
<view class="right-box" v-for="(item,index) in shopList" :key="index" @tap="goDetail(item)">
<view class="box-left">
<img :src="item.productPicture" class="img-radius" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
@ -77,6 +77,37 @@
</view>
</view>
</view>
</view>
<view class="right-box" v-for="(item,index) in shopList1" :key="index" @tap="goDetail(item)">
<view class="box-left">
<img :src="item.productPicture" class="img-radius" alt="" v-if="item.productPicture">
<view class="noPic" v-else>暂无图片</view>
</view>
<view class="box-right">
<view class="box-right-name">{{item.productName}}</view>
<view class="box-right-num">{{item.productSn}}</view>
<!-- 1上架 0下架 -->
<view class="up-down" v-if="item.delFlag ==1" @tap.stop="upDown('0',item)">下架</view>
<view class="up-down" v-if="item.delFlag ==0" @tap.stop="upDown('1',item)">上架</view>
<view class="box-right-price">
<view class="price-box" v-if='type==0'>
<text style="color: red;">{{item.inStorageStatus==0?'待入库':item.purchasePrice==null?'新商品':item.purchasePrice}}</text>
<text>采购价</text>
</view>
<view class="price-box">
<text>{{item.wholesalePrice}}</text>
<text>批发价</text>
</view>
<view class="price-box">
<text>{{item.price}}</text>
<text>零售价</text>
</view>
<view class="price-box">
<text>{{item.stockCount}}</text>
<text>库存</text>
</view>
</view>
</view>
</view>
</view>
</view>
@ -126,7 +157,9 @@
warnMsg:[],
searchName:'',
categoryIndex:0,
windowHeight:0
windowHeight:0,
shopList1:[],
gateType:''
}
},
onLoad(){
@ -159,7 +192,7 @@
}
}
this.categoryId = this.indexList[this.categoryIndex].id
this.getShareList(this.indexList[this.categoryIndex].id);
this.getShareList();
} else {
this.tui.toast(res.message)
}
@ -186,7 +219,7 @@
}
}
this.categoryId = this.indexList[index].id
this.getShareList(this.indexList[index].id)
this.getShareList()
},
//入库单详情
goDetail(item) {
@ -200,15 +233,34 @@
})
},
//点击分类获取商品列表
getShareList(id) {
this.tui.request("/app/product/getShareList", "POST", {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '10'
}, false, false).then((res) => {
if (res.code == 200) {
this.shopList = res.result.records
getShareList(type) {
let data = {}
if(type=='search'){
this.gateType = 'search'
data = {
categoryId: "",
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '100'
}
}else{
this.gateType = ''
data = {
categoryId: this.categoryId,
searchStr: this.searchName,
pageNum: this.pageNum,
pageSize: '100'
}
}
this.tui.request("/app/product/getShareList", "POST", data, false, false).then((res) => {
if (res.code == 200) {
if(type=='search'){
this.shopList = []
this.shopList1 = res.result.records
}else{
this.shopList1 = []
this.shopList = res.result.records
}
} else {
this.tui.toast(res.message)
}
@ -233,7 +285,7 @@
that.tui.toast(res.message)
}
this.categoryId = data.categoryId
that.getShareList(data.categoryId)
that.getShareList()
}).catch((res) => {})
} else { //上架
that.tui.request("/app/product/up", "POST", {
@ -245,7 +297,7 @@
that.tui.toast(res.message)
}
this.categoryId = data.categoryId
that.getShareList(data.categoryId)
that.getShareList()
}).catch((res) => {})
}
}
@ -254,8 +306,14 @@
},
//搜索接口
search(e){
this.searchName = e.value
this.getShareList()
if(e.value == ''){
this.searchName = ""
this.getShareList()
}else{
this.searchName = e.value
this.getShareList('search')
}
},
//清空搜索条件
clearSearch(){

191
pages/inventory/inventoryDetail.vue

@ -10,7 +10,12 @@
<view class="box-right-name">{{dataList.productName == null ? '暂无':dataList.productName}} ({{dataList.productSn == null ? '暂无':dataList.productSn}})</view>
<view class="box-right-num">供应商:{{dataList.supplierName == null ? '暂无':dataList.supplierName}}</view>
<view class="edit-btn" @tap="goToAddGoods">编辑</view>
<view @tap="clickPrint" style="width: 100rpx;height: 60rpx;line-height: 60rpx;color: #fff !important;background: #0072E3;position: absolute;top: 30rpx;right: 40rpx;border-radius: 10px;text-align: center;">打印</view>
<view v-if="!isPrint" @tap="printBtn" class="print-btn">
打印
</view>
<view v-if="isPrint" @tap="printBtn" class="print-btn">
取消
</view>
<view class="box-right-num" style="color:#ffa200;">
<text style="padding-right: 20rpx;">{{dataList.delFlag==1?'已上架':'已下架'}}</text>
<!-- <text>{{dataList.delFlag==0?'已上架':'已下架'}}</text> -->
@ -38,11 +43,15 @@
</view>
<view class="container-box" v-for="(item,index) in pecsList" :key='index'>
<view class="prec-list">
<view class="prec-list-box" style="width: 70%;">
<view class="prec-list-box" :style="{width:isPrint?'40%':'70%'}">
{{item.attributeList | sliceMsg}}
</view>
<view class="prec-list-box" style="font-size: 26rpx;">
<view class="prec-list-box" style="font-size: 26rpx;width: 26%;">
数量:{{item.stockCount}}
</view>
<view>
<uni-number-box v-if="isPrint" v-model="item.productCount" max="10000"
@change="changeNumBtn(item)" style="margin-top: 10rpx;display: block;" />
</view>
</view>
</view>
@ -56,8 +65,32 @@
<view class="content-low" v-for="(item1,index1) in list" :key="index1"
@tap.stop="addMultipleType(item1)" :class="item1.checked?'checked':''">{{item1.type}}</view>
</view>
<view class="popup-pay-container" >
<kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint" :defaultText="'打印'"></kk-printer>
<view v-if="list[0].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
供应商:
</text>
<input v-if="isShow" v-model="dataList.supplierName" @change="changeText" type="text" placeholder="请输入供应商名称" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
</view>
<view v-if="list[1].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
货号:
</text>
<input v-if="isShow" v-model="dataList.productSn" @change="changeText" type="text" placeholder="请输入货号" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
</view>
<view v-if="list[2].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
零售价:
</text>
<input v-if="isShow" v-model="dataList.price" @change="changeText" type="number" placeholder="请输入零售价" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
</view>
<view v-if="list[3].checked" style="display: flex;height: 80rpx;width: 100%;line-height: 80rpx;margin-top: 20rpx;">
<text style="display:inline-block;width:100rpx;font-size:22rpx;">
批发价:
</text>
<input v-if="isShow" v-model="dataList.wholesalePrice" @change="changeText" type="number" placeholder="请输入批发价" style="display: flex;height: 80rpx;width: 300rpx;line-height: 80rpx;padding-left: 20rpx;border: 1px solid #eee;">
</view>
<view class="popup-pay-container">
<kk-printer ref="kkprinter" :bufferData="bufferData" @onPrint="onPrint" :printNum="printNum" :defaultText="'打印'"></kk-printer>
</view>
</view>
</uni-popup>
@ -66,8 +99,9 @@
<uni-popup-dialog ref="inputClose" mode="input" title="采购价" placeholder="请输入采购价"
@confirm="changePrice"></uni-popup-dialog>
</uni-popup>
<view v-if="isPrint" @tap="clickPrint" class="bottom-btn">确认打印</view>
<!-- 右下角悬浮按钮 -->
<uni-fab ref="fab" :content="content" :horizontal="horizontal"
<uni-fab v-if="!isPrint" ref="fab" :content="content" :horizontal="horizontal"
@trigger="trigger" />
</view>
</template>
@ -81,23 +115,29 @@
return {
pageNum: 1, //分页的页码
dataList: [],
isPrint:false,
bufferData: [],
horizontal: 'right',
pecsList:[],
defaultText:'',
type:'',
printNum:1,
list:[{
type:'供应商',
checked:false,
text:''
},{
type:'货号',
checked:false,
text:''
},{
type:'零售价',
checked:false,
text:''
},{
type:'批发价',
checked:false,
text:''
}],
multipleList:[],
content: [{
@ -115,7 +155,10 @@
selectedIconPath: '/static/images/tabbar/home-sel.png',
text: '删除商品',
active: false
}]
}],
printList:new Map(),
yNum: 10,
isShow:true
}
},
filters: {
@ -140,7 +183,9 @@
components: {
kkPrinter
},
onLoad(option) {
onLoad(option) {
// 初始化蓝牙模块
wx.openBluetoothAdapter({mode: 'central'})
this.dataList = JSON.parse(option.item);
this.type = uni.getStorageSync('type')
},
@ -161,13 +206,42 @@
}).catch((res) => {})
},
changeText(){
console.log(this.dataList)
},
clickShow(){
this.isShow = false
},
changeNumBtn(item){
if(this.printList.has(item.attributeList) == true){ // map中已经有当前值
if(item.productCount == 0){
this.printList.delete(item.attributeList)
}else{
this.printList.get(item.attributeList).productCount = item.productCount
}
}else{
this.printList.set(item.attributeList,item)
}
console.log('打印的数组',this.printList)
},
printBtn(){
this.isPrint = !this.isPrint
},
//点击打印按钮
clickPrint() {
this.$refs.payDialog.open('center')
},
//选择多个规格保存
addMultipleType(item1){
if(item1.type== '供应商'){
item1.text = this.dataList.supplierName
}else if(item1.type== '货号'){
item1.text = this.dataList.productSn
}else if(item1.type== '零售价'){
item1.text = this.dataList.price
}else if(item1.type== '批发价'){
item1.text = this.dataList.wholesalePrice
}
item1.checked = !item1.checked
if(this.multipleList == ''){
this.multipleList.push(item1.type)
@ -184,7 +258,7 @@
}
}
}
console.log(this.multipleList);
console.log(this.multipleList)
},
//去新增商品页编辑
goToAddGoods(){
@ -192,30 +266,52 @@
url: "/package1/inventory/addGoods?dataList="+JSON.stringify(this.dataList)
})
},
onPrint(opt) {
let strCmd = blesdk.CreatCPCLPage(440, 320, 1, 0);
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '商品名:'+this.dataList.productName)
if(this.multipleList.indexOf('货号') != -1){
console.log(this.multipleList.indexOf('货号'))
strCmd += blesdk.addCPCLText('0', '80', '24', '0', 0, '货 号:'+this.dataList.productSn)
}
if(this.multipleList.indexOf('供应商') != -1){
console.log(this.multipleList.indexOf('供应商'))
strCmd += blesdk.addCPCLText('0', '130', '24', '0', 0, '供应商:'+this.dataList.supplierName)
}
if(this.multipleList.indexOf('批发价') != -1){
console.log(this.multipleList.indexOf('批发价'))
strCmd += blesdk.addCPCLText('0', '180', '24', '0', 0, '批发价:'+this.dataList.wholesalePrice)
}
if(this.multipleList.indexOf('零售价') != -1){
console.log(this.multipleList.indexOf('零售价'))
strCmd += blesdk.addCPCLText('0', '230', '24', '0', 0, '零售价:'+this.dataList.price)
sliceMsg(val) {
var name = ''
if (typeof(val) == 'string') {
let newObj = JSON.parse(val)
for (let as in newObj) {
name += newObj[as] + ' '
}
}
strCmd += blesdk.addCPCLQRCode(200, 140, 'H', '1', 6, [this.dataList.id,uni.getStorageSync('shopId')]) //二维码
strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中
strCmd += blesdk.addCPCLPrint();
this.bufferData.push(strCmd);
this.$refs.payDialog.close();
return name;
},
//计算打印机当前行高度
countPrint(){
return this.yNum += 50
},
onPrint(opt) {
let that = this
this.printList.forEach((item, index) => {
for(let i=0;i<item.productCount;i++){
that.yNum = 10
let strCmd = blesdk.CreatCPCLPage(440, 320, 1, 0);
strCmd += blesdk.addCPCLText('0', '10', '24', '0', 0, '商品名:'+that.dataList.productName)
if(that.multipleList.indexOf('货号') != -1){
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '货 号:'+that.dataList.productSn)
}
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '规 格:'+ that.sliceMsg(item.attributeList))
if(that.multipleList.indexOf('供应商') != -1){
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '供应商:'+that.dataList.supplierName)
}
if(that.multipleList.indexOf('批发价') != -1){
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '批发价:'+that.dataList.wholesalePrice)
}
if(that.multipleList.indexOf('零售价') != -1){
strCmd += blesdk.addCPCLText('0', that.countPrint(), '24', '0', 0, '零售价:'+that.dataList.price)
}
strCmd += blesdk.addCPCLQRCode(200, 140, 'H', '1', 6, [that.dataList.id,uni.getStorageSync('shopId')]) //二维码
strCmd += blesdk.addCPCLLocation(0); //对齐指令 0-左对齐 1-右对齐 2-居中
strCmd += blesdk.addCPCLPrint();
that.bufferData.push(strCmd);
}
})
that.$nextTick(()=>{
uni.navigateBack({
delta: 1
})
})
},
//悬浮按钮
trigger(e) {
@ -399,7 +495,7 @@
padding-bottom: 20rpx;
}
.popup-pay-container {
margin-top: 20rpx;
margin-top: 40rpx;
height: 100rpx;
border-radius: 10px;
background: #088FEB;
@ -415,6 +511,7 @@
}
.content-fur {
padding-bottom: 25rpx;
border-bottom: 1px solid #eee;
}
.content-low {
@ -427,5 +524,31 @@
text-align: center;
color: #777;
margin: 20rpx 0 0 20rpx;
}
.print-btn{
width: 100rpx;
height: 60rpx;
line-height: 60rpx;
color: #fff !important;
background: #0072E3;
position: absolute;
top: 30rpx;
right: 40rpx;
border-radius: 10px;
text-align: center;
}
.bottom-btn{
width: 200rpx;
height: 80rpx;
line-height: 80rpx;
color: #fff;
background: #0072E3;
border-radius: 80rpx;
text-align: center;
position: fixed;
bottom: 75rpx;
right: 0;
left: 0;
margin: auto;
}
</style>

17
pages/login/login.vue

@ -103,16 +103,25 @@
choose: false,
isChoose: false,
clock: 60, // 倒计时
shopList: []
shopList: [],
saleId:''
}
},
computed: mapState(['type']),
onLoad() {
onLoad(option) {
this.saleId = option.saleId
this.userId = option.userId
if(uni.getStorageSync('hiver_token') != '' && uni.getStorageSync('wayValue') == 2){
uni.reLaunch({
url: '/package1/other/custom?saleId=' + this.saleId + '&userId=' + this.userId
})
}
this.getCaptchaImg();
this.username = uni.getStorageSync('username')
this.password = uni.getStorageSync('password')
},
methods: {
methods: {
...mapMutations(['login']),
...mapActions(['getUserInfo']),
getCaptchaImg() {
@ -183,7 +192,7 @@
if(this.wayValue == 2){ //下游客户登录
setTimeout(() => {
uni.reLaunch({
url: '/package1/other/custom'
url: '/package1/other/custom?saleId=' + this.saleId
})
}, 200)
this.tui.toast('登录成功', 2000, true)

Loading…
Cancel
Save