order.php 21 KB

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