diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php index 8cf7ee2d..4ca478c9 100755 --- a/app/admin/controller/Login.php +++ b/app/admin/controller/Login.php @@ -25,6 +25,8 @@ use app\admin\logic\LoginLogic; use app\admin\validate\LoginValidate; use app\common\basics\AdminBase; use app\common\server\JsonServer; +use app\common\server\WeChatServer; +use EasyWeChat\Factory; class Login extends AdminBase { @@ -36,6 +38,22 @@ class Login extends AdminBase */ public function login() { +// $this->config = WeChatServer::getOaConfig(); +// $this->app = Factory::officialAccount($this->config); +// $this->app->template_message->sendSubscription([ +// 'touser' => 'user-openid', +// 'template_id' => 'template-id', +// 'url' => 'https://easywechat.com', +// 'scene' => 1000, +// 'data' => [ +// 'key1' => 'VALUE', +// 'key2' => 'VALUE2', +// ... +// ], +// ]); +// dump($this->config); +// dump($this->app); +// die; if ($this->request->isAjax()) { $post = request()->post(); (new LoginValidate())->goCheck(); diff --git a/app/api/logic/AfterSaleLogic.php b/app/api/logic/AfterSaleLogic.php index 331d1833..2b9ad4ef 100755 --- a/app/api/logic/AfterSaleLogic.php +++ b/app/api/logic/AfterSaleLogic.php @@ -56,7 +56,7 @@ class AfterSaleLogic extends Logic $where[] = ['o.order_status', 'in', [Order::STATUS_WAIT_RECEIVE, Order::STATUS_FINISH]]; $order = new Order(); $count = $order->alias('o') - ->field('o.id,o.confirm_take_time,o.order_status,o.create_time,s.id as sid,s.name as shop_name,s.type as shop_type') + ->field('o.id,o.confirm_take_time,o.order_status,o.create_time, o.allow_after_sale, s.id as sid,s.name as shop_name,s.type as shop_type') ->join('order_goods g', 'g.order_id = o.id') ->join('shop s', 'o.shop_id = s.id') ->with(['order_goods' => function ($query) { @@ -69,7 +69,7 @@ class AfterSaleLogic extends Logic $lists = $order ->alias('o') - ->field('o.id,o.confirm_take_time,o.order_status,o.order_sn,o.create_time,s.id as sid,s.name as shop_name,s.logo as shop_logo,s.type as shop_type') + ->field('o.id,o.confirm_take_time,o.order_status,o.order_sn,o.create_time, o.allow_after_sale,s.id as sid,s.name as shop_name,s.logo as shop_logo,s.type as shop_type') ->join('order_goods g', 'g.order_id = o.id') ->join('shop s', 'o.shop_id = s.id') ->with(['order_goods' => function ($query) { @@ -115,6 +115,7 @@ class AfterSaleLogic extends Logic $result['order_goods'] = $order_goods; $result['order_sn'] = $item['order_sn']; $result['create_time'] = $item['create_time']; + $result['allow_after_sale'] = $item['allow_after_sale']; $result['after_sale']['desc'] = ''; $result['after_sale']['able_apply'] = 1; $result['after_sale']['sn'] = ''; @@ -132,6 +133,7 @@ class AfterSaleLogic extends Logic $result['time'] = $time; $data[] = $result; } + $list = ['list' => $data, 'page' => $page, 'size' => $size, 'count' => $count, 'more' => is_more($count, $page, $size)]; return $list; break; @@ -313,7 +315,7 @@ class AfterSaleLogic extends Logic $where = ['order_id' => $order_id, 'item_id' => $item_id]; $info = $goods->where($where)->find()->toArray(); $goods['image'] = isset($info['image']) ? UrlServer::getFileUrl($info['image']) : ''; - $data = [ + $data = [ 'goods' => $info, 'reason' => AfterSale::getReasonLists(), ]; @@ -500,7 +502,7 @@ class AfterSaleLogic extends Logic $user_id, AfterSaleLog::USER_AGAIN_REFUND ); - + $order = Order::with('shop')->where(['id' => $post['order_id']])->find(); if (!empty($order['shop']['mobile'])) { //通知商家 diff --git a/app/shop/controller/order/Order.php b/app/shop/controller/order/Order.php index 2f95b8e7..5452c8e9 100755 --- a/app/shop/controller/order/Order.php +++ b/app/shop/controller/order/Order.php @@ -349,4 +349,16 @@ class Order extends ShopBase } } + // 允许售后申请 + public function allowAfterSale() + { + if ($this->request->isAjax()) { + $params = $this->request->post(); + if (OrderLogic::allowAfterSale($params)) { + return JsonServer::success('操作成功'); + } + + return JsonServer::error('操作失败'); + } + } } \ No newline at end of file diff --git a/app/shop/logic/order/OrderLogic.php b/app/shop/logic/order/OrderLogic.php index 57ab3cb8..dbe1eddb 100755 --- a/app/shop/logic/order/OrderLogic.php +++ b/app/shop/logic/order/OrderLogic.php @@ -1090,4 +1090,14 @@ class OrderLogic extends Logic } } + // 允许售后申请 + public static function allowAfterSale($params) + { + $type = 1; + if ($params['type'] == 1) { + $type = 0; + } + + return Order::where('id', $params['id'])->update(['allow_after_sale' => $type, 'update_time' => time()]); + } } \ No newline at end of file diff --git a/app/shop/view/order/order/lists.html b/app/shop/view/order/order/lists.html index fa15b361..4b22c370 100755 --- a/app/shop/view/order/order/lists.html +++ b/app/shop/view/order/order/lists.html @@ -1,32 +1,37 @@ {layout name="layout1" /} @@ -34,17 +39,18 @@
-