templateC.vue 7.8 KB

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