sell_order.php 17 KB

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