templateI.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489
  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">
  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">
  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. .section_page_main {
  321. width: 100%;
  322. height: auto;
  323. box-sizing: border-box;
  324. .floor-item {
  325. width: 339rpx;
  326. height: 516rpx;
  327. margin-right: 20rpx;
  328. font-size: $font-size-24;
  329. color: $text-color;
  330. background: #ffffff;
  331. line-height: 36rpx;
  332. border-radius: 16rpx;
  333. margin-bottom: 20rpx;
  334. float: left;
  335. box-sizing: border-box;
  336. position: relative;
  337. &.ad_01 {
  338. width: 100%;
  339. height: 240rpx;
  340. margin-right: 0;
  341. .item-img-gg {
  342. width: 100%;
  343. height: 240rpx;
  344. display: block;
  345. border-radius: 16rpx;
  346. }
  347. }
  348. &:nth-child(odd) {
  349. margin-right: 0;
  350. }
  351. &.ad_02,&.ad_03{
  352. width: 339rpx;
  353. height: 260rpx;
  354. .item-img-gg {
  355. width: 339rpx;
  356. height: 260rpx;
  357. display: block;
  358. border-radius: 16rpx;
  359. }
  360. }
  361. .item-img {
  362. width: 339rpx;
  363. height: 339rpx;
  364. border-radius: 16rpx 16rpx 0 0;
  365. display: block;
  366. margin-bottom: 8rpx;
  367. }
  368. .floor-item_tag {
  369. width: 100%;
  370. height: 32rpx;
  371. float: left;
  372. margin: 20rpx 0;
  373. padding: 0 20rpx;
  374. box-sizing: border-box;
  375. text {
  376. display: inline-block;
  377. padding: 0 8rpx;
  378. border: 1px solid #e3ebf7;
  379. border-radius: 8rpx;
  380. color: #9aa5b5;
  381. font-size: $font-size-22;
  382. line-height: 32rpx;
  383. text-align: center;
  384. float: left;
  385. }
  386. }
  387. .floor-item-content {
  388. width: 100%;
  389. padding: 0 20rpx;
  390. box-sizing: border-box;
  391. }
  392. .floor-item-act {
  393. display: block;
  394. width: 100%;
  395. height: 32rpx;
  396. text-align: center;
  397. box-sizing: border-box;
  398. }
  399. .floor-tags {
  400. height: 28rpx;
  401. border-radius: 6rpx;
  402. background-color: #ffffff;
  403. line-height: 28rpx;
  404. color: $color-system;
  405. text-align: center;
  406. display: inline-block;
  407. padding: 0 16rpx;
  408. font-size: $font-size-20;
  409. border: 1px solid #e15616;
  410. float: left;
  411. }
  412. .title-none {
  413. font-size: $font-size-26;
  414. color: #ff2a2a;
  415. line-height: 54rpx;
  416. }
  417. .title {
  418. width: 100%;
  419. height: 70rpx;
  420. display: flex;
  421. line-height: 35rpx;
  422. flex-direction: column;
  423. margin: 8rpx 0;
  424. padding: 0;
  425. position: relative;
  426. .mclap {
  427. width: 100%;
  428. line-height: 35rpx;
  429. text-overflow: ellipsis;
  430. display: -webkit-box;
  431. word-break: break-all;
  432. -webkit-box-orient: vertical;
  433. -webkit-line-clamp: 2;
  434. overflow: hidden;
  435. font-size: 26rpx;
  436. &.indent {
  437. text-indent: 95rpx;
  438. }
  439. }
  440. .mclap-tag {
  441. display: block;
  442. width: 84rpx;
  443. height: 32rpx;
  444. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  445. border-radius: 4rpx 48rpx 4px 4px;
  446. line-height: 32rpx;
  447. font-size: $font-size-22;
  448. color: #ffffff;
  449. text-align: center;
  450. position: absolute;
  451. left: 0;
  452. top: 0;
  453. }
  454. }
  455. .no-price {
  456. height: 54rpx;
  457. line-height: 54rpx;
  458. display: flex;
  459. box-sizing: border-box;
  460. .p-no {
  461. font-size: $font-size-28;
  462. color: $text-color;
  463. display: block;
  464. float: left;
  465. }
  466. .p-stars {
  467. float: left;
  468. }
  469. }
  470. .price {
  471. color: #ff2a2a;
  472. line-height: 54rpx;
  473. &.none {
  474. text-decoration: line-through;
  475. color: #999999;
  476. }
  477. .sm {
  478. font-size: $font-size-24;
  479. }
  480. .big {
  481. font-size: $font-size-28;
  482. }
  483. }
  484. }
  485. }
  486. </style>