templateC.vue 10 KB

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