templateZ.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="tui-floor-item" v-if="floorData.imageList.length>0">
  4. <swiper class="tui-floor-swiper" circular @change="swiperChange" :indicator-dots="false" :autoplay="true"
  5. :interval="5000" :duration="500">
  6. <swiper-item v-for="(item, index) in floorData.imageList" :key="item">
  7. <view class="tui-floor-swiper" @click="BannerNavigateTo(
  8. item.linkType,
  9. item.linkParam.id ? item.linkParam.id : '',
  10. item.linkParam.crmLink,
  11. item.linkParam.keyword ? item.linkParam.keyword : '')">
  12. <image class="floor-image" :src="item.crmImage" mode=""></image>
  13. </view>
  14. </swiper-item>
  15. </swiper>
  16. <view class="swiper__dots-box">
  17. <view v-for="(item, idx) in floorData.imageList" :key="idx"
  18. :class="[idx === current ? 'swiper__dots-long' : 'none']" :data-index="current"
  19. class="swiper__dots-item"></view>
  20. </view>
  21. </view>
  22. <view class="floor-item-main">
  23. <view class="floor-item clearfix" v-for="(pros, idx) in floorData.products" :key="idx"
  24. @click.stop="navToDetailPage(pros)">
  25. <image class="item-img tui-skeleton-fillet" :src="pros.mainImage" mode="aspectFill"></image>
  26. <template-Type :product="pros"></template-Type>
  27. <view class="floor-item-content">
  28. <view class="title tui-skeleton-rect">
  29. <text class="mclap" :class="pros.beautyActFlag == '1' ? 'indent' : ''">{{ pros.name }}
  30. </text>
  31. </view>
  32. <view class="floor-item-price">
  33. <template>
  34. <template-Tags :product="pros"></template-Tags>
  35. </template>
  36. <view v-if="hasLogin">
  37. <template v-if="pros.productCategory == 1">
  38. <template-Price :product="pros"></template-Price>
  39. </template>
  40. <template v-else>
  41. <view class="price tui-skeleton-rect" v-if="pros.detailTalkFlag == '2'">
  42. <text class="p sm">¥</text> <text class="p big">价格详聊</text>
  43. </view>
  44. <view class="price tui-skeleton-rect" v-else>
  45. <text class="p sm">¥</text>
  46. <text class="p big">{{ pros.price | NumFormat }}</text>
  47. </view>
  48. </template>
  49. </view>
  50. <view v-else class="no-price">
  51. <template v-if="pros.productCategory == 1">
  52. <view class="p-stars">
  53. <text class="p-no">¥</text>
  54. <uni-grader :grade="Number(pros.priceGrade)" :margin="14"></uni-grader>
  55. </view>
  56. </template>
  57. <template v-else>
  58. <view class="p-stars"> <text class="p-no">¥登录可见</text> </view>
  59. </template>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import { mapState, mapMutations } from 'vuex'
  69. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  70. import templateTags from '@/components/cm-module/pageTemplate/templateTags.vue'
  71. import templatePrice from '@/components/cm-module/pageTemplate/templatePrice.vue'
  72. import templateType from '@/components/cm-module/pageTemplate/templateType.vue'
  73. export default {
  74. name: 'templateZ',
  75. components: {
  76. uniGrader,
  77. templateTags,
  78. templatePrice,
  79. templateType
  80. },
  81. props: {
  82. pageData: {
  83. type: Object
  84. },
  85. userIdentity: {
  86. type: Number
  87. }
  88. },
  89. data() {
  90. return {
  91. current:0,
  92. floorData: {}
  93. }
  94. },
  95. filters: {
  96. NumFormat: function(text) {
  97. //处理金额
  98. return Number(text).toFixed(2)
  99. }
  100. },
  101. computed: {
  102. ...mapState(['hasLogin', 'userInfo', 'isActivity'])
  103. },
  104. created() {
  105. this.initData(this.pageData)
  106. },
  107. watch: {
  108. pageData: {
  109. handler: function(el) {
  110. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  111. this.pageData = el
  112. this.initData(this.pageData)
  113. },
  114. deep: true
  115. }
  116. },
  117. methods: {
  118. initData(data) {
  119. this.floorData = data
  120. },
  121. navToDetailPage(pros) {
  122. //跳转商品详情
  123. this.$api.navigateTo(`/pages/goods/product?id=${pros.productId}`)
  124. },
  125. BannerNavigateTo(linkType, linkId, linkHref, keyword) {
  126. //跳转
  127. this.$api.BannerNavigateTo(linkType, linkId, linkHref, keyword)
  128. },
  129. swiperChange(e) {//轮播图切换
  130. this.current = e.detail.current
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss">
  136. .section_page_main {
  137. width: 100%;
  138. height: auto;
  139. box-sizing: border-box;
  140. .tui-floor-item{
  141. width: 100%;
  142. height: 240rpx;
  143. border-radius: 16rpx;
  144. box-sizing: border-box;
  145. padding: 0;
  146. position: relative;
  147. margin-bottom: 24rpx;
  148. .swiper__dots-box{
  149. position: absolute;
  150. bottom: 30rpx;
  151. left: 0;
  152. right: 0;
  153. /* #ifndef APP-NVUE */
  154. display: flex;
  155. /* #endif */
  156. flex: 1;
  157. flex-direction: row;
  158. justify-content: center;
  159. align-items: center;
  160. .swiper__dots-item{
  161. width: 8rpx;
  162. height: 8rpx;
  163. border-radius: 100%;
  164. margin-left: 6px;
  165. background-color:rgba(255,255,255,.7);
  166. }
  167. .swiper__dots-long{
  168. width: 35rpx;
  169. height: 8rpx;
  170. border-radius: 4rpx;
  171. background-color: #ffff;
  172. transition: all 0.4s;
  173. }
  174. }
  175. .tui-floor-swiper{
  176. width: 100%;
  177. height: 240rpx;
  178. text-align: center;
  179. line-height: 240rpx;
  180. float: left;
  181. border-radius: 16rpx;
  182. overflow: hidden;
  183. .floor-image{
  184. width: 100%;
  185. height: 100%;
  186. display: block;
  187. }
  188. }
  189. }
  190. .floor-item-main{
  191. width: 100%;
  192. height: auto;
  193. display: flex;
  194. justify-content: space-between;
  195. flex-wrap: wrap;
  196. align-items: center;
  197. .floor-item {
  198. width: 339rpx;
  199. height: 524rpx;
  200. font-size: $font-size-24;
  201. color: $text-color;
  202. background: #ffffff;
  203. line-height: 36rpx;
  204. border-radius: 16rpx;
  205. box-sizing: border-box;
  206. position: relative;
  207. margin-right: 20rpx;
  208. margin-bottom: 20rpx;
  209. &:nth-child(2n){
  210. margin-right: 0;
  211. }
  212. .item-img {
  213. width: 339rpx;
  214. height: 339rpx;
  215. border-radius: 16rpx 16rpx 0 0;
  216. display: block;
  217. margin-bottom: 8rpx;
  218. }
  219. .floor-item_tag {
  220. width: 100%;
  221. height: 32rpx;
  222. float: left;
  223. margin: 20rpx 0;
  224. padding: 0 20rpx;
  225. box-sizing: border-box;
  226. text {
  227. display: inline-block;
  228. padding: 0 8rpx;
  229. border: 1px solid #e3ebf7;
  230. border-radius: 8rpx;
  231. color: #9aa5b5;
  232. font-size: $font-size-22;
  233. line-height: 32rpx;
  234. text-align: center;
  235. float: left;
  236. }
  237. }
  238. .floor-item-content {
  239. width: 100%;
  240. padding: 0 20rpx;
  241. box-sizing: border-box;
  242. }
  243. .floor-item-act {
  244. display: block;
  245. width: 100%;
  246. height: 32rpx;
  247. text-align: center;
  248. box-sizing: border-box;
  249. }
  250. .title-none {
  251. font-size: $font-size-26;
  252. color: #ff2a2a;
  253. line-height: 54rpx;
  254. }
  255. .title {
  256. width: 100%;
  257. height: 70rpx;
  258. display: flex;
  259. line-height: 35rpx;
  260. flex-direction: column;
  261. margin: 8rpx 0;
  262. padding: 0;
  263. position: relative;
  264. .mclap {
  265. width: 100%;
  266. line-height: 35rpx;
  267. text-overflow: ellipsis;
  268. display: -webkit-box;
  269. word-break: break-all;
  270. -webkit-box-orient: vertical;
  271. -webkit-line-clamp: 2;
  272. overflow: hidden;
  273. font-size: 26rpx;
  274. &.indent {
  275. text-indent: 95rpx;
  276. }
  277. }
  278. .mclap-tag {
  279. display: block;
  280. width: 84rpx;
  281. height: 32rpx;
  282. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  283. border-radius: 4rpx 48rpx 4px 4px;
  284. line-height: 32rpx;
  285. font-size: $font-size-22;
  286. color: #ffffff;
  287. text-align: center;
  288. position: absolute;
  289. left: 0;
  290. top: 0;
  291. }
  292. }
  293. .no-price {
  294. height: 54rpx;
  295. line-height: 54rpx;
  296. display: flex;
  297. box-sizing: border-box;
  298. .p-no {
  299. font-size: $font-size-28;
  300. color: $text-color;
  301. display: block;
  302. float: left;
  303. }
  304. .p-stars {
  305. float: left;
  306. }
  307. }
  308. .price {
  309. color: #ff2a2a;
  310. line-height: 54rpx;
  311. &.none {
  312. text-decoration: line-through;
  313. color: #999999;
  314. }
  315. .sm {
  316. font-size: $font-size-24;
  317. }
  318. .big {
  319. font-size: $font-size-28;
  320. }
  321. }
  322. }
  323. }
  324. }
  325. </style>