templateI.vue 9.8 KB

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