templateG.vue 9.3 KB

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