From aa71afdcde6a139e222498ca2e6c824e2353bae3 Mon Sep 17 00:00:00 2001 From: "tianyi@bogon" Date: Thu, 9 Nov 2023 18:49:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8D=95=EF=BC=8C=E5=85=A5=E5=BA=93?= =?UTF-8?q?=EF=BC=8C=E6=8C=82=E5=8D=95=E9=A1=B5=E9=9D=A2=E7=BC=9D=E7=BC=9D?= =?UTF-8?q?=E8=A1=A5=E8=A1=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/index/addHangOrder.vue | 1062 ++++++++++++++++-------------- pages/index/orderDetail.vue | 2 +- pages/index/returnList.vue | 56 +- pages/inventory/addinventory.vue | 35 +- pages/inventory/changeGoods1.vue | 1 + pages/inventory/inventory.vue | 68 +- 6 files changed, 695 insertions(+), 529 deletions(-) diff --git a/pages/index/addHangOrder.vue b/pages/index/addHangOrder.vue index cbd5fe5..7bbda73 100644 --- a/pages/index/addHangOrder.vue +++ b/pages/index/addHangOrder.vue @@ -9,38 +9,43 @@ - - - - 备注: - {{item.remark}} - - - - {{items.productName}} {{items.productSn}} - - - - {{itemss.attributeList}} * {{itemss.productCount}} - - - - + + + + + 备注: + {{item.remark}} + + + + {{items.productName}} {{items.productSn}} + + + + + + + {{itemss.attributeList | sliceMsg}} * {{itemss.productCount}} + + + + + + @@ -70,89 +75,90 @@ 语音识别中... - - - - - - - - - - {{goodsDetail.productName}} - - {{goodsDetail.productSn}} - - 修改价格 - - - - - - 实际价格 - - -
    -
  • - - {{items.name}} - - - - {{itemTag.value}} - -
  • -
- - - {{item.name}} - - - -
- - - {{zNum}} 件 - ¥{{zPrice}} - - - 选好了 - - -
-
-
- - - - - 选择商品价格 - - - 零售价:¥{{goodsDetail.price}} - - - 批发价:¥{{goodsDetail.wholesalePrice}} - - + + + + + + + + + + {{goodsDetail.productName}} + + {{goodsDetail.productSn}} + + 修改价格 + + + + + + 实际价格 + + +
    +
  • + + {{items.name}} + + + + {{itemTag.value}} + +
  • +
+ + + {{item.name}} + + + +
+ + + {{zNum}} 件 + ¥{{zPrice}} + + + 选好了 + + +
+
+
+ + + + + 选择商品价格 + + + 零售价:¥{{goodsDetail.price}} + + + 批发价:¥{{goodsDetail.wholesalePrice}} + + - - - - + + + + - + @@ -166,33 +172,46 @@ return { voiceText: '', recordState: false, - pageNumber: 1, - regList:[], - list:[], - value:'', - indexList: [], - pageNum: 1, //分页的页码 - shopList: [], - info: 0, - categoryId: '', //分类id - searchName: '', //搜索框输入值 - shopId: '', //店铺id, - checkbox: [], //需要分享的商品id - temporaryNum: 0, - goodsDetail: [], - attrNameList: [], - temporaryList: [], - carList: [], - columns: [], - keyList: [], - specsList: [], - evalue: [], - attributeList: [], - purchasePrice: 0, - zPrice:0, - zNum:0, - storageType:0, - hangId:'' + pageNumber: 1, + regList: [], + list: [], + value: '', + indexList: [], + pageNum: 1, //分页的页码 + shopList: [], + info: 0, + categoryId: '', //分类id + searchName: '', //搜索框输入值 + shopId: '', //店铺id, + checkbox: [], //需要分享的商品id + temporaryNum: 0, + goodsDetail: [], + attrNameList: [], + temporaryList: [], + carList: [], + columns: [], + keyList: [], + specsList: [], + evalue: [], + attributeList: [], + purchasePrice: 0, + zPrice: 0, + zNum: 0, + storageType: 0, + hangId: '', + bigImg: '' + } + }, + 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() { @@ -209,9 +228,9 @@ } } this.tui.request("/app/sale/listPages", "POST", obj, false, false).then((res) => { - if (res.code == 200) { - for (let i=0;i { @@ -273,19 +292,24 @@ // 识别错误事件 manager.onError = (res) => { - if(res.retcode == '-40001'){ - uni.showToast({ - title: '使用次数超限制,请联系管理员!', - icon: 'none' - }) + if (res.retcode == '-40001') { + uni.showToast({ + title: '使用次数超限制,请联系管理员!', + icon: 'none' + }) } } }, //扫一扫功能 - scanCodeAdd(id) { + scanCodeAdd(item) { uni.scanCode({ - success: (res) => { - this.hangId = id + success: (res) => { + this.hangId = item.id + if (item.saleDetailDTOList) { + for (let i = 0; i < item.saleDetailDTOList.length; i++) { + this.carList.push(item.saleDetailDTOList[i]) + } + } this.toggle('bottom', res.result); }, @@ -296,121 +320,123 @@ }) } }) - }, - 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), - 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 - } - } - } - - } - } - - }, - temporaryChange(val) { - this.zNum = 0 - for (var i=0;i { - if (res.code == 200) { - this.getRegList() - } else { - this.tui.toast(res.message) - } - }).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 = {} + 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) { + this.attributeList = { + attributeList: JSON.stringify(obj), + productCount: this.temporaryNum, + name: name, + price: this.purchasePrice + } + + 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.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 + } + } + } + + } + + } + + }, + temporaryChange(val) { + this.zNum = 0 + for (var i = 0; i < this.temporaryList.length; i++) { + this.zNum += this.temporaryList[i].productCount + } + this.zPrice = this.zNum * this.purchasePrice + }, + //弹窗选择规格后,点击弹窗中选好了按钮 + temporaryCheck() { + if (this.storageType == 0 && this.purchasePrice == 0) { + uni.showToast({ + title: "请输入实际价格!", + icon: 'none' + }) + } else { + let data = { + discount: 10, + productId: this.goodsDetail.id, + realPrice: this.zPrice, + productCount: this.zNum, + discountAmount: this.zPrice, + productName: this.goodsDetail.productName, + productSn: this.goodsDetail.productSn, + productPicture: this.goodsDetail.productPicture, + supplierName: this.goodsDetail.supplierName, + stockLogList1: this.temporaryList + } + this.carList.push(data) + // this.temporaryList = [] + this.purchasePrice = '' + 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 + } + } + //在这里把新增的所有数据放到this.carList,然后请求新增商品接口,直接覆盖所有数据 + this.setSaleDetail() + this.$refs.shopPopup.close() + } + + }, + //保存扫码选择的商品、删除整条商品数据都用这个方法 + setSaleDetail() { + this.tui.request("/app/sale/setSaleDetail", "post", { + saleDetailList: this.carList, + saleId: this.hangId + }, false, false).then((res) => { + if (res.code == 200) { + this.getRegList() + } else { + this.tui.toast(res.message) + } + }).catch((res) => {}) }, //弹出商品规格选择 toggle(type, id) { @@ -418,58 +444,58 @@ if (type == 'bottom') { this.$refs.shopPopup.open(type) this.getById(id); - } else { - wx.vibrateShort() - this.initRecord(); - this.voiceText = id.remark + } else { + wx.vibrateShort() + this.initRecord(); + this.voiceText = id.remark this.list = id this.$refs.popup.open(type) } }, //新增挂单弹窗 - inputDialogToggle(type,list) { - this.value = '' - if(type=="add"){ - this.$refs.inputDialog.open() - }else if(type=='edit'){ - this.list = list; - this.value = list.saleName - this.$refs.setDialog.open() - }else{ - this.$refs.payDialog.open() + inputDialogToggle(type, list) { + this.value = '' + if (type == "add") { + this.$refs.inputDialog.open() + } else if (type == 'edit') { + this.list = list; + this.value = list.saleName + this.$refs.setDialog.open() + } else { + this.$refs.payDialog.open() } }, //通过商品id查询商品详细信息 getById(id) { - this.tui.request("/app/product/getById/"+id, "POST", {}, false, true).then((res) => { + this.tui.request("/app/product/getById/" + id, "POST", {}, false, true).then((res) => { if (res.code == 200) { - this.goodsDetail = res.result; - if (typeof(this.goodsDetail.attributeList) == 'string') { - let newObj = JSON.parse(this.goodsDetail.attributeList) - let newArr = [] - for (let val in newObj) { - let valueObj = []; - for (var i = 0; i < newObj[val].length; i++) { - valueObj.push({ - value: newObj[val][i], - isChecked: false - }) - this.attrNameList.push({ - value: newObj[val][i], - name: val, - isChecked: false - }) - } - newArr.push({ - name: val, - value: valueObj - }) - } - this.goodsDetail.attributeList = newArr; - this.goodsDetail.attributeList.forEach((item, index) => { - this.columns[index] = item.value; - this.keyList[index] = item.name; - }) + this.goodsDetail = res.result; + if (typeof(this.goodsDetail.attributeList) == 'string') { + let newObj = JSON.parse(this.goodsDetail.attributeList) + let newArr = [] + for (let val in newObj) { + let valueObj = []; + for (var i = 0; i < newObj[val].length; i++) { + valueObj.push({ + value: newObj[val][i], + isChecked: false + }) + this.attrNameList.push({ + value: newObj[val][i], + name: val, + isChecked: false + }) + } + newArr.push({ + name: val, + value: valueObj + }) + } + this.goodsDetail.attributeList = newArr; + this.goodsDetail.attributeList.forEach((item, index) => { + this.columns[index] = item.value; + this.keyList[index] = item.name; + }) } } else { this.tui.toast(res.message) @@ -477,7 +503,8 @@ }).catch((res) => {}) }, //查看大图 - largeImg() { + largeImg(img) { + this.bigImg = img this.$refs.imgPopup.open() }, //新增挂单 @@ -495,48 +522,90 @@ this.tui.toast(res) }) }, - //删除商品规格确认弹窗 - delGoodsPrecs(id) { + //删除整条挂单 + delHangOrder() { + let that = this; uni.showModal({ title: "提示", - content: "确定删除此条商品吗?", - success: function(res) { - this.tui.request("/app/sale/delById", "POST", { - id: id - }, false, false).then((res) => { - if (res.code == 200) { - this.tui.toast("删除成功") - this.getRegList(); - } else { - this.tui.toast(res.message) - } - }).catch((res) => { - this.tui.toast(res) + content: "确定删除此条挂单记录吗?", + success: function(res) { + that.tui.request("/app/sale/delById", "POST", { + id: id + }, false, false).then((res) => { + if (res.code == 200) { + that.tui.toast("删除成功") + that.getRegList(); + } else { + that.tui.toast(res.message) + } + }).catch((res) => { + that.tui.toast(res) }) } }) - }, - //编辑挂单信息 - setDetail(){ - this.tui.request("/app/sale/updateOrder", "POST", { - saleName:this.value, - id:this.list.id, - remark:this.voiceText - }, false, false).then((res) => { - if (res.code == 200) { - this.tui.toast("编辑成功") - this.getRegList(); - } else { - this.tui.toast(res.message) - } - }).catch((res) => { - this.tui.toast(res) - }) - }, - //选择是零售价还是批发价 - checkPay(price){ - this.purchasePrice = price; - this.$refs.payDialog.close() + }, + //删除整条商品 + delGoods(item, productId) { + let that = this; + this.hangId = item.id; + console.log(item.saleDetailDTOList) + uni.showModal({ + title: "提示", + content: "确定删除此条商品吗?", + success: function(res) { + for (let i = 0; i < item.saleDetailDTOList.length; i++) { + if (item.saleDetailDTOList[i].productId == productId) { + item.saleDetailDTOList.splice(item.saleDetailDTOList[i], 1) + } + } + that.carList = item.saleDetailDTOList + that.setSaleDetail(); + } + }) + }, + //删除商品下的单条规格 + delGoodsPrecs(item, index, index1) { + let that = this; + this.hangId = item.id; + console.log(item.saleDetailDTOList) + uni.showModal({ + title: "提示", + content: "确定删除此条规格吗?", + success: function(res) { + item.saleDetailDTOList[index].stockLogList1.splice(item.saleDetailDTOList[index] + .stockLogList1[index1], 1) + that.carList = item.saleDetailDTOList + that.setSaleDetail(); + } + }) + }, + //编辑挂单信息 + setDetail() { + this.tui.request("/app/sale/updateOrder", "POST", { + saleName: this.value, + id: this.list.id, + remark: this.voiceText + }, false, false).then((res) => { + if (res.code == 200) { + this.tui.toast("编辑成功") + this.getRegList(); + } else { + this.tui.toast(res.message) + } + }).catch((res) => { + this.tui.toast(res) + }) + }, + //选择是零售价还是批发价 + checkPay(price) { + this.purchasePrice = price; + this.$refs.payDialog.close() + }, + //带参数跳转到开单页 + goSaleGoods() { + uni.navigateTo({ + url: '/pages/inventory/goodsList1' + }) } } } @@ -545,7 +614,7 @@ \ No newline at end of file diff --git a/pages/index/orderDetail.vue b/pages/index/orderDetail.vue index 221a196..f41f3f6 100644 --- a/pages/index/orderDetail.vue +++ b/pages/index/orderDetail.vue @@ -370,7 +370,7 @@ }, getReturnOrder(id) { this.tui.request("/app/return/list", "post", { - shopId: 1, + shopId: "1718514268414021633", remark: 3, saleId: id }, false, false).then((res) => { diff --git a/pages/index/returnList.vue b/pages/index/returnList.vue index 61ad053..5d34dcb 100644 --- a/pages/index/returnList.vue +++ b/pages/index/returnList.vue @@ -10,20 +10,26 @@ - + + + 客户名称:张三 + 创建时间:2023-10-22 + 退款金额:200 数量:20件 + - - + {{ val.attributeList.substr(1).substring(0,val.attributeList.substr(1).length-1).replace(/\"/g, "") }} * {{val.productCount}} - - 确认收货 + + + 拒绝 + 确认收货 + @@ -106,8 +112,44 @@ float: right; } } + } + .popup-content-title{ + padding: 0 30rpx; + } + .title-box{ + height: 80rpx; + line-height: 80rpx; + font-size: 32rpx; + font-weight: bold; + } + .two{ + font-size: 28rpx; + color:#777; + font-weight: normal; + } + .popup-content-bottom{ + display:flex; + margin-top:20rpx; + } + .bottom-btn{ + flex: 1; + text-align: center; + line-height: 40px; + height: 80rpx; + font-size: 32rpx; + background: #5fd9ee; + color: #fff; + + } + .bottom-btn:first-child{ + border-top-left-radius: 80rpx; + border-bottom-left-radius: 80rpx; + } + .bottom-btn:last-child{ + border-left: 1px solid #eee; + border-top-right-radius: 80rpx; + border-bottom-right-radius: 80rpx; } - .popup-content { padding: 40rpx; width: 80vw; diff --git a/pages/inventory/addinventory.vue b/pages/inventory/addinventory.vue index 0915212..509f279 100644 --- a/pages/inventory/addinventory.vue +++ b/pages/inventory/addinventory.vue @@ -147,9 +147,7 @@ onShow() { let that = this; this.khName = JSON.parse(JSON.stringify(this.khName)) || '' - //this.carList1 //上个页回来的 - //this.carList //这个页的最终数组 - console.log(this.carList1) + this.totalAmount = 0; if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < this.carList1.length; i++) { let obj = { @@ -167,9 +165,7 @@ obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i] .saleDetailQueryDTO[m].productCount) } - console.log("没有数据") this.carList.set(this.carList1[i].id, obj) - console.log(this.carList) } this.carList1 = [] } else { //当前页有数据 @@ -178,13 +174,11 @@ 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) } else { //规格不同 - console.log("规格不同") this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount) } @@ -208,13 +202,9 @@ } 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 }) @@ -256,8 +246,6 @@ }) }, inventorySubmit() { - console.log(this.khName) - console.log(Array.from(this.carList)[1]) if (this.khName == '' || this.carList == '') { uni.showToast({ title: "信息填写完成后入库!", @@ -274,22 +262,8 @@ supplierId: this.khName.id, //供应商id和姓名 supplierName: this.khName.consigneeName } - // that.carList.forEach(function(value, key) { - // for (let i = 0; i < value.saleDetailQueryDTO.length; i++) { - // let obj = { - // purchasePrice: value.price, //进货价 - // productCount: value.num, - // productId: key, - // productName: value.productName, - // productPicture: value.productPicture, - // stockLogList: value.saleDetailQueryDTO - - // } - // purchaseDetails.push(obj) - // } let purchaseDetails = []; this.carList.forEach(function(value, key) { - console.log(value.stockLogList) value.stockLogList.forEach(function(values, keys) { let obj = { productCount: values, @@ -297,11 +271,8 @@ } value.stockLogList1.push(obj) }) - console.log(value) purchaseDetails.push(value) }) - - console.log(purchaseDetails) this.tui.request("/app/stock/putInOfProduct", "post", { purchase: purchase, purchaseDetails: purchaseDetails @@ -324,8 +295,8 @@ }, //编辑每一个的单价 clickCollapse(index) { - console.log(index) - this.index = index + this.index = index + this.$refs.inputDialog.val = '' this.$refs.inputDialog.open() }, //计算价格 diff --git a/pages/inventory/changeGoods1.vue b/pages/inventory/changeGoods1.vue index 2c4c0ba..6a31927 100644 --- a/pages/inventory/changeGoods1.vue +++ b/pages/inventory/changeGoods1.vue @@ -313,6 +313,7 @@ // open 方法传入参数 等同在 uni-popup 组件上绑定 type属性 if (type == 'carPopup') { this.$refs.carPopup.open('bottom') + this.carNum = 0 for (let i=0;i +