ToggleStore.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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 && Array.isArray(allCount)) {
  100. allCount.forEach((value) => {
  101. if (value.item === '供应商') {
  102. this.supplierArr = value.count
  103. }
  104. if (value.item === '品牌') {
  105. this.brandArr = 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. localStorage.setItem('pageChange', 'false')
  124. this.$store.dispatch('loadBanners', {type: type + '_banner_carousel'})
  125. this.$store.dispatch('provider/findSimilarStoreList', { page: 1, count: 10, type: type === 'factory' ? 'ORIGINAL_FACTORY' : 'AGENCY-DISTRIBUTION' })
  126. if (type === 'brand') {
  127. this.$router.push('/eCommerce/home/brand/?initial=A')
  128. }
  129. if (type === 'supplier') {
  130. this.$router.push('/eCommerce/home/supplier')
  131. }
  132. if (type === 'factory') {
  133. this.$router.push('/eCommerce/home/factory')
  134. }
  135. if (type === 'origin') {
  136. this.$router.push('/eCommerce/home/origin')
  137. }
  138. },
  139. // 店铺入驻数量
  140. formatNumber (num, key) {
  141. let count = ('0000' + num).substr(-key)
  142. let _arr = []
  143. for (var i = 0; i < count.length; i++) {
  144. _arr.push(count[i])
  145. }
  146. return _arr
  147. },
  148. // 寄售
  149. open (url) {
  150. window.open(url)
  151. }
  152. }
  153. }
  154. </script>
  155. <style lang="scss" scoped>
  156. .toggleStore {
  157. float: left;
  158. width: 220px;
  159. height: 402px;
  160. padding: 0;
  161. .list-item{
  162. width: 100%;
  163. height: 81px;
  164. background: #fff;
  165. border-bottom: 1px solid #ece9ec;
  166. .header {
  167. overflow: hidden;
  168. padding: 10px 8px 0;
  169. .kind{
  170. float: left;
  171. font-size: 16px;
  172. font-weight: bold;
  173. color: #2496f1;
  174. span{
  175. display: inline-block;
  176. margin-right: 4px;
  177. width: 6px;
  178. height: 12px;
  179. background: url('/images/original/angle-blue.png') no-repeat;
  180. }
  181. }
  182. .count{
  183. overflow: hidden;
  184. float: right;
  185. padding: 0 5px;
  186. width: 120px;
  187. height: 26px;
  188. line-height: 24px;
  189. background-color: #fff;
  190. border-radius: 2px;
  191. border: solid 1px #bfbfbf;
  192. span {
  193. float: left;
  194. margin-right: 4px;
  195. font-size: 12px;
  196. letter-spacing: 0;
  197. color: #666;
  198. }
  199. .count_num{
  200. float: left;
  201. margin-top: 3px;
  202. span{
  203. display: inline-block;
  204. width: 14px;
  205. height: 18px;
  206. line-height: 18px;
  207. font-size: 12px;
  208. color: #fff;
  209. text-align: center;
  210. background-color: #a1a0a0;
  211. border-radius: 2px;
  212. &:last-child{
  213. margin-right: 0;
  214. }
  215. }
  216. }
  217. }
  218. .enter{
  219. float: right;
  220. display: inline-block;
  221. width: 72px;
  222. height: 22px;
  223. line-height: 20px;
  224. text-align: center;
  225. font-size: 12px;
  226. color: #2496f1;
  227. background-color: #ffffff;
  228. border-radius: 11px;
  229. border: solid 1px #2496f1;
  230. i{
  231. font-size: 16px;
  232. }
  233. &:hover{
  234. color: #fff;
  235. background: #2496f1;
  236. border: solid 1px #2496f1;
  237. }
  238. }
  239. }
  240. .body {
  241. margin-top: 15px;
  242. padding: 0 20px 0;
  243. p{
  244. width: 195px;
  245. overflow: hidden;
  246. white-space: nowrap;
  247. text-overflow: ellipsis;
  248. font-size: 14px;
  249. letter-spacing: 0;
  250. color: #666666;
  251. }
  252. }
  253. &:hover, &.active{
  254. background: #fa9819;
  255. cursor: pointer;
  256. .kind {
  257. color: #fff;
  258. span{
  259. background: url('/images/original/angle-white.png') no-repeat;
  260. }
  261. }
  262. .count{
  263. background-color: #d87c05;
  264. border: solid 1px #d87c05;
  265. span {
  266. color: #fff;
  267. }
  268. .count_num{
  269. span{
  270. color: #626364;
  271. background-color: #fff;
  272. }
  273. }
  274. }
  275. .body{
  276. p{
  277. color: #fff;
  278. }
  279. }
  280. }
  281. }
  282. .factory {
  283. border-top-left-radius: 5px;
  284. border-top-right-radius: 5px;
  285. }
  286. .sale{
  287. border-bottom-left-radius: 5px;
  288. border-bottom-right-radius: 5px;
  289. }
  290. }
  291. </style>