templateG.vue 6.0 KB

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