templateB.vue 11 KB

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