|
@@ -228,9 +228,12 @@ class Order extends Api |
|
@@ -228,9 +228,12 @@ class Order extends Api |
228
|
|
228
|
|
229
|
/**
|
229
|
/**
|
230
|
* 我的订单-申请退款
|
230
|
* 我的订单-申请退款
|
231
|
- * @ApiMethod (GET)
|
231
|
+ * @ApiMethod (POST)
|
232
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
232
|
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
|
233
|
* @ApiParams (name="order_id", type="integer", required=true, description="订单ID")
|
233
|
* @ApiParams (name="order_id", type="integer", required=true, description="订单ID")
|
|
|
234
|
+ * @ApiParams (name="refund_reason", type="string", required=true, description="退款原因")
|
|
|
235
|
+ * @ApiParams (name="refund_reason_explain", type="string", required=true, description="退款说明")
|
|
|
236
|
+ * @ApiParams (name="refund_reason_images", type="string", required=true, description="退款凭证,多个图片用英文逗号分隔")
|
234
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
237
|
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
|
235
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
238
|
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
|
236
|
* @ApiReturnParams (name="data", type="object", description="扩展数据返回")
|
239
|
* @ApiReturnParams (name="data", type="object", description="扩展数据返回")
|
|
@@ -239,14 +242,18 @@ class Order extends Api |
|
@@ -239,14 +242,18 @@ class Order extends Api |
239
|
'msg':'返回成功'
|
242
|
'msg':'返回成功'
|
240
|
})
|
243
|
})
|
241
|
*/
|
244
|
*/
|
242
|
- public function refund($order_id)
|
245
|
+ public function refund()
|
243
|
{
|
246
|
{
|
244
|
- if(!$order = $this->model->getUserOrderDetail($order_id, $this->user['id'])){
|
247
|
+ $post = $this->request->post();
|
|
|
248
|
+ if(!$order = $this->model->getUserOrderDetail($post['order_id'], $this->user['id'])){
|
245
|
$this->error($this->model->getError());
|
249
|
$this->error($this->model->getError());
|
246
|
- }
|
|
|
247
|
- if ($order['refund_status'] == 2) return self::setErrorInfo('订单已退款!');
|
|
|
248
|
- if ($order['refund_status'] == 1) return self::setErrorInfo('正在申请退款中!');
|
|
|
249
|
- if ($order['status'] == 1) return self::setErrorInfo('订单当前无法退款!');
|
250
|
+ }
|
|
|
251
|
+ empty($post['refund_reason']) && $this->error(__('请选择退款原因!'));
|
|
|
252
|
+ $order['refund_status'] == '2' && $this->error(__('订单已退款!'));
|
|
|
253
|
+ $order['refund_status'] == '1' && $this->error(__('正在申请退款中!'));
|
|
|
254
|
+ $order['delivery_status'] == '1' && $this->error(__('订单当前无法退款!'));
|
|
|
255
|
+ $this->model->allowField(true)->save($post);
|
|
|
256
|
+ $this->success(__('申请退款成功'));
|
250
|
}
|
257
|
}
|
251
|
|
258
|
|
252
|
/**
|
259
|
/**
|
|
@@ -268,5 +275,6 @@ class Order extends Api |
|
@@ -268,5 +275,6 @@ class Order extends Api |
268
|
if(!$order = $this->model->getUserOrderDetail($post['order_id'], $this->user['id'])){
|
275
|
if(!$order = $this->model->getUserOrderDetail($post['order_id'], $this->user['id'])){
|
269
|
$this->error($this->model->getError());
|
276
|
$this->error($this->model->getError());
|
270
|
}
|
277
|
}
|
|
|
278
|
+
|
271
|
}
|
279
|
}
|
272
|
} |
280
|
} |