templateF.vue 9.6 KB

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