完成订单重构

This commit is contained in:
xman 2025-06-01 23:18:37 +08:00
parent 2bdb613f78
commit 1db3b3c9fd
4 changed files with 37 additions and 30 deletions

View File

@ -35,6 +35,7 @@ class Aftersale extends Backend
$this->view->assign("handleTypeList", $this->model->getHandleTypeList());
$this->view->assign("fromList", $this->model->getFromList());
$this->view->assign("refundTypeList", $this->model->getRefundTypeList());
$this->view->assign("typeList", $this->model->getTypeList());
$this->view->assign("workerRefundEntryList", $this->model->getWorkerRefundEntryList());
}

View File

@ -12,7 +12,7 @@ return [
'Set status to 3' => '设为已退款',
'Status -1' => '已作废',
'Set status to -1' => '设为已作废',
'Handle_type' => '办结类型',
'Handle_type' => '办结方式',
'Handle_type 1' => '退款',
'Handle_type 2' => '返修',
'Handle_type 3' => '客户无理取闹',

View File

@ -29,7 +29,8 @@ class Aftersale extends Model
'handle_type_text',
'from_text',
'refund_type_text',
'worker_refund_entry_text'
'worker_refund_entry_text',
'type_text'
];
@ -57,6 +58,11 @@ class Aftersale extends Model
return ['0' => __('Refund_type 0'),'1' => __('Refund_type 1'), '2' => __('Refund_type 2')];
}
public function getTypeList()
{
return ['1' => __('退款'),'2' => __('返修'), '3' => __('其它')];
}
public function getWorkerRefundEntryList()
{
return ['0' => __('Worker_refund_entry 0'), '1' => __('Worker_refund_entry 1')];
@ -79,6 +85,14 @@ class Aftersale extends Model
}
public function getTypeTextAttr($value, $data)
{
$value = $value ?: ($data['type'] ?? '');
$list = $this->getTypeList();
return $list[$value] ?? '';
}
public function getFromTextAttr($value, $data)
{
$value = $value ?: ($data['from'] ?? '');

View File

@ -25,24 +25,13 @@
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">请求售后类型:</label>
<div class="col-xs-12 col-sm-8">
<select data-live-search="true" title="请选择" data-rule="required" name="row[type]" class="form-control">
<option {if $row['type'] == 1} selected {/if} value="1">退款</option>
<option {if $row['type'] == 2} selected {/if} value="2">返修</option>
<option {if $row['type'] == 3} selected {/if} value="3">其它</option>
</select>
<input id="c-type" class="form-control" readonly type="text" value="{$row.type_text|htmlentities}">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">办结方式:</label>
<div class="col-xs-12 col-sm-8">
<select data-live-search="true" title="请选择" data-rule="required" name="row[type]" class="form-control">
<option {if $row['handle_type'] == 1} selected {/if} value="1">退款</option>
<option {if $row['handle_type'] == 2} selected {/if} value="2">返修</option>
<option {if $row['handle_type'] == 3} selected {/if} value="3">其它</option>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('From')}:</label>
<div class="col-xs-12 col-sm-8">
@ -56,6 +45,22 @@
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Handle_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-handle_type" data-rule="required" class="form-control selectpicker" name="row[handle_type]">
{foreach name="handleTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.handle_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Company_refund_amount')}:</label>
<div class="col-xs-12 col-sm-8">
@ -179,19 +184,6 @@
</div>
<div class="form-group">
<label class="control-label col-xs-12 col-sm-2">{:__('Handle_type')}:</label>
<div class="col-xs-12 col-sm-8">
<select id="c-handle_type" data-rule="required" class="form-control selectpicker" name="row[handle_type]">
{foreach name="handleTypeList" item="vo"}
<option value="{$key}" {in name="key" value="$row.handle_type"}selected{/in}>{$vo}</option>
{/foreach}
</select>
</div>
</div>
{if condition='$row.status eq 1'}