sell_order.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. <?php
  2. $pay_status = Dever::config('base', 'pay')->pay['status'];
  3. $method = array
  4. (
  5. 1 => '自提',
  6. 2 => '外送',
  7. );
  8. $pay_method = array
  9. (
  10. 1 => '平台结算',
  11. 2 => '门店代下单',
  12. 3 => '礼品卡',
  13. );
  14. $code_status = array
  15. (
  16. 1 => '已下单',
  17. 2 => '待自提',
  18. 3 => '已自提',
  19. );
  20. $ps_status = array
  21. (
  22. 1 => '已下单',
  23. 2 => '待配送',
  24. 3 => '配送中',
  25. 4 => '已收货',
  26. );
  27. $status = array
  28. (
  29. 1 => '待支付',
  30. 2 => '待处理',
  31. 3 => '配送中',
  32. 4 => '已完成',
  33. 5 => '已取消',
  34. 6 => '申请全部退款',
  35. 7 => '申请部分退款',
  36. 8 => '退货退款',
  37. 9 => '部分退款',
  38. 10 => '仅退款',
  39. 11 => '已过期',
  40. );
  41. $tk_status = array
  42. (
  43. 1 => '待审核',
  44. 2 => '审核通过',
  45. 3 => '审核未通过',
  46. );
  47. return array
  48. (
  49. # 表名
  50. 'name' => 'sell_order',
  51. # 显示给用户看的名称
  52. 'lang' => '销售订单',
  53. 'order' => 100,
  54. 'status' => $status,
  55. 'ps_status' => $ps_status,
  56. 'code_status' => $code_status,
  57. 'pay_method' => $pay_method,
  58. 'method' => $method,
  59. # 数据结构
  60. 'struct' => array
  61. (
  62. 'id' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => 'ID',
  66. 'default' => '',
  67. 'desc' => '',
  68. 'match' => 'is_numeric',
  69. 'search' => 'order',
  70. //'list' => true,
  71. ),
  72. 'shop_id' => array
  73. (
  74. 'type' => 'int-11',
  75. 'name' => '所属门店',
  76. 'default' => '',
  77. 'desc' => '所属门店',
  78. 'match' => 'is_numeric',
  79. //'search' => '',
  80. 'update' => 'hidden',
  81. 'value' => Dever::input('search_option_shop_id'),
  82. 'list' => 'Dever::load("shop/info-find#name", {shop_id})',
  83. ),
  84. 'uid' => array
  85. (
  86. 'type' => 'int-11',
  87. 'name' => '购买人名称',
  88. 'default' => '0',
  89. 'desc' => '请选择用户',
  90. 'match' => 'is_numeric',
  91. 'update' => 'text',
  92. //'search' => 'select',
  93. 'search' => array
  94. (
  95. 'api' => 'passport/user-select',
  96. 'col' => 'username',
  97. 'result' => 'id',
  98. ),
  99. 'list' => 'Dever::load("shop/lib/manage.user", {id})',
  100. ),
  101. 'parent_uid' => array
  102. (
  103. 'type' => 'int-11',
  104. 'name' => '邀请人',
  105. 'default' => '0',
  106. 'desc' => '请选择用户',
  107. 'match' => 'is_numeric',
  108. //'update' => 'text',
  109. //'search' => 'select',
  110. /*
  111. 'search' => array
  112. (
  113. 'api' => 'passport/user-all',
  114. 'col' => 'username',
  115. 'result' => 'id',
  116. ),
  117. */
  118. //'list_name' => '订单详情',
  119. //'list' => 'Dever::load("goods/lib/manage.order", {id})',
  120. //'list' => '{parent_uid} > 0 ? Dever::load("passport/user-one#username", {parent_uid}) : "无邀请人"',
  121. ),
  122. 'mobile' => array
  123. (
  124. 'type' => 'varchar-300',
  125. 'name' => '下单手机号',
  126. 'default' => '',
  127. 'desc' => '手机号',
  128. 'match' => 'option',
  129. 'search' => array
  130. (
  131. 'api' => 'passport/user-select',//接口地址,最好是获取多条数据的地址
  132. 'col' => 'mobile',//要查询的字段
  133. 'result' => 'id',//返回的字段
  134. 'search' => 'uid',//本表的字段,默认为当前的字段
  135. ),
  136. ),
  137. 'address_id' => array
  138. (
  139. 'type' => 'int-11',
  140. 'name' => '送货地址',
  141. 'default' => '',
  142. 'desc' => '送货地址',
  143. 'match' => 'is_numeric',
  144. //'list' => 'Dever::load("passport/address-find#address", {address_id})';
  145. ),
  146. 'invoice_id' => array
  147. (
  148. 'type' => 'int-11',
  149. 'name' => '发票信息',
  150. 'default' => '',
  151. 'desc' => '发票信息',
  152. 'match' => 'is_numeric',
  153. //'list' => 'Dever::load("passport/address-find#address", {address_id})';
  154. ),
  155. 'name' => array
  156. (
  157. 'type' => 'varchar-80',
  158. 'name' => '订单名称',
  159. 'default' => '',
  160. 'desc' => '订单名称',
  161. 'match' => 'is_string',
  162. 'update' => 'text',
  163. ),
  164. 'order_num' => array
  165. (
  166. 'type' => 'varchar-100',
  167. 'name' => '订单号',
  168. 'default' => '',
  169. 'desc' => '订单号',
  170. 'match' => 'is_string',
  171. 'update' => 'text',
  172. 'search' => 'fulltext',
  173. 'list' => true,
  174. ),
  175. 'price' => array
  176. (
  177. 'type' => 'varchar-50',
  178. 'name' => '付款金额',
  179. 'default' => '',
  180. 'desc' => '付款金额',
  181. 'match' => 'option',
  182. 'update' => 'text',
  183. 'list' => true,
  184. ),
  185. 'num' => array
  186. (
  187. 'type' => 'int-11',
  188. 'name' => '购买数量',
  189. 'default' => '',
  190. 'desc' => '购买数量',
  191. 'match' => 'is_numeric',
  192. 'search' => 'select',
  193. //'list' => true,
  194. ),
  195. 'card_code_id' => array
  196. (
  197. 'type' => 'int-11',
  198. 'name' => '礼品卡id',
  199. 'default' => '',
  200. 'desc' => '礼品卡id',
  201. 'match' => 'option',
  202. ),
  203. 'coupon_id' => array
  204. (
  205. 'type' => 'int-11',
  206. 'name' => '用户使用的优惠券id',
  207. 'default' => '',
  208. 'desc' => '用户的优惠券id',
  209. 'match' => 'option',
  210. ),
  211. 'user_coupon_id' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '用户的优惠券id',
  215. 'default' => '',
  216. 'desc' => '用户的优惠券id',
  217. 'match' => 'option',
  218. ),
  219. 'method' => array
  220. (
  221. 'type' => 'int-11',
  222. 'name' => '配送类型',
  223. 'default' => '1',
  224. 'desc' => '配送类型',
  225. 'match' => 'is_numeric',
  226. 'update' => 'radio',
  227. 'option' => $method,
  228. ),
  229. 'code' => array
  230. (
  231. 'type' => 'varchar-100',
  232. 'name' => '自提码',
  233. 'default' => '',
  234. 'desc' => '自提码',
  235. 'match' => 'is_numeric',
  236. ),
  237. 'code_status' => array
  238. (
  239. 'type' => 'int-11',
  240. 'name' => '自提状态',
  241. 'default' => '1',
  242. 'desc' => '自提状态',
  243. 'match' => 'is_numeric',
  244. 'update' => 'radio',
  245. 'option' => $code_status,
  246. ),
  247. 'ps_code' => array
  248. (
  249. 'type' => 'varchar-100',
  250. 'name' => '物流号',
  251. 'default' => '',
  252. 'desc' => '物流号',
  253. 'match' => 'is_string',
  254. ),
  255. 'ps_status' => array
  256. (
  257. 'type' => 'int-11',
  258. 'name' => '配送状态',
  259. 'default' => '1',
  260. 'desc' => '配送状态',
  261. 'match' => 'is_numeric',
  262. 'update' => 'radio',
  263. 'option' => $ps_status,
  264. ),
  265. 'ps_id' => array
  266. (
  267. 'type' => 'int-11',
  268. 'name' => '配送服务商id',
  269. 'default' => '1',
  270. 'desc' => '配送服务商id',
  271. 'match' => 'is_numeric',
  272. //'update' => 'select',
  273. //'option' => $ps_service,
  274. ),
  275. 'ps_cash' => array
  276. (
  277. 'type' => 'varchar-100',
  278. 'name' => '配送金额',
  279. 'default' => '',
  280. 'desc' => '配送金额',
  281. 'match' => 'is_string',
  282. ),
  283. 'pay_id' => array
  284. (
  285. 'type' => 'varchar-100',
  286. 'name' => '支付订单ID',
  287. 'default' => '',
  288. 'desc' => '付款订单id',
  289. 'match' => 'is_string',
  290. //'update' => 'text',
  291. //'search' => 'fulltext',
  292. //'list' => true,
  293. ),
  294. 'pay_status' => array
  295. (
  296. 'type' => 'tinyint-1',
  297. 'name' => '支付状态',
  298. 'default' => '1',
  299. 'desc' => '请选择支付状态',
  300. 'match' => 'is_numeric',
  301. 'option' => $pay_status,
  302. 'list' => true,
  303. ),
  304. 'pay_price' => array
  305. (
  306. 'type' => 'varchar-50',
  307. 'name' => '付款金额',
  308. 'default' => '',
  309. 'desc' => '付款金额',
  310. 'match' => 'option',
  311. 'update' => 'text',
  312. ),
  313. 'pay_method' => array
  314. (
  315. 'type' => 'int-11',
  316. 'name' => '支付类型',
  317. 'default' => '1',
  318. 'desc' => '支付类型',
  319. 'match' => 'is_numeric',
  320. 'update' => 'radio',
  321. 'option' => $pay_method,
  322. 'list' => true,
  323. ),
  324. 'info' => array
  325. (
  326. 'type' => 'varchar-300',
  327. 'name' => '订单备注',
  328. 'default' => '',
  329. 'desc' => '订单备注',
  330. 'match' => 'option',
  331. 'update' => 'textarea',
  332. ),
  333. 'note' => array
  334. (
  335. 'type' => 'tinyint-1',
  336. 'name' => '是否发送状态提醒-1未发送,2已发送',
  337. 'default' => '1',
  338. 'desc' => '请选择状态',
  339. 'match' => 'is_numeric',
  340. ),
  341. 'notice' => array
  342. (
  343. 'type' => 'int-11',
  344. 'name' => '模板消息提醒次数',
  345. 'default' => '0',
  346. 'desc' => '模板消息提醒次数',
  347. 'match' => 'is_numeric',
  348. ),
  349. 'tk_pic' => array
  350. (
  351. 'type' => 'varchar-150',
  352. 'name' => '退款截图',
  353. 'default' => '',
  354. 'desc' => '退款截图',
  355. 'match' => 'is_string',
  356. 'update' => 'image',
  357. 'key' => 1
  358. ),
  359. 'tk_time' => array
  360. (
  361. 'type' => 'int-11',
  362. 'name' => '退款时间',
  363. 'default' => '',
  364. 'desc' => '退款时间',
  365. 'match' => 'option',
  366. //'list' => true,
  367. //'update' => 'date',
  368. 'callback' => 'maketime',
  369. 'show' => 'status=5',
  370. ),
  371. 'tk_admin' => array
  372. (
  373. 'type' => 'int-11',
  374. 'name' => '退款审核人',
  375. 'default' => '1',
  376. 'desc' => '退款审核人',
  377. 'match' => 'option',
  378. //'list' => true,
  379. 'show' => 'status=5',
  380. ),
  381. 'tk_desc' => array
  382. (
  383. 'type' => 'varchar-300',
  384. 'name' => '退款备注',
  385. 'default' => '',
  386. 'desc' => '退款备注',
  387. 'match' => 'option',
  388. 'update' => 'textarea',
  389. //'show' => 'status=5',
  390. ),
  391. 'tk_status' => array
  392. (
  393. 'type' => 'tinyint-1',
  394. 'name' => '申请退款状态',
  395. 'default' => '1',
  396. 'desc' => '申请退款状态',
  397. 'match' => 'option',
  398. 'update' => 'radio',
  399. 'option' => $tk_status,
  400. ),
  401. 'area' => array
  402. (
  403. 'type' => 'varchar-500',
  404. 'name' => '所在地区',
  405. 'default' => '',
  406. 'desc' => '所在地区',
  407. 'match' => 'option',
  408. 'search' => 'linkage',
  409. 'option' => Dever::url('api.get?level_total=4', 'area'),
  410. ),
  411. 'province' => array
  412. (
  413. 'type' => 'int-11',
  414. 'name' => '省份',
  415. 'default' => '',
  416. 'desc' => '省份',
  417. 'match' => 'option',
  418. //'update' => 'text',
  419. ),
  420. 'city' => array
  421. (
  422. 'type' => 'int-11',
  423. 'name' => '城市',
  424. 'default' => '',
  425. 'desc' => '城市',
  426. 'match' => 'option',
  427. //'update' => 'text',
  428. ),
  429. 'county' => array
  430. (
  431. 'type' => 'int-11',
  432. 'name' => '县区',
  433. 'default' => '',
  434. 'desc' => '县区',
  435. 'match' => 'option',
  436. //'update' => 'text',
  437. ),
  438. 'town' => array
  439. (
  440. 'type' => 'int-11',
  441. 'name' => '街道',
  442. 'default' => '',
  443. 'desc' => '街道',
  444. 'match' => 'option',
  445. //'update' => 'text',
  446. ),
  447. 'status' => array
  448. (
  449. 'type' => 'tinyint-1',
  450. 'name' => '状态',
  451. 'default' => '1',
  452. 'desc' => '状态',
  453. 'match' => 'is_numeric',
  454. 'option' => $status,
  455. 'search' => 'select',
  456. 'list' => true,
  457. ),
  458. 'state' => array
  459. (
  460. 'type' => 'tinyint-1',
  461. 'name' => '状态',
  462. 'default' => '1',
  463. 'desc' => '请选择状态',
  464. 'match' => 'is_numeric',
  465. ),
  466. 'cdate' => array
  467. (
  468. 'type' => 'int-11',
  469. 'name' => '下单时间',
  470. 'match' => array('is_numeric', time()),
  471. 'desc' => '',
  472. # 只有insert时才生效
  473. 'insert' => true,
  474. 'search' => 'date',
  475. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  476. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  477. ),
  478. ),
  479. 'manage' => array
  480. (
  481. 'delete' => false,
  482. 'edit' => false,
  483. 'insert' => false,
  484. 'button' => array
  485. (
  486. //'导出订单' => array('location', 'user/lib/manage.out'),
  487. ),
  488. 'list_button' => array
  489. (
  490. 'fast_list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=1"'),
  491. 'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  492. //'delete' => array('删除', '', '{status} == 1'),
  493. ),
  494. ),
  495. 'request' => array
  496. (
  497. 'getList' => array
  498. (
  499. # 匹配的正则或函数 选填项
  500. 'option' => array
  501. (
  502. 'shop_id' => 'yes',
  503. 'uid' => 'yes',
  504. 'status' => 'yes',
  505. 'state' => 1,
  506. ),
  507. 'type' => 'all',
  508. 'order' => array('cdate' => 'desc'),
  509. 'page' => array(5, 'list'),
  510. 'col' => '*',
  511. ),
  512. 'getAll' => array
  513. (
  514. # 匹配的正则或函数 选填项
  515. 'option' => array
  516. (
  517. 'uid' => 'yes',
  518. 'status' => 'yes',
  519. 'state' => 1,
  520. ),
  521. 'type' => 'all',
  522. 'order' => array('cdate' => 'desc'),
  523. 'page' => array(10, 'list'),
  524. 'col' => '*',
  525. ),
  526. 'getYes' => array
  527. (
  528. # 匹配的正则或函数 选填项
  529. 'option' => array
  530. (
  531. 'shop_id' => 'yes',
  532. 'state' => 1,
  533. ),
  534. 'type' => 'all',
  535. 'order' => array('cdate' => 'desc'),
  536. 'col' => '*',
  537. ),
  538. # 获取提交订单超过12个小时
  539. 'getDataByTime' => array
  540. (
  541. # 匹配的正则或函数 选填项
  542. 'option' => array
  543. (
  544. 'cdate' => array('yes', '>='),
  545. 'notice' => 'yes',
  546. 'note' => 'yes',
  547. 'state' => 1,
  548. ),
  549. 'type' => 'all',
  550. 'order' => array('cdate' => 'desc'),
  551. 'col' => '*',
  552. ),
  553. # 获取1,2
  554. 'getBuy' => array
  555. (
  556. # 匹配的正则或函数 选填项
  557. 'option' => array
  558. (
  559. 'status' => 'yes',
  560. 'shop_id' => 'yes',
  561. 'order_num' => 'yes',
  562. 'uid' => 'yes',
  563. 'state' => 1,
  564. ),
  565. 'type' => 'all',
  566. 'order' => array('id' => 'desc'),
  567. 'col' => '*',
  568. ),
  569. 'getMyAll' => array
  570. (
  571. # 匹配的正则或函数 选填项
  572. 'option' => array
  573. (
  574. 'uid' => 'yes',
  575. 'status' => 'yes',
  576. 'cate_id' => 'yes',
  577. 'state' => 1,
  578. ),
  579. 'type' => 'all',
  580. 'order' => array('id' => 'desc'),
  581. 'page' => array(10, 'list'),
  582. 'col' => 'id,order_num,name,buy_num,cdate,cash,shop_id,buy_id',
  583. ),
  584. # 删除未支付订单
  585. 'drop' => array
  586. (
  587. # 匹配的正则或函数 选填项
  588. 'where' => array
  589. (
  590. 'time' => array('yes-cdate', '<='),
  591. 'status' => 1,
  592. 'state' => 1,
  593. ),
  594. 'type' => 'delete',
  595. 'col' => 'id,order_num',
  596. ),
  597. # 获取数据
  598. 'getAllByDate' => array
  599. (
  600. # 匹配的正则或函数 选填项
  601. 'where' => array
  602. (
  603. 'start' => array('yes-cdate', '>='),
  604. 'end' => array('yes-cdate', '<='),
  605. ),
  606. 'type' => 'all',
  607. 'col' => 'id,order_num',
  608. ),
  609. # 获取订单数量
  610. 'getOrderNum' => array
  611. (
  612. # 匹配的正则或函数 选填项
  613. 'option' => array
  614. (
  615. 'start' => array('yes-cdate', '>='),
  616. 'end' => array('yes-cdate', '<='),
  617. 'shop_id' => 'yes',
  618. 'status' => array('yes', 'in'),
  619. 'state' => 1,
  620. ),
  621. 'type' => 'count',
  622. 'col' => '*',
  623. ),
  624. # 获取总金额
  625. 'getCashNum' => array
  626. (
  627. # 匹配的正则或函数 选填项
  628. 'option' => array
  629. (
  630. 'start' => array('yes-cdate', '>='),
  631. 'end' => array('yes-cdate', '<='),
  632. 'shop_id' => 'yes',
  633. 'status' => array('yes', 'in'),
  634. 'state' => 1,
  635. ),
  636. 'type' => 'one',
  637. 'col' => 'sum(price) as total',
  638. ),
  639. # 获取商品数量
  640. 'getGoodsNum' => array
  641. (
  642. # 匹配的正则或函数 选填项
  643. 'option' => array
  644. (
  645. 'start' => array('yes-cdate', '>='),
  646. 'end' => array('yes-cdate', '<='),
  647. 'shop_id' => 'yes',
  648. 'status' => array('yes', 'in'),
  649. 'state' => 1,
  650. ),
  651. 'type' => 'one',
  652. 'col' => 'sum(num) as total',
  653. ),
  654. ),
  655. );