Order.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. <?php
  2. /**
  3. * Niushop商城系统 - 团队十年电商经验汇集巨献!
  4. * =========================================================
  5. * Copy right 2019-2029 山西牛酷信息科技有限公司, 保留所有权利。
  6. * ----------------------------------------------
  7. * 官方网址: https://www.niushop.com.cn
  8. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
  9. * 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
  10. * =========================================================
  11. */
  12. namespace app\admin\controller;
  13. use app\model\order\Config as ConfigModel;
  14. use app\model\order\Order as OrderModel;
  15. use app\model\order\OrderCommon as OrderCommonModel;
  16. use app\model\order\OrderExport;
  17. use app\model\system\Promotion as PromotionModel;
  18. use phpoffice\phpexcel\Classes\PHPExcel;
  19. use phpoffice\phpexcel\Classes\PHPExcel\Writer\Excel2007;
  20. use think\facade\Config;
  21. /**
  22. * 订单管理 控制器
  23. */
  24. class Order extends BaseAdmin
  25. {
  26. /**
  27. * 快递订单列表
  28. */
  29. public function lists()
  30. {
  31. $order_label_list = array(
  32. "order_no" => "订单号",
  33. "out_trade_no" => "外部单号",
  34. "name" => "收货人姓名",
  35. "order_name" => "商品名称",
  36. "site_name" => "店铺名称",
  37. );
  38. $order_status = input("order_status", "");//订单状态
  39. $order_name = input("order_name", '');
  40. $pay_type = input("pay_type", '');
  41. $order_from = input("order_from", '');
  42. $start_time = input("start_time", '');
  43. $end_time = input("end_time", '');
  44. $site_id = input("site_id", "");
  45. $order_label = !empty($order_label_list[input("order_label")]) ? input("order_label") : "";
  46. $search_text = input("search", '');
  47. $promotion_type = input("promotion_type", '');
  48. $order_type = input("order_type", 'all');//营销类型
  49. $order_common_model = new OrderCommonModel();
  50. if (request()->isAjax()) {
  51. $page_index = input('page', 1);
  52. $page_size = input('limit', PAGE_LIST_ROWS);
  53. $condition = [
  54. // ["order_type", "=", 1]
  55. ];
  56. //订单状态
  57. if ($order_status != "") {
  58. $condition[] = ["order_status", "=", $order_status];
  59. }
  60. //订单内容 模糊查询
  61. if ($order_name != "") {
  62. $condition[] = ["order_name", 'like', "%$order_name%"];
  63. }
  64. //订单来源
  65. if ($order_from != "") {
  66. $condition[] = ["order_from", "=", $order_from];
  67. }
  68. //订单支付
  69. if ($pay_type != "") {
  70. $condition[] = ["pay_type", "=", $pay_type];
  71. }
  72. //订单类型
  73. if($order_type != 'all'){
  74. $condition[] = ["order_type", "=", $order_type];
  75. }
  76. //营销类型
  77. if ($promotion_type != "") {
  78. if($promotion_type == 'empty'){
  79. $condition[] = ["promotion_type", "=", ''];
  80. }else{
  81. $condition[] = ["promotion_type", "=", $promotion_type];
  82. }
  83. }
  84. if (!empty($start_time) && empty($end_time)) {
  85. $condition[] = ["create_time", "egt", date_to_time($start_time)];
  86. } elseif (empty($start_time) && !empty($end_time)) {
  87. $condition[] = ["create_time", "elt", date_to_time($end_time)];
  88. } elseif (!empty($start_time) && !empty($end_time)) {
  89. $condition[] = [ 'create_time', 'between', [ date_to_time($start_time), date_to_time($end_time) ] ];
  90. }
  91. if ($search_text != "") {
  92. $condition[] = [$order_label, 'like', "%$search_text%"];
  93. }
  94. if(!empty($site_id))
  95. {
  96. $condition[] = ["site_id", '=', $site_id];
  97. }
  98. $list = $order_common_model->getOrderPageList($condition, $page_index, $page_size, "create_time desc");
  99. return $list;
  100. } else {
  101. $this->assign("order_label_list", $order_label_list);
  102. $order_model = new OrderModel();
  103. $order_status_list = $order_model->order_status;
  104. $this->assign("order_status_list", $order_status_list);//订单状态
  105. //订单来源 (支持端口)
  106. $order_from = Config::get("app_type");
  107. $this->assign('order_from_list', $order_from);
  108. $pay_type = $order_common_model->getPayType();
  109. $this->assign("pay_type_list", $pay_type);
  110. $order_type_list = $order_common_model->getOrderTypeStatusList();
  111. $this->assign("order_type_list", $order_type_list);
  112. //营销活动类型
  113. $promotion_model = new PromotionModel();
  114. $promotion_type = $promotion_model->getPromotionType();
  115. $this->assign("promotion_type", $promotion_type);
  116. return $this->fetch('order/lists');
  117. }
  118. }
  119. /**
  120. * 快递订单详情
  121. */
  122. public function detail()
  123. {
  124. $order_id = input("order_id", 0);
  125. $order_common_model = new OrderCommonModel();
  126. $order_detail_result = $order_common_model->getOrderDetail($order_id);
  127. $order_detail = $order_detail_result["data"];
  128. $this->assign("order_detail", $order_detail);
  129. switch ($order_detail["order_type"]) {
  130. case 1 :
  131. $template = "order/detail";
  132. break;
  133. case 2 :
  134. $template = "storeorder/detail";
  135. break;
  136. case 3 :
  137. $template = "localorder/detail";
  138. break;
  139. case 4 :
  140. $template = "virtualorder/detail";
  141. break;
  142. }
  143. return $this->fetch($template);
  144. }
  145. /**
  146. * 订单设置
  147. */
  148. public function config()
  149. {
  150. if (request()->isAjax()) {
  151. //订单事件时间设置数据
  152. $order_event_time_config_data = [
  153. 'auto_close' => input('order_auto_close_time', 0),//订单未付款自动关闭时间 数字 单位(天)
  154. 'auto_take_delivery' => input('order_auto_take_delivery_time', 0),//订单发货后自动收货时间 数字 单位(天)
  155. 'auto_complete' => input('order_auto_complete_time', 0),//订单收货后自动完成时间 数字 单位(天)
  156. ];
  157. // //订单发票设置数据
  158. // $order_invoice_config_data = [
  159. // 'is_use' => input('invoice_is_use', 0),//是否启用发票 1:启用 0:不启用
  160. // 'tax' => input('invoice_tax', 0),//发票税率 0-100 不取小数
  161. // 'content' => input('invoice_content', ''),//发票内容 文具,服装,水果,建材 格式为逗号分隔的字符串 textarea
  162. // ];
  163. $config_model = new ConfigModel();
  164. $res = $config_model->setOrderEventTimeConfig($order_event_time_config_data);
  165. // $config_model->setOrderInvoiceConfig($order_invoice_config_data);
  166. return $res;
  167. } else {
  168. $config_model = new ConfigModel();
  169. //订单事件时间设置
  170. $order_event_time_config = $config_model->getOrderEventTimeConfig();
  171. $this->assign('order_event_time_config', $order_event_time_config['data']['value']);
  172. //订单发票设置
  173. $order_invoice_config = $config_model->getOrderInvoiceConfig();
  174. $this->assign('order_invoice_config', $order_invoice_config['data']['value']);
  175. return $this->fetch('order/config');
  176. }
  177. }
  178. /**
  179. * 订单导出(已订单为主)
  180. */
  181. public function exportOrder()
  182. {
  183. $order_status = input("order_status", "");//订单状态
  184. $order_name = input("order_name", '');
  185. $pay_type = input("pay_type", '');
  186. $order_from = input("order_from", '');
  187. $start_time = input("start_time", '');
  188. $end_time = input("end_time", '');
  189. $order_label = !empty($order_label_list[input("order_label")]) ? input("order_label") : "";
  190. $search_text = input("search", '');
  191. $promotion_type = input("promotion_type", '');
  192. $order_type = input("order_type", '1');
  193. $condition[] = ["order_type", "=", $order_type];
  194. //订单状态
  195. if ($order_status != "") {
  196. $condition[] = ["order_status", "=", $order_status];
  197. }
  198. //订单内容 模糊查询
  199. if ($order_name != "") {
  200. $condition[] = ["order_name", 'like', "%$order_name%"];
  201. }
  202. //订单来源
  203. if ($order_from != "") {
  204. $condition[] = ["order_from", "=", $order_from];
  205. }
  206. //订单支付
  207. if ($pay_type != "") {
  208. $condition[] = ["pay_type", "=", $pay_type];
  209. }
  210. //营销类型
  211. if ($promotion_type != "") {
  212. if($promotion_type == 'empty'){
  213. $condition[] = ["promotion_type", "=", ''];
  214. }else{
  215. $condition[] = ["promotion_type", "=", $promotion_type];
  216. }
  217. }
  218. if (!empty($start_time) && !empty($end_time)) {
  219. $condition[] = ["create_time", "between", [date_to_time($start_time), date_to_time($end_time)]];
  220. }
  221. if ($search_text != "") {
  222. $condition[] = [$order_label, 'like', "%$search_text%"];
  223. }
  224. $order_common_model = new OrderCommonModel();
  225. //接收需要展示的字段
  226. $input_field = input('field', '');
  227. $order = $order_common_model->getOrderList($condition, $input_field, 'id desc');
  228. $header_arr = array(
  229. 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  230. 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ',
  231. 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ'
  232. );
  233. $input_field = explode(',', $input_field);
  234. //处理数据
  235. $order_export_model = new OrderExport();
  236. if (!empty($shop['data'])) {
  237. $order_list = $order_export_model->handleData($order['data'], $input_field);
  238. }
  239. $count = count($input_field);
  240. // 实例化excel
  241. $phpExcel = new \PHPExcel();
  242. $phpExcel->getProperties()->setTitle("订单信息-订单维度");
  243. $phpExcel->getProperties()->setSubject("订单信息-订单维度");
  244. //单独添加列名称
  245. $phpExcel->setActiveSheetIndex(0);
  246. $field = $order_export_model->order_field;
  247. for ($i = 0; $i < $count; $i++) {
  248. $phpExcel->getActiveSheet()->setCellValue($header_arr[$i] . '1', $field[$input_field[$i]]);
  249. }
  250. if (!empty($order_list)) {
  251. foreach ($order_list as $k => $v) {
  252. $start = $k + 2;
  253. for ($i = 0; $i < $count; $i++) {
  254. $phpExcel->getActiveSheet()->setCellValue($header_arr[$i] . $start, $v[$input_field[$i]]);
  255. }
  256. }
  257. }
  258. // 重命名工作sheet
  259. $phpExcel->getActiveSheet()->setTitle('订单信息-订单维度');
  260. // 设置第一个sheet为工作的sheet
  261. $phpExcel->setActiveSheetIndex(0);
  262. // 保存Excel 2007格式文件,保存路径为当前路径,名字为export.xlsx
  263. $objWriter = \PHPExcel_IOFactory::createWriter($phpExcel, 'Excel2007');
  264. $file = date('Y年m月d日-订单信息', time()) . '.xlsx';
  265. $objWriter->save($file);
  266. header("Content-type:application/octet-stream");
  267. $filename = basename($file);
  268. header("Content-Disposition:attachment;filename = " . $filename);
  269. header("Accept-ranges:bytes");
  270. header("Accept-length:" . filesize($file));
  271. readfile($file);
  272. unlink($file);
  273. exit;
  274. }
  275. /**
  276. * 订单导出(已订单商品为主)
  277. */
  278. public function exportOrderGoods()
  279. {
  280. $order_status = input("order_status", "");//订单状态
  281. $order_name = input("order_name", '');
  282. $pay_type = input("pay_type", '');
  283. $order_from = input("order_from", '');
  284. $start_time = input("start_time", '');
  285. $end_time = input("end_time", '');
  286. $order_label = !empty($order_label_list[input("order_label")]) ? input("order_label") : "";
  287. $search_text = input("search", '');
  288. $promotion_type = input("promotion_type", '');
  289. $order_type = input("order_type", '1');
  290. $condition[] = ["o.order_type", "=", $order_type];
  291. //订单状态
  292. if ($order_status != "") {
  293. $condition[] = ["o.order_status", "=", $order_status];
  294. }
  295. //订单内容 模糊查询
  296. if ($order_name != "") {
  297. $condition[] = ["o.order_name", 'like', "%$order_name%"];
  298. }
  299. //订单来源
  300. if ($order_from != "") {
  301. $condition[] = ["o.order_from", "=", $order_from];
  302. }
  303. //订单支付
  304. if ($pay_type != "") {
  305. $condition[] = ["o.pay_type", "=", $pay_type];
  306. }
  307. //营销类型
  308. if ($promotion_type != "") {
  309. if($promotion_type == 'empty'){
  310. $condition[] = ["promotion_type", "=", ''];
  311. }else{
  312. $condition[] = ["promotion_type", "=", $promotion_type];
  313. }
  314. }
  315. if (!empty($start_time) && !empty($end_time)) {
  316. $condition[] = ["o.create_time", "between", [date_to_time($start_time), date_to_time($end_time)]];
  317. }
  318. if ($search_text != "") {
  319. $condition[] = ['o.' . $order_label, 'like', "%$search_text%"];
  320. }
  321. $order_common_model = new OrderCommonModel();
  322. $order_export_model = new OrderExport();
  323. //接收需要展示的字段
  324. $field = array_merge($order_export_model->order_field, $order_export_model->order_goods_field);
  325. $input_field = input('field', implode(',',array_keys($field)));
  326. $order = $order_common_model->getOrderGoodsDetailList($condition);
  327. $header_arr = array(
  328. 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  329. 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ',
  330. 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ'
  331. );
  332. $input_field = explode(',', $input_field);
  333. //处理数据
  334. if (!empty($order['data'])) {
  335. $order_list = $order_export_model->handleData($order['data'], $input_field);
  336. }
  337. $count = count($input_field);
  338. // 实例化excel
  339. $phpExcel = new \PHPExcel();
  340. $phpExcel->getProperties()->setTitle("订单信息-商品维度");
  341. $phpExcel->getProperties()->setSubject("订单信息-商品维度");
  342. //单独添加列名称
  343. $phpExcel->setActiveSheetIndex(0);
  344. for ($i = 0; $i < $count; $i++) {
  345. $phpExcel->getActiveSheet()->setCellValue($header_arr[$i] . '1', $field[$input_field[$i]]);
  346. }
  347. if (!empty($order_list)) {
  348. foreach ($order_list as $k => $v) {
  349. $start = $k + 2;
  350. for ($i = 0; $i < $count; $i++) {
  351. $phpExcel->getActiveSheet()->setCellValue($header_arr[$i] . $start, $v[$input_field[$i]]);
  352. }
  353. }
  354. }
  355. // 重命名工作sheet
  356. $phpExcel->getActiveSheet()->setTitle('订单信息-商品维度');
  357. // 设置第一个sheet为工作的sheet
  358. $phpExcel->setActiveSheetIndex(0);
  359. // 保存Excel 2007格式文件,保存路径为当前路径,名字为export.xlsx
  360. $objWriter = \PHPExcel_IOFactory::createWriter($phpExcel, 'Excel2007');
  361. $file = date('Y年m月d日-订单信息', time()) . '.xlsx';
  362. $objWriter->save($file);
  363. header("Content-type:application/octet-stream");
  364. $filename = basename($file);
  365. header("Content-Disposition:attachment;filename = " . $filename);
  366. header("Accept-ranges:bytes");
  367. header("Accept-length:" . filesize($file));
  368. readfile($file);
  369. unlink($file);
  370. exit;
  371. }
  372. /**
  373. * 订单导出(维权订单)
  374. */
  375. public function exportRefundOrder()
  376. {
  377. $refund_status = input("refund_status", "");//退款状态
  378. $sku_name = input("sku_name", '');//商品名称
  379. $refund_type = input("refund_type", '');//退款方式
  380. $start_time = input("start_time", '');//开始时间
  381. $end_time = input("end_time", '');//结束时间
  382. $order_no = input("order_no", '');//订单编号
  383. $delivery_status = input("delivery_status", '');//物流状态
  384. $refund_no = input("refund_no", '');//退款编号
  385. $delivery_no = input("delivery_no", '');//物流编号
  386. $refund_delivery_no = input("refund_delivery_no", '');//退款物流编号
  387. $order_common_model = new OrderCommonModel();
  388. //退款状态
  389. if ($refund_status != "") {
  390. $condition[] = ["og.refund_status", "=", $refund_status];
  391. } else {
  392. $condition[] = ["og.refund_status", "<>", 0];
  393. }
  394. //物流状态
  395. if ($delivery_status != "") {
  396. $condition[] = ["og.delivery_status", "=", $delivery_status];
  397. }
  398. //商品名称
  399. if ($sku_name != "") {
  400. $condition[] = ["og.sku_name", "like", "%$sku_name%"];
  401. }
  402. //退款方式
  403. if ($refund_type != "") {
  404. $condition[] = ["og.refund_type", "=", $refund_type];
  405. }
  406. //退款编号
  407. if ($refund_no != "") {
  408. $condition[] = ["og.refund_no", "like", "%$refund_no%"];
  409. }
  410. //订单编号
  411. if ($order_no != "") {
  412. $condition[] = ["og.order_no", "like", "%$order_no%"];
  413. }
  414. //物流编号
  415. if ($delivery_no != "") {
  416. $condition[] = ["og.delivery_no", "like", "%$delivery_no%"];
  417. }
  418. //退款物流编号
  419. if ($refund_delivery_no != "") {
  420. $condition[] = ["og.refund_delivery_no", "like", "%$refund_delivery_no%"];
  421. }
  422. if (!empty($start_time) && empty($end_time)) {
  423. $condition[] = ["og.refund_action_time", "egt", date_to_time($start_time)];
  424. } elseif (empty($start_time) && !empty($end_time)) {
  425. $condition[] = ["og.refund_action_time", "elt", date_to_time($end_time)];
  426. } elseif (!empty($start_time) && !empty($end_time)) {
  427. $condition[] = [ 'og.refund_action_time', 'between', [ date_to_time($start_time), date_to_time($end_time) ] ];
  428. }
  429. $order_export_model = new OrderExport();
  430. $field = array_merge($order_export_model->order_field, $order_export_model->order_goods_field);
  431. //接收需要展示的字段
  432. $input_field = input('field', implode(',',array_keys($field)));
  433. $order = $order_common_model->getOrderGoodsDetailList($condition);
  434. $header_arr = array(
  435. 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
  436. 'AA', 'AB', 'AC', 'AD', 'AE', 'AF', 'AG', 'AH', 'AI', 'AJ', 'AK', 'AL', 'AM', 'AN', 'AO', 'AP', 'AQ', 'AR', 'AS', 'AT', 'AU', 'AV', 'AW', 'AX', 'AY', 'AZ',
  437. 'BA', 'BB', 'BC', 'BD', 'BE', 'BF', 'BG', 'BH', 'BI', 'BJ', 'BK', 'BL', 'BM', 'BN', 'BO', 'BP', 'BQ', 'BR', 'BS', 'BT', 'BU', 'BV', 'BW', 'BX', 'BY', 'BZ'
  438. );
  439. $input_field = explode(',', $input_field);
  440. //处理数据
  441. if (!empty($order['data'])) {
  442. $order_list = $order_export_model->handleData($order['data'], $input_field);
  443. }
  444. $count = count($input_field);
  445. // 实例化excel
  446. $phpExcel = new \PHPExcel();
  447. $phpExcel->getProperties()->setTitle("退款维权订单");
  448. $phpExcel->getProperties()->setSubject("退款维权订单");
  449. //单独添加列名称
  450. $phpExcel->setActiveSheetIndex(0);
  451. for ($i = 0; $i < $count; $i++) {
  452. $phpExcel->getActiveSheet()->setCellValue($header_arr[$i] . '1', $field[$input_field[$i]]);
  453. }
  454. if (!empty($order_list)) {
  455. foreach ($order_list as $k => $v) {
  456. $start = $k + 2;
  457. for ($i = 0; $i < $count; $i++) {
  458. $phpExcel->getActiveSheet()->setCellValue($header_arr[$i] . $start, $v[$input_field[$i]]);
  459. }
  460. }
  461. }
  462. // 重命名工作sheet
  463. $phpExcel->getActiveSheet()->setTitle('退款维权订单');
  464. // 设置第一个sheet为工作的sheet
  465. $phpExcel->setActiveSheetIndex(0);
  466. // 保存Excel 2007格式文件,保存路径为当前路径,名字为export.xlsx
  467. $objWriter = \PHPExcel_IOFactory::createWriter($phpExcel, 'Excel2007');
  468. $file = date('Y年m月d日-退款维权订单', time()) . '.xlsx';
  469. $objWriter->save($file);
  470. header("Content-type:application/octet-stream");
  471. $filename = basename($file);
  472. header("Content-Disposition:attachment;filename = " . $filename);
  473. header("Accept-ranges:bytes");
  474. header("Accept-length:" . filesize($file));
  475. readfile($file);
  476. unlink($file);
  477. exit;
  478. }
  479. /**
  480. * 导出字段
  481. * @return array
  482. */
  483. public function getPrintingField()
  484. {
  485. $order_export_model = new OrderExport();
  486. $data = [
  487. 'order_field' => $order_export_model->order_field,
  488. 'order_goods_field' => $order_export_model->order_goods_field
  489. ];
  490. return success('1', '', $data);
  491. }
  492. /**
  493. * 交易记录
  494. */
  495. public function tradelist()
  496. {
  497. $order_common_model = new OrderCommonModel();
  498. if (request()->isAjax()) {
  499. $page = input('page', 1);
  500. $page_size = input('page_size', PAGE_LIST_ROWS);
  501. $member_id = input('member_id', 0);//会员id
  502. $search_text = input('search_text', 0);//h关键字查询
  503. $condition = array();
  504. if($member_id > 0){
  505. $condition[] = ["member_id", "=", $member_id];
  506. }
  507. if(!empty($search_text)){
  508. $condition[] = [ 'order_no|order_name', 'like', '%' . $search_text . '%' ];
  509. }
  510. return $order_common_model->getTradePageList($condition, $page, $page_size, "create_time desc");
  511. }
  512. }
  513. }