goods-instrument.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="container instrument clearfix">
  3. <tui-skeleton v-if="skeletonShow" backgroundColor="#fafafa" borderRadius="10rpx" :isLoading ="true" :loadingType="5"></tui-skeleton>
  4. <template v-else>
  5. <view class="instrument-btn" v-if="buttonName" :style="{paddingBottom :isIphoneX ? '68rpx' : '34rpx'}">
  6. <view class="btn" @click="ButtonNavigateTo(buttonLinkType,buttonLinkParam.id,buttonLink,buttonLinkKeyword)">{{ buttonName }}</view>
  7. </view>
  8. <view class="banner clearfix">
  9. <view class="banner-image">
  10. <image :src="banner" mode=""></image>
  11. </view>
  12. <view class=content v-if="linkId == 6">
  13. <text>{{ content }}</text>
  14. </view>
  15. </view>
  16. <view class="instrument-list clearfix" :style="{paddingBottom :isIphoneX ? '83px' : '34px'}">
  17. <view class="list-item-cell" v-for="(item,index) in list" :key="index">
  18. <view class="list-item-title">
  19. <view class="title" :class="item.link ? 'float' : ''">
  20. <text>{{ item.title }}</text>
  21. </view>
  22. <view class="more" v-if="item.link" @click="NavToDetailPage(item)">
  23. <text>查看更多</text>
  24. <text class="iconfont icon-xiangyou"></text>
  25. </view>
  26. </view>
  27. <view class="list-item-pros">
  28. <view class="item-pros" v-for="(pros,prosIndex) in item.floorData" :key="prosIndex" @click="NavToDetailPage(pros)">
  29. <view class="item-pros-image">
  30. <image :src="pros.image" mode=""></image>
  31. </view>
  32. <view class="item-pros-name">{{ pros.title }}</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <!-- 侧边 -->
  39. <scroll-top :isScrollTop="isScrollTop" :bottom="200"></scroll-top>
  40. </view>
  41. </template>
  42. <script>
  43. export default{
  44. components:{
  45. },
  46. data(){
  47. return{
  48. isIphoneX:this.$store.state.isIphoneX,
  49. banner:'',
  50. list:[],
  51. linkId:0,
  52. isScrollTop:false,
  53. linkTitle:'',
  54. skeletonShow:true,
  55. content:'',
  56. buttonName:'',
  57. buttonLink:'',
  58. buttonLinkType:'',
  59. buttonLinkParam:{},
  60. buttonLinkKeyword:''
  61. }
  62. },
  63. onLoad(option) {
  64. console.log(option)
  65. let _self = this
  66. this.linkId = option.linkId
  67. this.linkTitle = option.title
  68. this.GetPageTopicInfo()
  69. },
  70. methods:{
  71. GetPageTopicInfo(){//获取数据
  72. this.ProductService.GetPageTopic({pageId:this.linkId, source:2}).then(response =>{
  73. let { floorList, page } = response.data
  74. this.list = floorList
  75. this.banner = page.image
  76. this.content = page.content
  77. this.buttonLink = page.buttonLink
  78. this.buttonName = page.buttonName
  79. this.buttonLinkType = page.linkType
  80. this.buttonLinkParam = page.linkParam
  81. this.buttonLinkKeyword = page.keywords
  82. uni.setNavigationBarTitle({title:page.title})
  83. this.skeletonShow = false
  84. }).catch(error =>{
  85. this.$util.msg(error.msg,2000)
  86. })
  87. },
  88. NavToDetailPage(pros) {//跳转
  89. if(pros.linkType){
  90. const typeMap = {
  91. 1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}&title=${pros.title}`,
  92. 2:`/pages/goods/instrument-details?id=${pros.linkParam.id}`,
  93. 4:`/pages/h5/activity/activity?title=${pros.crmTitle}&link=${pros.crmLink}`,
  94. 5:`/pages/goods/product?id=${pros.linkParam.id}`,
  95. // 7:`/pages/supplier/user/my-shop?shopId=${pros.linkParam.id}`,
  96. 8:'/pages/h5/activity/activity-list',
  97. 9:'/pages/second/form/introduce',
  98. 10:'/pages/second/product/product-list',
  99. 11:'/pages/second/form/form',
  100. 12:`/pages/search/search?keyWord=${pros.linkParam.keyword}`,
  101. 13:`/pages/h5/article/path?link=${pros.link}`,
  102. 14:`/pages/h5/article/path?link=${pros.link}`,
  103. 15:`/pages/h5/article/path?link=${pros.link}`,
  104. 17:'/pages/login/register-select',
  105. 18:`/pages/h5/article/path?link=${pros.link}`,
  106. 19:`/pages/search/search-supplier?keyWord=${pros.linkParam.keyword}`
  107. }
  108. const url = typeMap[pros.linkType]
  109. uni.navigateTo({
  110. url:url
  111. })
  112. }
  113. },
  114. ButtonNavigateTo(linkType,linkId,linkHref,keyword) {//跳转
  115. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  116. }
  117. },
  118. onPageScroll(e){//实时获取到滚动的值
  119. if(e.scrollTop>600){
  120. this.isScrollTop = true
  121. }else{
  122. this.isScrollTop = false
  123. }
  124. },
  125. onShow() {
  126. }
  127. }
  128. </script>
  129. <style lang="scss">
  130. page{
  131. background-color: #F7F7F7;
  132. }
  133. .instrument{
  134. width: 100%;
  135. height: auto;
  136. .banner{
  137. box-sizing: border-box;
  138. padding:24rpx;
  139. width: 100%;
  140. .banner-image{
  141. width: 100%;
  142. height: 248rpx;
  143. border-radius: 16rpx;
  144. float: left;
  145. image{
  146. width: 100%;
  147. height: 248rpx;
  148. border-radius: 16rpx;
  149. }
  150. }
  151. .content{
  152. width: 100%;
  153. margin-top: 10rpx;
  154. float: left;
  155. box-sizing: border-box;
  156. background-color: #FFFFFF;
  157. font-size: $font-size-26;
  158. color: #666666;
  159. text-align: justify;
  160. line-height: 36rpx;
  161. }
  162. }
  163. .instrument-btn{
  164. width: 100%;
  165. box-sizing: border-box;
  166. padding: 7rpx 24rpx;
  167. background-color: #FFFFFF;
  168. position: fixed;
  169. bottom: 0;
  170. left: 0;
  171. z-index: 999;
  172. .btn{
  173. width: 100%;
  174. height: 100%;
  175. background-image: $btn-confirm;
  176. line-height: 84rpx;
  177. border-radius: 42rpx;
  178. text-align: center;
  179. font-size: 26rpx;
  180. color: #FFFFFF;
  181. }
  182. }
  183. .instrument-list{
  184. width: 100%;
  185. height: auto;
  186. box-sizing: border-box;
  187. padding: 0 24rpx;
  188. .list-item-cell{
  189. width: 100%;
  190. height: auto;
  191. float: left;
  192. .list-item-title{
  193. width: 100%;
  194. height: 88rpx;
  195. line-height: 88rpx;
  196. float: left;
  197. .title{
  198. font-size: $font-size-28;
  199. line-height: 80rpx;
  200. color: $text-color;
  201. font-weight: bold;
  202. &.float{
  203. float: left;
  204. }
  205. }
  206. .more{
  207. font-size: $font-size-26;
  208. line-height: 80rpx;
  209. color: #999999;
  210. height: 80rpx;
  211. float: right;
  212. .icon-xiangyou{
  213. font-size: $font-size-28;
  214. margin-left: 10rpx;
  215. }
  216. }
  217. }
  218. .list-item-pros{
  219. width: 100%;
  220. height: auto;
  221. float: left;
  222. .item-pros{
  223. width: 340rpx;
  224. height: 414rpx;
  225. float: left;
  226. margin-right: 20rpx;
  227. margin-bottom: 20rpx;
  228. background-color: #FFFFFF;
  229. border-radius: 16rpx;
  230. &:nth-child(2n){
  231. margin-right: 0;
  232. }
  233. .item-pros-image{
  234. width: 340rpx;
  235. height: 340rpx;
  236. float: left;
  237. image{
  238. width: 340rpx;
  239. height: 340rpx;
  240. display: block;
  241. border-radius: 16rpx 16rpx 0 0;
  242. }
  243. }
  244. .item-pros-name{
  245. width: 100%;
  246. height: 74rpx;
  247. line-height: 74rpx;
  248. box-sizing: border-box;
  249. padding: 0 24rpx;
  250. white-space: normal;
  251. word-break: break-all;
  252. overflow: hidden;
  253. text-overflow: ellipsis;
  254. display: -webkit-box;
  255. -webkit-box-orient: vertical;
  256. -webkit-line-clamp: 1;
  257. text-align: center;
  258. font-size: $font-size-26;
  259. line-height: 74rpx;
  260. text-align: center;
  261. }
  262. }
  263. }
  264. }
  265. }
  266. }
  267. </style>