Receipt.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\store\controller;
  13. use \app\store\model\Receipt as ReceiptModel;
  14. use app\common\service\Export as ExportService;
  15. /**
  16. * 发票模块控制器
  17. * Class Setting
  18. * @package app\store\controller
  19. */
  20. class Receipt extends Controller
  21. {
  22. /**
  23. * 门店管理首页
  24. * @return array
  25. * @throws \think\db\exception\DataNotFoundException
  26. * @throws \think\db\exception\DbException
  27. * @throws \think\db\exception\ModelNotFoundException
  28. */
  29. public function list()
  30. {
  31. $model = new ReceiptModel();
  32. $cs = request()->get();
  33. $list = $model->getList($cs);
  34. return $this->renderSuccess(compact('list'));
  35. }
  36. /**
  37. * 商城公共设置(仅展示可公开的信息)
  38. * @return array|\think\response\Json
  39. * @throws \think\db\exception\DataNotFoundException
  40. * @throws \think\db\exception\DbException
  41. * @throws \think\db\exception\ModelNotFoundException
  42. */
  43. public function confirmReceipt($id,$receipt_no)
  44. {
  45. $service = new ReceiptModel();
  46. $res = $service::updateStatus($id,$receipt_no);
  47. return $this->renderSuccess(compact('res'));
  48. }
  49. public function detail($id)
  50. {
  51. $list = ReceiptModel::getDetail($id);
  52. return $this->renderSuccess(compact('list'));
  53. }
  54. /**
  55. * 导出订单功能
  56. */
  57. public function export(){
  58. $param = $this->request->param();
  59. if(isset($param['receipt_ids']) && empty($param['receipt_ids'])){
  60. return $this->renderError('请勾选发票数据后再导出');
  61. }
  62. $model = new ReceiptModel;
  63. $data = $model->export($param);
  64. $res = ExportService::export($data['data'],$data['header'],$data['filename'],'列表','Xls');
  65. return $this->renderSuccess($res,'导出成功');
  66. }
  67. }