goods-instrument.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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({type:this.linkId}).then(response =>{
  73. let data = response.data
  74. this.list = data
  75. this.GetPageTopicBanner()
  76. this.skeletonShow = false
  77. }).catch(error =>{
  78. this.$util.msg(error.msg,2000)
  79. })
  80. },
  81. GetPageTopicBanner(){//获取banner
  82. this.ProductService.GetPageTopicBanner({type:this.linkId}).then(response =>{
  83. let data = response.data
  84. this.banner = data.image
  85. this.content = data.content
  86. this.buttonLink = data.buttonLink
  87. this.buttonName = data.buttonName
  88. this.buttonLinkType = data.linkType
  89. this.buttonLinkParam = data.linkParam
  90. this.buttonLinkKeyword = data.keywords
  91. uni.setNavigationBarTitle({title:data.title});
  92. }).catch(error =>{
  93. this.$util.msg(error.msg,2000)
  94. })
  95. },
  96. NavToDetailPage(pros) {//跳转
  97. if(pros.linkType){
  98. const typeMap = {
  99. 1:`/pages/goods/goods-instrument?linkId=${pros.linkParam.id}&title=${pros.title}`,
  100. 2:`/pages/goods/instrument-details?id=${pros.linkParam.id}`,
  101. 4:`/h5/pages/activity/activity?title=${pros.crmTitle}&link=${pros.crmLink}`,
  102. 5:`/pages/goods/product?id=${pros.linkParam.id}`,
  103. 7:`/supplier/pages/user/my-shop?shopId=${pros.linkParam.id}`,
  104. 8:`/h5/pages/activity/activity-list`,
  105. 9:`/second/pages/form/introduce`,
  106. 10:`/second/pages/product/product-list`,
  107. 11:`/second/pages/form/form`,
  108. 12:`/search/pages/search/search?keyWord=${pros.linkParam.keyword}`,
  109. 13:`/h5/pages/article/path?link=${pros.link}`,
  110. 14:`/h5/pages/article/path?link=${pros.link}`,
  111. 15:`/h5/pages/article/path?link=${pros.link}`,
  112. 17:`/pages/login/register-select`,
  113. 18:`/h5/pages/article/path?link=${pros.link}`,
  114. 19:`/search/pages/search/search-supplier?keyWord=${pros.linkParam.keyword}`
  115. }
  116. const url = typeMap[pros.linkType];
  117. uni.navigateTo({
  118. url:url
  119. })
  120. }
  121. },
  122. ButtonNavigateTo(linkType,linkId,linkHref,keyword) {//跳转
  123. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  124. }
  125. },
  126. onPageScroll(e){//实时获取到滚动的值
  127. if(e.scrollTop>600){
  128. this.isScrollTop = true
  129. }else{
  130. this.isScrollTop = false
  131. }
  132. },
  133. onShow() {
  134. }
  135. }
  136. </script>
  137. <style lang="scss">
  138. page{
  139. background-color: #F7F7F7;
  140. }
  141. .instrument{
  142. width: 100%;
  143. height: auto;
  144. .banner{
  145. box-sizing: border-box;
  146. padding:24rpx;
  147. width: 100%;
  148. .banner-image{
  149. width: 100%;
  150. height: 248rpx;
  151. border-radius: 16rpx;
  152. float: left;
  153. image{
  154. width: 100%;
  155. height: 248rpx;
  156. border-radius: 16rpx;
  157. }
  158. }
  159. .content{
  160. width: 100%;
  161. margin-top: 10rpx;
  162. float: left;
  163. box-sizing: border-box;
  164. background-color: #FFFFFF;
  165. font-size: $font-size-26;
  166. color: #666666;
  167. text-align: justify;
  168. line-height: 36rpx;
  169. }
  170. }
  171. .instrument-btn{
  172. width: 100%;
  173. box-sizing: border-box;
  174. padding: 7rpx 24rpx;
  175. background-color: #FFFFFF;
  176. position: fixed;
  177. bottom: 0;
  178. left: 0;
  179. z-index: 999;
  180. .btn{
  181. width: 100%;
  182. height: 100%;
  183. background-image: $btn-confirm;
  184. line-height: 84rpx;
  185. border-radius: 42rpx;
  186. text-align: center;
  187. font-size: 26rpx;
  188. color: #FFFFFF;
  189. }
  190. }
  191. .instrument-list{
  192. width: 100%;
  193. height: auto;
  194. box-sizing: border-box;
  195. padding: 0 24rpx;
  196. .list-item-cell{
  197. width: 100%;
  198. height: auto;
  199. float: left;
  200. .list-item-title{
  201. width: 100%;
  202. height: 88rpx;
  203. line-height: 88rpx;
  204. float: left;
  205. .title{
  206. font-size: $font-size-28;
  207. line-height: 80rpx;
  208. color: $text-color;
  209. font-weight: bold;
  210. &.float{
  211. float: left;
  212. }
  213. }
  214. .more{
  215. font-size: $font-size-26;
  216. line-height: 80rpx;
  217. color: #999999;
  218. height: 80rpx;
  219. float: right;
  220. .icon-xiangyou{
  221. font-size: $font-size-28;
  222. margin-left: 10rpx;
  223. }
  224. }
  225. }
  226. .list-item-pros{
  227. width: 100%;
  228. height: auto;
  229. float: left;
  230. .item-pros{
  231. width: 340rpx;
  232. height: 414rpx;
  233. float: left;
  234. margin-right: 20rpx;
  235. margin-bottom: 20rpx;
  236. background-color: #FFFFFF;
  237. border-radius: 16rpx;
  238. &:nth-child(2n){
  239. margin-right: 0;
  240. }
  241. .item-pros-image{
  242. width: 340rpx;
  243. height: 340rpx;
  244. float: left;
  245. image{
  246. width: 340rpx;
  247. height: 340rpx;
  248. display: block;
  249. border-radius: 16rpx 16rpx 0 0;
  250. }
  251. }
  252. .item-pros-name{
  253. width: 100%;
  254. height: 74rpx;
  255. line-height: 74rpx;
  256. box-sizing: border-box;
  257. padding: 0 24rpx;
  258. white-space: normal;
  259. word-break: break-all;
  260. overflow: hidden;
  261. text-overflow: ellipsis;
  262. display: -webkit-box;
  263. -webkit-box-orient: vertical;
  264. -webkit-line-clamp: 1;
  265. text-align: center;
  266. font-size: $font-size-26;
  267. line-height: 74rpx;
  268. text-align: center;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. }
  275. </style>