正在显示
12 个修改的文件
包含
302 行增加
和
58 行删除
@@ -203,5 +203,76 @@ class Car extends Backend | @@ -203,5 +203,76 @@ class Car extends Backend | ||
203 | $this->success(); | 203 | $this->success(); |
204 | } | 204 | } |
205 | 205 | ||
206 | + function getAccessToken() { | ||
207 | + $appId = "wx58ceff4e93cfc523"; | ||
208 | + $appSecret = "baf744d21875280a5e98611f66adaf91"; | ||
209 | + $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appId}&secret={$appSecret}"; | ||
210 | + $result = json_decode(file_get_contents($url), true); | ||
211 | + return $result["access_token"] ?? null; | ||
212 | + } | ||
213 | + | ||
214 | + function createMiniProgramQRCode($accessToken, $path, $width = 430) { | ||
215 | + $url = "https://api.weixin.qq.com/wxa/getwxacode?access_token={$accessToken}"; | ||
216 | + | ||
217 | + $data = json_encode([ | ||
218 | + 'path' => $path, | ||
219 | + 'width' => $width | ||
220 | + ]); | ||
221 | + $options = [ | ||
222 | + 'http' => [ | ||
223 | + 'method' => 'POST', | ||
224 | + 'header' => 'Content-type:application/json', | ||
225 | + 'content' => $data, | ||
226 | + ], | ||
227 | + ]; | ||
228 | + //POST参数 | ||
229 | + $result = $this->httpRequest($url,$data,"POST"); | ||
230 | + $filename= './uploads/store_qrcode/' . time() . '.png'; | ||
231 | + $ret = file_put_contents($filename, $result, true); | ||
232 | + return $filename; | ||
233 | + } | ||
234 | + //把请求发送到微信服务器换取二维码 | ||
235 | + public function httpRequest($url,$data='',$method='GET'){ | ||
236 | + $curl = curl_init(); | ||
237 | + curl_setopt($curl, CURLOPT_URL,$url); | ||
238 | + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); | ||
239 | + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); | ||
240 | + curl_setopt($curl, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']); | ||
241 | + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||
242 | + curl_setopt($curl, CURLOPT_AUTOREFERER, 1); | ||
243 | + if($method=='POST') | ||
244 | + { | ||
245 | + curl_setopt($curl, CURLOPT_POST, 1); | ||
246 | + if ($data !='') | ||
247 | + { | ||
248 | + curl_setopt($curl, CURLOPT_POSTFIELDS,$data); | ||
249 | + } | ||
250 | + } | ||
251 | + | ||
252 | + curl_setopt($curl, CURLOPT_TIMEOUT, 30); | ||
253 | + curl_setopt($curl, CURLOPT_HEADER, 0); | ||
254 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | ||
255 | + $result = curl_exec($curl); | ||
256 | + curl_close($curl); | ||
257 | + return $result; | ||
258 | + } | ||
259 | + public function test(){ | ||
260 | + $accessToken = $this->getAccessToken(); | ||
261 | + if ($accessToken) { | ||
262 | + $path = 'pages/index/index'; // 小程序内的页面路径 | ||
263 | + $qrCodeData = $this->createMiniProgramQRCode($accessToken, $path); | ||
264 | + | ||
265 | + if ($qrCodeData) { | ||
266 | + echo '图像文件保存成功!'; | ||
267 | +// 验证图像文件是否成功保存 | ||
268 | + } else { | ||
269 | + echo '图像文件保存失败!'; | ||
270 | + } | ||
271 | + header('Content-Type: image/png'); | ||
272 | + } else { | ||
273 | + echo "Failed to generate QR code."; | ||
274 | + } | ||
275 | + } | ||
276 | + | ||
206 | 277 | ||
207 | } | 278 | } |
@@ -58,7 +58,7 @@ class Driver extends Backend | @@ -58,7 +58,7 @@ class Driver extends Backend | ||
58 | ->paginate($limit); | 58 | ->paginate($limit); |
59 | 59 | ||
60 | foreach ($list as $row) { | 60 | foreach ($list as $row) { |
61 | - $row->visible(['id','name','car_fleet','phone','scheduling_type']); | 61 | + $row->visible(['id','name','car_fleet','offline_payment','phone','scheduling_type']); |
62 | $row->visible(['user']); | 62 | $row->visible(['user']); |
63 | $row->getRelation('user')->visible(['username']); | 63 | $row->getRelation('user')->visible(['username']); |
64 | } | 64 | } |
@@ -4,6 +4,8 @@ namespace app\admin\controller; | @@ -4,6 +4,8 @@ namespace app\admin\controller; | ||
4 | 4 | ||
5 | use app\common\controller\Backend; | 5 | use app\common\controller\Backend; |
6 | use think\Db; | 6 | use think\Db; |
7 | +use think\exception\PDOException; | ||
8 | +use think\exception\ValidateException; | ||
7 | 9 | ||
8 | /** | 10 | /** |
9 | * 订单管理 | 11 | * 订单管理 |
@@ -52,13 +54,13 @@ class Order extends Backend | @@ -52,13 +54,13 @@ class Order extends Backend | ||
52 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); | 54 | list($where, $sort, $order, $offset, $limit) = $this->buildparams(); |
53 | 55 | ||
54 | $list = $this->model | 56 | $list = $this->model |
55 | - ->with(['driver','car','user']) | 57 | + ->with(['driver', 'car', 'user']) |
56 | ->where($where) | 58 | ->where($where) |
57 | ->order($sort, $order) | 59 | ->order($sort, $order) |
58 | ->paginate($limit); | 60 | ->paginate($limit); |
59 | 61 | ||
60 | foreach ($list as $row) { | 62 | foreach ($list as $row) { |
61 | - $row->visible(['id','order_no','type','pay_type','price','is_pay','user_name','driver_name','pay_time','refund_time','create_time']); | 63 | + $row->visible(['id', 'order_no', 'type','intended_driver_id', 'pay_type', 'price', 'is_pay', 'user_name', 'driver_name', 'pay_time', 'refund_time', 'create_time']); |
62 | $row->visible(['driver']); | 64 | $row->visible(['driver']); |
63 | $row->getRelation('driver')->visible(['name']); | 65 | $row->getRelation('driver')->visible(['name']); |
64 | $row->visible(['car']); | 66 | $row->visible(['car']); |
@@ -74,10 +76,11 @@ class Order extends Backend | @@ -74,10 +76,11 @@ class Order extends Backend | ||
74 | return $this->view->fetch(); | 76 | return $this->view->fetch(); |
75 | } | 77 | } |
76 | 78 | ||
77 | - public function refund($id){ | 79 | + public function refund($id) |
80 | + { | ||
78 | //查询订单 | 81 | //查询订单 |
79 | - $order=Db::name("order")->where("id",$id)->find(); | ||
80 | - if($order['is_pay']!=1){ | 82 | + $order = Db::name("order")->where("id", $id)->find(); |
83 | + if ($order['is_pay'] != 1) { | ||
81 | $this->error("该订单无法退款"); | 84 | $this->error("该订单无法退款"); |
82 | } | 85 | } |
83 | //拼接退款参数 | 86 | //拼接退款参数 |
@@ -106,4 +109,56 @@ class Order extends Backend | @@ -106,4 +109,56 @@ class Order extends Backend | ||
106 | } | 109 | } |
107 | $this->success("退款成功"); | 110 | $this->success("退款成功"); |
108 | } | 111 | } |
112 | + | ||
113 | + | ||
114 | + /** | ||
115 | + * 编辑 | ||
116 | + * | ||
117 | + * @param $ids | ||
118 | + * @return string | ||
119 | + * @throws DbException | ||
120 | + * @throws \think\Exception | ||
121 | + */ | ||
122 | + public function selectiondriver($ids = null) | ||
123 | + { | ||
124 | + $row = $this->model->get($ids); | ||
125 | + if (!$row) { | ||
126 | + $this->error(__('No Results were found')); | ||
127 | + } | ||
128 | + $adminIds = $this->getDataLimitAdminIds(); | ||
129 | + if (is_array($adminIds) && !in_array($row[$this->dataLimitField], $adminIds)) { | ||
130 | + $this->error(__('You have no permission')); | ||
131 | + } | ||
132 | + if (false === $this->request->isPost()) { | ||
133 | + $this->view->assign('row', $row); | ||
134 | + return $this->view->fetch(); | ||
135 | + } | ||
136 | + $params = $this->request->post('row/a'); | ||
137 | + if (empty($params)) { | ||
138 | + $this->error(__('Parameter %s can not be empty', '')); | ||
139 | + } | ||
140 | + $params = $this->preExcludeFields($params); | ||
141 | + $result = false; | ||
142 | + Db::startTrans(); | ||
143 | + try { | ||
144 | + //是否采用模型验证 | ||
145 | + if ($this->modelValidate) { | ||
146 | + $name = str_replace("\\model\\", "\\validate\\", get_class($this->model)); | ||
147 | + $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate; | ||
148 | + $row->validateFailException()->validate($validate); | ||
149 | + } | ||
150 | + $result = $row->allowField(true)->save($params); | ||
151 | + Db::commit(); | ||
152 | + } catch (ValidateException|PDOException|Exception $e) { | ||
153 | + Db::rollback(); | ||
154 | + $this->error($e->getMessage()); | ||
155 | + } | ||
156 | + if (false === $result) { | ||
157 | + $this->error(__('No rows were updated')); | ||
158 | + } | ||
159 | + $this->success(); | ||
160 | + } | ||
161 | + | ||
162 | + | ||
163 | + | ||
109 | } | 164 | } |
@@ -5,9 +5,9 @@ return [ | @@ -5,9 +5,9 @@ return [ | ||
5 | 'User_id' => '用户id', | 5 | 'User_id' => '用户id', |
6 | 'Name' => '司机名称', | 6 | 'Name' => '司机名称', |
7 | 'Phone' => '手机号', | 7 | 'Phone' => '手机号', |
8 | - 'Is_work' => '是否上班', | ||
9 | - 'Is_work 1' => '上班', | ||
10 | - 'Is_work 2' => '下班', | 8 | + 'Offline_payment' => '是否线下支付', |
9 | + 'Offline_payment 0' => '否', | ||
10 | + 'Offline_payment 1' => '是', | ||
11 | 'Scheduling_type' => '排班类型', | 11 | 'Scheduling_type' => '排班类型', |
12 | 'Scheduling_type 1' => '滚动排班', | 12 | 'Scheduling_type 1' => '滚动排班', |
13 | 'Scheduling_type 2' => '自主排班', | 13 | 'Scheduling_type 2' => '自主排班', |
@@ -6,6 +6,12 @@ | @@ -6,6 +6,12 @@ | ||
6 | <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="username" class="form-control selectpage" name="row[user_id]" type="text" value=""> | 6 | <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="username" class="form-control selectpage" name="row[user_id]" type="text" value=""> |
7 | </div> | 7 | </div> |
8 | </div> | 8 | </div> |
9 | + <div class="form-group" id="kevin_company_type"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Offline_payment')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + {:build_radios("row[offline_payment]",["0"=>"否","1"=>"是"])} | ||
13 | + </div> | ||
14 | + </div> | ||
9 | <div class="form-group"> | 15 | <div class="form-group"> |
10 | <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | 16 | <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> |
11 | <div class="col-xs-12 col-sm-8"> | 17 | <div class="col-xs-12 col-sm-8"> |
@@ -6,6 +6,12 @@ | @@ -6,6 +6,12 @@ | ||
6 | <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="username" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}"> | 6 | <input id="c-user_id" data-rule="required" data-source="user/user/index" data-field="username" class="form-control selectpage" name="row[user_id]" type="text" value="{$row.user_id|htmlentities}"> |
7 | </div> | 7 | </div> |
8 | </div> | 8 | </div> |
9 | + <div class="form-group" id="kevin_company_type"> | ||
10 | + <label class="control-label col-xs-12 col-sm-2">{:__('Offline_payment')}:</label> | ||
11 | + <div class="col-xs-12 col-sm-8"> | ||
12 | + {:build_radios("row[offline_payment]",["0"=>"否","1"=>"是"],$row['offline_payment'])} | ||
13 | + </div> | ||
14 | + </div> | ||
9 | <div class="form-group"> | 15 | <div class="form-group"> |
10 | <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> | 16 | <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label> |
11 | <div class="col-xs-12 col-sm-8"> | 17 | <div class="col-xs-12 col-sm-8"> |
1 | +<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action=""> | ||
2 | + | ||
3 | + <div class="form-group layer-footer"> | ||
4 | + <label class="control-label col-xs-12 col-sm-2"></label> | ||
5 | + <div class="col-xs-12 col-sm-8"> | ||
6 | + <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button> | ||
7 | + <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button> | ||
8 | + </div> | ||
9 | + </div> | ||
10 | +</form> |
@@ -1094,10 +1094,6 @@ class Car extends Base | @@ -1094,10 +1094,6 @@ class Car extends Base | ||
1094 | $phone = $this->request->param("phone");//联系电话 | 1094 | $phone = $this->request->param("phone");//联系电话 |
1095 | $intended_driver_id = $this->request->param("intended_driver_id");//意向司机 | 1095 | $intended_driver_id = $this->request->param("intended_driver_id");//意向司机 |
1096 | $remarks = $this->request->param("remarks");//备注 | 1096 | $remarks = $this->request->param("remarks");//备注 |
1097 | - $driver = Db::name("driver")->where("id", $intended_driver_id)->find(); | ||
1098 | - $car = Db::name("car")->where("driver_id", $driver['id'])->find(); | ||
1099 | - $carmodel = Db::name("carmodel")->where("id", $car['carmodel_id'])->find(); | ||
1100 | - $route = Db::name("route")->where("id", $car['route_id'])->find(); | ||
1101 | $price = 0; | 1097 | $price = 0; |
1102 | $specificaddress = Db::name("specificaddress")->where("id", $specificaddress_id)->find(); | 1098 | $specificaddress = Db::name("specificaddress")->where("id", $specificaddress_id)->find(); |
1103 | if ($specificaddress) { | 1099 | if ($specificaddress) { |
@@ -1105,6 +1101,12 @@ class Car extends Base | @@ -1105,6 +1101,12 @@ class Car extends Base | ||
1105 | } else { | 1101 | } else { |
1106 | $this->error("价格计算错误"); | 1102 | $this->error("价格计算错误"); |
1107 | } | 1103 | } |
1104 | + if ($intended_driver_id){ | ||
1105 | + $driver = Db::name("driver")->where("id", $intended_driver_id)->find(); | ||
1106 | + $car = Db::name("car")->where("driver_id", $driver['id'])->find(); | ||
1107 | + $carmodel = Db::name("carmodel")->where("id", $car['carmodel_id'])->find(); | ||
1108 | + $route = Db::name("route")->where("id", $car['route_id'])->find(); | ||
1109 | + | ||
1108 | //判断总表 | 1110 | //判断总表 |
1109 | $time = strtotime(date("Y-m-d", time())); | 1111 | $time = strtotime(date("Y-m-d", time())); |
1110 | $order_review = Db::name("order_review") | 1112 | $order_review = Db::name("order_review") |
@@ -1138,7 +1140,6 @@ class Car extends Base | @@ -1138,7 +1140,6 @@ class Car extends Base | ||
1138 | "is_pay" => "2",//未支付 | 1140 | "is_pay" => "2",//未支付 |
1139 | "route_id" => $route_id, | 1141 | "route_id" => $route_id, |
1140 | "user_id" => $this->auth->id, | 1142 | "user_id" => $this->auth->id, |
1141 | - "driver_id" => $driver['id'], | ||
1142 | "phone" => $phone, | 1143 | "phone" => $phone, |
1143 | "create_time" => time(), | 1144 | "create_time" => time(), |
1144 | "reservation_time" => time(), | 1145 | "reservation_time" => time(), |
@@ -1147,6 +1148,25 @@ class Car extends Base | @@ -1147,6 +1148,25 @@ class Car extends Base | ||
1147 | "remarks" => $remarks, | 1148 | "remarks" => $remarks, |
1148 | "intended_driver_id" => $intended_driver_id, | 1149 | "intended_driver_id" => $intended_driver_id, |
1149 | ]; | 1150 | ]; |
1151 | + }else{ | ||
1152 | + $data = [ | ||
1153 | + "order_no" => getOrderSn(), | ||
1154 | + "price" => $price, | ||
1155 | + "is_qrcode" => $is_qrcode, | ||
1156 | + "specificaddress_id" => $specificaddress_id, | ||
1157 | + "reservation_time" => $reservation_time, | ||
1158 | + "is_pay" => "2",//未支付 | ||
1159 | + "route_id" => $route_id, | ||
1160 | + "user_id" => $this->auth->id, | ||
1161 | + "phone" => $phone, | ||
1162 | + "create_time" => time(), | ||
1163 | + "reservation_time" => time(), | ||
1164 | + "type" => 2, | ||
1165 | + "number" => $number, | ||
1166 | + "remarks" => $remarks, | ||
1167 | + "intended_driver_id" => $intended_driver_id, | ||
1168 | + ]; | ||
1169 | + } | ||
1150 | $res = Db::name("order")->insertGetId($data); | 1170 | $res = Db::name("order")->insertGetId($data); |
1151 | $userinfo = Db::name('user') | 1171 | $userinfo = Db::name('user') |
1152 | ->where(['id' => $this->auth->id]) | 1172 | ->where(['id' => $this->auth->id]) |
@@ -1467,6 +1487,15 @@ class Car extends Base | @@ -1467,6 +1487,15 @@ class Car extends Base | ||
1467 | } | 1487 | } |
1468 | } | 1488 | } |
1469 | 1489 | ||
1490 | + /** | ||
1491 | + * 查询订单详情 | ||
1492 | + * @return void | ||
1493 | + */ | ||
1494 | + public function orderinfo(){ | ||
1495 | + $order_id = $this->request->param("order_id"); | ||
1496 | + $res=Db::name("order")->where('id',$order_id)->find(); | ||
1497 | + $this->success("请求成功",$res); | ||
1498 | + } | ||
1470 | public function test(){ | 1499 | public function test(){ |
1471 | $res=SendMessage(117); | 1500 | $res=SendMessage(117); |
1472 | $this->success("123",$res); | 1501 | $this->success("123",$res); |
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | 2 | ||
3 | namespace app\api\controller; | 3 | namespace app\api\controller; |
4 | 4 | ||
5 | +use app\api\controller\inspection\Task; | ||
5 | use app\common\controller\Api; | 6 | use app\common\controller\Api; |
6 | 7 | ||
7 | /** | 8 | /** |
@@ -29,9 +30,8 @@ class Index extends Api | @@ -29,9 +30,8 @@ class Index extends Api | ||
29 | $result = json_decode(file_get_contents($url), true); | 30 | $result = json_decode(file_get_contents($url), true); |
30 | return $result["access_token"] ?? null; | 31 | return $result["access_token"] ?? null; |
31 | } | 32 | } |
32 | - | ||
33 | function createMiniProgramQRCode($accessToken, $path, $width = 430) { | 33 | function createMiniProgramQRCode($accessToken, $path, $width = 430) { |
34 | - $url = "https://api.weixin.qq.com/cgi-bin/qrcode/create?access_token={$accessToken}"; | 34 | + $url = "https://api.weixin.qq.com/wxa/getwxacode?access_token={$accessToken}"; |
35 | 35 | ||
36 | $data = json_encode([ | 36 | $data = json_encode([ |
37 | 'path' => $path, | 37 | 'path' => $path, |
@@ -44,13 +44,38 @@ class Index extends Api | @@ -44,13 +44,38 @@ class Index extends Api | ||
44 | 'content' => $data, | 44 | 'content' => $data, |
45 | ], | 45 | ], |
46 | ]; | 46 | ]; |
47 | - $context = stream_context_create($options); | ||
48 | - $result = file_get_contents($url, false, $context); | ||
49 | - print_r($result);return; | ||
50 | - | ||
51 | - if ($result === false) { | ||
52 | - return false; | 47 | + //POST参数 |
48 | + $result = $this->httpRequest($url,$data,"POST"); | ||
49 | + $file_name=md5(rand(1000,9999).time()). '.png'; | ||
50 | + $filename= 'uploads/' . $file_name ; | ||
51 | + $ret = file_put_contents($filename, $result, true); | ||
52 | + $task=new Task(); | ||
53 | + $res=$task->fileUpload($file_name); | ||
54 | + return $res; | ||
55 | + } | ||
56 | + //把请求发送到微信服务器换取二维码 | ||
57 | + public function httpRequest($url,$data='',$method='GET'){ | ||
58 | + $curl = curl_init(); | ||
59 | + curl_setopt($curl, CURLOPT_URL,$url); | ||
60 | + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); | ||
61 | + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); | ||
62 | + curl_setopt($curl, CURLOPT_USERAGENT,$_SERVER['HTTP_USER_AGENT']); | ||
63 | + curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); | ||
64 | + curl_setopt($curl, CURLOPT_AUTOREFERER, 1); | ||
65 | + if($method=='POST') | ||
66 | + { | ||
67 | + curl_setopt($curl, CURLOPT_POST, 1); | ||
68 | + if ($data !='') | ||
69 | + { | ||
70 | + curl_setopt($curl, CURLOPT_POSTFIELDS,$data); | ||
53 | } | 71 | } |
72 | + } | ||
73 | + | ||
74 | + curl_setopt($curl, CURLOPT_TIMEOUT, 30); | ||
75 | + curl_setopt($curl, CURLOPT_HEADER, 0); | ||
76 | + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); | ||
77 | + $result = curl_exec($curl); | ||
78 | + curl_close($curl); | ||
54 | return $result; | 79 | return $result; |
55 | } | 80 | } |
56 | public function test(){ | 81 | public function test(){ |
@@ -58,15 +83,8 @@ class Index extends Api | @@ -58,15 +83,8 @@ class Index extends Api | ||
58 | if ($accessToken) { | 83 | if ($accessToken) { |
59 | $path = 'pages/index/index'; // 小程序内的页面路径 | 84 | $path = 'pages/index/index'; // 小程序内的页面路径 |
60 | $qrCodeData = $this->createMiniProgramQRCode($accessToken, $path); | 85 | $qrCodeData = $this->createMiniProgramQRCode($accessToken, $path); |
61 | - | ||
62 | - if ($qrCodeData) { | ||
63 | - header('Content-Type: image/png'); | ||
64 | - echo $qrCodeData; | ||
65 | - } else { | ||
66 | - echo "Failed to generate QR code."; | ||
67 | - } | ||
68 | - } else { | ||
69 | - echo "Failed to get access token."; | 86 | + print_r($qrCodeData);return; |
87 | + return $qrCodeData; | ||
70 | } | 88 | } |
71 | } | 89 | } |
72 | } | 90 | } |
@@ -82,7 +82,7 @@ class Task extends Api | @@ -82,7 +82,7 @@ class Task extends Api | ||
82 | $data['filepath'] = $domain . $ret['key']; | 82 | $data['filepath'] = $domain . $ret['key']; |
83 | $data['fileurl'] = $ret['key']; | 83 | $data['fileurl'] = $ret['key']; |
84 | $path = '../public' . $data['fileurl']; | 84 | $path = '../public' . $data['fileurl']; |
85 | - is_file($path) && unlink($path);//删除服务器上文件 | 85 | + is_file($filepath) && unlink($filepath);//删除服务器上文件 |
86 | return $data; | 86 | return $data; |
87 | } else { | 87 | } else { |
88 | //上传失败获取错误信息 | 88 | //上传失败获取错误信息 |
@@ -30,6 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -30,6 +30,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
30 | {field: 'phone', title: __('Phone'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, | 30 | {field: 'phone', title: __('Phone'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, |
31 | {field: 'car_fleet', title: __('Car_fleet'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, | 31 | {field: 'car_fleet', title: __('Car_fleet'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, |
32 | {field: 'scheduling_type', title: __('Scheduling_type'), searchList: {"1":__('Scheduling_type 1'),"2":__('Scheduling_type 2')}, formatter: Table.api.formatter.normal}, | 32 | {field: 'scheduling_type', title: __('Scheduling_type'), searchList: {"1":__('Scheduling_type 1'),"2":__('Scheduling_type 2')}, formatter: Table.api.formatter.normal}, |
33 | + {field: 'offline_payment', title: __('Offline_payment'), searchList: {"0":__('Offline_payment 0'),"1":__('Offline_payment 1')}, formatter: Table.api.formatter.normal}, | ||
33 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} | 34 | {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate} |
34 | ] | 35 | ] |
35 | ] | 36 | ] |
1 | -define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) { | 1 | +define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function ($, undefined, Backend, Table, Form, Template) { |
2 | 2 | ||
3 | var Controller = { | 3 | var Controller = { |
4 | index: function () { | 4 | index: function () { |
@@ -28,21 +28,74 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -28,21 +28,74 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
28 | [ | 28 | [ |
29 | {checkbox: true}, | 29 | {checkbox: true}, |
30 | {field: 'id', title: __('Id')}, | 30 | {field: 'id', title: __('Id')}, |
31 | - {field: 'order_no', title: __('Order_no'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, | ||
32 | - {field: 'price', title: __('Price'), operate:'BETWEEN'}, | ||
33 | - {field: 'is_pay', title: __('Is_pay'), searchList: {"1":__('Is_pay 1'),"2":__('Is_pay 2'),"3":__('Is_pay 3'),"4":__('Is_pay 4')}, formatter: Table.api.formatter.normal}, | ||
34 | - {field: 'type', title: __('Type'), searchList: {"1":__('Type 1'),"2":__('Type 2'),"3":__('Type 3')}, formatter: Table.api.formatter.normal}, | ||
35 | - {field: 'pay_type', title: __('Pay_type'), searchList: {"Wxpay":__('Pay_type wxpay'),"offlinepay":__('Pay_type offlinepay')}, formatter: Table.api.formatter.normal}, | ||
36 | - {field: 'pay_time', title: __('Pay_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
37 | - {field: 'refund_time', title: __('Refund_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | ||
38 | - {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime}, | 31 | + { |
32 | + field: 'order_no', | ||
33 | + title: __('Order_no'), | ||
34 | + operate: 'LIKE', | ||
35 | + table: table, | ||
36 | + class: 'autocontent', | ||
37 | + formatter: Table.api.formatter.content | ||
38 | + }, | ||
39 | + {field: 'price', title: __('Price'), operate: 'BETWEEN'}, | ||
40 | + { | ||
41 | + field: 'is_pay', | ||
42 | + title: __('Is_pay'), | ||
43 | + searchList: { | ||
44 | + "1": __('Is_pay 1'), | ||
45 | + "2": __('Is_pay 2'), | ||
46 | + "3": __('Is_pay 3'), | ||
47 | + "4": __('Is_pay 4') | ||
48 | + }, | ||
49 | + formatter: Table.api.formatter.normal | ||
50 | + }, | ||
51 | + { | ||
52 | + field: 'type', | ||
53 | + title: __('Type'), | ||
54 | + searchList: {"1": __('Type 1'), "2": __('Type 2'), "3": __('Type 3')}, | ||
55 | + formatter: Table.api.formatter.normal | ||
56 | + }, | ||
57 | + { | ||
58 | + field: 'pay_type', | ||
59 | + title: __('Pay_type'), | ||
60 | + searchList: {"Wxpay": __('Pay_type wxpay'), "offlinepay": __('Pay_type offlinepay')}, | ||
61 | + formatter: Table.api.formatter.normal | ||
62 | + }, | ||
63 | + { | ||
64 | + field: 'pay_time', | ||
65 | + title: __('Pay_time'), | ||
66 | + operate: 'RANGE', | ||
67 | + addclass: 'datetimerange', | ||
68 | + autocomplete: false, | ||
69 | + formatter: Table.api.formatter.datetime | ||
70 | + }, | ||
71 | + { | ||
72 | + field: 'refund_time', | ||
73 | + title: __('Refund_time'), | ||
74 | + operate: 'RANGE', | ||
75 | + addclass: 'datetimerange', | ||
76 | + autocomplete: false, | ||
77 | + formatter: Table.api.formatter.datetime | ||
78 | + }, | ||
79 | + { | ||
80 | + field: 'create_time', | ||
81 | + title: __('Create_time'), | ||
82 | + operate: 'RANGE', | ||
83 | + addclass: 'datetimerange', | ||
84 | + autocomplete: false, | ||
85 | + formatter: Table.api.formatter.datetime | ||
86 | + }, | ||
39 | {field: 'user.username', title: __('User.username'), operate: 'LIKE'}, | 87 | {field: 'user.username', title: __('User.username'), operate: 'LIKE'}, |
40 | - {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate, | ||
41 | - buttons:[ | 88 | + { |
89 | + field: 'operate', | ||
90 | + title: __('Operate'), | ||
91 | + table: table, | ||
92 | + events: Table.api.events.operate, | ||
93 | + formatter: Table.api.formatter.operate, | ||
94 | + buttons: [ | ||
42 | { | 95 | { |
43 | name: 'ajax', | 96 | name: 'ajax', |
44 | title: "退款", | 97 | title: "退款", |
45 | - text:"退款", | 98 | + text: "退款", |
46 | classname: 'btn btn-xs btn-warning btn-magic btn-ajax', | 99 | classname: 'btn btn-xs btn-warning btn-magic btn-ajax', |
47 | icon: 'fa fa-paper-plane', | 100 | icon: 'fa fa-paper-plane', |
48 | confirm: function (row) { | 101 | confirm: function (row) { |
@@ -50,22 +103,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | @@ -50,22 +103,17 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin | ||
50 | }, | 103 | }, |
51 | url: 'order/refund?id={id}', | 104 | url: 'order/refund?id={id}', |
52 | 105 | ||
53 | - success: function (data, ret) { | ||
54 | - // Layer.alert(ret.msg + ",返回数据:" + JSON.stringify(data)); | ||
55 | - // 如果需要阻止成功提示,则必须使用return false; | ||
56 | - console.log(data, ret); | ||
57 | - Layer.alert(ret.msg); | ||
58 | - $("#myTabContent .btn-refresh").trigger("click"); | ||
59 | - return false; | ||
60 | - }, | ||
61 | - error: function (data, ret) { | ||
62 | - console.log(data, ret); | ||
63 | - Layer.alert(ret.msg); | ||
64 | - $("#myTabContent .btn-refresh").trigger("click"); | ||
65 | - return false; | ||
66 | - } | ||
67 | }, | 106 | }, |
107 | + { | ||
108 | + name: 'selectiondriver', | ||
109 | + text:"选择司机", | ||
110 | + title: "选择司机", | ||
111 | + extend:'data-area=["94%","94%"]', | ||
112 | + classname: 'btn btn-xs btn-primary btn-dialog', | ||
113 | + icon: 'fa fa-recipt', | ||
114 | + url: 'order/selectiondriver?id={id}', | ||
68 | 115 | ||
116 | + } | ||
69 | ] | 117 | ] |
70 | }] | 118 | }] |
71 | ] | 119 | ] |
-
请 注册 或 登录 后发表评论