templateJ.vue 12 KB

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