templateJ.vue 11 KB

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