templateB.vue 9.6 KB

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