templateE.vue 10 KB

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