templateD.vue 11 KB

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