dh_order.php 19 KB

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