Commit 092d9e16 by songbingqi

修复部分bug

parent 03282775
<template>
<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"
:class="item.id == categoryId ? 'active' : ''">
<view class="imgbox" v-if="item.icon&&sizeList[index].width">
......@@ -10,7 +10,7 @@
<!-- <view :class="item.id == categoryId ? 'active-line' : ''"></view> -->
</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>
<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>
......@@ -33,7 +33,7 @@
<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>
<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'" />
<!-- <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>
......@@ -249,7 +249,7 @@ export default {
icon: 'none',
})
}else{
if(this.shopState!==0){
if(this.shopState){
const {data} = await Order.checkSku({skuId:item.skus[0].skuId})
const {goods} = data.data
console.log(goods)
......
......@@ -82,7 +82,7 @@
@getphonenumber="saveReserve">结算
</button>
</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>
<show-toast ref="toast"/>
......
......@@ -63,16 +63,16 @@
</view>
<view v-if="size > 0" class="good-select-cont">
<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>
<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">
立即购买
</button>
</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>
......@@ -103,13 +103,13 @@ export default {
topBarHeight:0,
BottomSafeHeight:0,
Utils,
shopState:0,
shopState:true,
}
},
onShow() {
uni.removeStorageSync('goodsList');
this.BottomSafeHeight = uni.getStorageSync('BottomSafeHeight')
this.shopState = Number(JSON.parse(uni.getStorageSync("shopInfo")).state)
this.shopState = JSON.parse(uni.getStorageSync("shopState"))
},
mounted(){
// 获取胶囊坐标位置
......@@ -287,7 +287,7 @@ export default {
}
},
async shoppingCart() {
if(this.shopState===0){
if(!this.shopState){
return
}
if(this.checkNum('addShop')){
......@@ -317,7 +317,7 @@ export default {
this.loginByPhoneNumber(e);
return
}
if(this.shopState===0){
if(!this.shopState){
return
}
const { goods } = this;
......@@ -361,7 +361,7 @@ export default {
}
},
UseIt(ruleId) {
return this.available.indexOf(ruleId) == -1&&this.shopState!==0
return this.available.indexOf(ruleId) == -1&&this.shopState
}
},
computed: {
......
......@@ -59,7 +59,7 @@ export default {
let timeStart = ''
let timeEnd = ''
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){
timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.')
......
......@@ -67,6 +67,7 @@
<script>
import Modal from '@/components/Modal/index.vue'
import Mine from '@/request/mine'
import Store from '@/store';
export default {
components: { Modal },
computed:{
......@@ -78,7 +79,10 @@ export default {
const days = date.getDate()
return years+'.'+month+'.'+days
}
},
userInfoStorage() {
return this.$store.state.user.userInfo;
},
},
watch:{
'userInfo.name':{
......@@ -186,6 +190,7 @@ export default {
})
},
async save() {
const {customerName,...result} = this.userInfoStorage
if(!this.valate){
const {sex,name,id} = this.userInfo
const sendData = {
......@@ -197,6 +202,12 @@ export default {
const { data } = await Mine.editUserInfo(sendData)
const {code = 0} = data
if(code===200){
const data = {
...result,
customerName:name
}
Store.commit('setUserInfo', data);
uni.setStorage({ key: 'userInfo', data: data });
this.showToast({ title: '保存成功'})
}
}
......
......@@ -120,6 +120,7 @@ import User from '@/request/user'
import Order from '@/request/order'
export default {
onShow() {
console.log('show')
if (this.goods) {
Order.getWaitTine({
shopId: uni.getStorageSync('shopData').id,
......@@ -192,12 +193,12 @@ export default {
this.buyType = 3;
const shopCarInfo = uni.getStorageSync('shopCarInfo') || []
this.goods = shopCarInfo.filter(item => item.flag);
Order.getWaitTine({
shopId: uni.getStorageSync('shopData').id,
goods: this.goods
}).then(({ data }) => {
this.duration = data.data
})
// Order.getWaitTine({
// shopId: uni.getStorageSync('shopData').id,
// goods: this.goods
// }).then(({ data }) => {
// this.duration = data.data
// })
this.saveGetTicket()
},
......@@ -358,7 +359,7 @@ export default {
}
let needChoseMsg = true
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){
console.log('用户从未选择过授权信息,弹框')
needChoseMsg = true
......
......@@ -48,7 +48,7 @@
<view class="barCode-dis">点击二维码取单</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"
@confirm="confirm" keyName="name" @change="changeHandler"></u-picker> -->
<AreaPicker ref="AreaPicker" />
......@@ -57,7 +57,7 @@
style="background:#fff;width: 200px;height: 200px; display:block; left:-800rpx;position:absolute;" />
<show-toast ref="toast"/>
<taBar select="0"></taBar>
<ShopCar ref="shopbar" :shopState="shopInfo.state" />
<ShopCar ref="shopbar" :shopState="shopState" />
</view>
</template>
<script>
......@@ -88,6 +88,33 @@ export default {
};
},
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() {
return this.$store.getters.Authorization;
},
......
......@@ -109,8 +109,10 @@ export default {
}
},
async onShow() {
if(this.userInfo){
const {data} = await User.getCouponNum()
this.tickNum = data?.data||0
}
},
data() {
return {
......
......@@ -57,7 +57,7 @@
</div>
<view class="order_footer" :style="{'margin-top':checkStatus(item.state,[12,13,14,15])?'16rpx':'39rpx'}">
<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>
<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>
......
......@@ -17,7 +17,7 @@ const order = {
let timeStart = ''
let timeEnd = ''
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){
timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.')
......@@ -59,7 +59,7 @@ const order = {
let timeStart = ''
let timeEnd = ''
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){
timeEnd = item.useEndTime.slice(0,11).replace(new RegExp('-','g'), '.')
......
......@@ -23,6 +23,7 @@ const user = {
},
// 设置用户允许昵称头像授权时的信息
setUserInfo(state, userInfo) {
console.log(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