templateJ.vue 10 KB

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