templateF.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view
  4. class="floor-item ad_04 clearfix"
  5. v-for="(item, idx) in floorData.floorImageList"
  6. v-if="idx < 4"
  7. :key="idx"
  8. @click.stop="navToDetailPage(item)"
  9. >
  10. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  11. <view class="floor-item_tag" v-if="item.listType == 2">
  12. <text>{{ item.label }}</text>
  13. </view>
  14. <view class="floor-item-content">
  15. <view class="title tui-skeleton-rect">
  16. <text class="mclap-tag" v-if="item.product.beautyActFlag == '1'">美博会</text>
  17. <text class="mclap" :class="item.product.beautyActFlag == '1' ? 'indent' : ''"
  18. >{{ item.name }}
  19. </text>
  20. </view>
  21. <view class="floor-item-price" v-if="item.listType == 1">
  22. <template>
  23. <template-Tags :product="item.product"></template-Tags>
  24. </template>
  25. <view v-if="hasLogin">
  26. <template v-if="item.product.productCategory == 1">
  27. <template-Price :product="item.product"></template-Price>
  28. </template>
  29. <template v-else>
  30. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  31. <text class="p sm">¥</text> <text class="p big">价格详聊</text>
  32. </view>
  33. <view class="price tui-skeleton-rect" v-else>
  34. <text class="p sm">¥</text>
  35. <text class="p big">{{ item.product.price | NumFormat }}</text>
  36. </view>
  37. </template>
  38. </view>
  39. <view v-else class="no-price">
  40. <template v-if="item.product.productCategory == 1">
  41. <view class="p-stars">
  42. <text class="p-no">¥</text>
  43. <uni-grader :grade="Number(item.product.priceGrade)" :margin="14"></uni-grader>
  44. </view>
  45. </template>
  46. <template v-else>
  47. <view class="p-stars"> <text class="p-no">¥登录可见</text> </view>
  48. </template>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="floor-item ad_01">
  54. <image
  55. class="item-img-gg"
  56. :src="floorData.floorContent.appletsAdsImage1"
  57. @click="
  58. BannerNavigateTo(
  59. floorData.floorContent.linkType1,
  60. floorData.floorContent.linkParam1.id ? floorData.floorContent.linkParam1.id : '',
  61. floorData.floorContent.adsLink1,
  62. floorData.floorContent.linkParam1.keyword ? floorData.floorContent.linkParam1.keyword : ''
  63. )
  64. "
  65. mode="aspectFill"
  66. >
  67. </image>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import { mapState, mapMutations } from 'vuex'
  73. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  74. import templateTags from '@/components/cm-module/pageTemplate/templateTags.vue'
  75. import templatePrice from '@/components/cm-module/pageTemplate/templatePrice.vue'
  76. export default {
  77. name: 'templateF',
  78. components: {
  79. uniGrader,
  80. templateTags,
  81. templatePrice
  82. },
  83. props: {
  84. pageData: {
  85. type: Object
  86. },
  87. userIdentity: {
  88. type: Number
  89. }
  90. },
  91. data() {
  92. return {
  93. shopId: 0,
  94. floorData: {}
  95. }
  96. },
  97. filters: {
  98. NumFormat: function(text) {
  99. //处理金额
  100. return Number(text).toFixed(2)
  101. }
  102. },
  103. created() {
  104. this.initData(this.pageData)
  105. },
  106. computed: {
  107. ...mapState(['hasLogin', 'userInfo', 'isActivity'])
  108. },
  109. watch: {
  110. pageData: {
  111. handler: function(el) {
  112. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  113. this.pageData = el
  114. this.initData(this.pageData)
  115. },
  116. deep: true
  117. }
  118. },
  119. methods: {
  120. initData(data) {
  121. this.floorData = data
  122. // console.log(this.floorData)
  123. this.$api
  124. .getStorage()
  125. .then(resolve => {
  126. this.shopId = resolve.shopId ? resolve.shopId : 0
  127. })
  128. .catch(err => {
  129. console.log('err', err)
  130. })
  131. },
  132. PromotionsFormat(promo) {
  133. //促销活动类型数据处理
  134. if (promo != null) {
  135. if (promo.type == 1 && promo.mode == 1) {
  136. return true
  137. } else {
  138. return false
  139. }
  140. }
  141. return false
  142. },
  143. navToDetailPage(pros) {
  144. //跳转商品详情页
  145. this.$api.FlooryNavigateTo(pros)
  146. },
  147. BannerNavigateTo(linkType, linkId, linkHref, keyword) {
  148. //跳转商品详情页
  149. this.$api.BannerNavigateTo(linkType, linkId, linkHref, keyword)
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss">
  155. .section_page_main {
  156. width: 100%;
  157. height: auto;
  158. box-sizing: border-box;
  159. .floor-item {
  160. width: 339rpx;
  161. height: 516rpx;
  162. margin-right: 20rpx;
  163. font-size: $font-size-24;
  164. color: $text-color;
  165. background: #ffffff;
  166. line-height: 36rpx;
  167. border-radius: 16rpx;
  168. margin-bottom: 20rpx;
  169. float: left;
  170. box-sizing: border-box;
  171. position: relative;
  172. &.ad_01 {
  173. width: 100%;
  174. height: 240rpx;
  175. margin-right: 0;
  176. .item-img-gg {
  177. width: 100%;
  178. height: 240rpx;
  179. display: block;
  180. border-radius: 16rpx;
  181. }
  182. }
  183. &:nth-child(2n) {
  184. margin-right: 0;
  185. }
  186. .item-img-gg {
  187. width: 339rpx;
  188. height: 516rpx;
  189. display: block;
  190. border-radius: 16rpx;
  191. }
  192. .item-img {
  193. width: 339rpx;
  194. height: 339rpx;
  195. border-radius: 16rpx 16rpx 0 0;
  196. display: block;
  197. margin-bottom: 8rpx;
  198. }
  199. .floor-item_tag {
  200. width: 100%;
  201. height: 32rpx;
  202. float: left;
  203. margin: 20rpx 0;
  204. padding: 0 20rpx;
  205. box-sizing: border-box;
  206. text {
  207. display: inline-block;
  208. padding: 0 8rpx;
  209. border: 1px solid #e3ebf7;
  210. border-radius: 8rpx;
  211. color: #9aa5b5;
  212. font-size: $font-size-22;
  213. line-height: 32rpx;
  214. text-align: center;
  215. float: left;
  216. }
  217. }
  218. .floor-item_tag {
  219. width: 100%;
  220. height: 32rpx;
  221. float: left;
  222. margin: 8rpx 0;
  223. padding: 0 20rpx;
  224. box-sizing: border-box;
  225. margin-bottom: 20rpx;
  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. </style>