templateG.vue 8.0 KB

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