goods-shop-list.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <view class="container clearfix" >
  3. <tui-skeleton
  4. v-if="skeletonShow"
  5. backgroundColor="#fafafa"
  6. borderRadius="10rpx"
  7. :isLoading="true"
  8. :loadingType="5"
  9. />
  10. <template v-else>
  11. <view class="shop-content clearfix">
  12. <view class="shop-item" v-for="(item,index) in list" :key="index" @click="NavToDetailPage(item,index)">
  13. <view class="icon">
  14. <image class="icon-image" :src="item.image" mode="widthFix"></image>
  15. </view>
  16. <view class="name">{{ item.supplierName }}</view>
  17. </view>
  18. </view>
  19. </template>
  20. </view>
  21. </template>
  22. <script>
  23. import { mapState,mapMutations} from 'vuex'
  24. export default{
  25. data(){
  26. return{
  27. skeletonShow: true,
  28. list:[]
  29. }
  30. },
  31. onLoad(option) {
  32. },
  33. methods:{
  34. async getHomeDataInfo() {
  35. //初始化首页数据
  36. try{
  37. const userInfo = await this.$api.getStorage()
  38. const res = await this.CommonService.GetHomeDataInfo({ userId: userInfo.userId, source: 2 })
  39. const data = res.data.supplierImage
  40. this.list = data.qualitySupplierList || [] // 供应商列表
  41. setTimeout(() => {
  42. this.skeletonShow = false
  43. }, 1000)
  44. }catch(e){
  45. //TODO handle the exception
  46. this.$util.msg(error.msg, 2000)
  47. }
  48. },
  49. // 链接跳转
  50. NavToDetailPage(pros) {
  51. this.$api.navigateTo(`/pages/supplier/user/my-shop?shopId=${pros.linkParam.id}`)
  52. },
  53. },
  54. onShow() {
  55. this.getHomeDataInfo()
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. page{
  61. background-color: #F7F7F7;
  62. }
  63. .shop-content{
  64. width: 100%;
  65. height: auto;
  66. box-sizing: border-box;
  67. padding: 24rpx 24rpx;
  68. .shop-item{
  69. width: 220rpx;
  70. height: 280rpx;
  71. float: left;
  72. margin-right: 21rpx;
  73. margin-bottom: 21rpx;
  74. background-color: #FFFFFF;
  75. &:nth-child(3n) {
  76. margin-right: 0;
  77. }
  78. .icon{
  79. width: 220rpx;
  80. height: 220rpx;
  81. margin: 0 auto;
  82. position: relative;
  83. .icon-image{
  84. width: 220rpx;
  85. height: 220rpx;
  86. display: block;
  87. }
  88. }
  89. .name{
  90. width: 100%;
  91. height: 60rpx;
  92. line-height: 60rpx;
  93. font-size: $font-size-24;
  94. text-align: center;
  95. color: #666666;
  96. background-color: #f9f9f9;
  97. float: left;
  98. box-sizing: border-box;
  99. padding: 0 20rpx;
  100. white-space: normal;
  101. word-break: break-all;
  102. overflow: hidden;
  103. text-overflow: ellipsis;
  104. display: -webkit-box;
  105. -webkit-box-orient: vertical;
  106. -webkit-line-clamp: 1;
  107. }
  108. }
  109. }
  110. </style>