templateI.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="floor-item ad_01">
  4. <image
  5. class="item-img-gg"
  6. :src="floorData.floorContent.appletsAdsImage1"
  7. @click="
  8. BannerNavigateTo(
  9. floorData.floorContent.linkType1,
  10. floorData.floorContent.linkParam1.id ? floorData.floorContent.linkParam1.id : '',
  11. floorData.floorContent.adsLink1,
  12. floorData.floorContent.linkParam1.keyword ? floorData.floorContent.linkParam1.keyword : ''
  13. )
  14. "
  15. mode="aspectFill"
  16. >
  17. </image>
  18. </view>
  19. <view class="floor-item ad_02">
  20. <image
  21. class="item-img-gg"
  22. :src="floorData.floorContent.appletsAdsImage2"
  23. @click="
  24. BannerNavigateTo(
  25. floorData.floorContent.linkType2,
  26. floorData.floorContent.linkParam2.id ? floorData.floorContent.linkParam2.id : '',
  27. floorData.floorContent.adsLink2,
  28. floorData.floorContent.linkParam2.keyword ? floorData.floorContent.linkParam2.keyword : ''
  29. )
  30. "
  31. mode="aspectFill"
  32. >
  33. </image>
  34. </view>
  35. <view class="floor-item ad_03">
  36. <image
  37. class="item-img-gg"
  38. :src="floorData.floorContent.appletsAdsImage3"
  39. @click="
  40. BannerNavigateTo(
  41. floorData.floorContent.linkType3,
  42. floorData.floorContent.linkParam3.id ? floorData.floorContent.linkParam3.id : '',
  43. floorData.floorContent.adsLink3,
  44. floorData.floorContent.linkParam3.keyword ? floorData.floorContent.linkParam3.keyword : ''
  45. )
  46. "
  47. mode="aspectFill"
  48. >
  49. </image>
  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 {
  264. width: 339rpx;
  265. height: 516rpx;
  266. margin-right: 20rpx;
  267. font-size: $font-size-24;
  268. color: $text-color;
  269. background: #ffffff;
  270. line-height: 36rpx;
  271. border-radius: 16rpx;
  272. margin-bottom: 20rpx;
  273. float: left;
  274. box-sizing: border-box;
  275. position: relative;
  276. &.ad_01 {
  277. width: 100%;
  278. height: 240rpx;
  279. margin-right: 0;
  280. .item-img-gg {
  281. width: 100%;
  282. height: 240rpx;
  283. display: block;
  284. border-radius: 16rpx;
  285. }
  286. }
  287. &:nth-child(odd) {
  288. margin-right: 0;
  289. }
  290. &.ad_02,
  291. &.ad_03 {
  292. width: 339rpx;
  293. height: 260rpx;
  294. .item-img-gg {
  295. width: 339rpx;
  296. height: 260rpx;
  297. display: block;
  298. border-radius: 16rpx;
  299. }
  300. }
  301. .item-img {
  302. width: 339rpx;
  303. height: 339rpx;
  304. border-radius: 16rpx 16rpx 0 0;
  305. display: block;
  306. margin-bottom: 8rpx;
  307. }
  308. .floor-item_tag {
  309. width: 100%;
  310. height: 32rpx;
  311. float: left;
  312. margin: 20rpx 0;
  313. padding: 0 20rpx;
  314. box-sizing: border-box;
  315. text {
  316. display: inline-block;
  317. padding: 0 8rpx;
  318. border: 1px solid #e3ebf7;
  319. border-radius: 8rpx;
  320. color: #9aa5b5;
  321. font-size: $font-size-22;
  322. line-height: 32rpx;
  323. text-align: center;
  324. float: left;
  325. }
  326. }
  327. .floor-item-content {
  328. width: 100%;
  329. padding: 0 20rpx;
  330. box-sizing: border-box;
  331. }
  332. .floor-item-act {
  333. display: block;
  334. width: 100%;
  335. height: 32rpx;
  336. text-align: center;
  337. box-sizing: border-box;
  338. }
  339. .title-none {
  340. font-size: $font-size-26;
  341. color: #ff2a2a;
  342. line-height: 54rpx;
  343. }
  344. .title {
  345. width: 100%;
  346. height: 70rpx;
  347. display: flex;
  348. line-height: 35rpx;
  349. flex-direction: column;
  350. margin: 8rpx 0;
  351. padding: 0;
  352. position: relative;
  353. .mclap {
  354. width: 100%;
  355. line-height: 35rpx;
  356. text-overflow: ellipsis;
  357. display: -webkit-box;
  358. word-break: break-all;
  359. -webkit-box-orient: vertical;
  360. -webkit-line-clamp: 2;
  361. overflow: hidden;
  362. font-size: 26rpx;
  363. &.indent {
  364. text-indent: 95rpx;
  365. }
  366. }
  367. .mclap-tag {
  368. display: block;
  369. width: 84rpx;
  370. height: 32rpx;
  371. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  372. border-radius: 4rpx 48rpx 4px 4px;
  373. line-height: 32rpx;
  374. font-size: $font-size-22;
  375. color: #ffffff;
  376. text-align: center;
  377. position: absolute;
  378. left: 0;
  379. top: 0;
  380. }
  381. }
  382. .no-price {
  383. height: 54rpx;
  384. line-height: 54rpx;
  385. display: flex;
  386. box-sizing: border-box;
  387. .p-no {
  388. font-size: $font-size-28;
  389. color: $text-color;
  390. display: block;
  391. float: left;
  392. }
  393. .p-stars {
  394. float: left;
  395. }
  396. }
  397. .price {
  398. color: #ff2a2a;
  399. line-height: 54rpx;
  400. &.none {
  401. text-decoration: line-through;
  402. color: #999999;
  403. }
  404. .sm {
  405. font-size: $font-size-24;
  406. }
  407. .big {
  408. font-size: $font-size-28;
  409. }
  410. }
  411. }
  412. }
  413. </style>