Commit 181d417f by songbingqi

修复部分bug

parent 6755b9d1
......@@ -10,6 +10,7 @@ export default function initToast(v) {
},
mutations: {
hideToast(state) {
// #ifndef
if(state.hideTabBar){
wx.showTabBar();
}
......
......@@ -27,8 +27,8 @@
</view>
<view class="mon">
<view class="priceBox">
<view class="discount">{{ getSku(item).discount }}</view>
<view class="price"><text class="num">{{ getSku(item).price }}</text></view>
<view class="discount">{{ Utils.isInteger(getSku(item).discount) }}</view>
<view class="price" v-if="getSku(item).price!=getSku(item).discount"><text class="num">{{ Utils.isInteger(getSku(item).price) }}</text></view>
</view>
<view class="addbox">
<image v-if="getSku(item).state==1" @click.stop="getallNum(item, category)" class="add" :src="'../../static/imgs/jiahao.png'" />
......@@ -45,11 +45,13 @@
<script>
import { $EventBus } from "../../utils/EventBus";
import Utils from '@/utils/utils'
export default {
name: 'menuAssembly',
props:['buied'],
data() {
return {
Utils,
classifyData: [],
categoryId: '',
categoryPostion: [],
......
......@@ -41,9 +41,9 @@
</text>
</view>
<view class="goods-price">
<text class="price-discount">{{ item.sku.discount }}</text>
<text class="price-x"></text>
<text class="price-xx">{{ item.sku.price }}</text>
<text class="price-discount">{{ Utils.isInteger(item.sku.discount) }}</text>
<text class="price-x" v-show="item.sku.price!=item.sku.discount"></text>
<text class="price-xx" v-show="item.sku.price!=item.sku.discount">{{ Utils.isInteger(item.sku.price) }}</text>
</view>
</view>
</view>
......@@ -70,7 +70,7 @@
<view class="car-img">
<text class="badge" v-if="totalNum">{{ totalNum }}</text>
</view>
<text class="shopClassStyle">{{ totalPrice.toFixed(2) }}</text>
<text class="shopClassStyle">{{ Utils.isInteger(totalPrice.toFixed(2)) }}</text>
</view>
</view>
<view class="end-right goSubmmit" @click="saveReserve" v-if="userms">
......@@ -90,6 +90,7 @@
import { $EventBus } from "../../utils/EventBus";
import Menu from '@/request/menu';
import User from '@/request/user';
import Utils from '@/utils/utils'
export default {
data() {
return {
......@@ -100,6 +101,7 @@ export default {
goods: [],//购物车商品信息
loginInfo: "",
imgPath: 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fpic.51yuansu.com%2Fpic3%2Fcover%2F01%2F82%2F40%2F596fa6dc00bb4_610.jpg&refer=http%3A%2F%2Fpic.51yuansu.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1633499781&t=d37222e32213957ddbdd01d62e071309',
Utils
}
},
created() {
......
......@@ -52,8 +52,8 @@
<view class="good-select good-select-height" :style="{'padding-bottom':BottomSafeHeight+'px'}">
<view class="good-select-price">
<div>
<text class="good-select-price-normal">{{ priceTotal.discount }}</text>
<text class="good-select-price-small">{{ priceTotal.price }}</text>
<text class="good-select-price-normal">{{ Utils.isInteger(priceTotal.discount) }}</text>
<text class="good-select-price-small" v-show="priceTotal.price!=priceTotal.discount">{{ Utils.isInteger(priceTotal.price) }}</text>
</div>
<div v-if="!size > 0" style="color: orangered">已售罄</div>
<div v-else class="set_size">
......@@ -102,7 +102,8 @@ export default {
size: 0,
topBarTop:0,
topBarHeight:0,
BottomSafeHeight:0
BottomSafeHeight:0,
Utils
}
},
onShow() {
......@@ -224,10 +225,13 @@ export default {
callback && callback(true)
}
},
addGood() {
checkNum(type){
const shopCarInfo = uni.getStorageSync('shopCarInfo') || []
let shopCarNum = (type=='add'?1:0)
shopCarInfo.forEach(item=> shopCarNum+=item.num)
let countOfOrder = uni.getStorageSync('countOfOrder');
if (this.size < countOfOrder) {
this.size = this.size + 1;
if ((this.size + shopCarNum) <= countOfOrder) {
return true
} else {
this.showToast({
title: '最多可一次购买'+countOfOrder+'杯',
......@@ -236,18 +240,24 @@ export default {
}
},
addGood() {
if(this.checkNum('add')){
this.size = this.size + 1;
}
},
reduceGood() {
const { size } = this
if (size > 1) {
this.size = size - 1;
}
},
shoppingCart() {
const { goods } = this;
goods.num = this.size;
Utils.getallNum(goods)
uni.switchTab({ url: '/pages/menu/menu' })
if(this.checkNum('addShop')){
const { goods } = this;
goods.num = this.size;
Utils.getallNum(goods)
uni.switchTab({ url: '/pages/menu/menu' })
}
},
getallNum(e) {
let Authorization = uni.getStorageSync('Authorization');
......
......@@ -36,7 +36,7 @@
<div class="goods_text">
<div class="goods_name">
<div class="name">{{ item.goodsName }}</div>
<div class="price">¥{{ setPrice(item.realAmount) }}</div>
<div class="price">¥{{ Utils.isInteger(setPrice(item.realAmount)) }}</div>
</div>
<div class="goods_psce">
<div class="psce_name">
......@@ -65,7 +65,7 @@
<div class="size">{{ totalNum }}件商品</div>
<div>
<span class="paid_in">实付</span>
<span class="money">{{ setPrice(orderInfo.amount) }}</span>
<span class="money">{{ Utils.isInteger(setPrice(orderInfo.amount)) }}</span>
</div>
</div>
</div>
......@@ -124,7 +124,8 @@ export default {
data() {
return {
orderInfo: {},
ewmImg: ''
ewmImg: '',
Utils
}
},
methods: {
......
......@@ -23,7 +23,7 @@
<div class="goods_text">
<div class="goods_name">
<div class="name">{{ item.name }}</div>
<div class="price">¥{{ setPrice(item.sku.discount) }}</div>
<div class="price">¥{{ Utils.isInteger(setPrice(item.sku.discount)) }}</div>
</div>
<div class="goods_psce">
<div class="psce_name">
......@@ -52,7 +52,7 @@
<div class="size">{{ totalNum }}件商品</div>
<div class="priceBox">
<span class="paid_in">实付</span>
<span class="money">{{ totalPrice }}</span>
<span class="money">{{ Utils.isInteger(totalPrice) }}</span>
</div>
</div>
</div>
......@@ -68,7 +68,7 @@
<div class="total">
<div class="the_sum">
<span class="name">合计</span>
<span class="price">{{ totalPrice }}</span>
<span class="price">{{ Utils.isInteger(totalPrice) }}</span>
</div>
<!-- <div class="sun">
<div class="price">总优惠¥{{ reduction }}</div>
......@@ -163,7 +163,8 @@ export default {
payType: '1',
duration: '',
loginInfo: '',
BottomSafeHeight:0
BottomSafeHeight:0,
Utils
}
},
computed: {
......
......@@ -448,6 +448,7 @@ export default {
line-height: 34rpx;
letter-spacing: 0rpx;
text-shadow: -2px -2px 4px rgba(102, 102, 102, 0.1);
white-space: nowrap;
.time {
font-size: 32rpx;
......
......@@ -53,7 +53,7 @@
</div>
<view class="order_footer">
<view class="total">
{{ orderDetailsSize(item.orderDetails) }}件商品 合计<text class="price">{{ item.amount }}</text>
{{ orderDetailsSize(item.orderDetails) }}件商品 合计<text class="price">{{ Utils.isInteger(item.amount) }}</text>
</view>
<a class="btn" @click.stop="PayNow(item)" v-if="item.state == 1" type="primary">立刻支付</a>
<a class="btn" v-else @click.stop="oneMoreOrder(item)" type="primary">再来一单</a>
......@@ -84,7 +84,8 @@ export default {
return {
empty: false,
list: [],
loginInfo:""
loginInfo:"",
Utils
}
},
onShow() {
......
......@@ -65,7 +65,6 @@ export default {
// 业务逻辑。。。
},
fail: function (err) {
console.log(context)
context.showToast({
title: '支付失败',
icon: 'error',
......
import Config from '../static/config/index.js';
import WXBizDataCrypt from './WXBizDataCrypt.js';
import context from '../main.js'
import { $EventBus } from './EventBus';
export default {
......@@ -51,7 +52,7 @@ export default {
if(!unCheckCount) {
let countOfOrder = uni.getStorageSync('countOfOrder');
if (size >= countOfOrder) {
uni.showToast({
context.showToast({
title: '最多可一次购买'+countOfOrder+'杯',
icon: 'none',
});
......@@ -159,4 +160,12 @@ export default {
return (Math.round(Number(data) * Math.pow(10, fixed)) / Math.pow(10, fixed)).toFixed(fixed);
}
},
isInteger(value) {
const val = Number(value)
if(val%1 === 0){
return parseInt(val)
}else{
return val.toFixed(1)
}
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment