templateF.vue 11 KB

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