feat: 【后台配置订单列表】新增是否使用材料、材料凭证图片组字段

This commit is contained in:
gcd 2025-05-30 23:52:11 +08:00
parent 0be26ff745
commit b6d2aa21e9
3 changed files with 20 additions and 12 deletions

View File

@ -61,4 +61,18 @@ class Order extends Model
return $images;
}
public function getMaterialImagesAttr($val)
{
if (empty($val)) {
return [];
}
$images = explode(',', $val);
foreach ($images as $k => $v) {
$images[$k] = cdnurl($v, true);
}
return $images;
}
}

View File

@ -228,6 +228,9 @@ class OrderDispatchService extends BaseService
'images',
'status',
'coupon_id',
'is_material_used',
'material_cost',
'material_images',
];
$orderDispatchFields = [
'id',

View File

@ -62,25 +62,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
{field: 'real_amount', title: __('Real_amount'), operate:false},
{field: 'cost', title: __('Cost'), operate:false},
{
field: 'material_cost_text', title: '材料',
field: 'material_cost_text', title: '材料成本',
operate: false,
cellStyle: {css: {"text-align": "left !important"}},
formatter: function (val, row) {
let status = {
"0": "<span style='color: orange'>未使用</span>",
"1": "<span style='color: green'>已使用</span>",
}
let res = `
<span>是否使用材料${status[row.is_material_used]}</span><br>
`;
if (row.is_material_used === 1) {
res += `<span>材料成本:¥${row.material_cost}</span><br>`
return `¥${row.material_cost}`
}
return res
return '无'
}},
{field: 'material_images', title: __('材料凭证'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
{field: 'performance', title: __('Performance'), operate:false},
// {field: 'dispatch_type', title: __('Dispatch_type')},