dh_order.php 20 KB

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