templateA.vue 10.0 KB

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