templateD.vue 12 KB

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