templateB.vue 9.2 KB

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