templateG.vue 6.0 KB

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