templateG.vue 6.1 KB

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