templateF.vue 8.4 KB

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