templateE.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  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(floorData.floorContent.linkType1,floorData.floorContent.linkParam1.id,floorData.floorContent.adsLink1,floorData.floorContent.linkParam1.keyword)"
  7. mode="aspectFill">
  8. </image>
  9. </view>
  10. <view class="floor-item ad_04 clearfix" v-for="(item, idx) in floorData.floorImageList" v-if="idx < 4" :key="idx" @click.stop="navToDetailPage(item)">
  11. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  12. <view class="floor-item_tag" v-if="item.listType == 2">
  13. <text>{{ item.label }}</text>
  14. </view>
  15. <view class="floor-item-content">
  16. <view class="title tui-skeleton-rect">
  17. <text class="mclap">{{item.name}}</text>
  18. </view>
  19. <view class="floor-item-price" v-if="item.listType == 1">
  20. <view class="floor-item-act">
  21. <template v-if="userIdentity === 3">
  22. <template v-if="item.product.actStatus===1">
  23. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  24. {{item.product.promotions.name}}
  25. <text v-if="hasLogin && item.product.price1TextFlag != 1 && item.product.shopID == shopId">:¥{{item.product.retailPrice | NumFormat}}</text>
  26. </view>
  27. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  28. </template>
  29. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  30. <view class="floor-tags">阶梯价格</view>
  31. </template>
  32. </template>
  33. <template v-else>
  34. <template v-if="item.product.actStatus===1">
  35. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  36. {{item.product.promotions.name}}
  37. <text v-if="hasLogin && item.product.price1TextFlag != 1">:¥{{item.product.retailPrice | NumFormat}}</text>
  38. </view>
  39. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  40. </template>
  41. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  42. <view class="floor-tags">阶梯价格</view>
  43. </template>
  44. </template>
  45. </view>
  46. <view v-if="hasLogin">
  47. <template v-if="userIdentity == 3">
  48. <template v-if="item.product.shopID == shopId">
  49. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  50. <text class="p big">¥未公开价格</text>
  51. </view>
  52. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  53. <text class="p sm">¥</text>
  54. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  55. </view>
  56. </template>
  57. <template v-else>
  58. <view class="no-price">
  59. <view class="p-stars">
  60. <text class="p-no">¥</text>
  61. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  62. </view>
  63. </view>
  64. </template>
  65. </template>
  66. <template v-else-if="userIdentity ===4">
  67. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  68. <text class="p big">¥未公开价格</text>
  69. </view>
  70. <view class="title-none" v-if="item.product.price1TextFlag === '2'">
  71. <text class="p big">¥价格仅会员可见</text>
  72. </view>
  73. <view class="price tui-skeleton-rect" v-if="item.product.price1TextFlag === '0'" :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  74. <text class="p sm">¥</text>
  75. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  76. </view>
  77. </template>
  78. <template v-else>
  79. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  80. <text class="p big">¥未公开价格</text>
  81. </view>
  82. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  83. <text class="p sm">¥</text>
  84. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  85. </view>
  86. </template>
  87. </view>
  88. <view v-else class="no-price">
  89. <template v-if="item.product.productCategory == 1">
  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. </template>
  95. <template v-else>
  96. <view class="p-stars">
  97. <text class="p-no">¥登录可见</text>
  98. </view>
  99. </template>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </view>
  105. </template>
  106. <script>
  107. import { mapState,mapMutations} from 'vuex';
  108. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  109. export default{
  110. name:"templateE",
  111. components:{
  112. uniGrader
  113. },
  114. props:{
  115. pageData:{
  116. type:Object
  117. },
  118. userIdentity:{
  119. type:Number
  120. }
  121. },
  122. data() {
  123. return{
  124. shopId:0,
  125. floorData:{}
  126. }
  127. },
  128. filters: {
  129. NumFormat:function(text) {//处理金额
  130. return Number(text).toFixed(2);
  131. },
  132. },
  133. created(){
  134. this.initData(this.pageData)
  135. },
  136. computed: {
  137. ...mapState(['hasLogin','userInfo','isActivity'])
  138. },
  139. watch: {
  140. pageData: {
  141. handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
  142. this.pageData = el
  143. this.initData(this.pageData)
  144. },
  145. deep: true
  146. }
  147. },
  148. methods:{
  149. initData(data){
  150. this.$api.getStorage().then((resolve) =>{
  151. this.shopId = resolve.shopID
  152. })
  153. this.floorData = data
  154. // console.log(this.floorData)
  155. },
  156. PromotionsFormat(promo){//促销活动类型数据处理
  157. if(promo!=null){
  158. if(promo.type == 1 && promo.mode == 1){
  159. return true
  160. }else{
  161. return false
  162. }
  163. }
  164. return false
  165. },
  166. navToDetailPage(pros) {//跳转商品详情页
  167. this.$api.FlooryNavigateTo(pros)
  168. },
  169. BannerNavigateTo(linkType,linkId,linkHref,keyword) {//跳转商品详情页
  170. this.$api.BannerNavigateTo(linkType,linkId,linkHref,keyword)
  171. }
  172. }
  173. }
  174. </script>
  175. <style lang="scss">
  176. .section_page_main{
  177. width: 100%;
  178. height: auto;
  179. box-sizing: border-box;
  180. .floor-item{
  181. width: 339rpx;
  182. height: 516rpx;
  183. margin-right: 20rpx;
  184. font-size: $font-size-24;
  185. color: $text-color;
  186. background: #FFFFFF;
  187. line-height: 36rpx;
  188. border-radius: 16rpx;
  189. margin-bottom: 20rpx;
  190. float: left;
  191. box-sizing: border-box;
  192. position: relative;
  193. &.ad_01{
  194. width: 100%;
  195. height: 240rpx;
  196. .item-img-gg{
  197. width: 100%;
  198. height: 240rpx;
  199. display: block;
  200. border-radius: 16rpx;
  201. }
  202. }
  203. &.ad_02{
  204. margin-right: 20rpx;
  205. }
  206. &:nth-child(odd){
  207. margin-right: 0;
  208. }
  209. .item-img-gg{
  210. width: 339rpx;
  211. height: 516rpx;
  212. display: block;
  213. border-radius: 16rpx;
  214. }
  215. .item-img{
  216. width: 339rpx;
  217. height: 339rpx;
  218. border-radius: 16rpx 16rpx 0 0;
  219. display: block;
  220. margin-bottom: 8rpx;
  221. }
  222. .floor-item_tag{
  223. width: 100%;
  224. height: 32rpx;
  225. float: left;
  226. margin: 20rpx 0;
  227. padding: 0 20rpx;
  228. box-sizing: border-box;
  229. text{
  230. display: inline-block;
  231. padding: 0 8rpx;
  232. border: 1px solid #e3ebf7;
  233. border-radius: 8rpx ;
  234. color: #9aa5b5;
  235. font-size: $font-size-22;
  236. line-height: 32rpx;
  237. text-align: center;
  238. float: left;
  239. }
  240. }
  241. .floor-item-content{
  242. width: 100%;
  243. padding: 0 20rpx;
  244. box-sizing: border-box;
  245. }
  246. .floor-item-act{
  247. display: block;
  248. width: 100%;
  249. height: 32rpx;
  250. text-align: center;
  251. box-sizing: border-box;
  252. }
  253. .floor-tags{
  254. height: 28rpx;
  255. border-radius: 6rpx;
  256. background-color: #FFFFFF;
  257. line-height: 28rpx;
  258. color: $color-system;
  259. text-align: center;
  260. display: inline-block;
  261. padding:0 16rpx;
  262. font-size: $font-size-20;
  263. border: 1px solid #E15616;
  264. float: left;
  265. }
  266. .title-none{
  267. font-size: $font-size-26;
  268. color: #FF2A2A;
  269. line-height: 54rpx;
  270. }
  271. .title{
  272. width: 100%;
  273. height: 70rpx;
  274. display: flex;
  275. line-height: 35rpx;
  276. flex-direction: column;
  277. margin: 8rpx 0;
  278. padding: 0;
  279. .mclap{
  280. width: 100%;
  281. line-height:35rpx;
  282. text-overflow:ellipsis;
  283. display: -webkit-box;
  284. word-break: break-all;
  285. -webkit-box-orient: vertical;
  286. -webkit-line-clamp: 2;
  287. overflow: hidden;
  288. font-size: 26rpx;
  289. }
  290. }
  291. .no-price{
  292. height: 54rpx;
  293. line-height: 54rpx;
  294. display: flex;
  295. box-sizing: border-box;
  296. .p-no{
  297. font-size: $font-size-28;
  298. color: $text-color;
  299. display: block;
  300. float: left;
  301. }
  302. .p-stars{
  303. float: left;
  304. }
  305. }
  306. .price{
  307. color: #FF2A2A;
  308. line-height:54rpx;
  309. &.none{
  310. text-decoration: line-through;
  311. color: #999999;
  312. }
  313. .sm{
  314. font-size: $font-size-24;
  315. }
  316. .big{
  317. font-size: $font-size-28;
  318. }
  319. }
  320. }
  321. }
  322. </style>