goods_sku.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <?php
  2. $config = array
  3. (
  4. # 表名
  5. 'name' => 'goods_sku',
  6. # 显示给用户看的名称
  7. 'lang' => '商品价格设置',
  8. 'order' => 200,
  9. 'menu' => false,
  10. 'desc' => '1、当前库存是当前可售的库存,零售下单支付成功就会扣掉<br />
  11. 2、占用库存是当前卖了多少<br />
  12. 3、总库存是总进货多少,采购下单整个订单完成才会增加<br />
  13. 4、在途库存是当前有多少库存在运送中,采购下单整个订单完成才会增加',
  14. 'end' => array
  15. (
  16. 'insert' => 'shop/lib/manage.skuUpdate',
  17. 'update' => 'shop/lib/manage.skuUpdate',
  18. ),
  19. # 数据结构 不同的字段放这里
  20. 'struct' => array
  21. (
  22. 'id' => array
  23. (
  24. 'type' => 'int-11',
  25. 'name' => 'ID',
  26. 'default' => '',
  27. 'desc' => '',
  28. 'match' => 'is_numeric',
  29. //'list' => true,
  30. ),
  31. 'shop-info-sid'=> array
  32. (
  33. 'name' => '门店编号',
  34. 'default' => '',
  35. 'desc' => '门店编号',
  36. 'match' => 'option',
  37. # 读取另外表的关联方式
  38. 'sync' => array('shop_id', 'id'),
  39. 'list' => true,
  40. 'list_order' => 1,
  41. ),
  42. 'shop_id' => array
  43. (
  44. 'type' => 'int-11',
  45. 'name' => '门店名称',
  46. 'default' => '',
  47. 'desc' => '门店名称',
  48. 'match' => 'is_numeric',
  49. 'search' => 'select',
  50. //'option' => $shop,
  51. 'update' => 'hidden',
  52. 'search' => 'hidden',
  53. 'search' => array
  54. (
  55. 'api' => 'shop/info-like',
  56. 'col' => 'name',
  57. 'result' => 'id',
  58. ),
  59. 'value' => Dever::input('search_option_shop_id'),
  60. 'list' => 'Dever::load("shop/info-one#name", {shop_id})',
  61. 'list_order' => 2,
  62. ),
  63. 'shop-info-type'=> array
  64. (
  65. 'name' => '门店类型',
  66. 'default' => '',
  67. 'desc' => '门店类型',
  68. 'match' => 'option',
  69. # 读取另外表的关联方式
  70. 'sync' => array('shop_id', 'id'),
  71. 'list' => 'Dever::load("shop/lib/manage.shopInfoType", {shop-info-type})',
  72. 'list_order' => 3,
  73. ),
  74. 'goods-info_sku-code'=> array
  75. (
  76. 'name' => '商品编码',
  77. 'default' => '',
  78. 'desc' => '商品编码',
  79. 'match' => 'option',
  80. # 读取另外表的关联方式
  81. 'sync' => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
  82. 'list' => true,
  83. 'list_order' => 4,
  84. ),
  85. 'goods-info_sku-price'=> array
  86. (
  87. 'name' => '零售单价',
  88. 'default' => '',
  89. 'desc' => '零售单价',
  90. 'match' => 'option',
  91. # 读取另外表的关联方式
  92. 'sync' => array('sku_id', 'id', 'goods_id', 'info_id', 'key'),
  93. 'list' => true,
  94. 'list_order' => 7,
  95. ),
  96. 'area' => array
  97. (
  98. 'type' => 'varchar-500',
  99. 'name' => '所在街道',
  100. 'default' => '',
  101. 'desc' => '所在街道',
  102. 'match' => 'option',
  103. 'search' => 'linkage',
  104. 'update' => 'linkage',
  105. 'option' => Dever::url('lib/area.get', 'shop'),
  106. //'list' => 'Dever::load("area/api.string", "{area}")',
  107. ),
  108. 'goods_id' => array
  109. (
  110. 'type' => 'int-11',
  111. 'name' => '商品名称',
  112. 'default' => '',
  113. 'desc' => '商品名称',
  114. 'match' => 'is_numeric',
  115. 'search' => array
  116. (
  117. 'api' => 'goods/info-like',
  118. 'col' => 'name',
  119. 'result' => 'id',
  120. ),
  121. 'list' => 'Dever::load("goods/info-find#name", {goods_id})',
  122. 'list_order' => 5,
  123. ),
  124. 'sku_id' => array
  125. (
  126. 'type' => 'int-11',
  127. 'name' => '规格型号',
  128. 'default' => '-1',
  129. 'desc' => '规格型号',
  130. 'match' => 'is_numeric',
  131. 'list' => 'Dever::load("shop/lib/manage.getSku", {goods_id}, {sku_id})',
  132. 'list_order' => 6,
  133. ),
  134. 'add_num' => array
  135. (
  136. 'type' => 'int-11',
  137. 'name' => '新增库存-输入小于0的数字,则为减少库存',
  138. 'default' => '0',
  139. 'desc' => '新增库存',
  140. 'match' => 'is_numeric',
  141. 'list_name' => '当前库存',
  142. 'list' => '{total_num} - {sell_num}',
  143. 'list_order' => 8,
  144. ),
  145. 'total_num' => array
  146. (
  147. 'type' => 'int-11',
  148. 'name' => '总库存',
  149. 'default' => '0',
  150. 'desc' => '总库存',
  151. 'match' => 'is_numeric',
  152. 'list' => true,
  153. 'list_order' => 10,
  154. ),
  155. 'sell_num' => array
  156. (
  157. 'type' => 'int-11',
  158. 'name' => '销量',
  159. 'default' => '0',
  160. 'desc' => '请填写销量',
  161. 'match' => 'option',
  162. //'search' => 'order',
  163. 'list_name' => '占用库存',
  164. 'list' => true,
  165. 'list_order' => 9,
  166. ),
  167. 'min' => array
  168. (
  169. 'type' => 'int-11',
  170. 'name' => '起购数',
  171. 'default' => '1',
  172. 'desc' => '起购数',
  173. 'match' => 'is_string',
  174. 'update' => 'text',
  175. //'list' => true,
  176. 'list_name' => '采购在途库存',
  177. 'list' => 'Dever::load("shop/lib/manage.getGoodsTotal", 1, {shop_id}, "{goods_id}", "{sku_id}")',
  178. 'list_order' => 10,
  179. ),
  180. 'reorder' => array
  181. (
  182. 'type' => 'int-11',
  183. 'name' => '排序-数值越大越靠前,相当于置顶',
  184. 'default' => '1',
  185. 'desc' => '请输入排序',
  186. 'match' => 'option',
  187. //'update' => 'textgetGoodsTotal
  188. 'search' => 'order',
  189. //'list' => true,
  190. 'order' => 'desc',
  191. //'edit' => true,
  192. ),
  193. 'state' => array
  194. (
  195. 'type' => 'tinyint-1',
  196. 'name' => '数据状态',
  197. 'default' => '1',
  198. 'desc' => '请选择状态',
  199. 'match' => 'is_numeric',
  200. ),
  201. 'cdate' => array
  202. (
  203. 'type' => 'int-11',
  204. 'name' => '发布时间',
  205. 'match' => array('is_numeric', time()),
  206. 'desc' => '',
  207. # 只有insert时才生效
  208. 'insert' => true,
  209. //'search' => 'date',
  210. //'list' => 'date("Y-m-d H:i:s", {cdate})',
  211. ),
  212. ),
  213. 'manage' => array
  214. (
  215. 'insert' => false,
  216. 'edit' => false,
  217. 'delete' => false,
  218. 'num' => false,
  219. 'excel' => array(array('导出门店库存', '门店库存', '')),
  220. 'page_list_table' => 'sku',
  221. # 自定义快捷新增和编辑
  222. 'button' => array
  223. (
  224. //'自定义属性' => array('fast', 1, 'config&where_id=1'),
  225. ),
  226. ),
  227. # request 请求接口定义
  228. 'request' => array
  229. (
  230. 'getDataPage' => array
  231. (
  232. # 匹配的正则或函数 选填项
  233. 'option' => array
  234. (
  235. 'shop_id' => array('yes-t_1.shop_id'),
  236. 'name' => array('yes-t_2.name', 'like'),
  237. 'total' => array('yes|t_1.total_num-t_1.sell_num', '<'),
  238. 'column' => array('yes-t_2.column_id', 'like'),
  239. 'category' => array('yes-t_2.category', 'like'),
  240. 'top_category_id' => array('yes-t_2.top_category_id'),
  241. 'second_category_id' => array('yes-t_2.second_category_id'),
  242. 'category_id' => array('yes-t_2.category_id'),
  243. 'status' => array('yes-t_2.status', 1),
  244. 'state' => array('yes-t_2.state', 1),
  245. 'state_1' => array('yes-t_1.state', 1),
  246. ),
  247. # 联表
  248. 'join' => array
  249. (
  250. array
  251. (
  252. 'table' => 'goods/info',
  253. 'type' => 'left join',
  254. 'on' => array('goods_id','id'),
  255. 'col' => 'goods_id',
  256. ),
  257. ),
  258. 'type' => 'all',
  259. 'order' => array('t_2.reorder' => 'desc', 't_2.id' => 'desc', 't_2.price' => 'asc'),
  260. 'page' => array(30, 'list'),
  261. 'col' => '*,t_2.name,t_2.cover,t_2.id as id,t_1.total_num-t_1.sell_num as total,t_1.sell_num',
  262. ),
  263. # 列表
  264. 'getData' => array
  265. (
  266. # 匹配的正则或函数 选填项
  267. 'option' => array
  268. (
  269. 'shop_id' => 'yes',
  270. 'goods_id' => 'yes',
  271. 'sku_id' => 'yes',
  272. 'state' => 1,
  273. ),
  274. 'type' => 'all',
  275. 'order' => array('id' => 'desc'),
  276. 'col' => '*,total_num-sell_num as total|sku_id',
  277. ),
  278. # 获取单条数据
  279. 'getOne' => array
  280. (
  281. # 匹配的正则或函数 选填项
  282. 'option' => array
  283. (
  284. 'shop_id' => 'yes',
  285. 'goods_id' => 'yes',
  286. 'sku_id' => 'yes',
  287. 'state' => 1,
  288. ),
  289. 'type' => 'one',
  290. 'col' => '*,total_num-sell_num as total',
  291. ),
  292. # 更新售出量
  293. 'incSell' => array
  294. (
  295. 'type' => 'update',
  296. 'where' => array
  297. (
  298. 'shop_id' => 'yes',
  299. 'goods_id' => 'yes',
  300. 'sku_id' => 'yes',
  301. ),
  302. 'set' => array
  303. (
  304. 'sell_num' => array('yes', '+='),
  305. ),
  306. ),
  307. # 减少售出量
  308. 'decSell' => array
  309. (
  310. 'type' => 'update',
  311. 'where' => array
  312. (
  313. 'shop_id' => 'yes',
  314. 'goods_id' => 'yes',
  315. 'sku_id' => 'yes',
  316. ),
  317. 'set' => array
  318. (
  319. 'sell_num' => array('yes', '-='),
  320. ),
  321. ),
  322. # 更新总库存
  323. 'updateTotal' => array
  324. (
  325. 'type' => 'update',
  326. 'where' => array
  327. (
  328. 'id' => 'yes',
  329. ),
  330. 'set' => array
  331. (
  332. 'total_num' => array('yes', '+='),
  333. ),
  334. ),
  335. # 增加总库存
  336. 'incTotal' => array
  337. (
  338. 'type' => 'update',
  339. 'where' => array
  340. (
  341. 'shop_id' => 'yes',
  342. 'goods_id' => 'yes',
  343. 'sku_id' => 'yes',
  344. ),
  345. 'set' => array
  346. (
  347. 'total_num' => array('yes', '+='),
  348. ),
  349. ),
  350. # 减少总库存
  351. 'decTotal' => array
  352. (
  353. 'type' => 'update',
  354. 'where' => array
  355. (
  356. 'shop_id' => 'yes',
  357. 'goods_id' => 'yes',
  358. 'sku_id' => 'yes',
  359. ),
  360. 'set' => array
  361. (
  362. 'total_num' => array('yes', '-='),
  363. ),
  364. ),
  365. ),
  366. );
  367. return $config;