123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- <template>
- <block>
- <view class="choose-product-item"
- v-for="(item, dix) in list"
- :key="item.id"
- >
- <view class="choose-product-item-check" @click="checkItem(item)">
- <uni-icons v-if="!item.edit && (!item.status||item.status==0||item.dealerScopeFlag==0)" type="circle-filled" size="24" color="#ccc"></uni-icons>
- <uni-icons v-else :type="item.checked?'checkbox-filled':'circle'" size="24" :color="item.checked?'#dd0000':'#666'"></uni-icons>
- </view>
- <view>
- <view>
- <view class="choose-product-item-img">
- <image mode="aspectFit" :src="item.productImage?item.productImage+'?x-oss-process=image/resize,p_30':'/static/def_imgs.png'" style="width: 100%;height: 100%;"></image>
- <view class="back-price xiajia" v-if="!item.status||item.status==0">下架</view>
- <view class="back-price xiajia" v-else-if="item.dealerScopeFlag==0">售罄</view>
- </view>
- <view class="choose-product-item-info">
- <view class="choose-product-item-left-info-name">
- <text :max-lines="1" overflow="ellipsis">{{item.productName}}</text>
- </view>
- <view class="choose-product-item-left-info-guige">
- <text :max-lines="1" overflow="ellipsis">{{item.productCode}}</text>
- <text :max-lines="2" overflow="ellipsis">{{item.productOrigCode}}</text>
- </view>
- <view class="choose-product-item-left-info-price">
- <view v-if="item.status==1">
- <view class="price-txt">¥<text>{{item.price}}</text></view>
- <view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_VALID'">
- 返<text>{{item.resultValue}}</text>元
- </view>
- <view class="flex align_center rebate-tag" v-if="item.promoType=='BUY_PROD_GIVE_PROD'">
- 买{{item.conditionValue}}赠{{item.resultValue}}
- </view>
- <view class="flex align_center tejia-tag" v-if="item.promoType=='PROMO_PROD'">
- 特价<text>¥{{item.orginPrice}}</text>
- </view>
- </view>
- <view v-else></view>
- <view>
- <view v-if="item.status==1&&item.dealerScopeFlag==1" :style="{opacity:!item.edit?1:0,width:!item.edit?'auto':0}">
- <view class="flex align_center qty-box">
- <view class="qty-btn" @click="changeQty(item.qty-1,item,1)" :class="(item.qty <= 1)?'qty-disabled':''">-</view>
- <view class="qty-num" :style="{width:Number(item.qty).toString().length*8+10+'px'}">
- <input type="number" @input="inputQty(item)" @blur="changeQty(item.qty,item,0)" v-model="item.qty"/>
- </view>
- <view class="qty-btn" @click="changeQty(item.qty+1,item,1)" :class="(item.qty >= 999)?'qty-disabled':''">+</view>
- </view>
- </view>
- <view v-if="!item.edit && (!item.status||item.status==0||item.dealerScopeFlag==0)" class="edit-qty">
- X <text>{{item.qty}}</text>
- </view>
- <view v-if="item.edit" class="edit-qty">
- X <text>{{item.qty}}</text>
- <uni-icons type="minus-filled" size="24" color="#dd0000" @click="remove(item.cartSn)"></uni-icons>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 赠品 -->
- <view class="gift-box" v-if="item.giftQty">
- <view class="choose-product-item-img">
- <image mode="aspectFit" :src="item.productImage?item.productImage+'?x-oss-process=image/resize,p_30':'/static/def_imgs.png'" style="width: 100%;height: 100%;"></image>
- <view class="back-price xiajia" v-if="!item.status||item.status==0">下架</view>
- <view class="back-price xiajia" v-else-if="item.dealerScopeFlag==0">售罄</view>
- </view>
- <view class="choose-product-item-info">
- <view class="choose-product-item-left-info-name flex align_center">
- <view class="flex align_center rebate-tag">赠品</view>
- <text :max-lines="1" overflow="ellipsis">{{item.productName}}</text>
- </view>
- <view class="choose-product-item-left-info-guige">
- <text :max-lines="1" overflow="ellipsis">{{item.productCode}}</text>
- <text :max-lines="1" overflow="ellipsis">{{item.productOrigCode}}</text>
- </view>
- <view class="choose-product-item-left-info-price">
- <view></view>
- <view>
- <view class="edit-qty">
- X <text>{{item.giftQty}}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </block>
- </template>
- <script>
- export default {
- name: 'productItem',
- props: {
- list: {
- type: Array,
- default: () => []
- },
- },
- data() {
- return {
- isChange: false
- }
- },
- methods: {
- inputQty(item){
- this.isChange = true
- },
- changeQty(value,item,type) {
- const max = 999
- const v = value > max ? max : (value==''||value==0?1:value)
- if(type == 0){
- if(!this.isChange){
- return
- }
- this.updateNums(value,item.cartSn)
- this.$nextTick(()=>{
- setTimeout(()=>{
- this.updateNums(v,item.cartSn)
- this.isChange = false
- },100)
- })
- }else{
- if(value<=max && value >= 1){
- this.updateNums(v,item.cartSn)
- }
- }
- },
- updateNums(e, cartSn) {
- this.$emit('changeQty', Number(e), cartSn)
- },
- remove(cartSn){
- this.$emit('remove', [cartSn], false)
- },
- checkItem(item){
- if(item.edit || (item.status==1&&item.dealerScopeFlag==1)){
- this.$emit('check',item.cartSn)
- }
- }
- }
- }
- </script>
- <style lang="less" scoped>
- .qty-box{
- display: flex;
- .qty-btn{
- display: flex;
- align-items: center;
- justify-content: center;
- width: 22px;
- height: 22px;
- border-radius: 50px;
- font-size: 18px;
- background-color: #066cff;
- color: #fff;
- &.qty-disabled{
- background-color: #c0c0c0;
- }
- }
- .qty-num{
- width: 24px;
- height: 22px;
- line-height: 22px;
- padding:0 3px;
- input{
- width: 100%;
- height: 100%;
- text-align: center;
- color: #333;
- }
- }
- }
- .choose-product-item{
- display: flex;
- justify-content: space-between;
- padding: 10px;
- background: #fff;
- margin: 8px 8px 0 8px;
- border-radius: 10px;
- .price-txt{
- color: red;
- display: flex;
- align-items: baseline;
- font-size: 12px;
- text{
- font-size: 32rpx;
- }
- }
- > view{
- &:last-child{
- flex-grow: 1;
- width: 80%;
- >view{
- width: 100%;
- display: flex;
- align-items: center;
- justify-content: space-between;
- }
- }
- }
- .choose-product-item-check{
- padding: 0 10rpx 0 0;
- width: 24px;
- margin-top: 33px;
- }
- .choose-product-item-img{
- margin-right: 20rpx;
- width: 90px;
- height: 90px;
- position: relative;
- overflow: hidden;
- border: 1px solid #eee;
- padding: 3rpx;
- border-radius: 10rpx;
- .back-price{
- zoom: calc(0.8);
- padding: 6rpx 65rpx;
- position: absolute;
- top: 18rpx;
- right: -45rpx;
- z-index: 2;
- font-size: 20rpx;
- text-align: center;
- transform: rotate(40deg);
- display: flex;
- align-items: center;
- text{
- font-size: 28rpx;
- margin: 0 5rpx;
- }
- }
- .xiajia{
- background: #ececec;
- color: #5f5f5f;
- }
- .choose-product-item-left-info-code{
- color: #666;
- position: absolute;
- width: 100%;
- left:0;
- bottom:0;
- background: rgba(255,255,255,0.7);
- text-align: center;
- font-size: 12px;
- }
- }
- .choose-product-item-info{
- width: 70%;
- flex-grow: 1;
- .choose-product-item-left-info-price{
- display: flex;
- align-items:center;
- justify-content: space-between;
- >view{
- display: flex;
- align-items:center;
- }
- .edit-qty{
- display: flex;
- align-items:center;
- justify-content: space-between;
- color: #999;
- font-size: 10px;
- > text{
- color: #666;
- font-size: 14px;
- margin-left: 5px;
- margin-right: 10px;
- }
- }
- }
- .rebate-tag{
- background: #ffe7df;
- color: #E91E63;
- padding: 2px 5px;
- font-size: 10px;
- border-radius: 3px;
- margin-left: 6px;
- }
- .tejia-tag{
- color: #E91E63;
- margin-left: 6px;
- font-size: 10px;
- text{
- font-size: 10px;
- color: #999;
- margin-left: 5px;
- text-decoration: line-through;
- }
- }
- .choose-product-item-left-info-name{
- font-size: 28rpx;
- color: #333;
- }
- .choose-product-item-left-info-guige{
- margin: 10rpx 0;
- font-size: 12px;
- text{
- color: #666;
- &:last-child{
- color: #2196F3;
- }
- }
- }
- }
- .gift-box{
- margin-top: 10px;
- border-top: 1px solid #ececec;
- padding-top: 10px;
- .choose-product-item-img{
- width: 70px;
- height: 70px;
- margin-left: 20px;
- }
- .choose-product-item-info .choose-product-item-left-info-guige{
- margin: 10rpx 0 0 0;
- }
- .choose-product-item-info .choose-product-item-left-info-name{
- font-size: 24rpx;
- .rebate-tag{
- margin: 0 5px 0 2px;
- background: #ff0000;
- color: #fff;
- width: 40px;
- display: flex;
- justify-content: center;
- }
- }
- }
- }
- </style>
|