templateJ.vue 11 KB

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