templateE.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="floor-item ad_01">
  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 < 4"
  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: 'templateE',
  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. created() {
  195. this.initData(this.pageData)
  196. },
  197. computed: {
  198. ...mapState(['hasLogin', 'userInfo', 'isActivity'])
  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. // console.log(this.floorData)
  214. this.$api
  215. .getStorage()
  216. .then(resolve => {
  217. this.shopId = resolve.shopId ? resolve.shopId : 0
  218. })
  219. .catch(err => {
  220. console.log('err', err)
  221. })
  222. },
  223. PromotionsFormat(promo) {
  224. //促销活动类型数据处理
  225. if (promo != null) {
  226. if (promo.type == 1 && promo.mode == 1) {
  227. return true
  228. } else {
  229. return false
  230. }
  231. }
  232. return false
  233. },
  234. navToDetailPage(pros) {
  235. //跳转商品详情页
  236. this.$api.FlooryNavigateTo(pros)
  237. },
  238. BannerNavigateTo(linkType, linkId, linkHref, keyword) {
  239. //跳转商品详情页
  240. this.$api.BannerNavigateTo(linkType, linkId, linkHref, keyword)
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang="scss">
  246. .section_page_main {
  247. width: 100%;
  248. height: auto;
  249. box-sizing: border-box;
  250. .floor-item {
  251. width: 339rpx;
  252. height: 516rpx;
  253. margin-right: 20rpx;
  254. font-size: $font-size-24;
  255. color: $text-color;
  256. background: #ffffff;
  257. line-height: 36rpx;
  258. border-radius: 16rpx;
  259. margin-bottom: 20rpx;
  260. float: left;
  261. box-sizing: border-box;
  262. position: relative;
  263. &.ad_01 {
  264. width: 100%;
  265. height: 240rpx;
  266. .item-img-gg {
  267. width: 100%;
  268. height: 240rpx;
  269. display: block;
  270. border-radius: 16rpx;
  271. }
  272. }
  273. &.ad_02 {
  274. margin-right: 20rpx;
  275. }
  276. &:nth-child(odd) {
  277. margin-right: 0;
  278. }
  279. .item-img-gg {
  280. width: 339rpx;
  281. height: 516rpx;
  282. display: block;
  283. border-radius: 16rpx;
  284. }
  285. .item-img {
  286. width: 339rpx;
  287. height: 339rpx;
  288. border-radius: 16rpx 16rpx 0 0;
  289. display: block;
  290. margin-bottom: 8rpx;
  291. }
  292. .floor-item_tag {
  293. width: 100%;
  294. height: 32rpx;
  295. float: left;
  296. margin: 20rpx 0;
  297. padding: 0 20rpx;
  298. box-sizing: border-box;
  299. text {
  300. display: inline-block;
  301. padding: 0 8rpx;
  302. border: 1px solid #e3ebf7;
  303. border-radius: 8rpx;
  304. color: #9aa5b5;
  305. font-size: $font-size-22;
  306. line-height: 32rpx;
  307. text-align: center;
  308. float: left;
  309. }
  310. }
  311. .floor-item-content {
  312. width: 100%;
  313. padding: 0 20rpx;
  314. box-sizing: border-box;
  315. }
  316. .floor-item-act {
  317. display: block;
  318. width: 100%;
  319. height: 32rpx;
  320. text-align: center;
  321. box-sizing: border-box;
  322. .coupon-tags {
  323. height: 32rpx;
  324. box-sizing: border-box;
  325. border-radius: 8rpx;
  326. background-color: #fff1eb;
  327. line-height: 28rpx;
  328. color: #f94b4b;
  329. text-align: center;
  330. display: inline-block;
  331. padding: 0 10rpx;
  332. font-size: $font-size-20;
  333. border: 1px solid #f94b4b;
  334. float: left;
  335. margin-right: 12rpx;
  336. }
  337. .floor-tags {
  338. height: 32rpx;
  339. box-sizing: border-box;
  340. border-radius: 8rpx;
  341. background-color: #ffffff;
  342. line-height: 28rpx;
  343. color: $color-system;
  344. text-align: center;
  345. display: inline-block;
  346. padding: 0 16rpx;
  347. font-size: $font-size-20;
  348. border: 1px solid #e15616;
  349. float: left;
  350. }
  351. }
  352. .title-none {
  353. font-size: $font-size-26;
  354. color: #ff2a2a;
  355. line-height: 54rpx;
  356. }
  357. .title {
  358. width: 100%;
  359. height: 70rpx;
  360. display: flex;
  361. line-height: 35rpx;
  362. flex-direction: column;
  363. margin: 8rpx 0;
  364. padding: 0;
  365. position: relative;
  366. .mclap {
  367. width: 100%;
  368. line-height: 35rpx;
  369. text-overflow: ellipsis;
  370. display: -webkit-box;
  371. word-break: break-all;
  372. -webkit-box-orient: vertical;
  373. -webkit-line-clamp: 2;
  374. overflow: hidden;
  375. font-size: 26rpx;
  376. &.indent {
  377. text-indent: 95rpx;
  378. }
  379. }
  380. .mclap-tag {
  381. display: block;
  382. width: 84rpx;
  383. height: 32rpx;
  384. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  385. border-radius: 4rpx 48rpx 4px 4px;
  386. line-height: 32rpx;
  387. font-size: $font-size-22;
  388. color: #ffffff;
  389. text-align: center;
  390. position: absolute;
  391. left: 0;
  392. top: 0;
  393. }
  394. }
  395. .no-price {
  396. height: 54rpx;
  397. line-height: 54rpx;
  398. display: flex;
  399. box-sizing: border-box;
  400. .p-no {
  401. font-size: $font-size-28;
  402. color: $text-color;
  403. display: block;
  404. float: left;
  405. }
  406. .p-stars {
  407. float: left;
  408. }
  409. }
  410. .price {
  411. color: #ff2a2a;
  412. line-height: 54rpx;
  413. &.none {
  414. text-decoration: line-through;
  415. color: #999999;
  416. }
  417. .sm {
  418. font-size: $font-size-24;
  419. }
  420. .big {
  421. font-size: $font-size-28;
  422. }
  423. }
  424. }
  425. }
  426. </style>