templateJ.vue 12 KB

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