templateG.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view class="section_page_main clearfix">
  3. <view class="floor-item ad_04 clearfix" v-for="(item, idx) in floorData.floorImageList" v-if="idx < 4" :key="idx" @click.stop="navToDetailPage(item)">
  4. <image class="item-img tui-skeleton-fillet" :src="item.image" mode="aspectFill"></image>
  5. <view class="floor-item_tag" v-if="item.listType == 2">
  6. <text>{{ item.label }}</text>
  7. </view>
  8. <view class="floor-item-content">
  9. <view class="title tui-skeleton-rect">
  10. <text class="mclap-tag" v-if="item.product.beautyActFlag == '1'">美博会</text>
  11. <text class="mclap" :class="item.product.beautyActFlag == '1' ? 'indent' : ''">{{item.name}} </text>
  12. </view>
  13. <view class="floor-item-price" v-if="item.listType == 1">
  14. <view class="floor-item-act">
  15. <view class="coupon-tags">优惠券</view>
  16. <template v-if="userIdentity === 3">
  17. <template v-if="item.product.actStatus===1">
  18. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  19. {{item.product.promotions.name}}
  20. <text v-if="hasLogin && item.product.priceFlag != 1 && item.product.shopID == shopId">:¥{{item.product.price | NumFormat}}</text>
  21. </view>
  22. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  23. </template>
  24. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  25. <view class="floor-tags">阶梯价格</view>
  26. </template>
  27. </template>
  28. <template v-else>
  29. <template v-if="item.product.actStatus===1">
  30. <view class="floor-tags" v-if="PromotionsFormat(item.product.promotions)">
  31. {{item.product.promotions.name}}
  32. <text v-if="hasLogin && item.product.priceFlag != 1">:¥{{item.product.price | NumFormat}}</text>
  33. </view>
  34. <view class="floor-tags" v-else>{{item.product.promotions.name}}</view>
  35. </template>
  36. <template v-if="item.product.actStatus ===0 && item.product.ladderPriceFlag===1">
  37. <view class="floor-tags">阶梯价格</view>
  38. </template>
  39. </template>
  40. </view>
  41. <view v-if="hasLogin">
  42. <template v-if="item.product.productCategory == 1">
  43. <template v-if="userIdentity == 3">
  44. <template v-if="item.product.shopID == shopId">
  45. <view class="title-none" v-if="item.product.priceFlag === 1">
  46. <text class="p big">¥未公开价格</text>
  47. </view>
  48. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  49. <text class="p sm">¥</text>
  50. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.originalPrice : item.product.price ) | NumFormat}}</text>
  51. </view>
  52. </template>
  53. <template v-else>
  54. <view class="no-price">
  55. <view class="p-stars">
  56. <text class="p-no">¥</text>
  57. <uni-grader :grade="Number(item.product.priceGrade)" :margin="14"></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 class="price tui-skeleton-rect" v-if="item.product.priceFlag === 0" :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  70. <text class="p sm">¥</text>
  71. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.originalPrice : item.product.price ) | NumFormat}}</text>
  72. </view>
  73. </template>
  74. <template v-else>
  75. <view class="title-none" v-if="item.product.priceFlag === 1">
  76. <text class="p big">¥未公开价格</text>
  77. </view>
  78. <view class="price tui-skeleton-rect" v-else :class="PromotionsFormat(item.product.promotions) ? 'none' : ''">
  79. <text class="p sm">¥</text>
  80. <text class="p big">{{ (PromotionsFormat(item.product.promotions) ? item.product.originalPrice : item.product.price ) | NumFormat}}</text>
  81. </view>
  82. </template>
  83. </template>
  84. <template v-else>
  85. <view class="price tui-skeleton-rect" v-if="item.product.detailTalkFlag == '2'">
  86. <text class="p sm">¥</text>
  87. <text class="p big">价格详聊</text>
  88. </view>
  89. <view class="price tui-skeleton-rect" v-else>
  90. <text class="p sm">¥</text>
  91. <text class="p big">{{ item.product.price | NumFormat }}</text>
  92. </view>
  93. </template>
  94. </view>
  95. <view v-else class="no-price">
  96. <template v-if="item.product.productCategory == 1">
  97. <view class="p-stars">
  98. <text class="p-no">¥</text>
  99. <uni-grader :grade="Number(item.product.priceGrade)" :margin="14"></uni-grader>
  100. </view>
  101. </template>
  102. <template v-else>
  103. <view class="p-stars">
  104. <text class="p-no">¥登录可见</text>
  105. </view>
  106. </template>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </template>
  113. <script>
  114. import { mapState,mapMutations} from 'vuex';
  115. import uniGrader from '@/components/uni-grade/uni-grade.vue'
  116. export default{
  117. name:"templateG",
  118. components:{
  119. uniGrader
  120. },
  121. props:{
  122. pageData:{
  123. type:Object
  124. },
  125. userIdentity:{
  126. type:Number
  127. }
  128. },
  129. data() {
  130. return{
  131. shopId:0,
  132. floorData:{}
  133. }
  134. },
  135. filters: {
  136. NumFormat:function(text) {//处理金额
  137. return Number(text).toFixed(2);
  138. },
  139. },
  140. created(){
  141. this.initData(this.pageData)
  142. },
  143. computed: {
  144. ...mapState(['hasLogin','userInfo','isActivity'])
  145. },
  146. watch: {
  147. pageData: {
  148. handler: function (el) {//监听对象的变换使用 function,箭头函数容易出现this指向不正确
  149. this.pageData = el
  150. this.initData(this.pageData)
  151. },
  152. deep: true
  153. }
  154. },
  155. methods:{
  156. initData(data){
  157. this.floorData = data
  158. // console.log(this.floorData)
  159. this.$api.getStorage().then((resolve) =>{
  160. this.shopId = resolve.shopId ? resolve.shopId : 0
  161. }).catch(err => {
  162. console.log('err',err)
  163. })
  164. },
  165. PromotionsFormat(promo){//促销活动类型数据处理
  166. if(promo!=null){
  167. if(promo.type == 1 && promo.mode == 1){
  168. return true
  169. }else{
  170. return false
  171. }
  172. }
  173. return false
  174. },
  175. navToDetailPage(pros) {//跳转商品详情页
  176. this.$api.FlooryNavigateTo(pros)
  177. }
  178. }
  179. }
  180. </script>
  181. <style lang="scss">
  182. .section_page_main{
  183. width: 100%;
  184. height: auto;
  185. box-sizing: border-box;
  186. .floor-item{
  187. width: 339rpx;
  188. height: 516rpx;
  189. margin-right: 20rpx;
  190. font-size: $font-size-24;
  191. color: $text-color;
  192. background: #FFFFFF;
  193. line-height: 36rpx;
  194. border-radius: 16rpx;
  195. margin-bottom: 20rpx;
  196. float: left;
  197. box-sizing: border-box;
  198. position: relative;
  199. &:nth-child(2n){
  200. margin-right: 0;
  201. }
  202. .item-img-gg{
  203. width: 339rpx;
  204. height: 516rpx;
  205. display: block;
  206. border-radius: 16rpx;
  207. }
  208. .item-img{
  209. width: 339rpx;
  210. height: 339rpx;
  211. border-radius: 16rpx 16rpx 0 0;
  212. display: block;
  213. margin-bottom: 8rpx;
  214. }
  215. .floor-item_tag{
  216. width: 100%;
  217. height: 32rpx;
  218. float: left;
  219. margin: 20rpx 0;
  220. padding: 0 20rpx;
  221. box-sizing: border-box;
  222. text{
  223. display: inline-block;
  224. padding: 0 8rpx;
  225. border: 1px solid #e3ebf7;
  226. border-radius: 8rpx ;
  227. color: #9aa5b5;
  228. font-size: $font-size-22;
  229. line-height: 32rpx;
  230. text-align: center;
  231. float: left;
  232. }
  233. }
  234. .floor-item-content{
  235. width: 100%;
  236. padding: 0 20rpx;
  237. box-sizing: border-box;
  238. }
  239. .floor-item-act{
  240. display: block;
  241. width: 100%;
  242. height: 32rpx;
  243. text-align: center;
  244. box-sizing: border-box;
  245. .coupon-tags{
  246. height: 32rpx;
  247. box-sizing: border-box;
  248. border-radius: 8rpx;
  249. background-color: #fff1eb;
  250. line-height: 28rpx;
  251. color: #f94b4b;
  252. text-align: center;
  253. display: inline-block;
  254. padding:0 10rpx;
  255. font-size: $font-size-20;
  256. border: 1px solid #f94b4b;
  257. float: left;
  258. margin-right: 12rpx;
  259. }
  260. .floor-tags{
  261. height: 32rpx;
  262. box-sizing: border-box;
  263. border-radius: 8rpx;
  264. background-color: #FFFFFF;
  265. line-height: 28rpx;
  266. color: $color-system;
  267. text-align: center;
  268. display: inline-block;
  269. padding:0 16rpx;
  270. font-size: $font-size-20;
  271. border: 1px solid #E15616;
  272. float: left;
  273. }
  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>