templateK.vue 11 KB

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