templateE.vue 9.6 KB

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