templateI.vue 7.8 KB

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