templateF.vue 9.4 KB

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