templateE.vue 8.9 KB

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