Commit 181d417f by songbingqi

修复部分bug

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