sell_order.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690
  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. 'method' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '配送类型',
  215. 'default' => '1',
  216. 'desc' => '配送类型',
  217. 'match' => 'is_numeric',
  218. 'update' => 'radio',
  219. 'option' => $method,
  220. ),
  221. 'code' => array
  222. (
  223. 'type' => 'varchar-100',
  224. 'name' => '自提码',
  225. 'default' => '',
  226. 'desc' => '自提码',
  227. 'match' => 'is_numeric',
  228. ),
  229. 'code_status' => array
  230. (
  231. 'type' => 'int-11',
  232. 'name' => '自提状态',
  233. 'default' => '1',
  234. 'desc' => '自提状态',
  235. 'match' => 'is_numeric',
  236. 'update' => 'radio',
  237. 'option' => $code_status,
  238. ),
  239. 'ps_code' => array
  240. (
  241. 'type' => 'varchar-100',
  242. 'name' => '物流号',
  243. 'default' => '',
  244. 'desc' => '物流号',
  245. 'match' => 'is_numeric',
  246. ),
  247. 'ps_status' => array
  248. (
  249. 'type' => 'int-11',
  250. 'name' => '配送状态',
  251. 'default' => '1',
  252. 'desc' => '配送状态',
  253. 'match' => 'is_numeric',
  254. 'update' => 'radio',
  255. 'option' => $ps_status,
  256. ),
  257. 'pay_id' => array
  258. (
  259. 'type' => 'varchar-100',
  260. 'name' => '支付订单ID',
  261. 'default' => '',
  262. 'desc' => '付款订单id',
  263. 'match' => 'is_string',
  264. //'update' => 'text',
  265. //'search' => 'fulltext',
  266. //'list' => true,
  267. ),
  268. 'pay_status' => array
  269. (
  270. 'type' => 'tinyint-1',
  271. 'name' => '支付状态',
  272. 'default' => '1',
  273. 'desc' => '请选择支付状态',
  274. 'match' => 'is_numeric',
  275. 'option' => $pay_status,
  276. 'list' => true,
  277. ),
  278. 'pay_price' => array
  279. (
  280. 'type' => 'varchar-50',
  281. 'name' => '付款金额',
  282. 'default' => '',
  283. 'desc' => '付款金额',
  284. 'match' => 'option',
  285. 'update' => 'text',
  286. ),
  287. 'pay_method' => array
  288. (
  289. 'type' => 'int-11',
  290. 'name' => '支付类型',
  291. 'default' => '1',
  292. 'desc' => '支付类型',
  293. 'match' => 'is_numeric',
  294. 'update' => 'radio',
  295. 'option' => $pay_method,
  296. 'list' => true,
  297. ),
  298. 'info' => array
  299. (
  300. 'type' => 'varchar-300',
  301. 'name' => '订单备注',
  302. 'default' => '',
  303. 'desc' => '订单备注',
  304. 'match' => 'option',
  305. 'update' => 'textarea',
  306. ),
  307. 'note' => array
  308. (
  309. 'type' => 'tinyint-1',
  310. 'name' => '是否发送状态提醒-1未发送,2已发送',
  311. 'default' => '1',
  312. 'desc' => '请选择状态',
  313. 'match' => 'is_numeric',
  314. ),
  315. 'notice' => array
  316. (
  317. 'type' => 'int-11',
  318. 'name' => '模板消息提醒次数',
  319. 'default' => '0',
  320. 'desc' => '模板消息提醒次数',
  321. 'match' => 'is_numeric',
  322. ),
  323. 'tk_pic' => array
  324. (
  325. 'type' => 'varchar-150',
  326. 'name' => '退款截图',
  327. 'default' => '',
  328. 'desc' => '退款截图',
  329. 'match' => 'is_string',
  330. 'update' => 'image',
  331. 'key' => 1
  332. ),
  333. 'tk_time' => array
  334. (
  335. 'type' => 'int-11',
  336. 'name' => '退款时间',
  337. 'default' => '',
  338. 'desc' => '退款时间',
  339. 'match' => 'option',
  340. //'list' => true,
  341. //'update' => 'date',
  342. 'callback' => 'maketime',
  343. 'show' => 'status=5',
  344. ),
  345. 'tk_admin' => array
  346. (
  347. 'type' => 'int-11',
  348. 'name' => '退款审核人',
  349. 'default' => '1',
  350. 'desc' => '退款审核人',
  351. 'match' => 'option',
  352. //'list' => true,
  353. 'show' => 'status=5',
  354. ),
  355. 'tk_desc' => array
  356. (
  357. 'type' => 'varchar-300',
  358. 'name' => '退款备注',
  359. 'default' => '',
  360. 'desc' => '退款备注',
  361. 'match' => 'option',
  362. 'update' => 'textarea',
  363. //'show' => 'status=5',
  364. ),
  365. 'tk_status' => array
  366. (
  367. 'type' => 'tinyint-1',
  368. 'name' => '申请退款状态',
  369. 'default' => '1',
  370. 'desc' => '申请退款状态',
  371. 'match' => 'option',
  372. 'update' => 'radio',
  373. 'option' => $tk_status,
  374. ),
  375. 'area' => array
  376. (
  377. 'type' => 'varchar-500',
  378. 'name' => '所在地区',
  379. 'default' => '',
  380. 'desc' => '所在地区',
  381. 'match' => 'option',
  382. 'search' => 'linkage',
  383. 'option' => Dever::url('api.get?level_total=4', 'area'),
  384. ),
  385. 'province' => array
  386. (
  387. 'type' => 'int-11',
  388. 'name' => '省份',
  389. 'default' => '',
  390. 'desc' => '省份',
  391. 'match' => 'option',
  392. //'update' => 'text',
  393. ),
  394. 'city' => array
  395. (
  396. 'type' => 'int-11',
  397. 'name' => '城市',
  398. 'default' => '',
  399. 'desc' => '城市',
  400. 'match' => 'option',
  401. //'update' => 'text',
  402. ),
  403. 'county' => array
  404. (
  405. 'type' => 'int-11',
  406. 'name' => '县区',
  407. 'default' => '',
  408. 'desc' => '县区',
  409. 'match' => 'option',
  410. //'update' => 'text',
  411. ),
  412. 'town' => array
  413. (
  414. 'type' => 'int-11',
  415. 'name' => '街道',
  416. 'default' => '',
  417. 'desc' => '街道',
  418. 'match' => 'option',
  419. //'update' => 'text',
  420. ),
  421. 'status' => array
  422. (
  423. 'type' => 'tinyint-1',
  424. 'name' => '状态',
  425. 'default' => '1',
  426. 'desc' => '状态',
  427. 'match' => 'is_numeric',
  428. 'option' => $status,
  429. 'search' => 'select',
  430. 'list' => true,
  431. ),
  432. 'state' => array
  433. (
  434. 'type' => 'tinyint-1',
  435. 'name' => '状态',
  436. 'default' => '1',
  437. 'desc' => '请选择状态',
  438. 'match' => 'is_numeric',
  439. ),
  440. 'cdate' => array
  441. (
  442. 'type' => 'int-11',
  443. 'name' => '下单时间',
  444. 'match' => array('is_numeric', time()),
  445. 'desc' => '',
  446. # 只有insert时才生效
  447. 'insert' => true,
  448. 'search' => 'date',
  449. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  450. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  451. ),
  452. ),
  453. 'manage' => array
  454. (
  455. 'delete' => false,
  456. 'edit' => false,
  457. 'insert' => false,
  458. 'button' => array
  459. (
  460. //'导出订单' => array('location', 'user/lib/manage.out'),
  461. ),
  462. 'list_button' => array
  463. (
  464. 'fast_list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=1"'),
  465. 'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  466. //'delete' => array('删除', '', '{status} == 1'),
  467. ),
  468. ),
  469. 'request' => array
  470. (
  471. 'getList' => array
  472. (
  473. # 匹配的正则或函数 选填项
  474. 'option' => array
  475. (
  476. 'shop_id' => 'yes',
  477. 'uid' => 'yes',
  478. 'status' => 'yes',
  479. 'state' => 1,
  480. ),
  481. 'type' => 'all',
  482. 'order' => array('cdate' => 'desc'),
  483. 'page' => array(5, 'list'),
  484. 'col' => '*',
  485. ),
  486. 'getAll' => array
  487. (
  488. # 匹配的正则或函数 选填项
  489. 'option' => array
  490. (
  491. 'uid' => 'yes',
  492. 'status' => 'yes',
  493. 'state' => 1,
  494. ),
  495. 'type' => 'all',
  496. 'order' => array('cdate' => 'desc'),
  497. 'page' => array(10, 'list'),
  498. 'col' => '*',
  499. ),
  500. 'getYes' => array
  501. (
  502. # 匹配的正则或函数 选填项
  503. 'option' => array
  504. (
  505. 'shop_id' => 'yes',
  506. 'state' => 1,
  507. ),
  508. 'type' => 'all',
  509. 'order' => array('cdate' => 'desc'),
  510. 'col' => '*',
  511. ),
  512. # 获取提交订单超过12个小时
  513. 'getDataByTime' => array
  514. (
  515. # 匹配的正则或函数 选填项
  516. 'option' => array
  517. (
  518. 'cdate' => array('yes', '>='),
  519. 'notice' => 'yes',
  520. 'note' => 'yes',
  521. 'state' => 1,
  522. ),
  523. 'type' => 'all',
  524. 'order' => array('cdate' => 'desc'),
  525. 'col' => '*',
  526. ),
  527. # 获取1,2
  528. 'getBuy' => array
  529. (
  530. # 匹配的正则或函数 选填项
  531. 'option' => array
  532. (
  533. 'status' => 'yes',
  534. 'shop_id' => 'yes',
  535. 'order_num' => 'yes',
  536. 'uid' => 'yes',
  537. 'state' => 1,
  538. ),
  539. 'type' => 'all',
  540. 'order' => array('id' => 'desc'),
  541. 'col' => '*',
  542. ),
  543. 'getMyAll' => array
  544. (
  545. # 匹配的正则或函数 选填项
  546. 'option' => array
  547. (
  548. 'uid' => 'yes',
  549. 'status' => 'yes',
  550. 'cate_id' => 'yes',
  551. 'state' => 1,
  552. ),
  553. 'type' => 'all',
  554. 'order' => array('id' => 'desc'),
  555. 'page' => array(10, 'list'),
  556. 'col' => 'id,order_num,name,buy_num,cdate,cash,shop_id,buy_id',
  557. ),
  558. # 删除未支付订单
  559. 'drop' => array
  560. (
  561. # 匹配的正则或函数 选填项
  562. 'where' => array
  563. (
  564. 'time' => array('yes-cdate', '<='),
  565. 'status' => 1,
  566. 'state' => 1,
  567. ),
  568. 'type' => 'delete',
  569. 'col' => 'id,order_num',
  570. ),
  571. # 获取数据
  572. 'getAllByDate' => array
  573. (
  574. # 匹配的正则或函数 选填项
  575. 'where' => array
  576. (
  577. 'start' => array('yes-cdate', '>='),
  578. 'end' => array('yes-cdate', '<='),
  579. ),
  580. 'type' => 'all',
  581. 'col' => 'id,order_num',
  582. ),
  583. # 获取订单数量
  584. 'getOrderNum' => array
  585. (
  586. # 匹配的正则或函数 选填项
  587. 'option' => array
  588. (
  589. 'start' => array('yes-cdate', '>='),
  590. 'end' => array('yes-cdate', '<='),
  591. 'shop_id' => 'yes',
  592. 'status' => array('yes', 'in'),
  593. 'state' => 1,
  594. ),
  595. 'type' => 'count',
  596. 'col' => '*',
  597. ),
  598. # 获取总金额
  599. 'getCashNum' => array
  600. (
  601. # 匹配的正则或函数 选填项
  602. 'option' => array
  603. (
  604. 'start' => array('yes-cdate', '>='),
  605. 'end' => array('yes-cdate', '<='),
  606. 'shop_id' => 'yes',
  607. 'status' => array('yes', 'in'),
  608. 'state' => 1,
  609. ),
  610. 'type' => 'one',
  611. 'col' => 'sum(price) as total',
  612. ),
  613. # 获取商品数量
  614. 'getGoodsNum' => array
  615. (
  616. # 匹配的正则或函数 选填项
  617. 'option' => array
  618. (
  619. 'start' => array('yes-cdate', '>='),
  620. 'end' => array('yes-cdate', '<='),
  621. 'shop_id' => 'yes',
  622. 'status' => array('yes', 'in'),
  623. 'state' => 1,
  624. ),
  625. 'type' => 'one',
  626. 'col' => 'sum(num) as total',
  627. ),
  628. ),
  629. );