order.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. <?php
  2. $role = function()
  3. {
  4. $array = array();
  5. $data = Dever::load('setting/role-state');
  6. if($data)
  7. {
  8. $array += $data;
  9. }
  10. return $array;
  11. };
  12. $source_id = function()
  13. {
  14. $array = array
  15. (
  16. -1 => array
  17. (
  18. 'id' => '-1',
  19. 'name' => '无来源',
  20. ),
  21. );
  22. $data = Dever::load('setting/source-state');
  23. if($data)
  24. {
  25. $array += $data;
  26. }
  27. return $array;
  28. };
  29. $status = array
  30. (
  31. -1 => '待签名',
  32. 1 => '待业务初审',
  33. 2 => '待财务终审',
  34. 3 => '待权益发放',
  35. 4 => '已完成',
  36. 5 => '审核失败',
  37. 6 => '挂起',
  38. );
  39. $pay_status = array
  40. (
  41. 1 => '待支付',
  42. 2 => '已支付',
  43. 3 => '已退款',
  44. );
  45. $goods_status = array
  46. (
  47. 1 => '未发放',
  48. 2 => '无权益',
  49. 3 => '已发放',
  50. );
  51. $type = array
  52. (
  53. 1 => '个人',
  54. 2 => '公司',
  55. );
  56. $pay_type = array
  57. (
  58. 1 => '在线支付',
  59. 2 => '汇款',
  60. 3 => '个人转账',
  61. );
  62. $get_type = array
  63. (
  64. 1 => '购买',
  65. 2 => '赠送',
  66. );
  67. $level = function()
  68. {
  69. $array = array
  70. (
  71. -1 => array
  72. (
  73. 'id' => -1,
  74. 'name' => '普通',
  75. ),
  76. );
  77. $data = Dever::load('setting/level-state');
  78. if($data)
  79. {
  80. $array += $data;
  81. }
  82. return $array;
  83. };
  84. $order_type = array
  85. (
  86. 1 => '新购',
  87. 2 => '升级',
  88. );
  89. $button = array();
  90. $parent_mid = Dever::input('search_option_parent_mid');
  91. $mid = Dever::input('search_option_mid');
  92. $pmid = '';
  93. if ($parent_mid) {
  94. $pmid = $parent_mid;
  95. }
  96. if ($mid) {
  97. $pmid = $mid;
  98. }
  99. if ($pmid) {
  100. $button = array
  101. (
  102. '返回上一页' => array('location', 'l=project/database/list&project=agent&table=member_area&page_type=1&mid=' . $pmid),
  103. );
  104. }
  105. return array
  106. (
  107. # 表名
  108. 'name' => 'order',
  109. # 显示给用户看的名称
  110. 'lang' => '代理商订单',
  111. 'set' => array
  112. (
  113. 'status' => $status,
  114. 'pay_status' => $pay_status,
  115. 'goods_status' => $goods_status,
  116. 'type' => $type,
  117. 'pay_type' => $pay_type,
  118. 'order_type' => $order_type,
  119. ),
  120. 'order' => 99,
  121. # 数据结构
  122. 'struct' => array
  123. (
  124. 'id' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => 'ID',
  128. 'default' => '',
  129. 'desc' => '',
  130. 'match' => 'is_numeric',
  131. 'search' => 'order',
  132. //'list' => true,
  133. ),
  134. 'mid' => array
  135. (
  136. 'type' => 'int-11',
  137. 'name' => '代理商',
  138. 'default' => '-1',
  139. 'desc' => '代理商',
  140. 'match' => 'is_string',
  141. 'update' => 'text',
  142. 'searchs' => array
  143. (
  144. 'api' => 'agent/member-find',
  145. 'col' => 'mobile',
  146. 'result' => 'id',
  147. ),
  148. //'list' => 'Dever::load("agent/member-find#name", {mid})',
  149. ),
  150. 'order_num' => array
  151. (
  152. 'type' => 'varchar-100',
  153. 'name' => '订单号',
  154. 'default' => '',
  155. 'desc' => '订单号',
  156. 'match' => 'is_string',
  157. 'update' => 'text',
  158. 'search' => 'fulltext',
  159. 'list' => true,
  160. 'list_order' => 1,
  161. ),
  162. 'order_type' => array
  163. (
  164. 'type' => 'tinyint-1',
  165. 'name' => '订单类型',
  166. 'default' => '1',
  167. 'desc' => '订单类型',
  168. 'match' => 'is_numeric',
  169. 'option' => $order_type,
  170. ),
  171. 'mobile' => array
  172. (
  173. 'type' => 'bigint-11',
  174. 'name' => '手机号',
  175. 'default' => '',
  176. 'desc' => '请输入手机号',
  177. 'match' => Dever::rule('mobile'),
  178. 'update' => 'text',
  179. 'search' => 'fulltext',
  180. //'list' => true,
  181. ),
  182. 'parent_mid' => array
  183. (
  184. 'type' => 'int-11',
  185. 'name' => '邀请人手机号',
  186. 'default' => '-1',
  187. 'desc' => '邀请人',
  188. 'match' => 'is_string',
  189. 'update' => 'text',
  190. 'search' => $parent_mid ? 'hidden' : array
  191. (
  192. 'api' => 'agent/member-find',
  193. 'col' => 'mobile',
  194. 'result' => 'id',
  195. ),
  196. 'list_name' => '邀请人',
  197. 'list' => 'Dever::load("agent/lib/member.getOne", {parent_mid})',
  198. 'list_order' => 4,
  199. ),
  200. 'source_id' => array
  201. (
  202. 'type' => 'int-11',
  203. 'name' => '注册来源',
  204. 'default' => '-1',
  205. 'desc' => '注册来源',
  206. 'match' => 'is_numeric',
  207. 'search' => 'select',
  208. 'update' => 'checkbox',
  209. 'option' => $source_id,
  210. 'list' => true,
  211. 'list_order' => 5,
  212. ),
  213. 'name' => array
  214. (
  215. 'type' => 'varchar-100',
  216. 'name' => '姓名',
  217. 'default' => '',
  218. 'desc' => '姓名',
  219. 'match' => 'is_string',
  220. 'update' => 'text',
  221. 'search' => 'fulltext',
  222. 'list' => 'Dever::load("agent/lib/member.getOne", {id}, "agent/order")',
  223. 'list_order' => 3,
  224. ),
  225. 'role' => array
  226. (
  227. 'type' => 'int-11',
  228. 'name' => '代理角色',
  229. 'default' => '',
  230. 'desc' => '代理角色',
  231. 'match' => 'is_numeric',
  232. 'search' => 'select',
  233. 'update' => 'checkbox',
  234. 'option' => $role,
  235. //'list' => true,
  236. ),
  237. 'area' => array
  238. (
  239. 'type' => 'varchar-500',
  240. 'name' => '区域',
  241. 'default' => '',
  242. 'desc' => '区域',
  243. 'match' => 'option',
  244. 'search' => 'linkage',
  245. 'update' => 'linkage',
  246. 'option' => Dever::url('api.get?level_total=4', 'area'),
  247. 'list' => 'Dever::load("area/api.string", "{area}")',
  248. ),
  249. 'desc' => array
  250. (
  251. 'type' => 'varchar-600',
  252. 'name' => '付款备注',
  253. 'default' => '',
  254. 'desc' => '付款备注',
  255. 'match' => 'is_string',
  256. 'update' => 'text',
  257. ),
  258. 'f_price' => array
  259. (
  260. 'type' => 'float-11,2',
  261. 'name' => '原价',
  262. 'default' => '0',
  263. 'desc' => '原价',
  264. 'match' => 'option',
  265. 'update' => 'text',
  266. ),
  267. 'price' => array
  268. (
  269. 'type' => 'float-11,2',
  270. 'name' => '实付金额',
  271. 'default' => '0',
  272. 'desc' => '金额',
  273. 'match' => 'option',
  274. 'update' => 'text',
  275. 'list' => true,
  276. 'list_order' => 6,
  277. ),
  278. 'pay_type' => array
  279. (
  280. 'type' => 'tinyint-1',
  281. 'name' => '支付方式',
  282. 'default' => '1',
  283. 'desc' => '支付方式',
  284. 'match' => 'is_numeric',
  285. 'search' => 'select',
  286. 'update' => 'select',
  287. 'option' => $pay_type,
  288. 'list' => true,
  289. 'list_order' => 7,
  290. ),
  291. 'pay_pic' => array
  292. (
  293. 'type' => 'varchar-150',
  294. 'name' => '打款凭证',
  295. 'default' => '',
  296. 'desc' => '打款凭证',
  297. 'match' => 'option',
  298. 'update' => 'image',
  299. 'key' => '1',
  300. 'place' => '150',
  301. ),
  302. 'pay_price' => array
  303. (
  304. 'type' => 'float-11,2',
  305. 'name' => '交款金额',
  306. 'default' => '0',
  307. 'desc' => '交款金额',
  308. 'match' => 'option',
  309. 'update' => 'text',
  310. ),
  311. 'bank_id' => array
  312. (
  313. 'type' => 'int-11',
  314. 'name' => '所属银行',
  315. 'default' => '',
  316. 'desc' => '所属银行',
  317. 'match' => 'is_numeric',
  318. ),
  319. 'bank_card' => array
  320. (
  321. 'type' => 'int-11',
  322. 'name' => '银行卡号',
  323. 'default' => '',
  324. 'desc' => '银行卡号',
  325. 'match' => 'is_numeric',
  326. ),
  327. 'type' => array
  328. (
  329. 'type' => 'tinyint-1',
  330. 'name' => '类型',
  331. 'default' => '1',
  332. 'desc' => '类型',
  333. 'match' => 'is_numeric',
  334. 'option' => $type,
  335. ),
  336. 'sign' => array
  337. (
  338. 'type' => 'varchar-150',
  339. 'name' => '手写签名',
  340. 'default' => '',
  341. 'desc' => '手写签名',
  342. 'match' => 'option',
  343. 'update' => 'image',
  344. 'key' => '7',
  345. ),
  346. 'idcard' => array
  347. (
  348. 'type' => 'varchar-100',
  349. 'name' => '身份证号码',
  350. 'default' => '',
  351. 'desc' => '身份证号码',
  352. 'match' => 'is_string',
  353. 'update' => 'text',
  354. 'search' => 'fulltext',
  355. ),
  356. 'idcard_front' => array
  357. (
  358. 'type' => 'varchar-150',
  359. 'name' => '身份证正面',
  360. 'default' => '',
  361. 'desc' => '身份证正面',
  362. 'match' => 'option',
  363. 'update' => 'image',
  364. 'key' => '8',
  365. 'place' => '660*660',
  366. ),
  367. 'idcard_back' => array
  368. (
  369. 'type' => 'varchar-150',
  370. 'name' => '身份证背面',
  371. 'default' => '',
  372. 'desc' => '身份证背面',
  373. 'match' => 'option',
  374. 'update' => 'image',
  375. 'key' => '8',
  376. 'place' => '660*660',
  377. ),
  378. 'company_name' => array
  379. (
  380. 'type' => 'varchar-100',
  381. 'name' => '公司名称',
  382. 'default' => '',
  383. 'desc' => '公司名称',
  384. 'match' => 'is_string',
  385. 'update' => 'text',
  386. //'search' => 'fulltext',
  387. //'list' => true,
  388. ),
  389. 'company_pic' => array
  390. (
  391. 'type' => 'varchar-150',
  392. 'name' => '营业执照',
  393. 'default' => '',
  394. 'desc' => '营业执照',
  395. 'match' => 'option',
  396. 'update' => 'image',
  397. 'key' => '8',
  398. 'place' => '660*660',
  399. ),
  400. 'company_number' => array
  401. (
  402. 'type' => 'varchar-80',
  403. 'name' => '营业执照号码',
  404. 'default' => '',
  405. 'desc' => '营业执照号码',
  406. 'match' => 'is_string',
  407. 'update' => 'text',
  408. ),
  409. 'address' => array
  410. (
  411. 'type' => 'varchar-800',
  412. 'name' => '地址',
  413. 'default' => '',
  414. 'desc' => '地址',
  415. 'match' => 'is_string',
  416. 'update' => 'text',
  417. ),
  418. 'audit_desc' => array
  419. (
  420. 'type' => 'varchar-400',
  421. 'name' => '审核备注-从order_process中同步过来',
  422. 'default' => '',
  423. 'desc' => '审核备注',
  424. 'match' => 'is_string',
  425. //'update' => 'textarea',
  426. ),
  427. 'status' => array
  428. (
  429. 'type' => 'tinyint-1',
  430. 'name' => '订单状态',
  431. 'default' => '1',
  432. 'desc' => '状态',
  433. 'match' => 'is_numeric',
  434. 'option' => $status,
  435. 'search' => 'select',
  436. 'list' => true,
  437. 'list_order' => 8,
  438. ),
  439. 'history_status' => array
  440. (
  441. 'type' => 'tinyint-1',
  442. 'name' => '记录挂起之前的状态',
  443. 'default' => '1',
  444. 'desc' => '状态',
  445. 'match' => 'is_numeric',
  446. 'option' => $status,
  447. ),
  448. 'goods_status' => array
  449. (
  450. 'type' => 'tinyint-1',
  451. 'name' => '权益状态',
  452. 'default' => '1',
  453. 'desc' => '权益状态',
  454. 'match' => 'is_numeric',
  455. 'option' => $goods_status,
  456. 'search' => 'select',
  457. 'list' => true,
  458. 'list_order' => 9,
  459. ),
  460. 'pay_status' => array
  461. (
  462. 'type' => 'tinyint-1',
  463. 'name' => '支付状态',
  464. 'default' => '1',
  465. 'desc' => '状态',
  466. 'match' => 'is_numeric',
  467. 'option' => $pay_status,
  468. ),
  469. 'get_type' => array
  470. (
  471. 'type' => 'tinyint-1',
  472. 'name' => '获取方式',
  473. 'default' => '1',
  474. 'desc' => '获取方式',
  475. 'match' => 'is_numeric',
  476. 'update' => 'radio',
  477. 'option' => $get_type,
  478. ),
  479. 'agent_cash' => array
  480. (
  481. 'type' => 'float-11,2',
  482. 'name' => '代理费',
  483. 'default' => '0',
  484. 'desc' => '代理费',
  485. 'match' => 'option',
  486. 'update' => 'text',
  487. ),
  488. 'soft_cash' => array
  489. (
  490. 'type' => 'float-11,2',
  491. 'name' => '软件服务费',
  492. 'default' => '0',
  493. 'desc' => '软件服务费',
  494. 'match' => 'option',
  495. 'update' => 'text',
  496. ),
  497. 'goods_cash' => array
  498. (
  499. 'type' => 'float-11,2',
  500. 'name' => '商品价值-名额不算,商品价值第一次分配后保持不变',
  501. 'default' => '0',
  502. 'desc' => '商品价值',
  503. 'match' => 'option',
  504. 'update' => 'text',
  505. ),
  506. 'state' => array
  507. (
  508. 'type' => 'tinyint-1',
  509. 'name' => '状态',
  510. 'default' => '1',
  511. 'desc' => '请选择状态',
  512. 'match' => 'is_numeric',
  513. ),
  514. 'fdate' => array
  515. (
  516. 'type' => 'int-11',
  517. 'name' => '完成时间',
  518. 'default' => '',
  519. 'match' => 'is_numeric',
  520. 'desc' => '',
  521. ),
  522. 'cdate' => array
  523. (
  524. 'type' => 'int-11',
  525. 'name' => '申请时间',
  526. 'match' => array('is_numeric', time()),
  527. 'desc' => '',
  528. # 只有insert时才生效
  529. //'insert' => true,
  530. 'search' => 'date',
  531. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  532. 'list_order' => 2,
  533. ),
  534. ),
  535. 'alter' => array
  536. (
  537. 5 => array
  538. (
  539. array('update', 'price', 'price', 'float-11,2 0 实付金额'),
  540. array('update', 'f_price', 'f_price', 'float-11,2 0 原价'),
  541. array('update', 'agent_cash', 'agent_cash', 'float-11,2 0 代理费'),
  542. array('update', 'soft_cash', 'soft_cash', 'float-11,2 0 软件服务费'),
  543. array('update', 'goods_cash', 'goods_cash', 'float-11,2 0 商品价值'),
  544. ),
  545. 'version' => 5,
  546. ),
  547. 'manage' => array
  548. (
  549. 'insert' => false,
  550. 'delete' => false,
  551. 'edit' => false,
  552. 'button' => $button,
  553. 'list_button' => array
  554. (
  555. //fast_list
  556. 'list' => array('查看详情', '"order_process&project=agent&order_id={id}&page_type=1"'),
  557. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  558. //'delete' => array('删除', '', '{status} == 1'),
  559. ),
  560. ),
  561. 'request' => array
  562. (
  563. 'getOld' => array
  564. (
  565. # 匹配的正则或函数 选填项
  566. 'option' => array
  567. (
  568. 'mid' => 'yes',
  569. 'status' => array('yes', 'in'),
  570. 'state' => 1,
  571. ),
  572. 'order' => array('id' => 'asc'),
  573. 'type' => 'one',
  574. 'col' => '*',
  575. ),
  576. 'getData' => array
  577. (
  578. # 匹配的正则或函数 选填项
  579. 'option' => array
  580. (
  581. 'mid' => 'yes',
  582. 'status' => array('yes', 'in'),
  583. 'state' => 1,
  584. ),
  585. 'order' => array('id' => 'desc'),
  586. 'page' => array(10, 'list'),
  587. 'type' => 'all',
  588. 'col' => '*',
  589. ),
  590. # 获取订单数量
  591. 'getNum' => array
  592. (
  593. # 匹配的正则或函数 选填项
  594. 'option' => array
  595. (
  596. 'start' => array('yes-cdate', '>='),
  597. 'end' => array('yes-cdate', '<='),
  598. 'status' => array('yes', 'in'),
  599. 'state' => 1,
  600. ),
  601. 'type' => 'count',
  602. 'col' => '*',
  603. ),
  604. # 获取订单数量
  605. 'getCash' => array
  606. (
  607. # 匹配的正则或函数 选填项
  608. 'option' => array
  609. (
  610. 'start' => array('yes-cdate', '>='),
  611. 'end' => array('yes-cdate', '<='),
  612. 'status' => array('yes', 'in'),
  613. 'state' => 1,
  614. ),
  615. 'type' => 'one',
  616. 'col' => 'sum(price) as total',
  617. ),
  618. 'getDailiCash' => array
  619. (
  620. # 匹配的正则或函数 选填项
  621. 'option' => array
  622. (
  623. 'start' => array('yes-cdate', '>='),
  624. 'end' => array('yes-cdate', '<='),
  625. 'status' => array('yes', 'in'),
  626. 'state' => 1,
  627. ),
  628. 'type' => 'one',
  629. 'col' => 'sum(agent_cash) as total',
  630. ),
  631. 'getSoftCash' => array
  632. (
  633. # 匹配的正则或函数 选填项
  634. 'option' => array
  635. (
  636. 'start' => array('yes-cdate', '>='),
  637. 'end' => array('yes-cdate', '<='),
  638. 'status' => array('yes', 'in'),
  639. 'state' => 1,
  640. ),
  641. 'type' => 'one',
  642. 'col' => 'sum(soft_cash) as total',
  643. ),
  644. 'getGoodsCash' => array
  645. (
  646. # 匹配的正则或函数 选填项
  647. 'option' => array
  648. (
  649. 'start' => array('yes-cdate', '>='),
  650. 'end' => array('yes-cdate', '<='),
  651. 'status' => array('yes', 'in'),
  652. 'state' => 1,
  653. ),
  654. 'type' => 'one',
  655. 'col' => 'sum(goods_cash) as total',
  656. ),
  657. ),
  658. );