ToggleStore.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <div class="toggleStore">
  3. <!--寄售-->
  4. <div class="sale list-item" @click="open('/store/33069557578d44e69bd91ad12d28a8d4')">
  5. <div class="header">
  6. <div class="kind"><span></span>优软寄售</div>
  7. <a class="enter" @click="open('/store/33069557578d44e69bd91ad12d28a8d4')">进入店铺 <i class="fa fa-angle-right"></i></a>
  8. </div>
  9. <div class="body">
  10. <p>海量库存、不赚差价</p>
  11. </div>
  12. </div>
  13. <!--原厂-->
  14. <div class="factory list-item" :class="{active: storeType === 'factory'}" @click="toggleStore('factory')">
  15. <div class="header">
  16. <div class="kind"><span></span>原&nbsp;&nbsp;&nbsp;&nbsp;厂</div>
  17. <div class="count">
  18. <span>已入驻</span>
  19. <div class="count_num">
  20. <span v-for="item in formatNumber(originalCount, 4)" v-text="item">1</span>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="body">
  25. <p>原厂直营,品质保障</p>
  26. </div>
  27. </div>
  28. <!--代理经销-->
  29. <div class="agent list-item" :class="{active: storeType === 'origin'}" @click="toggleStore('origin')">
  30. <div class="header">
  31. <div class="kind"><span></span>代理经销</div>
  32. <div class="count">
  33. <span>已入驻</span>
  34. <div class="count_num">
  35. <span v-for="item in formatNumber(storeCount, 4)" v-text="item">1</span>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="body">
  40. <p>百强代理,一站找齐</p>
  41. </div>
  42. </div>
  43. <!--供应商-->
  44. <div class="agent list-item" :class="{active: storeType === 'supplier'}" @click="toggleStore('supplier')">
  45. <div class="header">
  46. <div class="kind"><span></span>供应商</div>
  47. <div class="count">
  48. <span>已入驻</span>
  49. <div class="count_num">
  50. <span v-for="item in formatNumber(supplierArr, 4)" v-text="item">1</span>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="body">
  55. <p>产业资源,免费共享</p>
  56. </div>
  57. </div>
  58. <!--品牌墙-->
  59. <div class="agent list-item" :class="{active: storeType === 'brand'}" @click="toggleStore('brand')">
  60. <div class="header">
  61. <div class="kind"><span></span>品牌墙</div>
  62. <div class="count">
  63. <span>已入驻</span>
  64. <div class="count_num">
  65. <span v-for="item in formatNumber(brandArr, 4)" v-text="item">1</span>
  66. </div>
  67. </div>
  68. </div>
  69. <div class="body">
  70. <p>全球品牌,自由筛选</p>
  71. </div>
  72. </div>
  73. </div>
  74. </template>
  75. <script>
  76. export default {
  77. name: 'excellent-suppliers',
  78. data () {
  79. return {
  80. supplierArr: [],
  81. brandArr: []
  82. }
  83. },
  84. computed: {
  85. storeType () {
  86. return this.$route.params.type
  87. },
  88. store () {
  89. return this.$store.state.provider.storeCms.recommendStore.data
  90. },
  91. storeCount () {
  92. return this.$store.state.provider.stores.storeCount.data
  93. },
  94. originalCount () {
  95. return this.$store.state.provider.stores.originalCount.data
  96. },
  97. count () {
  98. let allCount = this.$store.state.option.counter.data ? this.$store.state.option.counter.data : []
  99. if (allCount) {
  100. allCount.forEach((value) => {
  101. if (value.item === '供应商') {
  102. this.supplierArr.push(value.count)
  103. }
  104. if (value.item === '品 牌') {
  105. this.brandArr.push(value.count)
  106. }
  107. })
  108. }
  109. }
  110. },
  111. mounted () {
  112. this.$nextTick(() => {
  113. this.count
  114. })
  115. },
  116. create () {
  117. this.$store.dispatch('loadCounterData')
  118. },
  119. methods: {
  120. // 切换Store
  121. toggleStore (type) {
  122. if (type === this.storeType) return
  123. this.$store.dispatch('loadBanners', {type: type + '_banner_carousel'})
  124. this.$store.dispatch('provider/findSimilarStoreList', { page: 1, count: 10, type: type === 'factory' ? 'ORIGINAL_FACTORY' : 'AGENCY-DISTRIBUTION' })
  125. if (type === 'brand') {
  126. this.$router.push('/eCommerce/home/brand/?initial=A')
  127. }
  128. if (type === 'supplier') {
  129. this.$router.push('/eCommerce/home/supplier')
  130. }
  131. if (type === 'factory') {
  132. this.$router.push('/eCommerce/home/factory')
  133. }
  134. if (type === 'origin') {
  135. this.$router.push('/eCommerce/home/origin')
  136. }
  137. },
  138. // 店铺入驻数量
  139. formatNumber (num, key) {
  140. let count = ('0000' + num).substr(-key)
  141. let _arr = []
  142. for (var i = 0; i < count.length; i++) {
  143. _arr.push(count[i])
  144. }
  145. return _arr
  146. },
  147. // 寄售
  148. open (url) {
  149. window.open(url)
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. .toggleStore {
  156. float: left;
  157. width: 220px;
  158. height: 402px;
  159. padding: 0;
  160. .list-item{
  161. width: 100%;
  162. height: 81px;
  163. background: #fff;
  164. border-bottom: 1px solid #ece9ec;
  165. .header {
  166. overflow: hidden;
  167. padding: 10px 8px 0;
  168. .kind{
  169. float: left;
  170. font-size: 16px;
  171. font-weight: bold;
  172. color: #2496f1;
  173. span{
  174. display: inline-block;
  175. margin-right: 4px;
  176. width: 6px;
  177. height: 12px;
  178. background: url('/images/original/angle-blue.png') no-repeat;
  179. }
  180. }
  181. .count{
  182. overflow: hidden;
  183. float: right;
  184. padding: 0 5px;
  185. width: 120px;
  186. height: 26px;
  187. line-height: 24px;
  188. background-color: #fff;
  189. border-radius: 2px;
  190. border: solid 1px #bfbfbf;
  191. span {
  192. float: left;
  193. margin-right: 4px;
  194. font-size: 12px;
  195. letter-spacing: 0;
  196. color: #666;
  197. }
  198. .count_num{
  199. float: left;
  200. margin-top: 3px;
  201. span{
  202. display: inline-block;
  203. width: 14px;
  204. height: 18px;
  205. line-height: 18px;
  206. font-size: 12px;
  207. color: #fff;
  208. text-align: center;
  209. background-color: #a1a0a0;
  210. border-radius: 2px;
  211. &:last-child{
  212. margin-right: 0;
  213. }
  214. }
  215. }
  216. }
  217. .enter{
  218. float: right;
  219. display: inline-block;
  220. width: 72px;
  221. height: 22px;
  222. line-height: 20px;
  223. text-align: center;
  224. font-size: 12px;
  225. color: #2496f1;
  226. background-color: #ffffff;
  227. border-radius: 11px;
  228. border: solid 1px #2496f1;
  229. i{
  230. font-size: 16px;
  231. }
  232. &:hover{
  233. color: #fff;
  234. background: #2496f1;
  235. border: solid 1px #2496f1;
  236. }
  237. }
  238. }
  239. .body {
  240. margin-top: 15px;
  241. padding: 0 20px 0;
  242. p{
  243. width: 195px;
  244. overflow: hidden;
  245. white-space: nowrap;
  246. text-overflow: ellipsis;
  247. font-size: 14px;
  248. letter-spacing: 0;
  249. color: #666666;
  250. }
  251. }
  252. &:hover, &.active{
  253. background: #fa9819;
  254. cursor: pointer;
  255. .kind {
  256. color: #fff;
  257. span{
  258. background: url('/images/original/angle-white.png') no-repeat;
  259. }
  260. }
  261. .count{
  262. background-color: #d87c05;
  263. border: solid 1px #d87c05;
  264. span {
  265. color: #fff;
  266. }
  267. .count_num{
  268. span{
  269. color: #626364;
  270. background-color: #fff;
  271. }
  272. }
  273. }
  274. .body{
  275. p{
  276. color: #fff;
  277. }
  278. }
  279. }
  280. }
  281. .factory {
  282. border-top-left-radius: 5px;
  283. border-top-right-radius: 5px;
  284. }
  285. .sale{
  286. border-bottom-left-radius: 5px;
  287. border-bottom-right-radius: 5px;
  288. }
  289. }
  290. </style>