templateI.vue 7.9 KB

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