templateG.vue 8.4 KB

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