追加功能 #477
v4.0: Logistics - Shipping Cost Calculator
Start date:
06/23/2025
Due date:
07/04/2025
% Done:
100%
Estimated time:
50.00 h
Description
Background
Task Details
- 1. Shipping Cost Calculator
- Git提交
#xxx(redmine number): xxx(redmine title) - xxx(任意:补充内容)
- 代码规范
2.1: 结构:Public -> Protected -> Private
2.2: 其他代码规范同SBX
- MVCL的v3/v4物理分割
3.1: v3/v4的代码分为两个文件,比如: order.php, order_v3.php
3.2: system也分为两个文件,暂时只有一个user_v3
- Note: front的$this->user在v4中会替换为$this->customer, 即v4中需要清除$this->user
3.3: 代码中,区分v3/v4的调用,比如:new User_V3
- 前台代码
twig, js, css (js, css尽量写在单独的css文件中)
- 后台代码
MVCL (L:en,cn)
- 注释
- 类名:
/** * xxx * * @copyright RedBlue-OTS 2024 * @version v4 * */
- 函数名:参数类型 + 返回值类型
/** * xxx * * @param xxx $xxx * @param xxx $xxx * @return xxx */
- 类名:
- Report and Solution
Others
Related issues
Updated by Junyi Zhang 6 months ago
Output (2025/08/01), (2025/07/07),(2025/07/01 - 2025/07/04):
DONE:- Functions:
- 在运输主页模块添加“运费计算器”模块。
- 区域一(编辑shipping suppliers区域)(仅限桌面版):
- 支持编辑不同国家/地区的运输供应商:目前,仅支持“CN”、“SK”作为位置国家/地区。(countries数据源取自admin country模块,且使用常量限制显示的国家)
- 支持在同一运输供应商类型(express、air、train、boat、others)中重新排序,否则显示警告框并恢复排序。
- 支持在同一运输供应商类型中添加新的运输供应商。
- 支持使用不同货币编辑运输供应商成本价格:目前,CN => 人民币,SE => 瑞典克朗。
- 单价 21kg- 含所有附加费和单价 21kg+ 含所有附加费的结果。所有附加费:(单价21kg+旺季附加费) * (1+燃油附加费/100) - 运费计算器:根据区域二(CTN Parameters)或区域三(Total Parameters)计算运输供应商的总成本和交货时间。
- 客户需要提供CTN参数或总参数
- CTN参数验证:客户需要提供CTN毛重或CTN尺寸(长、宽、高)参数。
- 总成本 = 总重量 * 单价 + (CTN)长度超尺寸(其中一边大于120)+ (CTN)整箱超尺寸(整箱尺寸大于300)+ (CTN)超重(总重量大于30) - 权限:
- 区域一(编辑shipping suppliers区域)仅允许display_shipping = 1的公司查看或编辑。
- 区域二和区域三(运费计算器)允许所有客户查看和使用。 - 替换 v3 中hardcode的 TRACKING_TYPE_TEXT 和 CUSTOMER_SHIP_TO。
- 由于 TRACKING_TYPE_TEXT 和 CUSTOMER_SHIP_TO 在 V3 中仍然使用,我们还将 v3 和 v4 中的“logistics”分别拆分为“logictic_v3”和“shipping”。 - 支持按货币计算总费用: (从 https://www.boc.cn/sourcedb/whpj/ 获取,取第一页的最新数据,取‘现汇买入价’)
- 解析https://www.boc.cn/sourcedb/whpj/ 的html结构(参考SBX的scan函数),找到特定table的特定td,取得货币。
- 在Currency后面显示当前汇率(此汇率是相对于货源国货币的汇率)
- 报错机制:错误使用trigger_error抛在error.log中, 前端显示常规的alert。
- 显示的currencies取自admin的currency模块,且在web/system/library/cart/currency.php中额外增加两个值: row(在https://www.boc.cn/sourcedb/whpj/网站中的行数), Chinese_title(用于校验当前所取的行是否是目标行)。 - Modify the extra charge(Length Over Size, Whole Over Size and Over Weight) rules in shipping cost calculator.(The following description: use A for Length Over Size, use B for Whole Over Size, use C for Over Weight )
- Only 'CN' calculate extra charge.(Since we only get 'CN' extra charge rules)
- 'Express'(DHL, UPS, FEDEX) type shipping supplier will take extra charge.
- DHL:
- B always 0
- A or C: A or C
- A and C: A - UPS:
- A and B and C: B
- A and B: B
- A and C: A + C
- B and C: B - Fedex:
- A and B and C: A + B
- A and B: A + B
- A and C: A
- B and C: B + C
- DHL:
Database: 参考 #440