buy_order.php 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. <?php
  2. $status = array
  3. (
  4. 1 => '待支付',
  5. 2 => '待审核',
  6. 3 => '待发货',
  7. 4 => '待收货确认',
  8. 5 => '已完成',
  9. 6 => '已完成(有退款)',
  10. 7 => '已取消',
  11. 8 => '已退款',
  12. 11 => '已过期',
  13. );
  14. $refund_status = array
  15. (
  16. 1 => '未申请',
  17. 2 => '已申请',
  18. );
  19. $type = Dever::config('base')->source;
  20. $shop = function()
  21. {
  22. $array = array();
  23. $info = Dever::db('shop/info')->select();
  24. if($info)
  25. {
  26. $array += $info;
  27. }
  28. return $array;
  29. };
  30. $store = function()
  31. {
  32. $array = array();
  33. $info = Dever::db('store/info')->select();
  34. if($info)
  35. {
  36. $array += $info;
  37. }
  38. return $array;
  39. };
  40. $search_option_type = Dever::input('search_option_type', 1);
  41. if ($search_option_type == 1) {
  42. $search_name = '所属门店';
  43. $search_option = $shop;
  44. $search_url = 'shop/lib/manage.search';
  45. } elseif ($search_option_type != 1) {
  46. $search_name = '所属仓库';
  47. $search_option = $store;
  48. $search_url = 'store/lib/manage.search';
  49. }
  50. return array
  51. (
  52. # 表名
  53. 'name' => 'buy_order',
  54. # 显示给用户看的名称
  55. 'lang' => '采购订单',
  56. 'order' => 99,
  57. 'status' => $status,
  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. 'type' => array
  72. (
  73. 'type' => 'int-11',
  74. 'name' => '采购人类型',
  75. 'default' => '',
  76. 'desc' => '采购人类型',
  77. 'match' => 'is_numeric',
  78. 'search' => 'hidden',
  79. ),
  80. 'type_id' => array
  81. (
  82. 'type' => 'int-11',
  83. 'name' => $search_name,
  84. 'default' => '',
  85. 'desc' => '拥有人',
  86. 'match' => 'is_numeric',
  87. 'search' => $search_option_type == 3 ? '' : 'select',
  88. 'option' => $search_option,
  89. //'update_search' => $search_url,
  90. 'list' => 'Dever::load("shop/lib/manage.buyInfo", "{type}", "{type_id}")',
  91. ),
  92. 'source_type' => array
  93. (
  94. 'type' => 'int-11',
  95. 'name' => '供货商类型',
  96. 'default' => '',
  97. 'desc' => '供货商类型',
  98. 'match' => 'is_numeric',
  99. ),
  100. 'source_id' => array
  101. (
  102. 'type' => 'int-11',
  103. 'name' => '供货商',
  104. 'default' => '',
  105. 'desc' => '供货商',
  106. 'match' => 'is_numeric',
  107. 'list' => 'Dever::load("shop/lib/manage.buyInfo", "{source_type}", "{source_id}")',
  108. ),
  109. 'name' => array
  110. (
  111. 'type' => 'varchar-800',
  112. 'name' => '订单名称',
  113. 'default' => '',
  114. 'desc' => '订单名称',
  115. 'match' => 'is_string',
  116. 'update' => 'text',
  117. ),
  118. 'parent_order_id' => array
  119. (
  120. 'type' => 'varchar-100',
  121. 'name' => '原订单编号',
  122. 'default' => '',
  123. 'desc' => '订单编号',
  124. 'match' => 'is_string',
  125. ),
  126. 'order_num' => array
  127. (
  128. 'type' => 'varchar-100',
  129. 'name' => '订单编号',
  130. 'default' => '',
  131. 'desc' => '订单编号',
  132. 'match' => 'is_string',
  133. 'update' => 'text',
  134. 'search' => 'fulltext',
  135. 'list' => true,
  136. ),
  137. 'price' => array
  138. (
  139. 'type' => 'varchar-50',
  140. 'name' => '购买价格-销售价',
  141. 'default' => '0',
  142. 'desc' => '购买价格',
  143. 'match' => 'option',
  144. 'update' => 'text',
  145. 'list' => $search_option_type == 1 ? true : false,
  146. ),
  147. 'p_price' => array
  148. (
  149. 'type' => 'varchar-50',
  150. 'name' => '购买价格-出厂价,给厂家看的',
  151. 'default' => '0',
  152. 'desc' => '购买价格',
  153. 'match' => 'option',
  154. 'update' => 'text',
  155. 'list' => $search_option_type == 2 ? true : false,
  156. ),
  157. 'num' => array
  158. (
  159. 'type' => 'int-11',
  160. 'name' => '购买数量',
  161. 'default' => '',
  162. 'desc' => '购买数量',
  163. 'match' => 'is_numeric',
  164. 'search' => 'select',
  165. 'list' => true,
  166. ),
  167. 'refund_cash' => array
  168. (
  169. 'type' => 'varchar-50',
  170. 'name' => '退款合计金额-采购价格',
  171. 'default' => '0',
  172. 'desc' => '退款合计金额',
  173. 'match' => 'option',
  174. 'update' => 'text',
  175. ),
  176. 'refund_p_cash' => array
  177. (
  178. 'type' => 'varchar-50',
  179. 'name' => '退款合计金额-出厂价格',
  180. 'default' => '0',
  181. 'desc' => '退款合计金额',
  182. 'match' => 'option',
  183. 'update' => 'text',
  184. ),
  185. 'refund_status' => array
  186. (
  187. 'type' => 'tinyint-1',
  188. 'name' => '申请退款类型',
  189. 'default' => '1',
  190. 'desc' => '申请退款类型',
  191. 'match' => 'is_numeric',
  192. 'option' => $refund_status,
  193. //'search' => 'select',
  194. ),
  195. 'info' => array
  196. (
  197. 'type' => 'varchar-300',
  198. 'name' => '订单备注',
  199. 'default' => '',
  200. 'desc' => '订单备注',
  201. 'match' => 'option',
  202. 'update' => 'textarea',
  203. ),
  204. 'status' => array
  205. (
  206. 'type' => 'tinyint-1',
  207. 'name' => '状态',
  208. 'default' => '1',
  209. 'desc' => '状态',
  210. 'match' => 'is_numeric',
  211. 'option' => $status,
  212. 'search' => 'select',
  213. 'list' => 'Dever::load("mshop/lib/buy.orderStatus", "{id}")',
  214. ),
  215. 'state' => array
  216. (
  217. 'type' => 'tinyint-1',
  218. 'name' => '状态',
  219. 'default' => '1',
  220. 'desc' => '请选择状态',
  221. 'match' => 'is_numeric',
  222. ),
  223. 'fdate' => array
  224. (
  225. 'type' => 'int-11',
  226. 'name' => '完成时间',
  227. 'default' => '',
  228. 'match' => 'is_numeric',
  229. 'desc' => '',
  230. ),
  231. 'operdate' => array
  232. (
  233. 'type' => 'int-11',
  234. 'name' => '审核时间',
  235. 'default' => '',
  236. 'match' => 'is_numeric',
  237. 'desc' => '',
  238. ),
  239. 'cdate' => array
  240. (
  241. 'type' => 'int-11',
  242. 'name' => '下单时间',
  243. 'match' => array('is_numeric', time()),
  244. 'desc' => '',
  245. # 只有insert时才生效
  246. 'insert' => true,
  247. 'search' => 'date',
  248. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  249. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  250. ),
  251. ),
  252. 'manage' => array
  253. (
  254. 'delete' => false,
  255. 'edit' => false,
  256. 'insert' => false,
  257. 'button' => array
  258. (
  259. //'导出订单' => array('location', 'user/lib/manage.out'),
  260. ),
  261. 'list_button' => array(
  262. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
  263. //'delete' => array('删除', '', '{status} == 1'),
  264. 'list' => array('查看详情', '"buy_order_goods&project=shop&order_id={id}&page_type=1"'),
  265. 'oper' => array('审核', '"mshop/lib/manage.audit?order_id={id}"', '{status} == 2'),
  266. //'oper1' => array('发货', '"mshop/lib/manage.send?order_id={id}"', '{status} == 3'),
  267. //'fast1' => array('发货', '"buy_order_ps&where_id={id}&search_option_order_id={id}&oper_save_jump=buy_order&oper_table=buy_order&oper_parent=buy_order"', '{status} == 3'),
  268. ),
  269. ),
  270. 'request' => array
  271. (
  272. 'getAll' => array
  273. (
  274. # 匹配的正则或函数 选填项
  275. 'option' => array
  276. (
  277. 'name' => array('yes', 'like'),
  278. 'order_num' => array('yes', 'like'),
  279. 'type' => 'yes',
  280. 'type_id' => 'yes',
  281. 'source_type' => 'yes',
  282. 'source_id' => 'yes',
  283. 'start' => array('yes-cdate', '>='),
  284. 'end' => array('yes-cdate', '<='),
  285. 'start_o' => array('yes-operdate', '>='),
  286. 'end_o' => array('yes-operdate', '<='),
  287. 'start_f' => array('yes-fdate', '>='),
  288. 'end_f' => array('yes-fdate', '<='),
  289. 'status' => array('yes', 'in'),
  290. 'refund_status' => 'yes',
  291. 'state' => 1,
  292. ),
  293. 'type' => 'all',
  294. 'order' => array('cdate' => 'desc'),
  295. 'page' => array(20, 'list'),
  296. 'col' => '*',
  297. ),
  298. # 获取订单数量
  299. 'getOrderNum' => array
  300. (
  301. # 匹配的正则或函数 选填项
  302. 'option' => array
  303. (
  304. 'start' => array('yes-cdate', '>='),
  305. 'end' => array('yes-cdate', '<='),
  306. 'start_o' => array('yes-operdate', '>='),
  307. 'end_o' => array('yes-operdate', '<='),
  308. 'type' => 'yes',
  309. 'type_id' => 'yes',
  310. 'source_type' => 'yes',
  311. 'source_id' => 'yes',
  312. 'status' => array('yes', 'in'),
  313. 'state' => 1,
  314. ),
  315. 'type' => 'count',
  316. 'col' => '*',
  317. ),
  318. # 获取总金额
  319. 'getCashNum' => array
  320. (
  321. # 匹配的正则或函数 选填项
  322. 'option' => array
  323. (
  324. 'start' => array('yes-cdate', '>='),
  325. 'end' => array('yes-cdate', '<='),
  326. 'start_o' => array('yes-operdate', '>='),
  327. 'end_o' => array('yes-operdate', '<='),
  328. 'type' => 'yes',
  329. 'type_id' => 'yes',
  330. 'source_type' => 'yes',
  331. 'source_id' => 'yes',
  332. 'status' => array('yes', 'in'),
  333. 'state' => 1,
  334. ),
  335. 'type' => 'one',
  336. 'col' => 'sum(price-refund_cash) as total',
  337. ),
  338. # 获取总金额
  339. 'getPCashNum' => array
  340. (
  341. # 匹配的正则或函数 选填项
  342. 'option' => array
  343. (
  344. 'start' => array('yes-cdate', '>='),
  345. 'end' => array('yes-cdate', '<='),
  346. 'start_o' => array('yes-operdate', '>='),
  347. 'end_o' => array('yes-operdate', '<='),
  348. 'type' => 'yes',
  349. 'type_id' => 'yes',
  350. 'source_type' => 'yes',
  351. 'source_id' => 'yes',
  352. 'status' => array('yes', 'in'),
  353. 'state' => 1,
  354. ),
  355. 'type' => 'one',
  356. 'col' => 'sum(p_price-refund_p_cash) as total',
  357. ),
  358. # 获取商品数量
  359. 'getGoodsNum' => array
  360. (
  361. # 匹配的正则或函数 选填项
  362. 'option' => array
  363. (
  364. 'start' => array('yes-cdate', '>='),
  365. 'end' => array('yes-cdate', '<='),
  366. 'start_o' => array('yes-operdate', '>='),
  367. 'end_o' => array('yes-operdate', '<='),
  368. 'type' => 'yes',
  369. 'type_id' => 'yes',
  370. 'source_type' => 'yes',
  371. 'source_id' => 'yes',
  372. 'status' => array('yes', 'in'),
  373. 'state' => 1,
  374. ),
  375. 'type' => 'one',
  376. 'col' => 'sum(num) as total',
  377. ),
  378. # 获取提交订单超过12个小时
  379. 'getDataByTime' => array
  380. (
  381. # 匹配的正则或函数 选填项
  382. 'option' => array
  383. (
  384. 'cdate' => array('yes', '<='),
  385. 'status' => 'yes',
  386. 'notice' => 'yes',
  387. 'state' => 1,
  388. ),
  389. 'type' => 'all',
  390. 'order' => array('cdate' => 'desc'),
  391. 'col' => '*',
  392. ),
  393. ),
  394. );