templateG.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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>
  36. <template v-else>
  37. <template v-if="item.product.actStatus === 1">
  38. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  39. {{ item.product.promotions.name }}
  40. <text v-if="hasLogin && item.product.priceFlag != 1"
  41. >:¥{{ item.product.price | NumFormat }}</text
  42. >
  43. </view>
  44. <view class="floor-tags" v-else>{{ item.product.promotions.name }}</view>
  45. </template>
  46. </template>
  47. </view>
  48. <view v-if="hasLogin">
  49. <template v-if="item.product.productCategory == 1">
  50. <template v-if="userIdentity == 3">
  51. <template v-if="item.product.shopID == shopId">
  52. <view class="title-none" v-if="item.product.priceFlag === 1">
  53. <text class="p big">¥未公开价格</text>
  54. </view>
  55. <view
  56. class="price tui-skeleton-rect"
  57. v-else
  58. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  59. >
  60. <text class="p sm">¥</text>
  61. <text class="p big">{{
  62. (PromotionsFormat(item.product.promotions)
  63. ? item.product.originalPrice
  64. : item.product.price) | NumFormat
  65. }}</text>
  66. </view>
  67. </template>
  68. <template v-else>
  69. <view class="no-price">
  70. <view class="p-stars">
  71. <text class="p-no">¥</text>
  72. <uni-grader
  73. :grade="Number(item.product.priceGrade)"
  74. :margin="14"
  75. ></uni-grader>
  76. </view>
  77. </view>
  78. </template>
  79. </template>
  80. <template v-else-if="userIdentity === 4">
  81. <view class="title-none" v-if="item.product.priceFlag === 1">
  82. <text class="p big">¥未公开价格</text>
  83. </view>
  84. <view class="title-none" v-if="item.product.priceFlag === 2">
  85. <text class="p big">¥价格仅会员可见</text>
  86. </view>
  87. <view
  88. class="price tui-skeleton-rect"
  89. v-if="item.product.priceFlag === 0"
  90. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  91. >
  92. <text class="p sm">¥</text>
  93. <text class="p big">{{
  94. (PromotionsFormat(item.product.promotions)
  95. ? item.product.originalPrice
  96. : item.product.price) | NumFormat
  97. }}</text>
  98. </view>
  99. </template>
  100. <template v-else>
  101. <view class="title-none" v-if="item.product.priceFlag === 1">
  102. <text class="p big">¥未公开价格</text>
  103. </view>
  104. <view
  105. class="price tui-skeleton-rect"
  106. v-else
  107. :class="PromotionsFormat(item.product.promotions) ? 'none' : ''"
  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>
  118. <template v-else>
  119. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  120. <text class="p sm">¥</text> <text class="p big">价格详聊</text>
  121. </view>
  122. <view class="price tui-skeleton-rect" v-else>
  123. <text class="p sm">¥</text>
  124. <text class="p big">{{ item.product.price | NumFormat }}</text>
  125. </view>
  126. </template>
  127. </view>
  128. <view v-else class="no-price">
  129. <template v-if="item.product.productCategory == 1">
  130. <view class="p-stars">
  131. <text class="p-no">¥</text>
  132. <uni-grader :grade="Number(item.product.priceGrade)" :margin="14"></uni-grader>
  133. </view>
  134. </template>
  135. <template v-else>
  136. <view class="p-stars"> <text class="p-no">¥登录可见</text> </view>
  137. </template>
  138. </view>
  139. </view>
  140. </view>
  141. </view>
  142. </view>
  143. </template>
  144. <script>
  145. import { mapState, mapMutations } from 'vuex'
  146. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  147. export default {
  148. name: 'templateG',
  149. components: {
  150. uniGrader
  151. },
  152. props: {
  153. pageData: {
  154. type: Object
  155. },
  156. userIdentity: {
  157. type: Number
  158. }
  159. },
  160. data() {
  161. return {
  162. shopId: 0,
  163. floorData: {}
  164. }
  165. },
  166. filters: {
  167. NumFormat: function(text) {
  168. //处理金额
  169. return Number(text).toFixed(2)
  170. }
  171. },
  172. created() {
  173. this.initData(this.pageData)
  174. },
  175. computed: {
  176. ...mapState(['hasLogin', 'userInfo', 'isActivity'])
  177. },
  178. watch: {
  179. pageData: {
  180. handler: function(el) {
  181. //监听对象的变换使用 function,箭头函数容易出现this指向不正确
  182. this.pageData = el
  183. this.initData(this.pageData)
  184. },
  185. deep: true
  186. }
  187. },
  188. methods: {
  189. initData(data) {
  190. this.floorData = data
  191. // console.log(this.floorData)
  192. this.$api
  193. .getStorage()
  194. .then(resolve => {
  195. this.shopId = resolve.shopId ? resolve.shopId : 0
  196. })
  197. .catch(err => {
  198. console.log('err', err)
  199. })
  200. },
  201. PromotionsFormat(promo) {
  202. //促销活动类型数据处理
  203. if (promo != null) {
  204. if (promo.type == 1 && promo.mode == 1) {
  205. return true
  206. } else {
  207. return false
  208. }
  209. }
  210. return false
  211. },
  212. navToDetailPage(pros) {
  213. //跳转商品详情页
  214. this.$api.FlooryNavigateTo(pros)
  215. }
  216. }
  217. }
  218. </script>
  219. <style lang="scss">
  220. .section_page_main {
  221. width: 100%;
  222. height: auto;
  223. box-sizing: border-box;
  224. .floor-item {
  225. width: 339rpx;
  226. height: 516rpx;
  227. margin-right: 20rpx;
  228. font-size: $font-size-24;
  229. color: $text-color;
  230. background: #ffffff;
  231. line-height: 36rpx;
  232. border-radius: 16rpx;
  233. margin-bottom: 20rpx;
  234. float: left;
  235. box-sizing: border-box;
  236. position: relative;
  237. &:nth-child(2n) {
  238. margin-right: 0;
  239. }
  240. .item-img-gg {
  241. width: 339rpx;
  242. height: 516rpx;
  243. display: block;
  244. border-radius: 16rpx;
  245. }
  246. .item-img {
  247. width: 339rpx;
  248. height: 339rpx;
  249. border-radius: 16rpx 16rpx 0 0;
  250. display: block;
  251. margin-bottom: 8rpx;
  252. }
  253. .floor-item_tag {
  254. width: 100%;
  255. height: 32rpx;
  256. float: left;
  257. margin: 20rpx 0;
  258. padding: 0 20rpx;
  259. box-sizing: border-box;
  260. text {
  261. display: inline-block;
  262. padding: 0 8rpx;
  263. border: 1px solid #e3ebf7;
  264. border-radius: 8rpx;
  265. color: #9aa5b5;
  266. font-size: $font-size-22;
  267. line-height: 32rpx;
  268. text-align: center;
  269. float: left;
  270. }
  271. }
  272. .floor-item-content {
  273. width: 100%;
  274. padding: 0 20rpx;
  275. box-sizing: border-box;
  276. }
  277. .floor-item-act {
  278. display: block;
  279. width: 100%;
  280. height: 32rpx;
  281. text-align: center;
  282. box-sizing: border-box;
  283. .floor-tags {
  284. height: 32rpx;
  285. box-sizing: border-box;
  286. border-radius: 8rpx;
  287. background-color: #ffffff;
  288. line-height: 28rpx;
  289. color: $color-system;
  290. text-align: center;
  291. display: inline-block;
  292. padding: 0 16rpx;
  293. font-size: $font-size-20;
  294. border: 1px solid #e15616;
  295. float: left;
  296. }
  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-30;
  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>