|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <view class="item-cmd_bx" @click="customNum">
|
|
|
|
|
|
|
+ <view class="item-cmd_bx" @click="customNum(info.variety)">
|
|
|
<view class="img_bx" style="background:#eeeeee" @click.stop="showBigImg">
|
|
<view class="img_bx" style="background:#eeeeee" @click.stop="showBigImg">
|
|
|
<image :src="info.cover" v-if="isImg"></image>
|
|
<image :src="info.cover" v-if="isImg"></image>
|
|
|
</view>
|
|
</view>
|
|
@@ -16,19 +16,17 @@
|
|
|
<view v-if="Number(info.discountPrice)>0" class="price" >¥{{ info.discountPrice }}</view>
|
|
<view v-if="Number(info.discountPrice)>0" class="price" >¥{{ info.discountPrice }}</view>
|
|
|
<view v-else class="price" >¥{{ info.price }}</view>
|
|
<view v-else class="price" >¥{{ info.price }}</view>
|
|
|
</view>
|
|
</view>
|
|
|
-
|
|
|
|
|
<view class="price" v-else></view>
|
|
<view class="price" v-else></view>
|
|
|
<view style="text-align: right" >
|
|
<view style="text-align: right" >
|
|
|
<view class="open-bx" >
|
|
<view class="open-bx" >
|
|
|
- <i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click.stop="delEvent" v-if="bigCount > 0 || smallCount > 0"></i>
|
|
|
|
|
- <text class="num" @click.stop="customNum">
|
|
|
|
|
|
|
+ <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="bigCount > 0 || smallCount > 0">{{ `${bigCount}` }}</text>
|
|
|
<text v-if="smallCount > 0">/</text>
|
|
<text v-if="smallCount > 0">/</text>
|
|
|
<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
|
|
<text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
|
|
|
</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>
|
|
</view>
|
|
|
- <text style="padding-right: 55rpx">还剩 {{ info.stock > showMaxStock ? showMaxStock : info.stock }}</text>
|
|
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="num-open_bx flex-space" v-if="type == COMMODITY_TYPE.CHANGE">
|
|
<view class="num-open_bx flex-space" v-if="type == COMMODITY_TYPE.CHANGE">
|
|
@@ -39,7 +37,6 @@
|
|
|
<allSelectInput :inputType="'digit'" :isActive="isAloneAllActive" :isFocus="isAloneAllFocus" :value="changeAutoPrice" :placeholder="'自动调价'"
|
|
<allSelectInput :inputType="'digit'" :isActive="isAloneAllActive" :isFocus="isAloneAllFocus" :value="changeAutoPrice" :placeholder="'自动调价'"
|
|
|
@deleteInputVal="deleteInputVal" @initAllInput="initAloneAllInput" @moveAllInput="moveAllInput">
|
|
@deleteInputVal="deleteInputVal" @initAllInput="initAloneAllInput" @moveAllInput="moveAllInput">
|
|
|
</allSelectInput>
|
|
</allSelectInput>
|
|
|
- <!--<input class="change-input" v-model="changeAutoPrice" type="digit" placeholder="自动调价" selection-start="0" selection-end="1" />-->
|
|
|
|
|
<i :class="isShowSucceed?'position iconfont iconjihuo':'position'" ></i>
|
|
<i :class="isShowSucceed?'position iconfont iconjihuo':'position'" ></i>
|
|
|
<view class="btn-box" @click="changePriceEvent">确定</view>
|
|
<view class="btn-box" @click="changePriceEvent">确定</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -52,18 +49,13 @@
|
|
|
import { COMMODITY_TYPE } from "@/utils/declare";
|
|
import { COMMODITY_TYPE } from "@/utils/declare";
|
|
|
import AppImg from "@/components/app-img";
|
|
import AppImg from "@/components/app-img";
|
|
|
import { autoPriceByIdApi, changePriceByIdApi } from '@/api/product/index'
|
|
import { autoPriceByIdApi, changePriceByIdApi } from '@/api/product/index'
|
|
|
-// import productMins from "@/mixins/productContrapose";
|
|
|
|
|
import animationMins from "@/mixins/animation";
|
|
import animationMins from "@/mixins/animation";
|
|
|
-
|
|
|
|
|
import allSelectInput from "@/components/module/allSelectInput";
|
|
import allSelectInput from "@/components/module/allSelectInput";
|
|
|
import allSelectInputMins from "@/mixins/allSelectInput";
|
|
import allSelectInputMins from "@/mixins/allSelectInput";
|
|
|
-//报错暂时注释
|
|
|
|
|
-//import easyLoadimage from '@/components/easy-loadimage/easy-loadimage.vue'
|
|
|
|
|
export default {
|
|
export default {
|
|
|
name: "Commodity",
|
|
name: "Commodity",
|
|
|
components: {
|
|
components: {
|
|
|
AppImg,allSelectInput
|
|
AppImg,allSelectInput
|
|
|
- //easyLoadimage
|
|
|
|
|
},
|
|
},
|
|
|
mixins: [animationMins,allSelectInputMins],
|
|
mixins: [animationMins,allSelectInputMins],
|
|
|
props: {
|
|
props: {
|
|
@@ -158,51 +150,64 @@ export default {
|
|
|
showBigImg(){
|
|
showBigImg(){
|
|
|
this.$emit("showBigCover", this.info);
|
|
this.$emit("showBigCover", this.info);
|
|
|
},
|
|
},
|
|
|
- addEvents() {
|
|
|
|
|
- const ratio = Number(this.info.ratio);
|
|
|
|
|
- if(this.offVerifyRepertory){
|
|
|
|
|
- if(this.info.stock<=0){uni.showToast({title:'库存不足',icon:'none'});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){
|
|
|
|
|
+ uni.showToast({title:'没有货了',icon:'none'})
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Number(this.bigCount) * ratio + Number(this.smallCount) >Number(this.info.bigNum) * ratio + Number(this.info.smallNum)) {
|
|
|
|
|
+ this.$msg("库存只剩"+this.info.bigNum);
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ this.animationFun('add');
|
|
|
|
|
+ this.$emit("add", this.info);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //去特殊品种页
|
|
|
|
|
+ this.$emit("goToSpecialVariety", this.info);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- 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');
|
|
|
|
|
- console.log(this.info,'this.info')
|
|
|
|
|
- this.$emit("del", this.info);
|
|
|
|
|
|
|
+ delEvent(variety) {
|
|
|
|
|
+ if(variety == 0){
|
|
|
|
|
+ this.animationFun('del');
|
|
|
|
|
+ console.log(this.info,'this.info')
|
|
|
|
|
+ this.$emit("del", this.info);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //去特殊品种页
|
|
|
|
|
+ this.$emit("goToSpecialVariety", this.info);
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
changePriceEvent(event) {
|
|
changePriceEvent(event) {
|
|
|
this.isFocus = false;
|
|
this.isFocus = false;
|
|
|
this.isAlterMoney = true;
|
|
this.isAlterMoney = true;
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
- customNum() {
|
|
|
|
|
- if(this.info.stock<=0){uni.showToast({title:'库存不足',icon:'none'});return;}
|
|
|
|
|
- // if(!this.info.bigCount){
|
|
|
|
|
- if(!this.bigCount && !this.smallCount){
|
|
|
|
|
- let params = {
|
|
|
|
|
|
|
+ customNum(variety) {
|
|
|
|
|
+ if(variety == 0){
|
|
|
|
|
+ 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
|
|
|
|
|
+ };
|
|
|
|
|
+ this.$emit("addOneEvent", this.info,params);
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$emit("customNum", {
|
|
|
...this.info,
|
|
...this.info,
|
|
|
bigCount: this.bigCount,
|
|
bigCount: this.bigCount,
|
|
|
smallCount: this.smallCount
|
|
smallCount: this.smallCount
|
|
|
- };
|
|
|
|
|
- this.$emit("addOneEvent", this.info,params);
|
|
|
|
|
|
|
+ });
|
|
|
|
|
+ }else{
|
|
|
|
|
+ //去特殊品种页
|
|
|
|
|
+ this.$emit("goToSpecialVariety", this.info);
|
|
|
}
|
|
}
|
|
|
- this.$emit("customNum", {
|
|
|
|
|
- ...this.info,
|
|
|
|
|
- bigCount: this.bigCount,
|
|
|
|
|
- smallCount: this.smallCount
|
|
|
|
|
- });
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
@@ -307,5 +312,4 @@ export default {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
</style>
|
|
</style>
|