templateK.vue 13 KB

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