fix(delivery): 修复Excel下载逻辑并优化UI组件样式
- 移除Taro.downloadFile调用,直接使用URL设置临时文件路径 - 调整PDF查看按钮的图标颜色和类型样式 - 调整Excel查看按钮的图标颜色和类型样式 - 修复采购订单暂存跳转路径使用动态配置 - 添加空值检查避免访问undefined属性导致错误 - 移除档口信息中的冗余提示文本 - 更新Excel文件名格式化方式,移除分隔符 - 添加文件路径日志输出便于调试
This commit is contained in:
parent
b46137d0c3
commit
e6855dba63
@ -190,29 +190,13 @@ export default function Step3Success(props: Step3SuccessProps) {
|
|||||||
icon: "success",
|
icon: "success",
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
try {
|
setExcelTempFilePath(profitExcelUrl);
|
||||||
// 下载文件
|
|
||||||
const downloadRes = await Taro.downloadFile({
|
|
||||||
url: profitExcelUrl!,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (downloadRes.tempFilePath) {
|
|
||||||
setExcelTempFilePath(downloadRes.tempFilePath);
|
|
||||||
Taro.showToast({
|
Taro.showToast({
|
||||||
title: "Excel下载成功",
|
title: "Excel下载成功",
|
||||||
icon: "success",
|
icon: "success",
|
||||||
duration: 2000,
|
duration: 2000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error("下载Excel失败:", error);
|
|
||||||
Taro.showToast({
|
|
||||||
title: "下载Excel失败",
|
|
||||||
icon: "none",
|
|
||||||
duration: 2000,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 查看Excel文档
|
// 查看Excel文档
|
||||||
@ -405,15 +389,15 @@ export default function Step3Success(props: Step3SuccessProps) {
|
|||||||
{tempFilePath && (
|
{tempFilePath && (
|
||||||
<View className="flex-1">
|
<View className="flex-1">
|
||||||
<Button
|
<Button
|
||||||
icon={<Icon name="eye" size={16} />}
|
icon={<Icon name="eye" size={16} color={"orange"} />}
|
||||||
type="primary"
|
type="default"
|
||||||
color="orange"
|
color="orange"
|
||||||
fill={"outline"}
|
fill={"outline"}
|
||||||
size={"large"}
|
size={"large"}
|
||||||
block
|
block
|
||||||
onClick={handleViewPDF}
|
onClick={handleViewPDF}
|
||||||
>
|
>
|
||||||
<Text className="font-medium">查看PDF</Text>
|
<Text className="text-orange font-medium">查看PDF</Text>
|
||||||
</Button>
|
</Button>
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
@ -495,8 +479,8 @@ export default function Step3Success(props: Step3SuccessProps) {
|
|||||||
{excelTempFilePath && (
|
{excelTempFilePath && (
|
||||||
<View className="flex-1">
|
<View className="flex-1">
|
||||||
<Button
|
<Button
|
||||||
icon={<Icon name="eye" size={16} />}
|
icon={<Icon name="eye" size={16} color={"orange"} />}
|
||||||
type="primary"
|
type="default"
|
||||||
color="orange"
|
color="orange"
|
||||||
fill={"outline"}
|
fill={"outline"}
|
||||||
size={"large"}
|
size={"large"}
|
||||||
|
|||||||
@ -316,7 +316,7 @@ export default forwardRef<MadeOptionRef, IMadeOptionProps>(function MadeOption(
|
|||||||
content: "当前采购订单已暂存成功",
|
content: "当前采购订单已暂存成功",
|
||||||
});
|
});
|
||||||
Taro.redirectTo({
|
Taro.redirectTo({
|
||||||
url: "/pages/purchase/made/drafts",
|
url: purchase.path[orderVO.type].drafts,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -190,7 +190,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// 银行名称至少2个字符
|
// 银行名称至少2个字符
|
||||||
return bankName.length >= 2;
|
return bankName?.length >= 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 校验手机号函数
|
// 校验手机号函数
|
||||||
@ -955,7 +955,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入档口名称"
|
placeholder="请输入档口名称"
|
||||||
value={supplierVO.name}
|
value={supplierVO?.name || ""}
|
||||||
onChange={(value) => handleNameChange(value, supplierVO)}
|
onChange={(value) => handleNameChange(value, supplierVO)}
|
||||||
onBlur={() =>
|
onBlur={() =>
|
||||||
handleNameBlur(
|
handleNameBlur(
|
||||||
@ -982,7 +982,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入收款人姓名"
|
placeholder="请输入收款人姓名"
|
||||||
value={supplierVO.payeeName}
|
value={supplierVO?.payeeName || ""}
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
handlePayeeNameChange(value, supplierVO)
|
handlePayeeNameChange(value, supplierVO)
|
||||||
}
|
}
|
||||||
@ -1016,7 +1016,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入银行名称"
|
placeholder="请输入银行名称"
|
||||||
value={supplierVO.bankName}
|
value={supplierVO?.bankName || ""}
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
handleBankNameChange(value, supplierVO)
|
handleBankNameChange(value, supplierVO)
|
||||||
}
|
}
|
||||||
@ -1050,7 +1050,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="digit"
|
type="digit"
|
||||||
placeholder="请输入银行卡号"
|
placeholder="请输入银行卡号"
|
||||||
value={supplierVO.bankCard}
|
value={supplierVO?.bankCard || ""}
|
||||||
onChange={(value) =>
|
onChange={(value) =>
|
||||||
handleBankCardChange(value, supplierVO)
|
handleBankCardChange(value, supplierVO)
|
||||||
}
|
}
|
||||||
@ -1079,7 +1079,7 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="tel"
|
type="tel"
|
||||||
placeholder="请输入手机号码"
|
placeholder="请输入手机号码"
|
||||||
value={supplierVO.phone}
|
value={supplierVO?.phone || ""}
|
||||||
onChange={(value) => handlePhoneChange(value, supplierVO)}
|
onChange={(value) => handlePhoneChange(value, supplierVO)}
|
||||||
onBlur={() =>
|
onBlur={() =>
|
||||||
handlePhoneBlur(
|
handlePhoneBlur(
|
||||||
@ -1121,9 +1121,6 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
|||||||
微信收款码
|
微信收款码
|
||||||
</View>
|
</View>
|
||||||
<View className="text-sm text-green-600">已上传完成</View>
|
<View className="text-sm text-green-600">已上传完成</View>
|
||||||
<View className="text-neutral-darker mt-1 text-xs">
|
|
||||||
若档口无法开发票,则可打款到微信
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="flex flex-row gap-2.5">
|
<View className="flex flex-row gap-2.5">
|
||||||
@ -1176,9 +1173,6 @@ export default forwardRef<StallInfoRef, IStallInfoProps>(
|
|||||||
<View className="text-neutral-darker mt-1 text-xs">
|
<View className="text-neutral-darker mt-1 text-xs">
|
||||||
支持从相册选择或拍照
|
支持从相册选择或拍照
|
||||||
</View>
|
</View>
|
||||||
<View className="mt-2 text-center text-xs text-gray-400">
|
|
||||||
若档口无法开发票,则可打款到微信
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@ -869,7 +869,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入姓名"
|
placeholder="请输入姓名"
|
||||||
value={supplierVO.name}
|
value={supplierVO?.name || ""}
|
||||||
onChange={(value) => handleNameChange(value, supplierVO)}
|
onChange={(value) => handleNameChange(value, supplierVO)}
|
||||||
onBlur={() =>
|
onBlur={() =>
|
||||||
handleNameBlur(
|
handleNameBlur(
|
||||||
@ -896,7 +896,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="idcard"
|
type="idcard"
|
||||||
placeholder="请输入身份证号"
|
placeholder="请输入身份证号"
|
||||||
value={supplierVO.idCard || ""}
|
value={supplierVO?.idCard || ""}
|
||||||
onChange={(value) => handleIdCardChange(value, supplierVO)}
|
onChange={(value) => handleIdCardChange(value, supplierVO)}
|
||||||
onBlur={() =>
|
onBlur={() =>
|
||||||
handleIdCardBlur(
|
handleIdCardBlur(
|
||||||
@ -921,7 +921,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="请输入银行名称"
|
placeholder="请输入银行名称"
|
||||||
value={supplierVO.bankName || ""}
|
value={supplierVO?.bankName || ""}
|
||||||
onChange={(value) => handleBankNameChange(value, supplierVO)}
|
onChange={(value) => handleBankNameChange(value, supplierVO)}
|
||||||
onBlur={() =>
|
onBlur={() =>
|
||||||
handleBankNameBlur(
|
handleBankNameBlur(
|
||||||
@ -953,7 +953,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="digit"
|
type="digit"
|
||||||
placeholder="请输入银行卡号"
|
placeholder="请输入银行卡号"
|
||||||
value={supplierVO.bankCard || ""}
|
value={supplierVO?.bankCard || ""}
|
||||||
onChange={(value) => handleBankCardChange(value, supplierVO)}
|
onChange={(value) => handleBankCardChange(value, supplierVO)}
|
||||||
onBlur={() =>
|
onBlur={() =>
|
||||||
handleBankCardBlur(
|
handleBankCardBlur(
|
||||||
@ -978,7 +978,7 @@ export default forwardRef<SupplierInfoRef, ISupplierInfoProps>(
|
|||||||
clearable
|
clearable
|
||||||
type="tel"
|
type="tel"
|
||||||
placeholder="请输入手机号码"
|
placeholder="请输入手机号码"
|
||||||
value={supplierVO.phone}
|
value={supplierVO?.phone || ""}
|
||||||
onChange={(value) => handlePhoneChange(value, supplierVO)}
|
onChange={(value) => handlePhoneChange(value, supplierVO)}
|
||||||
onBlur={() =>
|
onBlur={() =>
|
||||||
handlePhoneBlur(
|
handlePhoneBlur(
|
||||||
|
|||||||
@ -57,11 +57,13 @@ const path = {
|
|||||||
create: "/pages/purchase/made/create",
|
create: "/pages/purchase/made/create",
|
||||||
preview: "/pages/purchase/made/preview",
|
preview: "/pages/purchase/made/preview",
|
||||||
result: "/pages/purchase/made/result",
|
result: "/pages/purchase/made/result",
|
||||||
|
drafts: "/pages/purchase/made/drafts",
|
||||||
},
|
},
|
||||||
MARKET_PURCHASE: {
|
MARKET_PURCHASE: {
|
||||||
create: "/pages/purchase/market/create",
|
create: "/pages/purchase/market/create",
|
||||||
preview: "/pages/purchase/market/preview",
|
preview: "/pages/purchase/market/preview",
|
||||||
result: "/pages/purchase/market/result",
|
result: "/pages/purchase/market/result",
|
||||||
|
drafts: "/pages/purchase/market/drafts",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -605,9 +605,6 @@ export default hocAuth(function Page(props: CommonComponent) {
|
|||||||
微信收款码
|
微信收款码
|
||||||
</View>
|
</View>
|
||||||
<View className="text-sm text-green-600">已上传完成</View>
|
<View className="text-sm text-green-600">已上传完成</View>
|
||||||
<View className="text-neutral-darker mt-1 text-xs">
|
|
||||||
若档口无法开发票,则可打款到微信
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
<View className="flex flex-row gap-2.5">
|
<View className="flex flex-row gap-2.5">
|
||||||
@ -660,9 +657,6 @@ export default hocAuth(function Page(props: CommonComponent) {
|
|||||||
<View className="text-neutral-darker mt-1 text-xs">
|
<View className="text-neutral-darker mt-1 text-xs">
|
||||||
支持从相册选择或拍照
|
支持从相册选择或拍照
|
||||||
</View>
|
</View>
|
||||||
<View className="mt-2 text-center text-xs text-gray-400">
|
|
||||||
若档口无法开发票,则可打款到微信
|
|
||||||
</View>
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import Taro from "@tarojs/taro";
|
import Taro from "@tarojs/taro";
|
||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import {utils, write} from "xlsx";
|
import { utils, write } from "xlsx";
|
||||||
|
|
||||||
// 利润表行数据接口
|
// 利润表行数据接口
|
||||||
export interface ProfitTableRow {
|
export interface ProfitTableRow {
|
||||||
@ -411,7 +411,7 @@ export const exportProfitTableExcel = async (
|
|||||||
utils.book_append_sheet(wb, ws, "诚信志远利润明细");
|
utils.book_append_sheet(wb, ws, "诚信志远利润明细");
|
||||||
|
|
||||||
// 生成文件名
|
// 生成文件名
|
||||||
const fileName = `诚信志远利润明细_${month}_${dayjs().format("YYYY-MM-DD_HH-mm-ss")}.xlsx`;
|
const fileName = `诚信志远利润明细_${month}_${dayjs().format("YYYYMMDDHHmmss")}.xlsx`;
|
||||||
|
|
||||||
// 根据环境选择不同的导出方式
|
// 根据环境选择不同的导出方式
|
||||||
const processEnv = process.env.TARO_ENV;
|
const processEnv = process.env.TARO_ENV;
|
||||||
@ -431,6 +431,7 @@ export const exportProfitTableExcel = async (
|
|||||||
|
|
||||||
// 将文件保存到本地
|
// 将文件保存到本地
|
||||||
const filePath = `${Taro.env.USER_DATA_PATH}/${fileName}`;
|
const filePath = `${Taro.env.USER_DATA_PATH}/${fileName}`;
|
||||||
|
console.log("filePath", filePath);
|
||||||
Taro.getFileSystemManager().writeFile({
|
Taro.getFileSystemManager().writeFile({
|
||||||
filePath,
|
filePath,
|
||||||
data: excelBuffer,
|
data: excelBuffer,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user