templateK.vue 9.1 KB

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