dh_order.php 18 KB

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