Commit 075ab1a1 by weijiguang

修改bug

parent 4c23005f
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
</view> </view>
<view class="dis-box"> <view class="dis-box">
<view class="dis">{{ item.desc || '' }}</view> <view class="dis">{{ item.desc || '' }}</view>
<view class="add-btn" @click.stop="getallNum(item, category)">+</view> <!-- <view class="add-btn" @click.stop="getallNum(item, category)">+</view> -->
<u-icon name="plus-circle-fill" color="#2979ff" @click.stop="getallNum(item, category)" size="22"></u-icon>
</view> </view>
<view class="mon"> <view class="mon">
<view class="discount">{{ getPrice(item).discount || item.discount }}</view> <view class="discount">{{ getPrice(item).discount || item.discount }}</view>
......
...@@ -43,9 +43,11 @@ ...@@ -43,9 +43,11 @@
</view> </view>
</view> </view>
<view class="detail-right"> <view class="detail-right">
<text class="subtract" @click="reduce(item, index)">-</text> <!-- <text class="subtract" @click="reduce(item, index)">-</text> -->
<u-icon class="subtract" name="minus-circle" @click="reduce(item, index)" color="#2979ff" size="22"></u-icon>
<text class="num">{{ item.num }}</text> <text class="num">{{ item.num }}</text>
<text @click="add(item)" class="add">+</text> <!-- <text @click="add(item)" class="add">+</text> -->
<u-icon class="add" name="plus-circle-fill" color="#2979ff" @click="add(item)" size="22"></u-icon>
</view> </view>
</view> </view>
</view> </view>
...@@ -71,8 +73,6 @@ ...@@ -71,8 +73,6 @@
@getphonenumber="saveReserve"> @getphonenumber="saveReserve">
付款 付款
</button> </button>
</view> </view>
</view> </view>
</template> </template>
...@@ -329,27 +329,33 @@ export default { ...@@ -329,27 +329,33 @@ export default {
} }
.detail-right { .detail-right {
text { display: flex;
width: 40rpx; // text {
line-height: 40rpx; // width: 40rpx;
text-align: center; // line-height: 40rpx;
display: inline-block; // text-align: center;
margin-right: 10rpx; // display: inline-block;
// margin-right: 10rpx;
// color: #000000;
// }
// .subtract {
// float: left;
// position: relative;
// }
.num {
// float: left;
// position: relative;
margin-left: 15rpx;
margin-right: 15rpx;
color: #000000; color: #000000;
// font-size: 28rpx;
font-weight: bold;
} }
// .add {
.add { // float: left;
color: #FFFFFF; // position: relative;
border-radius: 40rpx; // }
margin-right: 20rpx;
background: #006ECF;
}
.subtract {
border: 1rpx solid #006ECF;
border-radius: 40rpx;
color: #006ECF;
}
} }
} }
} }
......
...@@ -54,8 +54,7 @@ ...@@ -54,8 +54,7 @@
</div> </div>
<div v-if="!size > 0">已售罄</div> <div v-if="!size > 0">已售罄</div>
<div v-else class="set_size"> <div v-else class="set_size">
<u-icon name="minus-circle" @click="reduceGood" color="#2979ff" size="22"> <u-icon name="minus-circle" @click="reduceGood" color="#2979ff" size="22"></u-icon>
</u-icon>
<span>{{ size }}</span> <span>{{ size }}</span>
<u-icon name="plus-circle-fill" color="#2979ff" @click="addGood" size="22"></u-icon> <u-icon name="plus-circle-fill" color="#2979ff" @click="addGood" size="22"></u-icon>
</div> </div>
......
<template> <template>
<scroll-view class="msg" scroll-y> <scroll-view class="msg" scroll-y>
<view class="empty" v-show="empty == true">
<image class="empty_icon" src="/static/imgs/none_content.png"></image>
<view class="empty_text">---暂无消息,去品尝杯咖啡吧---</view>
<button class="empty_button" @click="goHome">去品尝</button>
</view>
<view class="msg_item" v-for="item in list" @click="toRead(item)" :key="item.id"> <view class="msg_item" v-for="item in list" @click="toRead(item)" :key="item.id">
<view class="msg_item_title_time"> <view class="msg_item_title_time">
<view v-if="item.isRead == 1" class="sign"></view> <view v-if="item.isRead == 1" class="sign"></view>
...@@ -16,6 +21,7 @@ import Mine from '@/request/mine' ...@@ -16,6 +21,7 @@ import Mine from '@/request/mine'
export default { export default {
data() { data() {
return { return {
empty: false,
list: [] list: []
} }
}, },
...@@ -27,6 +33,11 @@ export default { ...@@ -27,6 +33,11 @@ export default {
async getList() { async getList() {
const { data } = await Mine.getMsg(); const { data } = await Mine.getMsg();
this.list = data.rows this.list = data.rows
if(this.list && this.list.length>0) {
this.empty = false;
} else {
this.empty = true;
}
}, },
async toRead(item) { async toRead(item) {
const { id } = item const { id } = item
...@@ -34,6 +45,9 @@ export default { ...@@ -34,6 +45,9 @@ export default {
if (res) { if (res) {
this.getList() this.getList()
} }
},
goHome() {
uni.switchTab({ url: '/pages/menu/menu' });
} }
} }
...@@ -41,6 +55,40 @@ export default { ...@@ -41,6 +55,40 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.empty {
position: fixed;
/* 居中对齐begin */
left: 50%;
/* 兼容老版本的方法 */
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
margin-top: 200rpx;
.empty_icon {
width: 325rpx;
height: 296rpx;
}
.empty_text {
font-size: 20rpx;
margin-top: 10rpx;
font-family: ArialMT;
color: #666666;
text-align: center;
}
.empty_button {
width: 128rpx;
height: 46rpx;
margin-top: 10rpx;
background: #006ECF;
border-radius: 10rpx;
text-align: center;
font-size: 20rpx;
color: #fff;
}
}
.msg_item { .msg_item {
width: 100%; width: 100%;
height: 116rpx; height: 116rpx;
......
...@@ -120,11 +120,13 @@ export default { ...@@ -120,11 +120,13 @@ export default {
User.getLocation((location) => { User.getLocation((location) => {
uni.removeStorageSync('shopCarInfo'); uni.removeStorageSync('shopCarInfo');
$EventBus.$emit('updateCar'); $EventBus.$emit('updateCar');
this.buyType = 'A'; // this.buyType = '1';
let id = decodeURIComponent(q).split('?')[1].split('=')[1]; let id = decodeURIComponent(q).split('?')[1].split('=')[1];
Menu.getScreenShopCar(id, location).then(res => { Menu.getScreenShopCar(id, location).then(res => {
const data = JSON.parse(res.data.data); const data = JSON.parse(res.data.data);
console.log(data);
this.shopData = data.shop; this.shopData = data.shop;
this.buyType = data.screenNo;
this.goods = data.goods.map(item => { this.goods = data.goods.map(item => {
const data = { ...item, skuId: item.sku.skuId, flag: true } const data = { ...item, skuId: item.sku.skuId, flag: true }
Utils.getallNum(data) Utils.getallNum(data)
......
{ {
"name": "user",
"lockfileVersion": 2,
"requires": true, "requires": true,
"lockfileVersion": 1, "packages": {
"": {
"dependencies": {
"uview-ui": "^2.0.31"
}
},
"node_modules/uview-ui": {
"version": "2.0.31",
"resolved": "https://registry.npmmirror.com/uview-ui/-/uview-ui-2.0.31.tgz",
"integrity": "sha512-I/0fGuvtiKHH/mBb864SGYk+SJ7WaF32tsBgYgeBOsxlUp+Th+Ac2tgz2cTvsQJl6eZYWsKZ3ixiSXCAcxZ8Sw==",
"engines": {
"HBuilderX": "^3.1.0"
}
}
},
"dependencies": { "dependencies": {
"uview-ui": { "uview-ui": {
"version": "2.0.31", "version": "2.0.31",
......
<template> <template>
<view class="pages"> <view class="pages">
<view v-show="false">{{userms}}</view>
<view class="empty" v-show="userms && empty == true">
<image class="empty_icon" src="/static/imgs/none_content.png"></image>
<view class="empty_text">---您还未下单,下单品尝一下吧---</view>
<button class="empty_button" @click="goHome">去品尝</button>
</view>
<view class="empty" v-show="!userms">
<image class="empty_icon" src="/static/imgs/none_content.png"></image>
<view class="empty_text">---您还未登录,请先登录---</view>
<button class="empty_button" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">去登录</button>
</view>
<view class="orders"> <view class="orders">
<view class="order_item" v-for="item in list" :key="item.id" @click="openInfo(item)"> <view class="order_item" v-for="item in list" :key="item.id" @click="openInfo(item)">
<view class="order_header"> <view class="order_header">
...@@ -65,12 +76,14 @@ ...@@ -65,12 +76,14 @@
import order from '@/request/order' import order from '@/request/order'
import Menu from '@/request/menu'; import Menu from '@/request/menu';
import Utils from '@/utils/utils' import Utils from '@/utils/utils'
import User from '@/request/user'
import { $EventBus } from "@/utils/EventBus"; import { $EventBus } from "@/utils/EventBus";
export default { export default {
name: 'order', name: 'order',
data() { data() {
return { return {
empty: false,
list: [] list: []
} }
}, },
...@@ -105,7 +118,12 @@ export default { ...@@ -105,7 +118,12 @@ export default {
if (!this.userms) return if (!this.userms) return
const { data } = await order.getMyOrder(); const { data } = await order.getMyOrder();
if (data) { if (data) {
this.list = data.rows this.list = data.rows;
if(this.list && this.list.length>0) {
this.empty = false;
} else {
this.empty = true;
}
} else { } else {
uni.showToast({ title: '请登录!', icon: 'error' }) uni.showToast({ title: '请登录!', icon: 'error' })
} }
...@@ -119,11 +137,21 @@ export default { ...@@ -119,11 +137,21 @@ export default {
} }
} }
}, },
goHome() {
uni.switchTab({ url: '/pages/menu/menu' });
},
// 手机号授权登录
getPhoneNumber(e) {
if (e.detail.errMsg == 'getPhoneNumber:ok') {
User.getPhoneNumber(e, this.getList);
} else if (e.detail.errMsg == "getPhoneNumber:fail user deny") {
uni.showToast({ title: '已拒绝手机号授权', icon: 'error' })
}
},
openInfo(data) { openInfo(data) {
uni.setStorageSync('orderInfo', data); uni.setStorageSync('orderInfo', data);
let url = '/orderSubPackage/pages/orderInfo/index' let url = '/orderSubPackage/pages/orderInfo/index'
uni.navigateTo({ url }) uni.navigateTo({ url })
}, },
jsonParse(json) { jsonParse(json) {
const data = json || {} const data = json || {}
...@@ -144,6 +172,39 @@ export default { ...@@ -144,6 +172,39 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.empty {
position: fixed;
/* 居中对齐begin */
left: 50%;
/* 兼容老版本的方法 */
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
margin-top: 200rpx;
.empty_icon {
width: 325rpx;
height: 296rpx;
}
.empty_text {
font-size: 20rpx;
margin-top: 10rpx;
font-family: ArialMT;
color: #666666;
text-align: center;
}
.empty_button {
width: 128rpx;
height: 46rpx;
margin-top: 10rpx;
background: #006ECF;
border-radius: 10rpx;
text-align: center;
font-size: 20rpx;
color: #fff;
}
}
.orders { .orders {
padding: 1rpx; padding: 1rpx;
......
...@@ -45,7 +45,7 @@ export default { ...@@ -45,7 +45,7 @@ export default {
return err; return err;
}); });
}, },
uniLogin(res) { uniLogin(res, callback) {
uni.login({ uni.login({
provider: 'weixin', provider: 'weixin',
success: function (data) { success: function (data) {
...@@ -66,6 +66,8 @@ export default { ...@@ -66,6 +66,8 @@ export default {
uni.setStorage({ key: 'userInfo', data: data }); uni.setStorage({ key: 'userInfo', data: data });
Store.commit('setUserInfo', data); Store.commit('setUserInfo', data);
Store.commit('setAuthorization', token); Store.commit('setAuthorization', token);
if(callback)
callback();
} }
}) })
.catch((err) => { .catch((err) => {
...@@ -85,11 +87,11 @@ export default { ...@@ -85,11 +87,11 @@ export default {
}); });
}, },
// 手机号授权登录 // 手机号授权登录
getPhoneNumber(res) { getPhoneNumber(res, callback) {
uni.setStorage({ key: 'userPhoneInfo', data: res }); uni.setStorage({ key: 'userPhoneInfo', data: res });
Store.commit('setUserPhoneInfo', res); Store.commit('setUserPhoneInfo', res);
uni.setStorage({ key: 'phoneInfo', data: res }); uni.setStorage({ key: 'phoneInfo', data: res });
this.uniLogin(res.detail); this.uniLogin(res.detail, callback);
}, },
setAllow(allow) { setAllow(allow) {
uni.$u.http uni.$u.http
......
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