templateB.vue 10 KB

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