templateI.vue 12 KB

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