templateC.vue 10 KB

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