templateJ.vue 10 KB

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