templateI.vue 12 KB

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