templateG.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view
  4. class="floor-item ad_04 clearfix"
  5. v-for="(item, idx) in floorData.floorImageList"
  6. :key="idx"
  7. @click.stop="navToDetailPage(item)"
  8. >
  9. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  10. <view class="floor-item_tag" v-if="item.listType == 2">
  11. <text>{{ item.label }}</text>
  12. </view>
  13. <view class="floor-item-content">
  14. <view class="title tui-skeleton-rect">
  15. <text class="mclap-tag" v-if="item.product.beautyActFlag == '1'">美博会</text>
  16. <text class="mclap" :class="item.product.beautyActFlag == '1' ? 'indent' : ''"
  17. >{{ item.name }}
  18. </text>
  19. </view>
  20. <view class="floor-item-price" v-if="item.listType == 1">
  21. <template>
  22. <template-Tags :product="item.product"></template-Tags>
  23. </template>
  24. <view v-if="hasLogin">
  25. <template v-if="item.product.productCategory == 1">
  26. <template-Price :product="item.product"></template-Price>
  27. </template>
  28. <template v-else>
  29. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  30. <text class="p sm">¥</text> <text class="p big">价格详聊</text>
  31. </view>
  32. <view class="price tui-skeleton-rect" v-else>
  33. <text class="p sm">¥</text>
  34. <text class="p big">{{ item.product.price | NumFormat }}</text>
  35. </view>
  36. </template>
  37. </view>
  38. <view v-else class="no-price">
  39. <template v-if="item.product.productCategory == 1">
  40. <view class="p-stars">
  41. <text class="p-no">¥</text>
  42. <uni-grader :grade="Number(item.product.priceGrade)" :margin="14"></uni-grader>
  43. </view>
  44. </template>
  45. <template v-else>
  46. <view class="p-stars"> <text class="p-no">¥登录可见</text> </view>
  47. </template>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </template>
  54. <script>
  55. import { mapState, mapMutations } from 'vuex'
  56. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  57. import templateTags from '@/components/cm-module/pageTemplate/templateTags.vue'
  58. import templatePrice from '@/components/cm-module/pageTemplate/templatePrice.vue'
  59. export default {
  60. name: 'templateG',
  61. components: {
  62. uniGrader,
  63. templateTags,
  64. templatePrice
  65. },
  66. props: {
  67. pageData: {
  68. type: Object
  69. },
  70. userIdentity: {
  71. type: Number
  72. }
  73. },
  74. data() {
  75. return {
  76. shopId: 0,
  77. floorData: {}
  78. }
  79. },
  80. filters: {
  81. NumFormat: function(text) {
  82. //处理金额
  83. return Number(text).toFixed(2)
  84. }
  85. },
  86. created() {
  87. this.initData(this.pageData)
  88. },
  89. computed: {
  90. ...mapState(['hasLogin', 'userInfo', 'isActivity'])
  91. },
  92. watch: {
  93. pageData: {
  94. handler: function(el) {
  95. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  96. this.pageData = el
  97. this.initData(this.pageData)
  98. },
  99. deep: true
  100. }
  101. },
  102. methods: {
  103. initData(data) {
  104. this.$api.getStorage().then(resolve => {
  105. this.shopId = resolve.shopId ? resolve.shopId : 0
  106. })
  107. this.floorData = data
  108. // console.log(this.floorData)
  109. },
  110. PromotionsFormat(promo) {
  111. //促销活动类型数据处理
  112. if (promo != null) {
  113. if (promo.type == 1 && promo.mode == 1) {
  114. return true
  115. } else {
  116. return false
  117. }
  118. }
  119. return false
  120. },
  121. navToDetailPage(pros) {
  122. //跳转商品详情页
  123. this.$api.FlooryNavigateTo(pros)
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang="scss">
  129. .section_page_main {
  130. width: 100%;
  131. height: auto;
  132. box-sizing: border-box;
  133. .floor-item {
  134. width: 339rpx;
  135. height: 516rpx;
  136. margin-right: 20rpx;
  137. font-size: $font-size-24;
  138. color: $text-color;
  139. background: #ffffff;
  140. line-height: 36rpx;
  141. border-radius: 16rpx;
  142. margin-bottom: 20rpx;
  143. float: left;
  144. box-sizing: border-box;
  145. position: relative;
  146. &:nth-child(2n) {
  147. margin-right: 0;
  148. }
  149. .item-img-gg {
  150. width: 339rpx;
  151. height: 516rpx;
  152. display: block;
  153. border-radius: 16rpx;
  154. }
  155. .item-img {
  156. width: 339rpx;
  157. height: 339rpx;
  158. border-radius: 16rpx 16rpx 0 0;
  159. display: block;
  160. margin-bottom: 8rpx;
  161. }
  162. .floor-item_tag {
  163. width: 100%;
  164. height: 32rpx;
  165. float: left;
  166. margin: 20rpx 0;
  167. padding: 0 20rpx;
  168. box-sizing: border-box;
  169. text {
  170. display: inline-block;
  171. padding: 0 8rpx;
  172. border: 1px solid #e3ebf7;
  173. border-radius: 8rpx;
  174. color: #9aa5b5;
  175. font-size: $font-size-22;
  176. line-height: 32rpx;
  177. text-align: center;
  178. float: left;
  179. }
  180. }
  181. .floor-item-content {
  182. width: 100%;
  183. padding: 0 20rpx;
  184. box-sizing: border-box;
  185. }
  186. .floor-item-act {
  187. display: block;
  188. width: 100%;
  189. height: 32rpx;
  190. text-align: center;
  191. box-sizing: border-box;
  192. }
  193. .title-none {
  194. font-size: $font-size-26;
  195. color: #ff2a2a;
  196. line-height: 54rpx;
  197. }
  198. .title {
  199. width: 100%;
  200. height: 70rpx;
  201. display: flex;
  202. line-height: 35rpx;
  203. flex-direction: column;
  204. margin: 8rpx 0;
  205. padding: 0;
  206. position: relative;
  207. .mclap {
  208. width: 100%;
  209. line-height: 35rpx;
  210. text-overflow: ellipsis;
  211. display: -webkit-box;
  212. word-break: break-all;
  213. -webkit-box-orient: vertical;
  214. -webkit-line-clamp: 2;
  215. overflow: hidden;
  216. font-size: 26rpx;
  217. &.indent {
  218. text-indent: 95rpx;
  219. }
  220. }
  221. .mclap-tag {
  222. display: block;
  223. width: 84rpx;
  224. height: 32rpx;
  225. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  226. border-radius: 4rpx 48rpx 4px 4px;
  227. line-height: 32rpx;
  228. font-size: $font-size-22;
  229. color: #ffffff;
  230. text-align: center;
  231. position: absolute;
  232. left: 0;
  233. top: 0;
  234. }
  235. }
  236. .no-price {
  237. height: 54rpx;
  238. line-height: 54rpx;
  239. display: flex;
  240. box-sizing: border-box;
  241. .p-no {
  242. font-size: $font-size-30;
  243. color: $text-color;
  244. display: block;
  245. float: left;
  246. }
  247. .p-stars {
  248. float: left;
  249. }
  250. }
  251. .price {
  252. color: #ff2a2a;
  253. line-height: 54rpx;
  254. &.none {
  255. text-decoration: line-through;
  256. color: #999999;
  257. }
  258. .sm {
  259. font-size: $font-size-24;
  260. }
  261. .big {
  262. font-size: $font-size-28;
  263. }
  264. }
  265. }
  266. }
  267. </style>