templateC.vue 7.6 KB

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