templateF.vue 9.3 KB

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