diff --git a/src/PagesStatistics/billDetail.vue b/src/PagesStatistics/billDetail.vue index 6ee3a5d..e002722 100644 --- a/src/PagesStatistics/billDetail.vue +++ b/src/PagesStatistics/billDetail.vue @@ -26,7 +26,9 @@ {{ state.type === "1" ? "应付" : "应收" }}金额:¥{{ - state.type === "1" ? formatMoney(item.balanceTotalPrice) : formatMoney(item.totalPrice) + state.type === "1" + ? formatMoney(item.balanceTotalPrice) + : formatMoney(item.totalPrice) }} @@ -85,22 +87,25 @@ const getList = (v?: boolean) => { ReceiveApi.getOrderPage(params).then((res) => { if (res.code === 200) { pageList.isLoading = false; - (pageList as any).list = (res.data.list as any).map((item: any) => { - return { ...item, isChecked: false }; - }); + pageList.list = pageList.list.concat( + res.data.list.map((item: any) => { + return { ...item, isChecked: false }; + }) + ); pageList.total = (res.data as any).total; - } }); } else if (state.type === "2") { ShipmentApi.getOrderPage(params).then((res) => { if (res.code === 200) { pageList.isLoading = false; - (pageList as any).list = (res.data.list as any).map((item: any) => { - return { ...item, isChecked: false }; - }); + + pageList.list = pageList.list.concat( + res.data.list.map((item: any) => { + return { ...item, isChecked: false }; + }) + ); pageList.total = (res.data as any).total; - } }); } diff --git a/src/PagesStatistics/components/ProductDialog.vue b/src/PagesStatistics/components/ProductDialog.vue index d5c0574..44a6558 100644 --- a/src/PagesStatistics/components/ProductDialog.vue +++ b/src/PagesStatistics/components/ProductDialog.vue @@ -79,12 +79,9 @@ const handleSelect = (item: any) => { }; const getList = () => { if (props.isShipment) { - GoodsApi.getChildrenList().then((res) => { if (res.code === 200) { - if (res.code === 200) { - state.list = res.data; - } + state.list = res.data; } }); } else { diff --git a/src/pagesApp/customerMgt.vue b/src/pagesApp/customerMgt.vue index 414dbe2..64972f6 100644 --- a/src/pagesApp/customerMgt.vue +++ b/src/pagesApp/customerMgt.vue @@ -65,7 +65,7 @@ const handleModal = (v: boolean, id: number) => { deleteId.value = id; }; const handleOk = () => { - deleteCustomer({id: deleteId.value}) + deleteCustomer({ id: deleteId.value }); }; const state = reactive({ name: "", @@ -125,16 +125,16 @@ const getList = (v?: boolean) => { params.supplierTypeId = state.supplierTypeId; } pageList.isLoading = true; - CustomerApi.getCustomUserPage(params).then((res) => { + CustomerApi.getCustomUserPage(params).then((res: any) => { if (res.code === 200) { pageList.isLoading = false; - (pageList as any).list = (res.data as any).list; - pageList.total = (res.data as any).total; + pageList.list = pageList.list = pageList.list.concat(res.data.list); + pageList.total = res.data.total; } }); }; onShow(() => { - resetPageList() + resetPageList(); getList(); }); diff --git a/src/pagesApp/role.vue b/src/pagesApp/role.vue index 501ae46..6adfce5 100644 --- a/src/pagesApp/role.vue +++ b/src/pagesApp/role.vue @@ -126,10 +126,8 @@ const getList = (v?: boolean) => { pageList.isLoading = true; ProfileApi.getRoleList(params).then((res) => { if (res.code === 200) { - if (res.code === 200) { - pageList.isLoading = false; - (pageList as any).list = res.data as any; - } + pageList.isLoading = false; + (pageList as any).list = res.data as any; } }); }; diff --git a/src/pagesApp/stockCard.vue b/src/pagesApp/stockCard.vue index d954471..5c64aa4 100644 --- a/src/pagesApp/stockCard.vue +++ b/src/pagesApp/stockCard.vue @@ -71,7 +71,7 @@ const handleModal = (v: boolean, id: number) => { deleteId.value = id; }; const handleOk = () => { - deleteStockCard({id: deleteId.value}) + deleteStockCard({ id: deleteId.value }); }; const state = reactive({ @@ -131,17 +131,18 @@ const getList = (v?: boolean) => { if (state.supplierTypeId > -1) { params.supplierTypeId = state.supplierTypeId; } - StockCardApi.getStockCardList(params).then((res) => { + pageList.isLoading = true; + StockCardApi.getStockCardList(params).then((res: any) => { if (res.code === 200) { - if (res.code === 200) { - (pageList as any).list = (res.data as any).list; - } + pageList.isLoading = false; + pageList.list = pageList.list = pageList.list.concat(res.data.list); + pageList.total = res.data.total; } }); }; onShow(() => { - resetPageList() + resetPageList(); getList(); }); diff --git a/src/pagesReceive/form/pricingForm.vue b/src/pagesReceive/form/pricingForm.vue index c13cded..f840241 100644 --- a/src/pagesReceive/form/pricingForm.vue +++ b/src/pagesReceive/form/pricingForm.vue @@ -551,9 +551,14 @@ watch( } } model1.order.totalPrice = - (model1.order.price || 0) * (model1.order.netWeight || 0); + Math.round( + (model1.order.price || 0) * (model1.order.netWeight || 0) * 100 + ) / 100; + // 货款金额默认=预估总价,当系统自动算出预估总价时,值需同步 - model1.order.balanceTotalPrice = model1.order.totalPrice; + if (model1.order.balanceTotalPrice <= 0) { + model1.order.balanceTotalPrice = model1.order.totalPrice; + } } ); @@ -590,7 +595,6 @@ const handleBack = () => { // const files = ref([]); const filesRef = ref(); const handleUpload = () => { - // console.log(event.tempFilePaths) return filesRef.value[0].filesList.map((item: any, index: number) => { if (item.fileID) { return; @@ -621,7 +625,6 @@ const handleUpload = () => { * */ const handleDelete = (e: any) => { - console.log(model1.order.fileLists); if (e.tempFile.fileID) { PictureApi.deleteById({ id: e.tempFile.fileID }).then((res) => { if (res.code === 200) { @@ -703,9 +706,14 @@ const save = () => { }; const startSave = () => { Promise.all(handleUpload()).then((res) => { + console.log("***** 所有文件已经上传成功", res); if (res.filter((item) => item).length > 0) { PictureApi.addListAnnex({ annexPos: res.filter((item) => item) }).then( (res1) => { + console.log( + "***** 关联的内容是", + res.filter((item) => item) + ); if (res1.code === 200) { console.log("*** 资源文件更新成功"); } @@ -724,11 +732,14 @@ const updateOrder = () => { 零皮重 scaleState = 2 带审核 */ // 若是补单数据 则不做此判断 - if (!model1.order.repairFlag) { - if (model1.order.weighingMethod === 0) { - model1.order.scaleStatus = 1; - } else if (model1.order.weighingMethod === 1) { - model1.order.scaleStatus = 2; + // 到待审核状态不用关心补单的逻辑 + if (model1.order.scaleStatus < 2) { + if (!model1.order.repairFlag) { + if (model1.order.weighingMethod === 0) { + model1.order.scaleStatus = 1; + } else if (model1.order.weighingMethod === 1) { + model1.order.scaleStatus = 2; + } } } @@ -812,7 +823,7 @@ onLoad((option) => { } uni.$on("pricingParams", (data) => { - model1.order.userName = data.name + model1.order.userName = data.name; }); }); diff --git a/src/pagesReceive/payReview.vue b/src/pagesReceive/payReview.vue index dcf74f0..a104e81 100644 --- a/src/pagesReceive/payReview.vue +++ b/src/pagesReceive/payReview.vue @@ -289,12 +289,14 @@ const getList = (v?: boolean) => { pageNumber: pageList.pageNum, scaleStatus: currentTab.value, userName: keyword.value - }).then((res) => { + }).then((res:any) => { if (res.code === 200) { pageList.isLoading = false; - (pageList as any).list = (res.data.list as any).map((item: any) => { - return { ...item, isChecked: false }; - }); + pageList.list = pageList.list.concat( + res.data.list.map((item: any) => { + return { ...item, isChecked: false }; + }) + ); pageList.total = (res.data as any).total; } }); diff --git a/src/pagesShipment/shipmentSettlement.vue b/src/pagesShipment/shipmentSettlement.vue index 759a03b..eb858a1 100644 --- a/src/pagesShipment/shipmentSettlement.vue +++ b/src/pagesShipment/shipmentSettlement.vue @@ -243,11 +243,11 @@ const getList = (v?: boolean) => { // (pageList as any).list = (res.data.list as any).map((item: any) => { // return { ...item, isChecked: false }; // }); - (pageList as any).list = (pageList as any).list.concat( - (res.data.list as any).map((item: any) => { - return { ...item, isChecked: false }; - }) - ); + pageList.list = pageList.list.concat( + res.data.list.map((item: any) => { + return { ...item, isChecked: false }; + }) + ); pageList.total = (res.data as any).total; } }); diff --git a/src/utils/http.ts b/src/utils/http.ts index 4feb01a..4f6cb8d 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -9,7 +9,8 @@ let baseUrl = ""; // #endif const store = useMemberStore(pinia); -baseUrl = (process.env as any).config[(process.env as any).NODE_ENV].VITE_APP_BASE_URL; +baseUrl = (process.env as any).config[(process.env as any).NODE_ENV] + .VITE_APP_BASE_URL; const obj = { // 拦截前触发 @@ -18,12 +19,11 @@ const obj = { options.timeout = 10000; // 拼接完整路径 if (!options.url.startsWith("http")) { - if (options.url.indexOf('/prod/gateway/api/db/getDbInfo') === -1 ) { + if (options.url.indexOf("/prod/gateway/api/db/getDbInfo") === -1) { options.url = baseUrl + store.profile.childPath + options.url; } else { options.url = baseUrl + options.url; } - } // 请求头标识 // 1.小程序唯一标识 @@ -56,35 +56,92 @@ interface Data { */ export const http = (options: UniApp.RequestOptions) => { return new Promise>((resolve, reject) => { - console.log(options); if ((options as any).header?.type === "UPLOAD") { - uni.uploadFile({ - header: { - "x-userToken": store.profile?.token, - // #ifdef H5 - "Content-Type": "multipart/form-data", - // #endif + // 压缩图片 + uni.compressImage({ + src: (options as any).data.path, + quality: 80, // 压缩质量 + success: (compressRes) => { + const compressedTempFilePath = compressRes.tempFilePath; + console.log('******* 压缩啦', compressedTempFilePath) + uni.uploadFile({ + header: { + "x-userToken": store.profile?.token, + // #ifdef H5 + "Content-Type": "multipart/form-data", + // #endif + }, + timeout: 1800000, + url: baseUrl + store.profile.childPath + options.url,//仅为示例,非真实的接口地址 + fileType: "image", + // #ifdef H5 + files: (options as any).data.files, + // #endif + // #ifdef MP-WEIXIN + filePath: compressedTempFilePath, + // #endif + name: "file", + formData: { + file: (options as any).data.files, + }, // HTTP 请求中其他额外的 form data + success: (res) => { + resolve(JSON.parse(res.data) as Data); + }, + fail(err) { + console.log("上传失败了", err); + resolve(err as any); + }, + }); + + // 上传图片 + // uni.uploadFile({ + // url: 'https://your-api-upload-endpoint.com/upload', // 你的上传接口 + // filePath: compressedTempFilePath, + // name: 'file', + // formData: { + // 'user': 'test' + // }, + // success: (uploadFileRes) => { + // console.log('upload success:', uploadFileRes); + // }, + // fail: (uploadFileErr) => { + // console.error('upload fail:', uploadFileErr); + // } + // }); }, - url: baseUrl + options.url, //仅为示例,非真实的接口地址 - fileType: "image", - // #ifdef H5 - files: (options as any).data.files, - // #endif - // #ifdef MP-WEIXIN - filePath: (options as any).data.path, - // #endif - name: "file", - formData: { - file: (options as any).data.files, - }, // HTTP 请求中其他额外的 form data - success: (res) => { - resolve(JSON.parse(res.data) as Data); - }, - fail(err) { - console.log(err); - resolve(err as any); + fail: (compressErr) => { + console.error("compress fail:", compressErr); }, }); + + // uni.uploadFile({ + // header: { + // "x-userToken": store.profile?.token, + // // #ifdef H5 + // "Content-Type": "multipart/form-data", + // // #endif + // }, + // timeout: 1800000, + // url: baseUrl + store.profile.childPath + options.url,//仅为示例,非真实的接口地址 + // fileType: "image", + // // #ifdef H5 + // files: (options as any).data.files, + // // #endif + // // #ifdef MP-WEIXIN + // filePath: (options as any).data.path, + // // #endif + // name: "file", + // formData: { + // file: (options as any).data.files, + // }, // HTTP 请求中其他额外的 form data + // success: (res) => { + // resolve(JSON.parse(res.data) as Data); + // }, + // fail(err) { + // console.log("上传失败了", err); + // resolve(err as any); + // }, + // }); } else { uni.request({ ...options, @@ -141,7 +198,6 @@ export const http = (options: UniApp.RequestOptions) => { icon: "none", // title: JSON.stringify(err), title: "网络错误,请检查网络", - }); reject(err); }, diff --git a/src/utils/index.ts b/src/utils/index.ts index 577910b..c500215 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -259,3 +259,4 @@ export function getScaleStatus(type: number, value: number) { } } } +