templateF.vue 9.4 KB

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