|
@@ -24,13 +24,16 @@
|
|
|
<view class="open-bx" v-else-if="type == COMMODITY_TYPE.CHANGE">
|
|
<view class="open-bx" v-else-if="type == COMMODITY_TYPE.CHANGE">
|
|
|
<input
|
|
<input
|
|
|
class="change-input"
|
|
class="change-input"
|
|
|
- :value="autoPrice"
|
|
|
|
|
|
|
+ v-model="changeAutoPrice"
|
|
|
type="digit"
|
|
type="digit"
|
|
|
placeholder="自动调价"
|
|
placeholder="自动调价"
|
|
|
- @change="changePriceEvent"
|
|
|
|
|
/>
|
|
/>
|
|
|
- <i class="iconfont iconcachu edit" v-if="info.priceLabel==2" @click="removeEvent"></i>
|
|
|
|
|
- <i class="iconfont iconcachu" v-else></i>
|
|
|
|
|
|
|
+ <!--@change="changePriceEvent"-->
|
|
|
|
|
+ <i class="iconfont iconjihuo" v-if="isShowSucceed"></i>
|
|
|
|
|
+ <view class="btn-box" v-if="changeAutoPrice==''" @click="removeEvent">确定</view>
|
|
|
|
|
+ <view class="btn-box" v-else @click="changePriceEvent">确定</view>
|
|
|
|
|
+ <!--<i class="iconfont iconcachu edit" v-if="info.priceLabel==2" @click="removeEvent"></i>-->
|
|
|
|
|
+ <!--<i class="iconfont iconcachu" v-else></i>-->
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
@@ -40,6 +43,7 @@
|
|
|
<script>
|
|
<script>
|
|
|
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'
|
|
|
export default {
|
|
export default {
|
|
|
name: "Commodity",
|
|
name: "Commodity",
|
|
|
components: {
|
|
components: {
|
|
@@ -65,11 +69,13 @@ export default {
|
|
|
type: Number,
|
|
type: Number,
|
|
|
default: 0
|
|
default: 0
|
|
|
},
|
|
},
|
|
|
- autoPrice: {}
|
|
|
|
|
|
|
+ // autoPrice: {}
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
|
- COMMODITY_TYPE
|
|
|
|
|
|
|
+ COMMODITY_TYPE,
|
|
|
|
|
+ isShowSucceed:false,
|
|
|
|
|
+ changeAutoPrice:'',
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
created() {},
|
|
created() {},
|
|
@@ -81,14 +87,45 @@ export default {
|
|
|
this.$emit("del", this.info);
|
|
this.$emit("del", this.info);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- removeEvent() {
|
|
|
|
|
|
|
+ async removeEvent() {
|
|
|
|
|
+ // if (this.info.priceLabel != '2') {
|
|
|
|
|
+ // throw new Error('改价的商品才能清除')
|
|
|
|
|
+ // }
|
|
|
|
|
+ await autoPriceByIdApi({productId: this.info.id})
|
|
|
|
|
+ this.isShowSucceed = true;
|
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
|
+ this.isShowSucceed = false
|
|
|
|
|
+ this.changeAutoPrice = '';
|
|
|
|
|
+ // this.autoPrice = '';
|
|
|
|
|
+ },2000)
|
|
|
this.$emit("remove", this.info);
|
|
this.$emit("remove", this.info);
|
|
|
},
|
|
},
|
|
|
- changePriceEvent(event) {
|
|
|
|
|
- const {
|
|
|
|
|
- detail: { value }
|
|
|
|
|
- } = event;
|
|
|
|
|
- this.$emit("changePrice", this.info, value);
|
|
|
|
|
|
|
+ changePrice(event){
|
|
|
|
|
+ // const {
|
|
|
|
|
+ // detail: { value }
|
|
|
|
|
+ // } = event;
|
|
|
|
|
+ this.changeAutoPrice = event.detail.value
|
|
|
|
|
+ },
|
|
|
|
|
+ async changePriceEvent(event) {
|
|
|
|
|
+ // const {
|
|
|
|
|
+ // detail: { value }
|
|
|
|
|
+ // } = event;
|
|
|
|
|
+ // console.log('this.changeAutoPrice',this.changeAutoPrice)
|
|
|
|
|
+ // if(this.changeAutoPrice==null||this.changeAutoPrice==0){
|
|
|
|
|
+ // uni.showToast({title: '请输入正确的价格',icon: 'none'});
|
|
|
|
|
+ // return
|
|
|
|
|
+ // }
|
|
|
|
|
+ await changePriceByIdApi({
|
|
|
|
|
+ productId: this.info.id,
|
|
|
|
|
+ price: this.changeAutoPrice
|
|
|
|
|
+ })
|
|
|
|
|
+ this.isShowSucceed = true;
|
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
|
+ this.isShowSucceed = false
|
|
|
|
|
+ this.changeAutoPrice = '';
|
|
|
|
|
+ // this.autoPrice = '';
|
|
|
|
|
+ },2000)
|
|
|
|
|
+ this.$emit("changePrice", this.info, this.changeAutoPrice);
|
|
|
},
|
|
},
|
|
|
customNum() {
|
|
customNum() {
|
|
|
this.$emit("customNum", {
|
|
this.$emit("customNum", {
|
|
@@ -137,8 +174,9 @@ export default {
|
|
|
display: flex;
|
|
display: flex;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
& .iconfont {
|
|
& .iconfont {
|
|
|
|
|
+ margin-left: 15rpx;
|
|
|
color: #3385ff;
|
|
color: #3385ff;
|
|
|
- font-size: 50px;
|
|
|
|
|
|
|
+ font-size: 30px;
|
|
|
}
|
|
}
|
|
|
.iconcachu {
|
|
.iconcachu {
|
|
|
margin: 0 6px 0 20px;
|
|
margin: 0 6px 0 20px;
|
|
@@ -168,6 +206,16 @@ export default {
|
|
|
border-radius: 4px;
|
|
border-radius: 4px;
|
|
|
font-size: 28px;
|
|
font-size: 28px;
|
|
|
}
|
|
}
|
|
|
|
|
+ .btn-box{
|
|
|
|
|
+ width: 100rpx;
|
|
|
|
|
+ height: 60rpx;
|
|
|
|
|
+ margin-left: 15rpx;
|
|
|
|
|
+ line-height: 60rpx;
|
|
|
|
|
+ color: #ffffff;
|
|
|
|
|
+ background: #3385ff;
|
|
|
|
|
+ text-align: center;
|
|
|
|
|
+ border-radius: 10rpx;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|