templateC.vue 9.8 KB

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