templateC.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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_04 clearfix" v-for="(item, idx) in floorData.floorImageList" v-if="idx < 3" :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:"templateC",
  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. &.ad_01{
  201. width: 100%;
  202. height: 240rpx;
  203. .item-img-gg{
  204. width: 100%;
  205. height: 240rpx;
  206. display: block;
  207. border-radius: 16rpx;
  208. }
  209. }
  210. &.ad_02{
  211. margin-right: 20rpx;
  212. }
  213. &:nth-child(odd){
  214. margin-right: 0;
  215. }
  216. .item-img-gg{
  217. width: 339rpx;
  218. height: 516rpx;
  219. display: block;
  220. border-radius: 16rpx;
  221. }
  222. .item-img{
  223. width: 339rpx;
  224. height: 339rpx;
  225. border-radius: 16rpx 16rpx 0 0;
  226. display: block;
  227. margin-bottom: 8rpx;
  228. }
  229. .floor-item_tag{
  230. width: 100%;
  231. height: 32rpx;
  232. float: left;
  233. margin: 20rpx 0;
  234. padding: 0 20rpx;
  235. box-sizing: border-box;
  236. text{
  237. display: inline-block;
  238. padding: 0 8rpx;
  239. border: 1px solid #e3ebf7;
  240. border-radius: 8rpx ;
  241. color: #9aa5b5;
  242. font-size: $font-size-22;
  243. line-height: 32rpx;
  244. text-align: center;
  245. float: left;
  246. }
  247. }
  248. .floor-item_tag{
  249. width: 100%;
  250. height: 32rpx;
  251. float: left;
  252. margin: 8rpx 0;
  253. padding: 0 20rpx;
  254. box-sizing: border-box;
  255. margin-bottom: 20rpx;
  256. text{
  257. display: inline-block;
  258. padding: 0 8rpx;
  259. border: 1px solid #e3ebf7;
  260. border-radius: 8rpx ;
  261. color: #9aa5b5;
  262. font-size: $font-size-22;
  263. line-height: 32rpx;
  264. text-align: center;
  265. float: left;
  266. }
  267. }
  268. .floor-item-content{
  269. width: 100%;
  270. padding: 0 20rpx;
  271. box-sizing: border-box;
  272. }
  273. .floor-item-act{
  274. display: block;
  275. width: 100%;
  276. height: 32rpx;
  277. text-align: center;
  278. box-sizing: border-box;
  279. }
  280. .floor-tags{
  281. height: 28rpx;
  282. border-radius: 6rpx;
  283. background-color: #FFFFFF;
  284. line-height: 28rpx;
  285. color: $color-system;
  286. text-align: center;
  287. display: inline-block;
  288. padding:0 16rpx;
  289. font-size: $font-size-20;
  290. border: 1px solid #E15616;
  291. float: left;
  292. }
  293. .title-none{
  294. font-size: $font-size-26;
  295. color: #FF2A2A;
  296. line-height: 54rpx;
  297. }
  298. .title{
  299. width: 100%;
  300. height: 70rpx;
  301. display: flex;
  302. line-height: 35rpx;
  303. flex-direction: column;
  304. margin: 8rpx 0;
  305. padding: 0;
  306. .mclap{
  307. width: 100%;
  308. line-height:35rpx;
  309. text-overflow:ellipsis;
  310. display: -webkit-box;
  311. word-break: break-all;
  312. -webkit-box-orient: vertical;
  313. -webkit-line-clamp: 2;
  314. overflow: hidden;
  315. font-size: 26rpx;
  316. }
  317. }
  318. .no-price{
  319. height: 54rpx;
  320. line-height: 54rpx;
  321. display: flex;
  322. box-sizing: border-box;
  323. .p-no{
  324. font-size: $font-size-28;
  325. color: $text-color;
  326. display: block;
  327. float: left;
  328. }
  329. .p-stars{
  330. float: left;
  331. }
  332. }
  333. .price{
  334. color: #FF2A2A;
  335. line-height:54rpx;
  336. &.none{
  337. text-decoration: line-through;
  338. color: #999999;
  339. }
  340. .sm{
  341. font-size: $font-size-24;
  342. }
  343. .big{
  344. font-size: $font-size-28;
  345. }
  346. }
  347. }
  348. }
  349. </style>