dh_order.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  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. $mid = Dever::input('search_option_mid');
  16. $button = array();
  17. if ($mid) {
  18. $button = array
  19. (
  20. '返回上一页' => array('location', 'l=project/database/list&project=agent&table=member_area&page_type=1&mid=' . $mid),
  21. );
  22. }else{
  23. $button = array
  24. (
  25. '数据导出' => array('excel', '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. 'button' => $button,
  360. 'list_button' => array
  361. (
  362. //fast_list
  363. 'list' => array('查看详情', '"dh_order_goods&project=agent&order_id={id}&page_type=1"', '{type} == 1'),
  364. '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'),
  365. // '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'),
  366. 'list2' => array('审核', '"dh_order_goods&project=agent&order_id={id}&audit=1&page_type=1"', '{status} == 2'),
  367. 'oper' => array('确认收货', '"agent/lib/manage.setDhOrderStatus?mid={mid}&order_id={id}"', '{type} == 1 && {status} == 4'),
  368. ),
  369. 'list2_button' => $list2_button,
  370. ),
  371. 'request' => array
  372. (
  373. 'getList' => array
  374. (
  375. # 匹配的正则或函数 选填项
  376. 'option' => array
  377. (
  378. 'mid' => 'yes',
  379. 'status' => 'yes',
  380. 'state' => 1,
  381. ),
  382. 'type' => 'all',
  383. 'order' => array('cdate' => 'desc'),
  384. 'page' => array(5, 'list'),
  385. 'col' => '*',
  386. ),
  387. 'getAll' => array
  388. (
  389. # 匹配的正则或函数 选填项
  390. 'option' => array
  391. (
  392. 'name' => array('yes', 'like'),
  393. 'mid' => 'yes',
  394. 'mobile' => 'yes',
  395. 'start' => array('yes-cdate', '>='),
  396. 'end' => array('yes-cdate', '<='),
  397. 'status' => array('yes', 'in'),
  398. 'state' => 1,
  399. ),
  400. 'type' => 'all',
  401. 'order' => array('cdate' => 'desc'),
  402. 'page' => array(10, 'list'),
  403. 'col' => '*',
  404. ),
  405. 'getYes' => array
  406. (
  407. # 匹配的正则或函数 选填项
  408. 'option' => array
  409. (
  410. 'mid' => 'yes',
  411. 'state' => 1,
  412. ),
  413. 'type' => 'all',
  414. 'order' => array('cdate' => 'desc'),
  415. 'col' => '*',
  416. ),
  417. # 获取提交订单超过12个小时
  418. 'getDataByTime' => array
  419. (
  420. # 匹配的正则或函数 选填项
  421. 'option' => array
  422. (
  423. 'cdate' => array('yes', '<='),
  424. 'status' => array('yes', 'in'),
  425. 'state' => 1,
  426. ),
  427. 'type' => 'all',
  428. 'order' => array('cdate' => 'desc'),
  429. 'col' => '*',
  430. ),
  431. # 获取1,2
  432. 'getBuy' => array
  433. (
  434. # 匹配的正则或函数 选填项
  435. 'option' => array
  436. (
  437. 'status' => 'yes',
  438. 'mid' => 'yes',
  439. 'order_num' => 'yes',
  440. 'uid' => 'yes',
  441. 'state' => 1,
  442. ),
  443. 'type' => 'all',
  444. 'order' => array('id' => 'desc'),
  445. 'col' => '*',
  446. ),
  447. 'getMyAll' => array
  448. (
  449. # 匹配的正则或函数 选填项
  450. 'option' => array
  451. (
  452. 'uid' => 'yes',
  453. 'status' => 'yes',
  454. 'cate_id' => 'yes',
  455. 'state' => 1,
  456. ),
  457. 'type' => 'all',
  458. 'order' => array('id' => 'desc'),
  459. 'page' => array(10, 'list'),
  460. 'col' => 'id,order_num,name,buy_num,cdate,cash,mid,buy_id',
  461. ),
  462. # 删除未支付订单
  463. 'drop' => array
  464. (
  465. # 匹配的正则或函数 选填项
  466. 'where' => array
  467. (
  468. 'time' => array('yes-cdate', '<='),
  469. 'status' => 1,
  470. 'state' => 1,
  471. ),
  472. 'type' => 'delete',
  473. 'col' => 'id,order_num',
  474. ),
  475. # 获取数据
  476. 'getAllByDate' => array
  477. (
  478. # 匹配的正则或函数 选填项
  479. 'where' => array
  480. (
  481. 'start' => array('yes-cdate', '>='),
  482. 'end' => array('yes-cdate', '<='),
  483. 'status' => array('yes', 'in'),
  484. 'state' => 1,
  485. ),
  486. 'type' => 'all',
  487. 'col' => 'id,order_num,mobile,mid,cdate,price-refund_cash as total,num-refund_num as num',
  488. ),
  489. # 获取订单数量
  490. 'getOrderNum' => array
  491. (
  492. # 匹配的正则或函数 选填项
  493. 'option' => array
  494. (
  495. 'start' => array('yes-cdate', '>='),
  496. 'end' => array('yes-cdate', '<='),
  497. 'mid' => 'yes',
  498. 'status' => array('yes', 'in'),
  499. 'state' => 1,
  500. ),
  501. 'type' => 'count',
  502. 'col' => '*',
  503. ),
  504. # 获取总金额
  505. 'getCashNum' => array
  506. (
  507. # 匹配的正则或函数 选填项
  508. 'option' => array
  509. (
  510. 'start' => array('yes-cdate', '>='),
  511. 'end' => array('yes-cdate', '<='),
  512. 'mid' => 'yes',
  513. 'status' => array('yes', 'in'),
  514. 'state' => 1,
  515. ),
  516. 'type' => 'one',
  517. 'col' => 'sum(price-refund_cash) as total',
  518. ),
  519. # 获取商品数量
  520. 'getGoodsNum' => array
  521. (
  522. # 匹配的正则或函数 选填项
  523. 'option' => array
  524. (
  525. 'start' => array('yes-cdate', '>='),
  526. 'end' => array('yes-cdate', '<='),
  527. 'mid' => 'yes',
  528. 'status' => array('yes', 'in'),
  529. 'state' => 1,
  530. ),
  531. 'type' => 'one',
  532. 'col' => 'sum(num-refund_num) as total',
  533. ),
  534. # 获取订单数量
  535. 'getUser' => array
  536. (
  537. # 匹配的正则或函数 选填项
  538. 'option' => array
  539. (
  540. 'start' => array('yes-cdate', '>='),
  541. 'end' => array('yes-cdate', '<='),
  542. 'mid' => 'yes',
  543. 'status' => array('yes', 'in'),
  544. 'state' => 1,
  545. ),
  546. 'type' => 'all',
  547. 'group' => 'mobile',
  548. 'col' => 'count(mobile) as total',
  549. ),
  550. 'getUserNum' => array
  551. (
  552. # 匹配的正则或函数 选填项
  553. 'option' => array
  554. (
  555. 'start' => array('yes-cdate', '>='),
  556. 'end' => array('yes-cdate', '<='),
  557. 'mid' => 'yes',
  558. 'status' => array('yes', 'in'),
  559. 'state' => 1,
  560. ),
  561. 'type' => 'count',
  562. 'col' => '*',
  563. ),
  564. 'getExcelAll' => array
  565. (
  566. # 匹配的正则或函数 选填项
  567. 'option' => array
  568. (
  569. 'start' => array('yes-cdate', '>='),
  570. 'end' => array('yes-cdate', '<='),
  571. 'state' => 1,
  572. ),
  573. 'type' => 'all',
  574. 'col' => '*',
  575. ),
  576. ),
  577. );