templateA.vue 11 KB

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