templateB.vue 9.2 KB

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