templateJ.vue 10 KB

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