修改页面
This commit is contained in:
@ -4,7 +4,7 @@
|
||||
<view class="flex1 u-line-1">
|
||||
<view class="lg bold-400 u-flex">
|
||||
<navigator class="u-flex" url="/pages/store/choose_store" hover-class="none">
|
||||
MEET轻食店
|
||||
时光煎饼店
|
||||
<u-icon name="arrow-right" size="28" class="right-icon"></u-icon>
|
||||
</navigator>
|
||||
</view>
|
||||
@ -66,7 +66,7 @@
|
||||
<view class="u-text-center">
|
||||
<navigator url="/pages/store/store?type=2" hover-class="none">
|
||||
<view class="text-default xxl">现在点单</view>
|
||||
<view class="xs text-999">下单更便捷</view>
|
||||
<view class="xs text-999">预约下单更便捷</view>
|
||||
<view class="u-flex u-row-center">
|
||||
<u-image :src="cloudPath + 'img/icon_order.png'" width="132" height="133" mode="aspectFit"></u-image>
|
||||
</view>
|
||||
|
||||
@ -6,19 +6,18 @@
|
||||
|
||||
<view class="u-text-center text-gray">
|
||||
<view>小程序需要登录注册才能使用相关功能,申请获取以下权限</view>
|
||||
<view class="u-m-t-20">获得你的公开信息(昵称、头像、手机号码等)</view>
|
||||
<!-- <view class="u-m-t-20">获得你的公开信息(昵称、头像、手机号码等)</view> -->
|
||||
</view>
|
||||
|
||||
<view class="u-m-t-56">
|
||||
<!-- #ifdef MP -->
|
||||
<view class="u-m-b-32">
|
||||
<!-- <view class="u-m-b-32">
|
||||
<u-button @click="mpLogin" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '16rpx 0'}" :hair-line="false" shape="circle">快捷登录</u-button>
|
||||
</view>
|
||||
</view> -->
|
||||
<!-- #endif -->
|
||||
<view>
|
||||
<u-button @click="mobileLogin" hover-class="none" :customStyle="{color: themeColor, border: '1px solid ' + themeColor, padding: '16rpx 0'}" :plain="true" :hair-line="false" shape="circle">手机号登录/注册</u-button>
|
||||
<u-button @click="mobileLogin" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '16rpx 0'}" :plain="true" :hair-line="false" shape="circle">手机号登录/注册</u-button>
|
||||
</view>
|
||||
|
||||
<!-- <u-button @click="testLogin" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '16rpx 0'}" :hair-line="false" shape="circle">测试账号一键登录</u-button> -->
|
||||
</view>
|
||||
|
||||
@ -141,13 +140,12 @@
|
||||
|
||||
// 更新新注册的用户信息
|
||||
async handleSubmitMobile(e) {
|
||||
mobileLogin({
|
||||
mobile: e.mobile
|
||||
}).then((res) => {
|
||||
if (res.code == 1) {
|
||||
this.loginHandle(res.data)
|
||||
}
|
||||
})
|
||||
console.log("🚀 ~ handleSubmitMobile ~ e:", e)
|
||||
const wxCode = await getWxCode()
|
||||
const res = await accountLogin({ account: e.mobile, code: wxCode, client })
|
||||
if (res.code == 1) {
|
||||
this.loginHandle(res.data)
|
||||
}
|
||||
},
|
||||
|
||||
// 登录结果处理
|
||||
|
||||
@ -80,7 +80,7 @@
|
||||
<view class="nr bold-600">服务功能</view>
|
||||
<view>
|
||||
<u-grid :col="4" :border="false">
|
||||
<u-grid-item v-for="(item, index) in menuList[1]['content']['data']" :key="index" @click="tapMenu(item.link.path)">
|
||||
<u-grid-item v-for="(item, index) in menuList" :key="index" @click="tapMenu(item.link)">
|
||||
<u-image :src="item.image" width="64" height="64"></u-image>
|
||||
<view class="grid-text mt10">{{item.name}}</view>
|
||||
</u-grid-item>
|
||||
@ -127,9 +127,7 @@
|
||||
type: 2
|
||||
})
|
||||
if (code == 1) {
|
||||
this.menuList = data
|
||||
console.log("this.menuList>>>", this.menuList);
|
||||
return false;
|
||||
this.menuList = data[1].content.data
|
||||
}
|
||||
},
|
||||
|
||||
@ -137,7 +135,7 @@
|
||||
tapMenu(path) {
|
||||
if (!this.isLogin) return toLogin()
|
||||
uni.navigateTo({
|
||||
url: path
|
||||
url: path.path
|
||||
})
|
||||
// menuJump(item)
|
||||
},
|
||||
|
||||
@ -2,7 +2,8 @@
|
||||
<view>
|
||||
<view class="u-m-t-34" @tap="chooseAvatar">
|
||||
<view class="row-center">
|
||||
<u-avatar :src="userInfo.avatar ? userInfo.avatar : cloudPath + 'img/icon_avatar_empty2.png'" size="142"></u-avatar>
|
||||
<u-avatar v-if="userInfo.avatar" :src="userInfo.avatar" size="142"></u-avatar>
|
||||
<u-icon v-if="!userInfo.avatar" name="account-fill" size="142"></u-icon>
|
||||
</view>
|
||||
<view class="nr text-default u-text-center u-m-t-16">
|
||||
点击更换头像
|
||||
@ -20,7 +21,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view class="nr row-between u-col-center u-m-t-48" @tap="changeMobile">
|
||||
<!-- <view class="nr row-between u-col-center u-m-t-48" @tap="changeMobile">
|
||||
<view style="width: 100rpx;">手机号</view>
|
||||
<view class="flex1 u-m-l-80 row u-row-between u-col-center">
|
||||
<view>{{formatPhone(userInfo.mobile)}}</view>
|
||||
@ -28,7 +29,7 @@
|
||||
<u-image :src="cloudPath + 'img/icon_arrow_right.png'" width="44" height="44"></u-image>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
</view>
|
||||
|
||||
<view class="fixed left-0 right-0 save">
|
||||
@ -56,6 +57,7 @@
|
||||
</view>
|
||||
</u-popup>
|
||||
|
||||
<mplogin v-model="mp.showPopup" :info-type="mp.type" @close="mp.showPopup = false" @update="handleSubmitInfo"/>
|
||||
<mobile-login v-model="mobile.showPopup" @close="mobile.showPopup = false" :hideCancleBtn="false" @update="updateMobile"/>
|
||||
</view>
|
||||
</template>
|
||||
@ -82,6 +84,10 @@
|
||||
},
|
||||
mobile: {
|
||||
showPopup: false,
|
||||
},
|
||||
mp: {
|
||||
showPopup: false,
|
||||
type: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -94,32 +100,42 @@
|
||||
uni.$on('uAvatarCropper', (path) => {
|
||||
this.uploadImage(path)
|
||||
})
|
||||
|
||||
console.log("🚀 ~ onLoad ~ userInfo:", this.userInfo)
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 修改头像
|
||||
chooseAvatar() {
|
||||
this.fieldType = FieldType.AVATAR
|
||||
uni.$u.route({
|
||||
// 关于此路径,请见下方"注意事项"
|
||||
url: '/components/uview-ui/components/u-avatar-cropper/u-avatar-cropper',
|
||||
// 内部已设置以下默认参数值,可不传这些参数
|
||||
params: {
|
||||
// 输出图片宽度,高等于宽,单位px
|
||||
destWidth: 300,
|
||||
// 裁剪框宽度,高等于宽,单位px
|
||||
rectWidth: 300,
|
||||
// 输出的图片类型,如果'png'类型发现裁剪的图片太大,改成"jpg"即可
|
||||
fileType: 'jpg'
|
||||
}
|
||||
})
|
||||
// uni.$u.route({
|
||||
// // 关于此路径,请见下方"注意事项"
|
||||
// url: '/components/uview-ui/components/u-avatar-cropper/u-avatar-cropper',
|
||||
// // 内部已设置以下默认参数值,可不传这些参数
|
||||
// params: {
|
||||
// // 输出图片宽度,高等于宽,单位px
|
||||
// destWidth: 300,
|
||||
// // 裁剪框宽度,高等于宽,单位px
|
||||
// rectWidth: 300,
|
||||
// // 输出的图片类型,如果'png'类型发现裁剪的图片太大,改成"jpg"即可
|
||||
// fileType: 'jpg'
|
||||
// }
|
||||
// })
|
||||
|
||||
// 选择头像
|
||||
this.mp.showPopup = true
|
||||
this.mp.type = 'avatar'
|
||||
},
|
||||
|
||||
// 修改昵称
|
||||
changeName() {
|
||||
this.fieldType = FieldType.NICKNAME
|
||||
this.nickname.value = ''
|
||||
this.nickname.showPopup = true
|
||||
// this.nickname.value = ''
|
||||
// this.nickname.showPopup = true
|
||||
|
||||
// 选择昵称
|
||||
this.mp.showPopup = true
|
||||
this.mp.type = 'nickname'
|
||||
},
|
||||
|
||||
// 确认修改昵称
|
||||
@ -196,15 +212,22 @@
|
||||
if (p) {
|
||||
return p.substring(0, 3) + '****' + p.substring(7)
|
||||
}
|
||||
|
||||
return ''
|
||||
},
|
||||
|
||||
handleSubmitInfo(e) {
|
||||
if (this.mp.type === 'avatar') {
|
||||
this.setUserInfo(e.avatar)
|
||||
} else if (this.mp.type === 'nickname') {
|
||||
this.setUserInfo(e.nickname)
|
||||
}
|
||||
},
|
||||
|
||||
save() {
|
||||
uni.switchTab({
|
||||
url: '/pages/my/my'
|
||||
})
|
||||
}
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapState(['token']),
|
||||
|
||||
@ -22,11 +22,13 @@
|
||||
},
|
||||
{
|
||||
name: '待付款',
|
||||
type: orderType.PAY
|
||||
type: orderType.PAY,
|
||||
count: 1
|
||||
},
|
||||
{
|
||||
name: '未制作',
|
||||
type: orderType.DELIVERY
|
||||
type: orderType.DELIVERY,
|
||||
count: 5
|
||||
},
|
||||
{
|
||||
name: '已完成',
|
||||
|
||||
@ -141,7 +141,7 @@
|
||||
<view>2022-11-10 15:26:07</view>
|
||||
</view>
|
||||
<view class="u-m-t-8 row-between">
|
||||
<view>发货时间:</view>
|
||||
<view>取餐时间:</view>
|
||||
<view>2022-11-10 15:26:07</view>
|
||||
</view>
|
||||
</view>
|
||||
@ -154,14 +154,14 @@
|
||||
<!-- <u-button class="flex1" @click="mpLogin" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '16rpx 0'}" :hair-line="false">立即支付</u-button> -->
|
||||
</view>
|
||||
|
||||
<view class="fixed row-end u-text-center btn-group bg-white u-p-t-20" v-if="orderDetail.order_status > 0">
|
||||
<!-- <view class="fixed row-end u-text-center btn-group bg-white u-p-t-20" v-if="orderDetail.order_status > 0">
|
||||
<view class="mr20">
|
||||
<u-button @click="mobileLogin" hover-class="none" :customStyle="{width: '160rpx', height: '60rpx', color: themeColor, border: '1px solid ' + themeColor, padding: '16rpx 0', borderRadius: '8rpx'}" :plain="true" :hair-line="false">查看物流</u-button>
|
||||
</view>
|
||||
<view class="u-m-r-34">
|
||||
<u-button @click="mpLogin" hover-class="none" :customStyle="{width: '160rpx', height: '60rpx', backgroundColor: themeColor, color: '#fff', border: 'none', padding: '16rpx 0', borderRadius: '8rpx'}" :hair-line="false">确认收货</u-button>
|
||||
</view>
|
||||
</view>
|
||||
</view> -->
|
||||
<order-dialog ref="orderDialog" :orderId="orderDetail.id" :type="type" @refresh="onRefresh"></order-dialog>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@ -448,10 +448,9 @@ export default {
|
||||
|
||||
try {
|
||||
const { code, data, msg } = await orderBuy(from)
|
||||
|
||||
if (code == 1) {
|
||||
uni.redirectTo({
|
||||
url: `/pages/payment/payment?from=${data.type}&order_id=${data.order_id}`
|
||||
url: `/pages/payment/payment?from=${data.data.type}&order_id=${data.data.order_id}`
|
||||
})
|
||||
} else {
|
||||
throw new Error(msg)
|
||||
|
||||
@ -93,7 +93,7 @@
|
||||
<view>2022-11-10 15:26:07</view>
|
||||
</view>
|
||||
<view class="u-m-t-8 row-between">
|
||||
<view>发货时间:</view>
|
||||
<view>取餐时间:</view>
|
||||
<view>2022-11-10 15:26:07</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
@ -62,11 +62,15 @@
|
||||
</view>
|
||||
|
||||
<view class="fixed bg-white row-between px48 u-p-t-20 u-p-b-20">
|
||||
<view class="column u-text-center">
|
||||
<view class="column u-text-center u-relative" @click="addCartFun">
|
||||
<view class="row-center">
|
||||
<u-image :src="cloudPath + 'img/icon_store.png'" width="48" height="48"></u-image>
|
||||
<!-- <u-image src="/static/tabbar/tab_cart.png" width="48" height="48"></u-image> -->
|
||||
<u-icon name="shopping-cart" size="48" color="#254062"></u-icon>
|
||||
</view>
|
||||
<view>购物车</view>
|
||||
<view class="u-absolute top-0 right-0 text-fff number u-text-center xxs" v-if="cartNum">
|
||||
{{ cartNum }}
|
||||
</view>
|
||||
<view>门店</view>
|
||||
</view>
|
||||
<view class="u-m-l-64 flex1">
|
||||
<u-button hover-class="none" @click="showSpecFun"
|
||||
@ -78,13 +82,18 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<shop-spec v-model="showSpec" :name="goods.name" :goods="goods" @close="showSpec = false" @confirm="confirmSpec" @buynow="onBuy"></shop-spec>
|
||||
<shop-spec v-model="showSpec" :name="goods.name" :goods="goods" @close="closePopup" @confirm="confirmSpec" @buynow="onBuy"></shop-spec>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapActions,
|
||||
mapGetters
|
||||
} from 'vuex';
|
||||
import {
|
||||
getGoodsDetail,
|
||||
getCartList,
|
||||
addCart,
|
||||
getPoster,
|
||||
getCartNum
|
||||
@ -101,6 +110,9 @@
|
||||
goods: [],
|
||||
spec: [],
|
||||
checkedGoods: {},
|
||||
source: '',
|
||||
cartLists: [],
|
||||
totalPrice: 0,
|
||||
}
|
||||
},
|
||||
|
||||
@ -110,9 +122,13 @@
|
||||
|
||||
onShow() {
|
||||
this.getGoodsDetailFun();
|
||||
this.getCartNum()
|
||||
this.getCartListFun()
|
||||
},
|
||||
|
||||
methods: {
|
||||
...mapActions(['getCartNum']),
|
||||
|
||||
// 获取商品详情
|
||||
async getGoodsDetailFun() {
|
||||
const {
|
||||
@ -124,10 +140,44 @@
|
||||
if (code == 1) {
|
||||
this.goods = data
|
||||
console.log(this.goods.goods_image);
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
// 获取购物车列表数据
|
||||
getCartListFun() {
|
||||
// 获取商品的分类ID
|
||||
getCartList().then((res) => {
|
||||
if (res.code == 1) {
|
||||
let {
|
||||
lists,
|
||||
total_amount
|
||||
} = res.data;
|
||||
this.cartLists = lists;
|
||||
// // let cartType = 0;
|
||||
|
||||
// // if (lists.length == 0) {
|
||||
// // cartType = 2;
|
||||
// // } else {
|
||||
// // cartType = 1;
|
||||
// // }
|
||||
|
||||
// this.cartLists = list;
|
||||
// console.log(">>>", this.cartLists);
|
||||
|
||||
// // this.cartType = cartType;
|
||||
this.totalPrice = total_amount
|
||||
// // this.isShow = true;
|
||||
this.getCartNum();
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 将当前的商品添加到购物车里面
|
||||
addCartFun() {
|
||||
this.source = 'cart'
|
||||
this.showSpec = true
|
||||
},
|
||||
|
||||
// 打开商品规格
|
||||
openSpec() {
|
||||
this.showSpec = true
|
||||
@ -138,6 +188,7 @@
|
||||
console.log("data>>>", data.spec);
|
||||
this.spec = data.spec
|
||||
this.showSpec = false
|
||||
this.source = ''
|
||||
},
|
||||
|
||||
onChangeGoods(e) {
|
||||
@ -151,17 +202,46 @@
|
||||
this.showSpec = true;
|
||||
},
|
||||
|
||||
closePopup() {
|
||||
this.source = ''
|
||||
},
|
||||
|
||||
// 购买商品
|
||||
onBuy(e) {
|
||||
let {id, goodsNum} = e.detail
|
||||
let goods = [{item_id: id, num: goodsNum}]
|
||||
const params = {goods}
|
||||
this.showSpec = false
|
||||
uni.navigateTo({
|
||||
url: '/pages/order_now/order_now?data=' + encodeURIComponent((JSON.stringify(params)))
|
||||
})
|
||||
if (this.source === 'cart') {
|
||||
// 限购逻辑:套餐和单品内的商品列表,每个都是只能购买两个
|
||||
console.log("🚀 ~ onBuy ~ this.goods:", this.goods)
|
||||
if (this.goods.first_category_id == 1 || this.goods.first_category_id == 2) {
|
||||
const totalNum = this.cartLists
|
||||
.filter(i => i.first_category_id === this.goods.first_category_id)
|
||||
.reduce((sum, i) => sum + (i.goods_num || 0), 0);
|
||||
|
||||
if (totalNum >= 2) {
|
||||
this.$toast({ title: '该类商品每人限购2件' });
|
||||
return;
|
||||
} else {
|
||||
addCart({
|
||||
item_id: this.goods.id,
|
||||
goods_num: 1
|
||||
}).then(res => {
|
||||
this.getCartListFun()
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let {id, goodsNum} = e.detail
|
||||
let goods = [{item_id: id, num: goodsNum}]
|
||||
const params = {goods}
|
||||
this.showSpec = false
|
||||
uni.navigateTo({
|
||||
url: '/pages/order_now/order_now?data=' + encodeURIComponent((JSON.stringify(params)))
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['cartNum']),
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -183,4 +263,13 @@
|
||||
right: 0;
|
||||
padding-bottom: env(safe-area-inset-bottom);
|
||||
}
|
||||
|
||||
.number {
|
||||
background-color: #FF2C3C;
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
line-height: 40rpx;
|
||||
border-radius: 100%;
|
||||
}
|
||||
|
||||
</style>
|
||||
@ -155,7 +155,7 @@
|
||||
.signin {
|
||||
height: 570rpx;
|
||||
margin: 24rpx 20rpx 0;
|
||||
background-image: url(http://jianbing-media.stnav.com/frontend/img/signin-bg.png);
|
||||
background-image: url(https://jianbing-media.stnav.com/frontend/img/signin-bg.png);
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
|
||||
|
||||
@ -19,6 +19,9 @@
|
||||
<u-button shape="circle" :hair-line="false" hover-class="none" :customStyle="{backgroundColor: themeColor, color: '#fff', border: 'none', padding: '36rpx'}" @click="signin">自取</u-button>
|
||||
</view>
|
||||
</view>
|
||||
<view class="">
|
||||
<u-alert-tips type="warning" title="当前门店已休息"></u-alert-tips>
|
||||
</view>
|
||||
<cate-one :list="cateList"></cate-one>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user