templateD.vue 9.9 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. 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.floorData = data
  218. // console.log(this.floorData)
  219. this.$api
  220. .getStorage()
  221. .then(resolve => {
  222. this.shopId = resolve.shopId ? resolve.shopId : 0
  223. })
  224. .catch(err => {
  225. console.log('err', err)
  226. })
  227. },
  228. PromotionsFormat(promo) {
  229. //促销活动类型数据处理
  230. if (promo != null) {
  231. if (promo.type == 1 && promo.mode == 1) {
  232. return true
  233. } else {
  234. return false
  235. }
  236. }
  237. return false
  238. },
  239. navToDetailPage(pros) {
  240. //跳转商品详情页
  241. this.$api.FlooryNavigateTo(pros)
  242. },
  243. BannerNavigateTo(linkType, linkId, linkHref, keyword) {
  244. //跳转商品详情页
  245. this.$api.BannerNavigateTo(linkType, linkId, linkHref, keyword)
  246. }
  247. }
  248. }
  249. </script>
  250. <style lang="scss">
  251. .section_page_main {
  252. width: 100%;
  253. height: auto;
  254. box-sizing: border-box;
  255. .floor-item {
  256. width: 339rpx;
  257. height: 516rpx;
  258. margin-right: 20rpx;
  259. font-size: $font-size-24;
  260. color: $text-color;
  261. background: #ffffff;
  262. line-height: 36rpx;
  263. border-radius: 16rpx;
  264. margin-bottom: 20rpx;
  265. float: left;
  266. box-sizing: border-box;
  267. position: relative;
  268. &.ad_01 {
  269. width: 100%;
  270. height: 240rpx;
  271. margin-right: 0;
  272. .item-img-gg {
  273. width: 100%;
  274. height: 240rpx;
  275. display: block;
  276. border-radius: 16rpx;
  277. }
  278. }
  279. &:nth-child(odd) {
  280. margin-right: 0;
  281. }
  282. .item-img-gg {
  283. width: 339rpx;
  284. height: 516rpx;
  285. display: block;
  286. border-radius: 16rpx;
  287. }
  288. .item-img {
  289. width: 339rpx;
  290. height: 339rpx;
  291. border-radius: 16rpx 16rpx 0 0;
  292. display: block;
  293. margin-bottom: 8rpx;
  294. }
  295. .floor-item_tag {
  296. width: 100%;
  297. height: 32rpx;
  298. float: left;
  299. margin: 20rpx 0;
  300. padding: 0 20rpx;
  301. box-sizing: border-box;
  302. text {
  303. display: inline-block;
  304. padding: 0 8rpx;
  305. border: 1px solid #e3ebf7;
  306. border-radius: 8rpx;
  307. color: #9aa5b5;
  308. font-size: $font-size-22;
  309. line-height: 32rpx;
  310. text-align: center;
  311. float: left;
  312. }
  313. }
  314. .floor-item-content {
  315. width: 100%;
  316. padding: 0 20rpx;
  317. box-sizing: border-box;
  318. }
  319. .floor-item-act {
  320. display: block;
  321. width: 100%;
  322. height: 32rpx;
  323. text-align: center;
  324. box-sizing: border-box;
  325. }
  326. .title-none {
  327. font-size: $font-size-26;
  328. color: #ff2a2a;
  329. line-height: 54rpx;
  330. }
  331. .title {
  332. width: 100%;
  333. height: 70rpx;
  334. display: flex;
  335. line-height: 35rpx;
  336. flex-direction: column;
  337. margin: 8rpx 0;
  338. padding: 0;
  339. position: relative;
  340. .mclap {
  341. width: 100%;
  342. line-height: 35rpx;
  343. text-overflow: ellipsis;
  344. display: -webkit-box;
  345. word-break: break-all;
  346. -webkit-box-orient: vertical;
  347. -webkit-line-clamp: 2;
  348. overflow: hidden;
  349. font-size: 26rpx;
  350. &.indent {
  351. text-indent: 95rpx;
  352. }
  353. }
  354. .mclap-tag {
  355. display: block;
  356. width: 84rpx;
  357. height: 32rpx;
  358. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  359. border-radius: 4rpx 48rpx 4px 4px;
  360. line-height: 32rpx;
  361. font-size: $font-size-22;
  362. color: #ffffff;
  363. text-align: center;
  364. position: absolute;
  365. left: 0;
  366. top: 0;
  367. }
  368. }
  369. .no-price {
  370. height: 54rpx;
  371. line-height: 54rpx;
  372. display: flex;
  373. box-sizing: border-box;
  374. .p-no {
  375. font-size: $font-size-28;
  376. color: $text-color;
  377. display: block;
  378. float: left;
  379. }
  380. .p-stars {
  381. float: left;
  382. }
  383. }
  384. .price {
  385. color: #ff2a2a;
  386. line-height: 54rpx;
  387. &.none {
  388. text-decoration: line-through;
  389. color: #999999;
  390. }
  391. .sm {
  392. font-size: $font-size-24;
  393. }
  394. .big {
  395. font-size: $font-size-28;
  396. }
  397. }
  398. }
  399. }
  400. </style>