From c5cd79edd5fa24e5e85df9007842911fc16c4dc1 Mon Sep 17 00:00:00 2001
From: xman <1946321327@qq.com>
Date: Mon, 2 Jun 2025 18:37:32 +0800
Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E9=97=A8=E5=89=8D=E6=8F=90=E9=86=92?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../admin/behavior/OrderDispatchLog.php | 21 +-
.../admin/controller/aftersales/Aftersale.php | 2 +
.../controller/aftersales/Aftersale2.php | 278 ++++++++++++++++++
application/admin/model/TtsLog.php | 26 ++
.../admin/view/aftersales/aftersale2/add.html | 94 ++++++
.../view/aftersales/aftersale2/edit.html | 197 +++++++++++++
.../view/aftersales/aftersale2/index.html | 46 +++
application/common/Logic/NoticeLogic.php | 74 ++++-
.../common/command/CheckOrdeRecordCommand.php | 3 +-
.../common/command/CheckSmsPlantCommand.php | 59 ++++
.../common/command/CheckTTSPlantCommand.php | 55 ++++
.../common/services/alibaba/DyvmsService.php | 4 +-
application/extra/alibaba_dyvms.php | 10 +-
.../js/backend/aftersales/aftersale2.js | 104 +++++++
14 files changed, 958 insertions(+), 15 deletions(-)
create mode 100644 application/admin/controller/aftersales/Aftersale2.php
create mode 100644 application/admin/model/TtsLog.php
create mode 100644 application/admin/view/aftersales/aftersale2/add.html
create mode 100644 application/admin/view/aftersales/aftersale2/edit.html
create mode 100644 application/admin/view/aftersales/aftersale2/index.html
create mode 100644 application/common/command/CheckSmsPlantCommand.php
create mode 100644 application/common/command/CheckTTSPlantCommand.php
create mode 100644 public/assets/js/backend/aftersales/aftersale2.js
diff --git a/application/admin/behavior/OrderDispatchLog.php b/application/admin/behavior/OrderDispatchLog.php
index 21923bd..5a88a91 100644
--- a/application/admin/behavior/OrderDispatchLog.php
+++ b/application/admin/behavior/OrderDispatchLog.php
@@ -2,6 +2,8 @@
namespace app\admin\behavior;
+use app\admin\model\OrderDispatch;
+use app\common\Logic\NoticeLogic;
use think\Exception;
use think\Lang;
@@ -28,7 +30,24 @@ class OrderDispatchLog
'admin_user' => $dispatch->admin_user??'sys',
];
\app\admin\model\OrderDispatchLog::create($data);
- //(new \app\admin\model\OrderDispatchLog())->cre($data);
+
+ if($dispatch->status == OrderDispatch::STATUS_TOGET)
+ {
+ $alibaba_dyvms = config('alibaba_dyvms');
+
+ if($alibaba_dyvms['status']){
+ $data = [
+ 'order_id' => $dispatch->order_id,
+ 'dispatch_id' => $dispatch->id,
+ 'type' => 1,
+ 'outid' => md5(time().rand(1000,9999).rand(1000,9999)),
+ 'craate_time' => date('Y-m-d H:i:s'),
+ 'status' => $alibaba_dyvms['sync']?1:0
+ ];
+ $service = new NoticeLogic();
+ $service->dispatchNotice($dispatch,$data);
+ }
+ }
}catch (Exception $exception){
}
diff --git a/application/admin/controller/aftersales/Aftersale.php b/application/admin/controller/aftersales/Aftersale.php
index 9fb52bd..921a019 100644
--- a/application/admin/controller/aftersales/Aftersale.php
+++ b/application/admin/controller/aftersales/Aftersale.php
@@ -257,6 +257,8 @@ class Aftersale extends Backend
if($params['handle_type'] == 1 && $params['status'] == 2){ //处理完成,重新计算利润
+ $row->refund_status = 1;
+ $row->save();
$order = Order::get($row->order_id);
//重新计算订单利润
$orderLogic = new OrderLogic();
diff --git a/application/admin/controller/aftersales/Aftersale2.php b/application/admin/controller/aftersales/Aftersale2.php
new file mode 100644
index 0000000..85b4181
--- /dev/null
+++ b/application/admin/controller/aftersales/Aftersale2.php
@@ -0,0 +1,278 @@
+model = new \app\admin\model\Aftersale;
+ $this->view->assign("statusList", $this->model->getStatusList());
+ $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());
+ }
+
+
+
+ /**
+ * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+ * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+ * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+ */
+
+
+ /**
+ * 查看
+ */
+ public function index()
+ {
+ //当前是否为关联查询
+ $this->relationSearch = true;
+ //设置过滤方法
+ $this->request->filter(['strip_tags', 'trim']);
+
+ if ($this->request->isAjax()) {
+
+ $from = $this->request->param('from',1);
+ $man_id = $this->request->param('man_id');
+
+ //如果发送的来源是Selectpage,则转发到Selectpage
+ if ($this->request->request('keyField')) {
+ return $this->selectpage();
+ }
+ list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+
+ $builder = $this->model
+ ->where('refund_status','=',1)
+ ->with(['order'])
+ ->where($where);
+
+ if($from == 2){
+ //$builder->where('refund_amount','>',0);
+ //$builder->where('status','<>',-1);
+ $builder->where('fa_aftersale.dispatch_admin_id',$man_id ?: 0);
+
+ }
+
+ if($from == 3){
+ //$builder->where('refund_amount','>',0);
+ //$builder->where('status','<>',-1);
+ $builder->where('fa_aftersale.worker_id',$man_id ?: 0);
+ }
+
+ $list = $builder->order($sort, $order)
+ ->paginate($limit);
+
+ foreach ($list as $row) {
+
+
+ }
+
+ $result = array("total" => $list->total(), "rows" => $list->items());
+
+ return json($result);
+ }
+ return $this->view->fetch();
+ }
+
+ /**
+ * 添加
+ *
+ * @return string
+ * @throws \think\Exception
+ */
+ public function add($ids = null)
+ {
+ if (false === $this->request->isPost()) {
+
+ if ($ids){
+ $order = model('order')->get($ids);
+ $this->view->assign('order',$order);
+ }else{
+ $order_id = $this->request->param('order_id');
+ if(empty($order_id)){
+ $this->error('请选择订单');
+ }
+ $order = Order::get($order_id);
+ if(empty($order)){
+ $this->error('订单不存在');
+ }
+ $this->assign('order',$order);
+ }
+
+ return $this->view->fetch();
+ }
+ $params = $this->request->post('row/a');
+ if (empty($params)) {
+ $this->error(__('Parameter %s can not be empty', ''));
+ }
+ $params = $this->preExcludeFields($params);
+
+ if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+ $params[$this->dataLimitField] = $this->auth->id;
+ }
+ $result = false;
+ Db::startTrans();
+ try {
+ //是否采用模型验证
+ if ($this->modelValidate) {
+ $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+ $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : $name) : $this->modelValidate;
+ $this->model->validateFailException()->validate($validate);
+ }
+ $order = Order::get($params['order_id'],['dispatch']);
+ if(empty($order)){
+ $this->error('订单不存在');
+ }
+ /* if($order->status != Order::STATUS_FINISHED){
+ $this->error('订单不是完成状态,不可创建售后');
+ }*/
+ if(\app\admin\model\Aftersale::where('order_id',$params['order_id'])->find()){
+ $this->error('订单已存在售后信息,不可重复创建');
+ }
+ $params['admin_id'] = $this->auth->id;
+ $params['admin_user'] = $this->auth->nickname;
+ if(!empty($order->dispatch)){
+ $params['worker_id'] = $order->dispatch->worker_id ?? 0;
+ $params['worker_name'] = $order->dispatch->worker_name ?? '';
+ }
+ $params['status'] = 1;
+
+ if($params['type'] == 1){
+ $params['refund_amount'] = bcadd($params['company_refund_amount'] ?? 0,$params['worker_refund_amount']??0,2);
+ }else{
+ unset($params['company_refund_amount']);
+ unset($params['worker_refund_amount']);
+ }
+ $params['dispatch_admin_id'] = $order->dispatch_admin_id ?? 0;
+ $params['dispatch_admin_user'] = $order->dispatch_admin_user ?? '';
+
+ Message::create([
+ 'to_id' => $params['dispatch_admin_id'],
+ 'type' => 1,
+ 'title' => '售后申请通知',
+ 'content' => '【售后申请通知】您有一条售后申请待处理,请前往订单售后界面进行处理!'
+ ]);
+
+ $result = $this->model->allowField(true)->save($params);
+ $order->aftersale_id = $this->model->id;
+ $order->status = Order::STATUS_AFTERSALE;
+ $order->save();
+ Db::commit();
+ } catch (ValidateException|PDOException|Exception $e) {
+ Db::rollback();
+ throw $e;
+// $this->error($e->getMessage());
+ }
+ if ($result === false) {
+ $this->error(__('No rows were inserted'));
+ }
+ $this->success();
+ }
+
+ /**
+ * 编辑
+ *
+ * @param $ids
+ * @return string
+ * @throws DbException
+ * @throws \think\Exception
+ */
+ public function edit($ids = null)
+ {
+ $row = $this->model->get($ids);
+ if (!$row) {
+ $this->error(__('No Results were found'));
+ }
+ $adminIds = $this->getDataLimitAdminIds();
+ if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) {
+ $this->error(__('You have no permission'));
+ }
+ if (false === $this->request->isPost()) {
+ $order = Order::get($row->order_id);
+ if(empty($order)){
+ $this->error('订单不存在');
+ }
+ $this->view->assign('order',$order);
+ $this->view->assign('row', $row);
+ return $this->view->fetch();
+ }
+ $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 {
+ //是否采用模型验证
+ if ($this->modelValidate) {
+ $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+ $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+ $row->validateFailException()->validate($validate);
+ }
+ $params['handle_admin_id'] = $this->auth->id;
+ $params['handle_admin_user'] = $this->auth->nickname;
+ if($params['handle_type'] == 1){
+ $params['refund_amount'] = bcadd($params['company_refund_amount'],$params['worker_refund_amount'],2);
+ }else{
+ unset($params['company_refund_amount']);
+ unset($params['worker_refund_amount']);
+ }
+
+ if(empty($params['company_refund_time'])){
+ $params['company_refund_time'] = date('Y-m-d H:i:s');
+ }
+ if(empty($params['worker_refund_time'])){
+ $params['worker_refund_time'] = date('Y-m-d H:i:s');
+ }
+
+ $result = $row->allowField(true)->save($params);
+
+ if($params['handle_type'] == 1 && $params['status'] == 2){ //处理完成,重新计算利润
+
+ $order = Order::get($row->order_id);
+ //重新计算订单利润
+ $orderLogic = new OrderLogic();
+ $orderLogic->recacle($order,$row);
+ }
+ Db::commit();
+ } catch (ValidateException|PDOException|Exception $e) {
+ Db::rollback();
+ $this->error($e->getMessage());
+ }
+ if (false === $result) {
+ $this->error(__('No rows were updated'));
+ }
+ $this->success();
+ }
+
+
+}
diff --git a/application/admin/model/TtsLog.php b/application/admin/model/TtsLog.php
new file mode 100644
index 0000000..467d975
--- /dev/null
+++ b/application/admin/model/TtsLog.php
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/application/admin/view/aftersales/aftersale2/edit.html b/application/admin/view/aftersales/aftersale2/edit.html
new file mode 100644
index 0000000..a241227
--- /dev/null
+++ b/application/admin/view/aftersales/aftersale2/edit.html
@@ -0,0 +1,197 @@
+
diff --git a/application/admin/view/aftersales/aftersale2/index.html b/application/admin/view/aftersales/aftersale2/index.html
new file mode 100644
index 0000000..d4c3045
--- /dev/null
+++ b/application/admin/view/aftersales/aftersale2/index.html
@@ -0,0 +1,46 @@
+
+
+
+ {:build_heading(null,FALSE)}
+
+
+
+
+
+
diff --git a/application/common/Logic/NoticeLogic.php b/application/common/Logic/NoticeLogic.php
index f92b887..057fbaa 100644
--- a/application/common/Logic/NoticeLogic.php
+++ b/application/common/Logic/NoticeLogic.php
@@ -2,6 +2,8 @@
namespace app\common\Logic;
+use AlibabaCloud\SDK\Dyvmsapi\V20170525\Models\SingleCallByTtsResponse;
+use app\common\model\OrderDispatch;
use app\common\services\alibaba\DyvmsService;
use think\Exception;
@@ -11,25 +13,81 @@ use think\Exception;
class NoticeLogic
{
+ const TTS_DISPATCH1 ='TTS_313465270'; //手动派单通知
+ const TTS_DISPATCH2 ='TTS_313485240'; //手动派单通知
+ const TTS_OVER_FINISHED = 'TTS_315365191'; //完成时间已过
+ const TTS_GOGOGO = 'TTS_313570203'; //上门前一小时打电话通知师傅
+
public function __construct($types = [])
{
}
+ public function callIt($log)
+ {
+ $dispatch = OrderDispatch::get($log->dispatch_id);
+ //1=派单,2=提前通知,3=超时通知
+ $ttsCode = null;
+ $dispatch->tts_check_time = date('Y-m-d H:i:s',time()+5*60);
+ if($log->type == 1)
+ {
+ $dispatch->tts_notice = 1;
+ if($dispatch->type == 1){
+ $ttsCode = self::TTS_DISPATCH1;
+ $dispatch->save();
+ }else{
+ $ttsCode = self::TTS_DISPATCH2;
+ }
+ }elseif($log->type == 2)
+ {
+ $dispatch->tts_notice = 2;
+ $ttsCode = self::TTS_GOGOGO;
+ }elseif($log->type == 3){
+ $dispatch->tts_notice = 3;
+ $ttsCode = self::TTS_OVER_FINISHED;
+ }
+ if(empty($ttsCode)){
+ $log->status = -1;
+ $log->content = 'TTSID为空';
+ $log->save();
+ }
+ try {
+ $reponse = DyvmsService::getInstance()->call($dispatch->worker_tel, $ttsCode, md5(time()));
+
+ if($reponse->statusCode == 200 && $reponse->body->code == 'OK'){
+ $log->status = 1;
+ $log->callId = $reponse->body->callId;
+ $log->save();
+ }else{
+ $log->status = -1;
+ $log->content = $reponse->body->message;
+ $log->save();
+ }
+ }catch (Exception $exception){
+ $log->status = -1;
+ $log->content = $exception->getMessage();
+ $log->save();
+ }
+ }
+
/**
* 派单通知
- * @return void
+ * @return SingleCallByTtsResponse|array
*/
- public function dispatchNotice($dispatch,$type)
+ public function dispatchNotice($dispatch): array|SingleCallByTtsResponse
{
- $ttsCode = '';
- $outId = '';
- try {
- $reponse = DyvmsService::getInstance()->call($dispatch->worker_tel, $ttsCode, $outId);
- }catch (Exception $exception){
- dump($exception->getMessage());
+ if($dispatch->type == 1){
+ $ttsCode = self::TTS_DISPATCH1;
+ }else{
+ $ttsCode = self::TTS_DISPATCH2;
}
+ try {
+ $reponse = DyvmsService::getInstance()->call($dispatch->worker_tel, $ttsCode, md5(time()));
+ }catch (Exception $exception){
+ throw $exception;
+ }
+ return $reponse;
}
diff --git a/application/common/command/CheckOrdeRecordCommand.php b/application/common/command/CheckOrdeRecordCommand.php
index 0f42ffd..8a678d1 100644
--- a/application/common/command/CheckOrdeRecordCommand.php
+++ b/application/common/command/CheckOrdeRecordCommand.php
@@ -6,6 +6,8 @@ use app\admin\model\Message;
use app\admin\model\OrderDispatch;
use app\admin\model\OrderDispatchRecord;
+use app\admin\model\TtsLog;
+use app\common\Logic\NoticeLogic;
use think\console\Command;
use think\console\Input;
use think\console\Output;
@@ -19,7 +21,6 @@ class CheckOrdeRecordCommand extends Command
}
protected function execute(Input $input, Output $output){
-
$Model = new OrderDispatchRecord();
$now = date('Y-m-d H:i:s'); //创建三十分名以上未接的任务
diff --git a/application/common/command/CheckSmsPlantCommand.php b/application/common/command/CheckSmsPlantCommand.php
new file mode 100644
index 0000000..d24d433
--- /dev/null
+++ b/application/common/command/CheckSmsPlantCommand.php
@@ -0,0 +1,59 @@
+setName('check:dispatch-sms-plant')
+ ->setDescription('dispatch已预约任务短信提醒,每小时执行一次');
+ }
+
+ protected function execute(Input $input, Output $output){
+ $Model = new OrderDispatch();
+ $now = date('Y-m-d H:i:s'); //两小时通知
+ $afterTwoHours = date('Y-m-d H:i:s', strtotime('+2 hours'));
+
+
+ $logic = new SendMailLogic();
+ //$Model->where('need_notice',1)
+ $Model->where('status','=',OrderDispatch::STATUS_PLANIT)
+ ->where('plan_time','between',[$now,$afterTwoHours])
+ ->where('notice_num','<',3)
+ ->chunk(100, function ($list)use ($logic) {
+ $ids = [];
+ $logs = [];
+ foreach ($list as $item) {
+ $ids[] = $item->id;
+ //修改状态
+ /* $logs[] = [
+ 'dispatch_id' => $item->id,
+ 'order_id'=>$item->order_id,
+ 'type' => 2,
+ 'outid' => md5(time().rand(1000,9999).rand(1000,9999)),
+ 'create_time' => date('Y-m-d H:i:s'),
+ 'status' => 0,
+ 'update_time' => date('Y-m-d H:i:s')
+ ];
+ (new TtsLog())->insertAll($logs);*/
+ SendMailLogic::sendToWorker($item->worker_tel);
+ }
+ if(!empty($ids)){
+ OrderDispatch::whereIn('id',$ids)->update(['notice_num'=>3,'notice_time'=>date('Y-m-d H:i:s')]);
+ }
+ });
+ $output->info('OVER');
+ }
+}
\ No newline at end of file
diff --git a/application/common/command/CheckTTSPlantCommand.php b/application/common/command/CheckTTSPlantCommand.php
new file mode 100644
index 0000000..15c09c7
--- /dev/null
+++ b/application/common/command/CheckTTSPlantCommand.php
@@ -0,0 +1,55 @@
+setName('check:dispatch-tts-plant')
+ ->setDescription('dispatch已预约任务语音提醒,每小时执行一次');
+ }
+
+ protected function execute(Input $input, Output $output){
+ $Model = new OrderDispatch();
+ $now = date('Y-m-d H:i:s'); //两小时通知
+ $afterTwoHours = date('Y-m-d H:i:s', strtotime('+1 hours'));
+
+ //$Model->where('need_notice',1)
+ $Model->where('status','=',OrderDispatch::STATUS_PLANIT)
+ ->where('plan_time','between',[$now,$afterTwoHours])
+ ->where('tts_notice','<',2)
+ ->chunk(100, function ($list) {
+ $ids = [];
+ $logs = [];
+ foreach ($list as $item) {
+ $ids[] = $item->id;
+ //修改状态
+ $logs[] = [
+ 'dispatch_id' => $item->id,
+ 'order_id'=>$item->order_id,
+ 'type' => 2,
+ 'outid' => md5(time().rand(1000,9999).rand(1000,9999)),
+ 'create_time' => date('Y-m-d H:i:s'),
+ 'status' => 0,
+ 'update_time' => date('Y-m-d H:i:s')
+ ];
+ (new TtsLog())->insertAll($logs);
+ }
+ if(!empty($ids)){
+ OrderDispatch::whereIn('id',$ids)->update(['tts_notice'=>2,'tts_check_time'=>date('Y-m-d H:i:s')]);
+ }
+ });
+ $output->info('OVER');
+ }
+}
\ No newline at end of file
diff --git a/application/common/services/alibaba/DyvmsService.php b/application/common/services/alibaba/DyvmsService.php
index 1bfd5fc..ef50a0c 100644
--- a/application/common/services/alibaba/DyvmsService.php
+++ b/application/common/services/alibaba/DyvmsService.php
@@ -17,7 +17,7 @@ class DyvmsService
// 私有构造函数,防止外部直接实例化
private function __construct($options = [])
{
- $config = Env::get('alibaba_dyvms');
+ $config = \config('alibaba_dyvms');
if (!empty($options)) {
$config = array_merge($config, $options);
}
@@ -39,7 +39,7 @@ class DyvmsService
}
// 防止反序列化
- private function __wakeup()
+ public function __wakeup()
{
}
diff --git a/application/extra/alibaba_dyvms.php b/application/extra/alibaba_dyvms.php
index ee15bd7..85b7fc0 100644
--- a/application/extra/alibaba_dyvms.php
+++ b/application/extra/alibaba_dyvms.php
@@ -2,11 +2,15 @@
return [
- 'accessKeyId' => '',
+ 'accessKeyId' => 'LTAI5t87F5mAkaXVKfLcmnrB',
- 'accessKeySecret' => '',
+ 'accessKeySecret' => 'fk7KgdqRdJUS6Jc99TlB6mNLKorrsD',
- 'regionId' => '', //可用区ID
+ 'regionId' => 'cn-chengdu', //可用区ID
'calledShowNumber' => '', //专属号码
+
+ 'sync' => true, //同步
+
+ 'status' => true, //true启用,0关闭
];
\ No newline at end of file
diff --git a/public/assets/js/backend/aftersales/aftersale2.js b/public/assets/js/backend/aftersales/aftersale2.js
new file mode 100644
index 0000000..4cf7d4b
--- /dev/null
+++ b/public/assets/js/backend/aftersales/aftersale2.js
@@ -0,0 +1,104 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+ var Controller = {
+ index: function () {
+ // 初始化表格参数配置
+ Table.api.init({
+ extend: {
+ index_url: 'aftersales/aftersale2/index' + location.search,
+ add_url: 'aftersales/aftersale2/add',
+ edit_url: 'aftersales/aftersale2/edit',
+ // del_url: 'aftersales/aftersale/del',
+ multi_url: 'aftersales/aftersale2/multi',
+ import_url: 'aftersales/aftersale2/import',
+ table: 'aftersale',
+ }
+ });
+
+ var table = $("#table");
+
+ // 初始化表格
+ table.bootstrapTable({
+ url: $.fn.bootstrapTable.defaults.extend.index_url,
+ pk: 'id',
+ sortName: 'id',
+ fixedColumns: true,
+ fixedRightNumber: 1,
+ columns: [
+ [
+ // {checkbox: true},
+ {field: 'id', title: __('Id')},
+ // {field: 'order_id', title: __('Order_id')},
+ {field: 'order.order_no', title: __('Order.order_no'), operate: '='},
+ {field: 'order.customer', title: __('Order.customer'), operate: false},
+ {field: 'order.tel', title: __('Order.tel'), operate: '='},
+ {field: 'status', title: __('Status'), searchList: {"1":__('Status 1'),"2":__('Status 2'),
+ //"3":__('Status 3'),
+ "-1":__('Status -1')}, formatter: Table.api.formatter.status},
+ {field: 'handle_type', title: __('Handle_type'), searchList: {"1":__('Handle_type 1'),"2":__('Handle_type 2'),"3":__('Handle_type 3'),"4":__('Handle_type 4')}, formatter: Table.api.formatter.normal},
+ {field: 'from', title: __('From'), searchList: {"1":__('From 1'),"2":__('From 2'),"3":__('From 3')}, formatter: Table.api.formatter.normal},
+ {field: 'refund_amount', title: __('Refund_amount'), operate:false},
+ {field: 'company_refund_amount', title: __('Company_refund_amount'), operate:false},
+ {field: 'worker_refund_amount', title: __('Worker_refund_amount'), operate:false},
+ {field: 'refund_type', title: __('Refund_type'), searchList: {"0":__('Refund_type 0'),"1":__('Refund_type 1'),"2":__('Refund_type 2')}, formatter: Table.api.formatter.normal},
+ {field: 'worker_refund_entry', title: __('Worker_refund_entry'), searchList: {"0":__('Worker_refund_entry 0'),"1":__('Worker_refund_entry 1')}, formatter: Table.api.formatter.normal},
+ {field: 'company_refund_time', title: __('Company_refund_time'), operate:false, addclass:'datetimerange', autocomplete:false},
+ {field: 'worker_refund_time', title: __('Worker_refund_time'), operate:false, addclass:'datetimerange', autocomplete:false},
+ //{field: 'refund_time', title: __('Refund_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
+ {field: 'customer_appeal', title: __('Customer_appeal'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+ //{field: 'customer_qrcode', title: __('Customer_qrcode'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+
+ {field: 'customer_qrcode', title: __('Customer_qrcode'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
+
+ {field: 'images', title: __('Images'), operate: false, events: Table.api.events.image, formatter: Table.api.formatter.images},
+ {field: 'remark', title: __('Remark'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+
+ {field: 'dispatch_admin_user', title: __('派单员'), operate: '='},
+
+ //{field: 'admin_id', title: __('Admin_id')},
+ {field: 'admin_user', title: __('Admin_user'), operate: '='},
+ //{field: 'handle_admin_id', title: __('Handle_admin_id')},
+ {field: 'handle_admin_user', title: __('Handle_admin_user'), operate: '='},
+ {field: 'star', title: __('Star'),operate:false},
+ {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
+ {field: 'update_time', title: __('Update_time'), operate:false, addclass:'datetimerange', autocomplete:false},
+ {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
+ buttons: [
+ {
+ name: 'edit',
+ text:"处理",
+ title:"售后处理",
+ icon: 'fa fa-pencil',
+ //title: __('Edit'),
+ extend: 'data-toggle="tooltip" data-container="body"',
+ classname: 'btn btn-xs btn-success btn-editone',
+ visible:function(row){
+ if(row.status === 1){
+ return true;
+ }
+ return false;
+ }
+ }
+ ],
+ }
+ ]
+ ]
+ });
+
+ // 为表格绑定事件
+ Table.api.bindevent(table);
+ },
+ add: function () {
+ Controller.api.bindevent();
+ },
+ edit: function () {
+ Controller.api.bindevent();
+ },
+ api: {
+ bindevent: function () {
+ Form.api.bindevent($("form[role=form]"));
+ }
+ }
+ };
+ return Controller;
+});