templateE.vue 8.9 KB

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