templateI.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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. <view class="floor-item-act">
  71. <view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
  72. <template v-if="userIdentity === 3">
  73. <template v-if="item.product.actStatus === 1">
  74. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  75. {{ item.product.promotions.name }}
  76. <text
  77. v-if="hasLogin && item.product.priceFlag != 1 && item.product.shopID == shopId"
  78. >:¥{{ item.product.price | NumFormat }}</text
  79. >
  80. </view>
  81. <view class="floor-tags" v-else>{{ item.product.promotions.name }}</view>
  82. </template>
  83. </template>
  84. <template v-else>
  85. <template v-if="item.product.actStatus === 1">
  86. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  87. {{ item.product.promotions.name }}
  88. <text v-if="hasLogin && item.product.priceFlag != 1"
  89. >:¥{{ item.product.price | NumFormat }}</text
  90. >
  91. </view>
  92. <view class="floor-tags" v-else>{{ item.product.promotions.name }}</view>
  93. </template>
  94. </template>
  95. </view>
  96. <view v-if="hasLogin">
  97. <template v-if="item.product.productCategory == 1">
  98. <template v-if="userIdentity == 3">
  99. <template v-if="item.product.shopID == shopId">
  100. <view class="title-none" v-if="item.product.priceFlag === 1">
  101. <text class="p big">¥未公开价格</text>
  102. </view>
  103. <view
  104. class="price tui-skeleton-rect"
  105. v-else
  106. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  107. >
  108. <text class="p sm">¥</text>
  109. <text class="p big">{{
  110. (PromotionsFormat(item.product.promotions)
  111. ? item.product.originalPrice
  112. : item.product.price) | NumFormat
  113. }}</text>
  114. </view>
  115. </template>
  116. <template v-else>
  117. <view class="no-price">
  118. <view class="p-stars">
  119. <text class="p-no">¥</text>
  120. <uni-grader
  121. :grade="Number(item.product.priceGrade)"
  122. :margin="14"
  123. ></uni-grader>
  124. </view>
  125. </view>
  126. </template>
  127. </template>
  128. <template v-else-if="userIdentity === 4">
  129. <view class="title-none" v-if="item.product.priceFlag === 1">
  130. <text class="p big">¥未公开价格</text>
  131. </view>
  132. <view class="title-none" v-if="item.product.priceFlag === 2">
  133. <text class="p big">¥价格仅会员可见</text>
  134. </view>
  135. <view
  136. class="price tui-skeleton-rect"
  137. v-if="item.product.priceFlag === 0"
  138. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  139. >
  140. <text class="p sm">¥</text>
  141. <text class="p big">{{
  142. (PromotionsFormat(item.product.promotions)
  143. ? item.product.originalPrice
  144. : item.product.price) | NumFormat
  145. }}</text>
  146. </view>
  147. </template>
  148. <template v-else>
  149. <view class="title-none" v-if="item.product.priceFlag === 1">
  150. <text class="p big">¥未公开价格</text>
  151. </view>
  152. <view
  153. class="price tui-skeleton-rect"
  154. v-else
  155. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  156. >
  157. <text class="p sm">¥</text>
  158. <text class="p big">{{
  159. (PromotionsFormat(item.product.promotions)
  160. ? item.product.originalPrice
  161. : item.product.price) | NumFormat
  162. }}</text>
  163. </view>
  164. </template>
  165. </template>
  166. <template v-else>
  167. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  168. <text class="p sm">¥</text> <text class="p big">价格详聊</text>
  169. </view>
  170. <view class="price tui-skeleton-rect" v-else>
  171. <text class="p sm">¥</text>
  172. <text class="p big">{{ item.product.price | NumFormat }}</text>
  173. </view>
  174. </template>
  175. </view>
  176. <view v-else class="no-price">
  177. <template v-if="item.product.productCategory == 1">
  178. <view class="p-stars">
  179. <text class="p-no">¥</text>
  180. <uni-grader :grade="Number(item.product.priceGrade)" :margin="14"></uni-grader>
  181. </view>
  182. </template>
  183. <template v-else>
  184. <view class="p-stars"> <text class="p-no">¥登录可见</text> </view>
  185. </template>
  186. </view>
  187. </view>
  188. </view>
  189. </view>
  190. </view>
  191. </template>
  192. <script>
  193. import { mapState, mapMutations } from 'vuex'
  194. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  195. export default {
  196. name: 'templateD',
  197. components: {
  198. uniGrader
  199. },
  200. props: {
  201. pageData: {
  202. type: Object
  203. },
  204. userIdentity: {
  205. type: Number
  206. }
  207. },
  208. data() {
  209. return {
  210. shopId: 0,
  211. floorData: {}
  212. }
  213. },
  214. filters: {
  215. NumFormat: function(text) {
  216. //处理金额
  217. return Number(text).toFixed(2)
  218. }
  219. },
  220. created() {
  221. this.initData(this.pageData)
  222. },
  223. computed: {
  224. ...mapState(['hasLogin', 'userInfo', 'isActivity'])
  225. },
  226. watch: {
  227. pageData: {
  228. handler: function(el) {
  229. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  230. this.pageData = el
  231. this.initData(this.pageData)
  232. },
  233. deep: true
  234. }
  235. },
  236. methods: {
  237. initData(data) {
  238. this.$api.getStorage().then(resolve => {
  239. this.shopId = resolve.shopId ? resolve.shopId : 0
  240. })
  241. this.floorData = data
  242. // console.log(this.floorData)
  243. },
  244. PromotionsFormat(promo) {
  245. //促销活动类型数据处理
  246. if (promo != null) {
  247. if (promo.type == 1 && promo.mode == 1) {
  248. return true
  249. } else {
  250. return false
  251. }
  252. }
  253. return false
  254. },
  255. navToDetailPage(pros) {
  256. //跳转商品详情页
  257. this.$api.FlooryNavigateTo(pros)
  258. },
  259. BannerNavigateTo(linkType, linkId, linkHref, keyword) {
  260. //跳转商品详情页
  261. this.$api.BannerNavigateTo(linkType, linkId, linkHref, keyword)
  262. }
  263. }
  264. }
  265. </script>
  266. <style lang="scss">
  267. .section_page_main {
  268. width: 100%;
  269. height: auto;
  270. box-sizing: border-box;
  271. .floor-item {
  272. width: 339rpx;
  273. height: 516rpx;
  274. margin-right: 20rpx;
  275. font-size: $font-size-24;
  276. color: $text-color;
  277. background: #ffffff;
  278. line-height: 36rpx;
  279. border-radius: 16rpx;
  280. margin-bottom: 20rpx;
  281. float: left;
  282. box-sizing: border-box;
  283. position: relative;
  284. &.ad_01 {
  285. width: 100%;
  286. height: 240rpx;
  287. margin-right: 0;
  288. .item-img-gg {
  289. width: 100%;
  290. height: 240rpx;
  291. display: block;
  292. border-radius: 16rpx;
  293. }
  294. }
  295. &:nth-child(odd) {
  296. margin-right: 0;
  297. }
  298. &.ad_02,
  299. &.ad_03 {
  300. width: 339rpx;
  301. height: 260rpx;
  302. .item-img-gg {
  303. width: 339rpx;
  304. height: 260rpx;
  305. display: block;
  306. border-radius: 16rpx;
  307. }
  308. }
  309. .item-img {
  310. width: 339rpx;
  311. height: 339rpx;
  312. border-radius: 16rpx 16rpx 0 0;
  313. display: block;
  314. margin-bottom: 8rpx;
  315. }
  316. .floor-item_tag {
  317. width: 100%;
  318. height: 32rpx;
  319. float: left;
  320. margin: 20rpx 0;
  321. padding: 0 20rpx;
  322. box-sizing: border-box;
  323. text {
  324. display: inline-block;
  325. padding: 0 8rpx;
  326. border: 1px solid #e3ebf7;
  327. border-radius: 8rpx;
  328. color: #9aa5b5;
  329. font-size: $font-size-22;
  330. line-height: 32rpx;
  331. text-align: center;
  332. float: left;
  333. }
  334. }
  335. .floor-item-content {
  336. width: 100%;
  337. padding: 0 20rpx;
  338. box-sizing: border-box;
  339. }
  340. .floor-item-act {
  341. display: block;
  342. width: 100%;
  343. height: 32rpx;
  344. text-align: center;
  345. box-sizing: border-box;
  346. .floor-tags {
  347. height: 32rpx;
  348. box-sizing: border-box;
  349. border-radius: 8rpx;
  350. background-color: #ffffff;
  351. line-height: 28rpx;
  352. color: $color-system;
  353. text-align: center;
  354. display: inline-block;
  355. padding: 0 16rpx;
  356. font-size: $font-size-20;
  357. border: 1px solid #e15616;
  358. float: left;
  359. }
  360. }
  361. .title-none {
  362. font-size: $font-size-26;
  363. color: #ff2a2a;
  364. line-height: 54rpx;
  365. }
  366. .title {
  367. width: 100%;
  368. height: 70rpx;
  369. display: flex;
  370. line-height: 35rpx;
  371. flex-direction: column;
  372. margin: 8rpx 0;
  373. padding: 0;
  374. position: relative;
  375. .mclap {
  376. width: 100%;
  377. line-height: 35rpx;
  378. text-overflow: ellipsis;
  379. display: -webkit-box;
  380. word-break: break-all;
  381. -webkit-box-orient: vertical;
  382. -webkit-line-clamp: 2;
  383. overflow: hidden;
  384. font-size: 26rpx;
  385. &.indent {
  386. text-indent: 95rpx;
  387. }
  388. }
  389. .mclap-tag {
  390. display: block;
  391. width: 84rpx;
  392. height: 32rpx;
  393. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  394. border-radius: 4rpx 48rpx 4px 4px;
  395. line-height: 32rpx;
  396. font-size: $font-size-22;
  397. color: #ffffff;
  398. text-align: center;
  399. position: absolute;
  400. left: 0;
  401. top: 0;
  402. }
  403. }
  404. .no-price {
  405. height: 54rpx;
  406. line-height: 54rpx;
  407. display: flex;
  408. box-sizing: border-box;
  409. .p-no {
  410. font-size: $font-size-28;
  411. color: $text-color;
  412. display: block;
  413. float: left;
  414. }
  415. .p-stars {
  416. float: left;
  417. }
  418. }
  419. .price {
  420. color: #ff2a2a;
  421. line-height: 54rpx;
  422. &.none {
  423. text-decoration: line-through;
  424. color: #999999;
  425. }
  426. .sm {
  427. font-size: $font-size-24;
  428. }
  429. .big {
  430. font-size: $font-size-28;
  431. }
  432. }
  433. }
  434. }
  435. </style>