dh_order.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  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-select',
  90. 'col' => 'name',
  91. 'result' => 'id',
  92. ),
  93. 'search' => 'hidden',
  94. 'list' => 'Dever::load("agent/member-find#name", {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. ),
  251. 'audit_desc' => array
  252. (
  253. 'type' => 'varchar-500',
  254. 'name' => '审核备注',
  255. 'default' => '',
  256. 'desc' => '审核备注',
  257. 'match' => 'option',
  258. 'update' => 'textarea',
  259. ),
  260. 'fdate' => array
  261. (
  262. 'type' => 'int-11',
  263. 'name' => '完成时间',
  264. 'default' => '',
  265. 'match' => 'is_numeric',
  266. 'desc' => '',
  267. ),
  268. 'operdate' => array
  269. (
  270. 'type' => 'int-11',
  271. 'name' => '操作时间',
  272. 'default' => '',
  273. 'match' => 'is_numeric',
  274. 'desc' => '',
  275. //'list' => '"{operdate}" > 0 ? date("Y-m-d H:i:s", {operdate}) : "-"',
  276. //'list_name' => '发货时间',
  277. //'list_order' => 8,
  278. ),
  279. 'state' => array
  280. (
  281. 'type' => 'tinyint-1',
  282. 'name' => '状态',
  283. 'default' => '1',
  284. 'desc' => '请选择状态',
  285. 'match' => 'is_numeric',
  286. ),
  287. 'cdate' => array
  288. (
  289. 'type' => 'int-11',
  290. 'name' => '行权时间',
  291. 'match' => array('is_numeric', time()),
  292. 'desc' => '',
  293. # 只有insert时才生效
  294. 'insert' => true,
  295. 'search' => 'date',
  296. 'list' => 'date("Y-m-d H:i", {cdate})',
  297. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  298. 'list_order' => 2,
  299. ),
  300. ),
  301. 'manage' => array
  302. (
  303. 'delete' => false,
  304. 'edit' => false,
  305. 'insert' => false,
  306. 'button' => $button,
  307. 'list_button' => array
  308. (
  309. //fast_list
  310. 'list' => array('查看详情', '"dh_order_goods&project=agent&order_id={id}&page_type=1"', '{type} == 1'),
  311. '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'),
  312. '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'),
  313. 'oper' => array('确认收货', '"agent/lib/manage.setDhOrderStatus?mid={mid}&order_id={id}"', '{type} == 1 && {status} == 4'),
  314. ),
  315. ),
  316. 'request' => array
  317. (
  318. 'getList' => array
  319. (
  320. # 匹配的正则或函数 选填项
  321. 'option' => array
  322. (
  323. 'mid' => 'yes',
  324. 'status' => 'yes',
  325. 'state' => 1,
  326. ),
  327. 'type' => 'all',
  328. 'order' => array('cdate' => 'desc'),
  329. 'page' => array(5, 'list'),
  330. 'col' => '*',
  331. ),
  332. 'getAll' => array
  333. (
  334. # 匹配的正则或函数 选填项
  335. 'option' => array
  336. (
  337. 'name' => array('yes', 'like'),
  338. 'mid' => 'yes',
  339. 'mobile' => 'yes',
  340. 'start' => array('yes-cdate', '>='),
  341. 'end' => array('yes-cdate', '<='),
  342. 'status' => array('yes', 'in'),
  343. 'state' => 1,
  344. ),
  345. 'type' => 'all',
  346. 'order' => array('cdate' => 'desc'),
  347. 'page' => array(10, 'list'),
  348. 'col' => '*',
  349. ),
  350. 'getYes' => array
  351. (
  352. # 匹配的正则或函数 选填项
  353. 'option' => array
  354. (
  355. 'mid' => 'yes',
  356. 'state' => 1,
  357. ),
  358. 'type' => 'all',
  359. 'order' => array('cdate' => 'desc'),
  360. 'col' => '*',
  361. ),
  362. # 获取提交订单超过12个小时
  363. 'getDataByTime' => array
  364. (
  365. # 匹配的正则或函数 选填项
  366. 'option' => array
  367. (
  368. 'cdate' => array('yes', '<='),
  369. 'status' => array('yes', 'in'),
  370. 'state' => 1,
  371. ),
  372. 'type' => 'all',
  373. 'order' => array('cdate' => 'desc'),
  374. 'col' => '*',
  375. ),
  376. # 获取1,2
  377. 'getBuy' => array
  378. (
  379. # 匹配的正则或函数 选填项
  380. 'option' => array
  381. (
  382. 'status' => 'yes',
  383. 'mid' => 'yes',
  384. 'order_num' => 'yes',
  385. 'uid' => 'yes',
  386. 'state' => 1,
  387. ),
  388. 'type' => 'all',
  389. 'order' => array('id' => 'desc'),
  390. 'col' => '*',
  391. ),
  392. 'getMyAll' => array
  393. (
  394. # 匹配的正则或函数 选填项
  395. 'option' => array
  396. (
  397. 'uid' => 'yes',
  398. 'status' => 'yes',
  399. 'cate_id' => 'yes',
  400. 'state' => 1,
  401. ),
  402. 'type' => 'all',
  403. 'order' => array('id' => 'desc'),
  404. 'page' => array(10, 'list'),
  405. 'col' => 'id,order_num,name,buy_num,cdate,cash,mid,buy_id',
  406. ),
  407. # 删除未支付订单
  408. 'drop' => array
  409. (
  410. # 匹配的正则或函数 选填项
  411. 'where' => array
  412. (
  413. 'time' => array('yes-cdate', '<='),
  414. 'status' => 1,
  415. 'state' => 1,
  416. ),
  417. 'type' => 'delete',
  418. 'col' => 'id,order_num',
  419. ),
  420. # 获取数据
  421. 'getAllByDate' => array
  422. (
  423. # 匹配的正则或函数 选填项
  424. 'where' => array
  425. (
  426. 'start' => array('yes-cdate', '>='),
  427. 'end' => array('yes-cdate', '<='),
  428. 'status' => array('yes', 'in'),
  429. 'state' => 1,
  430. ),
  431. 'type' => 'all',
  432. 'col' => 'id,order_num,mobile,mid,cdate,price-refund_cash as total,num-refund_num as num',
  433. ),
  434. # 获取订单数量
  435. 'getOrderNum' => array
  436. (
  437. # 匹配的正则或函数 选填项
  438. 'option' => array
  439. (
  440. 'start' => array('yes-cdate', '>='),
  441. 'end' => array('yes-cdate', '<='),
  442. 'mid' => 'yes',
  443. 'status' => array('yes', 'in'),
  444. 'state' => 1,
  445. ),
  446. 'type' => 'count',
  447. 'col' => '*',
  448. ),
  449. # 获取总金额
  450. 'getCashNum' => array
  451. (
  452. # 匹配的正则或函数 选填项
  453. 'option' => array
  454. (
  455. 'start' => array('yes-cdate', '>='),
  456. 'end' => array('yes-cdate', '<='),
  457. 'mid' => 'yes',
  458. 'status' => array('yes', 'in'),
  459. 'state' => 1,
  460. ),
  461. 'type' => 'one',
  462. 'col' => 'sum(price-refund_cash) as total',
  463. ),
  464. # 获取商品数量
  465. 'getGoodsNum' => array
  466. (
  467. # 匹配的正则或函数 选填项
  468. 'option' => array
  469. (
  470. 'start' => array('yes-cdate', '>='),
  471. 'end' => array('yes-cdate', '<='),
  472. 'mid' => 'yes',
  473. 'status' => array('yes', 'in'),
  474. 'state' => 1,
  475. ),
  476. 'type' => 'one',
  477. 'col' => 'sum(num-refund_num) as total',
  478. ),
  479. # 获取订单数量
  480. 'getUser' => array
  481. (
  482. # 匹配的正则或函数 选填项
  483. 'option' => array
  484. (
  485. 'start' => array('yes-cdate', '>='),
  486. 'end' => array('yes-cdate', '<='),
  487. 'mid' => 'yes',
  488. 'status' => array('yes', 'in'),
  489. 'state' => 1,
  490. ),
  491. 'type' => 'all',
  492. 'group' => 'mobile',
  493. 'col' => 'count(mobile) as total',
  494. ),
  495. 'getUserNum' => array
  496. (
  497. # 匹配的正则或函数 选填项
  498. 'option' => array
  499. (
  500. 'start' => array('yes-cdate', '>='),
  501. 'end' => array('yes-cdate', '<='),
  502. 'mid' => 'yes',
  503. 'status' => array('yes', 'in'),
  504. 'state' => 1,
  505. ),
  506. 'type' => 'count',
  507. 'col' => '*',
  508. ),
  509. ),
  510. );