orderv2 add edit_finished
This commit is contained in:
@@ -1667,6 +1667,79 @@ class Orders extends HD_Controller
|
||||
}
|
||||
return $this->show_view('receiver/orderv2/edit_status');
|
||||
}
|
||||
//修改支付订单状态-一键完成
|
||||
public function edit_finished(){
|
||||
if($this->input->method()=='post'){
|
||||
$id = $this->input->post('id');
|
||||
if (!$id){
|
||||
return $this->show_json(SYS_CODE_FAIL, '订单id必须填写');
|
||||
}
|
||||
|
||||
$row = $this->receiver_orders_v2_model->get(['id'=>$id]);
|
||||
if(!$row){
|
||||
return $this->show_json(SYS_CODE_FAIL, '订单不存在');
|
||||
}
|
||||
if($row['status']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '订单无法操作');
|
||||
}
|
||||
|
||||
$now_time = date('Y-m-d H:i:s');
|
||||
$jsondata = array();
|
||||
$res_order = $this->receiver_orders_v2_model->update(['status'=>1,'ck_time'=>$now_time],['id'=>$id]);
|
||||
!is_bool($res_order) && $res_order && $jsondata['order.status'] = "{$row['status']}->1";
|
||||
$res = $this->receiver_orders_v2_model->update(['order_time'=>$now_time],['id'=>$id, 'order_time'=>'0000-00-00 00:00:00']);
|
||||
!is_bool($res) && $res && $jsondata['order.order_time'] = "{$row['order_time']}";
|
||||
$res = $this->receiver_orders_v2_model->update(['bill_time'=>$now_time],['id'=>$id, 'bill_time'=>'0000-00-00 00:00:00']);
|
||||
!is_bool($res) && $res && $jsondata['order.bill_time'] = "{$row['bill_time']}";
|
||||
|
||||
$res = $this->orders_status_entity->set_status($id,0,1);
|
||||
$res && $jsondata['set_status_0_1'] = $res;
|
||||
|
||||
$res = $this->orders_status_entity->set_status($id,0,2);
|
||||
$res && $jsondata['set_status_0_2'] = $res;
|
||||
|
||||
if (!$row['payway']){
|
||||
$res = $this->orders_status_entity->set_status($id,1,1);
|
||||
$res && $jsondata['set_status_1_1'] = $res;
|
||||
$res = $this->orders_status_entity->set_status($id,1,2);
|
||||
$res && $jsondata['set_status_1_2'] = $res;
|
||||
}
|
||||
|
||||
$res = $this->orders_status_entity->set_status($id,2,1);
|
||||
$res && $jsondata['set_status_2_1'] = $res;
|
||||
|
||||
$res = $this->orders_status_entity->set_status($id,3,1);
|
||||
$res && $jsondata['set_status_3_1'] = $res;
|
||||
|
||||
$res = $this->orders_status_entity->set_status($id,4,1);
|
||||
$res && $jsondata['set_status_4_1'] = $res;
|
||||
|
||||
$res = $this->orders_status_entity->set_status($id,4,2);
|
||||
$res && $jsondata['set_status_4_2'] = $res;
|
||||
|
||||
$res = $this->orders_status_entity->set_status($id,5,1);
|
||||
$res && $jsondata['set_status_5_1'] = $res;
|
||||
|
||||
$cus_id = $row['customer_id'];
|
||||
$cus = $this->customers_model->get(['id'=>$cus_id]);
|
||||
$res = $this->customers_model->update(['status'=>2,'order_time'=>$now_time],['id'=>$cus_id]);
|
||||
!is_bool($res) && $res && $jsondata['customer.status'] = "{$cus['status']}->2";
|
||||
$res = $this->customers_model->update(['order_time'=>$now_time],['id'=>$cus_id, 'order_time'=>'0000-00-00 00:00:00']);
|
||||
!is_bool($res) && $res && $jsondata['customer.order_time'] = "{$cus['order_time']}";
|
||||
$res && $jsondata['customer.order_time2'] = "{$cus['order_time']}, {$res}";
|
||||
|
||||
$content = '后台一键完成';
|
||||
$cf_platform = 'pc_admin';
|
||||
$this->orders_entity->add_log($id, $this->uid, $this->username, $content, 0, $cf_platform, $jsondata=json_encode($jsondata,JSON_UNESCAPED_UNICODE));
|
||||
|
||||
if($res_order){
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '修改成功');
|
||||
}else{
|
||||
return $this->show_json(SYS_CODE_FAIL, '保存失败');
|
||||
}
|
||||
}
|
||||
return $this->show_json(SYS_CODE_FAIL, '提交失败');
|
||||
}
|
||||
//下载pdf
|
||||
public function get_down(){
|
||||
require_once COMMPATH.'/third_party/TCPDF/tcpdf.php';
|
||||
|
||||
@@ -107,6 +107,8 @@
|
||||
<span style="font-size: 20px">基本信息</span>
|
||||
<span class="ml10">{{info.sid}}</span>
|
||||
<span style="float:right;margin-top:5px">
|
||||
<a :data-update="info.id" data-action="/receiver/orderv2/orders/edit_finished" class="am-btn am-btn-success am-btn-xs"
|
||||
v-if="0==info.status">一键完成</a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="am-panel-bd am-g" style="margin-top: 10px;margin-bottom: 10px;">
|
||||
|
||||
Reference in New Issue
Block a user