templateK.vue 14 KB

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