sell_order.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  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' => true,
  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. 'coupon_id' => array
  252. (
  253. 'type' => 'int-11',
  254. 'name' => '门店的优惠券id',
  255. 'default' => '',
  256. 'desc' => '门店的优惠券id',
  257. 'match' => 'option',
  258. ),
  259. 'user_coupon_id' => array
  260. (
  261. 'type' => 'int-11',
  262. 'name' => '用户的优惠券id',
  263. 'default' => '',
  264. 'desc' => '用户的优惠券id',
  265. 'match' => 'option',
  266. ),
  267. 'coupon_cash' => array
  268. (
  269. 'type' => 'varchar-300',
  270. 'name' => '优惠金额',
  271. 'default' => '0',
  272. 'desc' => '优惠金额',
  273. 'match' => 'option',
  274. 'update' => 'text',
  275. ),
  276. 'method' => array
  277. (
  278. 'type' => 'int-11',
  279. 'name' => '配送类型',
  280. 'default' => '1',
  281. 'desc' => '配送类型',
  282. 'match' => 'is_numeric',
  283. 'update' => 'radio',
  284. 'option' => $method,
  285. ),
  286. 'code' => array
  287. (
  288. 'type' => 'varchar-100',
  289. 'name' => '自提码或者核销码',
  290. 'default' => '',
  291. 'desc' => '自提码或者核销码',
  292. 'match' => 'is_numeric',
  293. ),
  294. 'pay_method' => array
  295. (
  296. 'type' => 'int-11',
  297. 'name' => '支付类型',
  298. 'default' => '1',
  299. 'desc' => '支付类型',
  300. 'match' => 'is_numeric',
  301. 'update' => 'radio',
  302. 'option' => $pay_method,
  303. 'list' => true,
  304. ),
  305. 'pay_type' => array
  306. (
  307. 'type' => 'int-11',
  308. 'name' => '支付方式',
  309. 'default' => '1',
  310. 'desc' => '支付方式',
  311. 'match' => 'is_numeric',
  312. 'update' => 'radio',
  313. 'option' => $pay_type,
  314. ),
  315. 'info' => array
  316. (
  317. 'type' => 'varchar-300',
  318. 'name' => '订单备注',
  319. 'default' => '',
  320. 'desc' => '订单备注',
  321. 'match' => 'option',
  322. 'update' => 'textarea',
  323. ),
  324. 'withdraw' => array
  325. (
  326. 'type' => 'tinyint-1',
  327. 'name' => '是否提现',
  328. 'default' => '1',
  329. 'desc' => '是否提现',
  330. 'match' => 'is_numeric',
  331. 'option' => $withdraw,
  332. //'search' => 'select',
  333. ),
  334. 'status' => array
  335. (
  336. 'type' => 'tinyint-1',
  337. 'name' => '状态',
  338. 'default' => '1',
  339. 'desc' => '状态',
  340. 'match' => 'is_numeric',
  341. 'option' => $status_manage,
  342. 'search' => 'select',
  343. 'list' => true,
  344. ),
  345. 'notice' => array
  346. (
  347. 'type' => 'tinyint-1',
  348. 'name' => '是否发送通知',
  349. 'default' => '1',
  350. 'desc' => '是否发送通知',
  351. 'match' => 'is_numeric',
  352. ),
  353. 'fdate' => array
  354. (
  355. 'type' => 'int-11',
  356. 'name' => '完成时间',
  357. 'default' => '',
  358. 'match' => 'is_numeric',
  359. 'desc' => '',
  360. ),
  361. 'operdate' => array
  362. (
  363. 'type' => 'int-11',
  364. 'name' => '操作时间',
  365. 'default' => '',
  366. 'match' => 'is_numeric',
  367. 'desc' => '',
  368. ),
  369. 'state' => array
  370. (
  371. 'type' => 'tinyint-1',
  372. 'name' => '状态',
  373. 'default' => '1',
  374. 'desc' => '请选择状态',
  375. 'match' => 'is_numeric',
  376. ),
  377. 'cdate' => array
  378. (
  379. 'type' => 'int-11',
  380. 'name' => '下单时间',
  381. 'match' => array('is_numeric', time()),
  382. 'desc' => '',
  383. # 只有insert时才生效
  384. 'insert' => true,
  385. 'search' => 'date',
  386. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  387. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  388. ),
  389. ),
  390. 'manage' => array
  391. (
  392. 'delete' => false,
  393. 'edit' => false,
  394. 'insert' => false,
  395. 'button' => array
  396. (
  397. //'导出订单' => array('location', 'user/lib/manage.out'),
  398. ),
  399. 'list_button' => array
  400. (
  401. //fast_list
  402. 'list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=1"'),
  403. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  404. //'delete' => array('删除', '', '{status} == 1'),
  405. ),
  406. ),
  407. 'request' => array
  408. (
  409. 'getList' => array
  410. (
  411. # 匹配的正则或函数 选填项
  412. 'option' => array
  413. (
  414. 'shop_id' => 'yes',
  415. 'uid' => 'yes',
  416. 'status' => 'yes',
  417. 'state' => 1,
  418. ),
  419. 'type' => 'all',
  420. 'order' => array('cdate' => 'desc'),
  421. 'page' => array(5, 'list'),
  422. 'col' => '*',
  423. ),
  424. 'getAll' => array
  425. (
  426. # 匹配的正则或函数 选填项
  427. 'option' => array
  428. (
  429. 'uid' => 'yes',
  430. 'name' => array('yes', 'like'),
  431. 'shop_id' => 'yes',
  432. 'mobile' => 'yes',
  433. 'method' => 'yes',
  434. 'pay_method' => 'yes',
  435. 'start' => array('yes-cdate', '>='),
  436. 'end' => array('yes-cdate', '<='),
  437. 'status' => array('yes', 'in'),
  438. 'state' => 1,
  439. ),
  440. 'type' => 'all',
  441. 'order' => array('cdate' => 'desc'),
  442. 'page' => array(10, 'list'),
  443. 'col' => '*',
  444. ),
  445. 'getYes' => array
  446. (
  447. # 匹配的正则或函数 选填项
  448. 'option' => array
  449. (
  450. 'shop_id' => 'yes',
  451. 'state' => 1,
  452. ),
  453. 'type' => 'all',
  454. 'order' => array('cdate' => 'desc'),
  455. 'col' => '*',
  456. ),
  457. # 获取提交订单超过12个小时
  458. 'getDataByTime' => array
  459. (
  460. # 匹配的正则或函数 选填项
  461. 'option' => array
  462. (
  463. 'cdate' => array('yes', '<='),
  464. 'status' => 'yes',
  465. 'notice' => 'yes',
  466. 'state' => 1,
  467. ),
  468. 'type' => 'all',
  469. 'order' => array('cdate' => 'desc'),
  470. 'col' => '*',
  471. ),
  472. # 获取1,2
  473. 'getBuy' => array
  474. (
  475. # 匹配的正则或函数 选填项
  476. 'option' => array
  477. (
  478. 'status' => 'yes',
  479. 'shop_id' => 'yes',
  480. 'order_num' => 'yes',
  481. 'uid' => 'yes',
  482. 'state' => 1,
  483. ),
  484. 'type' => 'all',
  485. 'order' => array('id' => 'desc'),
  486. 'col' => '*',
  487. ),
  488. 'getMyAll' => array
  489. (
  490. # 匹配的正则或函数 选填项
  491. 'option' => array
  492. (
  493. 'uid' => 'yes',
  494. 'status' => 'yes',
  495. 'cate_id' => 'yes',
  496. 'state' => 1,
  497. ),
  498. 'type' => 'all',
  499. 'order' => array('id' => 'desc'),
  500. 'page' => array(10, 'list'),
  501. 'col' => 'id,order_num,name,buy_num,cdate,cash,shop_id,buy_id',
  502. ),
  503. # 删除未支付订单
  504. 'drop' => array
  505. (
  506. # 匹配的正则或函数 选填项
  507. 'where' => array
  508. (
  509. 'time' => array('yes-cdate', '<='),
  510. 'status' => 1,
  511. 'state' => 1,
  512. ),
  513. 'type' => 'delete',
  514. 'col' => 'id,order_num',
  515. ),
  516. # 获取数据
  517. 'getAllByDate' => array
  518. (
  519. # 匹配的正则或函数 选填项
  520. 'where' => array
  521. (
  522. 'start' => array('yes-cdate', '>='),
  523. 'end' => array('yes-cdate', '<='),
  524. ),
  525. 'type' => 'all',
  526. 'col' => 'id,order_num',
  527. ),
  528. # 获取订单数量
  529. 'getOrderNum' => array
  530. (
  531. # 匹配的正则或函数 选填项
  532. 'option' => array
  533. (
  534. 'start' => array('yes-cdate', '>='),
  535. 'end' => array('yes-cdate', '<='),
  536. 'shop_id' => 'yes',
  537. 'status' => array('yes', 'in'),
  538. 'state' => 1,
  539. ),
  540. 'type' => 'count',
  541. 'col' => '*',
  542. ),
  543. # 获取总金额
  544. 'getCashNum' => array
  545. (
  546. # 匹配的正则或函数 选填项
  547. 'option' => array
  548. (
  549. 'start' => array('yes-cdate', '>='),
  550. 'end' => array('yes-cdate', '<='),
  551. 'shop_id' => 'yes',
  552. 'status' => array('yes', 'in'),
  553. 'state' => 1,
  554. ),
  555. 'type' => 'one',
  556. 'col' => 'sum(price-refund_cash) as total',
  557. ),
  558. # 获取商品数量
  559. 'getGoodsNum' => array
  560. (
  561. # 匹配的正则或函数 选填项
  562. 'option' => array
  563. (
  564. 'start' => array('yes-cdate', '>='),
  565. 'end' => array('yes-cdate', '<='),
  566. 'shop_id' => 'yes',
  567. 'status' => array('yes', 'in'),
  568. 'state' => 1,
  569. ),
  570. 'type' => 'one',
  571. 'col' => 'sum(num) as total',
  572. ),
  573. ),
  574. );