diff --git a/packages/app-client/src/pages/ship/document/create.tsx b/packages/app-client/src/pages/ship/document/create.tsx index fcd71a4..c856124 100644 --- a/packages/app-client/src/pages/ship/document/create.tsx +++ b/packages/app-client/src/pages/ship/document/create.tsx @@ -1269,32 +1269,47 @@ export default hocAuth(function Page(props: CommonComponent) { if (data && data.path) { setShipDocument(data.path); - // 保存到系统相册 + // 下载文件 Taro.downloadFile({ url: data.path, }).then((downloadRes) => { if (downloadRes.tempFilePath) { - Taro.saveImageToPhotosAlbum({ + Taro.openDocument({ filePath: downloadRes.tempFilePath, - complete: (res) => { - console.log("saveImageToPhotosAlbum", res); - }, + showMenu: true, + success: function () { + Taro.showToast({ + title: "发货单据已下载成功,您可以将生成的PDF发送给好友", + icon: "none", + duration: 3000, + }); + } }) - .then(() => { - Taro.showToast({ - title: "发货单据已保存到相册,您可以将生成的PDF发送给好友", - icon: "none", - duration: 3000, - }); - }) - .catch((e) => { - console.log("e", e); - Taro.showToast({ - title: "保存失败", - icon: "none", - duration: 3000, - }); - }); + // Taro.getFileSystemManager().mkdir({ + // dirPath: `${Taro.env.USER_DATA_PATH}/${shipOrderVO?.dealerName}/发货单据`, + // recursive: true, + // }); + // + // // 保存到文件系统 + // Taro.getFileSystemManager().saveFile({ + // tempFilePath: downloadRes.tempFilePath, + // filePath: `${Taro.env.USER_DATA_PATH}/${shipOrderVO?.dealerName}/发货单据/${shipOrderVO?.vehicleNo}_${shipOrderVO?.dealerName}_发货单据_${shipOrderVO?.orderSn}.pdf`, + // success: function () { + // Taro.showToast({ + // title: "发货单据已保存到本地,您可以将生成的PDF发送给好友", + // icon: "none", + // duration: 3000, + // }); + // }, + // fail: function (err) { + // console.log("保存失败", err); + // Taro.showToast({ + // title: "保存失败", + // icon: "none", + // duration: 3000, + // }); + // } + // }); } }); } @@ -1426,6 +1441,7 @@ export default hocAuth(function Page(props: CommonComponent) { // 下载完成后转发 Taro.shareFileMessage({ filePath: downloadRes.tempFilePath, + fileName: `${shipOrderVO?.vehicleNo}_${shipOrderVO?.dealerName}_发货单据_${shipOrderVO?.orderSn}.pdf`, complete: (res) => { console.log("complete", res); },