sell_order.php 16 KB

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