templateF.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="floor-item ad_04 clearfix" v-for="(item, idx) in floorData.floorImageList" v-if="idx < 4" :key="idx" @click.stop="navToDetailPage(item)">
  4. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  5. <view class="floor-item_tag" v-if="item.listType == 2">
  6. <text>{{ item.label }}</text>
  7. </view>
  8. <view class="floor-item-content">
  9. <view class="title tui-skeleton-rect">
  10. <text class="mclap">{{item.name}}</text>
  11. </view>
  12. <view class="floor-item-price" v-if="item.listType == 1">
  13. <view class="floor-item-act">
  14. <template v-if="userIdentity === 3">
  15. <template v-if="item.product.actStatus===1">
  16. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  17. {{item.product.promotions.name}}
  18. <text v-if="hasLogin && item.product.price1TextFlag != 1 && item.product.shopID == shopId">:¥{{item.product.retailPrice | NumFormat}}</text>
  19. </view>
  20. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  21. </template>
  22. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  23. <view class="floor-tags">阶梯价格</view>
  24. </template>
  25. </template>
  26. <template v-else>
  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.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. </view>
  39. <view v-if="hasLogin">
  40. <template v-if="item.product.productCategory == 1">
  41. <template v-if="userIdentity == 3">
  42. <template v-if="item.product.shopID == shopId">
  43. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  44. <text class="p big">¥未公开价格</text>
  45. </view>
  46. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  47. <text class="p sm">¥</text>
  48. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  49. </view>
  50. </template>
  51. <template v-else>
  52. <view class="no-price">
  53. <view class="p-stars">
  54. <text class="p-no">¥</text>
  55. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  56. </view>
  57. </view>
  58. </template>
  59. </template>
  60. <template v-else-if="userIdentity ===4">
  61. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  62. <text class="p big">¥未公开价格</text>
  63. </view>
  64. <view class="title-none" v-if="item.product.price1TextFlag === '2'">
  65. <text class="p big">¥价格仅会员可见</text>
  66. </view>
  67. <view class="price tui-skeleton-rect" v-if="item.product.price1TextFlag === '0'" :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  68. <text class="p sm">¥</text>
  69. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  70. </view>
  71. </template>
  72. <template v-else>
  73. <view class="title-none" v-if="item.product.price1TextFlag === '1'">
  74. <text class="p big">¥未公开价格</text>
  75. </view>
  76. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  77. <text class="p sm">¥</text>
  78. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.price1 : item.product.retailPrice ) | NumFormat}}</text>
  79. </view>
  80. </template>
  81. </template>
  82. <template v-else>
  83. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  84. <text class="p sm">¥</text>
  85. <text class="p big">价格详聊</text>
  86. </view>
  87. <view class="price tui-skeleton-rect" v-else>
  88. <text class="p sm">¥</text>
  89. <text class="p big">{{ item.product.retailPrice | NumFormat }}</text>
  90. </view>
  91. </template>
  92. </view>
  93. <view v-else class="no-price">
  94. <template v-if="item.product.productCategory == 1">
  95. <view class="p-stars">
  96. <text class="p-no">¥</text>
  97. <uni-grader :grade="Number(item.product.price1Grade)" :margin="14"></uni-grader>
  98. </view>
  99. </template>
  100. <template v-else>
  101. <view class="p-stars">
  102. <text class="p-no">¥登录可见</text>
  103. </view>
  104. </template>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="floor-item ad_01">
  110. <image class="item-img-gg"
  111. :src="floorData.floorContent.appletsAdsImage1"
  112. @click="BannerNavigateTo(
  113. floorData.floorContent.linkType1,
  114. floorData.floorContent.linkParam1.id ? floorData.floorContent.linkParam1.id : '',
  115. floorData.floorContent.adsLink1,
  116. floorData.floorContent.linkParam1.keyword ? floorData.floorContent.linkParam1.keyword : ''
  117. )"
  118. mode="aspectFill">
  119. </image>
  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:"templateF",
  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. margin-right: 0;
  214. .item-img-gg{
  215. width: 100%;
  216. height: 240rpx;
  217. display: block;
  218. border-radius: 16rpx;
  219. }
  220. }
  221. &:nth-child(2n){
  222. margin-right: 0;
  223. }
  224. .item-img-gg{
  225. width: 339rpx;
  226. height: 516rpx;
  227. display: block;
  228. border-radius: 16rpx;
  229. }
  230. .item-img{
  231. width: 339rpx;
  232. height: 339rpx;
  233. border-radius: 16rpx 16rpx 0 0;
  234. display: block;
  235. margin-bottom: 8rpx;
  236. }
  237. .floor-item_tag{
  238. width: 100%;
  239. height: 32rpx;
  240. float: left;
  241. margin: 20rpx 0;
  242. padding: 0 20rpx;
  243. box-sizing: border-box;
  244. text{
  245. display: inline-block;
  246. padding: 0 8rpx;
  247. border: 1px solid #e3ebf7;
  248. border-radius: 8rpx ;
  249. color: #9aa5b5;
  250. font-size: $font-size-22;
  251. line-height: 32rpx;
  252. text-align: center;
  253. float: left;
  254. }
  255. }
  256. .floor-item_tag{
  257. width: 100%;
  258. height: 32rpx;
  259. float: left;
  260. margin: 8rpx 0;
  261. padding: 0 20rpx;
  262. box-sizing: border-box;
  263. margin-bottom: 20rpx;
  264. text{
  265. display: inline-block;
  266. padding: 0 8rpx;
  267. border: 1px solid #e3ebf7;
  268. border-radius: 8rpx ;
  269. color: #9aa5b5;
  270. font-size: $font-size-22;
  271. line-height: 32rpx;
  272. text-align: center;
  273. float: left;
  274. }
  275. }
  276. .floor-item-content{
  277. width: 100%;
  278. padding: 0 20rpx;
  279. box-sizing: border-box;
  280. }
  281. .floor-item-act{
  282. display: block;
  283. width: 100%;
  284. height: 32rpx;
  285. text-align: center;
  286. box-sizing: border-box;
  287. }
  288. .floor-tags{
  289. height: 28rpx;
  290. border-radius: 6rpx;
  291. background-color: #FFFFFF;
  292. line-height: 28rpx;
  293. color: $color-system;
  294. text-align: center;
  295. display: inline-block;
  296. padding:0 16rpx;
  297. font-size: $font-size-20;
  298. border: 1px solid #E15616;
  299. float: left;
  300. }
  301. .title-none{
  302. font-size: $font-size-26;
  303. color: #FF2A2A;
  304. line-height: 54rpx;
  305. }
  306. .title{
  307. width: 100%;
  308. height: 70rpx;
  309. display: flex;
  310. line-height: 35rpx;
  311. flex-direction: column;
  312. margin: 8rpx 0;
  313. padding: 0;
  314. .mclap{
  315. width: 100%;
  316. line-height:35rpx;
  317. text-overflow:ellipsis;
  318. display: -webkit-box;
  319. word-break: break-all;
  320. -webkit-box-orient: vertical;
  321. -webkit-line-clamp: 2;
  322. overflow: hidden;
  323. font-size: 26rpx;
  324. }
  325. }
  326. .no-price{
  327. height: 54rpx;
  328. line-height: 54rpx;
  329. display: flex;
  330. box-sizing: border-box;
  331. .p-no{
  332. font-size: $font-size-28;
  333. color: $text-color;
  334. display: block;
  335. float: left;
  336. }
  337. .p-stars{
  338. float: left;
  339. }
  340. }
  341. .price{
  342. color: #FF2A2A;
  343. line-height:54rpx;
  344. &.none{
  345. text-decoration: line-through;
  346. color: #999999;
  347. }
  348. .sm{
  349. font-size: $font-size-24;
  350. }
  351. .big{
  352. font-size: $font-size-28;
  353. }
  354. }
  355. }
  356. }
  357. </style>