order.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784
  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. $invite_type = array
  106. (
  107. 1 => '邀请人',
  108. 2 => '来源',
  109. );
  110. # id小于50000为导入的数据
  111. return array
  112. (
  113. # 表名
  114. 'name' => 'order',
  115. # 显示给用户看的名称
  116. 'lang' => '代理商订单',
  117. 'auto' => 50000,
  118. 'set' => array
  119. (
  120. 'status' => $status,
  121. 'pay_status' => $pay_status,
  122. 'goods_status' => $goods_status,
  123. 'type' => $type,
  124. 'pay_type' => $pay_type,
  125. 'order_type' => $order_type,
  126. ),
  127. 'order' => 99,
  128. # 数据结构
  129. 'struct' => array
  130. (
  131. 'id' => array
  132. (
  133. 'type' => 'int-11',
  134. 'name' => 'ID',
  135. 'default' => '',
  136. 'desc' => '',
  137. 'match' => 'is_numeric',
  138. 'search' => 'order',
  139. //'list' => true,
  140. ),
  141. 'mid' => array
  142. (
  143. 'type' => 'int-11',
  144. 'name' => '代理商',
  145. 'default' => '-1',
  146. 'desc' => '代理商',
  147. 'match' => 'is_string',
  148. 'update' => 'text',
  149. 'searchs' => array
  150. (
  151. 'api' => 'agent/member-find',
  152. 'col' => 'mobile',
  153. 'result' => 'id',
  154. ),
  155. //'list' => 'Dever::load("agent/member-find#name", {mid})',
  156. ),
  157. 'order_num' => array
  158. (
  159. 'type' => 'varchar-100',
  160. 'name' => '订单号',
  161. 'default' => '',
  162. 'desc' => '订单号',
  163. 'match' => 'is_string',
  164. 'update' => 'text',
  165. 'search' => 'fulltext',
  166. 'list' => true,
  167. 'list_order' => 1,
  168. ),
  169. 'order_type' => array
  170. (
  171. 'type' => 'tinyint-1',
  172. 'name' => '订单类型',
  173. 'default' => '1',
  174. 'desc' => '订单类型',
  175. 'match' => 'is_numeric',
  176. 'option' => $order_type,
  177. ),
  178. 'mobile' => array
  179. (
  180. 'type' => 'bigint-11',
  181. 'name' => '手机号',
  182. 'default' => '',
  183. 'desc' => '请输入手机号',
  184. 'match' => Dever::rule('mobile'),
  185. 'update' => 'text',
  186. 'search' => 'fulltext',
  187. //'list' => true,
  188. ),
  189. 'parent_mid' => array
  190. (
  191. 'type' => 'int-11',
  192. 'name' => '邀请人手机号',
  193. 'default' => '-1',
  194. 'desc' => '邀请人',
  195. 'match' => 'is_string',
  196. 'update' => 'text',
  197. 'search' => $parent_mid ? 'hidden' : array
  198. (
  199. 'api' => 'agent/member-find',
  200. 'col' => 'mobile',
  201. 'result' => 'id',
  202. ),
  203. 'list_name' => '邀请人',
  204. 'list' => 'Dever::load("agent/lib/member.getOne", {parent_mid})',
  205. 'list_order' => 4,
  206. ),
  207. 'source_id' => array
  208. (
  209. 'type' => 'int-11',
  210. 'name' => '注册来源',
  211. 'default' => '-1',
  212. 'desc' => '注册来源',
  213. 'match' => 'is_numeric',
  214. 'search' => 'select',
  215. 'update' => 'checkbox',
  216. 'option' => $source_id,
  217. 'list' => true,
  218. 'list_order' => 5,
  219. ),
  220. 'name' => array
  221. (
  222. 'type' => 'varchar-100',
  223. 'name' => '姓名',
  224. 'default' => '',
  225. 'desc' => '姓名',
  226. 'match' => 'is_string',
  227. 'update' => 'text',
  228. 'search' => 'fulltext',
  229. 'list' => 'Dever::load("agent/lib/member.getOne", {id}, "agent/order")',
  230. 'list_order' => 3,
  231. ),
  232. 'role' => array
  233. (
  234. 'type' => 'int-11',
  235. 'name' => '代理角色',
  236. 'default' => '',
  237. 'desc' => '代理角色',
  238. 'match' => 'is_numeric',
  239. 'search' => 'select',
  240. 'update' => 'checkbox',
  241. 'option' => $role,
  242. //'list' => true,
  243. ),
  244. 'area' => array
  245. (
  246. 'type' => 'varchar-500',
  247. 'name' => '区域',
  248. 'default' => '',
  249. 'desc' => '区域',
  250. 'match' => 'option',
  251. 'search' => 'linkage',
  252. 'update' => 'linkage',
  253. 'option' => Dever::url('api.get?level_total=4', 'area'),
  254. 'list' => 'Dever::load("area/api.string", "{area}")',
  255. ),
  256. 'desc' => array
  257. (
  258. 'type' => 'varchar-600',
  259. 'name' => '付款备注',
  260. 'default' => '',
  261. 'desc' => '付款备注',
  262. 'match' => 'is_string',
  263. 'update' => 'text',
  264. ),
  265. 'f_price' => array
  266. (
  267. 'type' => 'float-11,2',
  268. 'name' => '原价',
  269. 'default' => '0',
  270. 'desc' => '原价',
  271. 'match' => 'option',
  272. 'update' => 'text',
  273. ),
  274. 'price' => array
  275. (
  276. 'type' => 'float-11,2',
  277. 'name' => '实付金额',
  278. 'default' => '0',
  279. 'desc' => '金额',
  280. 'match' => 'option',
  281. 'update' => 'text',
  282. // 'list' => true,
  283. 'list' =>'Dever::load("agent/lib/order.set_price", {id})',
  284. 'list_order' => 6,
  285. ),
  286. 'pay_type' => array
  287. (
  288. 'type' => 'tinyint-1',
  289. 'name' => '支付方式',
  290. 'default' => '1',
  291. 'desc' => '支付方式',
  292. 'match' => 'is_numeric',
  293. 'search' => 'select',
  294. 'update' => 'select',
  295. 'option' => $pay_type,
  296. 'list' => true,
  297. 'list_order' => 7,
  298. ),
  299. 'pay_pic' => array
  300. (
  301. 'type' => 'varchar-150',
  302. 'name' => '打款凭证',
  303. 'default' => '',
  304. 'desc' => '打款凭证',
  305. 'match' => 'option',
  306. 'update' => 'image',
  307. 'key' => '1',
  308. 'place' => '150',
  309. ),
  310. 'pay_price' => array
  311. (
  312. 'type' => 'float-11,2',
  313. 'name' => '交款金额',
  314. 'default' => '0',
  315. 'desc' => '交款金额',
  316. 'match' => 'option',
  317. 'update' => 'text',
  318. ),
  319. 'bank_id' => array
  320. (
  321. 'type' => 'int-11',
  322. 'name' => '所属银行',
  323. 'default' => '',
  324. 'desc' => '所属银行',
  325. 'match' => 'is_numeric',
  326. ),
  327. 'bank_card' => array
  328. (
  329. 'type' => 'int-11',
  330. 'name' => '银行卡号',
  331. 'default' => '',
  332. 'desc' => '银行卡号',
  333. 'match' => 'is_numeric',
  334. ),
  335. 'type' => array
  336. (
  337. 'type' => 'tinyint-1',
  338. 'name' => '类型',
  339. 'default' => '1',
  340. 'desc' => '类型',
  341. 'match' => 'is_numeric',
  342. 'option' => $type,
  343. ),
  344. 'sign' => array
  345. (
  346. 'type' => 'varchar-150',
  347. 'name' => '手写签名',
  348. 'default' => '',
  349. 'desc' => '手写签名',
  350. 'match' => 'option',
  351. 'update' => 'image',
  352. 'key' => '7',
  353. ),
  354. 'idcard' => array
  355. (
  356. 'type' => 'varchar-100',
  357. 'name' => '身份证号码',
  358. 'default' => '',
  359. 'desc' => '身份证号码',
  360. 'match' => 'is_string',
  361. 'match' => Dever::rule('idcard'),
  362. 'update' => 'text',
  363. 'search' => 'fulltext',
  364. ),
  365. 'idcard_front' => array
  366. (
  367. 'type' => 'varchar-150',
  368. 'name' => '身份证正面',
  369. 'default' => '',
  370. 'desc' => '身份证正面',
  371. 'match' => 'option',
  372. 'update' => 'image',
  373. 'key' => '8',
  374. 'place' => '660*660',
  375. ),
  376. 'idcard_back' => array
  377. (
  378. 'type' => 'varchar-150',
  379. 'name' => '身份证背面',
  380. 'default' => '',
  381. 'desc' => '身份证背面',
  382. 'match' => 'option',
  383. 'update' => 'image',
  384. 'key' => '8',
  385. 'place' => '660*660',
  386. ),
  387. 'company_name' => array
  388. (
  389. 'type' => 'varchar-100',
  390. 'name' => '公司名称',
  391. 'default' => '',
  392. 'desc' => '公司名称',
  393. 'match' => 'is_string',
  394. 'update' => 'text',
  395. //'search' => 'fulltext',
  396. //'list' => true,
  397. ),
  398. 'company_pic' => array
  399. (
  400. 'type' => 'varchar-150',
  401. 'name' => '营业执照',
  402. 'default' => '',
  403. 'desc' => '营业执照',
  404. 'match' => 'option',
  405. 'update' => 'image',
  406. 'key' => '8',
  407. 'place' => '660*660',
  408. ),
  409. 'company_number' => array
  410. (
  411. 'type' => 'varchar-80',
  412. 'name' => '营业执照号码',
  413. 'default' => '',
  414. 'desc' => '营业执照号码',
  415. 'match' => 'is_string',
  416. 'update' => 'text',
  417. ),
  418. 'address' => array
  419. (
  420. 'type' => 'varchar-800',
  421. 'name' => '地址',
  422. 'default' => '',
  423. 'desc' => '地址',
  424. 'match' => 'is_string',
  425. 'update' => 'text',
  426. ),
  427. 'audit_desc' => array
  428. (
  429. 'type' => 'varchar-400',
  430. 'name' => '审核备注-从order_process中同步过来',
  431. 'default' => '',
  432. 'desc' => '审核备注',
  433. 'match' => 'is_string',
  434. //'update' => 'textarea',
  435. ),
  436. 'admin_desc' => array
  437. (
  438. 'type' => 'varchar-800',
  439. 'name' => '管理员备注',
  440. 'default' => '',
  441. 'desc' => '管理员备注',
  442. 'match' => 'is_string',
  443. 'update' => 'textarea',
  444. ),
  445. 'status' => array
  446. (
  447. 'type' => 'tinyint-1',
  448. 'name' => '订单状态',
  449. 'default' => '1',
  450. 'desc' => '状态',
  451. 'match' => 'is_numeric',
  452. 'option' => $status,
  453. 'search' => 'select',
  454. 'list' => true,
  455. 'list_order' => 8,
  456. ),
  457. 'history_status' => array
  458. (
  459. 'type' => 'tinyint-1',
  460. 'name' => '记录挂起之前的状态',
  461. 'default' => '1',
  462. 'desc' => '状态',
  463. 'match' => 'is_numeric',
  464. 'option' => $status,
  465. ),
  466. 'goods_status' => array
  467. (
  468. 'type' => 'tinyint-1',
  469. 'name' => '权益状态',
  470. 'default' => '1',
  471. 'desc' => '权益状态',
  472. 'match' => 'is_numeric',
  473. 'option' => $goods_status,
  474. 'search' => 'select',
  475. 'list' => true,
  476. 'list_order' => 9,
  477. ),
  478. 'pay_status' => array
  479. (
  480. 'type' => 'tinyint-1',
  481. 'name' => '支付状态',
  482. 'default' => '1',
  483. 'desc' => '状态',
  484. 'match' => 'is_numeric',
  485. 'option' => $pay_status,
  486. ),
  487. 'get_type' => array
  488. (
  489. 'type' => 'tinyint-1',
  490. 'name' => '获取方式',
  491. 'default' => '1',
  492. 'desc' => '获取方式',
  493. 'match' => 'is_numeric',
  494. 'update' => 'radio',
  495. 'option' => $get_type,
  496. ),
  497. 'agent_cash' => array
  498. (
  499. 'type' => 'float-11,2',
  500. 'name' => '代理费',
  501. 'default' => '0',
  502. 'desc' => '代理费',
  503. 'match' => 'option',
  504. 'update' => 'text',
  505. ),
  506. 'soft_cash' => array
  507. (
  508. 'type' => 'float-11,2',
  509. 'name' => '软件服务费',
  510. 'default' => '0',
  511. 'desc' => '软件服务费',
  512. 'match' => 'option',
  513. 'update' => 'text',
  514. ),
  515. 'goods_cash' => array
  516. (
  517. 'type' => 'float-11,2',
  518. 'name' => '商品价值-名额不算,商品价值第一次分配后保持不变',
  519. 'default' => '0',
  520. 'desc' => '商品价值',
  521. 'match' => 'option',
  522. 'update' => 'text',
  523. ),
  524. 'state' => array
  525. (
  526. 'type' => 'tinyint-1',
  527. 'name' => '状态',
  528. 'default' => '1',
  529. 'desc' => '请选择状态',
  530. 'match' => 'is_numeric',
  531. ),
  532. 'fdate' => array
  533. (
  534. 'type' => 'int-11',
  535. 'name' => '完成时间',
  536. 'default' => '',
  537. 'match' => 'is_numeric',
  538. 'desc' => '',
  539. ),
  540. 'cdate' => array
  541. (
  542. 'type' => 'int-11',
  543. 'name' => '处理时间',
  544. 'match' => array('is_numeric', time()),
  545. 'desc' => '',
  546. # 只有insert时才生效
  547. 'insert' => true,
  548. 'search' => 'date',
  549. // 'list' => 'date("Y-m-d H:i:s", {cdate})',
  550. 'list' => 'Dever::load("agent/lib/order.set_cdate", {id})',
  551. 'list_order' => 2,
  552. ),
  553. ),
  554. 'alter' => array
  555. (
  556. 5 => array
  557. (
  558. array('update', 'price', 'price', 'float-11,2 0 实付金额'),
  559. array('update', 'f_price', 'f_price', 'float-11,2 0 原价'),
  560. array('update', 'agent_cash', 'agent_cash', 'float-11,2 0 代理费'),
  561. array('update', 'soft_cash', 'soft_cash', 'float-11,2 0 软件服务费'),
  562. array('update', 'goods_cash', 'goods_cash', 'float-11,2 0 商品价值'),
  563. ),
  564. 'version' => 5,
  565. ),
  566. 'manage' => array
  567. (
  568. 'insert' => false,
  569. 'delete' => false,
  570. 'edit' => false,
  571. 'button' => $button,
  572. 'list_button' => array
  573. (
  574. //fast_list
  575. 'list' => array('查看详情', '"order_process&project=agent&order_id={id}&page_type=1"'),
  576. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  577. //'delete' => array('删除', '', '{status} == 1'),
  578. ),
  579. ),
  580. 'request' => array
  581. (
  582. 'getNew' => array
  583. (
  584. # 匹配的正则或函数 选填项
  585. 'option' => array
  586. (
  587. 'mid' => 'yes',
  588. 'status' => array('yes', 'in'),
  589. 'state' => 1,
  590. ),
  591. 'order' => array('id' => 'desc'),
  592. 'type' => 'one',
  593. 'col' => '*',
  594. ),
  595. 'getTotal' => array
  596. (
  597. # 匹配的正则或函数 选填项
  598. 'option' => array
  599. (
  600. 'mid' => 'yes',
  601. 'status' => array('yes', 'in'),
  602. 'state' => 1,
  603. ),
  604. 'order' => array('id' => 'desc'),
  605. 'type' => 'count',
  606. 'col' => '*',
  607. ),
  608. 'getData' => array
  609. (
  610. # 匹配的正则或函数 选填项
  611. 'option' => array
  612. (
  613. 'mid' => 'yes',
  614. 'status' => array('yes', 'in'),
  615. 'state' => 1,
  616. ),
  617. 'order' => array('id' => 'desc'),
  618. 'page' => array(10, 'list'),
  619. 'type' => 'all',
  620. 'col' => '*',
  621. ),
  622. # 获取订单数量
  623. 'getNum' => array
  624. (
  625. # 匹配的正则或函数 选填项
  626. 'option' => array
  627. (
  628. 'start' => array('yes-cdate', '>='),
  629. 'end' => array('yes-cdate', '<='),
  630. 'status' => array('yes', 'in'),
  631. 'state' => 1,
  632. ),
  633. 'type' => 'count',
  634. 'col' => '*',
  635. ),
  636. # 获取订单数量
  637. 'getCash' => array
  638. (
  639. # 匹配的正则或函数 选填项
  640. 'option' => array
  641. (
  642. 'start' => array('yes-cdate', '>='),
  643. 'end' => array('yes-cdate', '<='),
  644. 'status' => array('yes', 'in'),
  645. 'state' => 1,
  646. ),
  647. 'type' => 'one',
  648. 'col' => 'sum(price) as total',
  649. ),
  650. 'getDailiCash' => array
  651. (
  652. # 匹配的正则或函数 选填项
  653. 'option' => array
  654. (
  655. 'start' => array('yes-cdate', '>='),
  656. 'end' => array('yes-cdate', '<='),
  657. 'status' => array('yes', 'in'),
  658. 'state' => 1,
  659. ),
  660. 'type' => 'one',
  661. 'col' => 'sum(agent_cash) as total',
  662. ),
  663. 'getSoftCash' => array
  664. (
  665. # 匹配的正则或函数 选填项
  666. 'option' => array
  667. (
  668. 'start' => array('yes-cdate', '>='),
  669. 'end' => array('yes-cdate', '<='),
  670. 'status' => array('yes', 'in'),
  671. 'state' => 1,
  672. ),
  673. 'type' => 'one',
  674. 'col' => 'sum(soft_cash) as total',
  675. ),
  676. 'getGoodsCash' => array
  677. (
  678. # 匹配的正则或函数 选填项
  679. 'option' => array
  680. (
  681. 'start' => array('yes-cdate', '>='),
  682. 'end' => array('yes-cdate', '<='),
  683. 'status' => array('yes', 'in'),
  684. 'state' => 1,
  685. ),
  686. 'type' => 'one',
  687. 'col' => 'sum(goods_cash) as total',
  688. ),
  689. 'getFindOne' => array
  690. (
  691. # 匹配的正则或函数 选填项
  692. 'option' => array
  693. (
  694. 'id' => array('yes','!='),
  695. 'mid' => 'yes',
  696. 'order_type' => 'yes',
  697. 'state' => 1,
  698. ),
  699. 'type' => 'one',
  700. 'order' => array('cdate' => 'desc'),
  701. 'col' => '*',
  702. ),
  703. 'getPrice' => array
  704. (
  705. # 匹配的正则或函数 选填项
  706. 'option' => array
  707. (
  708. 'mid' => 'yes',
  709. 'status' => 4,
  710. 'state' => 1,
  711. ),
  712. 'type' => 'one',
  713. 'col' => 'sum(price) as total',
  714. ),
  715. ),
  716. );