templateE.vue 9.2 KB

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