templateB.vue 9.5 KB

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