templateC.vue 12 KB

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