| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  | <template> | 
					
						
							| 
									
										
										
										
											2025-04-28 11:00:10 +08:00
										 |  |  |   <view class="area-product-list" :class="sizeClass"> | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |     <view class="area-header"> | 
					
						
							|  |  |  |       <view class="header-bg"></view> | 
					
						
							|  |  |  |       <text class="area-title">{{ title }}</text> | 
					
						
							|  |  |  |       <u-button | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |         v-if="list.length > 0" | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |         type="primary" | 
					
						
							|  |  |  |         size="mini" | 
					
						
							|  |  |  |         shape="circle" | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |         :custom-style="{ | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |           background: '#ffffff', | 
					
						
							|  |  |  |           border: 'none', | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |           position: 'relative', | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |           zIndex: 1, | 
					
						
							|  |  |  |           height: '46rpx', | 
					
						
							|  |  |  |           lineHeight: '46rpx', | 
					
						
							|  |  |  |           width: 'fit-content', | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |           padding: '0 12rpx', | 
					
						
							|  |  |  |           margin: '0', | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |         }" | 
					
						
							|  |  |  |         @click="goToMore" | 
					
						
							|  |  |  |       > | 
					
						
							|  |  |  |         <view class="more-btn-content"> | 
					
						
							|  |  |  |           <text class="more-text">更多</text> | 
					
						
							|  |  |  |           <u-icon name="arrow-right" color="#005bac" size="14"></u-icon> | 
					
						
							|  |  |  |         </view> | 
					
						
							|  |  |  |       </u-button> | 
					
						
							|  |  |  |     </view> | 
					
						
							|  |  |  |     <view class="product-container"> | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |       <view | 
					
						
							|  |  |  |         class="product-item" | 
					
						
							|  |  |  |         v-for="item in list" | 
					
						
							|  |  |  |         :key="item.pkWares" | 
					
						
							|  |  |  |         @click="handleProductClick(item)" | 
					
						
							|  |  |  |       > | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |         <image :src="item.cover1" class="product-image" mode="aspectFill" /> | 
					
						
							|  |  |  |         <view class="product-info"> | 
					
						
							| 
									
										
										
										
											2025-04-27 14:05:28 +08:00
										 |  |  |           <view class="product-name">{{ item.waresName }}</view> | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |           <view class="product-price-row"> | 
					
						
							|  |  |  |             <view class="product-price"> | 
					
						
							| 
									
										
										
										
											2025-05-28 15:10:50 +08:00
										 |  |  |               {{ formatCurrency(item.waresPrice) }} | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |             </view> | 
					
						
							|  |  |  |             <u-button | 
					
						
							| 
									
										
										
										
											2025-04-27 14:05:28 +08:00
										 |  |  |               v-if="false" | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |               type="primary" | 
					
						
							|  |  |  |               size="mini" | 
					
						
							|  |  |  |               shape="circle" | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |               :custom-style="{ | 
					
						
							|  |  |  |                 background: '#005bac', | 
					
						
							|  |  |  |                 margin: '0px', | 
					
						
							|  |  |  |                 width: '48rpx', | 
					
						
							|  |  |  |                 height: '48rpx', | 
					
						
							|  |  |  |                 minWidth: '48rpx', | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |               }" | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |               @click.native.stop="handleAddToCart(item)" | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |             > | 
					
						
							|  |  |  |               <u-icon name="plus" color="#ffffff" size="12"></u-icon> | 
					
						
							|  |  |  |             </u-button> | 
					
						
							|  |  |  |           </view> | 
					
						
							|  |  |  |         </view> | 
					
						
							|  |  |  |       </view> | 
					
						
							|  |  |  |     </view> | 
					
						
							|  |  |  |   </view> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | import { numberToCurrencyNo, isLocal, isLocaled } from '@/util/numberToCurrency' | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  | import { addShopping } from '@/config/goods' | 
					
						
							| 
									
										
										
										
											2025-05-28 15:10:50 +08:00
										 |  |  | import { formatCurrency } from '@/util/index.js' | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  | export default { | 
					
						
							|  |  |  |   props: { | 
					
						
							|  |  |  |     title: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							| 
									
										
										
										
											2025-04-28 11:00:10 +08:00
										 |  |  |       default: '', | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     list: { | 
					
						
							|  |  |  |       type: Array, | 
					
						
							| 
									
										
										
										
											2025-05-28 15:10:50 +08:00
										 |  |  |       default: () => [], | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     specialAreaId: { | 
					
						
							|  |  |  |       type: [Number, String], | 
					
						
							| 
									
										
										
										
											2025-04-28 11:00:10 +08:00
										 |  |  |       default: '', | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     size: { | 
					
						
							|  |  |  |       type: String, | 
					
						
							|  |  |  |       default: 'normal', // 'normal' or 'small'
 | 
					
						
							| 
									
										
										
										
											2025-05-28 15:10:50 +08:00
										 |  |  |       validator: value => ['normal', 'small'].includes(value), | 
					
						
							| 
									
										
										
										
											2025-04-28 11:00:10 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   computed: { | 
					
						
							|  |  |  |     sizeClass() { | 
					
						
							|  |  |  |       return this.size === 'small' ? 'area-product-list--small' : '' | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |     }, | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   methods: { | 
					
						
							|  |  |  |     isLocaled, | 
					
						
							| 
									
										
										
										
											2025-05-28 15:10:50 +08:00
										 |  |  |     formatCurrency, | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |     formatPrice(price) { | 
					
						
							|  |  |  |       // 使用numberToCurrencyNo和isLocal函数来格式化价格
 | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |       return isLocal(numberToCurrencyNo(price)) | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     goToMore() { | 
					
						
							|  |  |  |       // 跳转到专区详情页面
 | 
					
						
							|  |  |  |       uni.navigateTo({ | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |         url: `/pages/specialArea/index?id=${this.specialAreaId}`, | 
					
						
							|  |  |  |       }) | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     handleProductClick(item) { | 
					
						
							|  |  |  |       // 商品点击事件,可根据需求实现跳转或其他逻辑
 | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |       this.$emit('product-click', item) | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |     }, | 
					
						
							|  |  |  |     handleAddToCart(item) { | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |       const params = { | 
					
						
							|  |  |  |         pkCountry: this.pkCountry, | 
					
						
							|  |  |  |         specialArea: item.specialArea, | 
					
						
							|  |  |  |         number: 1, | 
					
						
							|  |  |  |         waresCode: item.waresCode, | 
					
						
							|  |  |  |         productGroup: item.productGroup, | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       addShopping(params).then(res => { | 
					
						
							|  |  |  |         if (res.code == 200) { | 
					
						
							|  |  |  |           uni.showToast({ | 
					
						
							|  |  |  |             title: '购物车添加成功', | 
					
						
							|  |  |  |             icon: 'success', | 
					
						
							|  |  |  |             mask: true, | 
					
						
							|  |  |  |           }) | 
					
						
							| 
									
										
										
										
											2025-05-28 15:10:50 +08:00
										 |  |  |           this.$store.dispatch('getCarLength') | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style lang="scss" scoped> | 
					
						
							|  |  |  | .area-product-list { | 
					
						
							|  |  |  |   background-color: #ffffff; | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |   padding: 20rpx; | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |   padding-top: 0; | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |   border-radius: 16rpx; | 
					
						
							|  |  |  |   margin-bottom: 24rpx; | 
					
						
							|  |  |  |   position: relative; | 
					
						
							| 
									
										
										
										
											2025-04-28 11:00:10 +08:00
										 |  |  |   transition: all 0.3s ease; // Add transition for smoother size changes
 | 
					
						
							|  |  |  |   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); // 添加阴影效果
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   &--small { | 
					
						
							|  |  |  |     padding: 16rpx; | 
					
						
							|  |  |  |     padding-top: 0; | 
					
						
							|  |  |  |     margin-bottom: 20rpx; | 
					
						
							|  |  |  |     border-radius: 12rpx; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .area-header { | 
					
						
							|  |  |  |       margin-bottom: 20rpx; | 
					
						
							|  |  |  |       padding: 16rpx 0; | 
					
						
							|  |  |  |       height: 40rpx; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .header-bg { | 
					
						
							| 
									
										
										
										
											2025-05-28 15:10:50 +08:00
										 |  |  |       left: -16rpx; | 
					
						
							|  |  |  |       right: -16rpx; | 
					
						
							|  |  |  |       border-top-left-radius: 6px; | 
					
						
							|  |  |  |       border-top-right-radius: 6px; | 
					
						
							| 
									
										
										
										
											2025-04-28 11:00:10 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .area-title { | 
					
						
							|  |  |  |       font-size: 28rpx; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .more-btn-content { | 
					
						
							|  |  |  |       // Adjust button style directly as u-button size='mini' might not be flexible enough
 | 
					
						
							|  |  |  |       :deep(.u-button) { | 
					
						
							|  |  |  |         height: 40rpx !important; | 
					
						
							|  |  |  |         line-height: 40rpx !important; | 
					
						
							|  |  |  |         padding: 0 10rpx !important; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       .more-text { | 
					
						
							|  |  |  |         font-size: 20rpx; | 
					
						
							|  |  |  |         margin-right: 2rpx; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       :deep(.u-icon) { | 
					
						
							|  |  |  |         font-size: 12px !important; // u-icon size might need !important
 | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .product-container { | 
					
						
							|  |  |  |       margin: 0 -8rpx; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .product-item { | 
					
						
							| 
									
										
										
										
											2025-05-28 15:10:50 +08:00
										 |  |  |       padding: 0 8rpx; | 
					
						
							| 
									
										
										
										
											2025-04-28 11:00:10 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .product-image { | 
					
						
							| 
									
										
										
										
											2025-04-28 11:22:00 +08:00
										 |  |  |       width: 180rpx; | 
					
						
							|  |  |  |       height: 180rpx; | 
					
						
							| 
									
										
										
										
											2025-04-28 11:00:10 +08:00
										 |  |  |       border-radius: 6rpx; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .product-info { | 
					
						
							|  |  |  |       margin-top: 10rpx; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .product-name { | 
					
						
							|  |  |  |       font-size: 24rpx; | 
					
						
							|  |  |  |       margin-bottom: 6rpx; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     .product-price-row .product-price { | 
					
						
							|  |  |  |       font-size: 20rpx; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .area-header { | 
					
						
							|  |  |  |   display: flex; | 
					
						
							|  |  |  |   justify-content: space-between; | 
					
						
							|  |  |  |   align-items: center; | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |   margin-bottom: 24rpx; | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |   position: relative; | 
					
						
							|  |  |  |   padding: 20rpx 0; | 
					
						
							|  |  |  |   height: 46rpx; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .header-bg { | 
					
						
							|  |  |  |   position: absolute; | 
					
						
							|  |  |  |   top: 0; | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |   left: -20rpx; | 
					
						
							|  |  |  |   right: -20rpx; | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |   height: 100%; | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |   background: linear-gradient(to bottom, #add8e6, #ffffff); | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |   z-index: 0; | 
					
						
							|  |  |  |   border-top-left-radius: 8px; | 
					
						
							|  |  |  |   border-top-right-radius: 8px; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .area-title { | 
					
						
							|  |  |  |   font-size: 32rpx; | 
					
						
							|  |  |  |   font-weight: bold; | 
					
						
							|  |  |  |   color: #333333; | 
					
						
							|  |  |  |   position: relative; | 
					
						
							|  |  |  |   z-index: 1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .more-btn-content { | 
					
						
							|  |  |  |   display: flex; | 
					
						
							|  |  |  |   align-items: center; | 
					
						
							|  |  |  |   justify-content: center; | 
					
						
							|  |  |  |   height: 100%; | 
					
						
							|  |  |  |   flex-grow: 0; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .more-text { | 
					
						
							|  |  |  |   font-size: 24rpx; | 
					
						
							|  |  |  |   color: #005bac; | 
					
						
							|  |  |  |   margin-right: 4rpx; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .product-container { | 
					
						
							|  |  |  |   display: flex; | 
					
						
							|  |  |  |   flex-wrap: wrap; | 
					
						
							|  |  |  |   margin: 0 -10rpx; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .product-item { | 
					
						
							|  |  |  |   width: 33.33%; | 
					
						
							|  |  |  |   padding: 0 10rpx; | 
					
						
							|  |  |  |   box-sizing: border-box; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .product-image { | 
					
						
							| 
									
										
										
										
											2025-04-28 11:22:00 +08:00
										 |  |  |   width: 200rpx; | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  |   height: 200rpx; | 
					
						
							|  |  |  |   border-radius: 8rpx; | 
					
						
							|  |  |  |   background-color: #f5f5f5; | 
					
						
							| 
									
										
										
										
											2025-04-28 11:22:00 +08:00
										 |  |  |   object-fit: cover; | 
					
						
							|  |  |  |   display: block; | 
					
						
							|  |  |  |   margin: 0 auto; | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .product-info { | 
					
						
							|  |  |  |   margin-top: 12rpx; | 
					
						
							|  |  |  |   position: relative; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .product-name { | 
					
						
							|  |  |  |   font-size: 28rpx; | 
					
						
							|  |  |  |   color: #333; | 
					
						
							|  |  |  |   margin-bottom: 8rpx; | 
					
						
							|  |  |  |   overflow: hidden; | 
					
						
							|  |  |  |   text-overflow: ellipsis; | 
					
						
							|  |  |  |   white-space: nowrap; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | .product-price-row { | 
					
						
							|  |  |  |   display: flex; | 
					
						
							|  |  |  |   justify-content: space-between; | 
					
						
							|  |  |  |   align-items: center; | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |   .product-price { | 
					
						
							|  |  |  |     font-size: 24rpx; | 
					
						
							|  |  |  |     font-weight: bold; | 
					
						
							| 
									
										
										
										
											2025-04-27 16:56:41 +08:00
										 |  |  |     color: #f82c1a; | 
					
						
							| 
									
										
										
										
											2025-04-27 10:59:43 +08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-04-25 18:07:27 +08:00
										 |  |  | } | 
					
						
							|  |  |  | </style> |