templateB.vue 7.2 KB

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