Browse Source

入库

master
tianyi@bogon 3 years ago
parent
commit
55d6e6a10a
  1. 24
      pages/index/addHangOrder.vue
  2. 42
      pages/inventory/addinventory.vue
  3. 89
      pages/inventory/changeGoods1.vue

24
pages/index/addHangOrder.vue

@ -12,7 +12,7 @@
<view style="flex:1;">{{item.saleName}}</view> <view style="flex:1;">{{item.saleName}}</view>
<view class="btn-list"> <view class="btn-list">
<view class="bj-btn" @tap.stop="inputDialogToggle('edit', item)">编辑</view> <view class="bj-btn" @tap.stop="inputDialogToggle('edit', item)">编辑</view>
<view class="bj-btn" @tap.stop="scanCodeAdd">扫码开单</view> <view class="bj-btn" @tap.stop="scanCodeAdd(item.id)">扫码开单</view>
<view class="bj-btn" @tap.stop="toggle('center',item)">语音备注</view> <view class="bj-btn" @tap.stop="toggle('center',item)">语音备注</view>
</view> </view>
</view> </view>
@ -29,13 +29,14 @@
<text style="color: red;">备注:</text> <text style="color: red;">备注:</text>
{{item.remark}} {{item.remark}}
</view> </view>
<view class="shop-list"> <view class="shop-list" v-for="items in item.saleDetailDTOList">
<view class="order-name"> <view class="order-name">
女士连衣裙(HD738206579) {{items.productName}} {{items.productSn}}
<img src="/static/images/datu.png" @tap.stop="largeImg" alt=""> <img :src="items.purchasePrice" @tap.stop="largeImg" alt="">
</view>
<view class="specs-name" v-for="itemss in items.saleDetailQueryDTO">
{{itemss.attributeList}} * {{itemss.productCount}}
</view> </view>
<view class="specs-name">颜色:黑色,尺码:s码 * 2</view>
<view class="specs-name">颜色:黑色,尺码:s码 * 2</view>
<view class="del-icon" @tap.stop="delGoodsPrecs"><uni-icons color="red" type="trash" <view class="del-icon" @tap.stop="delGoodsPrecs"><uni-icons color="red" type="trash"
size="26"></uni-icons></view> size="26"></uni-icons></view>
</view> </view>
@ -190,7 +191,8 @@
purchasePrice: 0, purchasePrice: 0,
zPrice:0, zPrice:0,
zNum:0, zNum:0,
storageType:0 storageType:0,
hangId:''
} }
}, },
onLoad() { onLoad() {
@ -280,9 +282,10 @@
} }
}, },
//扫一扫功能 //扫一扫功能
scanCodeAdd() { scanCodeAdd(id) {
uni.scanCode({ uni.scanCode({
success: (res) => { success: (res) => {
this.hangId = id
this.toggle('bottom', res.result); this.toggle('bottom', res.result);
}, },
@ -375,6 +378,9 @@
supplierName: this.goodsDetail.supplierName, supplierName: this.goodsDetail.supplierName,
saleDetailQueryDTO:this.temporaryList saleDetailQueryDTO:this.temporaryList
} }
// if(){
// }
this.carList.push(data) this.carList.push(data)
console.log(this.carList); console.log(this.carList);
this.temporaryList = [] this.temporaryList = []
@ -397,7 +403,7 @@
setSaleDetail(){ setSaleDetail(){
this.tui.request("/app/sale/setSaleDetail", "post", { this.tui.request("/app/sale/setSaleDetail", "post", {
saleDetailList:this.carList, saleDetailList:this.carList,
saleId:this.goodsDetail.id saleId:this.hangId
}, false, false).then((res) => { }, false, false).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.getRegList() this.getRegList()

42
pages/inventory/addinventory.vue

@ -37,7 +37,8 @@
</view> </view>
</view> </view>
<view class="shop-type"> <view class="shop-type">
<view class="shop-collapse" v-for="(items,index1) in item.saleDetailQueryDTO" @tap="clickCollapse(index,index1)"> <view class="shop-collapse" v-for="(items,index1) in item.saleDetailQueryDTO"
@tap="clickCollapse(index,index1)">
<text>{{items.name}}</text> <text>{{items.name}}</text>
<text style="color: red;">单价:¥{{items.price}}</text> <text style="color: red;">单价:¥{{items.price}}</text>
<text>数量:{{items.productCount}}</text> <text>数量:{{items.productCount}}</text>
@ -128,8 +129,36 @@
}, },
onShow() { onShow() {
this.khName = JSON.parse(JSON.stringify(this.khName)) || '' this.khName = JSON.parse(JSON.stringify(this.khName)) || ''
this.carList = this.carList || '' let lsList = this.carList;
if (lsList.length == 0) {
this.carList = this.carList1 || []
} else { //111 222
for (var i = 0; i < lsList.length; i++) {
for (var s = 0; s < lsList[i].saleDetailQueryDTO.length; s++) {
for (var m = 0; m < this.carList1.length; m++) {
if (lsList[i].id == this.carList1[m].id) { //是相同商品
for (var v = 0; v < this.carList1[m].saleDetailQueryDTO.length; v++) { //不是相同规格
if (lsList[i].saleDetailQueryDTO[s].name != this.carList1[m].saleDetailQueryDTO[v].name) {
//已经是最后一项循环
if (s + 1 == lsList[i].saleDetailQueryDTO.length) {
this.carList[i].saleDetailQueryDTO.push(this.carList1[m].saleDetailQueryDTO[v])
}
} else { //是相同规格
this.carList[i].saleDetailQueryDTO[s].productCount += this.carList1[m].saleDetailQueryDTO[v].productCount
}
}
}else{
if (i + 1 == lsList.length) { //已经是最后一项循环
this.carList.push(this.carList1[m])
}
}
}
}
}
}
console.log(this.carList) console.log(this.carList)
console.log(lsList)
for (let i = 0; i < this.carList.length; i++) { for (let i = 0; i < this.carList.length; i++) {
this.totalAmount += this.carList[i].num this.totalAmount += this.carList[i].num
this.shouldPay += this.carList[i].price this.shouldPay += this.carList[i].price
@ -174,6 +203,12 @@
inventorySubmit() { inventorySubmit() {
console.log(this.khName) console.log(this.khName)
console.log(this.carList) console.log(this.carList)
if (this.khName == '' || this.carList == '') {
uni.showToast({
title: "信息填写完成后入库!",
icon: 'none'
})
}
let that = this; let that = this;
let purchase = { let purchase = {
alreadyPay: this.alreadyPay, //已付金额 alreadyPay: this.alreadyPay, //已付金额
@ -232,7 +267,8 @@
this.carList[this.index].saleDetailQueryDTO[this.index1].price = val; this.carList[this.index].saleDetailQueryDTO[this.index1].price = val;
console.log(this.carList) console.log(this.carList)
for (let m = 0; m < this.carList[this.index].saleDetailQueryDTO.length; m++) { for (let m = 0; m < this.carList[this.index].saleDetailQueryDTO.length; m++) {
this.carList[this.index].price += this.carList[this.index].saleDetailQueryDTO[m].productCount *this.carList[this.index].saleDetailQueryDTO[m].price this.carList[this.index].price += this.carList[this.index].saleDetailQueryDTO[m].productCount * this
.carList[this.index].saleDetailQueryDTO[m].price
} }
for (let i = 0; i < this.carList.length; i++) { for (let i = 0; i < this.carList.length; i++) {
this.shouldPay += this.carList[i].price this.shouldPay += this.carList[i].price

89
pages/inventory/changeGoods1.vue

@ -90,14 +90,14 @@
</view> </view>
</li> </li>
</ul> </ul>
<view class="checkList" v-for="item in temporaryList"> <view class="checkList" v-for="item in Array.from(temporaryList)" :key="key">
<view class="checkList-box"> <view class="checkList-box">
{{item.name}} {{item[0]}}
</view> </view>
<uni-number-box v-model="item.productCount" @change="temporaryChange" /> <uni-number-box v-model="item[1].productCount" @change="temporaryChange" />
</view> </view>
</view> </view>
<view class="popup-bottom" v-for="item in temporaryList"> <view class="popup-bottom">
<view class="popup-bottom-left"> <view class="popup-bottom-left">
<text>数量:{{zNum}} 件</text> <text>数量:{{zNum}} 件</text>
<!-- <text>¥{{zPrice}}</text> --> <!-- <text>¥{{zPrice}}</text> -->
@ -171,11 +171,10 @@
temporaryNum: 0, temporaryNum: 0,
goodsDetail: [], goodsDetail: [],
attrNameList: [], attrNameList: [],
temporaryList: [], temporaryList: new Map(),
carList: [], carList: new Map(),
columns: [], columns: [],
keyList: [], keyList: [],
specsList: [],
evalue: [], evalue: [],
attributeList: [], attributeList: [],
purchasePrice: 0, purchasePrice: 0,
@ -219,8 +218,7 @@
this.goodsDetail.attributeList[index].value[index1].isChecked = true; this.goodsDetail.attributeList[index].value[index1].isChecked = true;
var name = '', var name = '',
evalue = [], evalue = [],
obj = {}, obj = {}
specsList = []
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) { for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) { for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) {
if (Ien[m].isChecked == true) { if (Ien[m].isChecked == true) {
@ -238,32 +236,37 @@
jishuqi++ jishuqi++
} }
} }
// this.temporaryList = new Map();
if (this.goodsDetail.attributeList.length == jishuqi) { if (this.goodsDetail.attributeList.length == jishuqi) {
let data = {}
this.attributeList = { this.attributeList = {
attributeList: JSON.stringify(obj), attributeList: JSON.stringify(obj),
productCount: this.temporaryNum, productCount: this.temporaryNum,
name: name, name: name,
price: this.purchasePrice price: this.purchasePrice
} }
if (this.temporaryList.length == 0) { for (let i = 0; i < this.goodsDetail.attributeList.length; i++) {
this.temporaryList.push(this.attributeList); this.goodsDetail.attributeList[i].isChecked = false;
} else { for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
for (var i = 0; i < this.temporaryList.length; i++) { this.goodsDetail.attributeList[i].value[m].isChecked = false
if (this.temporaryList[i].name.indexOf(this.attributeList.name) != -1) {
this.temporaryList[i] = this.attributeList
return
} else {
if (this.temporaryList.length == (i+1)) {
this.temporaryList.push(this.attributeList);
return
}
} }
} }
// if (this.temporaryList.size == 0) {
this.temporaryList.set(name, this.attributeList);
// } else {
// console.log(this.carList)
// console.log(this.goodsDetail.id)
console.log(Array.from(this.temporaryList))
// if (this.carList.get(this.goodsDetail.id).saleDetailQueryDTO.has(this.attributeList.name)) {
} // this.carList.get(this.goodsDetail.id).saleDetailQueryDTO.get(this.attributeList.name).value = this.attributeList
} // } else {
// this.temporaryList.set(name, this.attributeList);
// // this.temporaryList.push(this.attributeList);
// }
// }
}
}, },
temporaryChange(val) { temporaryChange(val) {
this.zNum = 0 this.zNum = 0
@ -276,7 +279,7 @@
backPrevPage() { backPrevPage() {
let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
let prevPage = pages[pages.length - 2]; //上一页页面实例 let prevPage = pages[pages.length - 2]; //上一页页面实例
prevPage.$vm.carList = this.carList prevPage.$vm.carList1 = this.carList
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
}) })
@ -377,12 +380,7 @@
}, },
//弹窗选择规格后,点击弹窗中选好了按钮 //弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() { temporaryCheck() {
// if(this.storageType == 0 && this.purchasePrice == 0){ let that = this;
// uni.showToast({
// title: "请输入采购价!",
// icon: 'none'
// })
// }else{
let data = { let data = {
id: this.goodsDetail.id, id: this.goodsDetail.id,
price: this.zPrice, price: this.zPrice,
@ -393,20 +391,31 @@
supplierName: this.goodsDetail.supplierName, supplierName: this.goodsDetail.supplierName,
saleDetailQueryDTO: this.temporaryList saleDetailQueryDTO: this.temporaryList
} }
this.carList.push(data) if(that.carList.has(that.goodsDetail.id)== true){ //新增的商品在list里面有了
console.log("有了")
console.log(that.carList.get(that.goodsDetail.id).saleDetailQueryDTO)
data.saleDetailQueryDTO.forEach (function(value, key) {
console.log(value)
console.log(key)
if(that.carList.get(that.goodsDetail.id).saleDetailQueryDTO.has(key) ==true){
console.log("有规格")
that.carList.get(that.goodsDetail.id).saleDetailQueryDTO.get(key).productCount += value.productCount
}else{
console.log("没有规格")
that.carList.get(that.goodsDetail.id).saleDetailQueryDTO.set(key,value)
}
})
console.log(that.carList.get(that.goodsDetail.id).saleDetailQueryDTO)
}else{ //商品在list中没有
this.carList.set(this.goodsDetail.id, data)
}
console.log(this.carList) console.log(this.carList)
this.temporaryList = [] this.temporaryList = new Map();
this.purchasePrice = 0 this.purchasePrice = 0
this.zPrice = '' this.zPrice = ''
this.zNum = '' this.zNum = ''
for(let i=0;i<this.goodsDetail.attributeList.length;i++){
this.goodsDetail.attributeList[i].isChecked = false;
for (let m=0;m<this.goodsDetail.attributeList[i].value.length;m++) {
this.goodsDetail.attributeList[i].value[m].isChecked = false
}
}
this.$refs.popup.close() this.$refs.popup.close()
// }
}, },
//删除整条商品 //删除整条商品

Loading…
Cancel
Save