templateG.vue 10 KB

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