|
|
@@ -1,55 +1,34 @@
|
|
|
<template>
|
|
|
<view class="item-cmd_bx" @click="changeItemNum(info.variety)">
|
|
|
<view class="img_bx" style="background:#eeeeee">
|
|
|
- <image :src="info.cover" v-if="isImg"></image>
|
|
|
+ <image :src="info.cover"></image>
|
|
|
</view>
|
|
|
<view class="cmd-info_bx">
|
|
|
<view class="tit" >{{ info.itemName || "" }}</view>
|
|
|
- <view class="kc num-open_bx flex-end" v-if="type == COMMODITY_TYPE.COMMON">
|
|
|
+ <view class="kc num-open_bx flex-end">
|
|
|
<view class="price csss">¥{{ parseFloat(info.price) }}</view>
|
|
|
<view style="text-align: right" >
|
|
|
<view class="open-bx" >
|
|
|
- <i class="iconfont iconjian" :class="delAnimationData?'animation':''" @click.stop="delEvent(info.variety)" v-if="bigCount > 0 || smallCount > 0"></i>
|
|
|
+ <i class="iconfont iconjian" @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(info.variety)"></i>
|
|
|
+ <i class="iconfont iconzeng" @click.stop="addEvents(info.variety)"></i>
|
|
|
</view>
|
|
|
<text v-if="Number(info.stock) > Number(info.stockWarning)" style="padding-right: 55upx">还剩 {{ parseFloat(info.stock) }}</text>
|
|
|
<text v-else style="padding-right: 55upx;color:red;font-weight:450;">还剩 {{ parseFloat(info.stock) }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="num-open_bx flex-space" v-if="type == COMMODITY_TYPE.CHANGE">
|
|
|
- <view class="price cs" v-if="!offPrice">¥{{ oldPrice }}</view>
|
|
|
- <view class="price" v-else></view>
|
|
|
- <view class="open-bx" style="padding-bottom: 40upx" >
|
|
|
- <input class="change-input" @focus="showPrice = null" v-model="showPrice" type="digit" placeholder="自动调价" />
|
|
|
- <view style="width: 80upx;text-align: center;color: red">
|
|
|
- {{Number(oldPrice)>Number(showPrice)&&Number(showPrice)>0?((Number(showPrice)/Number(oldPrice)).toFixed(2)*10).toFixed(1)+'折':''}}
|
|
|
- </view>
|
|
|
- <i :class="isShowSucceed?'position iconfont iconjihuo':'position'" ></i>
|
|
|
- <view class="btn-box" @click="changePriceEvent">确定</view>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
</view>
|
|
|
</view>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
-import { COMMODITY_TYPE } from "@/utils/declare";
|
|
|
-import AppImg from "@/components/app-img";
|
|
|
-import { changePriceByIdApi } from '@/api/product/index'
|
|
|
-import animationMins from "@/mixins/animation";
|
|
|
-import allSelectInput from "@/components/module/allSelectInput";
|
|
|
-import allSelectInputMins from "@/mixins/allSelectInput";
|
|
|
export default {
|
|
|
name: "Commodity",
|
|
|
- components: {
|
|
|
- AppImg,allSelectInput
|
|
|
- },
|
|
|
- mixins: [animationMins,allSelectInputMins],
|
|
|
+ components: {},
|
|
|
+ mixins: [],
|
|
|
props: {
|
|
|
info: {
|
|
|
required: true,
|
|
|
@@ -58,25 +37,16 @@ export default {
|
|
|
return {};
|
|
|
}
|
|
|
},
|
|
|
- type: {
|
|
|
- type: String,
|
|
|
- default: COMMODITY_TYPE.COMMON
|
|
|
- },
|
|
|
- bigCount: {
|
|
|
- type: Number,
|
|
|
- default: 0
|
|
|
+ storeItem:{
|
|
|
+ type: Object,
|
|
|
+ default() {
|
|
|
+ return {bigCount:0,smallCount:0,userPrice:0};
|
|
|
+ }
|
|
|
},
|
|
|
scrollTop: {
|
|
|
type: Number,
|
|
|
default: 0
|
|
|
},
|
|
|
- smallCount: {
|
|
|
- type: Number,
|
|
|
- default: 0
|
|
|
- },userPrice: {
|
|
|
- type: Number,
|
|
|
- default: 0
|
|
|
- },
|
|
|
autoPrice: {},
|
|
|
offPrice: {
|
|
|
type: Boolean,
|
|
|
@@ -101,58 +71,33 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
- COMMODITY_TYPE,
|
|
|
- isImg:false,
|
|
|
isAlterMoney:false,
|
|
|
isAloneAllActive: false,
|
|
|
isAloneAllFocus: false,
|
|
|
- isShowSucceed:false,
|
|
|
changeAutoPrice:'',
|
|
|
showPrice:0.00,
|
|
|
oldPrice:0.00,
|
|
|
- ifFocus:false
|
|
|
+ ifFocus:false,
|
|
|
+ bigCount:0,
|
|
|
+ smallCount:0,
|
|
|
+ userPrice:0
|
|
|
};
|
|
|
},
|
|
|
created() {},
|
|
|
mounted() {
|
|
|
- setTimeout(()=>{
|
|
|
- this.isImg = true;
|
|
|
- },100)
|
|
|
+
|
|
|
if(this.info.priceLabel == 2){
|
|
|
this.changeAutoPrice = this.info.price
|
|
|
}
|
|
|
this.showPrice = this.info.priceLabel==1?null:this.info.price
|
|
|
this.oldPrice = (Number(this.info.cost) + Number(this.info.addPrice)).toFixed(2)
|
|
|
+
|
|
|
+ this.bigCount = this.storeItem.bigCount
|
|
|
+ this.smallCount = this.storeItem.smallCount
|
|
|
+ this.userPrice = this.storeItem.userPrice
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
- //input点击删除按键
|
|
|
- deleteInputVal(){
|
|
|
- this.isAloneAllActive=false;
|
|
|
- this.changeAutoPrice = '';
|
|
|
- },
|
|
|
- //离开input
|
|
|
- moveAllInput(e){
|
|
|
- this.isAloneAllActive=false;
|
|
|
- this.isAloneAllFocus=false;
|
|
|
- this.changeAutoPrice = e?e:0;
|
|
|
- if(this.isAlterMoney){
|
|
|
- this.isAlterMoney = false;
|
|
|
- changePriceByIdApi({
|
|
|
- productId: this.info.id,
|
|
|
- price: this.changeAutoPrice
|
|
|
- }).then(res => {
|
|
|
- if(res.code == 1){
|
|
|
- this.showPrice = res.data.price
|
|
|
- this.isShowSucceed = true
|
|
|
- setTimeout(()=>{
|
|
|
- this.isShowSucceed = false
|
|
|
- },1000)
|
|
|
- }else{
|
|
|
- this.$msg(res.msg)
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
addEvents(variety) {
|
|
|
if(variety == 0 || this.pageType != 'bill'){
|
|
|
const ratio = Number(this.info.ratio);
|
|
|
@@ -168,7 +113,6 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
- this.animationFun('add');
|
|
|
this.$emit("add", this.info);
|
|
|
}else{
|
|
|
//去特殊品种页
|
|
|
@@ -177,36 +121,19 @@ export default {
|
|
|
},
|
|
|
delEvent(variety) {
|
|
|
if(variety == 0 || this.pageType != 'bill'){
|
|
|
- this.animationFun('del');
|
|
|
- this.$emit("del", this.info);
|
|
|
+ this.$emit("del", this.info)
|
|
|
}else{
|
|
|
//去特殊品种页
|
|
|
this.$emit("goToSpecialVariety", this.info);
|
|
|
}
|
|
|
},
|
|
|
- changePriceEvent(event) {
|
|
|
- changePriceByIdApi({
|
|
|
- productId: this.info.id,
|
|
|
- price: this.showPrice
|
|
|
- }).then(res => {
|
|
|
- if(res.code == 1){
|
|
|
- this.showPrice = res.data.price
|
|
|
- this.isShowSucceed = true
|
|
|
- setTimeout(()=>{
|
|
|
- this.isShowSucceed = false
|
|
|
- },1000)
|
|
|
- }else{
|
|
|
- this.$msg(res.msg)
|
|
|
- }
|
|
|
- })
|
|
|
- this.isAlterMoney = true;
|
|
|
- },
|
|
|
//通过弹框来修改花材数据(区别于点+-号修改花材)
|
|
|
changeItemNum(variety) {
|
|
|
//不是小菊或者是小菊但不是在开单
|
|
|
if(variety == 0 || this.pageType != 'bill'){
|
|
|
if(this.checkStock){
|
|
|
if(this.info.stock<=0){
|
|
|
+ this.$util.noStockRemind()
|
|
|
uni.showToast({title:'库存不足',icon:'none'})
|
|
|
return;
|
|
|
}
|
|
|
@@ -263,7 +190,6 @@ export default {
|
|
|
left: 0;
|
|
|
bottom: 0;
|
|
|
}
|
|
|
- //padding: 8upx 0 24upx;
|
|
|
}
|
|
|
& .num-open_bx {
|
|
|
display: flex;
|
|
|
@@ -277,11 +203,9 @@ export default {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
& .iconfont {
|
|
|
- //margin-left: 15upx;
|
|
|
color: #3385ff;
|
|
|
font-size: 42upx;
|
|
|
}
|
|
|
-
|
|
|
.position{
|
|
|
display: block;
|
|
|
width: 70upx;
|
|
|
@@ -329,5 +253,4 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
</style>
|