sell_order.php 18 KB

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