From 0357918b73a80e51b616b7778a5bfe42be5ad428 Mon Sep 17 00:00:00 2001 From: "tianyi@bogon" Date: Tue, 14 Nov 2023 12:04:31 +0800 Subject: [PATCH] qq --- pages/billing/addUser.vue | 146 +++++++++++++++++++++--------- pages/index/addHangOrder.vue | 58 +++++------- pages/index/index.vue | 4 +- pages/index/peopleList.vue | 2 +- pages/index/uparrears.vue | 6 +- pages/index/upstream.vue | 5 +- pages/index/waitStorageDetail.vue | 35 +++---- pages/inventory/addinventory.vue | 4 +- pages/inventory/changeGoods1.vue | 4 +- 9 files changed, 160 insertions(+), 104 deletions(-) diff --git a/pages/billing/addUser.vue b/pages/billing/addUser.vue index c8ecace..4615897 100644 --- a/pages/billing/addUser.vue +++ b/pages/billing/addUser.vue @@ -46,7 +46,8 @@ show: false, delShow: false, addressObj: {}, - type:'', + type:'', + popleType:'', formData: { consigneeMobile: '', consigneeName: '', @@ -106,9 +107,13 @@ this.$refs.form.setRules(this.rules) }, onLoad(option) { - let data = JSON.parse(option.data) - - this.type=option.type + // if(option.data){ + // let data = JSON.parse(option.data) + // } + this.popleType = option.popleType + this.type=option.type + console.log(option.popleType) + console.log(option.type) if (option.type = "edit") { this.formData.address1 = data.province + data.city + data.area this.formData.address = data.address @@ -189,48 +194,99 @@ // 触发提交表单 submit() { let that = this; - this.$refs.form.validate().then(res => { - if (that.type == 'edit') { - - res.id = that.userInfo.id - that.tui.request("/app/supplier/edit", "post", this.formData, false, - true).then((res) => { - if (res.code == 200) { - uni.showToast({ - title: "修改成功", - icon: 'none' - }) - uni.navigateBack() - } else { - uni.showToast({ - title: "修改失败", - icon: 'none' - }) - } - }) - } else { - that.tui.request("/app/supplier/save", "post", Object.assign(that.addressObj, res), false, - true).then((res) => { - if (res.code == 200) { - uni.showToast({ - title: "添加成功", - icon: 'none' - }) - let pages = - getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 - let prevPage = pages[pages.length - 2]; //上一页页面实例 - prevPage.$vm.popleType = 'gysName' - uni.navigateBack({ - delta: 1 - }) - } else { - uni.showToast({ - title: "添加失败", - icon: 'none' - }) - } - }) + this.$refs.form.validate().then(res => { + if(this.popleType == 'khName'){ + that.tui.request("/app/customer/save", "post", { + name:this.formData.consigneeName, + phone:this.formData.consigneeMobile, + address:this.formData.address, + province:this.addressObj.province, + city:this.addressObj.city, + area:this.addressObj.area, + userName:this.formData.consigneeMobile + }, false,true).then((res) => { + if (res.code == 200) { + uni.showToast({ + title: "添加成功", + icon: 'none' + }) + let pages = getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 + let prevPage = pages[pages.length - 2]; //上一页页面实例 + prevPage.$vm.popleType = 'khName' + uni.navigateBack({ + delta: 1 + }) + } else { + uni.showToast({ + title: "添加失败", + icon: 'none' + }) + } + }) + }else{ + that.tui.request("/app/supplier/save", "post", Object.assign(that.addressObj, res), false, + true).then((res) => { + if (res.code == 200) { + uni.showToast({ + title: "添加成功", + icon: 'none' + }) + let pages = + getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 + let prevPage = pages[pages.length - 2]; //上一页页面实例 + prevPage.$vm.popleType = 'gysName' + uni.navigateBack({ + delta: 1 + }) + } else { + uni.showToast({ + title: "添加失败", + icon: 'none' + }) + } + }) } + // if (that.type == 'edit') { + + // res.id = that.userInfo.id + // that.tui.request("/app/supplier/edit", "post", this.formData, false, + // true).then((res) => { + // if (res.code == 200) { + // uni.showToast({ + // title: "修改成功", + // icon: 'none' + // }) + // uni.navigateBack() + // } else { + // uni.showToast({ + // title: "修改失败", + // icon: 'none' + // }) + // } + // }) + // } else { + // that.tui.request("/app/supplier/save", "post", Object.assign(that.addressObj, res), false, + // true).then((res) => { + // if (res.code == 200) { + // uni.showToast({ + // title: "添加成功", + // icon: 'none' + // }) + // let pages = + // getCurrentPages(); // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。 + // let prevPage = pages[pages.length - 2]; //上一页页面实例 + // prevPage.$vm.popleType = 'gysName' + // uni.navigateBack({ + // delta: 1 + // }) + // } else { + // uni.showToast({ + // title: "添加失败", + // icon: 'none' + // }) + // } + // }) + // } }).catch(err => { console.log('表单错误信息:', err); diff --git a/pages/index/addHangOrder.vue b/pages/index/addHangOrder.vue index ee54672..ab7ad77 100644 --- a/pages/index/addHangOrder.vue +++ b/pages/index/addHangOrder.vue @@ -472,41 +472,33 @@ this.tui.request("/app/product/getById/" + id, "POST", {}, false, true).then((res) => { if (res.code == 200) { this.goodsDetail = res.result; - this.tui.request("/app/productAttribute/selectByCategoryId", "POST", { + this.tui.request("/app/productAttribute/selectAttributeAndValueByCategoryId", "POST", { categoryId: this.goodsDetail.categoryId }, false, true).then((res1) => { - if (res1.code == 200) { - this.attrList = res1.result; - if (res1.result.length > 0) { - let newArr = [] - this.attrList.forEach((items) => { - this.tui.request("/app/productAttributeValue/selectByAttributeId","get", { - id: items.id - }, false, true).then((res2) => { - if (res2.code == 200) { - let valueObj = []; - for (var i = 0; i < res2.result.length; i++) { - valueObj.push({ - value: res2.result[i].value, - isChecked: false - }) - } - newArr.push({ - name: items.attributeName, - 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) - } - console.log(this.goodsDetail) - }).catch((res) => {}) - }) - } + if (res1.code == 200) { + if (typeof(res1.result) == 'string') { + let newObj = JSON.parse(res1.result) + 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 + }) + } + 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) } diff --git a/pages/index/index.vue b/pages/index/index.vue index 11ec2d2..5aa704b 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -20,7 +20,7 @@ 推款 - + 待入库 @@ -106,7 +106,7 @@ arrow-direction="left"> - diff --git a/pages/index/peopleList.vue b/pages/index/peopleList.vue index c5b74d2..f4e9210 100644 --- a/pages/index/peopleList.vue +++ b/pages/index/peopleList.vue @@ -173,7 +173,7 @@ goAddPeople(type,data){ this.modelShow = true; uni.navigateTo({ - url: "/pages/billing/addUser?type="+type+'&data='+JSON.stringify(data) + url: "/pages/billing/addUser?type="+type+'&data='+JSON.stringify(data) + '&popleType=' + this.popleType }) }, //打开弹出层 diff --git a/pages/index/uparrears.vue b/pages/index/uparrears.vue index 1756aad..5a36e5e 100644 --- a/pages/index/uparrears.vue +++ b/pages/index/uparrears.vue @@ -48,11 +48,13 @@ // this.status = 'loading'; // this.page = ++this.page; // this.getList(); - // }, + // }, + onShow(){ + this.getList() + }, onLoad(options) { this.supplierId = options.supplierId this.consigneeName = options.consigneeName - this.getList() }, methods: { getList() { diff --git a/pages/index/upstream.vue b/pages/index/upstream.vue index 22233d6..08ed71c 100644 --- a/pages/index/upstream.vue +++ b/pages/index/upstream.vue @@ -37,9 +37,12 @@ shopName: '', list: [] } + }, + onShow(){ + this.getList() }, onLoad() { - this.getList() + }, methods: { getList() { diff --git a/pages/index/waitStorageDetail.vue b/pages/index/waitStorageDetail.vue index af950f8..1c52029 100644 --- a/pages/index/waitStorageDetail.vue +++ b/pages/index/waitStorageDetail.vue @@ -64,7 +64,7 @@ - 确认提交 + 确认提交 @@ -86,7 +86,8 @@ noPay:0, alreadyPay:0, otherPay:0, - remark:'', + remark:'', + id:'' } }, filters: { @@ -101,7 +102,8 @@ return name; } }, - onLoad(option) { + onLoad(option) { + this.id = option.id this.getWaitStorage(option.id) }, methods: { @@ -132,6 +134,7 @@ } let that = this; let purchase = { + id:this.id, alreadyPay: this.alreadyPay, //已付金额 noPay: this.noPay, //欠款 shouldPay: this.shouldPay, //应付金额 @@ -140,20 +143,20 @@ supplierId: this.sales.supplierId, //供应商id和姓名 supplierName: this.sales.supplierName } - let purchaseDetails = []; - this.carList.forEach(function(value, key) { - value.stockLogList.forEach(function(values, keys) { - let obj = { - productCount: values, - attributeList: keys - } - value.stockLogList1.push(obj) - }) - purchaseDetails.push(value) - }) - this.tui.request("/app/stock/putInOfProduct", "post", { + // let purchaseDetails = []; + // this.goodsList.forEach(function(value, key) { + // value.stockLogList.forEach(function(values, keys) { + // let obj = { + // productCount: values, + // attributeList: keys + // } + // value.stockLogList1.push(obj) + // }) + // purchaseDetails.push(value) + // }) + this.tui.request("/app/stock/putInPrice", "post", { purchase: purchase, - purchaseDetails: purchaseDetails + purchaseDetails: this.goodsList }, false, false).then((res) => { if (res.code == 200) { uni.showToast({ diff --git a/pages/inventory/addinventory.vue b/pages/inventory/addinventory.vue index 73968fe..7961813 100644 --- a/pages/inventory/addinventory.vue +++ b/pages/inventory/addinventory.vue @@ -151,7 +151,7 @@ if (this.carList.size == 0) { //当前页没有数据 for (let i = 0; i < this.carList1.length; i++) { let obj = { - purchasePrice: this.carList1[i].price, //进货价 + purchasePrice: "", //进货价 price: 0, productCount: this.carList1[i].num, productId: this.carList1[i].id, @@ -185,7 +185,7 @@ } } else { //商品不同 let obj = { - purchasePrice: this.carList1[i].price, //进货价 + purchasePrice: "", //进货价 price: 0, productCount: this.carList1[i].num, productId: this.carList1[i].id, diff --git a/pages/inventory/changeGoods1.vue b/pages/inventory/changeGoods1.vue index 1a581d4..86bd74a 100644 --- a/pages/inventory/changeGoods1.vue +++ b/pages/inventory/changeGoods1.vue @@ -177,7 +177,7 @@ keyList: [], evalue: [], attributeList: [], - purchasePrice: 0, + purchasePrice: "", zPrice:0, zNum:0, storageType:0, @@ -422,7 +422,7 @@ this.carList.push(data) console.log(this.carList) this.temporaryList = [] - this.purchasePrice = 0 + this.purchasePrice = "" this.zPrice = '' this.zNum = '' for(let i=0;i