out_order.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <?php
  2. $out_type = array
  3. (
  4. 1 => '店铺活动',
  5. 2 => '礼品赠送',
  6. 3 => '保质期到期销毁',
  7. 4 => '库存损毁',
  8. 10 => '其他',
  9. );
  10. $status = array
  11. (
  12. 1 => '待审核',
  13. 2 => '已审核',
  14. 3 => '取消',
  15. );
  16. $shop = function()
  17. {
  18. $array = array();
  19. $info = Dever::db('shop/info')->select();
  20. if($info)
  21. {
  22. $array += $info;
  23. }
  24. return $array;
  25. };
  26. $store = function()
  27. {
  28. $array = array();
  29. $info = Dever::db('store/info')->select();
  30. if($info)
  31. {
  32. $array += $info;
  33. }
  34. return $array;
  35. };
  36. # 1是门店 2是仓库
  37. $search = Dever::input('search_option_type', 1);
  38. if ($search == 1) {
  39. $search_name = '所属门店';
  40. $search_option = $shop;
  41. $search_url = 'shop/lib/manage.search';
  42. } elseif ($search == 2) {
  43. $search_name = '所属仓库';
  44. $search_option = $store;
  45. $search_url = 'store/lib/manage.search';
  46. }
  47. return array
  48. (
  49. # 表名
  50. 'name' => 'out_order',
  51. # 显示给用户看的名称
  52. 'lang' => '出库订单',
  53. 'order' => 98,
  54. 'config_type' => $out_type,
  55. 'config_status' => $status,
  56. # 数据结构
  57. 'struct' => array
  58. (
  59. 'id' => array
  60. (
  61. 'type' => 'int-11',
  62. 'name' => 'ID',
  63. 'default' => '',
  64. 'desc' => '',
  65. 'match' => 'is_numeric',
  66. 'search' => 'order',
  67. //'list' => true,
  68. ),
  69. 'type' => array
  70. (
  71. 'type' => 'int-11',
  72. 'name' => '拥有人类型',
  73. 'default' => '',
  74. 'desc' => '拥有人类型',
  75. 'search' => 'hidden',
  76. 'match' => 'is_numeric',
  77. ),
  78. 'type_id' => array
  79. (
  80. 'type' => 'int-11',
  81. 'name' => $search_name,
  82. 'default' => '',
  83. 'desc' => '拥有人',
  84. 'match' => 'is_numeric',
  85. 'search' => $search == 3 ? '' : 'select',
  86. 'option' => $search_option,
  87. //'update_search' => $search_url,
  88. 'list' => 'Dever::load("shop/lib/manage.buyInfo", "{type}", "{type_id}")',
  89. ),
  90. 'name' => array
  91. (
  92. 'type' => 'varchar-800',
  93. 'name' => '订单名称',
  94. 'default' => '',
  95. 'desc' => '订单名称',
  96. 'match' => 'is_string',
  97. 'update' => 'text',
  98. ),
  99. 'order_num' => array
  100. (
  101. 'type' => 'varchar-100',
  102. 'name' => '订单编号',
  103. 'default' => '',
  104. 'desc' => '订单编号',
  105. 'match' => 'is_string',
  106. 'update' => 'text',
  107. 'search' => 'fulltext',
  108. 'list' => true,
  109. ),
  110. 'price' => array
  111. (
  112. 'type' => 'varchar-50',
  113. 'name' => '价格',
  114. 'default' => '',
  115. 'desc' => '价格',
  116. 'match' => 'option',
  117. 'update' => 'text',
  118. 'list' => $search == 1 ? true : false,
  119. ),
  120. 'num' => array
  121. (
  122. 'type' => 'int-11',
  123. 'name' => '数量',
  124. 'default' => '',
  125. 'desc' => '数量',
  126. 'match' => 'is_numeric',
  127. 'search' => 'select',
  128. 'list' => true,
  129. ),
  130. 'info' => array
  131. (
  132. 'type' => 'varchar-300',
  133. 'name' => '订单备注',
  134. 'default' => '',
  135. 'desc' => '订单备注',
  136. 'match' => 'option',
  137. 'update' => 'textarea',
  138. ),
  139. 'member_id' => array
  140. (
  141. 'type' => 'int-11',
  142. 'name' => '操作人',
  143. 'default' => '',
  144. 'desc' => '操作人',
  145. 'match' => 'option',
  146. //'update' => 'text',
  147. ),
  148. 'out_type' => array
  149. (
  150. 'type' => 'tinyint-1',
  151. 'name' => '类型',
  152. 'default' => '1',
  153. 'desc' => '类型',
  154. 'match' => 'is_numeric',
  155. 'option' => $out_type,
  156. 'search' => 'select',
  157. 'list' => true,
  158. ),
  159. 'status' => array
  160. (
  161. 'type' => 'tinyint-1',
  162. 'name' => '状态',
  163. 'default' => '1',
  164. 'desc' => '状态',
  165. 'match' => 'is_numeric',
  166. 'option' => $status,
  167. 'search' => 'select',
  168. 'list' => true,
  169. ),
  170. 'state' => array
  171. (
  172. 'type' => 'tinyint-1',
  173. 'name' => '状态',
  174. 'default' => '1',
  175. 'desc' => '请选择状态',
  176. 'match' => 'is_numeric',
  177. ),
  178. 'cdate' => array
  179. (
  180. 'type' => 'int-11',
  181. 'name' => '出库时间',
  182. 'match' => array('is_numeric', time()),
  183. 'desc' => '',
  184. # 只有insert时才生效
  185. 'insert' => true,
  186. 'search' => 'date',
  187. 'list' => 'date("Y-m-d H:i:s", {cdate})',
  188. //'list' => 'Dever::load("service/lib/manage.showOrderTime", "{id}")',
  189. ),
  190. ),
  191. 'manage' => array
  192. (
  193. 'delete' => false,
  194. 'edit' => false,
  195. 'insert' => false,
  196. 'button' => array
  197. (
  198. //'导出订单' => array('location', 'user/lib/manage.out'),
  199. ),
  200. 'list_button' => array(
  201. //'edit' => array('退款', 'status,tk_time,tk_pic,tk_desc,tk_admin', '{status} == 2'),
  202. //'delete' => array('删除', '', '{status} == 1'),
  203. 'fast_list' => array('查看详情', '"out_order_goods&project=shop&order_id={id}&page_type=1"'),
  204. 'oper' => array('审核', '"mshop/lib/out.yes?id={type_id}&order_id={id}"', '{status} == 1 && {type} == 2'),
  205. ),
  206. ),
  207. 'request' => array
  208. (
  209. 'getAll' => array
  210. (
  211. # 匹配的正则或函数 选填项
  212. 'option' => array
  213. (
  214. 'order_num' => array('yes', 'like'),
  215. 'type' => 'yes',
  216. 'type_id' => 'yes',
  217. 'out_type' => 'yes',
  218. 'start' => array('yes-cdate', '>='),
  219. 'end' => array('yes-cdate', '<='),
  220. 'status' => array('yes', 'in'),
  221. 'state' => 1,
  222. ),
  223. 'type' => 'all',
  224. 'order' => array('cdate' => 'desc'),
  225. 'page' => array(10, 'list'),
  226. 'col' => '*',
  227. ),
  228. # 获取订单数量
  229. 'getOrderNum' => array
  230. (
  231. # 匹配的正则或函数 选填项
  232. 'option' => array
  233. (
  234. 'start' => array('yes-cdate', '>='),
  235. 'end' => array('yes-cdate', '<='),
  236. 'type' => 'yes',
  237. 'type_id' => 'yes',
  238. 'out_type' => 'yes',
  239. 'status' => array('yes', 'in'),
  240. 'state' => 1,
  241. ),
  242. 'type' => 'count',
  243. 'col' => '*',
  244. ),
  245. # 获取总金额
  246. 'getCashNum' => array
  247. (
  248. # 匹配的正则或函数 选填项
  249. 'option' => array
  250. (
  251. 'start' => array('yes-cdate', '>='),
  252. 'end' => array('yes-cdate', '<='),
  253. 'type' => 'yes',
  254. 'type_id' => 'yes',
  255. 'out_type' => 'yes',
  256. 'status' => array('yes', 'in'),
  257. 'state' => 1,
  258. ),
  259. 'type' => 'one',
  260. 'col' => 'sum(price) as total',
  261. ),
  262. # 获取商品数量
  263. 'getGoodsNum' => array
  264. (
  265. # 匹配的正则或函数 选填项
  266. 'option' => array
  267. (
  268. 'start' => array('yes-cdate', '>='),
  269. 'end' => array('yes-cdate', '<='),
  270. 'type' => 'yes',
  271. 'type_id' => 'yes',
  272. 'out_type' => 'yes',
  273. 'status' => array('yes', 'in'),
  274. 'state' => 1,
  275. ),
  276. 'type' => 'one',
  277. 'col' => 'sum(num) as total',
  278. ),
  279. ),
  280. );