From 7c89f1dbfda1a52fd5514a7753cbc0eb65810c00 Mon Sep 17 00:00:00 2001 From: "tianyi@bogon" Date: Mon, 6 Nov 2023 17:21:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/billing/changeGoods1.vue | 179 +++++++++-------- pages/inventory/addinventory.vue | 23 +-- pages/inventory/changeGoods1.vue | 2 +- pages/inventory/goodsList1.vue | 316 ++++++++++++++++++++++++------- 4 files changed, 348 insertions(+), 172 deletions(-) diff --git a/pages/billing/changeGoods1.vue b/pages/billing/changeGoods1.vue index daaf96e..1cc77f9 100644 --- a/pages/billing/changeGoods1.vue +++ b/pages/billing/changeGoods1.vue @@ -66,16 +66,16 @@ {{goodsDetail.productName}} {{goodsDetail.productSn}} - + - +
  • @@ -115,11 +115,11 @@ 选择商品价格 - - 零售价:¥29.99 + + 零售价:¥{{goodsDetail.price}} - - 批发价:¥25.99 + + 批发价:¥{{goodsDetail.wholesalePrice}} @@ -159,10 +159,10 @@ - 2 款 9 件 + {{carType}} 款 {{carNum}} 件 - 选好了 + 关闭 @@ -196,7 +196,9 @@ purchasePrice: 0, zPrice:0, zNum:0, - storageType:0 + storageType:0, + carNum:0, + carType:0 } }, onLoad() { @@ -225,56 +227,63 @@ }).catch((res) => {}) }, attrNameChange(index, index1) { - this.goodsDetail.attributeList[index].value.forEach(item => { - item.isChecked = false; - }) - this.goodsDetail.attributeList[index].isChecked = true; - this.goodsDetail.attributeList[index].value[index1].isChecked = true; - var name = '', - evalue = [], - obj = {}, - specsList = [] - 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) { - evalue.push(Ien[m].value) - name += Ien[m].value - } - } - } - this.keyList.map((item, index) => { - obj[item] = evalue[index] - }) - let jishuqi = 0; - for (var i = 0; i < this.goodsDetail.attributeList.length; i++) { - if (this.goodsDetail.attributeList[i].isChecked == true) { - jishuqi++ - } - } - if (this.goodsDetail.attributeList.length == jishuqi) { - let data = {} - this.attributeList = { - attributeList: JSON.stringify(obj), + this.goodsDetail.attributeList[index].value.forEach(item => { + item.isChecked = false; + }) + this.goodsDetail.attributeList[index].isChecked = true; + this.goodsDetail.attributeList[index].value[index1].isChecked = true; + var name = '', + evalue = [], + 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) { + evalue.push(Ien[m].value) + name += Ien[m].value + '/' + } + } + } + this.keyList.map((item, index) => { + obj[item] = evalue[index] + }) + let jishuqi = 0; + for (var i = 0; i < this.goodsDetail.attributeList.length; i++) { + if (this.goodsDetail.attributeList[i].isChecked == true) { + jishuqi++ + } + } + if (this.goodsDetail.attributeList.length == jishuqi) { + let data = {} + this.attributeList = { + attributeList: JSON.stringify(obj), 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)) { + price:this.purchasePrice + } + + for(let i=0;i - + @@ -122,7 +121,6 @@ }, khName: [], carList: new Map(), - lsList: new Map(), remark: '', otherPay: 0, noPay: 0, @@ -140,7 +138,6 @@ if (typeof(val) == 'string') { let newObj = JSON.parse(val) for (let as in newObj) { - console.log(newObj[as]) name += newObj[as] + '/' } } @@ -152,7 +149,6 @@ this.khName = JSON.parse(JSON.stringify(this.khName)) || '' //this.carList1 //上个页回来的 //this.carList //这个页的最终数组 - //this.lsList //这个页的规格数组 console.log(this.carList1) if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < this.carList1.length; i++) { @@ -174,7 +170,6 @@ console.log("没有数据") this.carList.set(this.carList1[i].id, obj) console.log(this.carList) - // this.lsList.set(this.carList1[i].id, obj) } this.carList1 = [] } else { //当前页有数据 @@ -220,7 +215,6 @@ } console.log('carList1', this.carList1) console.log('carList', this.carList) - console.log('lsList', this.lsList) this.carList.forEach(function(value, key) { that.totalAmount += value.productCount }) @@ -342,19 +336,8 @@ that.carList.get(that.index).price = val * that.carList.get(that.index).productCount; that.carList.forEach(function(value, key) { that.shouldPay += value.price - }) - // this.carList.get(this.index) - // 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 - // } + }) + } } } diff --git a/pages/inventory/changeGoods1.vue b/pages/inventory/changeGoods1.vue index d6b54b3..6b178a8 100644 --- a/pages/inventory/changeGoods1.vue +++ b/pages/inventory/changeGoods1.vue @@ -147,7 +147,7 @@ {{carType}} 款 {{carNum}} 件 - 选好了 + 选好了 diff --git a/pages/inventory/goodsList1.vue b/pages/inventory/goodsList1.vue index 5196b22..b3cf485 100644 --- a/pages/inventory/goodsList1.vue +++ b/pages/inventory/goodsList1.vue @@ -33,55 +33,61 @@ - 折扣类型 - - + 折扣类型 + + - + + + + + - - - + + - 品名:{{item.productName}} - 货号:{{item.barcode}} - 供应商:{{item.supplierName}} + 品名:{{value[1].productName}} ({{value[1].productSn}}) + 单价:{{value[1].purchasePrice}} 数量:{{value[1].productCount}} 总价:{{value[1].price}} + 供应商:{{value[1].supplierName}} + + + 选择售价 - - - {{item.saleDetailQueryDTO.attributeList}} - ¥{{item.price * item.num}} - {{item.num}} - + + + + 单价 + + + + 折扣(100%) + + + + 折后价 + + + + 数量 + + - - - 单价 - - - - 折扣(100%) - - - - 折后价 - - - - 数量 - - + + {{values[0] | sliceMsg}} + + 数量:{{values[1]}} @@ -190,13 +196,27 @@ - 合计:2 - ¥20.00 + 合计:{{totalAmount}} + ¥{{shouldPay}} - + + + + + + 选择商品价格 + + + 零售价:¥{{lsprice}} + + + 批发价:¥{{wholesalePrice}} + + + @@ -204,20 +224,22 @@ export default { components: {}, data() { - return { + return { + lsprice:0,//临时零售价 + wholesalePrice:0, // 临时显示批发价 price: '0', //总金额 relPrice: '0', //已付金额 otherExpense: '0', // 其他费用 - priceNo: '0', //未付金额 + priceNo: '0', //未付金额 + discountNum:10, value: '', - isCollapse: false, items: [{ value: '0', - name: '单品折扣' + name: '单品折' }, { value: '1', - name: '整体折扣' + name: '整体折' } ], logisticsType: [{ @@ -240,7 +262,10 @@ value: '4', name: '自送' }, - ], + ], + discountType:'', + discountCurrent:'', + current:'', discCurrent: '', //折扣 logisticsCurrent: '', //物流 categoryList: '', //销售员 @@ -250,22 +275,110 @@ wlName: [], //物流公司/物流/发车 kdyName: [], //快递员 lbgName: [], //拉包工姓名 - carList: [], //添加商品页传回来的商品信息 - xsyId: '' + carList: new Map(), //添加商品页传回来的商品信息 + xsyId: '', + shouldPay:0, + totalAmount: 0 } }, - onShow() { + onShow() { + let that = this; this.khName = JSON.parse(JSON.stringify(this.khName)) || '' this.gysName = JSON.parse(JSON.stringify(this.gysName)) || '' this.wlName = JSON.parse(JSON.stringify(this.wlName)) || '' this.kdyName = JSON.parse(JSON.stringify(this.kdyName)) || '' this.lbgName = JSON.parse(JSON.stringify(this.lbgName)) || '' - this.carList = this.carList || '' - console.log(this.carList) - - // for (var i= 0;i<) { - - // } + if (this.carList.size == 0) { //当前页没有数据 + for (let i = 0; i < this.carList1.length; i++) { + let obj = { + purchasePrice: this.carList1[i].price, //最后的价格 + price: 0, //总价 + discount:10, //折扣 + discountAmount:0, //折后价 + wholesalePrice:this.carList1[i].wholesalePrice, //批发价 + lsprice:this.carList1[i].lsprice, //零售价 + productCount: 0, //总数量 + productId: this.carList1[i].id, + productName: this.carList1[i].productName, + productPicture: this.carList1[i].productPicture, + productSn: this.carList1[i].productSn, + stockLogList: new Map(), + stockLogList1: [], + supplierName:this.carList1[i].supplierName //供应商 + } + for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { + obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i] + .saleDetailQueryDTO[m].productCount) + obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount + } + console.log("没有数据") + this.carList.set(this.carList1[i].id, obj) + console.log(this.carList) + // this.lsList.set(this.carList1[i].id, obj) + } + this.carList1 = [] + } else { //当前页有数据 + for (let i = 0; i < this.carList1.length; i++) { + 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[m].attributeList) == true) { //规格相同 + console.log("规格相同") + this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList.get(this.carList1[i].id).stockLogList.get(this.carList1[i].saleDetailQueryDTO[m].attributeList) + this.carList1[i].saleDetailQueryDTO[m].productCount) + this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[m].productCount + } else { //规格不同 + console.log("规格不同") + this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ + m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount) + this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[m].productCount + } + } + } else { //商品不同 + let obj = { + purchasePrice: this.carList1[i].price, //最后的价格 + price: 0, + discount:10, + discountAmount:0, + wholesalePrice:this.carList1[i].wholesalePrice, //批发价 + lsprice:this.carList1[i].lsprice, //零售价 + productCount: 0, + productId: this.carList1[i].id, + productName: this.carList1[i].productName, + productPicture: this.carList1[i].productPicture, + stockLogList: new Map(), + stockLogList1: [], + productSn: this.carList1[i].productSn, + supplierName:this.carList1[i].supplierName + } + for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { + obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i] + .saleDetailQueryDTO[m].productCount) + obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount + } + this.carList.set(this.carList1[i].id, obj) + } + + } + this.carList1 = [] + + } + console.log('carList1', this.carList1) + console.log('carList', this.carList) + this.carList.forEach(function(value, key) { + that.totalAmount += value.productCount + }) + this.noPay = this.shouldPay + }, + filters: { + sliceMsg(val) { + var name = '' + if (typeof(val) == 'string') { + let newObj = JSON.parse(val) + for (let as in newObj) { + name += newObj[as] + '/' + } + } + return name; + } }, onLoad() { this.xsyList(); @@ -293,11 +406,19 @@ this.createByName = this.categoryList[i].text } } - }, - //点击切换折叠状态 - clickCollapse() { - this.isCollapse = !this.isCollapse - }, + }, + //折扣种类选择 + discountChange(e){ + //快递0 物流1 发车2 拼包3 自送4 + this.discountType = e.detail.value; + for (let i = 0; i < this.items.length; i++) { + if (this.items[i].value === e.detail.value) { + this.discountCurrent = i; + break; + } + } + }, + //点击发货方式按钮 radioChange(e) { this.khName = '' this.gysName = '' @@ -312,7 +433,8 @@ break; } } - }, + }, + //发货方式选择 goPopleList(popleType) { if (popleType == 'kdyName' && this.wlName == '') { uni.showToast({ @@ -326,12 +448,14 @@ uni.navigateTo({ url: '/pages/index/peopleList?popleType=' + popleType + '&companyType=' + companyType }) - }, + }, + //点击加号手动添加商品 goodsAdd() { uni.navigateTo({ url: '/pages/billing/changeGoods1' }) - }, + }, + //点击底部开单按钮 goSell() { // console.log(this.khName) // console.log(this.lbgName) @@ -386,6 +510,25 @@ } }) + }, + //编辑每一个的单价 + clickPrice(index) { + console.log(index) + this.index = index + this.wholesalePrice = this.carList.get(this.index).wholesalePrice + this.lsprice = this.carList.get(this.index).lsprice + this.$refs.inputDialog.open() + }, + //选择是零售价还是批发价 + checkPay(price){ + let that = this; + this.shouldPay = 0 + this.carList.get(this.index).purchasePrice = price; + that.carList.get(that.index).price = price * that.carList.get(that.index).productCount; + this.$refs.inputDialog.close() + that.carList.forEach(function(value, key) { + that.shouldPay += value.price + }) } } } @@ -396,7 +539,14 @@ .page1 { height: 100%; } - + .popup-pay-content{ + align-items: center; + justify-content: center; + padding: 15px; + width: 500rpx; + height: auto; + background-color: #fff; + } .content { border-top: 1px solid #eee; overflow-y: scroll; @@ -409,6 +559,24 @@ background: #fff; margin-bottom: 20rpx; + } + .popup-pay-title { + font-size: 36rpx; + font-weight: bold; + text-align: center; + position: relative; + } + + .popup-pay-container { + margin-top: 20rpx; + height: 100rpx; + border-radius: 10px; + background: #088FEB; + line-height: 100rpx; + text-align: center; + border-bottom: 1px solid #eee; + border-top: 1px solid #eee; + color: #fff; } .content-list { @@ -486,7 +654,9 @@ font-weight: bold; display: flex; } - + .discount-num{ + width: 200rpx; + } .shop-productName { flex: 1; display: flex; @@ -504,14 +674,18 @@ // } // } - .shop-collapse { - border-radius: 1px solid #eee; - } - - .shop-collapse text { - text-align: right; - padding-right: 40rpx; - border-right: 1px solid #eee; + .shop-collapse { + display: flex; + height: 80rpx; + font-size: 26rpx; + line-height: 80rpx; + } + + .shop-collapse text { + flex: 1; + text-align: center; + padding-right: 40rpx; + border-right: 1px solid #eee; } .shop-collapse-item {