templateF.vue 11 KB

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