templateJ.vue 12 KB

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