templateA.vue 9.3 KB

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