templateJ.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  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">
  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.price1TextFlag != 1 &&
  93. item.product.shopID == shopId
  94. "
  95. >:¥{{ item.product.retailPrice | 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.price1TextFlag != 1"
  119. >:¥{{ item.product.retailPrice | 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.price1TextFlag === '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.price1
  157. : item.product.retailPrice) | 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.price1Grade)"
  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.price1TextFlag === '1'">
  175. <text class="p big">¥未公开价格</text>
  176. </view>
  177. <view class="title-none" v-if="item.product.price1TextFlag === '2'">
  178. <text class="p big">¥价格仅会员可见</text>
  179. </view>
  180. <view
  181. class="price tui-skeleton-rect"
  182. v-if="item.product.price1TextFlag === '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.price1
  189. : item.product.retailPrice) | NumFormat
  190. }}</text>
  191. </view>
  192. </template>
  193. <template v-else>
  194. <view class="title-none" v-if="item.product.price1TextFlag === '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.price1
  206. : item.product.retailPrice) | 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.retailPrice | NumFormat
  222. }}</text>
  223. </view>
  224. </template>
  225. </view>
  226. <view v-else class="no-price">
  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.price1Grade)"
  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. .section_page_main {
  321. width: 100%;
  322. height: auto;
  323. box-sizing: border-box;
  324. .floor-item-ad{
  325. width: 100%;
  326. margin-bottom: 24rpx;
  327. .floor-item-left,.floor_item_right{
  328. width: 339rpx;
  329. height: 516rpx;
  330. }
  331. .floor-item-left{
  332. margin-right: 20rpx;
  333. float: left;
  334. .item-img-gg{
  335. width: 339rpx;
  336. height: 516rpx;
  337. border-radius: 16rpx;
  338. }
  339. }
  340. .floor_item_right{
  341. float: left;
  342. .item-img-gg {
  343. width: 100%;
  344. height: 246rpx;
  345. display: block;
  346. border-radius: 16rpx;
  347. &:nth-child(1){
  348. margin-bottom:24rpx;
  349. }
  350. }
  351. }
  352. }
  353. .floor-item {
  354. width: 339rpx;
  355. height: 516rpx;
  356. margin-right: 20rpx;
  357. font-size: $font-size-24;
  358. color: $text-color;
  359. background: #ffffff;
  360. line-height: 36rpx;
  361. border-radius: 16rpx;
  362. margin-bottom: 20rpx;
  363. float: left;
  364. box-sizing: border-box;
  365. position: relative;
  366. &:nth-child(odd) {
  367. margin-right: 0;
  368. }
  369. .item-img-gg {
  370. width: 339rpx;
  371. height: 516rpx;
  372. display: block;
  373. border-radius: 16rpx;
  374. }
  375. .item-img {
  376. width: 339rpx;
  377. height: 339rpx;
  378. border-radius: 16rpx 16rpx 0 0;
  379. display: block;
  380. margin-bottom: 8rpx;
  381. }
  382. .floor-item_tag {
  383. width: 100%;
  384. height: 32rpx;
  385. float: left;
  386. margin: 20rpx 0;
  387. padding: 0 20rpx;
  388. box-sizing: border-box;
  389. text {
  390. display: inline-block;
  391. padding: 0 8rpx;
  392. border: 1px solid #e3ebf7;
  393. border-radius: 8rpx;
  394. color: #9aa5b5;
  395. font-size: $font-size-22;
  396. line-height: 32rpx;
  397. text-align: center;
  398. float: left;
  399. }
  400. }
  401. .floor-item-content {
  402. width: 100%;
  403. padding: 0 20rpx;
  404. box-sizing: border-box;
  405. }
  406. .floor-item-act {
  407. display: block;
  408. width: 100%;
  409. height: 32rpx;
  410. text-align: center;
  411. box-sizing: border-box;
  412. }
  413. .floor-tags {
  414. height: 28rpx;
  415. border-radius: 6rpx;
  416. background-color: #ffffff;
  417. line-height: 28rpx;
  418. color: $color-system;
  419. text-align: center;
  420. display: inline-block;
  421. padding: 0 16rpx;
  422. font-size: $font-size-20;
  423. border: 1px solid #e15616;
  424. float: left;
  425. }
  426. .title-none {
  427. font-size: $font-size-26;
  428. color: #ff2a2a;
  429. line-height: 54rpx;
  430. }
  431. .title {
  432. width: 100%;
  433. height: 70rpx;
  434. display: flex;
  435. line-height: 35rpx;
  436. flex-direction: column;
  437. margin: 8rpx 0;
  438. padding: 0;
  439. position: relative;
  440. .mclap {
  441. width: 100%;
  442. line-height: 35rpx;
  443. text-overflow: ellipsis;
  444. display: -webkit-box;
  445. word-break: break-all;
  446. -webkit-box-orient: vertical;
  447. -webkit-line-clamp: 2;
  448. overflow: hidden;
  449. font-size: 26rpx;
  450. &.indent {
  451. text-indent: 95rpx;
  452. }
  453. }
  454. .mclap-tag {
  455. display: block;
  456. width: 84rpx;
  457. height: 32rpx;
  458. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  459. border-radius: 4rpx 48rpx 4px 4px;
  460. line-height: 32rpx;
  461. font-size: $font-size-22;
  462. color: #ffffff;
  463. text-align: center;
  464. position: absolute;
  465. left: 0;
  466. top: 0;
  467. }
  468. }
  469. .no-price {
  470. height: 54rpx;
  471. line-height: 54rpx;
  472. display: flex;
  473. box-sizing: border-box;
  474. .p-no {
  475. font-size: $font-size-28;
  476. color: $text-color;
  477. display: block;
  478. float: left;
  479. }
  480. .p-stars {
  481. float: left;
  482. }
  483. }
  484. .price {
  485. color: #ff2a2a;
  486. line-height: 54rpx;
  487. &.none {
  488. text-decoration: line-through;
  489. color: #999999;
  490. }
  491. .sm {
  492. font-size: $font-size-24;
  493. }
  494. .big {
  495. font-size: $font-size-28;
  496. }
  497. }
  498. }
  499. }
  500. </style>