feat: 重构商品定价系统,新增步梯搬运费配置与支付台账统计
- 新增商品服务定价配置表,支持多规格服务价格体系 - 新增步梯搬运费配置功能,可按楼层阶梯收费 - 重构支付订单台账,新增核心数据统计卡片 - 优化下单流程,支持定价配置校验与增项计算 - 整合财务配置,移除独立充值配置菜单
这个提交包含在:
@@ -297,6 +297,8 @@ class Order extends Base
|
||||
'spec_id' => $specId,
|
||||
'service_type' => $reqServiceType,
|
||||
'is_custom' => $isCustom,
|
||||
'pricing_revision' => $this->request->post('pricing_revision'),
|
||||
'extras' => $this->request->post('extras/a', []),
|
||||
'strict' => true,
|
||||
], 0, $this->uid(), $priceType, $userPrice, $goodsList);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
@@ -304,6 +306,32 @@ class Order extends Base
|
||||
return;
|
||||
}
|
||||
|
||||
$pricedLines = $amount['lines'];
|
||||
if (!$goodsList && isset($pricedLines[0])) {
|
||||
$goodsList = [[
|
||||
'service_id' => $serviceId, 'spec_id' => $specId, 'goods_num' => $goodsNum,
|
||||
'goods_name' => $serviceName, 'goods_model' => $goodsModel,
|
||||
]];
|
||||
}
|
||||
foreach ($pricedLines as $index => $line) {
|
||||
unset($goodsList[$index]['service_types'], $goodsList[$index]['legacy_addons'], $goodsList[$index]['addons']);
|
||||
$goodsList[$index] = array_replace($goodsList[$index], [
|
||||
'item_name' => $line['item_name'],
|
||||
'spec_id' => $line['spec_id'],
|
||||
'spec_name' => $line['spec_name'],
|
||||
'unit' => $line['unit'],
|
||||
'service_type' => $line['service_type'],
|
||||
'service_type_name' => $line['service_type_name'],
|
||||
'base_price' => $line['base_price'],
|
||||
'extras' => $line['extras'],
|
||||
'pricing_revision' => $line['revision'],
|
||||
'addon_services' => implode(';', array_merge(
|
||||
[$line['service_type_name'] . 'x' . max(1, (int)($goodsList[$index]['num'] ?? $goodsList[$index]['goods_num'] ?? 1))],
|
||||
array_map(function ($addon) { return $addon['name'] . 'x' . $addon['num']; }, $line['extras'])
|
||||
)),
|
||||
]);
|
||||
}
|
||||
|
||||
if (in_array($priceType, ['fixed', 'range'], true) && (float)$amount['total_amount'] <= 0) {
|
||||
$this->error('一口价订单必须关联有效的平台服务项目');
|
||||
}
|
||||
@@ -488,7 +516,7 @@ class Order extends Base
|
||||
}
|
||||
|
||||
if (!empty($goodsList) && is_array($goodsList)) {
|
||||
foreach ($goodsList as $g) {
|
||||
foreach ($goodsList as $index => $g) {
|
||||
if (!is_array($g)) {
|
||||
continue;
|
||||
}
|
||||
@@ -538,7 +566,9 @@ class Order extends Base
|
||||
|
||||
$gSid = isset($g['service_id']) ? (int)$g['service_id'] : (int)$serviceId;
|
||||
$gUnitPrice = round((float)$amount['base_amount'] / max(1, (int)$goodsNum), 2);
|
||||
if ($gSid > 0 && in_array($priceType, ['fixed', 'range'], true)) {
|
||||
if (isset($pricedLines[$index])) {
|
||||
$gUnitPrice = $pricedLines[$index]['base_price'] ?? 0;
|
||||
} elseif ($gSid > 0 && in_array($priceType, ['fixed', 'range'], true)) {
|
||||
$gSvc = Db::name('service')->where('id', $gSid)->find();
|
||||
if ($gSvc && (float)$gSvc['base_price'] > 0) {
|
||||
$gUnitPrice = (float)$gSvc['base_price'];
|
||||
|
||||
在新工单中引用
屏蔽一个用户