templateK.vue 12 KB

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