sell_order.php 16 KB

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