Browse Source

入库

master
tianyi@bogon 3 years ago
parent
commit
55d6e6a10a
  1. 26
      pages/index/addHangOrder.vue
  2. 98
      pages/inventory/addinventory.vue
  3. 225
      pages/inventory/changeGoods1.vue

26
pages/index/addHangOrder.vue

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

98
pages/inventory/addinventory.vue

@ -33,11 +33,12 @@
<view class="shop-productName">
<view style="color:#FF5809;">品名:{{item.productName}}</view>
<view>货号:{{item.productSn}}</view>
<view>总价:{{item.price}} 数量:{{item.num}}</view>
<view>总价:{{item.price}} 数量:{{item.num}}</view>
</view>
</view>
<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 style="color: red;">单价:¥{{items.price}}</text>
<text>数量:{{items.productCount}}</text>
@ -89,11 +90,11 @@
<view class="bottom-right">
<button class="bottom-btn" @tap='inventorySubmit'>入库</button>
</view>
</view>
<!-- 弹出输入框 -->
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="采购价" placeholder="请输入采购价"
@confirm="changePrice"></uni-popup-dialog>
</view>
<!-- 弹出输入框 -->
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog ref="inputClose" mode="input" title="采购价" placeholder="请输入采购价"
@confirm="changePrice"></uni-popup-dialog>
</uni-popup>
</view>
</template>
@ -121,15 +122,43 @@
alreadyPay: 0,
realAmount: 0,
shouldPay: 0,
totalAmount: 0,
index:'',
index1:''
totalAmount: 0,
index: '',
index1: ''
}
},
onShow() {
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(lsList)
for (let i = 0; i < this.carList.length; i++) {
this.totalAmount += this.carList[i].num
this.shouldPay += this.carList[i].price
@ -174,6 +203,12 @@
inventorySubmit() {
console.log(this.khName)
console.log(this.carList)
if (this.khName == '' || this.carList == '') {
uni.showToast({
title: "信息填写完成后入库!",
icon: 'none'
})
}
let that = this;
let purchase = {
alreadyPay: this.alreadyPay, //已付金额
@ -218,25 +253,26 @@
})
}
})
},
//编辑每一个的单价
clickCollapse(index,index1){
this.index = index
this.index1 = index1
this.$refs.inputDialog.open()
},
//计算价格
changePrice(val){
this.shouldPay = 0
this.carList[this.index].price = 0
this.carList[this.index].saleDetailQueryDTO[this.index1].price = val;
console.log(this.carList)
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
}
for (let i = 0; i < this.carList.length; i++) {
this.shouldPay += this.carList[i].price
}
},
//编辑每一个的单价
clickCollapse(index, index1) {
this.index = index
this.index1 = index1
this.$refs.inputDialog.open()
},
//计算价格
changePrice(val) {
this.shouldPay = 0
this.carList[this.index].price = 0
this.carList[this.index].saleDetailQueryDTO[this.index1].price = val;
console.log(this.carList)
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
}
for (let i = 0; i < this.carList.length; i++) {
this.shouldPay += this.carList[i].price
}
}
}
}
@ -364,7 +400,7 @@
.shop-collapse text {
flex: 1;
text-align: center;
text-align: center;
padding-right: 40rpx;
border-right: 1px solid #eee;
}

225
pages/inventory/changeGoods1.vue

@ -90,14 +90,14 @@
</view>
</li>
</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">
{{item.name}}
{{item[0]}}
</view>
<uni-number-box v-model="item.productCount" @change="temporaryChange" />
<uni-number-box v-model="item[1].productCount" @change="temporaryChange" />
</view>
</view>
<view class="popup-bottom" v-for="item in temporaryList">
<view class="popup-bottom">
<view class="popup-bottom-left">
<text>数量:{{zNum}} 件</text>
<!-- <text>¥{{zPrice}}</text> -->
@ -171,23 +171,22 @@
temporaryNum: 0,
goodsDetail: [],
attrNameList: [],
temporaryList: [],
carList: [],
temporaryList: new Map(),
carList: new Map(),
columns: [],
keyList: [],
specsList: [],
evalue: [],
attributeList: [],
purchasePrice: 0,
zPrice:0,
zNum:0,
storageType:0,
carNum:0,
carType:0
purchasePrice: 0,
zPrice: 0,
zNum: 0,
storageType: 0,
carNum: 0,
carType: 0
}
},
onLoad() {
this.getGategoryList()
this.getGategoryList()
this.storageType = uni.getStorageSync('type')
},
methods: {
@ -219,8 +218,7 @@
this.goodsDetail.attributeList[index].value[index1].isChecked = true;
var name = '',
evalue = [],
obj = {},
specsList = []
obj = {}
for (var i = 0; i < this.goodsDetail.attributeList.length; i++) {
for (var m = 0, Ien = this.goodsDetail.attributeList[i].value; m < Ien.length; m++) {
if (Ien[m].isChecked == true) {
@ -238,45 +236,50 @@
jishuqi++
}
}
// this.temporaryList = new Map();
if (this.goodsDetail.attributeList.length == jishuqi) {
let data = {}
this.attributeList = {
attributeList: JSON.stringify(obj),
productCount: this.temporaryNum,
name:name,
price:this.purchasePrice
productCount: this.temporaryNum,
name: name,
price: this.purchasePrice
}
if (this.temporaryList.length == 0) {
this.temporaryList.push(this.attributeList);
} else {
for (var i = 0; i < this.temporaryList.length; i++) {
if (this.temporaryList[i].name.indexOf(this.attributeList.name) != -1) {
this.temporaryList[i] = this.attributeList
return
} else {
if (this.temporaryList.length == (i+1)) {
this.temporaryList.push(this.attributeList);
return
}
}
for (let i = 0; i < this.goodsDetail.attributeList.length; i++) {
this.goodsDetail.attributeList[i].isChecked = false;
for (let m = 0; m < this.goodsDetail.attributeList[i].value.length; m++) {
this.goodsDetail.attributeList[i].value[m].isChecked = false
}
}
}
// if (this.temporaryList.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
for (var i=0;i<this.temporaryList.length;i++) {
this.zNum += this.temporaryList[i].productCount
}
for (var i = 0; i < this.temporaryList.length; i++) {
this.zNum += this.temporaryList[i].productCount
}
this.zPrice = this.zNum * this.purchasePrice
},
//点击底部选好了,返回上一页
backPrevPage() {
let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
let prevPage = pages[pages.length - 2]; //上一页页面实例
prevPage.$vm.carList = this.carList
prevPage.$vm.carList1 = this.carList
uni.navigateBack({
delta: 1
})
@ -306,10 +309,10 @@
this.type = type
// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
if (type == 'carPopup') {
this.$refs.carPopup.open('bottom')
for (let i=0;i<this.carList.length;i++) {
this.carNum += this.carList[i].num
}
this.$refs.carPopup.open('bottom')
for (let i = 0; i < this.carList.length; i++) {
this.carNum += this.carList[i].num
}
this.carType = this.carList.length
} else {
this.checkGoods(item);
@ -377,72 +380,78 @@
},
//弹窗选择规格后,点击弹窗中选好了按钮
temporaryCheck() {
// if(this.storageType == 0 && this.purchasePrice == 0){
// uni.showToast({
// title: "请输入采购价!",
// icon: 'none'
// })
// }else{
let data = {
id: this.goodsDetail.id,
price: this.zPrice,
num: this.zNum,
productName: this.goodsDetail.productName,
productSn: this.goodsDetail.productSn,
productPicture: this.goodsDetail.productPicture,
supplierName: this.goodsDetail.supplierName,
saleDetailQueryDTO:this.temporaryList
}
this.carList.push(data)
console.log(this.carList)
this.temporaryList = []
this.purchasePrice = 0
this.zPrice = ''
this.zNum = ''
for(let i=0;i<this.goodsDetail.attributeList.length;i++){
this.goodsDetail.attributeList[i].isChecked = false;
for (let m=0;m<this.goodsDetail.attributeList[i].value.length;m++) {
this.goodsDetail.attributeList[i].value[m].isChecked = false
let that = this;
let data = {
id: this.goodsDetail.id,
price: this.zPrice,
num: this.zNum,
productName: this.goodsDetail.productName,
productSn: this.goodsDetail.productSn,
productPicture: this.goodsDetail.productPicture,
supplierName: this.goodsDetail.supplierName,
saleDetailQueryDTO: this.temporaryList
}
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)
}
}
this.$refs.popup.close()
// }
})
console.log(that.carList.get(that.goodsDetail.id).saleDetailQueryDTO)
}else{ //商品在list中没有
this.carList.set(this.goodsDetail.id, data)
}
},
//删除整条商品
delShop(id){
var that = this;
for (let i=0;i<this.carList.length;i++) {
if(this.carList[i].id == id){
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList.splice(i,1)
}
})
}
}
},
//删除商品下的某一个规格
delShopSpec(name){
var that = this;
for (let i=0;i<this.carList.length;i++) {
for (let m=0;m<this.carList[i].saleDetailQueryDTO.length;m++) {
if(this.carList[i].saleDetailQueryDTO[m].name == name){
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList[i].saleDetailQueryDTO.splice(m,1)
if(that.carList[i].saleDetailQueryDTO.length == 0){
that.carList.splice(i,1)
}
}
})
}
}
}
console.log(this.carList)
this.temporaryList = new Map();
this.purchasePrice = 0
this.zPrice = ''
this.zNum = ''
this.$refs.popup.close()
},
//删除整条商品
delShop(id) {
var that = this;
for (let i = 0; i < this.carList.length; i++) {
if (this.carList[i].id == id) {
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList.splice(i, 1)
}
})
}
}
},
//删除商品下的某一个规格
delShopSpec(name) {
var that = this;
for (let i = 0; i < this.carList.length; i++) {
for (let m = 0; m < this.carList[i].saleDetailQueryDTO.length; m++) {
if (this.carList[i].saleDetailQueryDTO[m].name == name) {
uni.showModal({
title: "提示",
content: "确定删除此条商品吗?",
success: function(res) {
that.carList[i].saleDetailQueryDTO.splice(m, 1)
if (that.carList[i].saleDetailQueryDTO.length == 0) {
that.carList.splice(i, 1)
}
}
})
}
}
}
}
}
}

Loading…
Cancel
Save