store_goods_sku.php 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  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. 'in_num' => array
  65. (
  66. 'type' => 'decimal-11,2',
  67. 'name' => '入库库存',
  68. 'default' => '0',
  69. 'desc' => '入库库存',
  70. 'match' => 'is_numeric',
  71. ),
  72. 'out_num' => array
  73. (
  74. 'type' => 'decimal-11,2',
  75. 'name' => '出库库存',
  76. 'default' => '0',
  77. 'desc' => '出库库存',
  78. 'match' => 'option',
  79. ),
  80. 'on_num' => array
  81. (
  82. 'type' => 'decimal-11,2',
  83. 'name' => '在途库存',
  84. 'default' => '0',
  85. 'desc' => '在途库存',
  86. 'match' => 'is_numeric',
  87. ),
  88. 'state' => array
  89. (
  90. 'type' => 'tinyint-1',
  91. 'name' => '数据状态',
  92. 'default' => '1',
  93. 'desc' => '请选择状态',
  94. 'match' => 'is_numeric',
  95. ),
  96. 'cdate' => array
  97. (
  98. 'type' => 'int-11',
  99. 'name' => '发布时间',
  100. 'match' => array('is_numeric', time()),
  101. 'desc' => '',
  102. # 只有insert时才生效
  103. 'insert' => true,
  104. //'search' => 'date',
  105. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  106. ),
  107. ),
  108. 'manage' => array
  109. (
  110. 'insert' => false,
  111. 'edit' => false,
  112. 'delete' => false,
  113. //'excel' => array(array('导出门店库存', '门店库存', '')),
  114. 'page_list_table' => 'sku',
  115. ),
  116. # request 请求接口定义
  117. 'request' => array
  118. (
  119. 'getDataPage' => array
  120. (
  121. # 匹配的正则或函数 选填项
  122. 'option' => array
  123. (
  124. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  125. 'name' => array('yes-t_2.name', 'like'),
  126. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  127. 'category' => array('yes-t_2.category', 'like'),
  128. 'top_category_id' => array('yes-t_2.top_category_id'),
  129. 'second_category_id' => array('yes-t_2.second_category_id'),
  130. 'category_id' => array('yes-t_2.category_id'),
  131. 'status' => array('yes-t_2.status', 1),
  132. 'state' => array('yes-t_2.state', 1),
  133. 'state_1' => array('yes-t_1.state', 1),
  134. ),
  135. # 联表
  136. 'join' => array
  137. (
  138. array
  139. (
  140. 'table' => 'scm_product/info',
  141. 'type' => 'left join',
  142. 'on' => array('goods_id','id'),
  143. 'col' => 'goods_id',
  144. ),
  145. ),
  146. 'type' => 'all',
  147. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  148. 'page' => array(30, 'list'),
  149. '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',
  150. ),
  151. 'getData' => array
  152. (
  153. # 匹配的正则或函数 选填项
  154. 'option' => array
  155. (
  156. 'servicer_store_id' => array('yes-t_1.servicer_store_id'),
  157. 'name' => array('yes-t_2.name', 'like'),
  158. 'total' => array('yes|t_1.in_num-t_1.out_num', '<'),
  159. 'category' => array('yes-t_2.category', 'like'),
  160. 'top_category_id' => array('yes-t_2.top_category_id'),
  161. 'second_category_id' => array('yes-t_2.second_category_id'),
  162. 'category_id' => array('yes-t_2.category_id'),
  163. 'status' => array('yes-t_2.status', 1),
  164. 'state' => array('yes-t_2.state', 1),
  165. 'state_1' => array('yes-t_1.state', 1),
  166. ),
  167. # 联表
  168. 'join' => array
  169. (
  170. array
  171. (
  172. 'table' => 'scm_product/info',
  173. 'type' => 'left join',
  174. 'on' => array('goods_id','id'),
  175. 'col' => 'goods_id',
  176. ),
  177. ),
  178. 'type' => 'all',
  179. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc'),
  180. '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',
  181. ),
  182. # 列表
  183. 'getList' => array
  184. (
  185. # 匹配的正则或函数 选填项
  186. 'option' => array
  187. (
  188. 'servicer_store_id' => 'yes',
  189. 'goods_id' => 'yes',
  190. 'sku_id' => 'yes',
  191. 'state' => 1,
  192. ),
  193. 'type' => 'all',
  194. 'order' => array('id' => 'desc'),
  195. 'col' => '*,in_num-out_num as total|sku_id',
  196. ),
  197. # 获取单条数据
  198. 'getOne' => array
  199. (
  200. # 匹配的正则或函数 选填项
  201. 'option' => array
  202. (
  203. 'servicer_store_id' => 'yes',
  204. 'goods_id' => 'yes',
  205. 'sku_id' => 'yes',
  206. 'state' => 1,
  207. ),
  208. 'type' => 'one',
  209. 'col' => '*,in_num-out_num as total',
  210. ),
  211. # 更新入库库存
  212. 'inUpdate' => array
  213. (
  214. 'type' => 'update',
  215. 'where' => array
  216. (
  217. 'id' => 'yes',
  218. ),
  219. 'set' => array
  220. (
  221. 'in_num' => array('yes', '+='),
  222. ),
  223. ),
  224. # 更新出库库存
  225. 'outUpdate' => array
  226. (
  227. 'type' => 'update',
  228. 'where' => array
  229. (
  230. 'id' => 'yes',
  231. ),
  232. 'set' => array
  233. (
  234. 'out_num' => array('yes', '+='),
  235. ),
  236. ),
  237. # 更新在途库存
  238. 'onUpdate' => array
  239. (
  240. 'type' => 'update',
  241. 'where' => array
  242. (
  243. 'id' => 'yes',
  244. ),
  245. 'set' => array
  246. (
  247. 'on_num' => array('yes', '+='),
  248. ),
  249. ),
  250. ),
  251. );
  252. return $config;