templateJ.vue 7.9 KB

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