sell_order.php 16 KB

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