templateF.vue 10 KB

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