dh_order.php 19 KB

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