sell_order.php 16 KB

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