dh_order.php 20 KB

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