templateF.vue 11 KB

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