cashier.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. use app\http\middleware\AllowOriginMiddleware;
  12. use app\http\middleware\InstallMiddleware;
  13. use app\http\middleware\cashier\AuthTokenMiddleware;
  14. use app\http\middleware\cashier\CashierCheckRoleMiddleware;
  15. use app\http\middleware\StationOpenMiddleware;
  16. use think\facade\Config;
  17. use think\facade\Route;
  18. use think\Response;
  19. /**
  20. * 收银台路由配置
  21. */
  22. Route::group('cashierapi', function () {
  23. /**
  24. * 不需要登录不验证权限
  25. */
  26. Route::group(function () {
  27. //图形验证码
  28. Route::get('ajcaptcha', 'Login/ajcaptcha')->name('ajcaptcha');
  29. //图形验证码
  30. Route::post('ajcheck', 'Login/ajcheck')->name('ajcheck');
  31. //是否需要滑块验证接口
  32. Route::post('is_captcha', 'Login/getAjCaptcha')->name('getAjCaptcha');
  33. //账号密码登录
  34. Route::post('login', 'Login/login')->name('login')->option(['real_name' => '账号密码登录']);
  35. //微信扫码登录
  36. Route::get('wechat_scan_login', 'Login/wechatScanLogin')->name('wechatScanLogin')->option(['real_name' => '微信扫码登录']);
  37. //企业微信扫码登录
  38. Route::get('work_scan_login', 'Login/workScanLogin')->name('workScanLogin')->option(['real_name' => '企业微信扫码登录']);
  39. //企业微信配置
  40. Route::get('work/config', 'Login/getWechatConfig')->name('getWechatConfig')->option(['real_name' => '企业微信配置']);
  41. //扫码登录状态信息检测获取
  42. Route::post('check_scan_login', 'Login/checkScanLogin')->name('checkScanLogin')->option(['real_name' => '扫码登录状态信息检测获取']);
  43. //登录信息
  44. Route::get('login/info', 'Login/info')->name('loginInfo')->option(['real_name' => '登录信息']);
  45. //图片验证码
  46. Route::get('captcha_store', 'Login/captcha')->name('captcha')->option(['real_name' => '图片验证码']);
  47. //获取版权
  48. Route::get('copyright', 'Common/getCopyright')->option(['real_name' => '获取版权']);
  49. });
  50. /**
  51. * 只需登录不验证权限
  52. */
  53. Route::group(function () {
  54. //获取logo
  55. Route::get('logo', 'Common/getLogo')->option(['real_name' => '获取logo']);
  56. //获取配置
  57. Route::get('config', 'Common/getConfig')->option(['real_name' => '获取配置']);
  58. //erp配置
  59. Route::get('erp/config', 'Common/getConfig')->option(['real_name' => '获取配置']);
  60. // //获取未读消息
  61. // Route::get('jnotice', 'Common/jnotice')->option(['real_name' => '获取未读消息']);
  62. //获取省市区街道
  63. Route::get('city', 'Common/city')->option(['real_name' => '获取省市区街道']);
  64. //获取搜索菜单列表
  65. Route::get('menusList', 'Common/menusList')->option(['real_name' => '搜索菜单列表']);
  66. //修改当前管理员信息
  67. Route::put('update_store', 'Login/updateStore')->name('updateStore')->option(['real_name' => '修改当前登录店员信息']);
  68. //退出登录
  69. Route::get('logout', 'Login/logOut')->option(['real_name' => '退出登录']);
  70. //修改收银员信息
  71. Route::put('updatePwd', 'User/updatePwd')->option(['real_name' => '修改收银员信息']);
  72. //公共类
  73. Route::post('upload/image', 'Common/upload_image')->name('uploadImage');//图片上传
  74. })->middleware(AuthTokenMiddleware::class);
  75. /**
  76. * 需登录验证权限
  77. */
  78. Route::group(function () {
  79. //首页头部统计数据
  80. Route::get('home/header', 'Common/homeStatics')->option(['real_name' => '首页头部统计数据']);
  81. //首页营业趋势图表
  82. Route::get('home/operate', 'Common/operateChart')->option(['real_name' => '首页营业趋势图表']);
  83. //首页交易图表
  84. Route::get('home/orderChart', 'Common/orderChart')->option(['real_name' => '首页交易图表']);
  85. //首页店员统计
  86. Route::get('home/staff', 'Common/staffChart')->option(['real_name' => '首页店员统计']);
  87. //轮询查询扫码订单支付状态
  88. Route::post('check_order_status/:type', 'Common/checkOrderStatus')->option(['real_name' => '轮询订单状态接口'])->name('checkOrderStatus');//轮询订单状态接口
  89. //获取充值套餐
  90. Route::get('store/recharge_info', 'Recharge/rechargeInfo')->option(['real_name' => '获取充值套餐']);
  91. //收银台用户充值
  92. Route::post('store/recharge', 'Recharge/recharge')->option(['real_name' => '获取充值套餐']);
  93. //获取登录店员详情
  94. Route::get('user/cashier_info', 'User/getCashierInfo')->option(['real_name' => '获取登录店员详情']);
  95. //获取当前门店店员列表和店员信息
  96. Route::get('user/cashier_list', 'User/getCashierList')->option(['real_name' => '获取当前门店店员列表和店员信息']);
  97. //收银台选择用户列表
  98. Route::get('user/get_list', 'User/getUserList')->option(['real_name' => '收银台选择用户列表']);
  99. //收银台切换购物车用户
  100. Route::post('user/switch/:cashierId', 'User/switchCartUser')->option(['real_name' => '收银台切换购物车用户']);
  101. //获取收银台用户信息
  102. Route::post('user/user_Info', 'User/getUserInfo')->option(['real_name' => '获取收银台用户信息']);
  103. //收银台获取当前用户信息
  104. Route::get('user/info/:uid', 'User/getUidInfo')->option(['real_name' => '获取当前用户信息']);
  105. //收银台获取当前用户记录
  106. Route::get('user/record/:uid', 'User/userRecord')->option(['real_name' => '收银台获取当前用户记录']);
  107. //显示指定的资源
  108. Route::get('user/read/:id', 'User/read')->option(['real_name' => '显示指定的资源']);
  109. //获取指定用户的信息
  110. Route::get('user/one_info/:id', 'User/oneUserInfo')->option(['real_name' => '获取指定用户的信息']);
  111. //收银台获取副屏信息
  112. Route::get('user/aux_screen', 'User/getAuxScreenInfo')->option(['real_name' => '收银台获取副屏信息']);
  113. //收银台切换用户切换店员
  114. Route::post('user/swith_user', 'User/swithUser')->option(['real_name' => '收银台切换用户切换店员']);
  115. //获取会员类型
  116. Route::get('user/member_card', 'User/getMemberCard')->option(['real_name' => '获取会员类型']);
  117. //获取会员类型
  118. Route::post('user/mer_recharge', 'User/payMember')->option(['real_name' => '会员充值']);
  119. //获取收银订单用户
  120. Route::get('order/get_user_list/:cashierId', 'Order/getUserList')->option(['real_name' => '获取收银订单用户']);
  121. //收银台挂单列表
  122. Route::get('order/get_hang_list/:cashierId', 'Order/getHangList')->option(['real_name' => '收银台挂单列表']);
  123. //收银台删除挂单
  124. Route::delete('order/del_hang', 'Order/deleteHangOrder')->option(['real_name' => '收银台删除挂单']);
  125. //收银台订单列表
  126. Route::post('order/get_order_list/[:orderType]', 'Order/getOrderList')->option(['real_name' => '收银台订单列表']);
  127. //收银台核销订单列表
  128. Route::post('order/get_verify_list', 'Order/getVerifyList')->option(['real_name' => '收银台核销订单列表']);
  129. //收银台核销订单数据
  130. Route::get('order/verify_cart_info', 'Order/verifyCartInfo')->option(['real_name' => '收银台核销订单数据']);
  131. //订单核销表单弹窗
  132. Route::get('order/write/form/:id', 'Order/writeOrderFrom')->name('writeOrderForm')->option(['real_name' => '订单核销表单']);
  133. //订单核销表单提交
  134. Route::post('order/write/form/:id', 'Order/writeoffFrom')->name('writeOrderForm')->option(['real_name' => '订单核销表单']);
  135. //收银台订单核销
  136. Route::put('order/write_off/:id', 'Order/writeOff')->option(['real_name' => '订单号核销']);
  137. //收银台订单详情
  138. Route::get('order/get_order_Info/:id', 'Order/order_info')->option(['real_name' => '收银台订单详情']);
  139. //收银台获取订单状态
  140. Route::get('order/get_order_status/:id', 'Order/status')->option(['real_name' => '获取订单状态']);
  141. //收银台计算订单金额
  142. Route::post('order/compute/:uid', 'Order/orderCompute')->option(['real_name' => '收银台计算订单金额']);
  143. //收银台创建订单
  144. Route::post('order/create/:uid', 'Order/createOrder')->option(['real_name' => '收银台创建订单']);
  145. //收银台再次支付订单
  146. Route::post('order/pay/:orderId', 'Order/payOrder')->option(['real_name' => '收银台再次支付订单']);
  147. //收银台订单小票打印
  148. Route::get('order/print/:id', 'Order/order_print')->option(['real_name' => '收银台订单小票打印']);
  149. //收银台订单备注
  150. Route::put('order/remark/:id', 'Order/remark')->option(['real_name' => '收银台订单备注']);
  151. //用户优惠券列表
  152. Route::post('order/coupon_list/:uid', 'Order/couponList')->option(['real_name' => '用户优惠券列表']);
  153. //用户领取优惠券
  154. Route::post('coupon/receive/:uid', 'Order/couponReceive')->option(['real_name' => '用户领取优惠券']);
  155. //收银台获取物流公司
  156. Route::get('order/express_list', 'Order/express')->option(['real_name' => '收银台获取物流公司']);
  157. //收银台获取配送员
  158. Route::get('order/delivery_list', 'Order/getDeliveryList')->option(['real_name' => '收银台获取配送员']);
  159. //面单默认配置信息
  160. Route::get('order/sheet_info', 'Order/getSheetInfo')->option(['real_name' => '面单默认配置信息']);
  161. //获取订单可拆分商品列表
  162. Route::get('order/split_cart_info/:id', 'Order/split_cart_info')->option(['real_name' => '获取订单可拆分商品列表']);
  163. //收银台订单发送货
  164. Route::put('order/delivery/:id', 'Order/updateDelivery')->option(['real_name' => '收银台订单发送货']);
  165. //订单退款表单
  166. Route::get('refund/refund/:id', 'Order/refund')->name('StoreOrderRefund')->option(['real_name' => '订单退款表单']);
  167. //订单退款
  168. Route::put('order/refund/:id', 'Order/update_refund')->name('StoreOrderUpdateRefund')->option(['real_name' => '订单退款']);
  169. //收银台拆单退款
  170. Route::post('open/refund/:id', 'Order/open_order_refund')->name('StoreOrderUpdateRefund')->option(['real_name' => '后台拆单退款']);
  171. //收银台退款订单列表
  172. Route::get('order/get_refund_list', 'Refund/getRefundList')->option(['real_name' => '收银台退款订单列表']);
  173. //收银台退款订单详情
  174. Route::get('order/get_refund_Info/:id', 'Refund/detail')->option(['real_name' => '收银台退款订单详情']);
  175. //售后订单退款
  176. Route::put('order/order_refund/:id', 'Refund/update_refund')->option(['real_name' => '售后订单退款']);
  177. //商家同意退款,等待用户退货
  178. Route::get('order/refund/agree/:id', 'Refund/agreeRefund')->option(['real_name' => '商家同意退款,等待用户退货']);
  179. //售后订单备注
  180. Route::put('order/refund/remark/:id', 'Refund/remark')->option(['real_name' => '售后订单备注']);
  181. //获取商品一级分类
  182. Route::get('product/get_one_category', 'Product/getOneCategory')->option(['real_name' => '获取商品一级分类']);
  183. //获取收银台商品列表
  184. Route::get('product/get_list', 'Product/getProductList')->option(['real_name' => '获取收银台商品列表']);
  185. //获取收银台商品详情
  186. Route::get('product/get_info/:id/[:uid]', 'Product/getProductInfo')->option(['real_name' => '获取收银台商品详情']);
  187. //获取收银台商品规格
  188. Route::get('product/get_attr/:id/[:uid]', 'Product/getProductAttr')->option(['real_name' => '获取收银台商品详情']);
  189. //获取收银台购物车信息
  190. Route::get('cart/get_cart/:uid/:cashierId', 'Order/getCartList')->option(['real_name' => '获取收银台购物车信息']);
  191. //收银台选择商品进入购物车
  192. Route::post('cart/set_cart/:uid', 'Order/addCart')->option(['real_name' => '收银台添加购物车']);
  193. //收银台更改购物车数量
  194. Route::put('cart/set_cart_num/:uid', 'Order/numCart')->option(['real_name' => '收银台更改购物车数量']);
  195. //收银台删除购物车信息
  196. Route::delete('cart/del_cart/:uid', 'Order/delCart')->option(['real_name' => '收银台删除购物车信息']);
  197. //收银台更改购物车规格
  198. Route::put('cart/change_cart', 'Order/changeCart')->option(['real_name' => '收银台更改购物车规格']);
  199. //获取门店适用的活动
  200. Route::get('promotions/list/:type', 'Promotions/getPromotionInfo')->option(['real_name' => '获取门店适用的活动']);
  201. //获取活动商品数量信息
  202. Route::get('promotions/count/:uid', 'Promotions/promotionsCount')->option(['real_name' => '获取收银台购物车信息']);
  203. //收银台获取活动商品列表
  204. Route::get('promotions/activity_list/:uid/:type', 'Promotions/activityList')->option(['real_name' => '收银台获取活动商品列表']);
  205. //桌码管理
  206. Route::get('code/list', 'Table/getTableCode')->option(['real_name' => '桌码管理']);
  207. //桌码订单列表
  208. Route::get('get/table/list', 'Table/getTableCodeList')->option(['real_name' => '桌码订单列表']);
  209. //桌码订单购物车信息
  210. Route::get('get/order/info/:oid', 'Table/getOrderInfo')->option(['real_name' => '桌码订单购物车信息']);
  211. //获取全部点餐用户信息
  212. Route::get('table/uid/all', 'Table/getTableCodeUserAll')->option(['real_name' => '获取全部点餐用户信息']);
  213. //购物车
  214. Route::get('get/cart/list', 'Table/getCartList')->option(['real_name' => '购物车']);
  215. //收银台购物车数量操作
  216. Route::post('edit/table/cart', 'Table/editCart')->option(['real_name' => '收银台购物车数量操作']);
  217. //取消桌码
  218. Route::get('cancel/table', 'Table/cancelInitiateTable')->option(['real_name' => '取消桌码']);
  219. //手动打单
  220. Route::get('staff/place', 'Table/staffPlaceOrder')->option(['real_name' => '手动打单']);
  221. //线下支付
  222. Route::post('pay_offline/:id', 'Order/pay_offline')->name('StoreOrderorPayOffline')->option(['real_name' => '线下支付']);
  223. })->middleware([AuthTokenMiddleware::class, CashierCheckRoleMiddleware::class]);
  224. /**
  225. * miss 路由
  226. */
  227. Route::miss(function () {
  228. if (app()->request->isOptions()) {
  229. $header = Config::get('cookie.header');
  230. $header['Access-Control-Allow-Origin'] = app()->request->header('origin');
  231. return Response::create('ok')->code(200)->header($header);
  232. } else
  233. return Response::create()->code(404);
  234. });
  235. })->prefix('cashier.')->middleware(InstallMiddleware::class)->middleware(AllowOriginMiddleware::class)->middleware(StationOpenMiddleware::class);