sell_order.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  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. $status = array
  15. (
  16. 1 => '待支付',//买家待支付
  17. 2 => '待处理',//买家已支付,待商家处理
  18. 3 => '配送中',//商家已处理,配送中或者已配货
  19. 4 => '已完成',//买家已确认
  20. 5 => '已取消',//买家已取消
  21. 6 => '已退款',//买家退款,当status==2时,买家可以申请退款
  22. 7 => '仅退款',//商家退款
  23. 8 => '退货退款',//商家退款
  24. 11 => '已过期',//长时间未支付,自动过期
  25. );
  26. //1待支付2支付成功3处理中4已完成5已取消6已退款7仅退款8退货退款11已过期
  27. return array
  28. (
  29. # 表名
  30. 'name' => 'sell_order',
  31. # 显示给用户看的名称
  32. 'lang' => '销售订单',
  33. 'order' => 100,
  34. 'status' => $status,
  35. 'pay_method' => $pay_method,
  36. 'method' => $method,
  37. # 数据结构
  38. 'struct' => array
  39. (
  40. 'id' => array
  41. (
  42. 'type' => 'int-11',
  43. 'name' => 'ID',
  44. 'default' => '',
  45. 'desc' => '',
  46. 'match' => 'is_numeric',
  47. 'search' => 'order',
  48. //'list' => true,
  49. ),
  50. 'shop_id' => array
  51. (
  52. 'type' => 'int-11',
  53. 'name' => '所属门店',
  54. 'default' => '',
  55. 'desc' => '所属门店',
  56. 'match' => 'is_numeric',
  57. //'search' => '',
  58. 'update' => 'hidden',
  59. 'value' => Dever::input('search_option_shop_id'),
  60. 'list' => 'Dever::load("shop/info-find#name", {shop_id})',
  61. ),
  62. 'uid' => array
  63. (
  64. 'type' => 'int-11',
  65. 'name' => '购买人名称',
  66. 'default' => '0',
  67. 'desc' => '请选择用户',
  68. 'match' => 'is_numeric',
  69. 'update' => 'text',
  70. //'search' => 'select',
  71. 'search' => array
  72. (
  73. 'api' => 'passport/user-select',
  74. 'col' => 'username',
  75. 'result' => 'id',
  76. ),
  77. 'list' => 'Dever::load("shop/lib/manage.user", {id})',
  78. ),
  79. 'mobile' => array
  80. (
  81. 'type' => 'varchar-300',
  82. 'name' => '下单手机号',
  83. 'default' => '',
  84. 'desc' => '手机号',
  85. 'match' => 'option',
  86. 'search' => array
  87. (
  88. 'api' => 'passport/user-select',//接口地址,最好是获取多条数据的地址
  89. 'col' => 'mobile',//要查询的字段
  90. 'result' => 'id',//返回的字段
  91. 'search' => 'uid',//本表的字段,默认为当前的字段
  92. ),
  93. ),
  94. 'address_id' => array
  95. (
  96. 'type' => 'int-11',
  97. 'name' => '送货地址',
  98. 'default' => '',
  99. 'desc' => '送货地址',
  100. 'match' => 'is_numeric',
  101. //'list' => 'Dever::load("passport/address-find#address", {address_id})';
  102. ),
  103. 'invoice_id' => array
  104. (
  105. 'type' => 'int-11',
  106. 'name' => '发票信息',
  107. 'default' => '',
  108. 'desc' => '发票信息',
  109. 'match' => 'is_numeric',
  110. //'list' => 'Dever::load("passport/address-find#address", {address_id})';
  111. ),
  112. 'name' => array
  113. (
  114. 'type' => 'varchar-80',
  115. 'name' => '订单名称',
  116. 'default' => '',
  117. 'desc' => '订单名称',
  118. 'match' => 'is_string',
  119. 'update' => 'text',
  120. ),
  121. 'order_num' => array
  122. (
  123. 'type' => 'varchar-100',
  124. 'name' => '订单号',
  125. 'default' => '',
  126. 'desc' => '订单号',
  127. 'match' => 'is_string',
  128. 'update' => 'text',
  129. 'search' => 'fulltext',
  130. 'list' => true,
  131. ),
  132. 'price' => array
  133. (
  134. 'type' => 'varchar-50',
  135. 'name' => '付款金额',
  136. 'default' => '',
  137. 'desc' => '付款金额',
  138. 'match' => 'option',
  139. 'update' => 'text',
  140. 'list' => true,
  141. ),
  142. 'num' => array
  143. (
  144. 'type' => 'int-11',
  145. 'name' => '购买数量',
  146. 'default' => '',
  147. 'desc' => '购买数量',
  148. 'match' => 'is_numeric',
  149. 'search' => 'select',
  150. //'list' => true,
  151. ),
  152. 'card_code_id' => array
  153. (
  154. 'type' => 'int-11',
  155. 'name' => '礼品卡id',
  156. 'default' => '',
  157. 'desc' => '礼品卡id',
  158. 'match' => 'option',
  159. ),
  160. 'user_coupon_id' => array
  161. (
  162. 'type' => 'int-11',
  163. 'name' => '用户的优惠券id',
  164. 'default' => '',
  165. 'desc' => '用户的优惠券id',
  166. 'match' => 'option',
  167. ),
  168. 'method' => array
  169. (
  170. 'type' => 'int-11',
  171. 'name' => '配送类型',
  172. 'default' => '1',
  173. 'desc' => '配送类型',
  174. 'match' => 'is_numeric',
  175. 'update' => 'radio',
  176. 'option' => $method,
  177. ),
  178. 'code' => array
  179. (
  180. 'type' => 'varchar-100',
  181. 'name' => '自提码或者核销码',
  182. 'default' => '',
  183. 'desc' => '自提码或者核销码',
  184. 'match' => 'is_numeric',
  185. ),
  186. 'pay_method' => array
  187. (
  188. 'type' => 'int-11',
  189. 'name' => '支付类型',
  190. 'default' => '1',
  191. 'desc' => '支付类型',
  192. 'match' => 'is_numeric',
  193. 'update' => 'radio',
  194. 'option' => $pay_method,
  195. 'list' => true,
  196. ),
  197. 'info' => array
  198. (
  199. 'type' => 'varchar-300',
  200. 'name' => '订单备注',
  201. 'default' => '',
  202. 'desc' => '订单备注',
  203. 'match' => 'option',
  204. 'update' => 'textarea',
  205. ),
  206. 'area' => array
  207. (
  208. 'type' => 'varchar-500',
  209. 'name' => '所在地区',
  210. 'default' => '',
  211. 'desc' => '所在地区',
  212. 'match' => 'option',
  213. 'search' => 'linkage',
  214. 'option' => Dever::url('api.get?level_total=4', 'area'),
  215. ),
  216. 'province' => array
  217. (
  218. 'type' => 'int-11',
  219. 'name' => '省份',
  220. 'default' => '',
  221. 'desc' => '省份',
  222. 'match' => 'option',
  223. //'update' => 'text',
  224. ),
  225. 'city' => array
  226. (
  227. 'type' => 'int-11',
  228. 'name' => '城市',
  229. 'default' => '',
  230. 'desc' => '城市',
  231. 'match' => 'option',
  232. //'update' => 'text',
  233. ),
  234. 'county' => array
  235. (
  236. 'type' => 'int-11',
  237. 'name' => '县区',
  238. 'default' => '',
  239. 'desc' => '县区',
  240. 'match' => 'option',
  241. //'update' => 'text',
  242. ),
  243. 'town' => array
  244. (
  245. 'type' => 'int-11',
  246. 'name' => '街道',
  247. 'default' => '',
  248. 'desc' => '街道',
  249. 'match' => 'option',
  250. //'update' => 'text',
  251. ),
  252. 'status' => array
  253. (
  254. 'type' => 'tinyint-1',
  255. 'name' => '状态',
  256. 'default' => '1',
  257. 'desc' => '状态',
  258. 'match' => 'is_numeric',
  259. 'option' => $status,
  260. 'search' => 'select',
  261. 'list' => true,
  262. ),
  263. 'state' => array
  264. (
  265. 'type' => 'tinyint-1',
  266. 'name' => '状态',
  267. 'default' => '1',
  268. 'desc' => '请选择状态',
  269. 'match' => 'is_numeric',
  270. ),
  271. 'cdate' => array
  272. (
  273. 'type' => 'int-11',
  274. 'name' => '下单时间',
  275. 'match' => array('is_numeric', time()),
  276. 'desc' => '',
  277. # 只有insert时才生效
  278. 'insert' => true,
  279. 'search' => 'date',
  280. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  281. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  282. ),
  283. ),
  284. 'manage' => array
  285. (
  286. 'delete' => false,
  287. 'edit' => false,
  288. 'insert' => false,
  289. 'button' => array
  290. (
  291. //'导出订单' => array('location', 'user/lib/manage.out'),
  292. ),
  293. 'list_button' => array
  294. (
  295. 'fast_list' => array('查看详情', '"sell_order_goods&project=shop&order_id={id}&page_type=1"'),
  296. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin,tk_status', '{status} == 6'),
  297. //'delete' => array('删除', '', '{status} == 1'),
  298. ),
  299. ),
  300. 'request' => array
  301. (
  302. 'getList' => array
  303. (
  304. # 匹配的正则或函数 选填项
  305. 'option' => array
  306. (
  307. 'shop_id' => 'yes',
  308. 'uid' => 'yes',
  309. 'status' => 'yes',
  310. 'state' => 1,
  311. ),
  312. 'type' => 'all',
  313. 'order' => array('cdate' => 'desc'),
  314. 'page' => array(5, 'list'),
  315. 'col' => '*',
  316. ),
  317. 'getAll' => array
  318. (
  319. # 匹配的正则或函数 选填项
  320. 'option' => array
  321. (
  322. 'uid' => 'yes',
  323. 'status' => 'yes',
  324. 'state' => 1,
  325. ),
  326. 'type' => 'all',
  327. 'order' => array('cdate' => 'desc'),
  328. 'page' => array(10, 'list'),
  329. 'col' => '*',
  330. ),
  331. 'getYes' => array
  332. (
  333. # 匹配的正则或函数 选填项
  334. 'option' => array
  335. (
  336. 'shop_id' => 'yes',
  337. 'state' => 1,
  338. ),
  339. 'type' => 'all',
  340. 'order' => array('cdate' => 'desc'),
  341. 'col' => '*',
  342. ),
  343. # 获取提交订单超过12个小时
  344. 'getDataByTime' => array
  345. (
  346. # 匹配的正则或函数 选填项
  347. 'option' => array
  348. (
  349. 'cdate' => array('yes', '>='),
  350. 'notice' => 'yes',
  351. 'note' => 'yes',
  352. 'state' => 1,
  353. ),
  354. 'type' => 'all',
  355. 'order' => array('cdate' => 'desc'),
  356. 'col' => '*',
  357. ),
  358. # 获取1,2
  359. 'getBuy' => array
  360. (
  361. # 匹配的正则或函数 选填项
  362. 'option' => array
  363. (
  364. 'status' => 'yes',
  365. 'shop_id' => 'yes',
  366. 'order_num' => 'yes',
  367. 'uid' => 'yes',
  368. 'state' => 1,
  369. ),
  370. 'type' => 'all',
  371. 'order' => array('id' => 'desc'),
  372. 'col' => '*',
  373. ),
  374. 'getMyAll' => array
  375. (
  376. # 匹配的正则或函数 选填项
  377. 'option' => array
  378. (
  379. 'uid' => 'yes',
  380. 'status' => 'yes',
  381. 'cate_id' => 'yes',
  382. 'state' => 1,
  383. ),
  384. 'type' => 'all',
  385. 'order' => array('id' => 'desc'),
  386. 'page' => array(10, 'list'),
  387. 'col' => 'id,order_num,name,buy_num,cdate,cash,shop_id,buy_id',
  388. ),
  389. # 删除未支付订单
  390. 'drop' => array
  391. (
  392. # 匹配的正则或函数 选填项
  393. 'where' => array
  394. (
  395. 'time' => array('yes-cdate', '<='),
  396. 'status' => 1,
  397. 'state' => 1,
  398. ),
  399. 'type' => 'delete',
  400. 'col' => 'id,order_num',
  401. ),
  402. # 获取数据
  403. 'getAllByDate' => array
  404. (
  405. # 匹配的正则或函数 选填项
  406. 'where' => array
  407. (
  408. 'start' => array('yes-cdate', '>='),
  409. 'end' => array('yes-cdate', '<='),
  410. ),
  411. 'type' => 'all',
  412. 'col' => 'id,order_num',
  413. ),
  414. # 获取订单数量
  415. 'getOrderNum' => array
  416. (
  417. # 匹配的正则或函数 选填项
  418. 'option' => array
  419. (
  420. 'start' => array('yes-cdate', '>='),
  421. 'end' => array('yes-cdate', '<='),
  422. 'shop_id' => 'yes',
  423. 'status' => array('yes', 'in'),
  424. 'state' => 1,
  425. ),
  426. 'type' => 'count',
  427. 'col' => '*',
  428. ),
  429. # 获取总金额
  430. 'getCashNum' => array
  431. (
  432. # 匹配的正则或函数 选填项
  433. 'option' => array
  434. (
  435. 'start' => array('yes-cdate', '>='),
  436. 'end' => array('yes-cdate', '<='),
  437. 'shop_id' => 'yes',
  438. 'status' => array('yes', 'in'),
  439. 'state' => 1,
  440. ),
  441. 'type' => 'one',
  442. 'col' => 'sum(price) as total',
  443. ),
  444. # 获取商品数量
  445. 'getGoodsNum' => array
  446. (
  447. # 匹配的正则或函数 选填项
  448. 'option' => array
  449. (
  450. 'start' => array('yes-cdate', '>='),
  451. 'end' => array('yes-cdate', '<='),
  452. 'shop_id' => 'yes',
  453. 'status' => array('yes', 'in'),
  454. 'state' => 1,
  455. ),
  456. 'type' => 'one',
  457. 'col' => 'sum(num) as total',
  458. ),
  459. ),
  460. );