|
|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
|
- <view class="item-cmd_bx" @click="customNum">
|
|
|
+ <view class="item-cmd_bx" @click="customNum(info.variety)">
|
|
|
<view class="img_bx" style="background:#eeeeee">
|
|
|
<image :src="info.cover" v-if="isImg"></image>
|
|
|
</view>
|
|
|
@@ -10,13 +10,13 @@
|
|
|
<view class="price csss" v-else>¥{{ info.price }}</view>
|
|
|
<view style="text-align: right" >
|
|
|
<view class="open-bx" >
|
|
|
- <i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click.stop="delEvent" v-if="bigCount > 0 || smallCount > 0"></i>
|
|
|
+ <i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click.stop="delEvent(info.variety)" v-if="bigCount > 0 || smallCount > 0"></i>
|
|
|
<text class="num" >
|
|
|
<text v-if="bigCount > 0 || smallCount > 0">{{ `${bigCount}` }}</text>
|
|
|
<text v-if="smallCount > 0">/</text>
|
|
|
<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
|
|
|
</text>
|
|
|
- <i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click.stop="addEvents"></i>
|
|
|
+ <i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click.stop="addEvents(info.variety)"></i>
|
|
|
</view>
|
|
|
<text v-if="Number(info.stock) > Number(info.stockWarning)" style="padding-right: 55rpx">还剩 {{ info.stock }}</text>
|
|
|
<text v-else style="padding-right: 55rpx;color:red;font-weight:450;">还剩 {{ info.stock }}</text>
|
|
|
@@ -99,13 +99,10 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
COMMODITY_TYPE,
|
|
|
- // isAllActive: false,
|
|
|
- // isAllFocus: false,
|
|
|
isImg:false,
|
|
|
isAlterMoney:false,
|
|
|
isAloneAllActive: false,
|
|
|
isAloneAllFocus: false,
|
|
|
-
|
|
|
isShowSucceed:false,
|
|
|
changeAutoPrice:'',
|
|
|
showPrice:0.00,
|
|
|
@@ -134,12 +131,9 @@ export default {
|
|
|
moveAllInput(e){
|
|
|
this.isAloneAllActive=false;
|
|
|
this.isAloneAllFocus=false;
|
|
|
- // if(e==''){return}
|
|
|
- console.log(e);
|
|
|
this.changeAutoPrice = e?e:0;
|
|
|
if(this.isAlterMoney){
|
|
|
this.isAlterMoney = false;
|
|
|
- // let self = this
|
|
|
changePriceByIdApi({
|
|
|
productId: this.info.id,
|
|
|
price: this.changeAutoPrice
|
|
|
@@ -156,34 +150,34 @@ export default {
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- addEvents() {
|
|
|
- const ratio = Number(this.info.ratio);
|
|
|
- if(this.offVerifyRepertory){
|
|
|
- if(this.info.stock<=0){
|
|
|
- this.$msg("库存不足");
|
|
|
- return
|
|
|
- }
|
|
|
- if (Number(this.bigCount) * ratio + Number(this.smallCount) >Number(this.info.bigNum) * ratio + Number(this.info.smallNum)) {
|
|
|
- this.$msg("库存不足");
|
|
|
- return
|
|
|
+ addEvents(variety) {
|
|
|
+ if(variety == 0){
|
|
|
+ const ratio = Number(this.info.ratio);
|
|
|
+ if(this.offVerifyRepertory){
|
|
|
+ if(this.info.stock<=0){
|
|
|
+ this.$msg("库存不足");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (Number(this.bigCount) * ratio + Number(this.smallCount) >Number(this.info.bigNum) * ratio + Number(this.info.smallNum)) {
|
|
|
+ this.$msg("库存不足");
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
+ this.animationFun('add');
|
|
|
+ this.$emit("add", this.info);
|
|
|
+ }else{
|
|
|
+ this.customNum(variety)
|
|
|
}
|
|
|
-
|
|
|
- this.animationFun('add');
|
|
|
- // let params = {
|
|
|
- // ...this.info,
|
|
|
- // bigCount: this.bigCount,
|
|
|
- // smallCount: this.smallCount
|
|
|
- // };
|
|
|
- // this.$emit("add", this.info,params);
|
|
|
- this.$emit("add", this.info);
|
|
|
},
|
|
|
- delEvent() {
|
|
|
- this.animationFun('del');
|
|
|
- this.$emit("del", this.info);
|
|
|
+ delEvent(variety) {
|
|
|
+ if(variety == 0){
|
|
|
+ this.animationFun('del');
|
|
|
+ this.$emit("del", this.info);
|
|
|
+ }else{
|
|
|
+ this.customNum(variety)
|
|
|
+ }
|
|
|
},
|
|
|
changePriceEvent(event) {
|
|
|
- // console.log('改价',this.changeAutoPrice)
|
|
|
changePriceByIdApi({
|
|
|
productId: this.info.id,
|
|
|
price: this.showPrice
|
|
|
@@ -198,45 +192,36 @@ export default {
|
|
|
this.$msg(res.msg)
|
|
|
}
|
|
|
})
|
|
|
- // this.isFocus = false;
|
|
|
- // this.isAloneAllFocus = false;
|
|
|
this.isAlterMoney = true;
|
|
|
-
|
|
|
- // if(uni.getSystemInfoSync().platform=='android'){return};
|
|
|
- // this.$nextTick(()=>{
|
|
|
- // this.moveAllInput(this.changeAutoPrice);
|
|
|
- // })
|
|
|
-
|
|
|
-
|
|
|
},
|
|
|
- customNum() {
|
|
|
- if(this.offVerifyRepertory){
|
|
|
- if(this.info.stock<=0){
|
|
|
- uni.showToast({title:'库存不足',icon:'none'})
|
|
|
- return;
|
|
|
+ customNum(variety) {
|
|
|
+ if(variety == 0){
|
|
|
+ if(this.offVerifyRepertory){
|
|
|
+ if(this.info.stock<=0){
|
|
|
+ uni.showToast({title:'库存不足',icon:'none'})
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!this.bigCount && !this.smallCount){
|
|
|
+ let params = {
|
|
|
+ ...this.info,
|
|
|
+ bigCount: this.bigCount,
|
|
|
+ smallCount: this.smallCount,
|
|
|
+ userPrice: this.userPrice,
|
|
|
+ };
|
|
|
+ this.$emit("addOneEvent", this.info,params);
|
|
|
+ }else{
|
|
|
+ this.$emit("customNum", {
|
|
|
+ ...this.info,
|
|
|
+ bigCount: this.bigCount,
|
|
|
+ smallCount: this.smallCount,
|
|
|
+ userPrice: this.userPrice,
|
|
|
+ });
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if(!this.bigCount && !this.smallCount){
|
|
|
-
|
|
|
- let params = {
|
|
|
- ...this.info,
|
|
|
- bigCount: this.bigCount,
|
|
|
- smallCount: this.smallCount,
|
|
|
- userPrice: this.userPrice,
|
|
|
- };
|
|
|
-
|
|
|
- this.$emit("addOneEvent", this.info,params);
|
|
|
}else{
|
|
|
- this.$emit("customNum", {
|
|
|
- ...this.info,
|
|
|
- bigCount: this.bigCount,
|
|
|
- smallCount: this.smallCount,
|
|
|
- userPrice: this.userPrice,
|
|
|
- });
|
|
|
+ //去特殊品种页
|
|
|
+ this.$emit("goToSpecialVariety", this.info);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
};
|