supplierList.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <view class="supplier-content clearfix">
  3. <view class="tui-group-title">
  4. <view class="tui-group-name">优质供应商</view>
  5. <view class="tui-group-tabs">采美正品联盟 质量保证</view>
  6. <view class="tui-group-r" @click="handleMoreShop">
  7. <text>更多</text> <text class="iconfont icon-xiayibu"></text>
  8. </view>
  9. </view>
  10. <view class="swiper-goods-box">
  11. <swiper class="tui-shop-swiper" circular @change="swiperChange" :indicator-dots="false" :autoplay="true"
  12. :interval="8000" :duration="500">
  13. <swiper-item v-for="(supplier, index) in supplierList" :key="index">
  14. <view class="tui-supplier-list">
  15. <view class="tui-supplier-item" v-for="(sup, supIndex) in supplier" :key="supIndex"
  16. @click="NavToDetailPage(sup)">
  17. <view class="tui-shop-top">
  18. <view class="tui-top-logo">
  19. <image :src="sup.image" mode=""></image>
  20. </view>
  21. <view class="tui-top-name">
  22. <text>{{ sup.supplierName }}</text>
  23. </view>
  24. </view>
  25. <view class="tui-shop-mid">
  26. <view class="tui-mid-item" v-for="(pros, prIndex) in sup.products" :key="prIndex" @click.stop="navToDetailPage(pros)">
  27. <image :src="pros.mainImage" mode=""></image>
  28. </view>
  29. </view>
  30. <view class="tui-shop-bot">
  31. <view class="tui-bot-btn">
  32. 进店<text class="iconfont icon-xiayibu"></text>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </swiper-item>
  38. </swiper>
  39. <view class="swiper__dots-box">
  40. <view v-for="(item, idx) in supplierList" :key="idx"
  41. :class="[idx === current ? 'swiper__dots-long' : 'none']" :data-index="current"
  42. class="swiper__dots-item"></view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. name: 'supplierList',
  50. props: {
  51. supplierObj: {
  52. type: Array
  53. }
  54. },
  55. data() {
  56. return {
  57. current: 0,
  58. supplierList: []
  59. }
  60. },
  61. created() {
  62. this.initData(this.supplierObj)
  63. },
  64. methods: {
  65. initData(data) {
  66. this.supplierList = this.handleCheckedList(data)
  67. console.log('supplierList', this.supplierList)
  68. },
  69. // 处理供应商列表
  70. handleCheckedList(arr) {
  71. if (!Array.isArray(arr)) return []
  72. let newArr = [],
  73. a = []
  74. let indexNum = 4
  75. arr.map((item, index) => {
  76. if (index !== 0 && index % indexNum === 0) {
  77. newArr.push(a)
  78. a = []
  79. a.push(item)
  80. } else a.push(item)
  81. if (arr.length === (index + 1)) {
  82. newArr.push(a)
  83. }
  84. })
  85. return newArr
  86. },
  87. //跳转店铺
  88. NavToDetailPage(item) {
  89. this.$api.navigateTo(`/pages/supplier/user/my-shop?shopId=${item.linkParam.id}`)
  90. },
  91. //跳转商品详情
  92. navToDetailPage(pros) {
  93. this.$api.navigateTo(`/pages/goods/product?id=${pros.productId}`)
  94. },
  95. handleMoreShop() {
  96. this.$api.navigateTo('/pages/goods/goods-shop-list')
  97. },
  98. swiperChange(e) { //切换
  99. this.current = e.detail.current
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss">
  105. .supplier-content {
  106. background-color: #F7F7F7;
  107. width: 100%;
  108. height: auto;
  109. box-sizing: border-box;
  110. padding: 0 24rpx;
  111. }
  112. .tui-group-title {
  113. width: 100%;
  114. display: flex;
  115. justify-content: flex-start;
  116. align-items: center;
  117. height: 100rpx;
  118. box-sizing: border-box;
  119. position: relative;
  120. .tui-group-name {
  121. font-size: $font-size-36;
  122. font-weight: bold;
  123. color: #333333;
  124. }
  125. .tui-group-tabs {
  126. height: 100rpx;
  127. display: flex;
  128. justify-content: space-between;
  129. align-items: center;
  130. margin-left: 20rpx;
  131. font-size: $font-size-24;
  132. line-height: 100rpx;
  133. color: #999999;
  134. }
  135. .tui-group-r {
  136. width: 100rpx;
  137. height: 100rpx;
  138. line-height: 100rpx;
  139. font-size: $font-size-24;
  140. color: #999999;
  141. text-align: right;
  142. position: absolute;
  143. right: 0;
  144. top: 0;
  145. }
  146. }
  147. .swiper-goods-box {
  148. width: 100%;
  149. height: 960rpx;
  150. position: relative;
  151. .swiper__dots-box {
  152. position: absolute;
  153. bottom: 0;
  154. left: 0;
  155. right: 0;
  156. /* #ifndef APP-NVUE */
  157. display: flex;
  158. /* #endif */
  159. flex: 1;
  160. flex-direction: row;
  161. justify-content: center;
  162. align-items: center;
  163. .swiper__dots-item {
  164. width: 10rpx;
  165. height: 10rpx;
  166. border-radius: 100%;
  167. margin-left: 6px;
  168. background-color: #FFFFFF;
  169. }
  170. .swiper__dots-long {
  171. width: 35rpx;
  172. height: 10rpx;
  173. border-radius: 6rpx;
  174. background-color: #FF5B00;
  175. transition: all 0.4s;
  176. }
  177. }
  178. .tui-shop-swiper {
  179. width: 100%;
  180. height: 920rpx;
  181. }
  182. .tui-supplier-list {
  183. padding: 0;
  184. width: 100%;
  185. height: 100%;
  186. display: flex;
  187. justify-content: flex-start;
  188. flex-wrap: wrap;
  189. .tui-supplier-item {
  190. display: flex;
  191. width: 339rpx;
  192. height: 448rpx;
  193. flex-direction: column;
  194. align-items: center;
  195. border-radius: 16rpx;
  196. margin: 0 20rpx 20rpx 0;
  197. box-sizing: border-box;
  198. padding: 24rpx 0;
  199. background-color: #FFFFFF;
  200. &:nth-child(2n) {
  201. margin-right: 0;
  202. }
  203. .tui-shop-top {
  204. width: 100%;
  205. display: flex;
  206. flex-direction: column;
  207. align-items: center;
  208. .tui-top-logo {
  209. display: flex;
  210. align-items: center;
  211. justify-content: center;
  212. width: 219rpx;
  213. height: 96rpx;
  214. background-color: #ffffff;
  215. border-radius: 8rpx;
  216. image {
  217. width: 219rpx;
  218. height: 96rpx;
  219. }
  220. }
  221. .tui-top-name {
  222. justify-content: center;
  223. font-size: 30rpx;
  224. line-height: 80rpx;
  225. color: #1bc0de;
  226. }
  227. }
  228. .tui-shop-mid {
  229. width: 100%;
  230. height: 95rpx;
  231. display: flex;
  232. justify-content: flex-start;
  233. align-items: center;
  234. box-sizing: border-box;
  235. margin: 20rpx 0;
  236. padding: 0 10rpx;
  237. .tui-mid-item {
  238. width: 95rpx;
  239. height: 95rpx;
  240. border-radius: 8rpx;
  241. overflow: hidden;
  242. margin: 0 5rpx;
  243. box-sizing: border-box;
  244. border: 1px solid #e1e1e1;
  245. image {
  246. width: 95rpx;
  247. height: 95rpx;
  248. }
  249. }
  250. }
  251. .tui-shop-bot {
  252. width: 100%;
  253. height: 54rpx;
  254. display: flex;
  255. justify-content: center;
  256. align-items: center;
  257. margin-top: 20rpx;
  258. .tui-bot-btn {
  259. justify-content: center;
  260. align-items: center;
  261. font-size: 28rpx;
  262. line-height: 52rpx;
  263. color: #333333;
  264. padding: 0 30rpx;
  265. border: 1px solid #999999;
  266. border-radius: 30rpx;
  267. .iconfont {
  268. font-size: 24rpx;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. }
  275. </style>