templateI.vue 12 KB

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