sell_order.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  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' => '0',
  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' => '0',
  198. 'desc' => '抹零金额',
  199. 'match' => 'option',
  200. 'update' => 'text',
  201. ),
  202. 'ps_cash' => array
  203. (
  204. 'type' => 'varchar-50',
  205. 'name' => '配送费',
  206. 'default' => '0',
  207. 'desc' => '配送费',
  208. 'match' => 'option',
  209. 'update' => 'text',
  210. ),
  211. 'card_code_id' => array
  212. (
  213. 'type' => 'int-11',
  214. 'name' => '礼品卡id',
  215. 'default' => '',
  216. 'desc' => '礼品卡id',
  217. 'match' => 'option',
  218. ),
  219. 'coupon_id' => array
  220. (
  221. 'type' => 'int-11',
  222. 'name' => '门店的优惠券id',
  223. 'default' => '',
  224. 'desc' => '门店的优惠券id',
  225. 'match' => 'option',
  226. ),
  227. 'user_coupon_id' => array
  228. (
  229. 'type' => 'int-11',
  230. 'name' => '用户的优惠券id',
  231. 'default' => '',
  232. 'desc' => '用户的优惠券id',
  233. 'match' => 'option',
  234. ),
  235. 'coupon_cash' => array
  236. (
  237. 'type' => 'varchar-300',
  238. 'name' => '优惠金额',
  239. 'default' => '0',
  240. 'desc' => '优惠金额',
  241. 'match' => 'option',
  242. 'update' => 'text',
  243. ),
  244. 'method' => array
  245. (
  246. 'type' => 'int-11',
  247. 'name' => '配送类型',
  248. 'default' => '1',
  249. 'desc' => '配送类型',
  250. 'match' => 'is_numeric',
  251. 'update' => 'radio',
  252. 'option' => $method,
  253. ),
  254. 'code' => array
  255. (
  256. 'type' => 'varchar-100',
  257. 'name' => '自提码或者核销码',
  258. 'default' => '',
  259. 'desc' => '自提码或者核销码',
  260. 'match' => 'is_numeric',
  261. ),
  262. 'pay_method' => array
  263. (
  264. 'type' => 'int-11',
  265. 'name' => '支付类型',
  266. 'default' => '1',
  267. 'desc' => '支付类型',
  268. 'match' => 'is_numeric',
  269. 'update' => 'radio',
  270. 'option' => $pay_method,
  271. 'list' => true,
  272. ),
  273. 'pay_type' => array
  274. (
  275. 'type' => 'int-11',
  276. 'name' => '支付方式',
  277. 'default' => '1',
  278. 'desc' => '支付方式',
  279. 'match' => 'is_numeric',
  280. 'update' => 'radio',
  281. 'option' => $pay_type,
  282. ),
  283. 'info' => array
  284. (
  285. 'type' => 'varchar-300',
  286. 'name' => '订单备注',
  287. 'default' => '',
  288. 'desc' => '订单备注',
  289. 'match' => 'option',
  290. 'update' => 'textarea',
  291. ),
  292. 'status' => array
  293. (
  294. 'type' => 'tinyint-1',
  295. 'name' => '状态',
  296. 'default' => '1',
  297. 'desc' => '状态',
  298. 'match' => 'is_numeric',
  299. 'option' => $status,
  300. 'search' => 'select',
  301. 'list' => true,
  302. ),
  303. 'fdate' => array
  304. (
  305. 'type' => 'int-11',
  306. 'name' => '完成时间',
  307. 'default' => '',
  308. 'match' => 'is_numeric',
  309. 'desc' => '',
  310. ),
  311. 'operdate' => array
  312. (
  313. 'type' => 'int-11',
  314. 'name' => '操作时间',
  315. 'default' => '',
  316. 'match' => 'is_numeric',
  317. 'desc' => '',
  318. ),
  319. 'state' => array
  320. (
  321. 'type' => 'tinyint-1',
  322. 'name' => '状态',
  323. 'default' => '1',
  324. 'desc' => '请选择状态',
  325. 'match' => 'is_numeric',
  326. ),
  327. 'cdate' => array
  328. (
  329. 'type' => 'int-11',
  330. 'name' => '下单时间',
  331. 'match' => array('is_numeric', time()),
  332. 'desc' => '',
  333. # 只有insert时才生效
  334. 'insert' => true,
  335. 'search' => 'date',
  336. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  337. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  338. ),
  339. ),
  340. 'manage' => array
  341. (
  342. 'delete' => false,
  343. 'edit' => false,
  344. 'insert' => false,
  345. 'button' => array
  346. (
  347. //'导出订单' => array('location', 'user/lib/manage.out'),
  348. ),
  349. 'list_button' => array
  350. (
  351. //fast_list
  352. 'list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=1"'),
  353. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  354. //'delete' => array('删除', '', '{status} == 1'),
  355. ),
  356. ),
  357. 'request' => array
  358. (
  359. 'getList' => array
  360. (
  361. # 匹配的正则或函数 选填项
  362. 'option' => array
  363. (
  364. 'shop_id' => 'yes',
  365. 'uid' => 'yes',
  366. 'status' => 'yes',
  367. 'state' => 1,
  368. ),
  369. 'type' => 'all',
  370. 'order' => array('cdate' => 'desc'),
  371. 'page' => array(5, 'list'),
  372. 'col' => '*',
  373. ),
  374. 'getAll' => array
  375. (
  376. # 匹配的正则或函数 选填项
  377. 'option' => array
  378. (
  379. 'uid' => 'yes',
  380. 'name' => array('yes', 'like'),
  381. 'shop_id' => 'yes',
  382. 'mobile' => 'yes',
  383. 'method' => 'yes',
  384. 'pay_method' => 'yes',
  385. 'start' => array('yes-cdate', '>='),
  386. 'end' => array('yes-cdate', '<='),
  387. 'status' => array('yes', 'in'),
  388. 'state' => 1,
  389. ),
  390. 'type' => 'all',
  391. 'order' => array('cdate' => 'desc'),
  392. 'page' => array(10, 'list'),
  393. 'col' => '*',
  394. ),
  395. 'getYes' => array
  396. (
  397. # 匹配的正则或函数 选填项
  398. 'option' => array
  399. (
  400. 'shop_id' => 'yes',
  401. 'state' => 1,
  402. ),
  403. 'type' => 'all',
  404. 'order' => array('cdate' => 'desc'),
  405. 'col' => '*',
  406. ),
  407. # 获取提交订单超过12个小时
  408. 'getDataByTime' => array
  409. (
  410. # 匹配的正则或函数 选填项
  411. 'option' => array
  412. (
  413. 'cdate' => array('yes', '>='),
  414. 'status' => 'yes',
  415. 'notice' => 'yes',
  416. 'note' => 'yes',
  417. 'state' => 1,
  418. ),
  419. 'type' => 'all',
  420. 'order' => array('cdate' => 'desc'),
  421. 'col' => '*',
  422. ),
  423. # 获取1,2
  424. 'getBuy' => array
  425. (
  426. # 匹配的正则或函数 选填项
  427. 'option' => array
  428. (
  429. 'status' => 'yes',
  430. 'shop_id' => 'yes',
  431. 'order_num' => 'yes',
  432. 'uid' => 'yes',
  433. 'state' => 1,
  434. ),
  435. 'type' => 'all',
  436. 'order' => array('id' => 'desc'),
  437. 'col' => '*',
  438. ),
  439. 'getMyAll' => array
  440. (
  441. # 匹配的正则或函数 选填项
  442. 'option' => array
  443. (
  444. 'uid' => 'yes',
  445. 'status' => 'yes',
  446. 'cate_id' => 'yes',
  447. 'state' => 1,
  448. ),
  449. 'type' => 'all',
  450. 'order' => array('id' => 'desc'),
  451. 'page' => array(10, 'list'),
  452. 'col' => 'id,order_num,name,buy_num,cdate,cash,shop_id,buy_id',
  453. ),
  454. # 删除未支付订单
  455. 'drop' => array
  456. (
  457. # 匹配的正则或函数 选填项
  458. 'where' => array
  459. (
  460. 'time' => array('yes-cdate', '<='),
  461. 'status' => 1,
  462. 'state' => 1,
  463. ),
  464. 'type' => 'delete',
  465. 'col' => 'id,order_num',
  466. ),
  467. # 获取数据
  468. 'getAllByDate' => array
  469. (
  470. # 匹配的正则或函数 选填项
  471. 'where' => array
  472. (
  473. 'start' => array('yes-cdate', '>='),
  474. 'end' => array('yes-cdate', '<='),
  475. ),
  476. 'type' => 'all',
  477. 'col' => 'id,order_num',
  478. ),
  479. # 获取订单数量
  480. 'getOrderNum' => array
  481. (
  482. # 匹配的正则或函数 选填项
  483. 'option' => array
  484. (
  485. 'start' => array('yes-cdate', '>='),
  486. 'end' => array('yes-cdate', '<='),
  487. 'shop_id' => 'yes',
  488. 'status' => array('yes', 'in'),
  489. 'state' => 1,
  490. ),
  491. 'type' => 'count',
  492. 'col' => '*',
  493. ),
  494. # 获取总金额
  495. 'getCashNum' => array
  496. (
  497. # 匹配的正则或函数 选填项
  498. 'option' => array
  499. (
  500. 'start' => array('yes-cdate', '>='),
  501. 'end' => array('yes-cdate', '<='),
  502. 'shop_id' => 'yes',
  503. 'status' => array('yes', 'in'),
  504. 'state' => 1,
  505. ),
  506. 'type' => 'one',
  507. 'col' => 'sum(price-refund_cash) as total',
  508. ),
  509. # 获取商品数量
  510. 'getGoodsNum' => array
  511. (
  512. # 匹配的正则或函数 选填项
  513. 'option' => array
  514. (
  515. 'start' => array('yes-cdate', '>='),
  516. 'end' => array('yes-cdate', '<='),
  517. 'shop_id' => 'yes',
  518. 'status' => array('yes', 'in'),
  519. 'state' => 1,
  520. ),
  521. 'type' => 'one',
  522. 'col' => 'sum(num) as total',
  523. ),
  524. ),
  525. );