This commit is contained in:
faiz 2024-05-17 14:08:08 +08:00
parent a08a4f4fa4
commit 9b78b8842f
3 changed files with 19 additions and 7 deletions

View File

@ -16,7 +16,11 @@ export const setCookies = (key, val, cookieExpires) => {
export const getCookies = key => {
return Cookies.get(key);
};
// 保留两位小数;
// num
export function toFixedNoRounding(num) {
return Math.floor(num * 100) / 100;
}
export const removeCookies = key => {
return Cookies.remove(key);
};

View File

@ -2074,7 +2074,7 @@ import { getToken } from '@/utils/auth'
import taoBao from './taoBao'
import copyRecord from './copyRecord'
import addCarMy from './addCarMy'
import { toFixedNoRounding } from '@/utils/util'
const defaultObj = {
image: '',
refund_switch: 1,
@ -2716,7 +2716,7 @@ export default {
},
//
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)
@ -2724,11 +2724,11 @@ export default {
//
handleCost(val,i,e,type){
if(type == 'batchAdd'){
i=='price'?val.cost = (val.price * 0.6).toFixed(2):''
i=='price'?val.cost = toFixedNoRounding(val.price * 0.6):''
}
if(i=='price'){
val.price=val.price.replace(/^([0-9-]\d*\.?\d{0,2})?.*$/,'$1')
val.cost = (e * val.proportion).toFixed(2)
val.cost = toFixedNoRounding(e * val.proportion)
let obj = this.proportionList.find(item=>item.value==val.proportion)
val.coupon = Math.floor(val.price*obj.coupon)

View File

@ -165,7 +165,7 @@
</div>
</template>
</el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="120">
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="80">
<template slot-scope="scope">
<a
v-if="formThead[iii].title == '依据链接'"
@ -204,7 +204,7 @@
<div class="pictrue tabPic"><img :src="scope.row.image" style="width: 36px; height: 36px; border-radius: 4px;"></div>
</template>
</el-table-column>
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="100">
<el-table-column v-for="(item,iii) in attrValue" :key="iii" :label="formThead[iii].title" align="center" min-width="80">
<template slot-scope="scope">
<a
v-if="formThead[iii].title == '依据链接'"
@ -738,6 +738,8 @@ const defaultObj = {
image: '',
price: null,
svip_price: null,
proportion:'0.6',
coupon:'',
cost: null,
ot_price: null,
stock: null,
@ -769,6 +771,12 @@ const objTitle = {
stock: {
title: '库存'
},
proportion: {
title: '占比'
},
coupon:{
title:'抵扣卷'
},
bar_code: {
title: '商品编号'
},