templateD.vue 11 KB

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