dh_order.php 16 KB

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