From d8ad4781e50540112ea3d2d08781b1fa3f7893e9 Mon Sep 17 00:00:00 2001
From: wangfukang <15630117759@163.com>
Date: Tue, 22 Oct 2024 19:50:47 +0800
Subject: [PATCH] 11
---
pages/billing/addUser.vue | 8 +-
pages/index/index.vue | 41 +-
pages/inventory/goodsList1.vue | 982 ++++++++++++++++++++++-----------
pages/inventory/inventory.vue | 4 +-
pages/login/login.vue | 2 +-
5 files changed, 681 insertions(+), 356 deletions(-)
diff --git a/pages/billing/addUser.vue b/pages/billing/addUser.vue
index e1bb716..2ae9b78 100644
--- a/pages/billing/addUser.vue
+++ b/pages/billing/addUser.vue
@@ -17,16 +17,16 @@
-
+
-
+
*客户欠款输入正数,如有余额则此处输入负数
-
+
-
+
*供应商的欠款需输入正数,如有余额则此处输入负数
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 908eec5..b7bcac4 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -312,6 +312,7 @@
src: 'http://pic2.sc.chinaz.com/Files/pic/pic9/202002/hpic2119_s.jpg',
inventoryList: [],
settingShow: false,
+ isCancel:false,
showFormula: false,
chartData: {},
showDan:'',
@@ -480,8 +481,10 @@
res.result.saleDetailDTOList[i].returnPrice = res.result.saleDetailDTOList[i].discountAmount
res.result.saleDetailDTOList[i].stockLogList = new Map()
that.returnList.set(res.result.saleDetailDTOList[i].productId,res.result.saleDetailDTOList[i])
- for(let m=0;m {
if (res1.code == 200) {
if (type == 'goPay') {
+ this.isCancel = true
this.goSaleGoods(item,'cancel')
} else {
this.getSaleInfo()
@@ -523,20 +527,20 @@
// 取消订单
getOrderInfoList(item,type) {
let that = this;
- // if(item.status == 0 || item.status == 1){
- // this.tui.request('/app/sale/status', "POST", {
- // status: 4,
- // orderId: item.id
- // }, true, true).then((res1) => {
- // if (res1.code == 200) {
+ if(item.status == 0 || item.status == 1){
+ this.tui.request('/app/sale/status', "POST", {
+ status: 4,
+ orderId: item.id
+ }, true, true).then((res1) => {
+ if (res1.code == 200) {
this.cancelSale(item,type)
- // } else {
- // this.tui.toast(res.message)
- // }
- // }).catch((res1) => {})
- // }else{
- // this.cancelSale(item,type)
- // }
+ } else {
+ this.tui.toast(res.message)
+ }
+ }).catch((res1) => {})
+ }else{
+ this.cancelSale(item,type)
+ }
},
sliceMsg(val) {
var name = ''
@@ -570,9 +574,16 @@
let hasCount = attrMap.get(item.saleDetailDTOList[i].stockLogList1[m].attributeList)
newSaleDetailDTOList[hasCount].productCount = Number(newSaleDetailDTOList[hasCount]
.productCount) + Number(item.saleDetailDTOList[i].stockLogList1[m].productCount)
+ if(this.isCancel == true){
+ newSaleDetailDTOList[hasCount].stockCount = newSaleDetailDTOList[hasCount].stockCount + newSaleDetailDTOList[hasCount].productCount
+ }
} else {
item.saleDetailDTOList[i].stockLogList1[m].name = this.sliceMsg(item.saleDetailDTOList[i]
.stockLogList1[m].attributeList)
+ if(this.isCancel == true){
+ item.saleDetailDTOList[i].stockLogList1[m].stockCount = item.saleDetailDTOList[i].stockLogList1[m].stockCount + item.saleDetailDTOList[i].stockLogList1[m].productCount
+ }
+
newSaleDetailDTOList.push(item.saleDetailDTOList[i].stockLogList1[m])
attrMap.set(item.saleDetailDTOList[i].stockLogList1[m].attributeList, num)
num++
diff --git a/pages/inventory/goodsList1.vue b/pages/inventory/goodsList1.vue
index 6739c9e..c60a556 100644
--- a/pages/inventory/goodsList1.vue
+++ b/pages/inventory/goodsList1.vue
@@ -761,7 +761,7 @@
@@ -1374,7 +1374,8 @@
discountType: '', //折扣类型
discountCurrent: "3",
isVoice: false,
- showTan: false,
+ showTan: false,
+ attrBuilt:'',
currentPopupIndex: 0,
voiceType:'new',
current: 0,
@@ -1986,8 +1987,15 @@
{
name: 'wholesalePrice1',
regex: /,批发价:(.*?)。/
+ },
+ {
+ name: 'productCount1',
+ regex: /,退:(.*?),/
+ },
+ {
+ name: 'productCount1',
+ regex: /,退:(.*?)。/
}
-
];
regexes.forEach(({
@@ -2003,6 +2011,9 @@
if (info.productCount && info.productCount.indexOf(',') != -1) {
info.productCount = info.productCount.split(',')[0]
}
+ if (info.productCount1 && info.productCount1.indexOf(',') != -1) {
+ info.productCount = '-'+info.productCount1.split(',')[0]
+ }
if (info.productName && info.productName.indexOf(',') != -1) {
info.productName = info.productName.split(',')[0]
}
@@ -2967,6 +2978,7 @@
productNum: null
}
obj.stockLogList.set(data.attributeList, data)
+ obj.stockLogList1.push(data)
this.carList.set(obj.id, obj)
this.$forceUpdate()
},
@@ -4226,6 +4238,22 @@
if (convertedStr.indexOf('批发价') != -1) {
convertedStr = convertedStr.replace(/批发价/g, ',批发价:')
}
+
+ if (convertedStr.indexOf(',退') != -1) {
+ convertedStr = convertedStr.replace(/,退/g, '退')
+ }
+ if (convertedStr.indexOf('退,') != -1) {
+ convertedStr = convertedStr.replace(/退,/g, '退')
+ }
+ if (convertedStr.indexOf('退::') != -1) {
+ convertedStr = convertedStr.replace(/退::/g, '退')
+ }
+ if (convertedStr.indexOf('退:') != -1) {
+ convertedStr = convertedStr.replace(/退:/g, '退')
+ }
+ if (convertedStr.indexOf('退') != -1) {
+ convertedStr = convertedStr.replace(/退/g, ',退:')
+ }
convertedStr = this.convertStringCorrectly(convertedStr)
convertedStr = this.spliceMsg(convertedStr)
if (convertedStr.indexOf(',') == 0) {
@@ -4244,7 +4272,7 @@
const regex = /货号.*?(?=货号|$)/g;
convertedStr = convertedStr.match(regex);
for (let i = 0; i < convertedStr.length; i++) {
- if (this.voiceGetOneData == true) {
+ if (this.voiceGetOneData == true) { //模糊搜索
setTimeout(resData => {
this.voiceData = this.extractInfo(convertedStr[i] + '。')
@@ -4281,7 +4309,7 @@
this.getOneData(this.voiceData)
}
}, 100 * i)
- } else {
+ } else { //精准搜索
let voiceData = this.extractInfo(convertedStr[i] + '。')
if (voiceData.productSn) {
voiceData.productSn = voiceData.productSn.replace(/[沟勾钩]/g, 'J');
@@ -4320,10 +4348,10 @@
categoryId: res.result[0].attrId
}, false, true).then((res1) => {
if (res1.code == 200) {
+ console.log('voiceData',voiceData)
let data = {
attributeList: '{"颜色":"均色","尺码":"均码"}',
- productCount: Number(voiceData
- .productCount[0]) || 1,
+ productCount: voiceData.productCount != undefined?Number(voiceData.productCount[0]):1,
stockCount: null
}
if (res1.result.stock.length > 0) {
@@ -4333,8 +4361,7 @@
'{"颜色":"均色","尺码":"均码"}') {
data = {
attributeList: '{"颜色":"均色","尺码":"均码"}',
- productCount: Number(voiceData
- .productCount[0]) || 1,
+ productCount: voiceData.productCount != undefined?Number(voiceData.productCount[0]):1,
stockCount: res1.result.stock[
i]
.stockCount
@@ -4684,6 +4711,23 @@
if (convertedStr.indexOf('数量') != -1) {
convertedStr = convertedStr.replace(/数量/g, ',数量:')
}
+
+ if (convertedStr.indexOf(',退') != -1) {
+ convertedStr = convertedStr.replace(/,退/g, '退')
+ }
+ if (convertedStr.indexOf('退,') != -1) {
+ convertedStr = convertedStr.replace(/退,/g, '退')
+ }
+ if (convertedStr.indexOf('退::') != -1) {
+ convertedStr = convertedStr.replace(/退::/g, '退')
+ }
+ if (convertedStr.indexOf('退:') != -1) {
+ convertedStr = convertedStr.replace(/退:/g, '退')
+ }
+ if (convertedStr.indexOf('退') != -1) {
+ convertedStr = convertedStr.replace(/退/g, ',退:')
+ }
+
if (convertedStr.startsWith("号")) {
convertedStr = "货号" + convertedStr.substr(1);
}
@@ -7211,7 +7255,7 @@
if (this.carList.get(id).stockLogList.get(
'{"颜色":"均色","尺码":"均码"}')) {
if (this.carList.get(id).stockLogList.get(
- '{"颜色":"均色","尺码":"均码"}').productCount == 0 && this.carList.get(
+ '{"颜色":"均色","尺码":"均码"}').productCount == 1 && this.carList.get(
id)
.stockLogList.size> 1&&
purchaseDetails[0].stockLogList1.length > 0) {
@@ -7305,6 +7349,23 @@
if (convertedStr.indexOf('数量') != -1) {
convertedStr = convertedStr.replace(/数量/g, ',数量:')
}
+
+ if (convertedStr.indexOf(',退') != -1) {
+ convertedStr = convertedStr.replace(/,退/g, '退')
+ }
+ if (convertedStr.indexOf('退,') != -1) {
+ convertedStr = convertedStr.replace(/退,/g, '退')
+ }
+ if (convertedStr.indexOf('退::') != -1) {
+ convertedStr = convertedStr.replace(/退::/g, '退')
+ }
+ if (convertedStr.indexOf('退:') != -1) {
+ convertedStr = convertedStr.replace(/退:/g, '退')
+ }
+ if (convertedStr.indexOf('退') != -1) {
+ convertedStr = convertedStr.replace(/退/g, ',退:')
+ }
+
if (convertedStr.startsWith("号")) {
convertedStr = "货号" + convertedStr.substr(1);
}
@@ -8486,9 +8547,11 @@
uni.scanCode({
success: (res) => {
if (res.scanType == "QR_CODE") { //二维码
-
+ if(res.result.split(',').length > 2){
+ that.attrBuilt = decodeURIComponent(res.result.split(',')[2].split('-')[0])+'-'+decodeURIComponent(res.result.split(',')[2].split('-')[1])
+ }
let shopId = base.decode(res.result.split(',')[1])
- if (shopId == uni.getStorageSync('shopId')) {
+ if (shopId == uni.getStorageSync('shopId').substring('10','12')) {
that.productId = base.decode(res.result.split(',')[0])
that.toggle('bottom', base.decode(res.result.split(',')[0]));
} else {
@@ -8527,6 +8590,7 @@
},
fail: (res) => {
+ console.log('扫描失败',res)
uni.showToast({
title: '扫描失败',
icon: 'none'
@@ -9121,7 +9185,7 @@
this.type = type
if (type == 'bottom') {
this.allChangeNum = 0
- this.getById(id);
+ this.getById(id,'',true);
uni.showLoading({
title: '加载中...'
})
@@ -9560,7 +9624,7 @@
this.returnPrice = ''
},
//整体选择时使用批发价、零售价,选择整体折扣的方法
- getAmountAndWho() {
+ getAmountAndWho(isSaoMa) {
let that = this;
let price = 0
this.carList.forEach(function(value, key) {
@@ -9600,8 +9664,14 @@
}
}else{
- value.price = (value.unitPrice * (value.discount / 10)) * Number(value.productCount)
- value.price = value.price.toFixed(2)
+ if((that.shopId == '1848276507420659713' || that.shopId == '1818888277105709056') && isSaoMa){
+ value.price = (value.discountAmount * (value.discount / 10)) * Number(value.productCount)
+ value.price = value.price.toFixed(2)
+ }else{
+ value.price = (value.unitPrice * (value.discount / 10)) * Number(value.productCount)
+ value.price = value.price.toFixed(2)
+ }
+
}
})
@@ -9614,313 +9684,537 @@
// }
},
AiAddSpec(value, current) {
- this.getById(value, current);
+ this.getById(value, current,false);
},
AiAddReturnSpec(value) {
this.getByReturnId(value);
},
//通过商品id查询商品详细信息
- async getById(id, current) {
- let that = this;
- //判断isNew,新商品直接调店铺颜色库
- if (current == 1) {
- that.goodsDetail = id;
- that.goodsDetail.attributeList = []
- if (this.goodsDetail.isNew) {
- this.goodsList = []
- that.goodsDetail.attributeList = this.defaultList
- for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
- for (var m = 0; m < that.goodsDetail.attributeList[i].value.length; m++) {
- that.dataObj.set(that.goodsDetail.attributeList[i].value[m].value, that.goodsDetail
- .attributeList[i].name)
- }
- let specs1 = {
- specs: []
- }
- that.goodsList.push(specs1)
- }
- this.$refs.shopPopup.open('bottom')
- } else {
- that.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId",
- "POST", {
- categoryId: that.goodsDetail.attrId
- }, false, true).then((res1) => {
- if (res1.code == 200) {
- that.goodsList = []
- if (typeof(res1.result.attributeAndValue) == 'string') {
- let newObj = JSON.parse(res1.result.attributeAndValue)
- let newArr = []
- let dataArr = []
- for (let val in newObj) {
- let valueObj = [];
- for (var i = 0; i < newObj[val].length; i++) {
- valueObj.push({
- value: newObj[val][i],
- isChecked: false
- })
- that.dataObj.set(newObj[val][i], val)
- }
- newArr.push({
- name: val,
- value: valueObj
- })
- }
- that.goodsDetail.attributeList = newArr;
- for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
- let specs1 = {
- specs: []
- }
- that.goodsList.push(specs1)
- }
- } else {
- that.tui.toast('失败了')
- }
- that.getKCList(res1.result.stock);
- } else {
- that.tui.toast(res1.message)
- }
- }).catch((res) => {})
- }
- this.pageOldTemList = []
- that.temporaryList = []
- if (that.carList.size > 0) {
- let isArgin = false
- that.carList.forEach(function(value, key) {
- value.stockLogList1 = []
- if (isArgin == false) {
- value.stockLogList.forEach(function(values, keys) {
- if (value.stockLogList1.length == 0) {
- let obj = {
- productCount: Number(values.productCount),
- name: values.name,
- attributeList: keys,
- productNum: values.productNum
- }
- value.stockLogList1.push(obj)
- } else {
- for (var i = 0; i < value.stockLogList1.length; i++) {
- if (value.stockLogList1[i].attributeList != keys) {
- if (value.stockLogList1.length == (i + 1)) {
- let obj = {
- productCount: Number(values.productCount),
- name: values.name,
- attributeList: keys,
- productNum: values.productNum
- }
- value.stockLogList1.push(obj)
- }
- }
- }
- }
-
- })
-
- if (value.productId == id) {
- that.zNum = Number(value.productCount)
- that.temporaryList = value.stockLogList1
- that.pageOldTemList = value.stockLogList1
- that.oldTemList = value.stockLogList1
- isArgin = true
- } else {
- if (value.isNew) {
- if (value.id == id.id) {
- that.zNum = Number(value.productCount)
- that.temporaryList = value.stockLogList1
- that.pageOldTemList = value.stockLogList1
- that.oldTemList = value.stockLogList1
- isArgin = true
- }
- } else {
- if (value.productId == id.productId) {
- that.zNum = Number(value.productCount)
- that.temporaryList = value.stockLogList1
- that.pageOldTemList = value.stockLogList1
- that.oldTemList = value.stockLogList1
- isArgin = true
- }
- }
-
- }
- value.stockLogList1 = []
-
- }
-
- })
- that.zNum = 0
- }
- } else {
- this.pageOldTemList = []
- await this.tui.request("/app/product/getById/" + id+'?customerId'+this.khName.id, "POST", {
- }, false, true).then((res) => {
- if (res.code == 200) {
- if (res.result.delFlag == 0) {
- that.tui.toast("请将商品上架后再操作!")
- return
- }
- that.goodsDetail = res.result;
- that.goodsDetail.unitPrice = that.goodsDetail.wholesalePrice
- that.temporaryList = []
- this.pageOldTemList = []
- if (that.carList.size > 0) {
- that.carList.forEach(function(value, key) {
- value.stockLogList.forEach(function(values, keys) {
- if (value.stockLogList1.length == 0) {
- let obj = {
- productCount: Number(values.productCount),
- name: values.name,
- attributeList: keys,
- productNum: values.productNum
- }
- value.stockLogList1.push(obj)
- } else {
- for (var i = 0; i < value.stockLogList1
- .length; i++) {
- if (value.stockLogList1[i].attributeList !=
- keys) {
- if (value.stockLogList1.length == (i +
- 1)) {
- let obj = {
- productCount: Number(values
- .productCount),
- name: values.name,
- attributeList: keys,
- productNum: values.productNum
- }
- value.stockLogList1.push(obj)
- }
- }
- }
- }
- })
- })
- that.zNum = 0
- that.colorData = []
- if(that.carList.get(id).stockLogList1.length == 1){
- if(that.carList.get(id).stockLogList1[0].attributeList == '{"颜色":"均色","尺码":"均码"}'){
- that.carList.get(id).stockLogList1[0].productCount = 0
- }
- }
- that.$nextTick(() => {
- that.carList.forEach(function(value, key) {
- if (value.productId == id) {
- for(let i = 0;i {
- this.tui.request(
- "/app/productAttribute/selectAttributeAndValueByCategoryId",
- "POST", {
- categoryId: this.goodsDetail.attrId
- }, false, true).then((res1) => {
- if (res1.code == 200) {
- this.goodsList = []
- this.pecsList = res1.result.stock
- if (typeof(res1.result.attributeAndValue) ==
- 'string') {
- let newObj = JSON.parse(res1.result
- .attributeAndValue)
- let newArr = []
- let dataArr = []
- for (let val in newObj) {
- let valueObj = [];
- if(that.colorData.length > 0){
- for (var i = 0; i < newObj[val].length; i++) {
- let isColorChecked = false
- for (var k = 0; k < that.colorData.length; k++) {
- if(that.colorData[k] == newObj[val][i]){
- isColorChecked = true
- }else{
- isColorChecked = false
- }
- }
- valueObj.push({
- value: newObj[val][i],
- isChecked: isColorChecked
- })
- this.dataObj.set(newObj[val][i], val)
- }
- }else{
- for (var i = 0; i < newObj[val].length; i++) {
- valueObj.push({
- value: newObj[val][i],
- isChecked: false
- })
- this.dataObj.set(newObj[val][i], val)
- }
- }
- newArr.push({
- name: val,
- value: valueObj
- })
- }
- that.goodsDetail.attributeList = newArr;
-
- for (var i = 0; i < that.goodsDetail.attributeList
- .length; i++) {
- let oldCheck = false
- let oldValue = []
- for (var m = 0; m < that.goodsDetail
- .attributeList[i].value
- .length; m++) {
- if (that.goodsDetail.attributeList[i]
- .value[m].isChecked ==
- true) {
- oldCheck = true
- oldValue.push(that.goodsDetail
- .attributeList[i].value[
- m].value)
- }
- }
- let specs1 = {
- specs: []
- }
- this.goodsList.push(specs1)
- oldCheck = false
- oldValue = []
- }
-
- if(that.goodsDetail.attributeList.length > 0){
- for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
- for (var j = 0; j < that.goodsDetail.attributeList[i].value.length; j++) {
-
- if(that.goodsDetail.attributeList[i].value[j].isChecked == true){
-
- that.goodsDetail.attributeList[i].isChecked = false
- that.goodsDetail.attributeList[i].value[j].isChecked = false
- this.attrNameChange(i, that.goodsDetail.attributeList[i].value[j].value, j)
- }
-
- }
- }
- }
- } else {
- this.tui.toast('失败了')
- }
- this.getKCList(res1.result.stock)
- } else {
- this.tui.toast(res1.message)
- }
- }).catch((res) => {})
- })
-
- } else {
- this.tui.toast(res.message)
- }
- }).catch((res) => {})
- }
+ async getById(id, current,isSaoMa) {
+ let that = this;
+ that.goodsDetail = id;
+ //判断isNew,新商品直接调店铺颜色库
+ if(that.attrBuilt == '' || !isSaoMa){
+ if (current == 1) {
+ that.goodsDetail.attributeList = []
+ if (this.goodsDetail.isNew) {
+ this.goodsList = []
+ that.goodsDetail.attributeList = this.defaultList
+ for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
+ for (var m = 0; m < that.goodsDetail.attributeList[i].value.length; m++) {
+ that.dataObj.set(that.goodsDetail.attributeList[i].value[m].value, that.goodsDetail
+ .attributeList[i].name)
+ }
+ let specs1 = {
+ specs: []
+ }
+ that.goodsList.push(specs1)
+ }
+ this.$refs.shopPopup.open('bottom')
+ } else {
+ that.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId",
+ "POST", {
+ categoryId: that.goodsDetail.attrId
+ }, false, true).then((res1) => {
+ if (res1.code == 200) {
+ that.goodsList = []
+ if (typeof(res1.result.attributeAndValue) == 'string') {
+ let newObj = JSON.parse(res1.result.attributeAndValue)
+ let newArr = []
+ let dataArr = []
+ for (let val in newObj) {
+ let valueObj = [];
+ for (var i = 0; i < newObj[val].length; i++) {
+ valueObj.push({
+ value: newObj[val][i],
+ isChecked: false
+ })
+ that.dataObj.set(newObj[val][i], val)
+ }
+ newArr.push({
+ name: val,
+ value: valueObj
+ })
+ }
+ that.goodsDetail.attributeList = newArr;
+ for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
+ let specs1 = {
+ specs: []
+ }
+ that.goodsList.push(specs1)
+ }
+ } else {
+ that.tui.toast('失败了')
+ }
+ that.getKCList(res1.result.stock);
+ } else {
+ that.tui.toast(res1.message)
+ }
+ }).catch((res) => {})
+ }
+ this.pageOldTemList = []
+ that.temporaryList = []
+ if (that.carList.size > 0) {
+ let isArgin = false
+ that.carList.forEach(function(value, key) {
+ value.stockLogList1 = []
+ if (isArgin == false) {
+ value.stockLogList.forEach(function(values, keys) {
+ if (value.stockLogList1.length == 0) {
+ let obj = {
+ productCount: Number(values.productCount),
+ name: values.name,
+ attributeList: keys,
+ productNum: values.productNum
+ }
+ value.stockLogList1.push(obj)
+ } else {
+ for (var i = 0; i < value.stockLogList1.length; i++) {
+ if (value.stockLogList1[i].attributeList != keys) {
+ if (value.stockLogList1.length == (i + 1)) {
+ let obj = {
+ productCount: Number(values.productCount),
+ name: values.name,
+ attributeList: keys,
+ productNum: values.productNum
+ }
+ value.stockLogList1.push(obj)
+ }
+ }
+ }
+ }
+
+ })
+ if(value.stockLogList1.length == 1){
+ if(value.stockLogList1[0].attributeList == '{"颜色":"均色","尺码":"均码"}'){
+ value.stockLogList1[0].productCount = 0
+ }
+ }
+ if (value.productId == id) {
+ that.zNum = Number(value.productCount)
+ that.temporaryList = value.stockLogList1
+ that.pageOldTemList = value.stockLogList1
+ that.oldTemList = value.stockLogList1
+ isArgin = true
+ } else {
+ if (value.isNew) {
+ if (value.id == id.id) {
+ that.zNum = Number(value.productCount)
+ that.temporaryList = value.stockLogList1
+ that.pageOldTemList = value.stockLogList1
+ that.oldTemList = value.stockLogList1
+ isArgin = true
+ }
+ } else {
+ if (value.productId == id.productId) {
+ that.zNum = Number(value.productCount)
+ that.temporaryList = value.stockLogList1
+ that.pageOldTemList = value.stockLogList1
+ that.oldTemList = value.stockLogList1
+ isArgin = true
+ }
+ }
+
+ }
+ value.stockLogList1 = []
+
+ }
+
+ })
+ that.zNum = 0
+ }
+ } else {
+ this.pageOldTemList = []
+ await this.tui.request("/app/product/getById/" + id+'?customerId='+this.khName.id, "POST", {
+ }, false, true).then((res) => {
+ if (res.code == 200) {
+ if (res.result.delFlag == 0) {
+ that.tui.toast("请将商品上架后再操作!")
+ return
+ }
+ that.goodsDetail = res.result;
+ that.goodsDetail.unitPrice = that.goodsDetail.wholesalePrice
+ that.temporaryList = []
+ this.pageOldTemList = []
+ if (that.carList.size > 0) {
+ that.carList.forEach(function(value, key) {
+ value.stockLogList.forEach(function(values, keys) {
+ if (value.stockLogList1.length == 0) {
+ let obj = {
+ productCount: Number(values.productCount),
+ name: values.name,
+ attributeList: keys,
+ productNum: values.productNum
+ }
+ value.stockLogList1.push(obj)
+ } else {
+ for (var i = 0; i < value.stockLogList1
+ .length; i++) {
+ if (value.stockLogList1[i].attributeList !=
+ keys) {
+ if (value.stockLogList1.length == (i +
+ 1)) {
+ let obj = {
+ productCount: Number(values
+ .productCount),
+ name: values.name,
+ attributeList: keys,
+ productNum: values.productNum
+ }
+ value.stockLogList1.push(obj)
+ }
+ }
+ }
+ }
+ })
+ })
+ that.zNum = 0
+ that.colorData = []
+ if(that.carList.get(id)){
+ if(that.carList.get(id).stockLogList1.length == 1){
+ if(that.carList.get(id).stockLogList1[0].attributeList == '{"颜色":"均色","尺码":"均码"}' && that.carList.get(id).stockLogList1[0].productCount == 1){
+ that.carList.get(id).stockLogList1[0].productCount = 0
+ }
+ }
+ }
+
+ that.$nextTick(() => {
+ that.carList.forEach(function(value, key) {
+ if (value.productId == id) {
+ for(let i = 0;i {
+ this.tui.request(
+ "/app/productAttribute/selectAttributeAndValueByCategoryId",
+ "POST", {
+ categoryId: this.goodsDetail.attrId
+ }, false, true).then((res1) => {
+ if (res1.code == 200) {
+ this.goodsList = []
+ this.pecsList = res1.result.stock
+ if (typeof(res1.result.attributeAndValue) ==
+ 'string') {
+ let newObj = JSON.parse(res1.result
+ .attributeAndValue)
+ let newArr = []
+ let dataArr = []
+ for (let val in newObj) {
+ let valueObj = [];
+ if(that.colorData.length > 0){
+ for (var i = 0; i < newObj[val].length; i++) {
+ let isColorChecked = false
+ for (var k = 0; k < that.colorData.length; k++) {
+ if(that.colorData[k] == newObj[val][i]){
+ isColorChecked = true
+ }else{
+ isColorChecked = false
+ }
+ }
+ valueObj.push({
+ value: newObj[val][i],
+ isChecked: isColorChecked
+ })
+ this.dataObj.set(newObj[val][i], val)
+ }
+ }else{
+ for (var i = 0; i < newObj[val].length; i++) {
+ valueObj.push({
+ value: newObj[val][i],
+ isChecked: false
+ })
+ this.dataObj.set(newObj[val][i], val)
+ }
+ }
+ newArr.push({
+ name: val,
+ value: valueObj
+ })
+ }
+ that.goodsDetail.attributeList = newArr;
+
+ for (var i = 0; i < that.goodsDetail.attributeList
+ .length; i++) {
+ let oldCheck = false
+ let oldValue = []
+ for (var m = 0; m < that.goodsDetail
+ .attributeList[i].value
+ .length; m++) {
+ if (that.goodsDetail.attributeList[i]
+ .value[m].isChecked ==
+ true) {
+ oldCheck = true
+ oldValue.push(that.goodsDetail
+ .attributeList[i].value[
+ m].value)
+ }
+ }
+ let specs1 = {
+ specs: []
+ }
+ this.goodsList.push(specs1)
+ oldCheck = false
+ oldValue = []
+ }
+
+ if(that.goodsDetail.attributeList.length > 0){
+ for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
+ for (var j = 0; j < that.goodsDetail.attributeList[i].value.length; j++) {
+
+ if(that.goodsDetail.attributeList[i].value[j].isChecked == true){
+
+ that.goodsDetail.attributeList[i].isChecked = false
+ that.goodsDetail.attributeList[i].value[j].isChecked = false
+ this.attrNameChange(i, that.goodsDetail.attributeList[i].value[j].value, j)
+ }
+
+ }
+ }
+ }
+ } else {
+ this.tui.toast('失败了')
+ }
+ this.getKCList(res1.result.stock)
+ } else {
+ this.tui.toast(res1.message)
+ }
+ }).catch((res) => {})
+ })
+
+ } else {
+ this.tui.toast(res.message)
+ }
+ }).catch((res) => {})
+ }
+ }else{
+ let attr = '{"颜色":"'+that.attrBuilt.split('-')[0]+'","尺码":"'+that.attrBuilt.split('-')[1]+'"}'
+ this.pageOldTemList = []
+ await this.tui.request("/app/product/getById/" + id+'?customerId='+this.khName.id, "POST", {
+ }, false, true).then((res) => {
+ if (res.code == 200) {
+ if (res.result.delFlag == 0) {
+ that.tui.toast("请将商品上架后再操作!")
+ return
+ }
+ that.goodsDetail = res.result;
+ that.goodsDetail.unitPrice = that.goodsDetail.wholesalePrice
+ that.temporaryList = []
+ this.pageOldTemList = []
+ if (that.carList.size > 0) {
+ that.carList.forEach(function(value, key) {
+ value.stockLogList.forEach(function(values, keys) {
+ if (value.stockLogList1.length == 0) {
+ let obj = {
+ productCount: Number(values.productCount),
+ name: values.name,
+ attributeList: keys,
+ productNum: values.productNum
+ }
+ value.stockLogList1.push(obj)
+ } else {
+ for (var i = 0; i < value.stockLogList1
+ .length; i++) {
+ if (value.stockLogList1[i].attributeList !=
+ keys) {
+ if (value.stockLogList1.length == (i +
+ 1)) {
+ let obj = {
+ productCount: Number(values
+ .productCount),
+ name: values.name,
+ attributeList: keys,
+ productNum: values.productNum
+ }
+ value.stockLogList1.push(obj)
+ }
+ }
+ }
+ }
+ })
+ })
+ that.zNum = 0
+ that.colorData = []
+ if(that.carList.get(id)){
+ if(that.carList.get(id).stockLogList1.length == 1){
+ if(that.carList.get(id).stockLogList1[0].attributeList == '{"颜色":"均色","尺码":"均码"}'){
+ that.carList.get(id).stockLogList1[0].productCount = 0
+ }
+ }
+ }
+
+ that.$nextTick(() => {
+ that.carList.forEach(function(value, key) {
+ if (value.productId == id) {
+ for(let i = 0;i {
+ this.tui.request(
+ "/app/productAttribute/selectAttributeAndValueByCategoryId",
+ "POST", {
+ categoryId: this.goodsDetail.attrId
+ }, false, true).then((res1) => {
+ if (res1.code == 200) {
+ this.goodsList = []
+ this.pecsList = res1.result.stock
+ if (typeof(res1.result.attributeAndValue) ==
+ 'string') {
+ let newObj = JSON.parse(res1.result
+ .attributeAndValue)
+ let newArr = []
+ let dataArr = []
+ for (let val in newObj) {
+ let valueObj = [];
+ if(that.colorData.length > 0){
+ for (var i = 0; i < newObj[val].length; i++) {
+ let isColorChecked = false
+ for (var k = 0; k < that.colorData.length; k++) {
+ if(that.colorData[k] == newObj[val][i]){
+ isColorChecked = true
+ }else{
+ isColorChecked = false
+ }
+ }
+ valueObj.push({
+ value: newObj[val][i],
+ isChecked: isColorChecked
+ })
+ this.dataObj.set(newObj[val][i], val)
+ }
+ }else{
+ for (var i = 0; i < newObj[val].length; i++) {
+ valueObj.push({
+ value: newObj[val][i],
+ isChecked: false
+ })
+ this.dataObj.set(newObj[val][i], val)
+ }
+ }
+ newArr.push({
+ name: val,
+ value: valueObj
+ })
+ }
+ that.goodsDetail.attributeList = newArr;
+
+ for (var i = 0; i < that.goodsDetail.attributeList
+ .length; i++) {
+ let oldCheck = false
+ let oldValue = []
+ for (var m = 0; m < that.goodsDetail
+ .attributeList[i].value
+ .length; m++) {
+ if (that.goodsDetail.attributeList[i]
+ .value[m].isChecked ==
+ true) {
+ oldCheck = true
+ oldValue.push(that.goodsDetail
+ .attributeList[i].value[
+ m].value)
+ }
+ }
+ let specs1 = {
+ specs: []
+ }
+ this.goodsList.push(specs1)
+ oldCheck = false
+ oldValue = []
+ }
+
+ if(that.goodsDetail.attributeList.length > 0){
+ for (var i = 0; i < that.goodsDetail.attributeList.length; i++) {
+ for (var j = 0; j < that.goodsDetail.attributeList[i].value.length; j++) {
+
+ if(that.goodsDetail.attributeList[i].value[j].isChecked == true){
+
+ that.goodsDetail.attributeList[i].isChecked = false
+ that.goodsDetail.attributeList[i].value[j].isChecked = false
+ this.attrNameChange(i, that.goodsDetail.attributeList[i].value[j].value, j)
+ }
+
+ }
+ }
+ }
+ } else {
+ this.tui.toast('失败了')
+ }
+ //this.getKCList(res1.result.stock)
+ that.$nextTick(() => {
+ let productcount1 = 1
+ let stockcount = null
+ if(this.pecsList.length == 1){
+ attr = this.pecsList[0].attributeList
+ stockcount = this.pecsList[0].stockCount
+ }else{
+ for(let a = 0; a < this.pecsList.length; a++){
+ if(this.pecsList[a].attributeList == attr){
+ stockcount = this.pecsList[a].stockCount
+ }
+ }
+ }
+ if(that.carList.size > 0 && that.carList.has(id)){
+ if(that.carList.get(id).stockLogList.has(attr)){
+ let oldProductCount = that.carList.get(id).stockLogList.get(attr).productCount
+ if(oldProductCount != undefined){
+ productcount1 += Number(oldProductCount)
+ }
+ }
+ }
+
+ if(stockcount == null){
+ this.getKCList(res1.result.stock)
+ }else{
+ that.attributeList = {
+ attributeList: attr,
+ productCount: productcount1,
+ productNum: stockcount,
+ name: that.attrBuilt.split('-')[0] + ' | ' +that.attrBuilt.split('-')[1],
+ price: this.purchasePrice
+ }
+ that.temporaryList = []
+ that.temporaryList.push(that.attributeList);
+ that.temporaryCheck(true)
+ }
+ }).catch((res) => {})
+
+ } else {
+ this.tui.toast(res1.message)
+ }
+ }).catch((res) => {})
+ })
+
+ } else {
+ this.tui.toast(res.message)
+ }
+ }).catch((res) => {})
+ }
+
},
//通过商品id查询商品详细信息
async getByReturnId(id) {
@@ -10587,7 +10881,7 @@
})
},
//弹窗选择规格后,点击弹窗中选好了按钮
- temporaryCheck() {
+ temporaryCheck(isSaoMa) {
uni.showLoading({
title: '加载中...'
})
@@ -10643,7 +10937,7 @@
customerCategoryList:carList1[i].customerCategoryList,
unitPrice: carList1[i].unitPrice || 0, //单价
categoryId: carList1[i].categoryId,
- discountAmount: carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[i]
+ discountAmount: ((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa) ? carList1[i].lsprice : carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[i]
.wholesalePrice || 0), //折后价
returnPrice: carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[i]
.wholesalePrice || 0),
@@ -10652,7 +10946,7 @@
wholesalePrice: carList1[i].wholesalePrice, //批发价
lsprice: carList1[i].lsprice, //零售价
productCount: 0, //总数量
- productId: carList1[i].id,
+ productId: carList1[i].id,
productName: carList1[i].productName,
productPicture: carList1[i].productPicture,
productSn: carList1[i].productSn,
@@ -10682,7 +10976,11 @@
}
}else{
- obj.discountAmount = obj.unitPrice
+ if((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa){
+
+ }else{
+ obj.discountAmount = obj.unitPrice
+ }
}
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
@@ -10704,12 +11002,15 @@
} else { //当前页有数据
for (let i = 0; i < carList1.length; i++) {
- if (this.carList.has(carList1[i].id) == true) {
+ if (this.carList.has(carList1[i].id) == true && !isSaoMa) {
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
- this.carList.get(carList1[i].id).returnCount = 0
+ if(!isSaoMa){
+ this.carList.get(carList1[i].id).productCount = 0
+ this.carList.get(carList1[i].id).returnCount = 0
+ }
+
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
if (this.carList.get(carList1[i].id).stockLogList.has(carList1[i]
.saleDetailQueryDTO[
@@ -10734,15 +11035,24 @@
m].attributeList, data1)
}
if (carList1[i].saleDetailQueryDTO[m].productCount > 0) {
- this.carList.get(carList1[i].id).productCount += Number(carList1[i]
- .saleDetailQueryDTO[m].productCount)
+ if(isSaoMa){
+ this.carList.get(carList1[i].id).productCount ++
+ }else{
+ this.carList.get(carList1[i].id).productCount += Number(carList1[i].saleDetailQueryDTO[m].productCount)
+ }
+
} else {
this.carList.get(carList1[i].id).returnCount += Math.abs(carList1[i]
.saleDetailQueryDTO[m].productCount)
}
- that.carList.get(carList1[i].id).price = Number(that.carList.get(carList1[i].id)
- .productCount) *
- that.carList.get(carList1[i].id).unitPrice
+ if((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa){
+
+ }else{
+ that.carList.get(carList1[i].id).price = Number(that.carList.get(carList1[i].id)
+ .productCount) *
+ that.carList.get(carList1[i].id).unitPrice
+ }
+
}
} else { //商品不同
let obj = {
@@ -10752,8 +11062,8 @@
discount: 10,
buyCount:carList1[i].buyCount,
customerCategoryList:carList1[i].customerCategoryList,
- discountAmount: carList1[i].isNew ? (carList1[i].unitPrice || 0) : (
- carList1[i].wholesalePrice || 0),
+ discountAmount: ((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa) ? carList1[i].lsprice : carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[i]
+ .wholesalePrice || 0), //折后价
returnPrice: carList1[i].isNew ? (carList1[i].unitPrice || 0) : (carList1[
i].wholesalePrice || 0),
returnCount: 0,
@@ -10793,7 +11103,11 @@
}
}else{
- obj.discountAmount = obj.unitPrice
+ if((this.shopId == '1848276507420659713' || this.shopId == '1818888277105709056') && isSaoMa){
+
+ }else{
+ obj.discountAmount = obj.unitPrice
+ }
}
for (let m = 0; m < carList1[i].saleDetailQueryDTO.length; m++) {
var data1 = {
@@ -10856,7 +11170,7 @@
})
// this.getAllPrice()
- this.getAmountAndWho();
+ this.getAmountAndWho(isSaoMa);
this.noPay = this.shouldPay
this.$refs.shopPopup.close()
setTimeout(res => {
diff --git a/pages/inventory/inventory.vue b/pages/inventory/inventory.vue
index cbd9fb4..ff1bcf8 100644
--- a/pages/inventory/inventory.vue
+++ b/pages/inventory/inventory.vue
@@ -58,10 +58,10 @@
- 商品数:{{indexList[categoryIndex].count != undefined ? indexList[categoryIndex].count : 0}}
+ 款数:{{indexList[categoryIndex].count != undefined ? indexList[categoryIndex].count : 0}}
- 库存数:{{indexList[categoryIndex].stockCount != undefined ? indexList[categoryIndex].stockCount + indexList[categoryIndex].minusStockCount: 0}}
+ 库存数:{{indexList[categoryIndex].stockCount != undefined ? indexList[categoryIndex].stockCount + indexList[categoryIndex].minusStockCount: 0}}
diff --git a/pages/login/login.vue b/pages/login/login.vue
index 56b6ae1..a0f4f05 100644
--- a/pages/login/login.vue
+++ b/pages/login/login.vue
@@ -239,7 +239,7 @@
uni.setStorageSync('username',res.result.logiticsCompany.username)
uni.setStorageSync('mobile',res.result.logiticsCompany.mobile)
uni.setStorageSync("hiver_token", res.result.lcomToken)
- uni.setStorageSync("transCompany", res.result.logiticsCompany.id)
+ uni.setStorageSync("transCompany", res.result.logiticsCompany.companyId)
uni.setStorageSync("isOnLine", res.result.logiticsCompany.isOnLine)
uni.setStorageSync("companyMobile", res.result.logiticsCompany.mobile)
uni.setStorageSync("companyName", res.result.logiticsCompany.companyName)