order.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  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. -2 => '待签名',
  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' =>'Dever::load("agent/lib/order.set_price", {id})',
  277. 'list_order' => 6,
  278. ),
  279. 'pay_type' => array
  280. (
  281. 'type' => 'tinyint-1',
  282. 'name' => '支付方式',
  283. 'default' => '1',
  284. 'desc' => '支付方式',
  285. 'match' => 'is_numeric',
  286. 'search' => 'select',
  287. 'update' => 'select',
  288. 'option' => $pay_type,
  289. 'list' => true,
  290. 'list_order' => 7,
  291. ),
  292. 'pay_pic' => array
  293. (
  294. 'type' => 'varchar-150',
  295. 'name' => '打款凭证',
  296. 'default' => '',
  297. 'desc' => '打款凭证',
  298. 'match' => 'option',
  299. 'update' => 'image',
  300. 'key' => '1',
  301. 'place' => '150',
  302. ),
  303. 'pay_price' => array
  304. (
  305. 'type' => 'float-11,2',
  306. 'name' => '交款金额',
  307. 'default' => '0',
  308. 'desc' => '交款金额',
  309. 'match' => 'option',
  310. 'update' => 'text',
  311. ),
  312. 'bank_id' => array
  313. (
  314. 'type' => 'int-11',
  315. 'name' => '所属银行',
  316. 'default' => '',
  317. 'desc' => '所属银行',
  318. 'match' => 'is_numeric',
  319. ),
  320. 'bank_card' => array
  321. (
  322. 'type' => 'int-11',
  323. 'name' => '银行卡号',
  324. 'default' => '',
  325. 'desc' => '银行卡号',
  326. 'match' => 'is_numeric',
  327. ),
  328. 'type' => array
  329. (
  330. 'type' => 'tinyint-1',
  331. 'name' => '类型',
  332. 'default' => '1',
  333. 'desc' => '类型',
  334. 'match' => 'is_numeric',
  335. 'option' => $type,
  336. ),
  337. 'sign' => array
  338. (
  339. 'type' => 'varchar-150',
  340. 'name' => '手写签名',
  341. 'default' => '',
  342. 'desc' => '手写签名',
  343. 'match' => 'option',
  344. 'update' => 'image',
  345. 'key' => '7',
  346. ),
  347. 'idcard' => array
  348. (
  349. 'type' => 'varchar-100',
  350. 'name' => '身份证号码',
  351. 'default' => '',
  352. 'desc' => '身份证号码',
  353. 'match' => 'is_string',
  354. 'match' => Dever::rule('idcard'),
  355. 'update' => 'text',
  356. 'search' => 'fulltext',
  357. ),
  358. 'idcard_front' => array
  359. (
  360. 'type' => 'varchar-150',
  361. 'name' => '身份证正面',
  362. 'default' => '',
  363. 'desc' => '身份证正面',
  364. 'match' => 'option',
  365. 'update' => 'image',
  366. 'key' => '8',
  367. 'place' => '660*660',
  368. ),
  369. 'idcard_back' => array
  370. (
  371. 'type' => 'varchar-150',
  372. 'name' => '身份证背面',
  373. 'default' => '',
  374. 'desc' => '身份证背面',
  375. 'match' => 'option',
  376. 'update' => 'image',
  377. 'key' => '8',
  378. 'place' => '660*660',
  379. ),
  380. 'company_name' => array
  381. (
  382. 'type' => 'varchar-100',
  383. 'name' => '公司名称',
  384. 'default' => '',
  385. 'desc' => '公司名称',
  386. 'match' => 'is_string',
  387. 'update' => 'text',
  388. //'search' => 'fulltext',
  389. //'list' => true,
  390. ),
  391. 'company_pic' => array
  392. (
  393. 'type' => 'varchar-150',
  394. 'name' => '营业执照',
  395. 'default' => '',
  396. 'desc' => '营业执照',
  397. 'match' => 'option',
  398. 'update' => 'image',
  399. 'key' => '8',
  400. 'place' => '660*660',
  401. ),
  402. 'company_number' => array
  403. (
  404. 'type' => 'varchar-80',
  405. 'name' => '营业执照号码',
  406. 'default' => '',
  407. 'desc' => '营业执照号码',
  408. 'match' => 'is_string',
  409. 'update' => 'text',
  410. ),
  411. 'address' => array
  412. (
  413. 'type' => 'varchar-800',
  414. 'name' => '地址',
  415. 'default' => '',
  416. 'desc' => '地址',
  417. 'match' => 'is_string',
  418. 'update' => 'text',
  419. ),
  420. 'audit_desc' => array
  421. (
  422. 'type' => 'varchar-400',
  423. 'name' => '审核备注-从order_process中同步过来',
  424. 'default' => '',
  425. 'desc' => '审核备注',
  426. 'match' => 'is_string',
  427. //'update' => 'textarea',
  428. ),
  429. 'admin_desc' => array
  430. (
  431. 'type' => 'varchar-800',
  432. 'name' => '管理员备注',
  433. 'default' => '',
  434. 'desc' => '管理员备注',
  435. 'match' => 'is_string',
  436. 'update' => 'textarea',
  437. ),
  438. 'status' => array
  439. (
  440. 'type' => 'tinyint-1',
  441. 'name' => '订单状态',
  442. 'default' => '1',
  443. 'desc' => '状态',
  444. 'match' => 'is_numeric',
  445. 'option' => $status,
  446. 'search' => 'select',
  447. 'list' => true,
  448. 'list_order' => 8,
  449. ),
  450. 'history_status' => array
  451. (
  452. 'type' => 'tinyint-1',
  453. 'name' => '记录挂起之前的状态',
  454. 'default' => '1',
  455. 'desc' => '状态',
  456. 'match' => 'is_numeric',
  457. 'option' => $status,
  458. ),
  459. 'goods_status' => array
  460. (
  461. 'type' => 'tinyint-1',
  462. 'name' => '权益状态',
  463. 'default' => '1',
  464. 'desc' => '权益状态',
  465. 'match' => 'is_numeric',
  466. 'option' => $goods_status,
  467. 'search' => 'select',
  468. 'list' => true,
  469. 'list_order' => 9,
  470. ),
  471. 'pay_status' => array
  472. (
  473. 'type' => 'tinyint-1',
  474. 'name' => '支付状态',
  475. 'default' => '1',
  476. 'desc' => '状态',
  477. 'match' => 'is_numeric',
  478. 'option' => $pay_status,
  479. ),
  480. 'get_type' => array
  481. (
  482. 'type' => 'tinyint-1',
  483. 'name' => '获取方式',
  484. 'default' => '1',
  485. 'desc' => '获取方式',
  486. 'match' => 'is_numeric',
  487. 'update' => 'radio',
  488. 'option' => $get_type,
  489. ),
  490. 'agent_cash' => array
  491. (
  492. 'type' => 'float-11,2',
  493. 'name' => '代理费',
  494. 'default' => '0',
  495. 'desc' => '代理费',
  496. 'match' => 'option',
  497. 'update' => 'text',
  498. ),
  499. 'soft_cash' => array
  500. (
  501. 'type' => 'float-11,2',
  502. 'name' => '软件服务费',
  503. 'default' => '0',
  504. 'desc' => '软件服务费',
  505. 'match' => 'option',
  506. 'update' => 'text',
  507. ),
  508. 'goods_cash' => array
  509. (
  510. 'type' => 'float-11,2',
  511. 'name' => '商品价值-名额不算,商品价值第一次分配后保持不变',
  512. 'default' => '0',
  513. 'desc' => '商品价值',
  514. 'match' => 'option',
  515. 'update' => 'text',
  516. ),
  517. 'state' => array
  518. (
  519. 'type' => 'tinyint-1',
  520. 'name' => '状态',
  521. 'default' => '1',
  522. 'desc' => '请选择状态',
  523. 'match' => 'is_numeric',
  524. ),
  525. 'fdate' => array
  526. (
  527. 'type' => 'int-11',
  528. 'name' => '完成时间',
  529. 'default' => '',
  530. 'match' => 'is_numeric',
  531. 'desc' => '',
  532. ),
  533. 'cdate' => array
  534. (
  535. 'type' => 'int-11',
  536. 'name' => '处理时间',
  537. 'match' => array('is_numeric', time()),
  538. 'desc' => '',
  539. # 只有insert时才生效
  540. 'insert' => true,
  541. 'search' => 'date',
  542. // 'list' => 'date("Y-m-d H:i:s", {cdate})',
  543. 'list' => 'Dever::load("agent/lib/order.set_cdate", {id})',
  544. 'list_order' => 2,
  545. ),
  546. ),
  547. 'alter' => array
  548. (
  549. 5 => array
  550. (
  551. array('update', 'price', 'price', 'float-11,2 0 实付金额'),
  552. array('update', 'f_price', 'f_price', 'float-11,2 0 原价'),
  553. array('update', 'agent_cash', 'agent_cash', 'float-11,2 0 代理费'),
  554. array('update', 'soft_cash', 'soft_cash', 'float-11,2 0 软件服务费'),
  555. array('update', 'goods_cash', 'goods_cash', 'float-11,2 0 商品价值'),
  556. ),
  557. 'version' => 5,
  558. ),
  559. 'manage' => array
  560. (
  561. 'insert' => false,
  562. 'delete' => false,
  563. 'edit' => false,
  564. 'button' => $button,
  565. 'list_button' => array
  566. (
  567. //fast_list
  568. 'list' => array('查看详情', '"order_process&project=agent&order_id={id}&page_type=1"'),
  569. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  570. //'delete' => array('删除', '', '{status} == 1'),
  571. ),
  572. ),
  573. 'request' => array
  574. (
  575. 'getNew' => array
  576. (
  577. # 匹配的正则或函数 选填项
  578. 'option' => array
  579. (
  580. 'mid' => 'yes',
  581. 'status' => array('yes', 'in'),
  582. 'state' => 1,
  583. ),
  584. 'order' => array('id' => 'desc'),
  585. 'type' => 'one',
  586. 'col' => '*',
  587. ),
  588. 'getTotal' => array
  589. (
  590. # 匹配的正则或函数 选填项
  591. 'option' => array
  592. (
  593. 'mid' => 'yes',
  594. 'status' => array('yes', 'in'),
  595. 'state' => 1,
  596. ),
  597. 'order' => array('id' => 'desc'),
  598. 'type' => 'count',
  599. 'col' => '*',
  600. ),
  601. 'getData' => array
  602. (
  603. # 匹配的正则或函数 选填项
  604. 'option' => array
  605. (
  606. 'mid' => 'yes',
  607. 'status' => array('yes', 'in'),
  608. 'state' => 1,
  609. ),
  610. 'order' => array('id' => 'desc'),
  611. 'page' => array(10, 'list'),
  612. 'type' => 'all',
  613. 'col' => '*',
  614. ),
  615. # 获取订单数量
  616. 'getNum' => array
  617. (
  618. # 匹配的正则或函数 选填项
  619. 'option' => array
  620. (
  621. 'start' => array('yes-cdate', '>='),
  622. 'end' => array('yes-cdate', '<='),
  623. 'status' => array('yes', 'in'),
  624. 'state' => 1,
  625. ),
  626. 'type' => 'count',
  627. 'col' => '*',
  628. ),
  629. # 获取订单数量
  630. 'getCash' => array
  631. (
  632. # 匹配的正则或函数 选填项
  633. 'option' => array
  634. (
  635. 'start' => array('yes-cdate', '>='),
  636. 'end' => array('yes-cdate', '<='),
  637. 'status' => array('yes', 'in'),
  638. 'state' => 1,
  639. ),
  640. 'type' => 'one',
  641. 'col' => 'sum(price) as total',
  642. ),
  643. 'getDailiCash' => array
  644. (
  645. # 匹配的正则或函数 选填项
  646. 'option' => array
  647. (
  648. 'start' => array('yes-cdate', '>='),
  649. 'end' => array('yes-cdate', '<='),
  650. 'status' => array('yes', 'in'),
  651. 'state' => 1,
  652. ),
  653. 'type' => 'one',
  654. 'col' => 'sum(agent_cash) as total',
  655. ),
  656. 'getSoftCash' => array
  657. (
  658. # 匹配的正则或函数 选填项
  659. 'option' => array
  660. (
  661. 'start' => array('yes-cdate', '>='),
  662. 'end' => array('yes-cdate', '<='),
  663. 'status' => array('yes', 'in'),
  664. 'state' => 1,
  665. ),
  666. 'type' => 'one',
  667. 'col' => 'sum(soft_cash) as total',
  668. ),
  669. 'getGoodsCash' => array
  670. (
  671. # 匹配的正则或函数 选填项
  672. 'option' => array
  673. (
  674. 'start' => array('yes-cdate', '>='),
  675. 'end' => array('yes-cdate', '<='),
  676. 'status' => array('yes', 'in'),
  677. 'state' => 1,
  678. ),
  679. 'type' => 'one',
  680. 'col' => 'sum(goods_cash) as total',
  681. ),
  682. ),
  683. );