templateG.vue 8.1 KB

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