templateK.vue 13 KB

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