templateI.vue 12 KB

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