123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- <template>
- <view class="product-item">
- <view>
- <u-image :src="item.productImage+'?x-oss-process=image/resize,p_30'" height="140px" width="100%"></u-image>
- <view class="back-price" v-if="item.promoRuleValue">返<text>{{item.promoRuleValue}}</text>元</view>
- <view class="product-code ellipsis-one">{{item.productCode}}</view>
- </view>
- <view>
- <view class="product-name ellipsis-two">{{item.productName}}</view>
- <view class="product-guige ellipsis-two">{{item.productOrigCode}}</view>
- <view class="product-button">
- <view class="price-txt">¥<text>{{item.cost}}</text></view>
- <view>
- <u-button v-if="!checked" @click="addToCat(item)" :throttle-time="50" size="mini" type="primary" shape="circle"><u-icon name="plus"></u-icon></u-button>
- <u-button v-else :throttle-time="50" @click="addToCat(item)" size="mini" type="success" shape="circle"><u-icon name="plus"></u-icon>{{item.qty}}</u-button>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'productItem',
- props: {
- item: {
- type: Object,
- default: () => ({})
- },
- checked:{
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
-
- }
- },
- methods: {
- addToCat(item){
- this.$emit('chooseProduct',item)
- }
- },
- }
- </script>
- <style lang="less">
- .product-item{
- background: #ffffff;
- border-radius: 10upx;
- box-shadow: 1px 1px 3px #EEEEEE;
- height: 100%;
- display: flex;
- flex-direction: column;
- > view{
- &:first-child{
- position: relative;
- overflow: hidden;
- border-bottom: 1px solid #eee;
- .product-code{
- color: #666;
- position: absolute;
- width: 100%;
- left:0;
- bottom:0;
- background: rgba(255,255,255,0.7);
- text-align: center;
- }
- }
- &:last-child{
- padding: 20rpx 20rpx 70rpx 20rpx;
- position: relative;
- flex-grow: 1;
- .product-name{
- font-size: 28rpx;
- font-weight: 900;
- color: #666;
- }
- .product-guige{
- margin: 10rpx 0 20rpx 0;
- color: #2196F3;
- text{
- margin-right: 10rpx;
- }
- }
- }
- .product-button{
- display: flex;
- justify-content: space-between;
- align-items: center;
- position: absolute;
- bottom: 20rpx;
- left: 0;
- width: 100%;
- padding: 0 20rpx;
- }
- .cart-add{
- padding: 6rpx 15rpx;
- border-radius: 30rpx;
- background: #2196F3;
- color: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 24rpx;
- }
- .colr-add{
- background: #2196F3;
- padding: 10rpx 20rpx;
- }
- .colr-checks{
- background: #00aa00;
- }
- }
- }
- </style>
|