templateF.vue 11 KB

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