templateI.vue 7.7 KB

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