6/14 解决了精度问题和购物车金额数据可能被前端篡改的问题

This commit is contained in:
mlf9527 2023-06-14 21:31:39 +08:00
parent 001e1a4dae
commit 5fab1b22e0
4 changed files with 7 additions and 7 deletions

View File

@ -83,7 +83,7 @@
<div :class="{divGoodsNum:1===1, moreGoods:cartData && cartData.length > 99}" v-if="cartData && cartData.length > 0">{{ goodsNum }}</div> <div :class="{divGoodsNum:1===1, moreGoods:cartData && cartData.length > 99}" v-if="cartData && cartData.length > 0">{{ goodsNum }}</div>
<div class="divNum"> <div class="divNum">
<span></span> <span></span>
<span>{{goodsPrice}}</span> <span>{{goodsPrice/100}}</span>
</div> </div>
<div class="divPrice"></div> <div class="divPrice"></div>
<div :class="{btnSubmitActive: cartData && cartData.length > 0, btnSubmit:!cartData || cartData.length<1}" @click="toAddOrderPage">去结算</div> <div :class="{btnSubmitActive: cartData && cartData.length > 0, btnSubmit:!cartData || cartData.length<1}" @click="toAddOrderPage">去结算</div>
@ -125,7 +125,7 @@
<div class="divDesc"> <div class="divDesc">
<div class="name">{{item.name}}</div> <div class="name">{{item.name}}</div>
<div class="price"> <div class="price">
<span class="spanMoney"></span>{{item.amount}}</div> <span class="spanMoney"></span>{{item.amount/100}}</div>
</div> </div>
<div class="divNum"> <div class="divNum">
<div class="divSubtract"> <div class="divSubtract">
@ -386,7 +386,7 @@
//菜单中往购物车中添加商品 //菜单中往购物车中添加商品
async addCart(item){ async addCart(item){
let params = { let params = {
amount:item.price/100,//金额 amount:item.price,//金额
dishFlavor:item.dishFlavor,//口味 如果没有传undefined dishFlavor:item.dishFlavor,//口味 如果没有传undefined
dishId:undefined,//菜品id dishId:undefined,//菜品id
setmealId:undefined,//套餐id setmealId:undefined,//套餐id

View File

@ -52,7 +52,7 @@
<div class="numPrice"> <div class="numPrice">
<span class="num">x{{item.number}}</span> <span class="num">x{{item.number}}</span>
<div class="price"> <div class="price">
<span class="spanMoney"></span>{{item.amount}}</div> <span class="spanMoney"></span>{{item.amount/100}}</div>
</div> </div>
</div> </div>
</div> </div>
@ -129,7 +129,7 @@
this.cartData.forEach(item=>{ this.cartData.forEach(item=>{
price += (item.number * item.amount) price += (item.number * item.amount)
}) })
return price return price/100
} }
}, },
created(){ created(){

View File

@ -44,7 +44,7 @@
</div> </div>
</div> </div>
<div class="result"> <div class="result">
<span>共{{order.sumNum}} 件商品,实付</span><span class="price">¥{{order.amount}}</span> <span>共{{order.sumNum}} 件商品,实付</span><span class="price">¥{{order.amount/100}}</span>
</div> </div>
<div class="btn" v-if="order.status === 4"> <div class="btn" v-if="order.status === 4">
<div class="btnAgain" @click="addOrderAgain(order)">再来一单</div> <div class="btnAgain" @click="addOrderAgain(order)">再来一单</div>

View File

@ -58,7 +58,7 @@
</div> </div>
<div class="result"> <div class="result">
<span>共{{order[0].sumNum}} 件商品,实付</span> <span>共{{order[0].sumNum}} 件商品,实付</span>
<span class="price">¥{{order[0].amount}}</span> <span class="price">¥{{order[0].amount/100}}</span>
</div> </div>
<div class="btn" v-if="order[0].status === 4"> <div class="btn" v-if="order[0].status === 4">
<div class="btnAgain" @click="addOrderAgain">再来一单</div> <div class="btnAgain" @click="addOrderAgain">再来一单</div>