// +---------------------------------------------------------------------- declare (strict_types = 1); namespace app\store\controller; use \app\store\model\Receipt as ReceiptModel; use app\common\service\Export as ExportService; /** * 发票模块控制器 * Class Setting * @package app\store\controller */ class Receipt extends Controller { /** * 门店管理首页 * @return array * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function list() { $model = new ReceiptModel(); $cs = request()->get(); $list = $model->getList($cs); return $this->renderSuccess(compact('list')); } /** * 商城公共设置(仅展示可公开的信息) * @return array|\think\response\Json * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function confirmReceipt($id,$receipt_no) { $service = new ReceiptModel(); $res = $service::updateStatus($id,$receipt_no); return $this->renderSuccess(compact('res')); } public function detail($id) { $list = ReceiptModel::getDetail($id); return $this->renderSuccess(compact('list')); } /** * 导出订单功能 */ public function export(){ $param = $this->request->param(); if(isset($param['receipt_ids']) && empty($param['receipt_ids'])){ return $this->renderError('请勾选发票数据后再导出'); } $model = new ReceiptModel; $data = $model->export($param); $res = ExportService::export($data['data'],$data['header'],$data['filename'],'列表','Xls'); return $this->renderSuccess($res,'导出成功'); } }