templateB.vue 11 KB

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