templateJ.vue 8.1 KB

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