templateK.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  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. :key="idx"
  85. @click.stop="navToDetailPage(item)"
  86. >
  87. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  88. <view class="floor-item_tag" v-if="item.listType == 2">
  89. <text>{{ item.label }}</text>
  90. </view>
  91. <view class="floor-item-content">
  92. <view class="title tui-skeleton-rect">
  93. <text class="mclap-tag" v-if="item.product.beautyActFlag == '1'">美博会</text>
  94. <text class="mclap" :class="item.product.beautyActFlag == '1' ? 'indent' : ''"
  95. >{{ item.name }}
  96. </text>
  97. </view>
  98. <view class="floor-item-price" v-if="item.listType == 1">
  99. <template>
  100. <cm-acttags :product="item.product"></cm-acttags>
  101. </template>
  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. import cmActtags from '@/components/cm-module/productDetails/cm-acttags.vue'
  202. export default {
  203. name: 'templateD',
  204. components: {
  205. uniGrader,
  206. cmActtags
  207. },
  208. props: {
  209. pageData: {
  210. type: Object
  211. },
  212. userIdentity: {
  213. type: Number
  214. }
  215. },
  216. data() {
  217. return {
  218. shopId: 0,
  219. floorData: {}
  220. }
  221. },
  222. filters: {
  223. NumFormat: function(text) {
  224. //处理金额
  225. return Number(text).toFixed(2)
  226. }
  227. },
  228. created() {
  229. this.initData(this.pageData)
  230. },
  231. computed: {
  232. ...mapState(['hasLogin', 'userInfo', 'isActivity'])
  233. },
  234. watch: {
  235. pageData: {
  236. handler: function(el) {
  237. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  238. this.pageData = el
  239. this.initData(this.pageData)
  240. },
  241. deep: true
  242. }
  243. },
  244. methods: {
  245. initData(data) {
  246. this.$api.getStorage().then(resolve => {
  247. this.shopId = resolve.shopId ? resolve.shopId : 0
  248. })
  249. this.floorData = data
  250. // console.log(this.floorData)
  251. },
  252. PromotionsFormat(promo) {
  253. //促销活动类型数据处理
  254. if (promo != null) {
  255. if (promo.type == 1 && promo.mode == 1) {
  256. return true
  257. } else {
  258. return false
  259. }
  260. }
  261. return false
  262. },
  263. navToDetailPage(pros) {
  264. //跳转商品详情页
  265. this.$api.FlooryNavigateTo(pros)
  266. },
  267. BannerNavigateTo(linkType, linkId, linkHref, keyword) {
  268. //跳转商品详情页
  269. this.$api.BannerNavigateTo(linkType, linkId, linkHref, keyword)
  270. }
  271. }
  272. }
  273. </script>
  274. <style lang="scss">
  275. .section_page_main {
  276. width: 100%;
  277. height: auto;
  278. box-sizing: border-box;
  279. .floor-item-ad {
  280. width: 100%;
  281. margin-bottom: 20rpx;
  282. .floor-item-left,
  283. .floor_item_right {
  284. width: 339rpx;
  285. height: 516rpx;
  286. }
  287. .floor-item-left {
  288. margin-right: 20rpx;
  289. float: left;
  290. .item-img-gg {
  291. width: 339rpx;
  292. height: 516rpx;
  293. border-radius: 16rpx;
  294. }
  295. }
  296. .floor_item_right {
  297. float: left;
  298. .item-img-gg {
  299. width: 100%;
  300. height: 246rpx;
  301. display: block;
  302. border-radius: 16rpx;
  303. &:nth-child(1) {
  304. margin-bottom: 24rpx;
  305. }
  306. }
  307. }
  308. &.ad-row2 {
  309. width: 100%;
  310. margin: 24rpx 0;
  311. .item-img-gg {
  312. width: 339rpx;
  313. height: 246rpx;
  314. float: left;
  315. display: block;
  316. border-radius: 16rpx;
  317. &:nth-child(1) {
  318. margin-right: 20rpx;
  319. }
  320. }
  321. }
  322. }
  323. .floor-item {
  324. width: 339rpx;
  325. height: 516rpx;
  326. margin-right: 20rpx;
  327. font-size: $font-size-24;
  328. color: $text-color;
  329. background: #ffffff;
  330. line-height: 36rpx;
  331. border-radius: 16rpx;
  332. margin-bottom: 20rpx;
  333. float: left;
  334. box-sizing: border-box;
  335. position: relative;
  336. &:nth-child(even) {
  337. margin-right: 0;
  338. }
  339. .item-img-gg {
  340. width: 339rpx;
  341. height: 516rpx;
  342. display: block;
  343. border-radius: 16rpx;
  344. }
  345. .item-img {
  346. width: 339rpx;
  347. height: 339rpx;
  348. border-radius: 16rpx 16rpx 0 0;
  349. display: block;
  350. margin-bottom: 8rpx;
  351. }
  352. .floor-item_tag {
  353. width: 100%;
  354. height: 32rpx;
  355. float: left;
  356. margin: 20rpx 0;
  357. padding: 0 20rpx;
  358. box-sizing: border-box;
  359. text {
  360. display: inline-block;
  361. padding: 0 8rpx;
  362. border: 1px solid #e3ebf7;
  363. border-radius: 8rpx;
  364. color: #9aa5b5;
  365. font-size: $font-size-22;
  366. line-height: 32rpx;
  367. text-align: center;
  368. float: left;
  369. }
  370. }
  371. .floor-item-content {
  372. width: 100%;
  373. padding: 0 20rpx;
  374. box-sizing: border-box;
  375. }
  376. .floor-item-act {
  377. display: block;
  378. width: 100%;
  379. height: 32rpx;
  380. text-align: center;
  381. box-sizing: border-box;
  382. }
  383. .title-none {
  384. font-size: $font-size-26;
  385. color: #ff2a2a;
  386. line-height: 54rpx;
  387. }
  388. .title {
  389. width: 100%;
  390. height: 70rpx;
  391. display: flex;
  392. line-height: 35rpx;
  393. flex-direction: column;
  394. margin: 8rpx 0;
  395. padding: 0;
  396. position: relative;
  397. .mclap {
  398. width: 100%;
  399. line-height: 35rpx;
  400. text-overflow: ellipsis;
  401. display: -webkit-box;
  402. word-break: break-all;
  403. -webkit-box-orient: vertical;
  404. -webkit-line-clamp: 2;
  405. overflow: hidden;
  406. font-size: 26rpx;
  407. &.indent {
  408. text-indent: 95rpx;
  409. }
  410. }
  411. .mclap-tag {
  412. display: block;
  413. width: 84rpx;
  414. height: 32rpx;
  415. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  416. border-radius: 4rpx 48rpx 4px 4px;
  417. line-height: 32rpx;
  418. font-size: $font-size-22;
  419. color: #ffffff;
  420. text-align: center;
  421. position: absolute;
  422. left: 0;
  423. top: 0;
  424. }
  425. }
  426. .no-price {
  427. height: 54rpx;
  428. line-height: 54rpx;
  429. display: flex;
  430. box-sizing: border-box;
  431. .p-no {
  432. font-size: $font-size-28;
  433. color: $text-color;
  434. display: block;
  435. float: left;
  436. }
  437. .p-stars {
  438. float: left;
  439. }
  440. }
  441. .price {
  442. color: #ff2a2a;
  443. line-height: 54rpx;
  444. &.none {
  445. text-decoration: line-through;
  446. color: #999999;
  447. }
  448. .sm {
  449. font-size: $font-size-24;
  450. }
  451. .big {
  452. font-size: $font-size-28;
  453. }
  454. }
  455. }
  456. }
  457. </style>