templateA.vue 6.7 KB

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