templateE.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="floor-item ad_01">
  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. v-if="idx < 4"
  23. :key="idx"
  24. @click.stop="navToDetailPage(item)"
  25. >
  26. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  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. export default {
  77. name: 'templateE',
  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. .item-img-gg {
  176. width: 100%;
  177. height: 240rpx;
  178. display: block;
  179. border-radius: 16rpx;
  180. }
  181. }
  182. &.ad_02 {
  183. margin-right: 20rpx;
  184. }
  185. &:nth-child(odd) {
  186. margin-right: 0;
  187. }
  188. .item-img-gg {
  189. width: 339rpx;
  190. height: 516rpx;
  191. display: block;
  192. border-radius: 16rpx;
  193. }
  194. .item-img {
  195. width: 339rpx;
  196. height: 339rpx;
  197. border-radius: 16rpx 16rpx 0 0;
  198. display: block;
  199. margin-bottom: 8rpx;
  200. }
  201. .floor-item_tag {
  202. width: 100%;
  203. height: 32rpx;
  204. float: left;
  205. margin: 20rpx 0;
  206. padding: 0 20rpx;
  207. box-sizing: border-box;
  208. text {
  209. display: inline-block;
  210. padding: 0 8rpx;
  211. border: 1px solid #e3ebf7;
  212. border-radius: 8rpx;
  213. color: #9aa5b5;
  214. font-size: $font-size-22;
  215. line-height: 32rpx;
  216. text-align: center;
  217. float: left;
  218. }
  219. }
  220. .floor-item-content {
  221. width: 100%;
  222. padding: 0 20rpx;
  223. box-sizing: border-box;
  224. }
  225. .floor-item-act {
  226. display: block;
  227. width: 100%;
  228. height: 32rpx;
  229. text-align: center;
  230. box-sizing: border-box;
  231. }
  232. .title-none {
  233. font-size: $font-size-26;
  234. color: #ff2a2a;
  235. line-height: 54rpx;
  236. }
  237. .title {
  238. width: 100%;
  239. height: 70rpx;
  240. display: flex;
  241. line-height: 35rpx;
  242. flex-direction: column;
  243. margin: 8rpx 0;
  244. padding: 0;
  245. position: relative;
  246. .mclap {
  247. width: 100%;
  248. line-height: 35rpx;
  249. text-overflow: ellipsis;
  250. display: -webkit-box;
  251. word-break: break-all;
  252. -webkit-box-orient: vertical;
  253. -webkit-line-clamp: 2;
  254. overflow: hidden;
  255. font-size: 26rpx;
  256. &.indent {
  257. text-indent: 95rpx;
  258. }
  259. }
  260. .mclap-tag {
  261. display: block;
  262. width: 84rpx;
  263. height: 32rpx;
  264. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  265. border-radius: 4rpx 48rpx 4px 4px;
  266. line-height: 32rpx;
  267. font-size: $font-size-22;
  268. color: #ffffff;
  269. text-align: center;
  270. position: absolute;
  271. left: 0;
  272. top: 0;
  273. }
  274. }
  275. .no-price {
  276. height: 54rpx;
  277. line-height: 54rpx;
  278. display: flex;
  279. box-sizing: border-box;
  280. .p-no {
  281. font-size: $font-size-28;
  282. color: $text-color;
  283. display: block;
  284. float: left;
  285. }
  286. .p-stars {
  287. float: left;
  288. }
  289. }
  290. .price {
  291. color: #ff2a2a;
  292. line-height: 54rpx;
  293. &.none {
  294. text-decoration: line-through;
  295. color: #999999;
  296. }
  297. .sm {
  298. font-size: $font-size-24;
  299. }
  300. .big {
  301. font-size: $font-size-28;
  302. }
  303. }
  304. }
  305. }
  306. </style>