From ef279443f2834069880377ba75b4936e08582d74 Mon Sep 17 00:00:00 2001 From: FrancisHu <2756004617@qq.com> Date: Wed, 12 Jun 2024 16:49:25 +0800 Subject: [PATCH] =?UTF-8?q?6.12=E5=AE=81=E5=A4=8F=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E9=A2=86=E7=94=A8=E9=99=90=E5=88=B6=E4=BF=AE=E6=94=B9-?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E5=AD=97=E6=AE=B5=E6=9C=AA=E5=8A=A0=E6=9A=82?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E5=88=AB=E7=9A=84=E5=AD=97=E6=AE=B5=E4=BB=A3?= =?UTF-8?q?=E6=9B=BF-=E6=8E=A5=E5=8F=A3=E8=B0=83=E8=AF=95=E5=90=8E?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=88=A4=E6=96=AD=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apis/http.js | 4 +- apis/request.js | 21 +++++--- pages/orderCart/orderCart.vue | 97 ++++++++++++++++++++--------------- 3 files changed, 73 insertions(+), 49 deletions(-) diff --git a/apis/http.js b/apis/http.js index ee2b774..4e6ad9c 100644 --- a/apis/http.js +++ b/apis/http.js @@ -3,8 +3,8 @@ class HttpConfig { baseUrl = "/api" // #endif // #ifdef APP-PLUS - baseUrl = "http://112.29.103.165:21624" - // baseUrl = "http://192.168.0.14:21624" + // baseUrl = "http://112.29.103.165:21624" + baseUrl = "http://192.168.0.14:21624" // baseUrl = "http://112.29.103.165:21626" // baseUrl = "http://172.20.10.3:8080" // baseUrl = "http://10.40.92.8:8080" diff --git a/apis/request.js b/apis/request.js index 213895b..10b7d56 100644 --- a/apis/request.js +++ b/apis/request.js @@ -13,6 +13,8 @@ class Http{ }, // 成功的回调 success(res) { + resolve(res) + /* console.log(res); if (res.data.code == 401) { uni.showToast({ icon: 'none', @@ -25,7 +27,7 @@ class Http{ }) } else { resolve(res) - } + } */ }, fail(err) { reject(err) @@ -48,7 +50,8 @@ class Http{ }, // 成功的回调 success(res) { - // console.log(res); + resolve(res) + /* console.log(res); if (res.data.code == 401) { uni.showToast({ icon: 'none', @@ -61,7 +64,7 @@ class Http{ }) } else { resolve(res) - } + } */ }, fail(err) { // console.log(err); @@ -85,6 +88,8 @@ class Http{ }, // 成功的回调 success(res) { + resolve(res) + /* console.log(res); if (res.data.code == 401) { uni.showToast({ icon: 'none', @@ -97,7 +102,7 @@ class Http{ }) } else { resolve(res) - } + } */ }, fail(err) { reject(err) @@ -120,6 +125,8 @@ class Http{ }, // 成功的回调 success(res) { + resolve(res) + /* console.log(res); if (res.data.code == 401) { uni.showToast({ icon: 'none', @@ -132,7 +139,7 @@ class Http{ }) } else { resolve(res) - } + } */ }, fail(err) { reject(err) @@ -153,6 +160,8 @@ class Http{ name: 'file', // 成功的回调 success(res) { + resolve(res) + /* console.log(res); if (res.data.code == 401) { uni.showToast({ icon: 'none', @@ -165,7 +174,7 @@ class Http{ }) } else { resolve(res) - } + } */ }, fail(err) { reject(err) diff --git a/pages/orderCart/orderCart.vue b/pages/orderCart/orderCart.vue index 40151eb..c63d07f 100644 --- a/pages/orderCart/orderCart.vue +++ b/pages/orderCart/orderCart.vue @@ -286,7 +286,7 @@ import { basePath } from '../../public'; // console.log(1); that.$refs.deptForm.validate().then(formData => { console.log(formData, that.totalGoods); - that.totalGoods = that.totalGoods.map((item) => { + that.totalGoods = that.totalGoods.map(item => { return { id: item['id'], createBy: uni.getStorageSync('userInfo').sysUser.userName, @@ -297,47 +297,61 @@ import { basePath } from '../../public'; preNum: item['bookNum'] } }) - that.sendData = { - userId: uni.getStorageSync('userInfo').sysUser.userId, - companyId: uni.getStorageSync('userInfo').sysUser.companyId, - createBy: uni.getStorageSync('userInfo').sysUser.userName, - unitId: formData.deptName, - projectId: formData.projName, - agreementId: that.deptFormData.agreementId, - agreementCode: that.deptFormData.agreementCode, - taskType: 29, - taskStatus: 30, - // createTime: that.formatDate(new Date().getTime()), - leaseApplyInfo: { - leasePerson: uni.getStorageSync('userInfo').sysUser.userName, - phone: uni.getStorageSync('userInfo').sysUser.phonenumber - }, - leaseApplyDetails: that.totalGoods - } - console.log('that.sendData =================== ',that.sendData); - // 提交预约商品 - that.$api.fetchMaterial.subCart(that.sendData).then(res => { - console.log(res); - if (res.data.code == 200) { - uni.showToast({ - icon: 'none', - title: res.data.msg, - success: () => { - uni.redirectTo({ - url: '/pages/orderCart/orderCart' - }) - } - }) - } else { - uni.showToast({ - icon: 'none', - title:res.data.msg - }) - } - }).catch(err => { - console.log(err); + let setArr = [] + that.totalGoods.forEach(list => { + setArr.push(list.typeId) }) - that.$refs.popup.close() + console.log(setArr); + let set = new Set(setArr) + console.log(set.size); + if (set.size == 1) { + that.sendData = { + userId: uni.getStorageSync('userInfo').sysUser.userId, + companyId: uni.getStorageSync('userInfo').sysUser.companyId, + createBy: uni.getStorageSync('userInfo').sysUser.userName, + unitId: formData.deptName, + projectId: formData.projName, + agreementId: that.deptFormData.agreementId, + agreementCode: that.deptFormData.agreementCode, + taskType: 29, + taskStatus: 30, + // createTime: that.formatDate(new Date().getTime()), + leaseApplyInfo: { + leasePerson: uni.getStorageSync('userInfo').sysUser.userName, + phone: uni.getStorageSync('userInfo').sysUser.phonenumber + }, + leaseApplyDetails: that.totalGoods + } + console.log('that.sendData =================== ',that.sendData); + // 提交预约商品 + /* that.$api.fetchMaterial.subCart(that.sendData).then(res => { + console.log(res); + if (res.data.code == 200) { + uni.showToast({ + icon: 'none', + title: res.data.msg, + success: () => { + uni.redirectTo({ + url: '/pages/orderCart/orderCart' + }) + } + }) + } else { + uni.showToast({ + icon: 'none', + title:res.data.msg + }) + } + }).catch(err => { + console.log(err); + }) */ + that.$refs.popup.close() + } else { + uni.showToast({ + icon: 'none', + title: '无法同时领用机具设备和调试设备!' + }) + } }) } }, @@ -442,6 +456,7 @@ import { basePath } from '../../public'; }) // 初始化查询预约车内所有商品 that.$api.fetchMaterial.getCartDetail().then(res => { + console.log(res); if (res.data.code == 200) { for (let i = 0; i < res.data.data.length; i++) { res.data.data[i].checked = false