out_order.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. <?php
  2. $status = array
  3. (
  4. 1 => '待审核',
  5. 2 => '已审核',
  6. 3 => '取消',
  7. );
  8. $shop = function()
  9. {
  10. $array = array();
  11. $info = Dever::db('shop/info')->select();
  12. if($info)
  13. {
  14. $array += $info;
  15. }
  16. return $array;
  17. };
  18. $store = function()
  19. {
  20. $array = array();
  21. $info = Dever::db('store/info')->select();
  22. if($info)
  23. {
  24. $array += $info;
  25. }
  26. return $array;
  27. };
  28. # 1是门店 2是仓库
  29. $search = Dever::input('search_option_type', 1);
  30. if ($search == 1) {
  31. $search_name = '门店名称';
  32. $search_option = $shop;
  33. $search_url = 'shop/lib/manage.search';
  34. $out_type = function()
  35. {
  36. $array = array();
  37. $info = Dever::db('shop/out_type')->getAll(array('type' => '1,10'));
  38. if($info)
  39. {
  40. $array += $info;
  41. }
  42. return $array;
  43. };
  44. $search_table = 'shop';
  45. $excel = array
  46. (
  47. array('导出订单', '门店出库订单', ''),
  48. array('导出订单明细', '门店出库订单明细', 'shop/excel.out_order'),
  49. );
  50. } elseif ($search != 1) {
  51. $search_name = '仓库名称';
  52. $search_option = $store;
  53. $search_url = 'store/lib/manage.search';
  54. $out_type = function()
  55. {
  56. $array = array();
  57. $info = Dever::db('shop/out_type')->getAll(array('type' => '2,10'));
  58. if($info)
  59. {
  60. $array += $info;
  61. }
  62. return $array;
  63. };
  64. $search_table = 'store';
  65. $excel = array
  66. (
  67. array('导出订单', '仓库出库订单', ''),
  68. array('导出订单明细', '仓库出库订单明细', 'shop/excel.store_out_order'),
  69. );
  70. }
  71. return array
  72. (
  73. # 表名
  74. 'name' => 'out_order',
  75. # 显示给用户看的名称
  76. 'lang' => '出库订单',
  77. 'order' => 98,
  78. 'config_type' => $out_type,
  79. 'config_status' => $status,
  80. # 数据结构
  81. 'struct' => array
  82. (
  83. 'id' => array
  84. (
  85. 'type' => 'int-11',
  86. 'name' => 'ID',
  87. 'default' => '',
  88. 'desc' => '',
  89. 'match' => 'is_numeric',
  90. 'search' => 'order',
  91. //'list' => true,
  92. ),
  93. 'type' => array
  94. (
  95. 'type' => 'int-11',
  96. 'name' => '拥有人类型',
  97. 'default' => '',
  98. 'desc' => '拥有人类型',
  99. 'search' => 'hidden',
  100. 'match' => 'is_numeric',
  101. ),
  102. 'type_id' => array
  103. (
  104. 'type' => 'int-11',
  105. 'name' => $search_name,
  106. 'default' => '',
  107. 'desc' => '拥有人',
  108. 'match' => 'is_numeric',
  109. //'search' => $search == 3 ? '' : 'select',
  110. 'search' => $search == 3 ? '' : array
  111. (
  112. 'api' => $search_table . '/info-like',
  113. 'col' => 'name',
  114. 'result' => 'id',
  115. ),
  116. //'option' => $search_option,
  117. //'update_search' => $search_url,
  118. 'list' => 'Dever::load("shop/lib/manage.buyInfo", "{type}", "{type_id}")',
  119. 'list_order' => 2,
  120. ),
  121. 'shop-info-sid'=> array
  122. (
  123. 'name' => '门店编号',
  124. 'default' => '',
  125. 'desc' => '门店编号',
  126. 'match' => 'option',
  127. # 读取另外表的关联方式
  128. 'sync' => array('type_id', 'id'),
  129. 'list' => $search == 1 ? true : false,
  130. 'list_order' => 1,
  131. ),
  132. 'shop-info-type'=> array
  133. (
  134. 'name' => '门店类型',
  135. 'default' => '',
  136. 'desc' => '门店类型',
  137. 'match' => 'option',
  138. # 读取另外表的关联方式
  139. 'sync' => array('type_id', 'id'),
  140. 'list' => $search == 1 ? 'Dever::load("shop/lib/manage.shopInfoType", {shop-info-type})' : false,
  141. 'list_order' => 3,
  142. ),
  143. 'area' => array
  144. (
  145. 'type' => 'varchar-500',
  146. 'name' => '所在街道',
  147. 'default' => '',
  148. 'desc' => '所在街道',
  149. 'match' => 'option',
  150. 'search' => 'linkage',
  151. 'update' => 'linkage',
  152. 'option' => Dever::url('lib/area.get', $search_table),
  153. //'list' => 'Dever::load("area/api.string", "{area}")',
  154. ),
  155. 'name' => array
  156. (
  157. 'type' => 'varchar-800',
  158. 'name' => '订单名称',
  159. 'default' => '',
  160. 'desc' => '订单名称',
  161. 'match' => 'is_string',
  162. 'update' => 'text',
  163. ),
  164. 'order_num' => array
  165. (
  166. 'type' => 'varchar-100',
  167. 'name' => '出库单号',
  168. 'default' => '',
  169. 'desc' => '出库单号',
  170. 'match' => 'is_string',
  171. 'update' => 'text',
  172. 'search' => 'fulltext',
  173. 'list' => true,
  174. 'list_order' => 4,
  175. ),
  176. 'price' => array
  177. (
  178. 'type' => 'varchar-50',
  179. 'name' => '出库总金额',
  180. 'default' => '',
  181. 'desc' => '出库总金额',
  182. 'match' => 'option',
  183. 'update' => 'text',
  184. 'list_name' => $search == 1 ? '出库总金额' : '出库总金额',
  185. 'list' => $search == 1 ? true : true,
  186. 'list_order' => 5,
  187. ),
  188. 'num' => array
  189. (
  190. 'type' => 'int-11',
  191. 'name' => '出库数量',
  192. 'default' => '',
  193. 'desc' => '出库数量',
  194. 'match' => 'is_numeric',
  195. 'search' => 'select',
  196. 'list' => true,
  197. 'list_order' => 5,
  198. ),
  199. 'info' => array
  200. (
  201. 'type' => 'varchar-300',
  202. 'name' => '订单备注',
  203. 'default' => '',
  204. 'desc' => '订单备注',
  205. 'match' => 'option',
  206. 'update' => 'textarea',
  207. ),
  208. 'member_id' => array
  209. (
  210. 'type' => 'int-11',
  211. 'name' => '操作人',
  212. 'default' => '',
  213. 'desc' => '操作人',
  214. 'match' => 'option',
  215. //'update' => 'text',
  216. ),
  217. 'out_type' => array
  218. (
  219. 'type' => 'int-11',
  220. 'name' => '出库类型',
  221. 'default' => '1',
  222. 'desc' => '类型',
  223. 'match' => 'is_numeric',
  224. 'option' => $out_type,
  225. 'search' => 'select',
  226. 'list' => true,
  227. 'list_order' => 7,
  228. ),
  229. 'status' => array
  230. (
  231. 'type' => 'tinyint-1',
  232. 'name' => '出库状态',
  233. 'default' => '1',
  234. 'desc' => '状态',
  235. 'match' => 'is_numeric',
  236. 'option' => $status,
  237. 'search' => 'select',
  238. 'list' => true,
  239. 'list_order' => 8,
  240. ),
  241. 'state' => array
  242. (
  243. 'type' => 'tinyint-1',
  244. 'name' => '状态',
  245. 'default' => '1',
  246. 'desc' => '请选择状态',
  247. 'match' => 'is_numeric',
  248. ),
  249. 'cdate' => array
  250. (
  251. 'type' => 'int-11',
  252. 'name' => '出库日期',
  253. 'match' => array('is_numeric', time()),
  254. 'desc' => '',
  255. # 只有insert时才生效
  256. 'insert' => true,
  257. 'search' => 'sdate',
  258. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  259. 'list_order' => 6,
  260. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  261. ),
  262. ),
  263. 'alter' => array
  264. (
  265. 2 => array
  266. (
  267. array('update', 'out_type', 'out_type', 'int-11 1 出库类型'),
  268. ),
  269. 3 => array
  270. (
  271. array('update', 'num', 'num', 'float-11,2 0 出库数量'),
  272. ),
  273. 'version' => 3,
  274. ),
  275. 'manage' => array
  276. (
  277. 'delete' => false,
  278. 'edit' => false,
  279. 'insert' => false,
  280. 'excel' => 'mshop/lib/out.excel',
  281. 'excel' => $excel,
  282. 'button' => array
  283. (
  284. //'导出订单' => array('excel', 'mshop/lib/out.excel'),
  285. ),
  286. 'list_button' => array(
  287. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
  288. //'delete' => array('删除', '', '{status} == 1'),
  289. //'fast_list' => array('查看详情', '"out_order_goods&project=shop&order_id={id}&page_type=1"'),
  290. 'list' => array('查看详情', '"out_order_goods&project=shop&order_id={id}&page_type=1"'),
  291. 'oper' => array('审核', '"mshop/lib/out.yes?id={type_id}&order_id={id}"', '{status} == 1 && {type} == 2'),
  292. 'location' => array('导出', Dever::url('mshop/lib/out.excel_one?type='.$search)),
  293. ),
  294. ),
  295. 'request' => array
  296. (
  297. 'getAll' => array
  298. (
  299. # 匹配的正则或函数 选填项
  300. 'option' => array
  301. (
  302. 'order_num' => array('yes', 'like'),
  303. 'type' => 'yes',
  304. 'type_id' => 'yes',
  305. 'out_type' => 'yes',
  306. 'start' => array('yes-cdate', '>='),
  307. 'end' => array('yes-cdate', '<='),
  308. 'status' => array('yes', 'in'),
  309. 'state' => 1,
  310. ),
  311. 'type' => 'all',
  312. 'order' => array('cdate' => 'desc'),
  313. 'page' => array(10, 'list'),
  314. 'col' => '*',
  315. ),
  316. 'getData' => array
  317. (
  318. # 匹配的正则或函数 选填项
  319. 'option' => array
  320. (
  321. 'order_num' => array('yes', 'like'),
  322. 'type' => 'yes',
  323. 'type_id' => 'yes',
  324. 'out_type' => 'yes',
  325. 'start' => array('yes-cdate', '>='),
  326. 'end' => array('yes-cdate', '<='),
  327. 'status' => array('yes', 'in'),
  328. 'state' => 1,
  329. ),
  330. 'type' => 'all',
  331. 'order' => array('cdate' => 'desc'),
  332. 'col' => '*',
  333. ),
  334. # 获取订单数量
  335. 'getOrderNum' => array
  336. (
  337. # 匹配的正则或函数 选填项
  338. 'option' => array
  339. (
  340. 'start' => array('yes-cdate', '>='),
  341. 'end' => array('yes-cdate', '<='),
  342. 'type' => 'yes',
  343. 'type_id' => 'yes',
  344. 'out_type' => 'yes',
  345. 'status' => array('yes', 'in'),
  346. 'state' => 1,
  347. ),
  348. 'type' => 'count',
  349. 'col' => '*',
  350. ),
  351. # 获取总金额
  352. 'getCashNum' => array
  353. (
  354. # 匹配的正则或函数 选填项
  355. 'option' => array
  356. (
  357. 'start' => array('yes-cdate', '>='),
  358. 'end' => array('yes-cdate', '<='),
  359. 'type' => 'yes',
  360. 'type_id' => 'yes',
  361. 'out_type' => 'yes',
  362. 'status' => array('yes', 'in'),
  363. 'state' => 1,
  364. ),
  365. 'type' => 'one',
  366. 'col' => 'sum(price) as total',
  367. ),
  368. # 获取商品数量
  369. 'getGoodsNum' => array
  370. (
  371. # 匹配的正则或函数 选填项
  372. 'option' => array
  373. (
  374. 'start' => array('yes-cdate', '>='),
  375. 'end' => array('yes-cdate', '<='),
  376. 'type' => 'yes',
  377. 'type_id' => 'yes',
  378. 'out_type' => 'yes',
  379. 'status' => array('yes', 'in'),
  380. 'state' => 1,
  381. ),
  382. 'type' => 'one',
  383. 'col' => 'sum(num) as total',
  384. ),
  385. ),
  386. );