templateJ.vue 10 KB

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