templateC.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  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" :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">
  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">
  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. .section_page_main{
  209. width: 100%;
  210. height: auto;
  211. box-sizing: border-box;
  212. .floor-item{
  213. width: 339rpx;
  214. height: 516rpx;
  215. margin-right: 20rpx;
  216. font-size: $font-size-24;
  217. color: $text-color;
  218. background: #FFFFFF;
  219. line-height: 36rpx;
  220. border-radius: 16rpx;
  221. margin-bottom: 20rpx;
  222. float: left;
  223. box-sizing: border-box;
  224. position: relative;
  225. &.ad_01{
  226. width: 100%;
  227. height: 240rpx;
  228. .item-img-gg{
  229. width: 100%;
  230. height: 240rpx;
  231. display: block;
  232. border-radius: 16rpx;
  233. }
  234. }
  235. &.ad_02{
  236. margin-right: 20rpx;
  237. }
  238. &:nth-child(odd){
  239. margin-right: 0;
  240. }
  241. .item-img-gg{
  242. width: 339rpx;
  243. height: 516rpx;
  244. display: block;
  245. border-radius: 16rpx;
  246. }
  247. .item-img{
  248. width: 339rpx;
  249. height: 339rpx;
  250. border-radius: 16rpx 16rpx 0 0;
  251. display: block;
  252. margin-bottom: 8rpx;
  253. }
  254. .floor-item_tag{
  255. width: 100%;
  256. height: 32rpx;
  257. float: left;
  258. margin: 20rpx 0;
  259. padding: 0 20rpx;
  260. box-sizing: border-box;
  261. text{
  262. display: inline-block;
  263. padding: 0 8rpx;
  264. border: 1px solid #e3ebf7;
  265. border-radius: 8rpx ;
  266. color: #9aa5b5;
  267. font-size: $font-size-22;
  268. line-height: 32rpx;
  269. text-align: center;
  270. float: left;
  271. }
  272. }
  273. .floor-item_tag{
  274. width: 100%;
  275. height: 32rpx;
  276. float: left;
  277. margin: 8rpx 0;
  278. padding: 0 20rpx;
  279. box-sizing: border-box;
  280. margin-bottom: 20rpx;
  281. text{
  282. display: inline-block;
  283. padding: 0 8rpx;
  284. border: 1px solid #e3ebf7;
  285. border-radius: 8rpx ;
  286. color: #9aa5b5;
  287. font-size: $font-size-22;
  288. line-height: 32rpx;
  289. text-align: center;
  290. float: left;
  291. }
  292. }
  293. .floor-item-content{
  294. width: 100%;
  295. padding: 0 20rpx;
  296. box-sizing: border-box;
  297. }
  298. .floor-item-act{
  299. display: block;
  300. width: 100%;
  301. height: 32rpx;
  302. text-align: center;
  303. box-sizing: border-box;
  304. .coupon-tags{
  305. height: 32rpx;
  306. box-sizing: border-box;
  307. border-radius: 8rpx;
  308. background-color: #fff1eb;
  309. line-height: 28rpx;
  310. color: #f94b4b;
  311. text-align: center;
  312. display: inline-block;
  313. padding:0 10rpx;
  314. font-size: $font-size-20;
  315. border: 1px solid #f94b4b;
  316. float: left;
  317. margin-right: 12rpx;
  318. }
  319. .floor-tags{
  320. height: 32rpx;
  321. box-sizing: border-box;
  322. border-radius: 8rpx;
  323. background-color: #FFFFFF;
  324. line-height: 28rpx;
  325. color: $color-system;
  326. text-align: center;
  327. display: inline-block;
  328. padding:0 16rpx;
  329. font-size: $font-size-20;
  330. border: 1px solid #E15616;
  331. float: left;
  332. }
  333. }
  334. .title-none{
  335. font-size: $font-size-26;
  336. color: #FF2A2A;
  337. line-height: 54rpx;
  338. }
  339. .title{
  340. width: 100%;
  341. height: 70rpx;
  342. display: flex;
  343. line-height: 35rpx;
  344. flex-direction: column;
  345. margin: 8rpx 0;
  346. padding: 0;
  347. position: relative;
  348. .mclap{
  349. width: 100%;
  350. line-height:35rpx;
  351. text-overflow:ellipsis;
  352. display: -webkit-box;
  353. word-break: break-all;
  354. -webkit-box-orient: vertical;
  355. -webkit-line-clamp: 2;
  356. overflow: hidden;
  357. font-size: 26rpx;
  358. &.indent{
  359. text-indent: 95rpx;
  360. }
  361. }
  362. .mclap-tag{
  363. display: block;
  364. width: 84rpx;
  365. height: 32rpx;
  366. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  367. border-radius: 4rpx 48rpx 4px 4px;
  368. line-height: 32rpx;
  369. font-size: $font-size-22;
  370. color: #FFFFFF;
  371. text-align: center;
  372. position: absolute;
  373. left: 0;
  374. top: 0;
  375. }
  376. }
  377. .no-price{
  378. height: 54rpx;
  379. line-height: 54rpx;
  380. display: flex;
  381. box-sizing: border-box;
  382. .p-no{
  383. font-size: $font-size-28;
  384. color: $text-color;
  385. display: block;
  386. float: left;
  387. }
  388. .p-stars{
  389. float: left;
  390. }
  391. }
  392. .price{
  393. color: #FF2A2A;
  394. line-height:54rpx;
  395. &.none{
  396. text-decoration: line-through;
  397. color: #999999;
  398. }
  399. .sm{
  400. font-size: $font-size-24;
  401. }
  402. .big{
  403. font-size: $font-size-28;
  404. }
  405. }
  406. }
  407. }
  408. </style>