store_goods_sku.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'store_goods_sku',
  6. # 显示给用户看的名称
  7. 'lang' => '商品价格设置',
  8. 'order' => 200,
  9. 'menu' => false,
  10. # 数据结构 不同的字段放这里
  11. 'struct' => array
  12. (
  13. 'id' => array
  14. (
  15. 'type' => 'int-11',
  16. 'name' => 'ID',
  17. 'default' => '',
  18. 'desc' => '',
  19. 'match' => 'is_numeric',
  20. //'list' => true,
  21. ),
  22. 'servicer_store_id' => array
  23. (
  24. 'type' => 'int-11',
  25. 'name' => '所属配送商',
  26. 'default' => '',
  27. 'desc' => '所属配送商',
  28. 'match' => 'is_numeric',
  29. 'update' => 'hidden',
  30. 'search' => 'hidden',
  31. 'value' => Dever::input('search_option_servicer_store_id'),
  32. 'list' => 'Dever::load("scm_servicer/store-one#name", {servicer_store_id})',
  33. ),
  34. 'goods-info_sku-code'=> array
  35. (
  36. 'name' => '商品编码',
  37. 'default' => '',
  38. 'desc' => '商品编码',
  39. 'match' => 'option',
  40. # 读取另外表的关联方式
  41. 'sync' => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
  42. 'list' => true,
  43. 'list_order' => 4,
  44. ),
  45. 'goods_id' => array
  46. (
  47. 'type' => 'int-11',
  48. 'name' => '商品名称',
  49. 'default' => '',
  50. 'desc' => '商品名称',
  51. 'match' => 'is_numeric',
  52. 'update' => 'select',
  53. 'update_search' => 'scm_product/lib/manage.search',
  54. 'list' => 'Dever::load("scm_product/info-one#name", {goods_id})',
  55. ),
  56. 'sku_id' => array
  57. (
  58. 'type' => 'int-11',
  59. 'name' => '规格型号',
  60. 'default' => '-1',
  61. 'desc' => '规格型号',
  62. 'match' => 'is_numeric',
  63. ),
  64. 'batch' => array
  65. (
  66. 'type' => 'varchar-800',
  67. 'name' => '入库批次号',
  68. 'default' => '',
  69. 'desc' => '入库批次号',
  70. 'match' => 'option',
  71. ),
  72. 'cash' => array
  73. (
  74. 'type' => 'decimal-11,2',
  75. 'name' => '入库单价',
  76. 'default' => '',
  77. 'desc' => '入库单价',
  78. 'match' => 'option',
  79. ),
  80. 'in_num' => array
  81. (
  82. 'type' => 'decimal-11,2',
  83. 'name' => '入库库存',
  84. 'default' => '0',
  85. 'desc' => '入库库存',
  86. 'match' => 'is_numeric',
  87. ),
  88. 'out_num' => array
  89. (
  90. 'type' => 'decimal-11,2',
  91. 'name' => '出库库存',
  92. 'default' => '0',
  93. 'desc' => '出库库存',
  94. 'match' => 'option',
  95. ),
  96. 'on_num' => array
  97. (
  98. 'type' => 'decimal-11,2',
  99. 'name' => '在途库存',
  100. 'default' => '0',
  101. 'desc' => '在途库存',
  102. 'match' => 'is_numeric',
  103. ),
  104. 'state' => array
  105. (
  106. 'type' => 'tinyint-1',
  107. 'name' => '数据状态',
  108. 'default' => '1',
  109. 'desc' => '请选择状态',
  110. 'match' => 'is_numeric',
  111. ),
  112. 'cdate' => array
  113. (
  114. 'type' => 'int-11',
  115. 'name' => '发布时间',
  116. 'match' => array('is_numeric', time()),
  117. 'desc' => '',
  118. # 只有insert时才生效
  119. 'insert' => true,
  120. //'search' => 'date',
  121. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  122. ),
  123. ),
  124. 'manage' => array
  125. (
  126. 'insert' => false,
  127. 'edit' => false,
  128. 'delete' => false,
  129. //'excel' => array(array('导出门店库存', '门店库存', '')),
  130. 'page_list_table' => 'sku',
  131. ),
  132. # request 请求接口定义
  133. 'request' => array
  134. (
  135. # 后台搜索用到,也可以不加,自动生成
  136. 'search' => array
  137. (
  138. # 匹配的正则或函数 选填项
  139. 'option' => array
  140. (
  141. 'name' => array('yes-t_2.name', 'like'),
  142. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  143. 'status' => 'yes-t_2.status-1',
  144. 'state' => 'yes-t_2.state-1',
  145. 'state_1' => 'yes-t_1.state-1',
  146. ),
  147. # 联表
  148. 'join' => array
  149. (
  150. array
  151. (
  152. 'table' => 'scm_product/info',
  153. 'type' => 'left join',
  154. 'on' => array('goods_id','id'),
  155. 'col' => 'goods_id',
  156. ),
  157. ),
  158. 'type' => 'all',
  159. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  160. 'col' => '*,t_2.*,t_2.id as value, "" as selected, "" as disabled',
  161. ),
  162. 'getDataPage' => array
  163. (
  164. # 匹配的正则或函数 选填项
  165. 'option' => array
  166. (
  167. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  168. 'name' => array('yes-t_2.name', 'like'),
  169. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  170. 'category' => array('yes-t_2.category', 'like'),
  171. 'top_category_id' => array('yes-t_2.top_category_id'),
  172. 'second_category_id' => array('yes-t_2.second_category_id'),
  173. 'category_id' => array('yes-t_2.category_id'),
  174. 'status' => array('yes-t_2.status', 1),
  175. 'state' => array('yes-t_2.state', 1),
  176. 'state_1' => array('yes-t_1.state', 1),
  177. ),
  178. # 联表
  179. 'join' => array
  180. (
  181. array
  182. (
  183. 'table' => 'scm_product/info',
  184. 'type' => 'left join',
  185. 'on' => array('goods_id','id'),
  186. 'col' => 'goods_id',
  187. ),
  188. ),
  189. 'type' => 'all',
  190. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  191. 'page' => array(30, 'list'),
  192. 'col' => '*,t_2.name,t_2.pic,t_2.video,t_2.id as id,t_1.in_num-t_1.out_num as total,t_1.out_num',
  193. ),
  194. 'getData' => array
  195. (
  196. # 匹配的正则或函数 选填项
  197. 'option' => array
  198. (
  199. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  200. 'name' => array('yes-t_2.name', 'like'),
  201. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  202. 'category' => array('yes-t_2.category', 'like'),
  203. 'top_category_id' => array('yes-t_2.top_category_id'),
  204. 'second_category_id' => array('yes-t_2.second_category_id'),
  205. 'category_id' => array('yes-t_2.category_id'),
  206. 'status' => array('yes-t_2.status', 1),
  207. 'state' => array('yes-t_2.state', 1),
  208. 'state_1' => array('yes-t_1.state', 1),
  209. ),
  210. # 联表
  211. 'join' => array
  212. (
  213. array
  214. (
  215. 'table' => 'scm_product/info',
  216. 'type' => 'left join',
  217. 'on' => array('goods_id','id'),
  218. 'col' => 'goods_id',
  219. ),
  220. ),
  221. 'type' => 'all',
  222. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  223. 'col' => '*,t_2.name,t_2.pic,t_2.video,t_2.id as id,t_1.in_num-t_1.out_num as total,t_1.out_num,t_1.in_num,t_2.type,t_2.stock,t_2.commission,t_2.sell_type,t_2.buy_type',
  224. ),
  225. # 列表
  226. 'getList' => array
  227. (
  228. # 匹配的正则或函数 选填项
  229. 'option' => array
  230. (
  231. 'servicer_store_id' => 'yes',
  232. 'goods_id' => 'yes',
  233. 'sku_id' => 'yes',
  234. 'state' => 1,
  235. ),
  236. 'type' => 'all',
  237. 'order' => array('id' => 'desc'),
  238. 'col' => '*,in_num-out_num as total|sku_id',
  239. ),
  240. # 获取单条数据
  241. 'getOne' => array
  242. (
  243. # 匹配的正则或函数 选填项
  244. 'option' => array
  245. (
  246. 'servicer_store_id' => 'yes',
  247. 'goods_id' => 'yes',
  248. 'sku_id' => 'yes',
  249. 'state' => 1,
  250. ),
  251. 'type' => 'one',
  252. 'col' => '*,in_num-out_num as total',
  253. ),
  254. # 更新入库库存
  255. 'inUpdate' => array
  256. (
  257. 'type' => 'update',
  258. 'where' => array
  259. (
  260. 'id' => 'yes',
  261. ),
  262. 'set' => array
  263. (
  264. 'in_num' => array('yes', '+='),
  265. ),
  266. ),
  267. # 更新出库库存
  268. 'outUpdate' => array
  269. (
  270. 'type' => 'update',
  271. 'where' => array
  272. (
  273. 'id' => 'yes',
  274. ),
  275. 'set' => array
  276. (
  277. 'out_num' => array('yes', '+='),
  278. ),
  279. ),
  280. # 更新在途库存
  281. 'onUpdate' => array
  282. (
  283. 'type' => 'update',
  284. 'where' => array
  285. (
  286. 'id' => 'yes',
  287. ),
  288. 'set' => array
  289. (
  290. 'on_num' => array('yes', '+='),
  291. ),
  292. ),
  293. ),
  294. );
  295. return $config;