| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 | 
							- <template>
 
- 	<view class="item" @click="showProduct()">
 
- 		<view class="img-box">
 
- 			<image :src="item.image" mode="aspectFill"></image>
 
- 			<view class="otctxt" v-show="item.productType" :style="{background:_background(item.productType)}">{{$getDictLabelName("storeProductType",item.productType)}}</view>
 
- 		</view>
 
- 		<view class="info-box">
 
- 			<view class="title ellipsis2">{{item.productName}}</view>
 
- 			<view class="price-box x-bc">
 
- 				<view>
 
- 					<text class="price-box-unit">¥</text>
 
- 					<text class="price-box-integer">{{splitPrice(item.price || 0).intPart}}</text>
 
- 					<text class="price-box-decimal">.{{splitPrice(item.price || 0).decPart}}</text>
 
- 					<!-- <text class="price-box-text">/日</text> -->
 
- 					<!-- <text class="old" v-show="item.price!=item.otPrice&&item.otPrice!==null&&item.otPrice!==undefined">¥{{item.otPrice.toFixed(2)}}</text> -->
 
- 				</view>
 
- 			</view>
 
- 		</view>
 
- 	</view>
 
- </template>
 
- <script>
 
- 	export default {
 
- 		props: ['item','storeId'],
 
- 		data() {
 
- 			return {
 
- 				
 
- 			}
 
- 		},
 
- 		computed: {
 
- 			_background() {
 
- 				//productType: 1:OTC,2:Rx,3:非药品,4:器械
 
- 				return (productType)=> {
 
- 					switch (productType) {
 
- 						case 1: return '#37E2EA' // OTC
 
- 						case 2: return 'red'     // Rx
 
- 						case 3: return '#2583EB' // 非药品
 
- 						case 4: return '#999'    // 器械
 
- 						default: return '#ccc'
 
- 					}
 
- 				}
 
- 			}
 
- 		},
 
- 		methods: {
 
- 			splitPrice(num) {
 
- 			  const [intPart = '0', decPart = '00'] = String(num||0).split('.');
 
- 			  return { intPart, decPart: decPart.padEnd(2, '0').slice(0, 2) };
 
- 			},
 
- 			showProduct() {
 
- 				uni.navigateTo({
 
- 					url: '/pages_shopping/productDetails?productId=' + this.item.productId+'&storeId='+this.storeId || ''
 
- 				})
 
- 			},
 
- 		}
 
- 	}
 
- </script>
 
- <style scoped lang="scss">
 
- 	.otctxt {
 
- 		position: absolute;
 
- 		top: 0;
 
- 		left: 0;
 
- 		background-color: #37E2EA;
 
- 		font-family: PingFang SC, PingFang SC;
 
- 		font-weight: 500;
 
- 		font-size: 20rpx;
 
- 		color: #FFFFFF;
 
- 		padding: 4rpx 14rpx;
 
- 		border-radius: 16rpx 0 16rpx 0;
 
- 	}
 
- 	.price-box {
 
- 		font-family: Roboto, Roboto;
 
- 		font-weight: bold;
 
- 		font-size: 36rpx;
 
- 		color: #FF5C03;
 
- 	
 
- 		&-unit {
 
- 			font-weight: 600;
 
- 			font-size: 26rpx;
 
- 		}
 
- 	
 
- 		&-decimal {
 
- 			font-weight: 600;
 
- 			font-size: 26rpx;
 
- 		}
 
- 	
 
- 		&-text {
 
- 			font-family: PingFang SC, PingFang SC;
 
- 			font-weight: 500;
 
- 			font-size: 26rpx;
 
- 		}
 
- 	}
 
- 	.item{
 
- 		margin-right: 20rpx;
 
- 		margin-bottom: 20rpx;
 
- 		width: 235rpx;
 
- 		background: #FFFFFF;
 
- 		box-shadow: 0px 0px 10rpx 4rpx rgba(199, 199, 199, 0.22);
 
- 		border-radius: 20rpx;
 
- 		overflow: hidden;
 
- 		&:nth-child(2n) {
 
- 			margin-right: 0;
 
- 		}
 
- 		.img-box{
 
- 			width: 100%;
 
- 			height: 235rpx;
 
- 			position: relative;
 
- 			image{
 
- 				width: 100%;
 
- 				height: 100%;
 
- 			}
 
- 		}
 
- 		.info-box{
 
- 			box-sizing: border-box;
 
- 			// height: 182rpx;
 
- 			padding: 12rpx 20rpx;
 
- 			display: flex;
 
- 			flex-direction: column;
 
- 			justify-content: space-between;
 
- 			.title{
 
- 				font-size: 26rpx;
 
- 				font-family: PingFang SC;
 
- 				font-weight: 500;
 
- 				color: #111111;
 
- 				line-height: 40rpx;
 
- 				height: 80rpx;
 
- 			}
 
- 			.price-box{
 
- 				display: flex;
 
- 				align-items: flex-end;
 
- 				.now{
 
- 					display: flex;
 
- 					align-items: flex-end;
 
- 					margin-right: 20rpx;
 
- 					.unit{
 
- 						font-size: 24rpx;
 
- 						font-family: PingFang SC;
 
- 						font-weight: 500;
 
- 						color: #FF6633;
 
- 						line-height: 1.2;
 
- 						margin-right: 4rpx;
 
- 					}
 
- 					.num{
 
- 						font-size: 36rpx;
 
- 						font-family: PingFang SC;
 
- 						font-weight: bold;
 
- 						color: #FF6633;
 
- 						line-height: 1;
 
- 					}
 
- 				}
 
- 				.old{
 
- 					font-size: 26rpx;
 
- 					font-family: PingFang SC;
 
- 					font-weight: 500;
 
- 					text-decoration: line-through;
 
- 					color: #BBBBBB;
 
- 					line-height: 1.1;
 
- 				}
 
- 			}
 
- 		}
 
- 	}
 
- </style>
 
 
  |