templateA.vue 10.0 KB

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