|
|
@@ -1,21 +1,21 @@
|
|
|
<template>
|
|
|
<view class="item-cmd_bx">
|
|
|
<view class="img_bx">
|
|
|
- <app-img :src="info.cover" alt="商品图" mode="aspectFit" :height="160" />
|
|
|
+ <app-img @click="addEvent" :src="info.cover" alt="商品图" mode="aspectFit" :height="160" />
|
|
|
</view>
|
|
|
<view class="cmd-info_bx">
|
|
|
- <view class="tit">{{ info.itemName || "" }}</view>
|
|
|
- <view class="kc">库存 {{ info.stock }}</view>
|
|
|
+ <view class="tit" @click="addEvent">{{ info.itemName || "" }}</view>
|
|
|
+ <view class="kc" @click="addEvent">库存 {{ info.stock }}</view>
|
|
|
<view class="num-open_bx">
|
|
|
<view class="price">¥{{ showPrice }}</view>
|
|
|
<view class="open-bx" v-if="type == COMMODITY_TYPE.COMMON">
|
|
|
- <i class="iconfont iconjian" @click="delEvent" v-if="bigCount > 0 || smallCount > 0"></i>
|
|
|
- <text class="num" @click="customNum" v-if="bigCount > 0 || smallCount > 0">
|
|
|
+ <i class="iconfont iconjian" :class="delAnimationData?'animation':''"@click="delEvent" v-if="bigCount > 0 || smallCount > 0"></i>
|
|
|
+ <text class="num" @click="customNum">
|
|
|
<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" @click="addEvent"></i>
|
|
|
+ <i class="iconfont iconzeng" :class="addAnimationData?'animation':''" @click="addEvent"></i>
|
|
|
</view>
|
|
|
<view class="open-bx" v-else-if="type == COMMODITY_TYPE.CHANGE">
|
|
|
<input class="change-input" v-model="changeAutoPrice" type="digit" placeholder="自动调价" selection-start="0" selection-end="1" />
|
|
|
@@ -32,12 +32,13 @@ import { COMMODITY_TYPE } from "@/utils/declare";
|
|
|
import AppImg from "@/components/app-img";
|
|
|
import { autoPriceByIdApi, changePriceByIdApi } from '@/api/product/index'
|
|
|
import productMins from "@/mixins/productContrapose";
|
|
|
+import animationMins from "@/mixins/animation";
|
|
|
export default {
|
|
|
name: "Commodity",
|
|
|
components: {
|
|
|
AppImg
|
|
|
},
|
|
|
- mixins: [productMins],
|
|
|
+ mixins: [productMins,animationMins],
|
|
|
props: {
|
|
|
info: {
|
|
|
required: true,
|
|
|
@@ -58,7 +59,7 @@ export default {
|
|
|
type: Number,
|
|
|
default: 0
|
|
|
},
|
|
|
- autoPrice: {}
|
|
|
+ autoPrice: {},
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -78,15 +79,17 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
addEvent() {
|
|
|
- let params = {
|
|
|
- ...this.info,
|
|
|
- bigCount: this.bigCount,
|
|
|
- smallCount: this.smallCount
|
|
|
- };
|
|
|
- this.$emit("add", this.info,params);
|
|
|
- // this.$emit("add", 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');
|
|
|
this.$emit("del", this.info);
|
|
|
},
|
|
|
async changePriceEvent(event) {
|
|
|
@@ -107,6 +110,15 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
customNum() {
|
|
|
+ console.log(this.info)
|
|
|
+ if(!this.info.bigCount){
|
|
|
+ let params = {
|
|
|
+ ...this.info,
|
|
|
+ bigCount: this.bigCount,
|
|
|
+ smallCount: this.smallCount
|
|
|
+ };
|
|
|
+ this.$emit("addOneEvent", this.info,params);
|
|
|
+ }
|
|
|
this.$emit("customNum", {
|
|
|
...this.info,
|
|
|
bigCount: this.bigCount,
|
|
|
@@ -157,6 +169,7 @@ export default {
|
|
|
color: #3385ff;
|
|
|
font-size: 42px;
|
|
|
}
|
|
|
+
|
|
|
.position{
|
|
|
display: block;
|
|
|
width: 70rpx;
|
|
|
@@ -204,4 +217,5 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
</style>
|