templateF.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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.floorData = data
  169. // console.log(this.floorData)
  170. this.$api
  171. .getStorage()
  172. .then(resolve => {
  173. this.shopId = resolve.shopId ? resolve.shopId : 0
  174. })
  175. .catch(err => {
  176. console.log('err', err)
  177. })
  178. },
  179. PromotionsFormat(promo) {
  180. //促销活动类型数据处理
  181. if (promo != null) {
  182. if (promo.type == 1 && promo.mode == 1) {
  183. return true
  184. } else {
  185. return false
  186. }
  187. }
  188. return false
  189. },
  190. navToDetailPage(pros) {
  191. //跳转商品详情页
  192. this.$api.FlooryNavigateTo(pros)
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss">
  198. .section_page_main {
  199. width: 100%;
  200. height: auto;
  201. box-sizing: border-box;
  202. .floor-item {
  203. width: 339rpx;
  204. height: 516rpx;
  205. margin-right: 20rpx;
  206. font-size: $font-size-24;
  207. color: $text-color;
  208. background: #ffffff;
  209. line-height: 36rpx;
  210. border-radius: 16rpx;
  211. margin-bottom: 20rpx;
  212. float: left;
  213. box-sizing: border-box;
  214. position: relative;
  215. &:nth-child(2n) {
  216. margin-right: 0;
  217. }
  218. .item-img-gg {
  219. width: 339rpx;
  220. height: 516rpx;
  221. display: block;
  222. border-radius: 16rpx;
  223. }
  224. .item-img {
  225. width: 339rpx;
  226. height: 339rpx;
  227. border-radius: 16rpx 16rpx 0 0;
  228. display: block;
  229. margin-bottom: 8rpx;
  230. }
  231. .floor-item_tag {
  232. width: 100%;
  233. height: 32rpx;
  234. float: left;
  235. margin: 20rpx 0;
  236. padding: 0 20rpx;
  237. box-sizing: border-box;
  238. text {
  239. display: inline-block;
  240. padding: 0 8rpx;
  241. border: 1px solid #e3ebf7;
  242. border-radius: 8rpx;
  243. color: #9aa5b5;
  244. font-size: $font-size-22;
  245. line-height: 32rpx;
  246. text-align: center;
  247. float: left;
  248. }
  249. }
  250. .floor-item-content {
  251. width: 100%;
  252. padding: 0 20rpx;
  253. box-sizing: border-box;
  254. }
  255. .floor-item-act {
  256. display: block;
  257. width: 100%;
  258. height: 32rpx;
  259. text-align: center;
  260. box-sizing: border-box;
  261. }
  262. .title-none {
  263. font-size: $font-size-26;
  264. color: #ff2a2a;
  265. line-height: 54rpx;
  266. }
  267. .title {
  268. width: 100%;
  269. height: 70rpx;
  270. display: flex;
  271. line-height: 35rpx;
  272. flex-direction: column;
  273. margin: 8rpx 0;
  274. padding: 0;
  275. position: relative;
  276. .mclap {
  277. width: 100%;
  278. line-height: 35rpx;
  279. text-overflow: ellipsis;
  280. display: -webkit-box;
  281. word-break: break-all;
  282. -webkit-box-orient: vertical;
  283. -webkit-line-clamp: 2;
  284. overflow: hidden;
  285. font-size: 26rpx;
  286. &.indent {
  287. text-indent: 95rpx;
  288. }
  289. }
  290. .mclap-tag {
  291. display: block;
  292. width: 84rpx;
  293. height: 32rpx;
  294. background-image: linear-gradient(270deg, #f9c023 0%, #f83600 100%);
  295. border-radius: 4rpx 48rpx 4px 4px;
  296. line-height: 32rpx;
  297. font-size: $font-size-22;
  298. color: #ffffff;
  299. text-align: center;
  300. position: absolute;
  301. left: 0;
  302. top: 0;
  303. }
  304. }
  305. .no-price {
  306. height: 54rpx;
  307. line-height: 54rpx;
  308. display: flex;
  309. box-sizing: border-box;
  310. .p-no {
  311. font-size: $font-size-30;
  312. color: $text-color;
  313. display: block;
  314. float: left;
  315. }
  316. .p-stars {
  317. float: left;
  318. }
  319. }
  320. .price {
  321. color: #ff2a2a;
  322. line-height: 54rpx;
  323. &.none {
  324. text-decoration: line-through;
  325. color: #999999;
  326. }
  327. .sm {
  328. font-size: $font-size-24;
  329. }
  330. .big {
  331. font-size: $font-size-28;
  332. }
  333. }
  334. }
  335. }
  336. </style>