templateC.vue 11 KB

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