templateK.vue 9.3 KB

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