templateB.vue 9.4 KB

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