templateF.vue 7.3 KB

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