dh_order.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. <?php
  2. $pay_status = Dever::config('base', 'pay')->pay['status'];
  3. $audit = array
  4. (
  5. //1 => '待审核',
  6. 2 => '审核通过',
  7. 3 => '审核未通过',
  8. );
  9. $type = Dever::db('agent/member_goods')->config['set']['type'];
  10. $dh_type = array
  11. (
  12. 1 => '兑换',
  13. 2 => '自动发放',
  14. );
  15. $excel = false;
  16. $mid = Dever::input('search_option_mid');
  17. $button = array();
  18. if ($mid) {
  19. $button = array
  20. (
  21. '返回上一页' => array('location', 'l=project/database/list&project=agent&table=member_area&page_type=1&mid=' . $mid),
  22. );
  23. }else{
  24. if(Dever::load('manage/auth')->checkFunc('agent.dh_order', 'editQorderout', '数据导出')){
  25. $excel[] = array('数据导出', '权益订单','agent/lib/dhorder.out_dhorder');
  26. }
  27. }
  28. $list2_button = array();
  29. if (Dever::load('manage/auth')->checkFunc('agent.dh_order', 'edit', '审核')){
  30. $list2_button = array('审核', '"dh_order_goods&project=agent&order_id={id}&audit=1&page_type=1"', '{status} == 2');
  31. }
  32. $status = array
  33. (
  34. 1 => array('name' => '待支付', 'style' => 'font-weight:bold;color:#436EEE'),
  35. 2 => array('name' => '待审核', 'style' => 'font-weight:bold;color:#436EEE'),
  36. 3 => array('name' => '已审核(未发货)', 'style' => 'font-weight:bold;color:green'),
  37. 4 => array('name' => '已审核(已发货)', 'style' => 'font-weight:bold;color:green'),
  38. 5 => array('name' => '已完成', 'style' => 'font-weight:bold;color:green'),
  39. 6 => array('name' => '已完成(有退款)', 'style' => 'font-weight:bold;color:green'),
  40. 7 => array('name' => '作废', 'style' => 'font-weight:bold;color:#CD3700'),
  41. 8 => array('name' => '已退款', 'style' => 'font-weight:bold;color:#CD3700'),
  42. 11 => array('name' => '已过期', 'style' => 'font-weight:bold;color:#CD3700'),
  43. );
  44. $refund_status = array
  45. (
  46. 1 => '未申请',
  47. 2 => '申请中',
  48. 3 => '有退款',
  49. 4 => '已退款',
  50. );
  51. $mid = Dever::input('search_option_mid');
  52. return array
  53. (
  54. # 表名
  55. 'name' => 'dh_order',
  56. # 显示给用户看的名称
  57. 'lang' => '权益订单',
  58. 'order' => 80,
  59. 'status' => $status,
  60. 'end' => array
  61. (
  62. //'insert' => 'agent/lib/manage.sellOrderUpdate',
  63. 'update' => 'agent/lib/manage.sellOrderUpdate',
  64. ),
  65. # 数据结构
  66. 'struct' => array
  67. (
  68. 'id' => array
  69. (
  70. 'type' => 'int-11',
  71. 'name' => 'ID',
  72. 'default' => '',
  73. 'desc' => '',
  74. 'match' => 'is_numeric',
  75. 'search' => 'order',
  76. //'list' => true,
  77. ),
  78. 'shop_id' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => '门店名称',
  82. 'default' => '',
  83. 'desc' => '门店名称',
  84. 'match' => 'is_numeric',
  85. 'search' => 'select',
  86. 'update' => 'hidden',
  87. ),
  88. 'mid' => array
  89. (
  90. 'type' => 'int-11',
  91. 'name' => '代理商姓名/手机号',
  92. 'default' => '-1',
  93. 'desc' => '代理商',
  94. 'match' => 'is_string',
  95. 'update' => 'text',
  96. 'search' => array
  97. (
  98. 'api' => 'agent/member-getSearch',
  99. 'col' => 'col',
  100. 'result' => 'id',
  101. 'search' => 'mid',
  102. ),
  103. 'list_name' => '行权人',
  104. 'list' => 'Dever::load("agent/lib/member.getOne", {mid}, "agent/member", true)',
  105. 'list_order' => 3,
  106. ),
  107. 'mobile' => array
  108. (
  109. 'type' => 'varchar-300',
  110. 'name' => '手机号',
  111. 'default' => '',
  112. 'desc' => '手机号',
  113. 'match' => 'option',
  114. //'search' => $mid ? 'hidden' : 'fulltext',
  115. // 'list' => true,
  116. 'list' =>'Dever::load("agent/lib/member.set_mobile", {id})',
  117. 'list_order' => 4,
  118. ),
  119. 'agent-member-mobile'=> array
  120. (
  121. 'name' => '名称',
  122. 'default' => '',
  123. 'desc' => '手机号',
  124. 'match' => 'option',
  125. 'searchs' => array
  126. (
  127. 'api' => 'agent/member-find',
  128. 'col' => 'name',
  129. 'result' => 'id',
  130. 'search' => 'mid',
  131. ),
  132. # 读取另外表的关联方式
  133. 'sync' => array('mid', 'id'),
  134. ),
  135. 'agent-member-idcard'=> array
  136. (
  137. 'name' => '身份证号',
  138. 'default' => '',
  139. 'desc' => '手机号',
  140. 'match' => 'option',
  141. 'searchs' => array
  142. (
  143. 'api' => 'agent/member-find',
  144. 'col' => 'idcard',
  145. 'result' => 'id',
  146. 'search' => 'mid',
  147. ),
  148. # 读取另外表的关联方式
  149. 'sync' => array('mid', 'id'),
  150. ),
  151. 'address_id' => array
  152. (
  153. 'type' => 'int-11',
  154. 'name' => '送货地址',
  155. 'default' => '',
  156. 'desc' => '送货地址',
  157. 'match' => 'is_numeric',
  158. ),
  159. 'type' => array
  160. (
  161. 'type' => 'tinyint-1',
  162. 'name' => '类型',
  163. 'default' => '1',
  164. 'desc' => '类型',
  165. 'match' => 'is_numeric',
  166. 'update' => 'radio',
  167. 'option' => $type,
  168. ),
  169. 'type_id' => array
  170. (
  171. 'type' => 'int-11',
  172. 'name' => '类型id',
  173. 'default' => '-1',
  174. 'desc' => '类型id',
  175. 'match' => 'is_numeric',
  176. 'list_name' => '权益名称',
  177. //'list' => 'Dever::load("agent/lib/manage.getGoods#name", "{type}", "{type_id}", "-2")',
  178. ),
  179. 'dh_type' => array
  180. (
  181. 'type' => 'tinyint-1',
  182. 'name' => '行权方式',
  183. 'default' => '1',
  184. 'desc' => '行权方式',
  185. 'match' => 'is_numeric',
  186. 'update' => 'radio',
  187. 'option' => $dh_type,
  188. 'list' => true,
  189. 'list_order' => 5,
  190. ),
  191. 'name' => array
  192. (
  193. 'type' => 'varchar-800',
  194. 'name' => '详情',
  195. 'default' => '',
  196. 'desc' => '订单名称',
  197. 'match' => 'is_string',
  198. 'update' => 'text',
  199. 'list' => true,
  200. 'list_order' => 6,
  201. ),
  202. 'order_num' => array
  203. (
  204. 'type' => 'varchar-100',
  205. 'name' => '订单号',
  206. 'default' => '',
  207. 'desc' => '订单号',
  208. 'match' => 'is_string',
  209. 'update' => 'text',
  210. //'search' => 'fulltext',
  211. //'list' => true,
  212. //'list_order' => 1,
  213. ),
  214. 'price' => array
  215. (
  216. 'type' => 'varchar-50',
  217. 'name' => '订单总金额',
  218. 'default' => '0',
  219. 'desc' => '实付金额',
  220. 'match' => 'option',
  221. 'update' => 'text',
  222. 'list' => false,
  223. 'list_order' => 11,
  224. ),
  225. 'num' => array
  226. (
  227. 'type' => 'int-11',
  228. 'name' => '购买总数量',
  229. 'default' => '',
  230. 'desc' => '购买总数量',
  231. 'match' => 'is_numeric',
  232. 'search' => 'select',
  233. 'list' => false,
  234. 'list_order' => 10,
  235. ),
  236. 'refund_num' => array
  237. (
  238. 'type' => 'int-11',
  239. 'name' => '退款数量',
  240. 'default' => '0',
  241. 'desc' => '退款数量',
  242. 'match' => 'is_numeric',
  243. ),
  244. 'refund_cash' => array
  245. (
  246. 'type' => 'decimal-11,2',
  247. 'name' => '退款金额',
  248. 'default' => '0',
  249. 'desc' => '已退订单金额',
  250. 'match' => 'option',
  251. 'update' => 'text',
  252. ),
  253. 'refund_status' => array
  254. (
  255. 'type' => 'tinyint-1',
  256. 'name' => '退款状态',
  257. 'default' => '1',
  258. 'desc' => '申请退款状态',
  259. 'match' => 'is_numeric',
  260. 'option' => $refund_status,
  261. ),
  262. 'info' => array
  263. (
  264. 'type' => 'varchar-300',
  265. 'name' => '订单备注',
  266. 'default' => '',
  267. 'desc' => '订单备注',
  268. 'match' => 'option',
  269. 'update' => 'textarea',
  270. ),
  271. 'status' => array
  272. (
  273. 'type' => 'tinyint-1',
  274. 'name' => '订单状态',
  275. 'default' => '1',
  276. 'desc' => '订单状态',
  277. 'match' => 'is_numeric',
  278. 'option' => $status,
  279. 'search' => 'select',
  280. 'list' => true,
  281. 'list_order' => 7,
  282. ),
  283. 'audit' => array
  284. (
  285. 'type' => 'tinyint-1',
  286. 'name' => '审核状态',
  287. 'default' => '2',
  288. 'desc' => '审核状态',
  289. 'match' => 'is_numeric',
  290. 'option' => $audit,
  291. //'search' => 'select',
  292. 'update' => 'radio',
  293. 'control' => 'audit',
  294. ),
  295. 'audit_desc' => array
  296. (
  297. 'type' => 'varchar-500',
  298. 'name' => '审核备注',
  299. 'default' => '',
  300. 'desc' => '审核备注',
  301. 'match' => 'is_string',
  302. 'update' => 'textarea',
  303. 'show' => 'audit=3',
  304. ),
  305. 'fdate' => array
  306. (
  307. 'type' => 'int-11',
  308. 'name' => '完成时间',
  309. 'default' => '',
  310. 'match' => 'is_numeric',
  311. 'desc' => '',
  312. ),
  313. 'operdate' => array
  314. (
  315. 'type' => 'int-11',
  316. 'name' => '操作时间',
  317. 'default' => '',
  318. 'match' => 'is_numeric',
  319. 'desc' => '',
  320. //'list' => '"{operdate}" > 0 ? date("Y-m-d H:i:s", {operdate}) : "-"',
  321. //'list_name' => '发货时间',
  322. //'list_order' => 8,
  323. ),
  324. 'state' => array
  325. (
  326. 'type' => 'tinyint-1',
  327. 'name' => '状态',
  328. 'default' => '1',
  329. 'desc' => '请选择状态',
  330. 'match' => 'is_numeric',
  331. ),
  332. 'cdate' => array
  333. (
  334. 'type' => 'int-11',
  335. 'name' => '行权时间',
  336. 'match' => array('is_numeric', time()),
  337. 'desc' => '',
  338. # 只有insert时才生效
  339. 'insert' => true,
  340. 'search' => 'date',
  341. 'list' => 'date("Y-m-d H:i", {cdate})',
  342. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  343. 'list_order' => 2,
  344. ),
  345. ),
  346. 'alter' => array
  347. (
  348. 10 => array
  349. (
  350. array('update', 'refund_cash', 'refund_cash', 'decimal-11,2 0 退款金额'),
  351. ),
  352. 'version' => 10,
  353. ),
  354. 'manage' => array
  355. (
  356. 'delete' => false,
  357. 'edit' => false,
  358. 'insert' => false,
  359. 'excel' => $excel,
  360. 'button' => $button,
  361. 'list_button' => array
  362. (
  363. //fast_list
  364. 'list' => array('查看详情', '"dh_order_goods&project=agent&order_id={id}&page_type=1"', '{type} == 1'),
  365. 'list1' => array('查看采购单', '"buy_order&project=shop&search_option_type=1&search_option_parent_type=3&search_option_parent_order_id={id}&oper_table=dh_order&oper_project=agent"', '{type} == 1 && {status} >= 3 && {audit} == 2'),
  366. // 'fast' => array('审核', '"dh_order&where_id={id}&col=audit,audit_desc&oper_save_jump=dh_order&oper_table=dh_order&oper_parent=dh_order"', '{type} == 1 && {status} == 2'),
  367. 'list2' => array('审核', '"dh_order_goods&project=agent&order_id={id}&audit=1&page_type=1"', '{status} == 2'),
  368. 'oper' => array('确认收货', '"agent/lib/manage.setDhOrderStatus?mid={mid}&order_id={id}"', '{type} == 1 && {status} == 4'),
  369. ),
  370. 'list2_button' => $list2_button,
  371. ),
  372. 'request' => array
  373. (
  374. 'getList' => array
  375. (
  376. # 匹配的正则或函数 选填项
  377. 'option' => array
  378. (
  379. 'mid' => 'yes',
  380. 'status' => 'yes',
  381. 'state' => 1,
  382. ),
  383. 'type' => 'all',
  384. 'order' => array('cdate' => 'desc'),
  385. 'page' => array(5, 'list'),
  386. 'col' => '*',
  387. ),
  388. 'getAll' => array
  389. (
  390. # 匹配的正则或函数 选填项
  391. 'option' => array
  392. (
  393. 'name' => array('yes', 'like'),
  394. 'mid' => 'yes',
  395. 'mobile' => 'yes',
  396. 'start' => array('yes-cdate', '>='),
  397. 'end' => array('yes-cdate', '<='),
  398. 'status' => array('yes', 'in'),
  399. 'state' => 1,
  400. ),
  401. 'type' => 'all',
  402. 'order' => array('cdate' => 'desc'),
  403. 'page' => array(10, 'list'),
  404. 'col' => '*',
  405. ),
  406. 'getYes' => array
  407. (
  408. # 匹配的正则或函数 选填项
  409. 'option' => array
  410. (
  411. 'mid' => 'yes',
  412. 'state' => 1,
  413. ),
  414. 'type' => 'all',
  415. 'order' => array('cdate' => 'desc'),
  416. 'col' => '*',
  417. ),
  418. # 获取提交订单超过12个小时
  419. 'getDataByTime' => array
  420. (
  421. # 匹配的正则或函数 选填项
  422. 'option' => array
  423. (
  424. 'cdate' => array('yes', '<='),
  425. 'status' => array('yes', 'in'),
  426. 'state' => 1,
  427. ),
  428. 'type' => 'all',
  429. 'order' => array('cdate' => 'desc'),
  430. 'col' => '*',
  431. ),
  432. # 获取1,2
  433. 'getBuy' => array
  434. (
  435. # 匹配的正则或函数 选填项
  436. 'option' => array
  437. (
  438. 'status' => 'yes',
  439. 'mid' => 'yes',
  440. 'order_num' => 'yes',
  441. 'uid' => 'yes',
  442. 'state' => 1,
  443. ),
  444. 'type' => 'all',
  445. 'order' => array('id' => 'desc'),
  446. 'col' => '*',
  447. ),
  448. 'getMyAll' => array
  449. (
  450. # 匹配的正则或函数 选填项
  451. 'option' => array
  452. (
  453. 'uid' => 'yes',
  454. 'status' => 'yes',
  455. 'cate_id' => 'yes',
  456. 'state' => 1,
  457. ),
  458. 'type' => 'all',
  459. 'order' => array('id' => 'desc'),
  460. 'page' => array(10, 'list'),
  461. 'col' => 'id,order_num,name,buy_num,cdate,cash,mid,buy_id',
  462. ),
  463. # 删除未支付订单
  464. 'drop' => array
  465. (
  466. # 匹配的正则或函数 选填项
  467. 'where' => array
  468. (
  469. 'time' => array('yes-cdate', '<='),
  470. 'status' => 1,
  471. 'state' => 1,
  472. ),
  473. 'type' => 'delete',
  474. 'col' => 'id,order_num',
  475. ),
  476. # 获取数据
  477. 'getAllByDate' => array
  478. (
  479. # 匹配的正则或函数 选填项
  480. 'where' => array
  481. (
  482. 'start' => array('yes-cdate', '>='),
  483. 'end' => array('yes-cdate', '<='),
  484. 'status' => array('yes', 'in'),
  485. 'state' => 1,
  486. ),
  487. 'type' => 'all',
  488. 'col' => 'id,order_num,mobile,mid,cdate,price-refund_cash as total,num-refund_num as num',
  489. ),
  490. # 获取订单数量
  491. 'getOrderNum' => array
  492. (
  493. # 匹配的正则或函数 选填项
  494. 'option' => array
  495. (
  496. 'start' => array('yes-cdate', '>='),
  497. 'end' => array('yes-cdate', '<='),
  498. 'mid' => 'yes',
  499. 'status' => array('yes', 'in'),
  500. 'state' => 1,
  501. ),
  502. 'type' => 'count',
  503. 'col' => '*',
  504. ),
  505. # 获取总金额
  506. 'getCashNum' => array
  507. (
  508. # 匹配的正则或函数 选填项
  509. 'option' => array
  510. (
  511. 'start' => array('yes-cdate', '>='),
  512. 'end' => array('yes-cdate', '<='),
  513. 'mid' => 'yes',
  514. 'status' => array('yes', 'in'),
  515. 'state' => 1,
  516. ),
  517. 'type' => 'one',
  518. 'col' => 'sum(price-refund_cash) as total',
  519. ),
  520. # 获取商品数量
  521. 'getGoodsNum' => array
  522. (
  523. # 匹配的正则或函数 选填项
  524. 'option' => array
  525. (
  526. 'start' => array('yes-cdate', '>='),
  527. 'end' => array('yes-cdate', '<='),
  528. 'mid' => 'yes',
  529. 'status' => array('yes', 'in'),
  530. 'state' => 1,
  531. ),
  532. 'type' => 'one',
  533. 'col' => 'sum(num-refund_num) as total',
  534. ),
  535. # 获取订单数量
  536. 'getUser' => array
  537. (
  538. # 匹配的正则或函数 选填项
  539. 'option' => array
  540. (
  541. 'start' => array('yes-cdate', '>='),
  542. 'end' => array('yes-cdate', '<='),
  543. 'mid' => 'yes',
  544. 'status' => array('yes', 'in'),
  545. 'state' => 1,
  546. ),
  547. 'type' => 'all',
  548. 'group' => 'mobile',
  549. 'col' => 'count(mobile) as total',
  550. ),
  551. 'getUserNum' => array
  552. (
  553. # 匹配的正则或函数 选填项
  554. 'option' => array
  555. (
  556. 'start' => array('yes-cdate', '>='),
  557. 'end' => array('yes-cdate', '<='),
  558. 'mid' => 'yes',
  559. 'status' => array('yes', 'in'),
  560. 'state' => 1,
  561. ),
  562. 'type' => 'count',
  563. 'col' => '*',
  564. ),
  565. 'getDhNum' => array
  566. (
  567. # 匹配的正则或函数 选填项
  568. 'option' => array
  569. (
  570. 'start' => array('yes-cdate', '>='),
  571. 'end' => array('yes-cdate', '<='),
  572. 'status' => array('yes', 'in'),
  573. 'state' => 1,
  574. ),
  575. 'type' => 'count',
  576. 'col' => '*',
  577. ),
  578. 'getExcelAll' => array
  579. (
  580. # 匹配的正则或函数 选填项
  581. 'option' => array
  582. (
  583. 'start' => array('yes-cdate', '>='),
  584. 'end' => array('yes-cdate', '<='),
  585. 'state' => 1,
  586. ),
  587. 'type' => 'all',
  588. 'col' => '*',
  589. ),
  590. ),
  591. );