取消订单
This commit is contained in:
parent
c4f4653568
commit
6d9772e6c9
|
|
@ -422,6 +422,40 @@ class Order extends Backend
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function delete($ids = null){
|
||||||
|
if (false === $this->request->isPost()) {
|
||||||
|
|
||||||
|
$options = \app\admin\model\Order::DELETED_TYPE;
|
||||||
|
$order = model('order')->get($ids);
|
||||||
|
return $this->fetch('delete',['row' => $order,'options'=>$options]);
|
||||||
|
}
|
||||||
|
$params = $this->request->post('row/a');
|
||||||
|
if (empty($params)) {
|
||||||
|
$this->error(__('Parameter %s can not be empty', ''));
|
||||||
|
}
|
||||||
|
$params = $this->preExcludeFields($params);
|
||||||
|
|
||||||
|
|
||||||
|
$result = false;
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$order = model('order')->get($params['order_id']);
|
||||||
|
if (!$order){
|
||||||
|
$this->error('Not Find');
|
||||||
|
}
|
||||||
|
$params['status'] = \app\admin\model\Order::STATUS_CANCEL;
|
||||||
|
$result = $order->allowField(true)->save($params);
|
||||||
|
Db::commit();
|
||||||
|
} catch (ValidateException | PDOException | Exception $e) {
|
||||||
|
Db::rollback();
|
||||||
|
$this->error($e->getMessage());
|
||||||
|
}
|
||||||
|
if ($result === false) {
|
||||||
|
$this->error(__('No rows were inserted'));
|
||||||
|
}
|
||||||
|
$this->success();
|
||||||
|
}
|
||||||
|
|
||||||
private function filterAreaCodes(array $area_codes)
|
private function filterAreaCodes(array $area_codes)
|
||||||
{
|
{
|
||||||
// 提取所有两位区号
|
// 提取所有两位区号
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,17 @@ class Order extends Model
|
||||||
return $tabStatus[$tab] ?? [];
|
return $tabStatus[$tab] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public const DELETED_TYPE = [
|
||||||
|
1 => '无相关师傅',
|
||||||
|
2 => '距离客户太远',
|
||||||
|
3 => '价格不同意',
|
||||||
|
4 => '重复订单',
|
||||||
|
5 => '联系客户已晚',
|
||||||
|
6 => '询价后没有后续',
|
||||||
|
7 => '一直联系不上',
|
||||||
|
8 => '客户不能久等',
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
public function incomeBtnStatus(){
|
public function incomeBtnStatus(){
|
||||||
return array_merge($this->tabStatus(self::TAB_PENDING),[self::STATUS_AUDITING]);
|
return array_merge($this->tabStatus(self::TAB_PENDING),[self::STATUS_AUDITING]);
|
||||||
|
|
|
||||||
40
application/admin/view/order/delete.html
Normal file
40
application/admin/view/order/delete.html
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('order/delete')}">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">订单编号</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<input id="c-order_id"
|
||||||
|
disabled
|
||||||
|
class="form-control" type="text" value="{$row->order_no}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="row[order_id]" value="{$row->id}" >
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2">作废原因:</label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<select id="c-coupon" title="请选择" data-rule="required" name="row[cancel_reason_id]" class="form-control selectpicker">
|
||||||
|
{foreach $options as $key=>$item}
|
||||||
|
<option {if $key == $row.cancel_reason_id} selected {/if} value="{$key}">{$item}</option>
|
||||||
|
{/foreach}
|
||||||
|
</select>
|
||||||
|
</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">
|
||||||
|
<textarea id="c-detail" data-rule="required" class="form-control" rows="5" name="row[cancel_detail]" cols="50">{$row->cancel_detail}</textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group layer-footer">
|
||||||
|
<label class="control-label col-xs-12 col-sm-2"></label>
|
||||||
|
<div class="col-xs-12 col-sm-8">
|
||||||
|
<button type="submit" class="btn btn-primary btn-embossed">{:__('OK')}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
@ -1,5 +1,14 @@
|
||||||
<div class="panel panel-default panel-intro">
|
<div class="panel panel-default panel-intro">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="panel-heading">
|
||||||
|
{:build_heading(null,FALSE)}
|
||||||
|
<ul class="nav nav-tabs" data-field="status">
|
||||||
|
<li class="{:$Think.get.status === (string)1 ? 'active' : ''}"><a href="#t-active" data-value="1" data-toggle="tab">正常订单</a></li>
|
||||||
|
<li class="{:$Think.get.status === (string)2 ? 'active' : ''}"><a href="#t-cancel" data-value="2" data-toggle="tab">取消订单</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<div class="tab-pane fade active in" id="one">
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,5 @@
|
||||||
<div class="panel panel-default panel-intro">
|
<div class="panel panel-default panel-intro">
|
||||||
|
|
||||||
<div class="panel-heading">
|
|
||||||
{:build_heading(null,FALSE)}
|
|
||||||
<ul class="nav nav-tabs" data-field="status">
|
|
||||||
<li class="{:$Think.get.status === null ? 'active' : ''}"><a href="#t-all" data-value="" data-toggle="tab">{:__('All')}</a></li>
|
|
||||||
{foreach name="statusList" item="vo"}
|
|
||||||
<li class="{:$Think.get.status === (string)$key ? 'active' : ''}"><a href="#t-{$key}" data-value="{$key}" data-toggle="tab">{$vo}</a></li>
|
|
||||||
{/foreach}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div id="myTabContent" class="tab-content">
|
<div id="myTabContent" class="tab-content">
|
||||||
<div class="tab-pane fade active in" id="one">
|
<div class="tab-pane fade active in" id="one">
|
||||||
|
|
|
||||||
|
|
@ -203,6 +203,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
|
||||||
icon: 'fa fa-bolt',
|
icon: 'fa fa-bolt',
|
||||||
url: 'order/addAbnormal',
|
url: 'order/addAbnormal',
|
||||||
refresh:true,
|
refresh:true,
|
||||||
|
}, {
|
||||||
|
name: 'delete',
|
||||||
|
text: '取消',
|
||||||
|
title: '取消',
|
||||||
|
classname: 'btn btn-xs btn-danger btn-dialog',
|
||||||
|
icon: 'fa fa-trash',
|
||||||
|
url: 'order/delete',
|
||||||
|
visible: function (row) {
|
||||||
|
//返回true时按钮显示,返回false隐藏
|
||||||
|
return true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
@ -304,6 +315,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form','cascader'], function
|
||||||
// return false;
|
// return false;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
delete: function () {
|
||||||
|
console.log('delete');
|
||||||
|
Form.api.bindevent($("form[role=form]"));
|
||||||
|
},
|
||||||
api: {
|
api: {
|
||||||
bindevent: function () {
|
bindevent: function () {
|
||||||
Form.api.bindevent($("form[role=form]"));
|
Form.api.bindevent($("form[role=form]"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user