templateF.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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.floorData = data
  108. // console.log(this.floorData)
  109. this.$api
  110. .getStorage()
  111. .then(resolve => {
  112. this.shopId = resolve.shopId ? resolve.shopId : 0
  113. })
  114. .catch(err => {
  115. console.log('err', err)
  116. })
  117. },
  118. PromotionsFormat(promo) {
  119. //促销活动类型数据处理
  120. if (promo != null) {
  121. if (promo.type == 1 && promo.mode == 1) {
  122. return true
  123. } else {
  124. return false
  125. }
  126. }
  127. return false
  128. },
  129. navToDetailPage(pros) {
  130. //跳转商品详情页
  131. this.$api.FlooryNavigateTo(pros)
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss">
  137. .section_page_main {
  138. width: 100%;
  139. height: auto;
  140. box-sizing: border-box;
  141. .floor-item {
  142. width: 339rpx;
  143. height: 516rpx;
  144. margin-right: 20rpx;
  145. font-size: $font-size-24;
  146. color: $text-color;
  147. background: #ffffff;
  148. line-height: 36rpx;
  149. border-radius: 16rpx;
  150. margin-bottom: 20rpx;
  151. float: left;
  152. box-sizing: border-box;
  153. position: relative;
  154. &:nth-child(2n) {
  155. margin-right: 0;
  156. }
  157. .item-img-gg {
  158. width: 339rpx;
  159. height: 516rpx;
  160. display: block;
  161. border-radius: 16rpx;
  162. }
  163. .item-img {
  164. width: 339rpx;
  165. height: 339rpx;
  166. border-radius: 16rpx 16rpx 0 0;
  167. display: block;
  168. margin-bottom: 8rpx;
  169. }
  170. .floor-item_tag {
  171. width: 100%;
  172. height: 32rpx;
  173. float: left;
  174. margin: 20rpx 0;
  175. padding: 0 20rpx;
  176. box-sizing: border-box;
  177. text {
  178. display: inline-block;
  179. padding: 0 8rpx;
  180. border: 1px solid #e3ebf7;
  181. border-radius: 8rpx;
  182. color: #9aa5b5;
  183. font-size: $font-size-22;
  184. line-height: 32rpx;
  185. text-align: center;
  186. float: left;
  187. }
  188. }
  189. .floor-item-content {
  190. width: 100%;
  191. padding: 0 20rpx;
  192. box-sizing: border-box;
  193. }
  194. .floor-item-act {
  195. display: block;
  196. width: 100%;
  197. height: 32rpx;
  198. text-align: center;
  199. box-sizing: border-box;
  200. }
  201. .title-none {
  202. font-size: $font-size-26;
  203. color: #ff2a2a;
  204. line-height: 54rpx;
  205. }
  206. .title {
  207. width: 100%;
  208. height: 70rpx;
  209. display: flex;
  210. line-height: 35rpx;
  211. flex-direction: column;
  212. margin: 8rpx 0;
  213. padding: 0;
  214. position: relative;
  215. .mclap {
  216. width: 100%;
  217. line-height: 35rpx;
  218. text-overflow: ellipsis;
  219. display: -webkit-box;
  220. word-break: break-all;
  221. -webkit-box-orient: vertical;
  222. -webkit-line-clamp: 2;
  223. overflow: hidden;
  224. font-size: 26rpx;
  225. &.indent {
  226. text-indent: 95rpx;
  227. }
  228. }
  229. .mclap-tag {
  230. display: block;
  231. width: 84rpx;
  232. height: 32rpx;
  233. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  234. border-radius: 4rpx 48rpx 4px 4px;
  235. line-height: 32rpx;
  236. font-size: $font-size-22;
  237. color: #ffffff;
  238. text-align: center;
  239. position: absolute;
  240. left: 0;
  241. top: 0;
  242. }
  243. }
  244. .no-price {
  245. height: 54rpx;
  246. line-height: 54rpx;
  247. display: flex;
  248. box-sizing: border-box;
  249. .p-no {
  250. font-size: $font-size-30;
  251. color: $text-color;
  252. display: block;
  253. float: left;
  254. }
  255. .p-stars {
  256. float: left;
  257. }
  258. }
  259. .price {
  260. color: #ff2a2a;
  261. line-height: 54rpx;
  262. &.none {
  263. text-decoration: line-through;
  264. color: #999999;
  265. }
  266. .sm {
  267. font-size: $font-size-24;
  268. }
  269. .big {
  270. font-size: $font-size-28;
  271. }
  272. }
  273. }
  274. }
  275. </style>