templateD.vue 9.6 KB

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