templateJ.vue 12 KB

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