dh_order.php 21 KB

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