edit
This commit is contained in:
parent
11b34d7c9b
commit
578361bf5a
|
@ -17,6 +17,11 @@ export const getCookies = key => {
|
|||
return Cookies.get(key);
|
||||
};
|
||||
|
||||
// 保留两位小数;
|
||||
// num
|
||||
export function toFixedNoRounding(num) {
|
||||
return Math.floor(num * 100) / 100;
|
||||
}
|
||||
/**
|
||||
* 从cookie中移除指定的键值对
|
||||
* @param {string} key - 要移除的键名
|
||||
|
|
|
@ -215,6 +215,7 @@ import {
|
|||
freeTrialApi
|
||||
} from '@/api/product'
|
||||
import { roterPre } from "@/settings";
|
||||
import { toFixedNoRounding } from '@/utils/util'
|
||||
const defaultObj = {
|
||||
store_name: '',
|
||||
cate_id: '',
|
||||
|
@ -448,13 +449,13 @@ export default {
|
|||
methods: {
|
||||
// 占比值变化处理
|
||||
proportionChange(val,i,e){
|
||||
val.cost = (val.price * e).toFixed(2)
|
||||
val.cost = toFixedNoRounding(val.price * e)
|
||||
let obj = this.proportionList.find(item=>item.value==e)
|
||||
val.coupon = Math.floor(val.price*obj.coupon)
|
||||
val.growth = Math.floor(val.price*obj.growth)
|
||||
},
|
||||
BatchProportionChange(){
|
||||
this.oneFormBatch[0].cost = (this.oneFormBatch[0].price * this.oneFormBatch[0].proportion).toFixed(2)
|
||||
this.oneFormBatch[0].cost = toFixedNoRounding(this.oneFormBatch[0].price * this.oneFormBatch[0].proportion)
|
||||
let obj = this.proportionList.find(item=>item.value==this.oneFormBatch[0].proportion)
|
||||
this.oneFormBatch[0].coupon = Math.floor(this.oneFormBatch[0].price*obj.coupon)
|
||||
this.oneFormBatch[0].growth = Math.floor(this.oneFormBatch[0].price*obj.growth)
|
||||
|
@ -468,7 +469,7 @@ export default {
|
|||
// this.oneFormBatch[0].proportion = (this.oneFormBatch[0].cost/this.oneFormBatch[0].price).toFixed(2)
|
||||
}else{
|
||||
this.oneFormBatch[0].price = this.oneFormBatch[0].price.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')
|
||||
this.oneFormBatch[0].cost = (this.oneFormBatch[0].price * this.oneFormBatch[0].proportion).toFixed(2)
|
||||
this.oneFormBatch[0].cost = toFixedNoRounding(this.oneFormBatch[0].price * this.oneFormBatch[0].proportion)
|
||||
let obj = this.proportionList.find(item=>item.value==this.oneFormBatch[0].proportion)
|
||||
this.oneFormBatch[0].coupon = Math.floor(this.oneFormBatch[0].price*obj.coupon)
|
||||
this.oneFormBatch[0].growth = Math.floor(this.oneFormBatch[0].price*obj.growth)
|
||||
|
@ -502,7 +503,7 @@ export default {
|
|||
case 'price':
|
||||
val.price=val.price.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')
|
||||
let obj = this.proportionList.find(item=>item.value==val.proportion)
|
||||
val.cost = (val.price * val.proportion).toFixed(2)
|
||||
val.cost = toFixedNoRounding(val.price * val.proportion)
|
||||
val.coupon = Math.floor(val.price*obj.coupon)
|
||||
val.growth = Math.floor(val.price*obj.growth)
|
||||
break;
|
||||
|
|
|
@ -1189,9 +1189,9 @@ const defaultObj = {
|
|||
price: null,
|
||||
svip_price: null,
|
||||
cost: null,
|
||||
|
||||
ot_price: null,
|
||||
proportion: 0.6,
|
||||
coupon:'',
|
||||
stock: 0,
|
||||
growth: 0,
|
||||
bar_code: "",
|
||||
|
@ -1222,6 +1222,9 @@ const objTitle = {
|
|||
proportion: {
|
||||
title: "占比",
|
||||
},
|
||||
coupon:{
|
||||
title:'抵扣卷'
|
||||
},
|
||||
stock: {
|
||||
title: "库存",
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue