templateB.vue 9.1 KB

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