templateC.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  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.price1TextFlag != 1 && item.product.shopID == shopId">:¥{{item.product.retailPrice | 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.price1TextFlag != 1">:¥{{item.product.retailPrice | 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.price1TextFlag === '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.price1 : item.product.retailPrice ) | 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.price1Grade)" :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.price1TextFlag === '1'">
  87. <text class="p big">¥未公开价格</text>
  88. </view>
  89. <view class="title-none" v-if="item.product.price1TextFlag === '2'">
  90. <text class="p big">¥价格仅会员可见</text>
  91. </view>
  92. <view class="price tui-skeleton-rect" v-if="item.product.price1TextFlag === '0'" :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  93. <text class="p sm">¥</text>
  94. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  95. </view>
  96. </template>
  97. <template v-else>
  98. <view class="title-none" v-if="item.product.price1TextFlag === '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.price1 : item.product.retailPrice ) | 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.retailPrice | 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.price1Grade)" :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.$api.getStorage().then((resolve) =>{
  181. this.shopId = resolve.shopID ? resolve.shopID : 0
  182. })
  183. this.floorData = data
  184. // console.log(this.floorData)
  185. },
  186. PromotionsFormat(promo){//促销活动类型数据处理
  187. if(promo!=null){
  188. if(promo.type == 1 && promo.mode == 1){
  189. return true
  190. }else{
  191. return false
  192. }
  193. }
  194. return false
  195. },
  196. navToDetailPage(pros) {//跳转商品详情页
  197. this.$api.FlooryNavigateTo(pros)
  198. },
  199. BannerNavigateTo(linkType,linkId,linkHref,keyword) {//跳转商品详情页
  200. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  201. }
  202. }
  203. }
  204. </script>
  205. <style lang="scss">
  206. .section_page_main{
  207. width: 100%;
  208. height: auto;
  209. box-sizing: border-box;
  210. .floor-item{
  211. width: 339rpx;
  212. height: 516rpx;
  213. margin-right: 20rpx;
  214. font-size: $font-size-24;
  215. color: $text-color;
  216. background: #FFFFFF;
  217. line-height: 36rpx;
  218. border-radius: 16rpx;
  219. margin-bottom: 20rpx;
  220. float: left;
  221. box-sizing: border-box;
  222. position: relative;
  223. &.ad_01{
  224. width: 100%;
  225. height: 240rpx;
  226. .item-img-gg{
  227. width: 100%;
  228. height: 240rpx;
  229. display: block;
  230. border-radius: 16rpx;
  231. }
  232. }
  233. &.ad_02{
  234. margin-right: 20rpx;
  235. }
  236. &:nth-child(odd){
  237. margin-right: 0;
  238. }
  239. .item-img-gg{
  240. width: 339rpx;
  241. height: 516rpx;
  242. display: block;
  243. border-radius: 16rpx;
  244. }
  245. .item-img{
  246. width: 339rpx;
  247. height: 339rpx;
  248. border-radius: 16rpx 16rpx 0 0;
  249. display: block;
  250. margin-bottom: 8rpx;
  251. }
  252. .floor-item_tag{
  253. width: 100%;
  254. height: 32rpx;
  255. float: left;
  256. margin: 20rpx 0;
  257. padding: 0 20rpx;
  258. box-sizing: border-box;
  259. text{
  260. display: inline-block;
  261. padding: 0 8rpx;
  262. border: 1px solid #e3ebf7;
  263. border-radius: 8rpx ;
  264. color: #9aa5b5;
  265. font-size: $font-size-22;
  266. line-height: 32rpx;
  267. text-align: center;
  268. float: left;
  269. }
  270. }
  271. .floor-item_tag{
  272. width: 100%;
  273. height: 32rpx;
  274. float: left;
  275. margin: 8rpx 0;
  276. padding: 0 20rpx;
  277. box-sizing: border-box;
  278. margin-bottom: 20rpx;
  279. text{
  280. display: inline-block;
  281. padding: 0 8rpx;
  282. border: 1px solid #e3ebf7;
  283. border-radius: 8rpx ;
  284. color: #9aa5b5;
  285. font-size: $font-size-22;
  286. line-height: 32rpx;
  287. text-align: center;
  288. float: left;
  289. }
  290. }
  291. .floor-item-content{
  292. width: 100%;
  293. padding: 0 20rpx;
  294. box-sizing: border-box;
  295. }
  296. .floor-item-act{
  297. display: block;
  298. width: 100%;
  299. height: 32rpx;
  300. text-align: center;
  301. box-sizing: border-box;
  302. }
  303. .floor-tags{
  304. height: 28rpx;
  305. border-radius: 6rpx;
  306. background-color: #FFFFFF;
  307. line-height: 28rpx;
  308. color: $color-system;
  309. text-align: center;
  310. display: inline-block;
  311. padding:0 16rpx;
  312. font-size: $font-size-20;
  313. border: 1px solid #E15616;
  314. float: left;
  315. }
  316. .title-none{
  317. font-size: $font-size-26;
  318. color: #FF2A2A;
  319. line-height: 54rpx;
  320. }
  321. .title{
  322. width: 100%;
  323. height: 70rpx;
  324. display: flex;
  325. line-height: 35rpx;
  326. flex-direction: column;
  327. margin: 8rpx 0;
  328. padding: 0;
  329. position: relative;
  330. .mclap{
  331. width: 100%;
  332. line-height:35rpx;
  333. text-overflow:ellipsis;
  334. display: -webkit-box;
  335. word-break: break-all;
  336. -webkit-box-orient: vertical;
  337. -webkit-line-clamp: 2;
  338. overflow: hidden;
  339. font-size: 26rpx;
  340. &.indent{
  341. text-indent: 95rpx;
  342. }
  343. }
  344. .mclap-tag{
  345. display: block;
  346. width: 84rpx;
  347. height: 32rpx;
  348. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  349. border-radius: 4rpx 48rpx 4px 4px;
  350. line-height: 32rpx;
  351. font-size: $font-size-22;
  352. color: #FFFFFF;
  353. text-align: center;
  354. position: absolute;
  355. left: 0;
  356. top: 0;
  357. }
  358. }
  359. .no-price{
  360. height: 54rpx;
  361. line-height: 54rpx;
  362. display: flex;
  363. box-sizing: border-box;
  364. .p-no{
  365. font-size: $font-size-28;
  366. color: $text-color;
  367. display: block;
  368. float: left;
  369. }
  370. .p-stars{
  371. float: left;
  372. }
  373. }
  374. .price{
  375. color: #FF2A2A;
  376. line-height:54rpx;
  377. &.none{
  378. text-decoration: line-through;
  379. color: #999999;
  380. }
  381. .sm{
  382. font-size: $font-size-24;
  383. }
  384. .big{
  385. font-size: $font-size-28;
  386. }
  387. }
  388. }
  389. }
  390. </style>