templateC.vue 11 KB

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