| 
									
										
										
										
											2025-03-23 09:29:40 +08:00
										 |  |  | <!-- | 
					
						
							|  |  |  |  * @Descripttion:  | 
					
						
							|  |  |  |  * @version:  | 
					
						
							|  |  |  |  * @Author: 王三华 | 
					
						
							|  |  |  |  * @Date: 2023-07-01 09:38:17 | 
					
						
							|  |  |  | --> | 
					
						
							|  |  |  | <template> | 
					
						
							|  |  |  |   <view> | 
					
						
							|  |  |  |     <view class="quan" | 
					
						
							|  |  |  |           @click.stop="goCart"> | 
					
						
							|  |  |  |       <img :src="smallCarLength>0?img1:img2" | 
					
						
							|  |  |  |            alt=""> | 
					
						
							|  |  |  |       <view class="qiu" | 
					
						
							|  |  |  |             v-show="smallCarLength > 0">{{ smallCarLength }}</view> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     </view> | 
					
						
							|  |  |  |     <u-popup :show="downShow" | 
					
						
							|  |  |  |              mode="bottom" | 
					
						
							|  |  |  |              closeOnClickOverlay | 
					
						
							|  |  |  |              closeable | 
					
						
							|  |  |  |              round="10" | 
					
						
							|  |  |  |              @close="close"> | 
					
						
							| 
									
										
										
										
											2025-04-01 21:35:18 +08:00
										 |  |  |       <view class="title">{{ '购物车' }}</view> | 
					
						
							| 
									
										
										
										
											2025-03-23 09:29:40 +08:00
										 |  |  |       <cartBtmList ref='cartBtmList'></cartBtmList> | 
					
						
							|  |  |  |     </u-popup> | 
					
						
							|  |  |  |   </view> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | import { mapGetters } from 'vuex' | 
					
						
							|  |  |  | import cartBtmList from '@/components/cartBtmList.vue' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export default { | 
					
						
							|  |  |  |   components: { | 
					
						
							|  |  |  |     cartBtmList, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   data() { | 
					
						
							|  |  |  |     return { | 
					
						
							|  |  |  |       downShow: false, | 
					
						
							|  |  |  |       img1: require('@/static/images/cartBall1.png'), | 
					
						
							|  |  |  |       img2: require('@/static/images/cartBall.png'), | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   computed: { | 
					
						
							|  |  |  |     ...mapGetters(['smallCarLength']), | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   watch: { | 
					
						
							|  |  |  |     carLength(n, o) { | 
					
						
							|  |  |  |       this.smallCarLength = n | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   props: { | 
					
						
							|  |  |  |     carLength: { | 
					
						
							|  |  |  |       type: Number | String, | 
					
						
							|  |  |  |       default: 0, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     specialArea: { | 
					
						
							|  |  |  |       type: Number | String, | 
					
						
							|  |  |  |       default: 1, | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   mounted() { | 
					
						
							|  |  |  |     this.$store.dispatch('getCarLength', this.specialArea) | 
					
						
							|  |  |  |     // .then((res) => {
 | 
					
						
							|  |  |  |     //   this.smallCarLength = res.data.smallCount
 | 
					
						
							|  |  |  |     // })
 | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   methods: { | 
					
						
							|  |  |  |     close() { | 
					
						
							|  |  |  |       this.downShow = false | 
					
						
							|  |  |  |       this.getCar() | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     getCar() { | 
					
						
							|  |  |  |       this.$store.dispatch('getCarLength', this.specialArea) | 
					
						
							|  |  |  |       // .then((res) => {
 | 
					
						
							|  |  |  |       //   this.smallCarLength = res.data.smallCount
 | 
					
						
							|  |  |  |       // })
 | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     goCart() { | 
					
						
							|  |  |  |       this.downShow = true | 
					
						
							|  |  |  |       this.$nextTick(() => { | 
					
						
							|  |  |  |         this.$refs.cartBtmList.getCarList(this.specialArea) | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |       // uni.switchTab({ url: '/pages/shoppingCar/index' })
 | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style lang="scss" scoped> | 
					
						
							|  |  |  | .title { | 
					
						
							|  |  |  |   font-size: 40rpx; | 
					
						
							|  |  |  |   text-align: center; | 
					
						
							|  |  |  |   margin: 20rpx auto; | 
					
						
							|  |  |  |   color: #333; | 
					
						
							|  |  |  |   font-weight: bold; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | .quan { | 
					
						
							|  |  |  |   position: absolute; | 
					
						
							|  |  |  |   right: 24rpx; | 
					
						
							|  |  |  |   bottom: 33%; | 
					
						
							|  |  |  |   background: #fff; | 
					
						
							|  |  |  |   border-radius: 50%; | 
					
						
							|  |  |  |   box-shadow: 0px 2px 20px 0px rgba(204, 204, 204, 1); | 
					
						
							|  |  |  |   width: 100rpx; | 
					
						
							|  |  |  |   height: 100rpx; | 
					
						
							|  |  |  |   display: flex; | 
					
						
							|  |  |  |   justify-content: center; | 
					
						
							|  |  |  |   align-items: center; | 
					
						
							|  |  |  |   z-index: 10; | 
					
						
							|  |  |  |   img { | 
					
						
							|  |  |  |     width: 60rpx; | 
					
						
							|  |  |  |     height: 60rpx; | 
					
						
							|  |  |  |     position: relative; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   .qiu { | 
					
						
							|  |  |  |     position: absolute; | 
					
						
							|  |  |  |     width: 30rpx; | 
					
						
							|  |  |  |     height: 30rpx; | 
					
						
							|  |  |  |     background: #e03030; | 
					
						
							|  |  |  |     border-radius: 50%; | 
					
						
							|  |  |  |     color: #fff; | 
					
						
							|  |  |  |     text-align: center; | 
					
						
							|  |  |  |     line-height: 30rpx; | 
					
						
							|  |  |  |     right: 0; | 
					
						
							|  |  |  |     top: -10rpx; | 
					
						
							|  |  |  |     font-size: 10px; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | ::v-deep .u-popup__content { | 
					
						
							|  |  |  |   overflow: hidden; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | </style> |