Commit 092d9e16 by songbingqi

修复部分bug

parent 03282775
<template> <template>
<view class="page-body"> <view class="page-body">
<scroll-view class="nav-left" :style="[heightStyle]" :class="[shopCarFlag||shopState===0?'shopCarcss':'' ]" scroll-y :scroll-top="scrollLeftTop" scroll-with-animation> <scroll-view class="nav-left" :style="[heightStyle]" :class="[shopCarFlag||!shopState?'shopCarcss':'' ]" scroll-y :scroll-top="scrollLeftTop" scroll-with-animation>
<view class="nav-left-item" v-for="(item,index) in classifyData" @click="categoryClickMain(item.id)" :key="item.id" <view class="nav-left-item" v-for="(item,index) in classifyData" @click="categoryClickMain(item.id)" :key="item.id"
:class="item.id == categoryId ? 'active' : ''"> :class="item.id == categoryId ? 'active' : ''">
<view class="imgbox" v-if="item.icon&&sizeList[index].width"> <view class="imgbox" v-if="item.icon&&sizeList[index].width">
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<!-- <view :class="item.id == categoryId ? 'active-line' : ''"></view> --> <!-- <view :class="item.id == categoryId ? 'active-line' : ''"></view> -->
</view> </view>
</scroll-view> </scroll-view>
<scroll-view class="nav-right" :style="[heightStyle]" :class="[shopCarFlag||shopState===0?'shopCarcss':'' ]" scroll-y :scroll-top="scrollTop" @scroll="scroll" @touchstart="openScroll" <scroll-view class="nav-right" :style="[heightStyle]" :class="[shopCarFlag||!shopState?'shopCarcss':'' ]" scroll-y :scroll-top="scrollTop" @scroll="scroll" @touchstart="openScroll"
scroll-with-animation> scroll-with-animation>
<view v-for="(category,index) in classifyData" :id="category.id" :key="category.id" class="box" :style="[goodBottom]"> <view v-for="(category,index) in classifyData" :id="category.id" :key="category.id" class="box" :style="[goodBottom]">
<view :style="loads" class="right-title">{{ category.name }}</view> <view :style="loads" class="right-title">{{ category.name }}</view>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<view class="discount"><text class="moneyLog"></text>{{ Utils.isInteger(getSku(item).discount) }}</view> <view class="discount"><text class="moneyLog"></text>{{ 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 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" v-if="shopState!==0"> <view class="addbox" v-if="shopState">
<image v-if="getSku(item).state==1" @click.stop="cart(item, category)" class="add" :src="'../../static/imgs/jiahao.png'" /> <image v-if="getSku(item).state==1" @click.stop="cart(item, category)" class="add" :src="'../../static/imgs/jiahao.png'" />
<!-- <u-icon class="add" name="plus-circle-fill" color="#0050F6" @click.stop="getallNum(item, category)" size="22"></u-icon> --> <!-- <u-icon class="add" name="plus-circle-fill" color="#0050F6" @click.stop="getallNum(item, category)" size="22"></u-icon> -->
<div v-if="getSku(item).state!=1" style="color: #858585;font-size: 20rpx;margin-top:16rpx">已售罄</div> <div v-if="getSku(item).state!=1" style="color: #858585;font-size: 20rpx;margin-top:16rpx">已售罄</div>
...@@ -249,7 +249,7 @@ export default { ...@@ -249,7 +249,7 @@ export default {
icon: 'none', icon: 'none',
}) })
}else{ }else{
if(this.shopState!==0){ if(this.shopState){
const {data} = await Order.checkSku({skuId:item.skus[0].skuId}) const {data} = await Order.checkSku({skuId:item.skus[0].skuId})
const {goods} = data.data const {goods} = data.data
console.log(goods) console.log(goods)
......
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
@getphonenumber="saveReserve">结算 @getphonenumber="saveReserve">结算
</button> </button>
</view> </view>
<view class="shopClose" v-if="shopState===0" :style="{'bottom':shopCar+'rpx'}"> <view class="shopClose" v-if="!shopState" :style="{'bottom':shopCar+'rpx'}">
<view class="content">门店已休息</view> <view class="content">门店已休息</view>
</view> </view>
<show-toast ref="toast"/> <show-toast ref="toast"/>
......
...@@ -63,16 +63,16 @@ ...@@ -63,16 +63,16 @@
</view> </view>
<view v-if="size > 0" class="good-select-cont"> <view v-if="size > 0" class="good-select-cont">
<view> <view>
<a :class="shopState===0?'good-select-btn1-close':'good-select-btn1'" @click="getallNum()" v-if="userms"> <a :class="!shopState?'good-select-btn1-close':'good-select-btn1'" @click="getallNum()" v-if="userms">
立即购买 立即购买
</a> </a>
<button v-if="!userms" :class="shopState===0?'good-select-btn1-close':'good-select-btn1'" style="border-radius: 0;" open-type="getPhoneNumber" <button v-if="!userms" :class="!shopState?'good-select-btn1-close':'good-select-btn1'" style="border-radius: 0;" open-type="getPhoneNumber"
@getphonenumber="getallNum"> @getphonenumber="getallNum">
立即购买 立即购买
</button> </button>
</view> </view>
<span :class="shopState===0?'good-select-btn2-close':'good-select-btn2'" @click="shoppingCart" type="default">加入购物袋</span> <span :class="!shopState?'good-select-btn2-close':'good-select-btn2'" @click="shoppingCart" type="default">加入购物袋</span>
</view> </view>
</view> </view>
</view> </view>
...@@ -103,13 +103,13 @@ export default { ...@@ -103,13 +103,13 @@ export default {
topBarHeight:0, topBarHeight:0,
BottomSafeHeight:0, BottomSafeHeight:0,
Utils, Utils,
shopState:0, shopState:true,
} }
}, },
onShow() { onShow() {
uni.removeStorageSync('goodsList'); uni.removeStorageSync('goodsList');
this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight') this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight')
this.shopState = Number(JSON.parse(uni.getStorageSync("shopInfo")).state) this.shopState = JSON.parse(uni.getStorageSync("shopState"))
}, },
mounted(){ mounted(){
// 获取胶囊坐标位置 // 获取胶囊坐标位置
...@@ -287,7 +287,7 @@ export default { ...@@ -287,7 +287,7 @@ export default {
} }
}, },
async shoppingCart() { async shoppingCart() {
if(this.shopState===0){ if(!this.shopState){
return return
} }
if(this.checkNum('addShop')){ if(this.checkNum('addShop')){
...@@ -317,7 +317,7 @@ export default { ...@@ -317,7 +317,7 @@ export default {
this.loginByPhoneNumber(e); this.loginByPhoneNumber(e);
return return
} }
if(this.shopState===0){ if(!this.shopState){
return return
} }
const { goods } = this; const { goods } = this;
...@@ -361,7 +361,7 @@ export default { ...@@ -361,7 +361,7 @@ export default {
} }
}, },
UseIt(ruleId) { UseIt(ruleId) {
return this.available.indexOf(ruleId) == -1&&this.shopState!==0 return this.available.indexOf(ruleId) == -1&&this.shopState
} }
}, },
computed: { computed: {
......
...@@ -59,7 +59,7 @@ export default { ...@@ -59,7 +59,7 @@ export default {
let timeStart = '' let timeStart = ''
let timeEnd = '' let timeEnd = ''
if(item.useStartTime){ if(item.useStartTime){
timeStart = Date.parse(item.useStartTime.replace(/-/g,'/'))<new Date().valueOf()<Date.parse(item.useEndTime.replace(/-/g,'/'))?'':item.useStartTime.slice(0,11).replace(new RegExp('-','g'), '.') timeStart = (Date.parse(item.useStartTime.replace(/-/g,'/'))<new Date().valueOf()&&new Date().valueOf()<Date.parse(item.useEndTime.replace(/-/g,'/')))?'':item.useStartTime.slice(0,11).replace(new RegExp('-','g'), '.')
} }
if(item.useEndTime){ if(item.useEndTime){
timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.') timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.')
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
<script> <script>
import Modal from '@/components/Modal/index.vue' import Modal from '@/components/Modal/index.vue'
import Mine from '@/request/mine' import Mine from '@/request/mine'
import Store from '@/store';
export default { export default {
components: { Modal }, components: { Modal },
computed:{ computed:{
...@@ -78,7 +79,10 @@ export default { ...@@ -78,7 +79,10 @@ export default {
const days = date.getDate() const days = date.getDate()
return years+'.'+month+'.'+days return years+'.'+month+'.'+days
} },
userInfoStorage() {
return this.$store.state.user.userInfo;
},
}, },
watch:{ watch:{
'userInfo.name':{ 'userInfo.name':{
...@@ -186,6 +190,7 @@ export default { ...@@ -186,6 +190,7 @@ export default {
}) })
}, },
async save() { async save() {
const {customerName,...result} = this.userInfoStorage
if(!this.valate){ if(!this.valate){
const {sex,name,id} = this.userInfo const {sex,name,id} = this.userInfo
const sendData = { const sendData = {
...@@ -197,6 +202,12 @@ export default { ...@@ -197,6 +202,12 @@ export default {
const { data } = await Mine.editUserInfo(sendData) const { data } = await Mine.editUserInfo(sendData)
const {code = 0} = data const {code = 0} = data
if(code===200){ if(code===200){
const data = {
...result,
customerName:name
}
Store.commit('setUserInfo', data);
uni.setStorage({ key: 'userInfo', data: data });
this.showToast({ title: '保存成功'}) this.showToast({ title: '保存成功'})
} }
} }
......
...@@ -120,6 +120,7 @@ import User from '@/request/user' ...@@ -120,6 +120,7 @@ import User from '@/request/user'
import Order from '@/request/order' import Order from '@/request/order'
export default { export default {
onShow() { onShow() {
console.log('show')
if (this.goods) { if (this.goods) {
Order.getWaitTine({ Order.getWaitTine({
shopId: uni.getStorageSync('shopData').id, shopId: uni.getStorageSync('shopData').id,
...@@ -192,12 +193,12 @@ export default { ...@@ -192,12 +193,12 @@ export default {
this.buyType = 3; this.buyType = 3;
const shopCarInfo = uni.getStorageSync('shopCarInfo') || [] const shopCarInfo = uni.getStorageSync('shopCarInfo') || []
this.goods = shopCarInfo.filter(item => item.flag); this.goods = shopCarInfo.filter(item => item.flag);
Order.getWaitTine({ // Order.getWaitTine({
shopId: uni.getStorageSync('shopData').id, // shopId: uni.getStorageSync('shopData').id,
goods: this.goods // goods: this.goods
}).then(({ data }) => { // }).then(({ data }) => {
this.duration = data.data // this.duration = data.data
}) // })
this.saveGetTicket() this.saveGetTicket()
}, },
...@@ -358,7 +359,7 @@ export default { ...@@ -358,7 +359,7 @@ export default {
} }
let needChoseMsg = true let needChoseMsg = true
const { sendMsgFlag1, flagExpireData } = this.sendMsgData const { sendMsgFlag1, flagExpireData } = this.sendMsgData
const HasMessageFlag = JSON.stringify(sendMsgFlag1)=='true'||JSON.stringify(sendMsgFlag1)=='false'?true:true const HasMessageFlag = JSON.stringify(sendMsgFlag1)=='true'||JSON.stringify(sendMsgFlag1)=='false'?true:false
if(!HasMessageFlag&&!flagExpireData){ if(!HasMessageFlag&&!flagExpireData){
console.log('用户从未选择过授权信息,弹框') console.log('用户从未选择过授权信息,弹框')
needChoseMsg = true needChoseMsg = true
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<view class="barCode-dis">点击二维码取单</view> <view class="barCode-dis">点击二维码取单</view>
</view> </view>
</view> </view>
<MenuAssembly ref="MenuAssembly" @getallNum="getallNum" :buied="buied" :shopState="shopInfo.state"/> <MenuAssembly ref="MenuAssembly" @getallNum="getallNum" :buied="buied" :shopState="shopState"/>
<!-- <u-picker @cancel="show = false" :show="show" :immediateChange="true" ref="uPicker" :columns="columns" <!-- <u-picker @cancel="show = false" :show="show" :immediateChange="true" ref="uPicker" :columns="columns"
@confirm="confirm" keyName="name" @change="changeHandler"></u-picker> --> @confirm="confirm" keyName="name" @change="changeHandler"></u-picker> -->
<AreaPicker ref="AreaPicker" /> <AreaPicker ref="AreaPicker" />
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
style="background:#fff;width: 200px;height: 200px; display:block; left:-800rpx;position:absolute;" /> style="background:#fff;width: 200px;height: 200px; display:block; left:-800rpx;position:absolute;" />
<show-toast ref="toast"/> <show-toast ref="toast"/>
<taBar select="0"></taBar> <taBar select="0"></taBar>
<ShopCar ref="shopbar" :shopState="shopInfo.state" /> <ShopCar ref="shopbar" :shopState="shopState" />
</view> </view>
</template> </template>
<script> <script>
...@@ -88,6 +88,33 @@ export default { ...@@ -88,6 +88,33 @@ export default {
}; };
}, },
computed: { computed: {
shopState() {
console.log(this.shopInfo)
const { shopInfo } = this
const {startTime,endTime,state} = shopInfo
if(!startTime||!endTime||!state) return true
function getNowFormatDate() {
let date = new Date(),
seperator1 = '/', //格式分隔符
year = date.getFullYear(), //获取完整的年份(4位)
month = date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
strDate = date.getDate() // 获取当前日(1-31)
if (month >= 1 && month <= 9) month = '0' + month // 如果月份是个位数,在前面补0
if (strDate >= 0 && strDate <= 9) strDate = '0' + strDate // 如果日是个位数,在前面补0
let currentdate = year + seperator1 + month + seperator1 + strDate
return currentdate
}
const startTimeNew = Date.parse(getNowFormatDate()+ ' ' +startTime+':00')
const endTimeNew = Date.parse(getNowFormatDate()+ ' ' +endTime+':00')
if(startTimeNew<new Date().valueOf()&&new Date().valueOf()<endTimeNew&&state===1) {
uni.setStorageSync("shopState",true)
return true
}else{
uni.setStorageSync("shopState",false)
return false
}
},
userms() { userms() {
return this.$store.getters.Authorization; return this.$store.getters.Authorization;
}, },
......
...@@ -109,8 +109,10 @@ export default { ...@@ -109,8 +109,10 @@ export default {
} }
}, },
async onShow() { async onShow() {
const {data} = await User.getCouponNum() if(this.userInfo){
this.tickNum = data?.data||0 const {data} = await User.getCouponNum()
this.tickNum = data?.data||0
}
}, },
data() { data() {
return { return {
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
</div> </div>
<view class="order_footer" :style="{'margin-top':checkStatus(item.state,[12,13,14,15])?'16rpx':'39rpx'}"> <view class="order_footer" :style="{'margin-top':checkStatus(item.state,[12,13,14,15])?'16rpx':'39rpx'}">
<view class="total"> <view class="total">
{{ orderDetailsSize(item.orderDetails) }}件商品 实付<text class="price">{{ Utils.isInteger(item.amount) }}</text> {{ orderDetailsSize(item.orderDetails) }}件商品 实付<text class="price">{{ Utils.isInteger(item.paidAmount) }}</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>
......
...@@ -17,7 +17,7 @@ const order = { ...@@ -17,7 +17,7 @@ const order = {
let timeStart = '' let timeStart = ''
let timeEnd = '' let timeEnd = ''
if(item.useStartTime){ if(item.useStartTime){
timeStart = Date.parse(item.useStartTime.replace(/-/g,'/'))<new Date().valueOf()<Date.parse(item.useEndTime.replace(/-/g,'/'))?'':item.useStartTime.slice(0,11).replace(new RegExp('-','g'), '.') timeStart = (Date.parse(item.useStartTime.replace(/-/g,'/'))<new Date().valueOf()&&new Date().valueOf()<Date.parse(item.useEndTime.replace(/-/g,'/')))?'':item.useStartTime.slice(0,11).replace(new RegExp('-','g'), '.')
} }
if(item.useEndTime){ if(item.useEndTime){
timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.') timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.')
...@@ -59,7 +59,7 @@ const order = { ...@@ -59,7 +59,7 @@ const order = {
let timeStart = '' let timeStart = ''
let timeEnd = '' let timeEnd = ''
if(item.useStartTime){ if(item.useStartTime){
timeStart = Date.parse(item.useStartTime.replace(/-/g,'/'))<new Date().valueOf()<Date.parse(item.useEndTime.replace(/-/g,'/'))?'':item.useStartTime.slice(0,11).replace(new RegExp('-','g'), '.') timeStart = (Date.parse(item.useStartTime.replace(/-/g,'/'))<new Date().valueOf()&&new Date().valueOf()<Date.parse(item.useEndTime.replace(/-/g,'/')))?'':item.useStartTime.slice(0,11).replace(new RegExp('-','g'), '.')
} }
if(item.useEndTime){ if(item.useEndTime){
timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.') timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.')
......
...@@ -23,6 +23,7 @@ const user = { ...@@ -23,6 +23,7 @@ const user = {
}, },
// 设置用户允许昵称头像授权时的信息 // 设置用户允许昵称头像授权时的信息
setUserInfo(state, userInfo) { setUserInfo(state, userInfo) {
console.log(userInfo)
state.userInfo = userInfo; state.userInfo = userInfo;
}, },
// 授权手机号时允许后的信息 // 授权手机号时允许后的信息
......
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