sell_order.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  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. 'operdate' => array
  295. (
  296. 'type' => 'int-11',
  297. 'name' => '操作时间',
  298. 'default' => '',
  299. 'match' => 'is_numeric',
  300. 'desc' => '',
  301. ),
  302. 'state' => array
  303. (
  304. 'type' => 'tinyint-1',
  305. 'name' => '状态',
  306. 'default' => '1',
  307. 'desc' => '请选择状态',
  308. 'match' => 'is_numeric',
  309. ),
  310. 'cdate' => array
  311. (
  312. 'type' => 'int-11',
  313. 'name' => '下单时间',
  314. 'match' => array('is_numeric', time()),
  315. 'desc' => '',
  316. # 只有insert时才生效
  317. 'insert' => true,
  318. 'search' => 'date',
  319. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  320. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  321. ),
  322. ),
  323. 'manage' => array
  324. (
  325. 'delete' => false,
  326. 'edit' => false,
  327. 'insert' => false,
  328. 'button' => array
  329. (
  330. //'导出订单' => array('location', 'user/lib/manage.out'),
  331. ),
  332. 'list_button' => array
  333. (
  334. 'fast_list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=1"'),
  335. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  336. //'delete' => array('删除', '', '{status} == 1'),
  337. ),
  338. ),
  339. 'request' => array
  340. (
  341. 'getList' => array
  342. (
  343. # 匹配的正则或函数 选填项
  344. 'option' => array
  345. (
  346. 'shop_id' => 'yes',
  347. 'uid' => 'yes',
  348. 'status' => 'yes',
  349. 'state' => 1,
  350. ),
  351. 'type' => 'all',
  352. 'order' => array('cdate' => 'desc'),
  353. 'page' => array(5, 'list'),
  354. 'col' => '*',
  355. ),
  356. 'getAll' => array
  357. (
  358. # 匹配的正则或函数 选填项
  359. 'option' => array
  360. (
  361. 'uid' => 'yes',
  362. 'name' => array('yes', 'like'),
  363. 'shop_id' => 'yes',
  364. 'mobile' => 'yes',
  365. 'method' => 'yes',
  366. 'pay_method' => 'yes',
  367. 'start' => array('yes-cdate', '>='),
  368. 'end' => array('yes-cdate', '<='),
  369. 'status' => array('yes', 'in'),
  370. 'state' => 1,
  371. ),
  372. 'type' => 'all',
  373. 'order' => array('cdate' => 'desc'),
  374. 'page' => array(10, 'list'),
  375. 'col' => '*',
  376. ),
  377. 'getYes' => array
  378. (
  379. # 匹配的正则或函数 选填项
  380. 'option' => array
  381. (
  382. 'shop_id' => 'yes',
  383. 'state' => 1,
  384. ),
  385. 'type' => 'all',
  386. 'order' => array('cdate' => 'desc'),
  387. 'col' => '*',
  388. ),
  389. # 获取提交订单超过12个小时
  390. 'getDataByTime' => array
  391. (
  392. # 匹配的正则或函数 选填项
  393. 'option' => array
  394. (
  395. 'cdate' => array('yes', '>='),
  396. 'status' => 'yes',
  397. 'notice' => 'yes',
  398. 'note' => 'yes',
  399. 'state' => 1,
  400. ),
  401. 'type' => 'all',
  402. 'order' => array('cdate' => 'desc'),
  403. 'col' => '*',
  404. ),
  405. # 获取1,2
  406. 'getBuy' => array
  407. (
  408. # 匹配的正则或函数 选填项
  409. 'option' => array
  410. (
  411. 'status' => 'yes',
  412. 'shop_id' => 'yes',
  413. 'order_num' => 'yes',
  414. 'uid' => 'yes',
  415. 'state' => 1,
  416. ),
  417. 'type' => 'all',
  418. 'order' => array('id' => 'desc'),
  419. 'col' => '*',
  420. ),
  421. 'getMyAll' => array
  422. (
  423. # 匹配的正则或函数 选填项
  424. 'option' => array
  425. (
  426. 'uid' => 'yes',
  427. 'status' => 'yes',
  428. 'cate_id' => 'yes',
  429. 'state' => 1,
  430. ),
  431. 'type' => 'all',
  432. 'order' => array('id' => 'desc'),
  433. 'page' => array(10, 'list'),
  434. 'col' => 'id,order_num,name,buy_num,cdate,cash,shop_id,buy_id',
  435. ),
  436. # 删除未支付订单
  437. 'drop' => array
  438. (
  439. # 匹配的正则或函数 选填项
  440. 'where' => array
  441. (
  442. 'time' => array('yes-cdate', '<='),
  443. 'status' => 1,
  444. 'state' => 1,
  445. ),
  446. 'type' => 'delete',
  447. 'col' => 'id,order_num',
  448. ),
  449. # 获取数据
  450. 'getAllByDate' => array
  451. (
  452. # 匹配的正则或函数 选填项
  453. 'where' => array
  454. (
  455. 'start' => array('yes-cdate', '>='),
  456. 'end' => array('yes-cdate', '<='),
  457. ),
  458. 'type' => 'all',
  459. 'col' => 'id,order_num',
  460. ),
  461. # 获取订单数量
  462. 'getOrderNum' => array
  463. (
  464. # 匹配的正则或函数 选填项
  465. 'option' => array
  466. (
  467. 'start' => array('yes-cdate', '>='),
  468. 'end' => array('yes-cdate', '<='),
  469. 'shop_id' => 'yes',
  470. 'status' => array('yes', 'in'),
  471. 'state' => 1,
  472. ),
  473. 'type' => 'count',
  474. 'col' => '*',
  475. ),
  476. # 获取总金额
  477. 'getCashNum' => array
  478. (
  479. # 匹配的正则或函数 选填项
  480. 'option' => array
  481. (
  482. 'start' => array('yes-cdate', '>='),
  483. 'end' => array('yes-cdate', '<='),
  484. 'shop_id' => 'yes',
  485. 'status' => array('yes', 'in'),
  486. 'state' => 1,
  487. ),
  488. 'type' => 'one',
  489. 'col' => 'sum(price-refund_cash) as total',
  490. ),
  491. # 获取商品数量
  492. 'getGoodsNum' => array
  493. (
  494. # 匹配的正则或函数 选填项
  495. 'option' => array
  496. (
  497. 'start' => array('yes-cdate', '>='),
  498. 'end' => array('yes-cdate', '<='),
  499. 'shop_id' => 'yes',
  500. 'status' => array('yes', 'in'),
  501. 'state' => 1,
  502. ),
  503. 'type' => 'one',
  504. 'col' => 'sum(num) as total',
  505. ),
  506. ),
  507. );