goods.js 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. define([ 'ngResource' ], function() {
  2. angular.module('goodsServices', [ 'ngResource' ]).factory('Goods', ['$resource', 'BaseService', function($resource, BaseService) {
  3. var rootPath = BaseService.getRootPath();
  4. //获取ComponentSubmit的分页数据
  5. return $resource('trade/goods', {}, {
  6. /**
  7. * 获取分页面的GOODS数据(后台数据 产品管理部分)
  8. * start wangcz
  9. * */
  10. loadGoodsList: {
  11. url: 'trade/goods/background/page',
  12. method: 'POST'
  13. },
  14. /**
  15. * end wangcz
  16. * */
  17. //取得完整的消息
  18. findAllByUuid : {
  19. url : 'trade/goods/byUuid/:uuid',
  20. method : 'GET',
  21. isArray : true
  22. },
  23. // 取得价格信息
  24. findPriceByCode : {
  25. url : 'trade/goods/price',
  26. method : 'GET'
  27. },
  28. //取得简化的消息
  29. findSimpleAllByUuid : {
  30. url : 'trade/goods/simple/byUuid/:uuid',
  31. method : 'GET',
  32. isArray : true
  33. },
  34. findOneById : {
  35. url : 'trade/goods/one',
  36. method : 'GET'
  37. },
  38. //取得有效的简化的消息
  39. findSimpleAvailableByUuid : {
  40. url : 'trade/goods/simple/byUuidAndCurrency',
  41. method : 'GET',
  42. isArray : true,
  43. params : { _status : 'available' }
  44. },
  45. // 通过uuid获取批次信息
  46. findGoodsGroupByStoreOrderByMinrmbPrice : {
  47. url : 'trade/goods/store/uuid/:uuid',
  48. method : 'GET',
  49. isArray : true
  50. },
  51. // 上传Excel批量发布产品
  52. publishByExcel: {
  53. url: 'trade/goods/publish/excel',
  54. method: 'POST'
  55. },
  56. //获取在售的产品
  57. findSalingGoods : {
  58. url : 'trade/goods/saling',
  59. method :'GET'
  60. },
  61. //管理平台获取在售的产品
  62. findSalingGoodsAdmin : {
  63. url : 'trade/goods/saling/admin',
  64. method :'GET'
  65. },
  66. //获取已下架的产品
  67. findDownedGoods : {
  68. url : 'trade/goods/downed',
  69. method :'GET'
  70. },
  71. // 获取上架/下架产品
  72. findUpAndDown : {
  73. url : 'trade/goods/upAndDown',
  74. method :'GET'
  75. },
  76. //管理平台获取已下架的产品
  77. findDownedGoodsAdmin : {
  78. url : 'trade/goods/downed/admin',
  79. method :'GET'
  80. },
  81. //更新产品
  82. updateGoods : {
  83. url : 'trade/goods',
  84. method : 'PUT'
  85. },
  86. //批量下架产品
  87. batchDown : {
  88. url : 'trade/goods/batchdown',
  89. method : 'DELETE'
  90. },
  91. //失效产品全部下架产品
  92. batchDownAll : {
  93. url : 'trade/goods/batchdownAll',
  94. method : 'DELETE'
  95. },
  96. //根据批次号获取产品详情
  97. findByBatchCode : {
  98. url : 'trade/goods/:batchCode/detail',
  99. method : 'GET'
  100. },
  101. //判断商品是否被送样
  102. isSample : {
  103. url : 'trade/goods/:id/issample',
  104. method : 'GET'
  105. },
  106. //刷新批次有效期
  107. refresh : {
  108. url : 'trade/goods/refresh/:id',
  109. method : 'GET'
  110. },
  111. //获取即将失效批次
  112. getOvertime : {
  113. url : 'trade/goods/overtime',
  114. method : 'GET',
  115. isArray : true
  116. },
  117. // 获取发布人信息
  118. getPublisherInfo : {
  119. url : 'trade/goods/publisher/info',
  120. method : 'GET'
  121. },
  122. getStatistics : {
  123. url : 'trade/goods/statistics',
  124. method : 'GET'
  125. },
  126. // 根据关键字、库存来源和器件类目分页获取商品信息列表
  127. findGoodsByKeyword : {
  128. url : 'api/product/component/goods/original/:original',
  129. method : 'GET'
  130. },
  131. // 根据批次号获取批次信息变更记录(卖家)
  132. findGoodsHistoryWithVendor : {
  133. url : 'trade/goods/goodsHistory',
  134. method : 'GET'
  135. },
  136. // 分页获取当前店铺的某一状态的商品信息
  137. getGoodsByPageAndStatus : {
  138. url : 'trade/goods/store/status',
  139. method : 'GET'
  140. },
  141. // 重新上架已下架商品 该方法的后台代码又问题,被弃用
  142. putOnCommodityOnce : {
  143. url : rootPath + '/trade/goods/:batchCode/putOnOnce',
  144. method : 'PUT'
  145. },
  146. //商品上架
  147. putOn : {
  148. url : 'trade/goods/putOn/:id',
  149. method: 'PUT'
  150. },
  151. downNowEnterpriseGoods: {
  152. url : 'trade/goods/down/enUU',
  153. method: 'PUT'
  154. },
  155. // 删除列表
  156. deleteGoodsByIdList: {
  157. url : 'trade/goods/delete/batch',
  158. method: 'PUT'
  159. },
  160. // 删除企业下在售
  161. deleteGoodsByEnUU: {
  162. url : 'trade/goods/delete/enUU',
  163. method: 'PUT'
  164. },
  165. // 卖家下架已上架商品
  166. offShelfGoodsByProvider : {
  167. url : 'trade/goods/provider/off/shelf',
  168. method : 'PUT'
  169. },
  170. // 卖家下架已上架商品
  171. offShelfGoodsByids : {
  172. url : rootPath + '/trade/goods/provider/down/id',
  173. method : 'PUT'
  174. },
  175. // 随机生成4个热卖商品 Deprecated
  176. randomGetHotCommodity : {
  177. url : rootPath + '/trade/goods/hot/random',
  178. method : 'GET'
  179. },
  180. // 据店铺UUID获取商品和品牌的数量
  181. findCommodityAndKindNumberByStore : {
  182. url : rootPath + '/trade/goods/storeid/:storeUuid/counts',
  183. method : 'GET'
  184. },
  185. //获取最近的库存信息
  186. getLatestGoods: {
  187. url : rootPath + '/api/commodity/latest',
  188. method : 'GET',
  189. isArray : true
  190. },
  191. // 各月新增在售批次数量
  192. getIncreaseBatch: {
  193. url : rootPath + '/trade/goods/increaseBatchCount',
  194. method : 'GET',
  195. isArray : true
  196. },
  197. // 各月新增在售器件数量
  198. getIncreaseCmp: {
  199. url : rootPath + '/trade/goods/increaseCmpCount',
  200. method : 'GET',
  201. isArray : true
  202. },
  203. // 上传产品用户数
  204. getProductsCmp: {
  205. url : rootPath + '/trade/products/apply/count',
  206. method : 'GET'
  207. },
  208. // 器件申请用户数
  209. getComponentSubmitCmp: {
  210. url : rootPath + '/produce/componentSubmit/submit/count',
  211. method : 'GET',
  212. isArray : true
  213. },
  214. // 品牌申请用户数
  215. getBrandSubmitCmp: {
  216. url : rootPath + '/produce/brandSubmit/submit/count',
  217. method : 'GET'
  218. },
  219. getDownLoadStatus: {
  220. url : 'release/product/release/failure/status',
  221. method : 'GET'
  222. },
  223. /**
  224. * 获取类似的产品
  225. */
  226. getSimilarityPro : {
  227. url : 'trade/goods/similarities',
  228. method : 'GET'
  229. },
  230. /**
  231. * 获取类似的产品
  232. */
  233. getSimilarityProCount : {
  234. url : 'trade/goods/similarities/count',
  235. method : 'GET'
  236. },
  237. /**
  238. * 批量获取类似的产品
  239. */
  240. getSimilarityProCountBatch : {
  241. url : 'trade/goods/similarities/count/batch',
  242. method : 'POST'
  243. },
  244. /**
  245. * 下架该公司所有的产品
  246. */
  247. downAllGoodsByEnterprise : {
  248. url : 'trade/goods/downAllGoods/enterprise',
  249. method : 'GET'
  250. },
  251. /**
  252. * 根据产品id获取对应上架信息
  253. */
  254. getGoodsByProductId : {
  255. url : 'trade/goods/by/productId',
  256. method : 'GET',
  257. isArray : true
  258. },
  259. /**
  260. * 修改goods状态,转为在售
  261. */
  262. modifyGoodsStatus : {
  263. url : 'trade/goods/turn/sale',
  264. method : 'PUT'
  265. },
  266. /**
  267. * 是否被推荐了
  268. */
  269. isRecommendGoods : {
  270. url : 'trade/goods/isRecommend/:id',
  271. method: 'GET'
  272. },
  273. /**
  274. * 删除产品信息
  275. */
  276. deleteGoodsById : {
  277. url : 'trade/goods/delete/:id',
  278. method: 'DELETE'
  279. },
  280. /**
  281. * 添加产品信息
  282. */
  283. addGoods : {
  284. url : 'trade/goods/addGoods',
  285. method : 'POST'
  286. },
  287. getDeleteProductMessage : {
  288. url : 'trade/goods/:productid/deleteMessage',
  289. method : 'GET'
  290. },
  291. getRepeatByTagAndProductId : {
  292. url : 'trade/goods/repeat/tag',
  293. method : 'GET'
  294. }
  295. });
  296. }]).factory('GoodsModifyInfo', ['$resource', function ($resource) {
  297. return $resource('goods/modifyInfo', {}, {
  298. getPageModifyInfo : {
  299. url: 'goods/modifyInfo/page',
  300. method: 'GET'
  301. },
  302. getPageModifyDetail : {
  303. url: 'goods/modifyInfo/detail/page',
  304. method: 'GET'
  305. },
  306. getModifyInfoByBatchCode : {
  307. url: 'goods/modifyInfo/batchCode',
  308. method: 'GET',
  309. isArray: true
  310. },
  311. auditedGoods : {
  312. url: 'goods/modifyInfo/audit/goods',
  313. method: 'PUT'
  314. }
  315. })
  316. }]).factory('GoodsHistory', ['$resource', function ($resource) {
  317. return $resource('trade/goodsHistory', {}, {
  318. findDataOfUpAndDown: {
  319. url: 'trade/goodsHistory/page/batchCode',
  320. method: 'GET'
  321. }
  322. })
  323. }]);
  324. });