templateK.vue 13 KB

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