templateC.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  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. v-if="idx < 3"
  39. :key="idx"
  40. @click.stop="navToDetailPage(item)"
  41. >
  42. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  43. <view class="floor-item_tag" v-if="item.listType == 2">
  44. <text>{{ item.label }}</text>
  45. </view>
  46. <view class="floor-item-content">
  47. <view class="title tui-skeleton-rect">
  48. <text class="mclap-tag" v-if="item.product.beautyActFlag == '1'">美博会</text>
  49. <text class="mclap" :class="item.product.beautyActFlag == '1' ? 'indent' : ''"
  50. >{{ item.name }}
  51. </text>
  52. </view>
  53. <view class="floor-item-price" v-if="item.listType == 1">
  54. <view class="floor-item-act">
  55. <view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
  56. <template v-if="userIdentity === 3">
  57. <template v-if="item.product.actStatus === 1">
  58. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  59. {{ item.product.promotions.name }}
  60. <text
  61. v-if="hasLogin && item.product.priceFlag != 1 && item.product.shopID == shopId"
  62. >:¥{{ item.product.price | NumFormat }}</text
  63. >
  64. </view>
  65. <view class="floor-tags" v-else>{{ item.product.promotions.name }}</view>
  66. </template>
  67. <template v-if="item.product.actStatus === 0 && item.product.ladderPriceFlag === 1">
  68. <view class="floor-tags">阶梯价格</view>
  69. </template>
  70. </template>
  71. <template v-else>
  72. <template v-if="item.product.actStatus === 1">
  73. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  74. {{ item.product.promotions.name }}
  75. <text v-if="hasLogin && item.product.priceFlag != 1"
  76. >:¥{{ item.product.price | NumFormat }}</text
  77. >
  78. </view>
  79. <view class="floor-tags" v-else>{{ item.product.promotions.name }}</view>
  80. </template>
  81. <template v-if="item.product.actStatus === 0 && item.product.ladderPriceFlag === 1">
  82. <view class="floor-tags">阶梯价格</view>
  83. </template>
  84. </template>
  85. </view>
  86. <view v-if="hasLogin">
  87. <template v-if="item.product.productCategory == 1">
  88. <template v-if="userIdentity == 3">
  89. <template v-if="item.product.shopID == shopId">
  90. <view class="title-none" v-if="item.product.priceFlag === 1">
  91. <text class="p big">¥未公开价格</text>
  92. </view>
  93. <view
  94. class="price tui-skeleton-rect"
  95. v-else
  96. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  97. >
  98. <text class="p sm">¥</text>
  99. <text class="p big">{{
  100. (PromotionsFormat(item.product.promotions)
  101. ? item.product.originalPrice
  102. : item.product.price) | NumFormat
  103. }}</text>
  104. </view>
  105. </template>
  106. <template v-else>
  107. <view class="no-price">
  108. <view class="p-stars">
  109. <text class="p-no">¥</text>
  110. <uni-grader
  111. :grade="Number(item.product.priceGrade)"
  112. :margin="14"
  113. ></uni-grader>
  114. </view>
  115. </view>
  116. </template>
  117. </template>
  118. <template v-else-if="userIdentity === 4">
  119. <view class="title-none" v-if="item.product.priceFlag === 1">
  120. <text class="p big">¥未公开价格</text>
  121. </view>
  122. <view class="title-none" v-if="item.product.priceFlag === 2">
  123. <text class="p big">¥价格仅会员可见</text>
  124. </view>
  125. <view
  126. class="price tui-skeleton-rect"
  127. v-if="item.product.priceFlag === 0"
  128. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  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 v-else>
  139. <view class="title-none" v-if="item.product.priceFlag === 1">
  140. <text class="p big">¥未公开价格</text>
  141. </view>
  142. <view
  143. class="price tui-skeleton-rect"
  144. v-else
  145. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  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. export default {
  186. name: 'templateC',
  187. components: {
  188. uniGrader
  189. },
  190. props: {
  191. pageData: {
  192. type: Object
  193. },
  194. userIdentity: {
  195. type: Number
  196. }
  197. },
  198. data() {
  199. return {
  200. shopId: 0,
  201. floorData: {}
  202. }
  203. },
  204. filters: {
  205. NumFormat: function(text) {
  206. //处理金额
  207. return Number(text).toFixed(2)
  208. }
  209. },
  210. created() {
  211. this.initData(this.pageData)
  212. },
  213. computed: {
  214. ...mapState(['hasLogin', 'userInfo', 'isActivity'])
  215. },
  216. watch: {
  217. pageData: {
  218. handler: function(el) {
  219. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  220. this.pageData = el
  221. this.initData(this.pageData)
  222. },
  223. deep: true
  224. }
  225. },
  226. methods: {
  227. initData(data) {
  228. this.floorData = data
  229. // console.log(this.floorData)
  230. this.$api
  231. .getStorage()
  232. .then(resolve => {
  233. this.shopId = resolve.shopId ? resolve.shopId : 0
  234. })
  235. .catch(err => {
  236. console.log('err', err)
  237. })
  238. },
  239. PromotionsFormat(promo) {
  240. //促销活动类型数据处理
  241. if (promo != null) {
  242. if (promo.type == 1 && promo.mode == 1) {
  243. return true
  244. } else {
  245. return false
  246. }
  247. }
  248. return false
  249. },
  250. navToDetailPage(pros) {
  251. //跳转商品详情页
  252. this.$api.FlooryNavigateTo(pros)
  253. },
  254. BannerNavigateTo(linkType, linkId, linkHref, keyword) {
  255. //跳转商品详情页
  256. this.$api.BannerNavigateTo(linkType, linkId, linkHref, keyword)
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss">
  262. .section_page_main {
  263. width: 100%;
  264. height: auto;
  265. box-sizing: border-box;
  266. .floor-item {
  267. width: 339rpx;
  268. height: 516rpx;
  269. margin-right: 20rpx;
  270. font-size: $font-size-24;
  271. color: $text-color;
  272. background: #ffffff;
  273. line-height: 36rpx;
  274. border-radius: 16rpx;
  275. margin-bottom: 20rpx;
  276. float: left;
  277. box-sizing: border-box;
  278. position: relative;
  279. &.ad_01 {
  280. width: 100%;
  281. height: 240rpx;
  282. .item-img-gg {
  283. width: 100%;
  284. height: 240rpx;
  285. display: block;
  286. border-radius: 16rpx;
  287. }
  288. }
  289. &.ad_02 {
  290. margin-right: 20rpx;
  291. }
  292. &:nth-child(odd) {
  293. margin-right: 0;
  294. }
  295. .item-img-gg {
  296. width: 339rpx;
  297. height: 516rpx;
  298. display: block;
  299. border-radius: 16rpx;
  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_tag {
  328. width: 100%;
  329. height: 32rpx;
  330. float: left;
  331. margin: 8rpx 0;
  332. padding: 0 20rpx;
  333. box-sizing: border-box;
  334. margin-bottom: 20rpx;
  335. text {
  336. display: inline-block;
  337. padding: 0 8rpx;
  338. border: 1px solid #e3ebf7;
  339. border-radius: 8rpx;
  340. color: #9aa5b5;
  341. font-size: $font-size-22;
  342. line-height: 32rpx;
  343. text-align: center;
  344. float: left;
  345. }
  346. }
  347. .floor-item-content {
  348. width: 100%;
  349. padding: 0 20rpx;
  350. box-sizing: border-box;
  351. }
  352. .floor-item-act {
  353. display: block;
  354. width: 100%;
  355. height: 32rpx;
  356. text-align: center;
  357. box-sizing: border-box;
  358. .coupon-tags {
  359. height: 32rpx;
  360. box-sizing: border-box;
  361. border-radius: 8rpx;
  362. background-color: #fff1eb;
  363. line-height: 28rpx;
  364. color: #f94b4b;
  365. text-align: center;
  366. display: inline-block;
  367. padding: 0 10rpx;
  368. font-size: $font-size-20;
  369. border: 1px solid #f94b4b;
  370. float: left;
  371. margin-right: 12rpx;
  372. }
  373. .floor-tags {
  374. height: 32rpx;
  375. box-sizing: border-box;
  376. border-radius: 8rpx;
  377. background-color: #ffffff;
  378. line-height: 28rpx;
  379. color: $color-system;
  380. text-align: center;
  381. display: inline-block;
  382. padding: 0 16rpx;
  383. font-size: $font-size-20;
  384. border: 1px solid #e15616;
  385. float: left;
  386. }
  387. }
  388. .title-none {
  389. font-size: $font-size-26;
  390. color: #ff2a2a;
  391. line-height: 54rpx;
  392. }
  393. .title {
  394. width: 100%;
  395. height: 70rpx;
  396. display: flex;
  397. line-height: 35rpx;
  398. flex-direction: column;
  399. margin: 8rpx 0;
  400. padding: 0;
  401. position: relative;
  402. .mclap {
  403. width: 100%;
  404. line-height: 35rpx;
  405. text-overflow: ellipsis;
  406. display: -webkit-box;
  407. word-break: break-all;
  408. -webkit-box-orient: vertical;
  409. -webkit-line-clamp: 2;
  410. overflow: hidden;
  411. font-size: 26rpx;
  412. &.indent {
  413. text-indent: 95rpx;
  414. }
  415. }
  416. .mclap-tag {
  417. display: block;
  418. width: 84rpx;
  419. height: 32rpx;
  420. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  421. border-radius: 4rpx 48rpx 4px 4px;
  422. line-height: 32rpx;
  423. font-size: $font-size-22;
  424. color: #ffffff;
  425. text-align: center;
  426. position: absolute;
  427. left: 0;
  428. top: 0;
  429. }
  430. }
  431. .no-price {
  432. height: 54rpx;
  433. line-height: 54rpx;
  434. display: flex;
  435. box-sizing: border-box;
  436. .p-no {
  437. font-size: $font-size-28;
  438. color: $text-color;
  439. display: block;
  440. float: left;
  441. }
  442. .p-stars {
  443. float: left;
  444. }
  445. }
  446. .price {
  447. color: #ff2a2a;
  448. line-height: 54rpx;
  449. &.none {
  450. text-decoration: line-through;
  451. color: #999999;
  452. }
  453. .sm {
  454. font-size: $font-size-24;
  455. }
  456. .big {
  457. font-size: $font-size-28;
  458. }
  459. }
  460. }
  461. }
  462. </style>