sell_order.php 16 KB

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