templateC.vue 11 KB

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