templateG.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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>
  110. </template>
  111. <script>
  112. import { mapState,mapMutations} from 'vuex';
  113. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  114. export default{
  115. name:"templateG",
  116. components:{
  117. uniGrader
  118. },
  119. props:{
  120. pageData:{
  121. type:Object
  122. },
  123. userIdentity:{
  124. type:Number
  125. }
  126. },
  127. data() {
  128. return{
  129. shopId:0,
  130. floorData:{}
  131. }
  132. },
  133. filters: {
  134. NumFormat:function(text) {//处理金额
  135. return Number(text).toFixed(2);
  136. },
  137. },
  138. created(){
  139. this.initData(this.pageData)
  140. },
  141. computed: {
  142. ...mapState(['hasLogin','userInfo','isActivity'])
  143. },
  144. watch: {
  145. pageData: {
  146. handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
  147. this.pageData = el
  148. this.initData(this.pageData)
  149. },
  150. deep: true
  151. }
  152. },
  153. methods:{
  154. initData(data){
  155. this.$api.getStorage().then((resolve) =>{
  156. this.shopId = resolve.shopID ? resolve.shopID : 0
  157. })
  158. this.floorData = data
  159. // console.log(this.floorData)
  160. },
  161. PromotionsFormat(promo){//促销活动类型数据处理
  162. if(promo!=null){
  163. if(promo.type == 1 && promo.mode == 1){
  164. return true
  165. }else{
  166. return false
  167. }
  168. }
  169. return false
  170. },
  171. navToDetailPage(pros) {//跳转商品详情页
  172. this.$api.FlooryNavigateTo(pros)
  173. }
  174. }
  175. }
  176. </script>
  177. <style lang="scss">
  178. .section_page_main{
  179. width: 100%;
  180. height: auto;
  181. box-sizing: border-box;
  182. .floor-item{
  183. width: 339rpx;
  184. height: 516rpx;
  185. margin-right: 20rpx;
  186. font-size: $font-size-24;
  187. color: $text-color;
  188. background: #FFFFFF;
  189. line-height: 36rpx;
  190. border-radius: 16rpx;
  191. margin-bottom: 20rpx;
  192. float: left;
  193. box-sizing: border-box;
  194. position: relative;
  195. &:nth-child(2n){
  196. margin-right: 0;
  197. }
  198. .item-img-gg{
  199. width: 339rpx;
  200. height: 516rpx;
  201. display: block;
  202. border-radius: 16rpx;
  203. }
  204. .item-img{
  205. width: 339rpx;
  206. height: 339rpx;
  207. border-radius: 16rpx 16rpx 0 0;
  208. display: block;
  209. margin-bottom: 8rpx;
  210. }
  211. .floor-item_tag{
  212. width: 100%;
  213. height: 32rpx;
  214. float: left;
  215. margin: 20rpx 0;
  216. padding: 0 20rpx;
  217. box-sizing: border-box;
  218. text{
  219. display: inline-block;
  220. padding: 0 8rpx;
  221. border: 1px solid #e3ebf7;
  222. border-radius: 8rpx ;
  223. color: #9aa5b5;
  224. font-size: $font-size-22;
  225. line-height: 32rpx;
  226. text-align: center;
  227. float: left;
  228. }
  229. }
  230. .floor-item-content{
  231. width: 100%;
  232. padding: 0 20rpx;
  233. box-sizing: border-box;
  234. }
  235. .floor-item-act{
  236. display: block;
  237. width: 100%;
  238. height: 32rpx;
  239. text-align: center;
  240. box-sizing: border-box;
  241. }
  242. .floor-tags{
  243. height: 28rpx;
  244. border-radius: 6rpx;
  245. background-color: #FFFFFF;
  246. line-height: 28rpx;
  247. color: $color-system;
  248. text-align: center;
  249. display: inline-block;
  250. padding:0 16rpx;
  251. font-size: $font-size-20;
  252. border: 1px solid #E15616;
  253. float: left;
  254. }
  255. .title-none{
  256. font-size: $font-size-26;
  257. color: #FF2A2A;
  258. line-height: 54rpx;
  259. }
  260. .title{
  261. width: 100%;
  262. height: 70rpx;
  263. display: flex;
  264. line-height: 35rpx;
  265. flex-direction: column;
  266. margin: 8rpx 0;
  267. padding: 0;
  268. .mclap{
  269. width: 100%;
  270. line-height:35rpx;
  271. text-overflow:ellipsis;
  272. display: -webkit-box;
  273. word-break: break-all;
  274. -webkit-box-orient: vertical;
  275. -webkit-line-clamp: 2;
  276. overflow: hidden;
  277. font-size: 26rpx;
  278. }
  279. }
  280. .no-price{
  281. height: 54rpx;
  282. line-height: 54rpx;
  283. display: flex;
  284. box-sizing: border-box;
  285. .p-no{
  286. font-size: $font-size-30;
  287. color: $text-color;
  288. display: block;
  289. float: left;
  290. }
  291. .p-stars{
  292. float: left;
  293. }
  294. }
  295. .price{
  296. color: #FF2A2A;
  297. line-height:54rpx;
  298. &.none{
  299. text-decoration: line-through;
  300. color: #999999;
  301. }
  302. .sm{
  303. font-size: $font-size-24;
  304. }
  305. .big{
  306. font-size: $font-size-28;
  307. }
  308. }
  309. }
  310. }
  311. </style>