templateE.vue 9.2 KB

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