wesley.chen 7 سال پیش
والد
کامیت
5a07eba547
29فایلهای تغییر یافته به همراه2378 افزوده شده و 88 حذف شده
  1. 168 57
      app/Http/Controllers/Admin/Order/InfoController.php
  2. 138 0
      app/Http/Controllers/Admin/Refund/InfoController.php
  3. 138 0
      app/Http/Controllers/Admin/Setting/InfoController.php
  4. 1 1
      app/Http/Controllers/Api/V1/Controller.php
  5. 329 5
      app/Http/Controllers/Api/V1/HomeController.php
  6. 25 0
      app/Models/OrderInfoModel.php
  7. 39 0
      app/Models/RefundInfoModel.php
  8. 45 0
      app/Models/SettingInfoModel.php
  9. 33 0
      app/Repositories/Order/InfoRepository.php
  10. 45 0
      app/Repositories/Refund/Criteria/MultiWhere.php
  11. 21 0
      app/Repositories/Refund/InfoRepository.php
  12. 45 0
      app/Repositories/Setting/Criteria/MultiWhere.php
  13. 21 0
      app/Repositories/Setting/InfoRepository.php
  14. 43 0
      database/migrations/2018_07_22_105854_create_setting_info_table.php
  15. 35 0
      database/migrations/2018_07_22_105944_create_refund_info_tanle.php
  16. 227 11
      public/apidoc/api_data.js
  17. 227 11
      public/apidoc/api_data.json
  18. 1 1
      public/apidoc/api_project.js
  19. 1 1
      public/apidoc/api_project.json
  20. 15 1
      resources/views/admin/order/info/index.blade.php
  21. 88 0
      resources/views/admin/refund/info/check.blade.php
  22. 86 0
      resources/views/admin/refund/info/edit.blade.php
  23. 103 0
      resources/views/admin/refund/info/index.blade.php
  24. 53 0
      resources/views/admin/refund/info/view.blade.php
  25. 90 0
      resources/views/admin/setting/info/check.blade.php
  26. 140 0
      resources/views/admin/setting/info/edit.blade.php
  27. 105 0
      resources/views/admin/setting/info/index.blade.php
  28. 95 0
      resources/views/admin/setting/info/view.blade.php
  29. 21 0
      routes/api.php

+ 168 - 57
app/Http/Controllers/Admin/Order/InfoController.php

xqd xqd xqd
@@ -1,59 +1,89 @@
 <?php
 /**
  *  订单列表
- *  @author  system
- *  @version    1.0
- *  @date 2018-07-12 08:32:14
+ * @author  system
+ * @version    1.0
+ * @date 2018-07-12 08:32:14
  *
  */
+
 namespace App\Http\Controllers\Admin\Order;
+
 use App\Http\Controllers\Admin\Controller;
+use App\Models\OrderInfoModel;
+use App\Models\RefundInfoModel;
+use Carbon\Carbon;
+use EasyWeChat\Factory;
 use Illuminate\Http\Request;
 use App\Repositories\Base\Criteria\OrderBy;
 use App\Repositories\Order\Criteria\MultiWhere;
 use App\Repositories\Order\InfoRepository;
+use Illuminate\Pagination\LengthAwarePaginator;
+use Illuminate\Pagination\Paginator;
+use Illuminate\Support\Collection;
 
 class InfoController extends Controller
 {
     private $repository;
 
-    public function __construct(InfoRepository $repository) {
-        if(!$this->repository) $this->repository = $repository;
+    public function __construct(InfoRepository $repository)
+    {
+        if (!$this->repository) $this->repository = $repository;
     }
 
-    function index(Request $request) {
+    function index(Request $request)
+    {
         $search['keyword'] = $request->input('keyword');
-        $query = $this->repository->pushCriteria(new MultiWhere($search));
+        $search['status'] = $request->input('status');
 
-        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
-        $query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
-        }else{
-            $query = $query->pushCriteria(new OrderBy('id','DESC'));
+        $order = array();
+        if (isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+            $order[$request['sort_field']] = $request['sort_field_by'];
+        } else {
+            $order['status'] = 'ASC';
+            $order['id'] = 'DESC';
         }
-        $list = $query->paginate();
-        return view('admin.order.info.index',compact('list'));
+
+        $list = $this->repository->with(['refundinfo'])->searchOrder($search, $order);
+        $list = $list->get()->filter(function ($value) use ($search) {
+            if ($search['status'] == 3 && count($value->refundinfo)) {
+                return false;
+            }
+            return true;
+        });
+        $list = $this->paginate($list);
+
+        return view('admin.order.info.index', compact('list'));
+    }
+
+    public function paginate($items, $perPage = 10, $page = null, $options = [])
+    {
+        $page = $page ?: (Paginator::resolveCurrentPage() ?: 1);
+        $items = $items instanceof Collection ? $items : Collection::make($items);
+        return new LengthAwarePaginator($items->forPage($page, $perPage), $items->count(), $perPage, $page, $options);
     }
 
 
-    function check(Request $request) {
+    function check(Request $request)
+    {
         $request = $request->all();
         $search['keyword'] = $request->input('keyword');
         $orderby = array();
-        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+        if (isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
             $orderby[$request['sort_field']] = $request['sort_field_by'];
         }
-        $list = $this->repository->search($search,$orderby);
-        return view('admin.order.info.check',compact('list'));
+        $list = $this->repository->search($search, $orderby);
+        return view('admin.order.info.check', compact('list'));
     }
 
 
     /**
      * 添加
-     * 
+     *
      */
     public function create(Request $request)
     {
-        if($request->method() == 'POST') {
+        if ($request->method() == 'POST') {
             return $this->_createSave();
         }
         return view('admin.order.info.edit');
@@ -62,51 +92,60 @@ class InfoController extends Controller
     /**
      * 保存修改
      */
-    private function _createSave(){
-        $data = (array) request('data');
+    private function _createSave()
+    {
+        $data = (array)request('data');
         $id = $this->repository->create($data);
-        if($id) {
-            $url[] = array('url'=>U( 'Order/Info/index'),'title'=>'返回列表');
-            $url[] = array('url'=>U( 'Order/Info/create'),'title'=>'继续添加');
-            $this->showMessage('添加成功',$url);
-        }else{
-            $url[] = array('url'=>U( 'Order/Info/index'),'title'=>'返回列表');
-            return $this->showWarning('添加失败',$url);
+        if ($id) {
+            $url[] = array('url' => U('Order/Info/index'), 'title' => '返回列表');
+            $url[] = array('url' => U('Order/Info/create'), 'title' => '继续添加');
+            $this->showMessage('添加成功', $url);
+        } else {
+            $url[] = array('url' => U('Order/Info/index'), 'title' => '返回列表');
+            return $this->showWarning('添加失败', $url);
         }
     }
-    
+
     /**
-     * 
+     *
      * 修改
-     * 
-     * 
+     *
+     *
      */
-    public function update(Request $request) {
-        if($request->method() == 'POST') {
-            return $this->_updateSave();
+    public function update(Request $request)
+    {
+        $id = request('id');
+        $order = OrderInfoModel::find($id);
+        $order->status = 2;
+        $ok = $order->save();
+        if ($ok) {
+            return $this->showMessage('操作成功', urldecode(request('_referer')));
+        } else {
+            return $this->showWarning('操作失败', urldecode(request('_referer')));
         }
-        $data = $this->repository->find($request->get('id'));
-        return view('admin.order.info.edit',compact('data'));
+
     }
 
     /**
      * 保存修改
      */
-    private function _updateSave() {
-        $data = (array) request('data');
-        $ok = $this->repository->update(request('id'),$data);
-        if($ok) {
-            $url[] = array('url'=>U( 'Order/Info/index'),'title'=>'返回列表');
-            return $this->showMessage('操作成功',urldecode(request('_referer')));
-        }else{
-            $url[] = array('url'=>U( 'Order/Info/index'),'title'=>'返回列表');
-            return $this->showWarning('操作失败',$url);
+    private function _updateSave()
+    {
+        $data = (array)request('data');
+        $ok = $this->repository->update(request('id'), $data);
+        if ($ok) {
+            $url[] = array('url' => U('Order/Info/index'), 'title' => '返回列表');
+            return $this->showMessage('操作成功', urldecode(request('_referer')));
+        } else {
+            $url[] = array('url' => U('Order/Info/index'), 'title' => '返回列表');
+            return $this->showWarning('操作失败', $url);
         }
     }
 
-    public function view(Request $request) {
+    public function view(Request $request)
+    {
         $data = $this->repository->find(request('id'));
-        return view('admin.order.info.view',compact('data'));
+        return view('admin.order.info.view', compact('data'));
     }
 
 
@@ -115,24 +154,96 @@ class InfoController extends Controller
      * 状态改变
      *
      */
-    public function status(Request $request) {
-        $ok = $this->repository->updateStatus(request('id'),request('status'));
-        if($ok) {
+    public function status(Request $request)
+    {
+        $ok = $this->repository->updateStatus(request('id'), request('status'));
+        if ($ok) {
             return $this->showMessage('操作成功');
-        }else{
+        } else {
             return $this->showWarning('操作失败');
         }
     }
-    
+
     /**
      * 删除
      */
-    public function destroy(Request $request) {
+    public function destroy(Request $request)
+    {
         $bool = $this->repository->destroy($request->get('id'));
-        if($bool) {
-            return  $this->showMessage('操作成功');
+        if ($bool) {
+            return $this->showMessage('操作成功');
+        } else {
+            return $this->showWarning("操作失败");
+        }
+    }
+
+    /***
+     * 退款
+     */
+    public function refund(Request $request)
+    {
+        $config = [
+            // 必要配置
+            'app_id' => 'xxxx',
+            'mch_id' => 'your-mch-id',
+            'key' => 'key-for-signature',   // API 密钥
+
+            // 如需使用敏感接口(如退款、发送红包等)需要配置 API 证书路径(登录商户平台下载 API 证书)
+            'cert_path' => 'path/to/your/cert.pem', // XXX: 绝对路径!!!!
+            'key_path' => 'path/to/your/key',      // XXX: 绝对路径!!!!
+
+            'notify_url' => '默认的订单回调地址',     // 你也可以在下单时单独设置来想覆盖它
+        ];
+
+        $app = Factory::payment($config);
+        $orderid = request('id');
+        $order = OrderInfoModel::with('paidinfo')->find($orderid);
+        $out_trade_no = $order->out_trade_no;
+        $total_price = $order->paidinfo->paid_price *100;
+
+        $refund_time = strtotime($order->updated_at);
+        $schedule_time = strtotime($order->schedule_time);
+
+        if($schedule_time < $refund_time){
+            $refund_price = $total_price * 0.75;
         }else{
-            return  $this->showWarning("操作失败");
+            $time = $schedule_time-$refund_time / 3600;
+            $hour = 12;
+
+            if( $time > $hour){
+                $refund_price = $total_price;
+            }else{
+                $refund_price = $total_price * 0.85;
+            }
+        }
+
+
+$result = $app->refund->byOutTradeNumber($out_trade_no, $out_trade_no, $total_price, $refund_price, [
+    // 可在此处传入其他参数,详细参数见微信支付文档
+    'refund_desc' => $out_trade_no.'退款',
+]);
+\Log::info($result);
+
+        if($result){
+            $data = [
+                'refund_no' => $out_trade_no,
+                'order_id' => $orderid ,
+                'refund_price' => $refund_price
+            ];
+
+            $ok = RefundInfoModel::create($data);
+            if ($ok) {
+                return $this->showMessage('退款成功');
+            } else {
+                return $this->showWarning('操作失败,请稍后再试');
+            }
+
         }
+
+    }
+
+    public function notify()
+    {
+
     }
 }

+ 138 - 0
app/Http/Controllers/Admin/Refund/InfoController.php

xqd
@@ -0,0 +1,138 @@
+<?php
+/**
+ *  退款管理
+ *  @author  system
+ *  @version    1.0
+ *  @date 2018-07-22 14:03:35
+ *
+ */
+namespace App\Http\Controllers\Admin\Refund;
+use App\Http\Controllers\Admin\Controller;
+use Illuminate\Http\Request;
+use App\Repositories\Base\Criteria\OrderBy;
+use App\Repositories\Refund\Criteria\MultiWhere;
+use App\Repositories\Refund\InfoRepository;
+
+class InfoController extends Controller
+{
+    private $repository;
+
+    public function __construct(InfoRepository $repository) {
+        if(!$this->repository) $this->repository = $repository;
+    }
+
+    function index(Request $request) {
+        $search['keyword'] = $request->input('keyword');
+        $query = $this->repository->pushCriteria(new MultiWhere($search));
+
+        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+        $query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
+        }else{
+            $query = $query->pushCriteria(new OrderBy('id','DESC'));
+        }
+        $list = $query->paginate();
+        return view('admin.refund.info.index',compact('list'));
+    }
+
+
+    function check(Request $request) {
+        $request = $request->all();
+        $search['keyword'] = $request->input('keyword');
+        $orderby = array();
+        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+            $orderby[$request['sort_field']] = $request['sort_field_by'];
+        }
+        $list = $this->repository->search($search,$orderby);
+        return view('admin.refund.info.check',compact('list'));
+    }
+
+
+    /**
+     * 添加
+     * 
+     */
+    public function create(Request $request)
+    {
+        if($request->method() == 'POST') {
+            return $this->_createSave();
+        }
+        return view('admin.refund.info.edit');
+    }
+
+    /**
+     * 保存修改
+     */
+    private function _createSave(){
+        $data = (array) request('data');
+        $id = $this->repository->create($data);
+        if($id) {
+            $url[] = array('url'=>U( 'Refund/Info/index'),'title'=>'返回列表');
+            $url[] = array('url'=>U( 'Refund/Info/create'),'title'=>'继续添加');
+            $this->showMessage('添加成功',$url);
+        }else{
+            $url[] = array('url'=>U( 'Refund/Info/index'),'title'=>'返回列表');
+            return $this->showWarning('添加失败',$url);
+        }
+    }
+    
+    /**
+     * 
+     * 修改
+     * 
+     * 
+     */
+    public function update(Request $request) {
+        if($request->method() == 'POST') {
+            return $this->_updateSave();
+        }
+        $data = $this->repository->find($request->get('id'));
+        return view('admin.refund.info.edit',compact('data'));
+    }
+
+    /**
+     * 保存修改
+     */
+    private function _updateSave() {
+        $data = (array) request('data');
+        $ok = $this->repository->update(request('id'),$data);
+        if($ok) {
+            $url[] = array('url'=>U( 'Refund/Info/index'),'title'=>'返回列表');
+            return $this->showMessage('操作成功',urldecode(request('_referer')));
+        }else{
+            $url[] = array('url'=>U( 'Refund/Info/index'),'title'=>'返回列表');
+            return $this->showWarning('操作失败',$url);
+        }
+    }
+
+    public function view(Request $request) {
+        $data = $this->repository->find(request('id'));
+        return view('admin.refund.info.view',compact('data'));
+    }
+
+
+    /**
+     *
+     * 状态改变
+     *
+     */
+    public function status(Request $request) {
+        $ok = $this->repository->updateStatus(request('id'),request('status'));
+        if($ok) {
+            return $this->showMessage('操作成功');
+        }else{
+            return $this->showWarning('操作失败');
+        }
+    }
+    
+    /**
+     * 删除
+     */
+    public function destroy(Request $request) {
+        $bool = $this->repository->destroy($request->get('id'));
+        if($bool) {
+            return  $this->showMessage('操作成功');
+        }else{
+            return  $this->showWarning("操作失败");
+        }
+    }
+}

+ 138 - 0
app/Http/Controllers/Admin/Setting/InfoController.php

xqd
@@ -0,0 +1,138 @@
+<?php
+/**
+ *  基础设置
+ *  @author  system
+ *  @version    1.0
+ *  @date 2018-07-22 14:05:49
+ *
+ */
+namespace App\Http\Controllers\Admin\Setting;
+use App\Http\Controllers\Admin\Controller;
+use Illuminate\Http\Request;
+use App\Repositories\Base\Criteria\OrderBy;
+use App\Repositories\Setting\Criteria\MultiWhere;
+use App\Repositories\Setting\InfoRepository;
+
+class InfoController extends Controller
+{
+    private $repository;
+
+    public function __construct(InfoRepository $repository) {
+        if(!$this->repository) $this->repository = $repository;
+    }
+
+    function index(Request $request) {
+        $search['keyword'] = $request->input('keyword');
+        $query = $this->repository->pushCriteria(new MultiWhere($search));
+
+        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+        $query = $query->pushCriteria(new OrderBy($request['sort_field'],$request['sort_field_by']));
+        }else{
+            $query = $query->pushCriteria(new OrderBy('id','DESC'));
+        }
+        $list = $query->paginate();
+        return view('admin.setting.info.index',compact('list'));
+    }
+
+
+    function check(Request $request) {
+        $request = $request->all();
+        $search['keyword'] = $request->input('keyword');
+        $orderby = array();
+        if(isset($request['sort_field']) && $request['sort_field'] && isset($request['sort_field_by'])) {
+            $orderby[$request['sort_field']] = $request['sort_field_by'];
+        }
+        $list = $this->repository->search($search,$orderby);
+        return view('admin.setting.info.check',compact('list'));
+    }
+
+
+    /**
+     * 添加
+     * 
+     */
+    public function create(Request $request)
+    {
+        if($request->method() == 'POST') {
+            return $this->_createSave();
+        }
+        return view('admin.setting.info.edit');
+    }
+
+    /**
+     * 保存修改
+     */
+    private function _createSave(){
+        $data = (array) request('data');
+        $id = $this->repository->create($data);
+        if($id) {
+            $url[] = array('url'=>U( 'Setting/Info/index'),'title'=>'返回列表');
+            $url[] = array('url'=>U( 'Setting/Info/create'),'title'=>'继续添加');
+            $this->showMessage('添加成功',$url);
+        }else{
+            $url[] = array('url'=>U( 'Setting/Info/index'),'title'=>'返回列表');
+            return $this->showWarning('添加失败',$url);
+        }
+    }
+    
+    /**
+     * 
+     * 修改
+     * 
+     * 
+     */
+    public function update(Request $request) {
+        if($request->method() == 'POST') {
+            return $this->_updateSave();
+        }
+        $data = $this->repository->find($request->get('id'));
+        return view('admin.setting.info.edit',compact('data'));
+    }
+
+    /**
+     * 保存修改
+     */
+    private function _updateSave() {
+        $data = (array) request('data');
+        $ok = $this->repository->update(request('id'),$data);
+        if($ok) {
+            $url[] = array('url'=>U( 'Setting/Info/index'),'title'=>'返回列表');
+            return $this->showMessage('操作成功',urldecode(request('_referer')));
+        }else{
+            $url[] = array('url'=>U( 'Setting/Info/index'),'title'=>'返回列表');
+            return $this->showWarning('操作失败',$url);
+        }
+    }
+
+    public function view(Request $request) {
+        $data = $this->repository->find(request('id'));
+        return view('admin.setting.info.view',compact('data'));
+    }
+
+
+    /**
+     *
+     * 状态改变
+     *
+     */
+    public function status(Request $request) {
+        $ok = $this->repository->updateStatus(request('id'),request('status'));
+        if($ok) {
+            return $this->showMessage('操作成功');
+        }else{
+            return $this->showWarning('操作失败');
+        }
+    }
+    
+    /**
+     * 删除
+     */
+    public function destroy(Request $request) {
+        $bool = $this->repository->destroy($request->get('id'));
+        if($bool) {
+            return  $this->showMessage('操作成功');
+        }else{
+            return  $this->showWarning("操作失败");
+        }
+    }
+}

+ 1 - 1
app/Http/Controllers/Api/V1/Controller.php

xqd
@@ -21,7 +21,7 @@ class Controller extends BaseController
         $this->middleware('auth:api', [
             'except' => [
                 'upload', 'getCode', 'reset', 'login', 'get', 'register', 'alipayNotify', 'wechatpayNotify',
-                'get', 'area', 'get_province', 'get_city', 'get_county', 'test','getProducts','getProduct','getStores','getSchedule','createOrder','couponList','myCoupon','getCoupon'
+                'get', 'area', 'get_province', 'get_city', 'get_county', 'test','getProducts','getProduct','getStores','getSchedule','createOrder','couponList','myCoupon','getCoupon','usableCoupon','refund','myOrders','orderDetail'
 
             ]
         ]);

+ 329 - 5
app/Http/Controllers/Api/V1/HomeController.php

xqd xqd xqd xqd xqd
@@ -316,14 +316,14 @@ class HomeController extends Controller
      * @apiGroup Photo
      * @apiPermission None
      * @apiVersion 0.1.0
-     * @apiParam {string}    user_id         user_id
-     * @apiParam {string}    store_id        预约得店铺ID
-     * @apiParam {string}    product_id      产品规格ID
+     * @apiParam {int}    user_id           user_id
+     * @apiParam {int}    store_id          预约店铺ID
+     * @apiParam {int}    product_id      产品规格ID
      * @apiParam {string}    schedule_time   预约时间
      * @apiParam {string}    username        到店人姓名
      * @apiParam {string}    phone           联系方式
      * @apiParam {string}    email           邮箱(接受照片用)
-     * @apiParam {string}    sex             性别
+     * @apiParam {int}       sex                性别 (0:男;1:女)
      * @apiParam {string}    [comment]       备注
      * @apiSuccessExample {json} Success-Response:
      * HTTP/1.1 200 OK
@@ -347,6 +347,7 @@ class HomeController extends Controller
      *                  "price": 199,                                //应付金额
      *                  "deposit": 100                               //定金
      *              }
+     *          }
      *
      * }
      * @apiErrorExample {json} Error-Response:
@@ -420,6 +421,158 @@ class HomeController extends Controller
         return $this->api(compact('order'));
     }
 
+    /**
+     * @api {get} /api/home/myorders 我的订单
+     * @apiDescription 我的订单
+     * @apiGroup Photo
+     * @apiPermission None
+     * @apiVersion 0.1.0
+     * @apiParam {int}    user_id           user_id
+     * @apiParam {int}    [status]          订单状态:1:已付款,未完成拍摄;2:拍摄完成;3:已取消
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "state": true,
+     *     "code": 0,
+     *     "message": "",
+     *     "data": {
+     *          "orders": [
+     *              {
+     *                  "id": 6,
+     *                  "out_trade_no": "s10006",                //订单号
+     *                  "username": "lee",
+     *                  "schedule_time": "2018-07-19 11:00:00",  //预约时间
+     *                  "product_id": 1,
+     *                  "status": 1,                             //订单状态
+     *                  "store_id": "1",
+     *                  "storename": "青羊店",                    //店铺名称
+     *                  "product_name": "证件照"                  //产品名称
+     *              },
+     *              {
+     *                  "id": 7,
+     *                  "out_trade_no": "s10007",
+     *                  "username": "lee",
+     *                  "schedule_time": "2018-07-19 11:00:00",
+     *                  "product_id": 1,
+     *                  "status": 3,
+     *                  "store_id": "1",
+     *                  "storename": "青羊店",
+     *                  "product_name": "证件照"
+     *              }
+     *          ]
+     *      }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     */
+    public function myOrders(Request $request)
+    {
+        $validator = Validator::make($request->all(),
+            [
+                'user_id' => 'required',
+            ],
+            [
+                'user_id.required' => 'user_id不能为空!',
+            ]
+        );
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+
+        if (request('status')) {
+            $orders = OrderInfoModel::where('user_id', request('user_id'))->where('status', request('status'))->get(['id', 'out_trade_no', 'username', 'schedule_time', 'product_id', 'status', 'store_id']);
+        } else {
+            $orders = OrderInfoModel::where('user_id', request('user_id'))->where('status', '>', 0)->get();
+        }
+
+        foreach ($orders as $order) {
+            $store = $order->store();
+            $product = ProductInfoModel::find($order->product_id);
+
+            $order['storename'] = $store;
+            $order['product_name'] = $product->name;
+        }
+
+
+        return $this->api(compact('orders'));
+    }
+
+    /**
+     * @api {get} /api/home/order 获取订单详情
+     * @apiDescription 获取订单详情
+     * @apiGroup Photo
+     * @apiPermission None
+     * @apiVersion 0.1.0
+     * @apiParam {int}    user_id           user_id
+     * @apiParam {int}    order_id          订单ID
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "state": true,
+     *     "code": 0,
+     *     "message": "",
+     *     "data": {
+     *          "order": {
+     *                  "id": 27,
+     *                  "out_trade_no": "xxg1531993028",            //订单编号
+     *                  "username": "lee",                          //联系人
+     *                  "phone": "13407570876",                     //联系电话
+     *                  "email": "154@qq.com",                      //邮箱
+     *                  "schedule_time": "2018-07-19 11:00:00",     //预约时间
+     *                  "status": 0,
+     *                  "store_id": "1",
+     *                  "storename": "青羊店",                        //店铺名称
+     *                  "product_name": "证件照",                     //产品名称
+     *                  "service_time": "约120分钟",                  //服务时长
+     *                  "price": 199,                                //应付金额
+     *                  "deposit": 100                               //定金
+     *              }
+     *          }
+     *
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     */
+    public function orderDetail(Request $request){
+        $validator = Validator::make($request->all(),
+            [
+                'user_id' => 'required',
+                'order_id' => 'required',
+            ],
+            [
+                'user_id.required' => 'user_id不能为空!',
+                'order_id.required' => 'user_id不能为空!',
+            ]
+        );
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+
+        $order = OrderInfoModel::select(['id', 'out_trade_no', 'username', 'phone', 'email', 'schedule_time', 'status', 'store_id', 'price', 'deposit'])->find(request('order_id'));
+        $store = $order->store();
+        $product = ProductInfoModel::find(request($order->product_id))->first();
+
+        $order['storename'] = $store;
+        $order['product_name'] = $product->name;
+        $order['service_time'] = $product->service_time;
+
+        return $this->api(compact('order'));
+
+
+    }
+
     /**
      * @api {post} /api/home/pay   获取微信支付签名信息
      * @apiDescription  获取微信支付签名信息
@@ -484,7 +637,7 @@ class HomeController extends Controller
         $app = Factory::payment($this->options());
 
         $result = $app->order->unify([
-            'body' => '高考志愿助手 - 付费查询',
+            'body' => '',
             'out_trade_no' => $order->out_trade_no,
             'total_fee' => $money * 100,
             'trade_type' => 'JSAPI',
@@ -769,6 +922,177 @@ class HomeController extends Controller
 
     }
 
+
+    /**
+     * @api {get} /api/home/usablecoupon   获取订单可用的优惠券
+     * @apiDescription  获取订单可用的优惠券
+     * @apiGroup Photo
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {int}       user_id      用户ID
+     * @apiParam {int}       product_id   产品规格ID,订单中获取
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "status": true,
+     *     "status_code": 0,
+     *     "message": "",
+     *     "data": {
+     *              "usablecoupons": [
+     *                  {
+     *                      "id": 1,
+     *                      "coupon_id": 1,
+     *                      "user_id": 1,
+     *                      "coupon": {
+     *                      "id": 1,
+     *                      "name": "证件照七折优惠",
+     *                      "type": "1",
+     *                      "min_price": 100,
+     *                      "discount": "7",
+     *                      "discount_price": null,
+     *                      "product_id": "1,2",
+     *                      "count": 7,
+     *                      "end_time": "2018-07-31",
+     *                      "created_at": "2018-07-13 07:29:27",
+     *                      "updated_at": "2018-07-21 07:41:59"
+     *                  }
+     *              }
+     *          ]
+     *      }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+    public function usableCoupon(Request $request)
+    {
+
+        $validator = Validator::make($request->all(),
+            [
+                'user_id' => 'required',
+                'product_id' => 'required'
+
+            ],
+            [
+                'user_id.required' => 'user_id不能为空!',
+                'product_id.required' => 'product_id不能为空!'
+            ]
+        );
+
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+
+        $mycoupons = UserCouponRelationModel::where('user_id', request('user_id'))->with('coupon')->orderBy('created_at', 'desc')->get();
+        $usablecoupons = $mycoupons->filter(function ($value) {
+            $flag = false;
+
+            $product = ProductInfoModel::find(request('product_id'));
+            $products = explode(',', $value->coupon->product_id);
+
+            if ((strtotime($value->coupon->end_time) > strtotime(Carbon::now('Asia/Shanghai'))) && in_array($product->category_id, $products)) {
+                $flag = true;
+            } else {
+                $flag = false;
+            }
+
+            return $flag;
+
+        });
+
+        return $this->api(compact('usablecoupons'));
+
+
+    }
+
+    /**
+     * @api {get} /api/home/refund   申请退款
+     * @apiDescription  申请退款
+     * @apiGroup Photo
+     * @apiPermission none
+     * @apiVersion 0.1.0
+     * @apiParam {int}       user_id      用户ID
+     * @apiParam {int}       order_id   产品规格ID,订单中获取
+     * @apiSuccessExample {json} Success-Response:
+     * HTTP/1.1 200 OK
+     * {
+     *     "status": true,
+     *     "status_code": 0,
+     *     "message": "",
+     *     "data": {
+     *              "code": 200,
+     *              "msg": "退款已申请,请等待商家审核!"
+     *          }
+     * }
+     * @apiErrorExample {json} Error-Response:
+     * HTTP/1.1 400 Bad Request
+     * {
+     *     "state": false,
+     *     "code": 1000,
+     *     "message": "传入参数不正确",
+     *     "data": null or []
+     * }
+     *
+     * {
+     *      "status": true,
+     *      "status_code": 0,
+     *      "message": "",
+     *      "data": {
+     *          "code": 10003,
+     *          "msg": "该订单不能退款,如有疑问,请联系商家!"
+     *      }
+     * }
+     * 可能出现的错误代码:
+     *    1000    CLIENT_WRONG_PARAMS             传入参数不正确
+     */
+
+    public function refund(Request $request)
+    {
+        $validator = Validator::make($request->all(),
+            [
+                'user_id' => 'required',
+                'order_id' => 'required'
+
+            ],
+            [
+                'user_id.required' => 'user_id不能为空!',
+                'order_id.required' => 'order_id不能为空!'
+            ]
+        );
+
+        if ($validator->fails()) {
+            return $this->error(ErrorCode::CLIENT_WRONG_PARAMS, '传入参数不正确!', $validator->messages());
+        }
+
+        $order = OrderInfoModel::find(request('order_id'));
+        if ($order->status != 1) {
+            $data = [
+                'code' => 10003,
+                'msg' => '该订单不能退款,如有疑问,请联系商家!'
+            ];
+            return $this->api($data);
+        }
+
+        $order->status = 3;
+        $ok = $order->save();
+        if ($ok) {
+            $data = [
+                'code' => 200,
+                'msg' => '退款已申请,请等待商家审核!'
+            ];
+            return $this->api($data);
+        }
+
+    }
+
+
     //格式化排期
     function cut_time_part($start, $end, $min = 30, $format = true)
     {

+ 25 - 0
app/Models/OrderInfoModel.php

xqd
@@ -64,4 +64,29 @@ class OrderInfoModel extends BaseModel
       return $this->belongsTo('App\Models\ProductInfoModel','product_id');
   }
 
+  public function status(){
+      switch ($this->status){
+          case 1:
+              return '已付款';
+              break;
+          case 2:
+              return '已完成';
+              break;
+          case 3:
+              return '已取消';
+              break;
+          default:
+              return '未付款';
+              break;
+
+      }
+  }
+
+  public function paidinfo(){
+      return $this->hasOne('App\Models\PaidInfoModel','order_id');
+  }
+
+    public function refundinfo(){
+        return $this->hasOne('App\Models\RefundInfoModel','order_id');
+    }
 }

+ 39 - 0
app/Models/RefundInfoModel.php

xqd
@@ -0,0 +1,39 @@
+<?php
+namespace App\Models;
+use App\Models\BaseModel;
+/**
+ *  @description 退款管理
+ *  @author  system;
+ *  @version    1.0
+ *  @date 2018-07-22 14:03:35
+ *
+ */
+class RefundInfoModel extends BaseModel
+{
+    /**
+     * 数据表名
+     *
+     * @var string
+     *
+     */
+    protected $table = 'refund_info';
+    /**
+    主键
+     */
+    protected $primaryKey = 'id';
+
+    //分页
+    protected $perPage = PAGE_NUMS;
+
+    /**
+     * 可以被集体附值的表的字段
+     *
+     * @var string
+     */
+    protected $fillable = [
+                           'refund_no',
+                           'order_id',
+                           'refund_price'
+                          ];
+
+}

+ 45 - 0
app/Models/SettingInfoModel.php

xqd
@@ -0,0 +1,45 @@
+<?php
+namespace App\Models;
+use App\Models\BaseModel;
+/**
+ *  @description 基础设置
+ *  @author  system;
+ *  @version    1.0
+ *  @date 2018-07-22 14:05:49
+ *
+ */
+class SettingInfoModel extends BaseModel
+{
+    /**
+     * 数据表名
+     *
+     * @var string
+     *
+     */
+    protected $table = 'setting_info';
+    /**
+    主键
+     */
+    protected $primaryKey = 'id';
+
+    //分页
+    protected $perPage = PAGE_NUMS;
+
+    /**
+     * 可以被集体附值的表的字段
+     *
+     * @var string
+     */
+    protected $fillable = [
+                           'app_id',
+                           'app_secret',
+                           'mch_id',
+                           'api_key',
+                           'cert_path',
+                           'key_path',
+                           'free_refund_time',
+                           'refund_poundage_in',
+                           'refund_poundage_out'
+                          ];
+
+}

+ 33 - 0
app/Repositories/Order/InfoRepository.php

xqd
@@ -17,5 +17,38 @@ class InfoRepository extends Repository {
         return \App\Models\OrderInfoModel::class;
     }
 
+    public function searchOrder(array $search,array $orderby=['id'=>'desc'],$pagesize=25)
+    {
+        $currentQuery = $this->model;
+        if(isset($search['keyword']) && ! empty($search['keyword'])) {
+            $keywords = '%' . $search['keyword'] . '%';
+            $currentQuery = $currentQuery->where(function ($query) use ($keywords) {
+                $query->where('out_trade_no'  , 'like', $keywords)
+                    ->orwhere('username', 'like', $keywords)
+                    ->orwhere('email', 'like', $keywords)
+                    ->orwhere('phone', 'like', $keywords);
+            });
+        }
+
+        if(isset($search['status'])) {
+            $currentQuery = $currentQuery->where(function ($query) use ($search) {
+                $query->where('status', $search['status']);
+            });
+
+        }else{
+            $currentQuery = $currentQuery->where(function ($query) use ($search) {
+                $query->where('status','>' ,0);
+            });
+        }
+
+        if($orderby && is_array($orderby)){
+            foreach ($orderby AS $field => $value){
+                //dd($orderby);
+                $currentQuery = $currentQuery -> orderBy($field, $value);
+            }
+        }
+//        $currentQuery = $currentQuery->paginate($pagesize);
+        return $currentQuery;
+    }
     
 }

+ 45 - 0
app/Repositories/Refund/Criteria/MultiWhere.php

xqd
@@ -0,0 +1,45 @@
+<?php
+/**
+ * User: Mike
+ * Email: m@9026.com
+ * Date: 2017/1/12
+ * Time: 17:52
+ */
+
+namespace App\Repositories\Refund\Criteria;
+
+
+
+
+use App\Repositories\Base\Criteria;
+use App\Repositories\Contracts\RepositoryInterface as Repository;
+
+class MultiWhere extends Criteria {
+
+    private $search = [];
+
+    /**
+     * MultiWhere constructor.
+     * @param array $search
+     *
+     */
+    public function __construct(array $search)
+    {
+        $this->search = $search;
+    }
+
+    /**
+    * @param $model
+    * @param RepositoryInterface $repository
+    * @return mixed
+    */
+    public function apply($model, Repository $repository)
+    {
+          if(isset($this->search['updated_at']) && $this->search['updated_at']) {
+                                    $model = $model->where('updated_at',$this->search['updated_at']);
+                                 }
+
+         return $model;
+    }
+
+}

+ 21 - 0
app/Repositories/Refund/InfoRepository.php

xqd
@@ -0,0 +1,21 @@
+<?php
+/**
+ *   退款管理
+ *  @author  system
+ *  @version    1.0
+ *  @date 2018-07-22 14:03:35
+ *
+ */
+namespace App\Repositories\Refund;
+
+use App\Repositories\Base\Repository;
+
+
+class InfoRepository extends Repository {
+
+    public function model() {
+        return \App\Models\RefundInfoModel::class;
+    }
+
+    
+}

+ 45 - 0
app/Repositories/Setting/Criteria/MultiWhere.php

xqd
@@ -0,0 +1,45 @@
+<?php
+/**
+ * User: Mike
+ * Email: m@9026.com
+ * Date: 2017/1/12
+ * Time: 17:52
+ */
+
+namespace App\Repositories\Setting\Criteria;
+
+
+
+
+use App\Repositories\Base\Criteria;
+use App\Repositories\Contracts\RepositoryInterface as Repository;
+
+class MultiWhere extends Criteria {
+
+    private $search = [];
+
+    /**
+     * MultiWhere constructor.
+     * @param array $search
+     *
+     */
+    public function __construct(array $search)
+    {
+        $this->search = $search;
+    }
+
+    /**
+    * @param $model
+    * @param RepositoryInterface $repository
+    * @return mixed
+    */
+    public function apply($model, Repository $repository)
+    {
+          if(isset($this->search['updated_at']) && $this->search['updated_at']) {
+                                    $model = $model->where('updated_at',$this->search['updated_at']);
+                                 }
+
+         return $model;
+    }
+
+}

+ 21 - 0
app/Repositories/Setting/InfoRepository.php

xqd
@@ -0,0 +1,21 @@
+<?php
+/**
+ *   基础设置
+ *  @author  system
+ *  @version    1.0
+ *  @date 2018-07-22 14:05:49
+ *
+ */
+namespace App\Repositories\Setting;
+
+use App\Repositories\Base\Repository;
+
+
+class InfoRepository extends Repository {
+
+    public function model() {
+        return \App\Models\SettingInfoModel::class;
+    }
+
+    
+}

+ 43 - 0
database/migrations/2018_07_22_105854_create_setting_info_table.php

xqd
@@ -0,0 +1,43 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateSettingInfoTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('setting_info', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('app_id')->nullable()->comment('小程序appid');
+            $table->string('app_secret')->nullable()->comment('小程序secret');
+
+            $table->string('mch_id')->nullable()->comment('支付商户号');
+            $table->string('api_key')->nullable()->comment('支付密钥');
+            $table->string('cert_path')->nullable()->comment('支付cart路径');
+            $table->string('key_path')->nullable()->comment('支付key路径');
+
+            $table->string('free_refund_time')->nullable()->comment('免手续费退款时间,小时');
+            $table->string('refund_poundage_in')->nullable()->comment('未到期退款手续费,百分比');
+            $table->string('refund_poundage_out')->nullable()->comment('到期退款手续费,百分比');
+
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('setting_info');
+    }
+}

+ 35 - 0
database/migrations/2018_07_22_105944_create_refund_info_tanle.php

xqd
@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateRefundInfoTanle extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('refund_info', function (Blueprint $table) {
+            $table->increments('id');
+            $table->string('refund_no')->comment('退款单号');
+            $table->integer('order_id')->comment('对应订单号');
+            $table->string('refund_price')->nullable()->comment('退款金额');
+
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('refund_info');
+    }
+}

+ 227 - 11
public/apidoc/api_data.js

xqd xqd xqd xqd xqd xqd xqd xqd
@@ -211,21 +211,21 @@ define({ "api": [
         "Parameter": [
           {
             "group": "Parameter",
-            "type": "string",
+            "type": "int",
             "optional": false,
             "field": "user_id",
             "description": "<p>user_id</p>"
           },
           {
             "group": "Parameter",
-            "type": "string",
+            "type": "int",
             "optional": false,
             "field": "store_id",
-            "description": "<p>预约店铺ID</p>"
+            "description": "<p>预约店铺ID</p>"
           },
           {
             "group": "Parameter",
-            "type": "string",
+            "type": "int",
             "optional": false,
             "field": "product_id",
             "description": "<p>产品规格ID</p>"
@@ -260,10 +260,10 @@ define({ "api": [
           },
           {
             "group": "Parameter",
-            "type": "string",
+            "type": "int",
             "optional": false,
             "field": "sex",
-            "description": "<p>性别</p>"
+            "description": "<p>性别 (0:男;1:女)</p>"
           },
           {
             "group": "Parameter",
@@ -279,7 +279,7 @@ define({ "api": [
       "examples": [
         {
           "title": "Success-Response:",
-          "content": "HTTP/1.1 200 OK\n{\n    \"state\": true,\n    \"code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"order\": {\n                 \"id\": 27,\n                 \"out_trade_no\": \"xxg1531993028\",            //订单编号\n                 \"username\": \"lee\",                          //联系人\n                 \"phone\": \"13407570876\",                     //联系电话\n                 \"email\": \"154@qq.com\",                      //邮箱\n                 \"schedule_time\": \"2018-07-19 11:00:00\",     //预约时间\n                 \"status\": 0,\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",                        //店铺名称\n                 \"product_name\": \"证件照\",                     //产品名称\n                 \"service_time\": \"约120分钟\",                  //服务时长\n                 \"price\": 199,                                //应付金额\n                 \"deposit\": 100                               //定金\n             }\n\n}",
+          "content": "HTTP/1.1 200 OK\n{\n    \"state\": true,\n    \"code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"order\": {\n                 \"id\": 27,\n                 \"out_trade_no\": \"xxg1531993028\",            //订单编号\n                 \"username\": \"lee\",                          //联系人\n                 \"phone\": \"13407570876\",                     //联系电话\n                 \"email\": \"154@qq.com\",                      //邮箱\n                 \"schedule_time\": \"2018-07-19 11:00:00\",     //预约时间\n                 \"status\": 0,\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",                        //店铺名称\n                 \"product_name\": \"证件照\",                     //产品名称\n                 \"service_time\": \"约120分钟\",                  //服务时长\n                 \"price\": 199,                                //应付金额\n                 \"deposit\": 100                               //定金\n             }\n         }\n\n}",
           "type": "json"
         }
       ]
@@ -495,7 +495,7 @@ define({ "api": [
       "examples": [
         {
           "title": "Success-Response:",
-          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"mycoupons\": [\n                 {\n                     \"id\": 1,\n                     \"coupon_id\": 1,\n                     \"user_id\": 1,\n                     \"coupon\": {\n                         \"id\": 1,\n                         \"name\": \"证件照七折优惠\",     //优惠券名字\n                         \"type\": \"1\",                //优惠券类型 0:固定金额优惠,1:折扣优惠\n                         \"min_price\": 100,           //最低使用金额\n                         \"discount\": \"7\",            //折扣\n                         \"discount_price\": null,      //优惠金额\n                         \"product_id\": \"1,2\",         //可使用的产品id\n                         \"count\": 10,\n                         \"end_time\": \"2018-07-31\",     //有效期\n                         \"created_at\": \"2018-07-13 07:29:27\",\n                         \"updated_at\": \"2018-07-18 06:36:38\"\n                         }\n                 }\n             ]\n         }\n}",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"res\": true         //领取成功\n}\n}",
           "type": "json"
         }
       ]
@@ -504,7 +504,7 @@ define({ "api": [
       "examples": [
         {
           "title": "Error-Response:",
-          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n\n{\n     \"status\": true,\n     \"status_code\": 0,\n     \"message\": \"\",\n     \"data\": {\n         \"code\": 10001,\n         \"msg\": \"你已经领取过改优惠券,不能重复领取!\"\n     }\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确\n   1001    CLIENT_WRONG_PARAMS             你已经领取过改优惠券,不能重复领取",
           "type": "json"
         }
       ]
@@ -542,7 +542,7 @@ define({ "api": [
       "examples": [
         {
           "title": "Success-Response:",
-          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"res\": true         //领取成功\n}\n}",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"mycoupons\": [\n                 {\n                     \"id\": 1,\n                     \"coupon_id\": 1,\n                     \"user_id\": 1,\n                     \"coupon\": {\n                         \"id\": 1,\n                         \"name\": \"证件照七折优惠\",     //优惠券名字\n                         \"type\": \"1\",                //优惠券类型 0:固定金额优惠,1:折扣优惠\n                         \"min_price\": 100,           //最低使用金额\n                         \"discount\": \"7\",            //折扣\n                         \"discount_price\": null,      //优惠金额\n                         \"product_id\": \"1,2\",         //可使用的产品id\n                         \"count\": 10,\n                         \"end_time\": \"2018-07-31\",     //有效期\n                         \"created_at\": \"2018-07-13 07:29:27\",\n                         \"updated_at\": \"2018-07-18 06:36:38\"\n                         }\n                 }\n             ]\n         }\n}",
           "type": "json"
         }
       ]
@@ -551,7 +551,7 @@ define({ "api": [
       "examples": [
         {
           "title": "Error-Response:",
-          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n\n{\n     \"status\": true,\n     \"status_code\": 0,\n     \"message\": \"\",\n     \"data\": {\n         \"code\": 10001,\n         \"msg\": \"你已经领取过改优惠券,不能重复领取!\"\n     }\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确\n   1001    CLIENT_WRONG_PARAMS             你已经领取过改优惠券,不能重复领取",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
           "type": "json"
         }
       ]
@@ -560,6 +560,222 @@ define({ "api": [
     "groupTitle": "Photo",
     "name": "GetApiHomeMycoupon"
   },
+  {
+    "type": "get",
+    "url": "/api/home/myorders",
+    "title": "我的订单",
+    "description": "<p>我的订单</p>",
+    "group": "Photo",
+    "permission": [
+      {
+        "name": "None"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "user_id",
+            "description": "<p>user_id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "status",
+            "description": "<p>订单状态:1:已付款,未完成拍摄;2:拍摄完成;3:已取消</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"state\": true,\n    \"code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"orders\": [\n             {\n                 \"id\": 6,\n                 \"out_trade_no\": \"s10006\",                //订单号\n                 \"username\": \"lee\",\n                 \"schedule_time\": \"2018-07-19 11:00:00\",  //预约时间\n                 \"product_id\": 1,\n                 \"status\": 1,                             //订单状态\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",                    //店铺名称\n                 \"product_name\": \"证件照\"                  //产品名称\n             },\n             {\n                 \"id\": 7,\n                 \"out_trade_no\": \"s10007\",\n                 \"username\": \"lee\",\n                 \"schedule_time\": \"2018-07-19 11:00:00\",\n                 \"product_id\": 1,\n                 \"status\": 3,\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",\n                 \"product_name\": \"证件照\"\n             }\n         ]\n     }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/HomeController.php",
+    "groupTitle": "Photo",
+    "name": "GetApiHomeMyorders"
+  },
+  {
+    "type": "get",
+    "url": "/api/home/order",
+    "title": "获取订单详情",
+    "description": "<p>获取订单详情</p>",
+    "group": "Photo",
+    "permission": [
+      {
+        "name": "None"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "user_id",
+            "description": "<p>user_id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "order_id",
+            "description": "<p>订单ID</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"state\": true,\n    \"code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"order\": {\n                 \"id\": 27,\n                 \"out_trade_no\": \"xxg1531993028\",            //订单编号\n                 \"username\": \"lee\",                          //联系人\n                 \"phone\": \"13407570876\",                     //联系电话\n                 \"email\": \"154@qq.com\",                      //邮箱\n                 \"schedule_time\": \"2018-07-19 11:00:00\",     //预约时间\n                 \"status\": 0,\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",                        //店铺名称\n                 \"product_name\": \"证件照\",                     //产品名称\n                 \"service_time\": \"约120分钟\",                  //服务时长\n                 \"price\": 199,                                //应付金额\n                 \"deposit\": 100                               //定金\n             }\n         }\n\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/HomeController.php",
+    "groupTitle": "Photo",
+    "name": "GetApiHomeOrder"
+  },
+  {
+    "type": "get",
+    "url": "/api/home/refund",
+    "title": "申请退款",
+    "description": "<p>申请退款</p>",
+    "group": "Photo",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "user_id",
+            "description": "<p>用户ID</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "order_id",
+            "description": "<p>产品规格ID,订单中获取</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"code\": 200,\n             \"msg\": \"退款已申请,请等待商家审核!\"\n         }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n\n{\n     \"status\": true,\n     \"status_code\": 0,\n     \"message\": \"\",\n     \"data\": {\n         \"code\": 10003,\n         \"msg\": \"该订单不能退款,如有疑问,请联系商家!\"\n     }\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/HomeController.php",
+    "groupTitle": "Photo",
+    "name": "GetApiHomeRefund"
+  },
+  {
+    "type": "get",
+    "url": "/api/home/usablecoupon",
+    "title": "获取订单可用的优惠券",
+    "description": "<p>获取订单可用的优惠券</p>",
+    "group": "Photo",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "user_id",
+            "description": "<p>用户ID</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "product_id",
+            "description": "<p>产品规格ID,订单中获取</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"usablecoupons\": [\n                 {\n                     \"id\": 1,\n                     \"coupon_id\": 1,\n                     \"user_id\": 1,\n                     \"coupon\": {\n                     \"id\": 1,\n                     \"name\": \"证件照七折优惠\",\n                     \"type\": \"1\",\n                     \"min_price\": 100,\n                     \"discount\": \"7\",\n                     \"discount_price\": null,\n                     \"product_id\": \"1,2\",\n                     \"count\": 7,\n                     \"end_time\": \"2018-07-31\",\n                     \"created_at\": \"2018-07-13 07:29:27\",\n                     \"updated_at\": \"2018-07-21 07:41:59\"\n                 }\n             }\n         ]\n     }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/HomeController.php",
+    "groupTitle": "Photo",
+    "name": "GetApiHomeUsablecoupon"
+  },
   {
     "type": "post",
     "url": "/api/home/pay",

+ 227 - 11
public/apidoc/api_data.json

xqd xqd xqd xqd xqd xqd xqd xqd
@@ -211,21 +211,21 @@
         "Parameter": [
           {
             "group": "Parameter",
-            "type": "string",
+            "type": "int",
             "optional": false,
             "field": "user_id",
             "description": "<p>user_id</p>"
           },
           {
             "group": "Parameter",
-            "type": "string",
+            "type": "int",
             "optional": false,
             "field": "store_id",
-            "description": "<p>预约店铺ID</p>"
+            "description": "<p>预约店铺ID</p>"
           },
           {
             "group": "Parameter",
-            "type": "string",
+            "type": "int",
             "optional": false,
             "field": "product_id",
             "description": "<p>产品规格ID</p>"
@@ -260,10 +260,10 @@
           },
           {
             "group": "Parameter",
-            "type": "string",
+            "type": "int",
             "optional": false,
             "field": "sex",
-            "description": "<p>性别</p>"
+            "description": "<p>性别 (0:男;1:女)</p>"
           },
           {
             "group": "Parameter",
@@ -279,7 +279,7 @@
       "examples": [
         {
           "title": "Success-Response:",
-          "content": "HTTP/1.1 200 OK\n{\n    \"state\": true,\n    \"code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"order\": {\n                 \"id\": 27,\n                 \"out_trade_no\": \"xxg1531993028\",            //订单编号\n                 \"username\": \"lee\",                          //联系人\n                 \"phone\": \"13407570876\",                     //联系电话\n                 \"email\": \"154@qq.com\",                      //邮箱\n                 \"schedule_time\": \"2018-07-19 11:00:00\",     //预约时间\n                 \"status\": 0,\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",                        //店铺名称\n                 \"product_name\": \"证件照\",                     //产品名称\n                 \"service_time\": \"约120分钟\",                  //服务时长\n                 \"price\": 199,                                //应付金额\n                 \"deposit\": 100                               //定金\n             }\n\n}",
+          "content": "HTTP/1.1 200 OK\n{\n    \"state\": true,\n    \"code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"order\": {\n                 \"id\": 27,\n                 \"out_trade_no\": \"xxg1531993028\",            //订单编号\n                 \"username\": \"lee\",                          //联系人\n                 \"phone\": \"13407570876\",                     //联系电话\n                 \"email\": \"154@qq.com\",                      //邮箱\n                 \"schedule_time\": \"2018-07-19 11:00:00\",     //预约时间\n                 \"status\": 0,\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",                        //店铺名称\n                 \"product_name\": \"证件照\",                     //产品名称\n                 \"service_time\": \"约120分钟\",                  //服务时长\n                 \"price\": 199,                                //应付金额\n                 \"deposit\": 100                               //定金\n             }\n         }\n\n}",
           "type": "json"
         }
       ]
@@ -495,7 +495,7 @@
       "examples": [
         {
           "title": "Success-Response:",
-          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"mycoupons\": [\n                 {\n                     \"id\": 1,\n                     \"coupon_id\": 1,\n                     \"user_id\": 1,\n                     \"coupon\": {\n                         \"id\": 1,\n                         \"name\": \"证件照七折优惠\",     //优惠券名字\n                         \"type\": \"1\",                //优惠券类型 0:固定金额优惠,1:折扣优惠\n                         \"min_price\": 100,           //最低使用金额\n                         \"discount\": \"7\",            //折扣\n                         \"discount_price\": null,      //优惠金额\n                         \"product_id\": \"1,2\",         //可使用的产品id\n                         \"count\": 10,\n                         \"end_time\": \"2018-07-31\",     //有效期\n                         \"created_at\": \"2018-07-13 07:29:27\",\n                         \"updated_at\": \"2018-07-18 06:36:38\"\n                         }\n                 }\n             ]\n         }\n}",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"res\": true         //领取成功\n}\n}",
           "type": "json"
         }
       ]
@@ -504,7 +504,7 @@
       "examples": [
         {
           "title": "Error-Response:",
-          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n\n{\n     \"status\": true,\n     \"status_code\": 0,\n     \"message\": \"\",\n     \"data\": {\n         \"code\": 10001,\n         \"msg\": \"你已经领取过改优惠券,不能重复领取!\"\n     }\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确\n   1001    CLIENT_WRONG_PARAMS             你已经领取过改优惠券,不能重复领取",
           "type": "json"
         }
       ]
@@ -542,7 +542,7 @@
       "examples": [
         {
           "title": "Success-Response:",
-          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"res\": true         //领取成功\n}\n}",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"mycoupons\": [\n                 {\n                     \"id\": 1,\n                     \"coupon_id\": 1,\n                     \"user_id\": 1,\n                     \"coupon\": {\n                         \"id\": 1,\n                         \"name\": \"证件照七折优惠\",     //优惠券名字\n                         \"type\": \"1\",                //优惠券类型 0:固定金额优惠,1:折扣优惠\n                         \"min_price\": 100,           //最低使用金额\n                         \"discount\": \"7\",            //折扣\n                         \"discount_price\": null,      //优惠金额\n                         \"product_id\": \"1,2\",         //可使用的产品id\n                         \"count\": 10,\n                         \"end_time\": \"2018-07-31\",     //有效期\n                         \"created_at\": \"2018-07-13 07:29:27\",\n                         \"updated_at\": \"2018-07-18 06:36:38\"\n                         }\n                 }\n             ]\n         }\n}",
           "type": "json"
         }
       ]
@@ -551,7 +551,7 @@
       "examples": [
         {
           "title": "Error-Response:",
-          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n\n{\n     \"status\": true,\n     \"status_code\": 0,\n     \"message\": \"\",\n     \"data\": {\n         \"code\": 10001,\n         \"msg\": \"你已经领取过改优惠券,不能重复领取!\"\n     }\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确\n   1001    CLIENT_WRONG_PARAMS             你已经领取过改优惠券,不能重复领取",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
           "type": "json"
         }
       ]
@@ -560,6 +560,222 @@
     "groupTitle": "Photo",
     "name": "GetApiHomeMycoupon"
   },
+  {
+    "type": "get",
+    "url": "/api/home/myorders",
+    "title": "我的订单",
+    "description": "<p>我的订单</p>",
+    "group": "Photo",
+    "permission": [
+      {
+        "name": "None"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "user_id",
+            "description": "<p>user_id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": true,
+            "field": "status",
+            "description": "<p>订单状态:1:已付款,未完成拍摄;2:拍摄完成;3:已取消</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"state\": true,\n    \"code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"orders\": [\n             {\n                 \"id\": 6,\n                 \"out_trade_no\": \"s10006\",                //订单号\n                 \"username\": \"lee\",\n                 \"schedule_time\": \"2018-07-19 11:00:00\",  //预约时间\n                 \"product_id\": 1,\n                 \"status\": 1,                             //订单状态\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",                    //店铺名称\n                 \"product_name\": \"证件照\"                  //产品名称\n             },\n             {\n                 \"id\": 7,\n                 \"out_trade_no\": \"s10007\",\n                 \"username\": \"lee\",\n                 \"schedule_time\": \"2018-07-19 11:00:00\",\n                 \"product_id\": 1,\n                 \"status\": 3,\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",\n                 \"product_name\": \"证件照\"\n             }\n         ]\n     }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/HomeController.php",
+    "groupTitle": "Photo",
+    "name": "GetApiHomeMyorders"
+  },
+  {
+    "type": "get",
+    "url": "/api/home/order",
+    "title": "获取订单详情",
+    "description": "<p>获取订单详情</p>",
+    "group": "Photo",
+    "permission": [
+      {
+        "name": "None"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "user_id",
+            "description": "<p>user_id</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "order_id",
+            "description": "<p>订单ID</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"state\": true,\n    \"code\": 0,\n    \"message\": \"\",\n    \"data\": {\n         \"order\": {\n                 \"id\": 27,\n                 \"out_trade_no\": \"xxg1531993028\",            //订单编号\n                 \"username\": \"lee\",                          //联系人\n                 \"phone\": \"13407570876\",                     //联系电话\n                 \"email\": \"154@qq.com\",                      //邮箱\n                 \"schedule_time\": \"2018-07-19 11:00:00\",     //预约时间\n                 \"status\": 0,\n                 \"store_id\": \"1\",\n                 \"storename\": \"青羊店\",                        //店铺名称\n                 \"product_name\": \"证件照\",                     //产品名称\n                 \"service_time\": \"约120分钟\",                  //服务时长\n                 \"price\": 199,                                //应付金额\n                 \"deposit\": 100                               //定金\n             }\n         }\n\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/HomeController.php",
+    "groupTitle": "Photo",
+    "name": "GetApiHomeOrder"
+  },
+  {
+    "type": "get",
+    "url": "/api/home/refund",
+    "title": "申请退款",
+    "description": "<p>申请退款</p>",
+    "group": "Photo",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "user_id",
+            "description": "<p>用户ID</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "order_id",
+            "description": "<p>产品规格ID,订单中获取</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"code\": 200,\n             \"msg\": \"退款已申请,请等待商家审核!\"\n         }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n\n{\n     \"status\": true,\n     \"status_code\": 0,\n     \"message\": \"\",\n     \"data\": {\n         \"code\": 10003,\n         \"msg\": \"该订单不能退款,如有疑问,请联系商家!\"\n     }\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/HomeController.php",
+    "groupTitle": "Photo",
+    "name": "GetApiHomeRefund"
+  },
+  {
+    "type": "get",
+    "url": "/api/home/usablecoupon",
+    "title": "获取订单可用的优惠券",
+    "description": "<p>获取订单可用的优惠券</p>",
+    "group": "Photo",
+    "permission": [
+      {
+        "name": "none"
+      }
+    ],
+    "version": "0.1.0",
+    "parameter": {
+      "fields": {
+        "Parameter": [
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "user_id",
+            "description": "<p>用户ID</p>"
+          },
+          {
+            "group": "Parameter",
+            "type": "int",
+            "optional": false,
+            "field": "product_id",
+            "description": "<p>产品规格ID,订单中获取</p>"
+          }
+        ]
+      }
+    },
+    "success": {
+      "examples": [
+        {
+          "title": "Success-Response:",
+          "content": "HTTP/1.1 200 OK\n{\n    \"status\": true,\n    \"status_code\": 0,\n    \"message\": \"\",\n    \"data\": {\n             \"usablecoupons\": [\n                 {\n                     \"id\": 1,\n                     \"coupon_id\": 1,\n                     \"user_id\": 1,\n                     \"coupon\": {\n                     \"id\": 1,\n                     \"name\": \"证件照七折优惠\",\n                     \"type\": \"1\",\n                     \"min_price\": 100,\n                     \"discount\": \"7\",\n                     \"discount_price\": null,\n                     \"product_id\": \"1,2\",\n                     \"count\": 7,\n                     \"end_time\": \"2018-07-31\",\n                     \"created_at\": \"2018-07-13 07:29:27\",\n                     \"updated_at\": \"2018-07-21 07:41:59\"\n                 }\n             }\n         ]\n     }\n}",
+          "type": "json"
+        }
+      ]
+    },
+    "error": {
+      "examples": [
+        {
+          "title": "Error-Response:",
+          "content": "HTTP/1.1 400 Bad Request\n{\n    \"state\": false,\n    \"code\": 1000,\n    \"message\": \"传入参数不正确\",\n    \"data\": null or []\n}\n可能出现的错误代码:\n   1000    CLIENT_WRONG_PARAMS             传入参数不正确",
+          "type": "json"
+        }
+      ]
+    },
+    "filename": "app/Http/Controllers/Api/V1/HomeController.php",
+    "groupTitle": "Photo",
+    "name": "GetApiHomeUsablecoupon"
+  },
   {
     "type": "post",
     "url": "/api/home/pay",

+ 1 - 1
public/apidoc/api_project.js

xqd
@@ -7,7 +7,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2018-07-21T08:21:09.441Z",
+    "time": "2018-07-22T15:37:20.260Z",
     "url": "http://apidocjs.com",
     "version": "0.17.6"
   }

+ 1 - 1
public/apidoc/api_project.json

xqd
@@ -7,7 +7,7 @@
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2018-07-21T08:21:09.441Z",
+    "time": "2018-07-22T15:37:20.260Z",
     "url": "http://apidocjs.com",
     "version": "0.17.6"
   }

+ 15 - 1
resources/views/admin/order/info/index.blade.php

xqd xqd
@@ -37,11 +37,12 @@
                         <tr>
                             <th class="sorting" data-sort="out_trade_no"> 订单编号</th>
                             <th class="sorting" data-sort="username"> 用户姓名</th>
-                            <th class="sorting" data-sort="sex"> 性别 </th>
+                            <th class="sorting" data-sort="sex"> 性别</th>
                             <th class="sorting" data-sort="phone"> 电话</th>
                             <th class="sorting" data-sort="email"> 邮箱</th>
                             <th class="sorting" data-sort="store_id"> 预约店铺</th>
                             <th class="sorting" data-sort="schedule_time"> 预约时间</th>
+                            <th class="sorting" data-sort="status">订单状态</th>
                             <th width="22%">相关操作</th>
                         </tr>
                         </thead>
@@ -56,7 +57,20 @@
                                     <td>{{ $item->email }}</td>
                                     <td>{{ $item->store() }}</td>
                                     <td>{{ $item->schedule_time }}</td>
+                                    <td>{{ $item->status() }}</td>
                                     <td>
+                                        @if($item->status ==1)
+                                            <button onclick="window.location.href='{{ U('Order/Info/update',['id'=>$item->id])}}'"
+                                                    class="btn btn-info">拍摄完成
+                                            </button>
+                                        @endif
+
+                                            @if($item->status ==3 && !count($item->refundinfo))
+                                                <button onclick="window.location.href='{{ U('Order/Info/refund',['id'=>$item->id])}}'"
+                                                        class="btn btn-warning">退款
+                                                </button>
+                                            @endif
+
 
                                         @if(role('Order/Info/view'))
                                             <button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Order/Info/view',['id'=>$item->id])}}'});"

+ 88 - 0
resources/views/admin/refund/info/check.blade.php

xqd
@@ -0,0 +1,88 @@
+@extends('admin.layout')
+
+@section('content')
+		<div class="row">
+			<div class="col-sm-12">
+				<div class="ibox float-e-margins">
+					<div class="ibox-title">
+						<h5>退款管理</h5>
+						<div class="ibox-tools">
+							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+							</a>
+						</div>
+					</div>
+					<div class="ibox-content">
+						<div class="row">
+							<form method="GET" action="" accept-charset="UTF-8">
+
+								<div class="col-sm-4">
+									<div class="input-group">
+										<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control">
+								<span class="input-group-btn">
+									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								</span>
+									</div>
+								</div>
+							</form>
+							@if(role('Refund/Info/create'))
+								<div class="col-sm-3 pull-right">
+									<a href="{{ U('Refund/Info/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+								</div>
+							@endif
+						</div>
+
+						<table class="table table-striped table-bordered table-hover dataTables-example dataTable dataCheckTable">
+							<thead>
+							<tr>
+								<th><input class="btSelectAll" name="btSelectAll" type="checkbox"></th>
+								
+            <th class="sorting" data-sort="id"> ID </th>
+            <th class="sorting" data-sort="refund_no"> 退款单号 </th>
+            <th class="sorting" data-sort="order_id"> 对应订单号 </th>
+            <th class="sorting" data-sort="refund_price"> 退款金额 </th>
+            <th class="sorting" data-sort="created_at"> 创建时间 </th>
+            <th class="sorting" data-sort="updated_at"> 更新时间 </th>
+								<th width="22%">相关操作</th>
+							</tr>
+							</thead>
+							<tbody>
+							@if(isset($list))
+								@foreach($list as $key => $item)
+									<tr>
+									<td><input data-json='{!! json_encode($item) !!}'  name="btSelectItem" class="data_key" type="checkbox" value="{{ $item->id or 0 }}" /></td>
+									
+            <td>{{ $item->id }}</td>
+            <td>{{ $item->refund_no }}</td>
+            <td>{{ $item->order_id }}</td>
+            <td>{{ $item->refund_price }}</td>
+            <td>{{ $item->created_at }}</td>
+            <td>{{ $item->updated_at }}</td>
+									<td>
+										@if(role('Refund/Info/view'))
+											<button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Refund/Info/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
+										@endif
+									</td>
+								</tr>
+								@endforeach
+							@endif
+
+							</tbody>
+						</table>
+						<div class="row">
+							<div class="col-sm-6">
+								<div class="dataTables_info" id="DataTables_Table_0_info"
+									 role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+							</div>
+							<div class="col-sm-6">
+								<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+									{!! $list->setPath('')->appends(Request::all())->render() !!}
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	@include('admin.tools.check_script');
+
+@endsection

+ 86 - 0
resources/views/admin/refund/info/edit.blade.php

xqd
@@ -0,0 +1,86 @@
+@extends('admin.layout')
+
+@section('content')
+
+<?php
+    if(!isset($data)) $data = array();
+    if(!$data && session("data")){
+        $data = session("data");
+    }
+    if(!$data && session('_old_input')){
+        $data = session("_old_input");
+    }
+?>
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox float-e-margins">
+				<div class="ibox-title">
+					<h5>退款管理</h5>
+					<div class="ibox-tools">
+						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+						</a>
+					</div>
+				</div>
+				<div class="ibox-content">
+                    @if(role('Refund/Info/index'))
+				    <div class="row">
+    					<div class="col-sm-3 pull-right">
+    					   <a href="{{ U('Refund/Info/index')}}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+    					</div>
+					</div>
+                    @endif
+
+		            <div class="row">
+                        <div class="col-lg-10">
+                            <form name="form_product" id="form-validation" action="" class="form-horizontal form-validation" accept-charset="UTF-8" method="post">
+
+                                    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">退款单号</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_refund_no" name="data[refund_no]" class="form-control" value="{{ $data['refund_no'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">对应订单号</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_order_id" name="data[order_id]" class="form-control" value="{{ $data['order_id'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">退款金额</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_refund_price" name="data[refund_price]" class="form-control" value="{{ $data['refund_price'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>
+                                
+                                <div class="form-group">
+                                    <label class="control-label col-sm-3">&nbsp;</label>
+                                    <div class="col-sm-9">
+                                        <input type="hidden" name="_referer" value="<?php echo urlencode(request()->server('HTTP_REFERER'));?>"/>
+                                        <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"/>
+                                        <input type="submit" class="btn btn-success" style="margin-right:20px;">
+                                        <input type="reset" class="btn btn-default" >
+                                    </div>
+                                </div>
+        
+                            </form>
+                        </div>
+                        <!-- /.col-lg-10 -->
+                    </div>
+                    <!-- /.row -->
+				</div>
+			</div>
+		</div>
+	</div>
+
+@endsection

+ 103 - 0
resources/views/admin/refund/info/index.blade.php

xqd
@@ -0,0 +1,103 @@
+@extends('admin.layout') 
+
+@section('content')
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox float-e-margins">
+				<div class="ibox-title">
+					<h5>退款管理</h5>
+					<div class="ibox-tools">
+						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+						</a>
+					</div>
+				</div>
+				<div class="ibox-content">
+				    <div class="row">
+				        <form method="GET" action="" accept-charset="UTF-8">
+
+				        <div class="col-sm-4">
+				            <div class="input-group">
+								<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control"> 
+								<span class="input-group-btn">
+									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								</span>
+    						</div>
+				        </div>
+				        </form>
+						@if(role('Refund/Info/create'))
+    					<div class="col-sm-3 pull-right">
+    					   <a href="{{ U('Refund/Info/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+    					</div>
+						@endif
+					</div>
+					
+					<table class="table table-striped table-bordered table-hover dataTables-example dataTable">
+						<thead>
+    						<tr>
+								
+            <th class="sorting" data-sort="id"> ID </th>
+            <th class="sorting" data-sort="refund_no"> 退款单号 </th>
+            <th class="sorting" data-sort="order_id"> 对应订单号 </th>
+            <th class="sorting" data-sort="refund_price"> 退款金额 </th>
+            <th class="sorting" data-sort="created_at"> 创建时间 </th>
+            <th class="sorting" data-sort="updated_at"> 更新时间 </th>
+        						<th width="22%">相关操作</th>
+        					</tr>
+						</thead>
+						<tbody>
+						@if(isset($list))
+							@foreach($list as $key => $item)							<tr>
+								
+            <td>{{ $item->id }}</td>
+            <td>{{ $item->refund_no }}</td>
+            <td>{{ $item->order_id }}</td>
+            <td>{{ $item->refund_price }}</td>
+            <td>{{ $item->created_at }}</td>
+            <td>{{ $item->updated_at }}</td>
+								<td>
+									<div class="btn-group">
+										<button data-toggle="dropdown"
+											class="btn btn-warning btn-sm dropdown-toggle"
+											aria-expanded="false">
+											操作 <span class="caret"></span>
+										</button>
+										<ul class="dropdown-menu">
+
+
+											@if(role('Refund/Info/update'))
+											<li><a href="{{ U('Refund/Info/update',['id'=>$item->id])}}" class="font-bold">修改</a></li>
+											@endif
+
+											@if(role('Refund/Info/destroy'))
+											<li class="divider"></li>
+											<li><a href="{{ U('Refund/Info/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作?');">删除</a></li>
+											@endif
+
+										</ul>
+									</div>
+								@if(role('Refund/Info/view'))
+										<button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Refund/Info/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
+									@endif
+								</td>
+							</tr>
+							@endforeach
+							@endif
+
+						</tbody>
+					</table>
+					<div class="row">
+						<div class="col-sm-6">
+							<div class="dataTables_info" id="DataTables_Table_0_info"
+								role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+						</div>
+						<div class="col-sm-6">
+						<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+						{!! $list->setPath('')->appends(Request::all())->render() !!}
+						</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+@endsection

+ 53 - 0
resources/views/admin/refund/info/view.blade.php

xqd
@@ -0,0 +1,53 @@
+@extends('admin.layout')
+
+@section('content')
+<div class="row">
+    <div class="ibox-content">
+        <div class="list-group">
+                                 
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">ID</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['id'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">退款单号</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['refund_no'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">对应订单号</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['order_id'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">退款金额</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['refund_price'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">创建时间</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['created_at'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">更新时间</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['updated_at'] or ''}}</p>
+                                                 
+               </div>
+        </div>
+    </div>
+</div>
+@endsection

+ 90 - 0
resources/views/admin/setting/info/check.blade.php

xqd
@@ -0,0 +1,90 @@
+@extends('admin.layout')
+
+@section('content')
+		<div class="row">
+			<div class="col-sm-12">
+				<div class="ibox float-e-margins">
+					<div class="ibox-title">
+						<h5>基础设置</h5>
+						<div class="ibox-tools">
+							<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+							</a>
+						</div>
+					</div>
+					<div class="ibox-content">
+						<div class="row">
+							<form method="GET" action="" accept-charset="UTF-8">
+
+								<div class="col-sm-4">
+									<div class="input-group">
+										<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control">
+								<span class="input-group-btn">
+									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								</span>
+									</div>
+								</div>
+							</form>
+							@if(role('Setting/Info/create'))
+								<div class="col-sm-3 pull-right">
+									<a href="{{ U('Setting/Info/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+								</div>
+							@endif
+						</div>
+
+						<table class="table table-striped table-bordered table-hover dataTables-example dataTable dataCheckTable">
+							<thead>
+							<tr>
+								<th><input class="btSelectAll" name="btSelectAll" type="checkbox"></th>
+								
+            <th class="sorting" data-sort="id"> ID </th>
+            <th class="sorting" data-sort="app_id"> 小程序appid </th>
+            <th class="sorting" data-sort="app_secret"> 小程序secret </th>
+            <th class="sorting" data-sort="mch_id"> 支付商户号 </th>
+            <th class="sorting" data-sort="api_key"> 支付密钥 </th>
+            <th class="sorting" data-sort="cert_path"> 支付cart路径 </th>
+            <th class="sorting" data-sort="key_path"> 支付key路径 </th>
+								<th width="22%">相关操作</th>
+							</tr>
+							</thead>
+							<tbody>
+							@if(isset($list))
+								@foreach($list as $key => $item)
+									<tr>
+									<td><input data-json='{!! json_encode($item) !!}'  name="btSelectItem" class="data_key" type="checkbox" value="{{ $item->id or 0 }}" /></td>
+									
+            <td>{{ $item->id }}</td>
+            <td>{{ $item->app_id }}</td>
+            <td>{{ $item->app_secret }}</td>
+            <td>{{ $item->mch_id }}</td>
+            <td>{{ $item->api_key }}</td>
+            <td>{{ $item->cert_path }}</td>
+            <td>{{ $item->key_path }}</td>
+									<td>
+										@if(role('Setting/Info/view'))
+											<button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Setting/Info/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
+										@endif
+									</td>
+								</tr>
+								@endforeach
+							@endif
+
+							</tbody>
+						</table>
+						<div class="row">
+							<div class="col-sm-6">
+								<div class="dataTables_info" id="DataTables_Table_0_info"
+									 role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+							</div>
+							<div class="col-sm-6">
+								<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+									{!! $list->setPath('')->appends(Request::all())->render() !!}
+								</div>
+							</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	@include('admin.tools.check_script');
+
+@endsection

+ 140 - 0
resources/views/admin/setting/info/edit.blade.php

xqd
@@ -0,0 +1,140 @@
+@extends('admin.layout')
+
+@section('content')
+
+<?php
+    if(!isset($data)) $data = array();
+    if(!$data && session("data")){
+        $data = session("data");
+    }
+    if(!$data && session('_old_input')){
+        $data = session("_old_input");
+    }
+?>
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox float-e-margins">
+				<div class="ibox-title">
+					<h5>基础设置</h5>
+					<div class="ibox-tools">
+						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+						</a>
+					</div>
+				</div>
+				<div class="ibox-content">
+                    @if(role('Setting/Info/index'))
+				    <div class="row">
+    					<div class="col-sm-3 pull-right">
+    					   <a href="{{ U('Setting/Info/index')}}" class="btn btn-sm btn-primary pull-right">返回列表</a>
+    					</div>
+					</div>
+                    @endif
+
+		            <div class="row">
+                        <div class="col-lg-10">
+                            <form name="form_product" id="form-validation" action="" class="form-horizontal form-validation" accept-charset="UTF-8" method="post">
+
+                                    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">小程序appid</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_app_id" name="data[app_id]" class="form-control" value="{{ $data['app_id'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">小程序secret</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_app_secret" name="data[app_secret]" class="form-control" value="{{ $data['app_secret'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">支付商户号</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_mch_id" name="data[mch_id]" class="form-control" value="{{ $data['mch_id'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">支付密钥</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_api_key" name="data[api_key]" class="form-control" value="{{ $data['api_key'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">支付cart路径</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_cert_path" name="data[cert_path]" class="form-control" value="{{ $data['cert_path'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">支付key路径</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_key_path" name="data[key_path]" class="form-control" value="{{ $data['key_path'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">免手续费退款时间,小时</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_free_refund_time" name="data[free_refund_time]" class="form-control" value="{{ $data['free_refund_time'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">未到期退款手续费,百分比</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_refund_poundage_in" name="data[refund_poundage_in]" class="form-control" value="{{ $data['refund_poundage_in'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>    
+                <div class="form-group">
+                                    
+                 <label class="control-label col-sm-3">到期退款手续费,百分比</label>
+                                    
+                   <div class="col-sm-9">
+                     <input id="data_refund_poundage_out" name="data[refund_poundage_out]" class="form-control" value="{{ $data['refund_poundage_out'] or ''}}" required="" aria-required="true"  placeholder=""> 
+                    </div>
+                                
+                </div>
+                                
+                                <div class="form-group">
+                                    <label class="control-label col-sm-3">&nbsp;</label>
+                                    <div class="col-sm-9">
+                                        <input type="hidden" name="_referer" value="<?php echo urlencode(request()->server('HTTP_REFERER'));?>"/>
+                                        <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>"/>
+                                        <input type="submit" class="btn btn-success" style="margin-right:20px;">
+                                        <input type="reset" class="btn btn-default" >
+                                    </div>
+                                </div>
+        
+                            </form>
+                        </div>
+                        <!-- /.col-lg-10 -->
+                    </div>
+                    <!-- /.row -->
+				</div>
+			</div>
+		</div>
+	</div>
+
+@endsection

+ 105 - 0
resources/views/admin/setting/info/index.blade.php

xqd
@@ -0,0 +1,105 @@
+@extends('admin.layout') 
+
+@section('content')
+	<div class="row">
+		<div class="col-sm-12">
+			<div class="ibox float-e-margins">
+				<div class="ibox-title">
+					<h5>基础设置</h5>
+					<div class="ibox-tools">
+						<a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+						</a>
+					</div>
+				</div>
+				<div class="ibox-content">
+				    <div class="row">
+				        <form method="GET" action="" accept-charset="UTF-8">
+
+				        <div class="col-sm-4">
+				            <div class="input-group">
+								<input type="text" value="{{Request::get('keyword')}}"	placeholder="请输入关键词" name="keyword"class="input-sm form-control"> 
+								<span class="input-group-btn">
+									<button type="submit" class="btn btn-sm btn-primary">搜索</button>
+								</span>
+    						</div>
+				        </div>
+				        </form>
+						@if(role('Setting/Info/create'))
+    					<div class="col-sm-3 pull-right">
+    					   <a href="{{ U('Setting/Info/create')}}" class="btn btn-sm btn-primary pull-right">添加</a>
+    					</div>
+						@endif
+					</div>
+					
+					<table class="table table-striped table-bordered table-hover dataTables-example dataTable">
+						<thead>
+    						<tr>
+								
+            <th class="sorting" data-sort="id"> ID </th>
+            <th class="sorting" data-sort="app_id"> 小程序appid </th>
+            <th class="sorting" data-sort="app_secret"> 小程序secret </th>
+            <th class="sorting" data-sort="mch_id"> 支付商户号 </th>
+            <th class="sorting" data-sort="api_key"> 支付密钥 </th>
+            <th class="sorting" data-sort="cert_path"> 支付cart路径 </th>
+            <th class="sorting" data-sort="key_path"> 支付key路径 </th>
+        						<th width="22%">相关操作</th>
+        					</tr>
+						</thead>
+						<tbody>
+						@if(isset($list))
+							@foreach($list as $key => $item)							<tr>
+								
+            <td>{{ $item->id }}</td>
+            <td>{{ $item->app_id }}</td>
+            <td>{{ $item->app_secret }}</td>
+            <td>{{ $item->mch_id }}</td>
+            <td>{{ $item->api_key }}</td>
+            <td>{{ $item->cert_path }}</td>
+            <td>{{ $item->key_path }}</td>
+								<td>
+									<div class="btn-group">
+										<button data-toggle="dropdown"
+											class="btn btn-warning btn-sm dropdown-toggle"
+											aria-expanded="false">
+											操作 <span class="caret"></span>
+										</button>
+										<ul class="dropdown-menu">
+
+
+											@if(role('Setting/Info/update'))
+											<li><a href="{{ U('Setting/Info/update',['id'=>$item->id])}}" class="font-bold">修改</a></li>
+											@endif
+
+											@if(role('Setting/Info/destroy'))
+											<li class="divider"></li>
+											<li><a href="{{ U('Setting/Info/destroy',['id'=>$item->id])}}" onclick="return confirm('你确定执行删除操作?');">删除</a></li>
+											@endif
+
+										</ul>
+									</div>
+								@if(role('Setting/Info/view'))
+										<button onclick="layer.open({type: 2,area: ['80%', '90%'],content: '{{ U('Setting/Info/view',['id'=>$item->id])}}'});"  class="btn btn-primary ">查看</button>
+									@endif
+								</td>
+							</tr>
+							@endforeach
+							@endif
+
+						</tbody>
+					</table>
+					<div class="row">
+						<div class="col-sm-6">
+							<div class="dataTables_info" id="DataTables_Table_0_info"
+								role="alert" aria-live="polite" aria-relevant="all">每页{{ $list->count() }}条,共{{ $list->lastPage() }}页,总{{ $list->total() }}条。</div>
+						</div>
+						<div class="col-sm-6">
+						<div class="dataTables_paginate paging_simple_numbers" id="DataTables_Table_0_paginate">
+						{!! $list->setPath('')->appends(Request::all())->render() !!}
+						</div>
+						</div>
+					</div>
+				</div>
+			</div>
+		</div>
+	</div>
+@endsection

+ 95 - 0
resources/views/admin/setting/info/view.blade.php

xqd
@@ -0,0 +1,95 @@
+@extends('admin.layout')
+
+@section('content')
+<div class="row">
+    <div class="ibox-content">
+        <div class="list-group">
+                                 
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">ID</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['id'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">小程序appid</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['app_id'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">小程序secret</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['app_secret'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">支付商户号</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['mch_id'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">支付密钥</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['api_key'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">支付cart路径</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['cert_path'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">支付key路径</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['key_path'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">免手续费退款时间,小时</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['free_refund_time'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">未到期退款手续费,百分比</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['refund_poundage_in'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">到期退款手续费,百分比</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['refund_poundage_out'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">创建时间</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['created_at'] or ''}}</p>
+                                                 
+               </div>                     
+               <div class="list-group-item">
+                                                  
+                   <h3 class="list-group-item-heading">更新时间</h3>
+                                                   
+                   <p class="list-group-item-text"> {{ $data['updated_at'] or ''}}</p>
+                                                 
+               </div>
+        </div>
+    </div>
+</div>
+@endsection

+ 21 - 0
routes/api.php

xqd
@@ -61,5 +61,26 @@ $api->version('v1', ['namespace' => 'App\Http\Controllers\Api\V1'], function ($a
         'as' => 'home.getcoupon',
         'uses' => 'HomeController@getCoupon',
     ]);
+    $api->get('home/usablecoupon', [
+        'as' => 'home.usablecoupon',
+        'uses' => 'HomeController@usableCoupon',
+    ]);
+    $api->get('home/refund', [
+        'as' => 'home.refund',
+        'uses' => 'HomeController@refund',
+    ]);
+    $api->get('home/myorders', [
+        'as' => 'home.myorders',
+        'uses' => 'HomeController@myOrders',
+    ]);
+
+    $api->get('home/orderdetail', [
+        'as' => 'home.orderdetail',
+        'uses' => 'HomeController@orderDetail',
+    ]);
+
+
+
+
 
 });