Showing
5 changed files
with
34 additions
and
6 deletions
@@ -50,12 +50,17 @@ class OrderData | @@ -50,12 +50,17 @@ class OrderData | ||
50 | * @param type $orderCode | 50 | * @param type $orderCode |
51 | * @return type | 51 | * @return type |
52 | */ | 52 | */ |
53 | - public static function cancelUserOrder($uid, $orderCode) | 53 | + public static function cancelUserOrder($uid, $orderCode, $reason = false, $reasonId = false) |
54 | { | 54 | { |
55 | $param = Yohobuy::param(); | 55 | $param = Yohobuy::param(); |
56 | $param['method'] = 'app.SpaceOrders.close'; | 56 | $param['method'] = 'app.SpaceOrders.close'; |
57 | $param['uid'] = $uid; | 57 | $param['uid'] = $uid; |
58 | $param['order_code'] = $orderCode; | 58 | $param['order_code'] = $orderCode; |
59 | + //取消订单原因 | ||
60 | + if ($reasonId) { | ||
61 | + $param['reasonId'] = $reasonId; | ||
62 | + $param['reasons'] = $reason; | ||
63 | + } | ||
59 | $param['client_secret'] = Sign::getSign($param); | 64 | $param['client_secret'] = Sign::getSign($param); |
60 | return Yohobuy::get(Yohobuy::API_URL, $param); | 65 | return Yohobuy::get(Yohobuy::API_URL, $param); |
61 | } | 66 | } |
@@ -147,4 +152,20 @@ class OrderData | @@ -147,4 +152,20 @@ class OrderData | ||
147 | // 调用接口获得数据 | 152 | // 调用接口获得数据 |
148 | return Yohobuy::post(Yohobuy::API_URL, $param); | 153 | return Yohobuy::post(Yohobuy::API_URL, $param); |
149 | } | 154 | } |
155 | + | ||
156 | + /** | ||
157 | + * 取消订单原因列表 | ||
158 | + * @return type | ||
159 | + */ | ||
160 | + public static function closeReasons() | ||
161 | + { | ||
162 | + // 构建必传参数 | ||
163 | + $param = Yohobuy::param(); | ||
164 | + $param['method'] = 'app.SpaceOrders.closeReasons'; | ||
165 | + $param['client_secret'] = Sign::getSign($param); | ||
166 | + | ||
167 | + // 调用接口获得数据 | ||
168 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
169 | + } | ||
170 | + | ||
150 | } | 171 | } |
@@ -224,6 +224,8 @@ class OrderModel | @@ -224,6 +224,8 @@ class OrderModel | ||
224 | $detail['remark'] = $orderDetail['remark']; | 224 | $detail['remark'] = $orderDetail['remark']; |
225 | $detail['operation'] = self::getOrderDetailOp($orderDetail['order_code'], $orderDetail['payment'], $orderDetail['status'], $orderDetail['is_cancel'], $orderDetail['payment_status'], $orderDetail['payment_type'], $orderDetail['order_type'], $orderDetail['attribute'], $orderDetail['refund_status']); //,$orderDetail['order_type_value'] | 225 | $detail['operation'] = self::getOrderDetailOp($orderDetail['order_code'], $orderDetail['payment'], $orderDetail['status'], $orderDetail['is_cancel'], $orderDetail['payment_status'], $orderDetail['payment_type'], $orderDetail['order_type'], $orderDetail['attribute'], $orderDetail['refund_status']); //,$orderDetail['order_type_value'] |
226 | $detail['packages'] = CartModel::getPackageInfo($orderDetail); | 226 | $detail['packages'] = CartModel::getPackageInfo($orderDetail); |
227 | + //判断是否可以修改地址 | ||
228 | + $result['changeable'] = $orderDetail['can_update_delivery_address'] == 'Y' ? 'true' : 'false'; | ||
227 | } | 229 | } |
228 | return $detail; | 230 | return $detail; |
229 | } | 231 | } |
@@ -330,7 +332,7 @@ class OrderModel | @@ -330,7 +332,7 @@ class OrderModel | ||
330 | $result['courierNumbe'] = isset($logistics['data']['express_number']) ? $logistics['data']['express_number'] : ''; | 332 | $result['courierNumbe'] = isset($logistics['data']['express_number']) ? $logistics['data']['express_number'] : ''; |
331 | $expressDetail = isset($logistics['data']['express_detail']) ? $logistics['data']['express_detail'] : array(); | 333 | $expressDetail = isset($logistics['data']['express_detail']) ? $logistics['data']['express_detail'] : array(); |
332 | if (isset($expressDetail) && $expressDetail) { | 334 | if (isset($expressDetail) && $expressDetail) { |
333 | - $logisticsTmp = $result['logistics'][0];//暂存 | 335 | + $logisticsTmp = $result['logistics'][0]; //暂存 |
334 | $result['logistics'] = array(); | 336 | $result['logistics'] = array(); |
335 | foreach ($expressDetail as $value) { | 337 | foreach ($expressDetail as $value) { |
336 | $pos = stripos($value['accept_address'], ' ') / 3; | 338 | $pos = stripos($value['accept_address'], ' ') / 3; |
@@ -344,7 +346,7 @@ class OrderModel | @@ -344,7 +346,7 @@ class OrderModel | ||
344 | } | 346 | } |
345 | } | 347 | } |
346 | //把最初的处理放最后 | 348 | //把最初的处理放最后 |
347 | - $result['logistics'][]=$logisticsTmp; | 349 | + $result['logistics'][] = $logisticsTmp; |
348 | } | 350 | } |
349 | } | 351 | } |
350 | } | 352 | } |
@@ -65,6 +65,9 @@ class OrdersController extends WebAction | @@ -65,6 +65,9 @@ class OrdersController extends WebAction | ||
65 | //历史订单/普通订单 | 65 | //历史订单/普通订单 |
66 | $orderKey = ($type == ChannelConfig::$historyType) ? 'historyOrders' : 'orders'; | 66 | $orderKey = ($type == ChannelConfig::$historyType) ? 'historyOrders' : 'orders'; |
67 | $data[$orderKey] = $orders; | 67 | $data[$orderKey] = $orders; |
68 | + //取消订单原因列表 | ||
69 | + $resons = OrderData::closeReasons(); | ||
70 | + $data['cancelReason'] = isset($resons['data']) ? $resons['data'] : ''; | ||
68 | $this->_view->display('orders', array('meOrdersPage' => true, 'meOrders' => $data)); | 71 | $this->_view->display('orders', array('meOrdersPage' => true, 'meOrders' => $data)); |
69 | } | 72 | } |
70 | 73 | ||
@@ -98,7 +101,7 @@ class OrdersController extends WebAction | @@ -98,7 +101,7 @@ class OrdersController extends WebAction | ||
98 | 'userThumb' => UserModel::getUserHeadImg($uid), | 101 | 'userThumb' => UserModel::getUserHeadImg($uid), |
99 | 'homeNav' => $leftNav | 102 | 'homeNav' => $leftNav |
100 | ); | 103 | ); |
101 | - $packages=false; | 104 | + $packages = false; |
102 | if ($detail) { | 105 | if ($detail) { |
103 | $data += array( | 106 | $data += array( |
104 | 'orderNum' => $detail['orderNum'], | 107 | 'orderNum' => $detail['orderNum'], |
@@ -185,8 +188,10 @@ class OrdersController extends WebAction | @@ -185,8 +188,10 @@ class OrdersController extends WebAction | ||
185 | break; | 188 | break; |
186 | } | 189 | } |
187 | $uid = $this->auditJumpLogin(); | 190 | $uid = $this->auditJumpLogin(); |
188 | - $orderCode = trim($this->post('orderCode', '')); | ||
189 | - $data = OrderData::cancelUserOrder($uid, $orderCode); | 191 | + $orderCode = trim($this->post('orderCode', ''));//订单编号 |
192 | + $reason = $this->get('reason', ''); //取消订单原因 | ||
193 | + $reasonid = $this->get('reasonId', ''); //取消原因id | ||
194 | + $data = OrderData::cancelUserOrder($uid, $orderCode, $reason, $reasonid); | ||
190 | if (!isset($data['code'])) { | 195 | if (!isset($data['code'])) { |
191 | break; | 196 | break; |
192 | } | 197 | } |
-
Please register or login to post a comment