templateA.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="floor-item ad_02">
  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
  20. class="floor-item ad_04 clearfix"
  21. v-for="(item, idx) in floorData.floorImageList"
  22. :key="idx"
  23. @click.stop="navToDetailPage(item)"
  24. >
  25. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  26. <view class="floor-item_tag" v-if="item.listType == 2">
  27. <text>{{ item.label }}</text>
  28. </view>
  29. <view class="floor-item-content">
  30. <view class="title tui-skeleton-rect">
  31. <text class="mclap-tag" v-if="item.product.beautyActFlag == '1'">美博会</text>
  32. <text class="mclap" :class="item.product.beautyActFlag == '1' ? 'indent' : ''"
  33. >{{ item.name }}
  34. </text>
  35. </view>
  36. <view class="floor-item-price" v-if="item.listType == 1">
  37. <view class="floor-item-act">
  38. <view class="coupon-tags" v-if="item.product.couponsLogo">优惠券</view>
  39. <template v-if="userIdentity === 3">
  40. <template v-if="item.product.actStatus === 1">
  41. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  42. {{ item.product.promotions.name }}
  43. <text
  44. v-if="hasLogin && item.product.priceFlag != 1 && item.product.shopID == shopId"
  45. >:¥{{ item.product.price | NumFormat }}</text
  46. >
  47. </view>
  48. <view class="floor-tags" v-else>{{ item.product.promotions.name }}</view>
  49. </template>
  50. <template v-if="item.product.actStatus === 0 && item.product.ladderPriceFlag === 1">
  51. <view class="floor-tags">阶梯价格</view>
  52. </template>
  53. </template>
  54. <template v-else>
  55. <template v-if="item.product.actStatus === 1">
  56. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  57. {{ item.product.promotions.name }}
  58. <text v-if="hasLogin && item.product.priceFlag != 1"
  59. >:¥{{ item.product.price | NumFormat }}</text
  60. >
  61. </view>
  62. <view class="floor-tags" v-else>{{ item.product.promotions.name }}</view>
  63. </template>
  64. <template v-if="item.product.actStatus === 0 && item.product.ladderPriceFlag === 1">
  65. <view class="floor-tags">阶梯价格</view>
  66. </template>
  67. </template>
  68. </view>
  69. <view v-if="hasLogin">
  70. <template v-if="item.product.productCategory == 1">
  71. <template v-if="userIdentity == 3">
  72. <template v-if="item.product.shopID == shopId">
  73. <view class="title-none" v-if="item.product.priceFlag === 1">
  74. <text class="p big">¥未公开价格</text>
  75. </view>
  76. <view
  77. class="price tui-skeleton-rect"
  78. v-else
  79. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  80. >
  81. <text class="p sm">¥</text>
  82. <text class="p big">{{
  83. (PromotionsFormat(item.product.promotions)
  84. ? item.product.originalPrice
  85. : item.product.price) | NumFormat
  86. }}</text>
  87. </view>
  88. </template>
  89. <template v-else>
  90. <view class="no-price">
  91. <view class="p-stars">
  92. <text class="p-no">¥</text>
  93. <uni-grader
  94. :grade="Number(item.product.priceGrade)"
  95. :margin="14"
  96. ></uni-grader>
  97. </view>
  98. </view>
  99. </template>
  100. </template>
  101. <template v-else-if="userIdentity === 4">
  102. <view class="title-none" v-if="item.product.priceFlag === 1">
  103. <text class="p big">¥未公开价格</text>
  104. </view>
  105. <view class="title-none" v-if="item.product.priceFlag === 2">
  106. <text class="p big">¥价格仅会员可见</text>
  107. </view>
  108. <view
  109. class="price tui-skeleton-rect"
  110. v-if="item.product.priceFlag === 0"
  111. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  112. >
  113. <text class="p sm">¥</text>
  114. <text class="p big">{{
  115. (PromotionsFormat(item.product.promotions)
  116. ? item.product.originalPrice
  117. : item.product.price) | NumFormat
  118. }}</text>
  119. </view>
  120. </template>
  121. <template v-else>
  122. <view class="title-none" v-if="item.product.priceFlag === 1">
  123. <text class="p big">¥未公开价格</text>
  124. </view>
  125. <view
  126. class="price tui-skeleton-rect"
  127. v-else
  128. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  129. >
  130. <text class="p sm">¥</text>
  131. <text class="p big">{{
  132. (PromotionsFormat(item.product.promotions)
  133. ? item.product.originalPrice
  134. : item.product.price) | NumFormat
  135. }}</text>
  136. </view>
  137. </template>
  138. </template>
  139. <template v-else>
  140. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  141. <text class="p sm">¥</text> <text class="p big">价格详聊</text>
  142. </view>
  143. <view class="price tui-skeleton-rect" v-else>
  144. <text class="p sm">¥</text>
  145. <text class="p big">{{ item.product.price | NumFormat }}</text>
  146. </view>
  147. </template>
  148. </view>
  149. <view v-else class="no-price">
  150. <template v-if="item.product.productCategory == 1">
  151. <view class="p-stars">
  152. <text class="p-no">¥</text>
  153. <uni-grader :grade="Number(item.product.priceGrade)" :margin="14"></uni-grader>
  154. </view>
  155. </template>
  156. <template v-else>
  157. <view class="p-stars"> <text class="p-no">¥登录可见</text> </view>
  158. </template>
  159. </view>
  160. </view>
  161. </view>
  162. </view>
  163. </view>
  164. </template>
  165. <script>
  166. import { mapState, mapMutations } from 'vuex'
  167. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  168. export default {
  169. name: 'templateA',
  170. components: {
  171. uniGrader
  172. },
  173. props: {
  174. pageData: {
  175. type: Object
  176. },
  177. userIdentity: {
  178. type: Number
  179. }
  180. },
  181. data() {
  182. return {
  183. shopId: 0,
  184. floorData: {}
  185. }
  186. },
  187. filters: {
  188. NumFormat: function(text) {
  189. //处理金额
  190. return Number(text).toFixed(2)
  191. }
  192. },
  193. created() {
  194. this.initData(this.pageData)
  195. },
  196. computed: {
  197. ...mapState(['hasLogin', 'userInfo', 'isActivity'])
  198. },
  199. watch: {
  200. pageData: {
  201. handler: function(el) {
  202. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  203. this.pageData = el
  204. this.initData(this.pageData)
  205. },
  206. deep: true
  207. }
  208. },
  209. methods: {
  210. initData(data) {
  211. this.floorData = data
  212. // console.log(this.floorData)
  213. this.$api
  214. .getStorage()
  215. .then(resolve => {
  216. this.shopId = resolve.shopId ? resolve.shopId : 0
  217. })
  218. .catch(err => {
  219. console.log('err', err)
  220. })
  221. },
  222. PromotionsFormat(promo) {
  223. //促销活动类型数据处理
  224. if (promo != null) {
  225. if (promo.type == 1 && promo.mode == 1) {
  226. return true
  227. } else {
  228. return false
  229. }
  230. }
  231. return false
  232. },
  233. navToDetailPage(pros) {
  234. //跳转商品详情页
  235. this.$api.FlooryNavigateTo(pros)
  236. },
  237. BannerNavigateTo(linkType, linkId, linkHref, keyword) {
  238. //跳转商品详情页
  239. this.$api.BannerNavigateTo(linkType, linkId, linkHref, keyword)
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang="scss">
  245. .section_page_main {
  246. width: 100%;
  247. height: auto;
  248. box-sizing: border-box;
  249. .floor-item {
  250. width: 339rpx;
  251. height: 516rpx;
  252. margin-right: 20rpx;
  253. font-size: $font-size-24;
  254. color: $text-color;
  255. background: #ffffff;
  256. line-height: 36rpx;
  257. border-radius: 16rpx;
  258. margin-bottom: 20rpx;
  259. float: left;
  260. box-sizing: border-box;
  261. position: relative;
  262. &:nth-child(2n) {
  263. margin-right: 0;
  264. }
  265. .item-img-gg {
  266. width: 339rpx;
  267. height: 516rpx;
  268. display: block;
  269. border-radius: 16rpx;
  270. }
  271. .item-img {
  272. width: 339rpx;
  273. height: 339rpx;
  274. border-radius: 16rpx 16rpx 0 0;
  275. display: block;
  276. margin-bottom: 8rpx;
  277. }
  278. .floor-item_tag {
  279. width: 100%;
  280. height: 32rpx;
  281. float: left;
  282. margin: 20rpx 0;
  283. padding: 0 20rpx;
  284. box-sizing: border-box;
  285. text {
  286. display: inline-block;
  287. padding: 0 8rpx;
  288. border: 1px solid #e3ebf7;
  289. border-radius: 8rpx;
  290. color: #9aa5b5;
  291. font-size: $font-size-22;
  292. line-height: 32rpx;
  293. text-align: center;
  294. float: left;
  295. }
  296. }
  297. .floor-item-content {
  298. width: 100%;
  299. padding: 0 20rpx;
  300. box-sizing: border-box;
  301. }
  302. .floor-item-act {
  303. display: block;
  304. width: 100%;
  305. height: 32rpx;
  306. text-align: center;
  307. box-sizing: border-box;
  308. .coupon-tags {
  309. height: 32rpx;
  310. box-sizing: border-box;
  311. border-radius: 8rpx;
  312. background-color: #fff1eb;
  313. line-height: 28rpx;
  314. color: #f94b4b;
  315. text-align: center;
  316. display: inline-block;
  317. padding: 0 10rpx;
  318. font-size: $font-size-20;
  319. border: 1px solid #f94b4b;
  320. float: left;
  321. margin-right: 12rpx;
  322. }
  323. .floor-tags {
  324. height: 32rpx;
  325. box-sizing: border-box;
  326. border-radius: 8rpx;
  327. background-color: #ffffff;
  328. line-height: 28rpx;
  329. color: $color-system;
  330. text-align: center;
  331. display: inline-block;
  332. padding: 0 16rpx;
  333. font-size: $font-size-20;
  334. border: 1px solid #e15616;
  335. float: left;
  336. }
  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>