templateI.vue 12 KB

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