From 3fcffad87cb2d19a1cb2ce5fdc3aad0789b352fb Mon Sep 17 00:00:00 2001
From: wangfukang <15630117759@163.com>
Date: Mon, 13 May 2024 18:19:21 +0800
Subject: [PATCH] 11
---
pages/index/shareStyle.vue | 11 ++-
pages/inventory/AIInventory.vue | 126 ++++++++++++++-----------------
pages/inventory/goodsList1.vue | 128 +++++++++-----------------------
3 files changed, 97 insertions(+), 168 deletions(-)
diff --git a/pages/index/shareStyle.vue b/pages/index/shareStyle.vue
index e739344..7c8abc6 100644
--- a/pages/index/shareStyle.vue
+++ b/pages/index/shareStyle.vue
@@ -22,7 +22,7 @@
{{item.productName}}
{{item.productSn}}
-
+
{{item.purchasePrice?item.purchasePrice:'暂无'}}
采购价
@@ -41,7 +41,7 @@
-
+
@@ -158,7 +158,12 @@
path: '/pages/index/shareStyle?khid=' + this.khid
}
},
- onLoad(options) {
+ onLoad(options) {
+ wx.updateShareMenu({
+ withShareTicket: true,
+ isPrivateMessage:true,
+ success () { }
+ })
this.height = wx.getSystemInfoSync().windowHeight
if (options.khid != undefined) {
uni.redirectTo({
diff --git a/pages/inventory/AIInventory.vue b/pages/inventory/AIInventory.vue
index cd4915e..0191146 100644
--- a/pages/inventory/AIInventory.vue
+++ b/pages/inventory/AIInventory.vue
@@ -90,9 +90,6 @@
@change="GoodsNumChange($event,value,values[0])" />
-
- ↑↑ 改动在这里 ↑↑
-
@@ -504,12 +501,10 @@
}
var data1 = {
productCount: productCount,
- name: this.carList1[i].saleDetailQueryDTO[m].name,
- uuid:'A'+generateUUID(),
- isPoint:false //控制锚点下面文字显示
+ 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.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount == null ? 0 : this.carList1[i].saleDetailQueryDTO[m].productCount
obj.price1 = obj.productCount * this.carList1[i].purchasePrice
}
let id = this.carList1[i].isNew ==true ?this.carList1[i].id : this.carList1[i].productId
@@ -528,24 +523,21 @@
var data1 = {
productCount: this.carList.get(this.carList1[i].id).stockLogList.get(this.carList1[i].saleDetailQueryDTO[m].attributeList).productCount + this.carList1[i].saleDetailQueryDTO[m].productCount,
- name: this.carList1[i].saleDetailQueryDTO[m].name,
- uuid:'A'+generateUUID(),
- isPoint:false //控制锚点下面文字显示
+ name: this.carList1[i].saleDetailQueryDTO[m].name
}
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
} else { //规格不同
var data1 = {
productCount: this.carList1[i].saleDetailQueryDTO[m].productCount,
- name: this.carList1[i].saleDetailQueryDTO[m].name,
- uuid:'A'+generateUUID(),
- isPoint:false //控制锚点下面文字显示
+ name: this.carList1[i].saleDetailQueryDTO[m].name
}
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
m].attributeList, data1)
}
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[
+ m].productCount == null ? 0 : this.carList1[i].saleDetailQueryDTO[
m].productCount
this.carList.get(this.carList1[i].id).price1 = this.carList.get(this.carList1[i].id).productCount * this.carList.get(this.carList1[i].id).purchasePrice
}
@@ -572,14 +564,13 @@
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
var data1 = {
productCount: this.carList1[i].saleDetailQueryDTO[m].productCount,
- name: this.carList1[i].saleDetailQueryDTO[m].name,
- uuid:'A'+generateUUID(),
- isPoint:false
+ name: this.carList1[i].saleDetailQueryDTO[m].name
}
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.name = this.carList1[i].saleDetailQueryDTO[m].name
- obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount
+ obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount ==null ? 0 : this.carList1[i].saleDetailQueryDTO[
+ m].productCount
obj.price1 = obj.productCount * this.carList1[i].purchasePrice
}
@@ -682,70 +673,59 @@
this.$forceUpdate()
this.$refs.getaPopup.open()
},
+ sliceMsg(val) {
+ var name = ''
+ if (typeof(val) == 'string') {
+ let newObj = JSON.parse(val)
+ for (let as in newObj) {
+ name += newObj[as] + '/'
+ }
+ }
+ return name;
+ },
//点击某一个规格,可修改
- changeSpec(item){
+ async changeSpec(item){
let that = this;
if(item == ''){
this.tui.toast('请输入要修改的规格值')
return;
}
let data = this.temporary
- let specMap = new Map() //新的临时存放值那个更改过的值的数组
- let similar = ''
- console.log('锚点',this.carList)
- this.carList.get(data[0]).stockLogList.forEach(function(value, key) {
- value.isPoint = false
+ let specMap = new Map() //新的临时存放值那个更改过的值的map
+ await this.carList.get(data[0]).stockLogList.forEach(function(value, key) {
if(key == data[1]){
let stringKey = key.replace(data[3],item) //拿到了更改过的key
+ if(specMap.has(stringKey)== true){
+ data[1] = stringKey
+
+ specMap.get(stringKey).name = that.sliceMsg(stringKey)
+ specMap.get(stringKey).productCount += value.productCount
+ }else{
+ data[1] = stringKey
+
+ specMap.set(stringKey,value)
+ specMap.get(stringKey).name = that.sliceMsg(stringKey)
+ }
that.tui.request("/app/stock/productCount", "post", {
productId: that.carList.get(data[0]).productId,
attributeList: stringKey
}, false, true).then((res) => {
if (res.code == 200) {
value.productNum = res.result
- if(specMap.has(stringKey) == true){ //当前的数据中有相同的值
- similar = specMap.get(stringKey).uuid
- specMap.get(stringKey).isPoint = true
- specMap.get(stringKey).productCount += value.productCount
- }else{
- value.uuid = 'A'+generateUUID();
- value.isPoint = true
- specMap.set(stringKey,value) //name的值没有改,所有的数组都放在这个下面
- }
that.$forceUpdate()
- that.carList.get(data[0]).stockLogList.delete(data[1])
} else {
that.tui.toast(res.message)
}
}).catch((res) => {})
- that.$nextTick(()=>{
- setTimeout(res => {
- if(similar != ''){
- that.currentAnchor = '#'+similar;
- }else{
- that.currentAnchor = '#'+value.uuid;
- }
- }, 200)
- })
- that.$nextTick(()=>{
- setTimeout(res => {
- that.currentAnchor = ""
- similar = ''
- }, 1000)
- })
+ }else{
+ specMap.set(key,value)
}
})
- 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
- setTimeout(res => {
-
+ await that.$nextTick(()=>{
+ this.carList.get(data[0]).stockLogList = specMap
this.$forceUpdate()
this.$refs.getaPopup.close()
- }, 200)
+ })
},
handleBlur(e){
this.categoryText = e.detail.value
@@ -1407,7 +1387,8 @@
temporaryCheck() {
uni.showLoading({
title: '加载中...'
- })
+ })
+ console.log(this.temporaryList)
let that = this,
carList1 = []
let data = {
@@ -1460,9 +1441,7 @@
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
- name: carList1[i].saleDetailQueryDTO[m].name,
- uuid:'A'+generateUUID(),
- isPoint:false
+ name: carList1[i].saleDetailQueryDTO[m].name
}
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount
@@ -1475,7 +1454,11 @@
} else { //当前页有数据
for (let i = 0; i < carList1.length; i++) {
-
+ console.log('stockLogList',this.carList)
+ console.log('stockLogList',carList1[i].id)
+ if(this.carList.has(carList1[i].id) == true){
+ this.carList.get(carList1[i].id).stockLogList = new Map()
+ }
if (this.carList.has(carList1[i].id) == true) { //商品相同
if(this.carList.get(carList1[i].id)){
@@ -1488,9 +1471,7 @@
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
- name: carList1[i].saleDetailQueryDTO[m].name,
- uuid:'A'+generateUUID(),
- isPoint:false
+ name: carList1[i].saleDetailQueryDTO[m].name
}
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
@@ -1502,9 +1483,7 @@
} else { //规格不同
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
- name: carList1[i].saleDetailQueryDTO[m].name,
- uuid:'A'+generateUUID(),
- isPoint:false
+ name: carList1[i].saleDetailQueryDTO[m].name
}
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[
m].attributeList, data1)
@@ -1535,9 +1514,7 @@
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
- name: carList1[i].saleDetailQueryDTO[m].name,
- uuid:'A'+generateUUID(),
- isPoint:false
+ name: carList1[i].saleDetailQueryDTO[m].name
}
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount
@@ -1674,6 +1651,13 @@
if(value.price == null){
value.price = 0
}
+ if(value.productName == ''){
+ uni.showToast({
+ title: "品名必须维护~",
+ icon: 'none'
+ })
+ return
+ }
if(value.productSn == ''){
uni.showToast({
title: value.productName + "的货号必须维护~",
diff --git a/pages/inventory/goodsList1.vue b/pages/inventory/goodsList1.vue
index 9929889..d2304c0 100644
--- a/pages/inventory/goodsList1.vue
+++ b/pages/inventory/goodsList1.vue
@@ -130,9 +130,6 @@
@change="GoodsNumChange($event,value,values[0])" />
-
- ↑↑ 改动在这里 ↑↑
-
@@ -791,9 +788,7 @@
var data1 = {
productCount: this.carList1[i].saleDetailQueryDTO[m].productCount,
name: this.carList1[i].saleDetailQueryDTO[m].name,
- productNum:this.carList1[i].saleDetailQueryDTO[m].productNum != undefined?this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i].saleDetailQueryDTO[m].stockCount,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:this.carList1[i].saleDetailQueryDTO[m].productNum != undefined?this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i].saleDetailQueryDTO[m].stockCount
}
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
@@ -810,9 +805,7 @@
var data1 = {
productCount: this.carList.get(this.carList1[i].id).stockLogList.get(this.carList1[i].saleDetailQueryDTO[m].attributeList).productCount + this.carList1[i].saleDetailQueryDTO[m].productCount,
name: this.carList1[i].saleDetailQueryDTO[m].name,
- productNum:this.carList1[i].saleDetailQueryDTO[m].productNum != undefined?this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i].saleDetailQueryDTO[m].stockCount,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:this.carList1[i].saleDetailQueryDTO[m].productNum != undefined?this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i].saleDetailQueryDTO[m].stockCount
}
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
@@ -834,9 +827,7 @@
var data1 = {
productCount: this.carList1[i].saleDetailQueryDTO[m].productCount,
name: this.carList1[i].saleDetailQueryDTO[m].name,
- productNum:this.carList1[i].saleDetailQueryDTO[m].productNum != undefined?this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i].saleDetailQueryDTO[m].stockCount,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:this.carList1[i].saleDetailQueryDTO[m].productNum != undefined?this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i].saleDetailQueryDTO[m].stockCount
}
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[
m].attributeList, data1)
@@ -871,9 +862,7 @@
var data1 = {
productCount: this.carList1[i].saleDetailQueryDTO[m].productCount,
name: this.carList1[i].saleDetailQueryDTO[m].name,
- productNum:this.carList1[i].saleDetailQueryDTO[m].productNum != undefined?this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i].saleDetailQueryDTO[m].stockCount,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:this.carList1[i].saleDetailQueryDTO[m].productNum != undefined?this.carList1[i].saleDetailQueryDTO[m].productNum : this.carList1[i].saleDetailQueryDTO[m].stockCount
}
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
@@ -957,9 +946,7 @@
var data1 = {
productCount: this.carList1[i].stockLogList1[m].productCount,
name: this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList),
- productNum:this.carList1[i].stockLogList1[m].stockCount,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:this.carList1[i].stockLogList1[m].stockCount
}
obj.stockLogList.set(this.carList1[i].stockLogList1[m].attributeList, data1)
obj.productCount += this.carList1[i].stockLogList1[m].productCount
@@ -976,9 +963,7 @@
var data1 = {
productCount: this.carList.get(this.carList1[i].productId).stockLogList.get(this.carList1[i].stockLogList1[m].attributeList).productCount + this.carList1[i].stockLogList1[m].productCount,
name: this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList),
- productNum:this.carList1[i].stockLogList1[m].stockCount,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:this.carList1[i].stockLogList1[m].stockCount
}
this.carList.get(this.carList1[i].productId).stockLogList.set(this.carList1[i].stockLogList1[m].attributeList, data1)
@@ -987,9 +972,7 @@
var data1 = {
productCount: this.carList1[i].stockLogList1[m].productCount,
name: this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList),
- productNum:this.carList1[i].stockLogList1[m].stockCount,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:this.carList1[i].stockLogList1[m].stockCount
}
this.carList.get(this.carList1[i].productId).stockLogList.set(this.carList1[i].stockLogList1[
m].attributeList, data1)
@@ -1025,9 +1008,7 @@
var data1 = {
productCount: this.carList1[i].stockLogList1[m].productCount,
name: this.sliceMsg(this.carList1[i].stockLogList1[m].attributeList),
- productNum:this.carList1[i].stockLogList1[m].stockCount,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:this.carList1[i].stockLogList1[m].stockCount
}
obj.stockLogList.set(this.carList1[i].stockLogList1[m].attributeList, data1)
@@ -1147,70 +1128,48 @@
this.$refs.getaPopup.open()
},
//点击某一个规格,可修改
- changeSpec(item){
+ async changeSpec(item){
let that = this;
if(item == ''){
this.tui.toast('请输入要修改的规格值')
return;
}
let data = this.temporary
- let specMap = new Map() //新的临时存放值那个更改过的值的数组
- let similar = ''
- this.carList.get(data[0]).stockLogList.forEach(function(value, key) {
- value.isPoint = false
+ let specMap = new Map() //新的临时存放值那个更改过的值的map
+ await this.carList.get(data[0]).stockLogList.forEach(function(value, key) {
if(key == data[1]){
let stringKey = key.replace(data[3],item) //拿到了更改过的key
+ if(specMap.has(stringKey)== true){
+ data[1] = stringKey
+
+ specMap.get(stringKey).name = that.sliceMsg(stringKey)
+ specMap.get(stringKey).productCount += value.productCount
+ }else{
+ data[1] = stringKey
+
+ specMap.set(stringKey,value)
+ specMap.get(stringKey).name = that.sliceMsg(stringKey)
+ }
that.tui.request("/app/stock/productCount", "post", {
productId: that.carList.get(data[0]).productId,
attributeList: stringKey
}, false, true).then((res) => {
if (res.code == 200) {
value.productNum = res.result
- if(specMap.has(stringKey) == true){ //当前的数据中有相同的值
- similar = specMap.get(stringKey).uuid
- specMap.get(stringKey).isPoint = true
- specMap.get(stringKey).productCount += value.productCount
- }else{
- value.uuid = 'A'+generateUUID();
- value.isPoint = true
- specMap.set(stringKey,value) //name的值没有改,所有的数组都放在这个下面
- }
that.$forceUpdate()
- that.carList.get(data[0]).stockLogList.delete(data[1])
} else {
that.tui.toast(res.message)
}
}).catch((res) => {})
- that.$nextTick(()=>{
- setTimeout(res => {
- if(similar != ''){
- that.currentAnchor = '#'+similar;
- }else{
- that.currentAnchor = '#'+value.uuid;
- }
-
- }, 200)
- })
- that.$nextTick(()=>{
- setTimeout(res => {
- that.currentAnchor = ""
- similar = ''
-
- }, 1000)
- })
+ }else{
+ specMap.set(key,value)
}
})
- 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
- setTimeout(res => {
-
+ await that.$nextTick(()=>{
+ this.carList.get(data[0]).stockLogList = specMap
this.$forceUpdate()
this.$refs.getaPopup.close()
- }, 200)
+ })
},
//销售员列表
@@ -2023,9 +1982,7 @@
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
name: carList1[i].saleDetailQueryDTO[m].name,
- productNum:carList1[i].saleDetailQueryDTO[m].productNum,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:carList1[i].saleDetailQueryDTO[m].productNum
}
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount
@@ -2035,44 +1992,29 @@
carList1 = []
} else { //当前页有数据
- console.log(carList1)
- console.log(this.carList)
for (let i = 0; i < carList1.length; i++) {
+ if(this.carList.has(carList1[i].id) == true){
+ this.carList.get(carList1[i].id).stockLogList = new Map()
+ }
if (this.carList.has(carList1[i].id) == true) { //商品相同
this.carList.get(carList1[i].id).productCount = 0
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i]
.saleDetailQueryDTO[
m].attributeList) == true) { //规格相同
- // var data1 = {
- // productCount: this.carList.get(this.carList1[i].id).stockLogList.get(this.carList1[i].saleDetailQueryDTO[m].attributeList).productCount + this.carList1[i].saleDetailQueryDTO[m].productCount,
- // name: this.carList1[i].saleDetailQueryDTO[m].name
- // }
-
- // this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, data1)
-
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
name: carList1[i].saleDetailQueryDTO[m].name,
- productNum:carList1[i].saleDetailQueryDTO[m].productNum,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:carList1[i].saleDetailQueryDTO[m].productNum
}
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[
m].attributeList, data1)
- // this.carList.get(carList1[i].id).stockLogList.set(carList1[i]
- // .saleDetailQueryDTO[
- // m].attributeList, this.carList.get(carList1[i].id).stockLogList.get(
- // carList1[i].saleDetailQueryDTO[m].attributeList) + carList1[i]
- // .saleDetailQueryDTO[m].productCount)
} else { //规格不同
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
name: carList1[i].saleDetailQueryDTO[m].name,
- productNum:carList1[i].saleDetailQueryDTO[m].productNum,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:carList1[i].saleDetailQueryDTO[m].productNum
}
this.carList.get(carList1[i].id).stockLogList.set(carList1[i].saleDetailQueryDTO[
m].attributeList, data1)
@@ -2107,9 +2049,7 @@
var data1 = {
productCount: carList1[i].saleDetailQueryDTO[m].productCount,
name: carList1[i].saleDetailQueryDTO[m].name,
- productNum:carList1[i].saleDetailQueryDTO[m].productNum,
- uuid:'A'+generateUUID(),
- isPoint:false
+ productNum:carList1[i].saleDetailQueryDTO[m].productNum
}
obj.stockLogList.set(carList1[i].saleDetailQueryDTO[m].attributeList, data1)
obj.productCount += carList1[i].saleDetailQueryDTO[m].productCount