更改首页

This commit is contained in:
魏啾
2024-07-05 18:26:46 +08:00
parent a40cfd9c5f
commit 380a6312f8
19 changed files with 3841 additions and 1179 deletions

View File

@@ -63,6 +63,7 @@ class webSocketUtils {
this.canReconnect = true;
clearInterval(this.heartbeatInterval);
clearInterval(this.reconnectTimeOut);
try {
if (this.connectNum <= 10) {
// uni.showLoading({
// title: `网络连接失败,正尝试第${this.connectNum}次连接`,
@@ -91,6 +92,9 @@ class webSocketUtils {
uni.hideLoading()
}, 1000)
}
} catch (e) {
//TODO handle the exception
}
});
// 这里仅是事件监听【如果socket关闭了会执行】
this.socketTask.onClose(() => {

View File

@@ -0,0 +1,181 @@
<template>
<view class="l-barrage">
<block v-for="(item,index) in items" :key="index">
<!-- #ifdef H5 -->
<text v-if="item.display" class="aon" :style="{top: `${item.top}%`,color: item.color}">
{{item.text}}
</text>
<!-- #endif -->
<!-- #ifndef H5 -->
<!-- <text v-if="item.display" class="aon"
:style="{top: `${item.top}%`,color: item.color,
animation: `mymove ${Number(item.time)}s linear forwards`
}"
>
{{item.text}}
</text> -->
<view v-if="item.display" class="aon"
style=" display: flex;justify-content: center;align-items: center; background-color: #000; padding:10rpx; border-radius: 10rpx;"
:style="{top: `${item.top}%`,
animation: `mymove ${Number(item.time)}s linear forwards`
}">
<image style="width: 50rpx; height: 50rpx;border-radius: 50%;" :src="avatar"
mode="aspectFill"></image>
<text style="color: #fff;">
{{item.text}}
</text>
</view>
<!-- #endif -->
</block>
</view>
</template>
<script>
let cycle;
// 弹幕字体颜色
function getRandomColor() {
let rgb = []
for (let i = 0; i < 3; ++i) {
let color = Math.floor(Math.random() * 256).toString(16)
color = color.length == 1 ? '0' + color : color
rgb.push(color)
}
return '#' + rgb.join('')
}
export default {
name: 'l-barrage',
props: {
minTime: {
type: Number,
default: 4
},
maxTime: {
type: Number,
default: 9
},
minTop: {
type: Number,
default: 8
},
maxTop: {
type: Number,
default: 16
},
avatar:{
type:String,
default:'@/static/1.gif'
}
},
data() {
return {
items: [],
userInfo: uni.cache.get('userInfo'), //个人信息
}
},
methods: {
add(text = '', time = Math.ceil(Math.floor(Math.random() * (this.maxTime - this.minTime + 1) + this
.minTime))) {
this.items.push({
text,
time,
top: Math.ceil(Math.random() * (this.maxTop - this.minTop + 1) + this.minTop),
color: getRandomColor(),
display: 1,
});
},
start(items = []) {
this.items = [];
cycle && (clearInterval(cycle));
let i = 0,
len = items.length;
cycle = setInterval(() => {
let time = 5;
// #ifndef H5
time = Math.ceil(Math.floor(Math.random() * (this.maxTime - this.minTime + 1) + this.minTime));
// #endif
if (i < len) {
this.add(items[i], time);
i++;
} else {
clearInterval(cycle);
setTimeout(() => {
this.$emit("end", {});
}, time * 1000)
}
}, 500)
}
}
}
</script>
<style>
.aon {
position: fixed;
white-space: nowrap;
animation: mymove 5s linear forwards;
animation-timing-function: linear;
-webkit-animation-timing-function: linear;
animation-fill-mode: forwards;
}
.l-barrage {
z-index: 99;
width: 100%;
position: fixed;
}
@keyframes mymove {
from {
left: 100%;
}
to {
left: -200%;
}
}
@-moz-keyframes mymove
/* Firefox */
{
from {
left: 100%;
}
to {
left: -200%;
}
}
@-webkit-keyframes mymove
/* Safari and Chrome */
{
from {
left: 100%;
}
to {
left: -200%;
}
}
@-o-keyframes mymove
/* Opera */
{
from {
left: 100%;
}
to {
left: -200%;
}
}
</style>

View File

@@ -1,41 +0,0 @@
# 测试发现h5不支持
## 如何使用
```
<template>
<view class="barrage-test">
<vastwu-barrage width="750rpx" height="1300rpx" ref="vBarrage"></vastwu-barrage>
</view>
</template>
<script>
const list = ['模拟弹幕效果','宽度如要修改请留意动画是从750rpx到-100%','高度默认100%','随机颜色','随机速度','图标可设置','图标大小可控','可自定义高度轨道','高度轨道数组多长,一屏幕就能播多少列','高度不够不会显示','欢迎使用','不会重叠']
import vastwuBarrage from '@/components/vastwu-barrage/vastwu-barrage.vue'
export default {
components:{vastwuBarrage},
data() {
return {}
},
onLoad() {
this.$refs.vBarrage.init(list)
},
methods: {}
}
</script>
<style>
.barrage-test{
background-color: #C0C0C0
}
</style>
```
## 参数说明
|参数|类型|默认|说明|
|:-|:-:|-:|-:|
|trackList|Array|[0,100,200,300,400,500,600,700,800,900,1000]|自定义弹幕轨道,值为距离容器顶部的距离,可根据图标高度自行调整|
|icon|String|![默认图](https://vkceyugu.cdn.bspapp.com/VKCEYUGU-d0fe8d48-ece3-4582-a195-6929fb47a9c5/43a4f7a7-ff65-4460-b774-1249f31fbef7.png)|默认图标|
|iconWidth|String|62rpx|图标宽度|
|iconHeight|String|'86rpx'|图标高度|
|minTime|Number|7|最短过渡时间|
|maxTime|Number|10|最长过渡时间|
|width|String|'100%'|容器宽度|
|height|String|'100%'|容器高度|

View File

@@ -16,10 +16,10 @@ const baseUrlwws = 'ws://cashier.sxczgkj.cn/cashierService'
// #endif
// #ifdef APP || MP-WEIXIN
const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上
const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
// const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
// const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
// const baseUrl = debug ? proxyApi : 'https://cashier.sxczgkj.cn/cashierService' // 线上、、
// const baseUrlwws = debug ? proxyApiwws : 'wss://cashier.sxczgkj.cn/netty' // 线上
const baseUrl = 'https://cashier.sxczgkj.cn/cashierService' // 线上
const baseUrlwws = 'wss://cashier.sxczgkj.cn/netty' // 线上/
// #endif
// import VConsole from "./vConsole.js"

View File

@@ -1,9 +0,0 @@
{
"devDependencies": {
"sass": "^1.69.5",
"sass-loader": "^13.3.2"
},
"dependencies": {
"lodash": "^4.17.21"
}
}

View File

@@ -94,6 +94,12 @@
"navigationBarTitleText": "订单详情"
}
},
{
"path": "pages/order_detail/indexs",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"path": "pages/order/successful",
"style": {

View File

@@ -1,266 +0,0 @@
<template>
<view>
<view class="banner-wrap">
<u-swiper :list="banners" height="440" radius="0" :indicator="banners.length > 1"
imgMode="widthFix"></u-swiper>
</view>
<view class="container">
<view class="user-info">
<view class="top">
<view class="col">
<view style="width: 36px; height: 36px;border-radius: 10rpx;">
<button open-type="chooseAvatar" @chooseavatar='onChooseAvatar'
style="padding: 0;margin: 0; width: 36px; height: 36px;border-radius: 10rpx;">
<image style="width: 36px; height: 36px;" v-if="userInfo.avatar" :src="userInfo.avatar" mode="aspectFill">
</image>
<image style="width: 36px; height: 36px;" v-else src="@/static/avatar.png" mode="aspectFill">
</image>
</button>
</view>
<text class="t">{{userInfo.nickName}}</text>
</view>
<navigator class="ewm-wrap" url="/pages/pay_code/pay_code" hover-class="none">
<image class="ewm" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/ewm.png" mode="aspectFit"></image>
<text class="t">会员码</text>
</navigator>
</view>
<view class="bottom">
<view class="col">
<text class="t1 num">{{shopUser.amount || '0'}}</text>
<text class="t2">余额</text>
</view>
<view class="col">
<text class="t1 num">{{shopUser.levelConsume || '0'}}</text>
<text class="t2">积分</text>
</view>
</view>
</view>
<view class="menu-wrap">
<view class="top-wrap">
<view class="item" @click="scanCodehandle">
<image class="bg" src="../../static/index_m2.png" mode="widthFix"></image>
<view class="btn">
<text class="t">扫码点餐</text>
</view>
</view>
<view class="item" @click="memberindex">
<image class="bg" src="../../static/index_m1.png" mode="widthFix"></image>
<view class="btn">
<text class="t">会员充值</text>
</view>
</view>
</view>
</view>
<view class="footer-banner">
<u-swiper :list="footerBanners" radius="20" height="160" :indicator="banners.length > 1"
imgMode="widthFix"></u-swiper>
</view>
</view>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
banners: [require('@/static/banner1.png')],
footerBanners: [require('@/static/footer_banner1.png')],
userInfo: {},
shopInfo:{}
};
},
onLoad() {
// #ifdef MP-WEIXIN
if (!uni.cache.get('token')) {
uni.reLaunch({
url: '/pages/login/login'
})
}
// #endif
},
onShow() {
if (uni.cache.get('token')) {
this.loginwxuserInfo()
}else{
uni.reLaunch({
url: '/pages/login/login'
})
}
},
methods: {
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id,
shopId: uni.cache.get('shopUser')
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data.userInfo);
uni.cache.set('shopUser', res.data.shopUser);
uni.cache.set('shopInfo', res.data.shopInfo);
this.shopUser = uni.cache.get('shopUser')
this.userInfo = uni.cache.get('userInfo')
this.shopInfo = uni.cache.get('shopInfo')
}
},
scanCodehandle() {
uni.scanCode({
success: (res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
if (tableCode) {
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
})
}
}
})
},
memberindex() {
uni.pro.navigateTo('member/index')
},
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
// / 更换头像
onChooseAvatar(e) {
uni.showLoading({
title: '上传中',
mask: true
})
console.log(e.detail.avatarUrl)
let file = e.detail.avatarUrl;
uploadImage(file, 'avatar',
result => {
//将上传后的图片以对象官方要求的格式的形式存入uni-file-picker的value值imageValueimageValue值的结构为数组包对象用于图片回显
// let objAge = {
// 'url': result,
// 'extname': 'png',
// 'name': 'imgss.png'
// };
// this.userlist.avatar.push(objAge)
this.userInfo.avatar = result
console.log(this.userInfo.avatar)
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
}
};
</script>
<style scoped lang="scss">
.container {
padding: 40upx;
}
.user-info {
background-color: #fff;
padding: 40upx;
border-radius: 20upx;
.top {
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1upx solid #ececec;
padding-bottom: 42upx;
.col {
display: flex;
align-items: center;
.t {
margin-left: 20upx;
}
}
.ewm-wrap {
display: flex;
flex-direction: column;
align-items: center;
.ewm {
$size: 50upx;
width: $size;
height: $size;
}
.t {
font-size: 20upx;
padding-top: 8upx;
}
}
}
.bottom {
padding-top: 40upx;
display: flex;
.col {
flex: 1;
display: flex;
align-items: center;
flex-direction: column;
.t1 {
font-size: 38upx;
}
}
}
}
.menu-wrap {
padding: 40upx 0 0 0;
$gap: 20upx;
.top-wrap {
display: flex;
gap: $gap;
.item {
flex: auto;
display: flex;
align-items: center;
flex-direction: column;
background-color: #fff;
border-radius: 20upx;
position: relative;
.bg {
width: 100%;
height: auto;
border-radius: $gap;
}
.btn {
margin-top: $gap;
padding: $gap $gap * 2;
border-radius: 100upx;
display: flex;
justify-content: center;
font-size: 32upx;
background-color: #fff;
box-shadow: 0 12upx 12upx rgba(0, 0, 0, 0.05);
position: absolute;
bottom: $gap * 2;
left: 50%;
transform: translateX(-50%);
white-space: nowrap;
}
}
}
}
.footer-banner {
padding-top: 20upx;
}
</style>

View File

@@ -1,5 +1,6 @@
<template>
<view class="content">
<view v-if="showindex">
<!-- 导航栏 -->
<view class="navbar" :class="{active:opacity}">
<!-- #ifndef APP-PLUS || MP-WEIXIN -->
@@ -23,15 +24,16 @@
size="16"></u-icon>
</view>
<view class="navbar_tow_tow flex-start">
<input type="text" class="navbar_tow_towinput" v-model="keyword" placeholder="请输入关键字" />
<input type="text" class="navbar_tow_towinput" v-model="keyword"
placeholder="请输入关键字" />
<view class="navbar_tow_towview">搜索</view>
</view>
</view>
</view>
<!-- 吸顶 -->
<view v-if="isFixedTop" class="fourcontent flex-between">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu" :key="index"
@click="viewHistory(item,index)"
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu"
:key="index" @click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text>{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 8rpx;" name="arrow-down-fill"
@@ -53,8 +55,8 @@
<view class="fourcontent">
<!-- 用于防止榻卸 -->
<view class="flex-between" style="flex-wrap: inherit;" v-if="!isFixedTop">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu" :key="index"
@click="viewHistory(item,index)"
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu"
:key="index" @click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text style="margin-right: 10rpx;">{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 10rpx;" name="arrow-down-fill"
@@ -129,7 +131,8 @@
</view>
</view>
<view class="indexboxitemleftthere_countdown flex-between">
<text class="indexboxitemleftthere_countdowntext">共省{{item.save}}</text>
<text
class="indexboxitemleftthere_countdowntext">共省{{item.save}}</text>
<view class="indexboxitemleftthere_countdowntexts">
<uni-countdown @timeup="updateCity" :show-day="false"
:day="item.end_times.d" :hour="item.end_times.h"
@@ -174,8 +177,8 @@
<view class="navbar_tow_one flex-start" @click="uindexlist">
<text class="textnth-childone">{{NAME}}</text>
<text class="textnth-childtow">{{form.address}}</text>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill" color="#333333"
size="16"></u-icon>
<u-icon style="margin-left: 8rpx;" name="arrow-down-fill"
color="#333333" size="16"></u-icon>
</view>
<view class="navbar_tow_tow flex-start">
<input type="text" class="navbar_tow_towinput" v-model="keyword"
@@ -186,20 +189,23 @@
</view>
<!-- 吸顶 -->
<view class="fourcontent flex-between">
<view class="fourcontent_item flex-start" v-for="(item,index) in hometoplist.menu"
:key="index" @click="viewHistory(item,index)"
<view class="fourcontent_item flex-start"
v-for="(item,index) in hometoplist.menu" :key="index"
@click="viewHistory(item,index)"
:class="!item.isChild && viewHistoryindex == index ? 'fourcontent_itemactev':''">
<text>{{item.name}}</text>
<u-icon v-if="item.isChild" style="margin-left: 10rpx;" name="arrow-down-fill"
color="#333333" size="16"></u-icon>
<u-icon v-if="item.isChild" style="margin-left: 10rpx;"
name="arrow-down-fill" color="#333333" size="16"></u-icon>
</view>
</view>
<!-- 显示下拉字段 -->
<view class="sixcontent" v-if="clickhometoplistmenulist.quilt == '1' ">
<view class="sixcontentitemP flex-start" style="padding-bottom:0 ;">
<category style="width: 100%;" :categoryList="clickhometoplistmenulist.detail"
:subCategoryList="subCategoryList" @categoryMainClick="categoryMainClick"
<category style="width: 100%;"
:categoryList="clickhometoplistmenulist.detail"
:subCategoryList="subCategoryList"
@categoryMainClick="categoryMainClick"
@categorySubClick="categorySubClick">
</category>
</view>
@@ -218,6 +224,9 @@
</view>
</u-popup>
</view>
<indexs v-if="!showindex" :usershopUserinfo='usershopUserinfo'></indexs>
</view>
</template>
<script>
@@ -228,6 +237,7 @@
import advertisement from './components/advertisement.vue'
import customSwiper from '@/components/blackmonth-swiper/index'
import category from '@/components/qiyue-category/qiyue-category.vue';
import indexs from './indexs.vue';
export default {
components: {
swipers,
@@ -236,10 +246,12 @@
productlist,
advertisement,
category,
customSwiper
customSwiper,
indexs
},
data() {
return {
showindex: false,
NAME: uni.cache.get('NAME'),
timersetInterval: '0', //定时器
isFixedTop: false, //吸顶是否显示
@@ -276,7 +288,9 @@
clickdetailtowlist: [],
// 二级菜单
categoryList: [],
subCategoryList: [] //二级菜单数据
subCategoryList: [], //二级菜单数据
// 登录后店铺信息
usershopUserinfo:{}
};
},
@@ -314,7 +328,19 @@
onReachBottom() {
this.onLoadhome()
},
onShow() {
async onShow() {
// 判断显示那个页面
if (uni.cache.get('shopUser') && uni.cache.get('token')) {
this.showindex = false
uni.cache.set('types', 'index');
let res = await this.api.shopUserInfo({
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.usershopUserinfo = res.data
}
} else {
uni.getLocation({
type: 'wgs84',
success: async (res) => {
@@ -338,7 +364,7 @@
}
},
fail: async (err) => {
console.log(err, '获取错误')
console.log(err, '获取错误') //测试用于app
let successres = await this.api.geocodelocation({
lng: '',
lat: '',
@@ -346,8 +372,6 @@
if (successres.code == 0) {
console.log(successres.data.addressComponent.streetNumber.location.split(','))
let res = successres.data.addressComponent.streetNumber.location.split(',')
// this.form.lng = res[0]
// this.form.lat = res[1]
let datastorage = {
country: successres.data.addressComponent.country, // "中国"
province: successres.data.addressComponent.province, //province: "陕西省"
@@ -363,7 +387,8 @@
}
}
});
this.showindex = true
}
},
methods: {
closeproductlist() {

273
pages/index/indexs.vue Normal file
View File

@@ -0,0 +1,273 @@
<template>
<view>
<u-swiper :list="banners" height="460" radius="0" :indicator="banners.length > 1" imgMode="widthFix"></u-swiper>
<view class="container">
<view class="after"></view>
<view class="onecontent flex-between">
<view class="onecontentone flex-start">
<image :src="userInfo.headImg" mode="aspectFill">
<text>{{userInfo.nickName || '无'}}</text>
</view>
<view class="onecontenttow flex-start">
<view class="onecontenttowring flex-colum" @click="memberindex(0)">
<text class="onecontenttowringone">{{usershopUserinfo.amount || '0.00'}}</text>
<text class="onecontenttowringtow">余额</text>
</view>
<!-- <view class="onecontenttowring flex-colum">
<text class="onecontenttowringone">282</text>
<text class="onecontenttowringtow">积分</text>
</view> -->
<view class="onecontenttowring flex-colum" @click="memberindex(1)">
<image class="onecontenttowringone image"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/rwm.png" mode="aspectFill">
</image>
<text class="onecontenttowringtow">会员码</text>
</view>
</view>
</view>
<view class="towcontent flex-between">
<view class="towcontentitem flex-colum" @click="scanCodehandle(0)">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/Instore.png" mode="widthFix"
style="width: 86.88rpx; height: 140.94rpx;"></image>
<text class="towcontentitemtext">店内就餐</text>
</view>
<view class="towcontentitem flex-colum" @click="scanCodehandle(1)">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/takeaway.png" mode="widthFix"
style="width: 128.05rpx; height: 120.41rpx;"></image>
<text class="towcontentitemtext">点个外卖</text>
</view>
</view>
<view class="footer-banner">
<!-- <u-swiper :list="footerBanners" radius="20" height="274" :indicator="banners.length > 1"
imgMode="widthFix"></u-swiper> -->
</view>
</view>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
export default {
data() {
return {
banners: ['https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/banner1.png'],
footerBanners: ['https://czg-qr-order.oss-cn-beijing.aliyuncs.com/index/footer_banner1.png'],
userInfo: uni.cache.get('userInfo'),
};
},
props: {
usershopUserinfo: {
type: Object,
default () {
return {
amount:'',
shopName: ""
}
}
},
},
methods: {
scanCodehandle(i) {
if (i == 0) {
uni.scanCode({
success: (res) => {
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
uni.pro.navigateTo('order_food/order_food')
}
// let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
// if (tableCode) {
// uni.pro.navigateTo('order_food/order_food', {
// tableCode: tableCode,
// })
// }
}
})
// uni.navigateTo({
// url:'/pages/order_food/order_food'
// })
} else {
uni.showToast({
title: '此店铺暂未开通外卖',
icon: 'none'
})
}
},
memberindex(i) {
if (i == 0) {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: uni.cache.get('shopUser'),
})
} else {
// uni.pro.navigateTo('pay_code/pay_code?shopInfo=', {
// shopName: this.usershopUserinfo.shopName,
// amount: this.usershopUserinfo.amount,
// shopId: uni.cache.get('shopUser')
// })
let data = {
shopName: this.usershopUserinfo.shopName,
amount: this.usershopUserinfo.amount,
shopId: uni.cache.get('shopUser')
}
uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(data)
})
}
},
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
// / 更换头像
onChooseAvatar(e) {
uni.showLoading({
title: '上传中',
mask: true
})
console.log(e.detail.avatarUrl)
let file = e.detail.avatarUrl;
uploadImage(file, 'avatar',
result => {
//将上传后的图片以对象官方要求的格式的形式存入uni-file-picker的value值imageValueimageValue值的结构为数组包对象用于图片回显
// let objAge = {
// 'url': result,
// 'extname': 'png',
// 'name': 'imgss.png'
// };
// this.userlist.avatar.push(objAge)
this.userInfo.avatar = result
console.log(this.userInfo.avatar)
uni.hideLoading()
}, result => {
uni.hideLoading()
})
},
}
};
</script>
<style scoped lang="scss">
page {
background: #F6F8FA;
}
.container {
border-radius: 0 0 0 40rpx;
position: relative;
padding: 0 28rpx;
.after {
position: absolute;
top:46rpx;
right: 0;
width: 40rpx;
height: 40rpx;
line-height: 40rpx;
text-align: center;
background-image: radial-gradient(160rpx at 0px 0px, rgba(0, 0, 0, 0) 40rpx, #f9f9f9 40rpx);
}
.onecontent {
width: 100%;
margin-top: -86rpx;
position: relative;
height: 172rpx;
background: #FFFFFF;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
border-radius: 14rpx;
padding: 0 30rpx;
.onecontentone {
image {
width: 108rpx;
height: 108rpx;
background: #FFFFFF;
border: 2rpx solid #707070;
border-radius: 50%;
}
text {
margin-left: 12rpx;
width: 146rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
}
.onecontenttow {
.onecontenttowring {
margin-left: 32rpx;
height: 110rpx;
justify-content: flex-end;
.onecontenttowringone {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #333333;
}
.image {
width: 42rpx;
height: 42rpx;
}
.onecontenttowringtow {
margin-top: 20rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #666666;
}
}
}
}
.towcontent {
margin-top: 48rpx;
position: relative;
width: 100%;
background: #FFFFFF;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0, 0, 0, 0.16);
border-radius: 14rpx 14rpx 14rpx 14rpx;
height: 314rpx;
padding: 0 90rpx 0 120rpx;
&::after {
position: absolute;
content: '';
display: inline-block;
height: 188rpx;
width: 2rpx;
left: 50%;
margin-left: -1rpx;
background: #D8D8D8;
}
.towcontentitem {
.towcontentitemtext {
margin-top: 26rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
}
}
.footer-banner {
margin-top: 48upx;
}
}
</style>

View File

@@ -0,0 +1,605 @@
<template>
<view class="container">
<view class="card">
<view class="head">
<text class="title">
<text>{{listinfo.name}}</text>
</text>
<text class="status" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<text> 待支付 </text>
</text>
<text class="status" v-if="listinfo.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="listinfo.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="listinfo.status == 'send'">
<text> 已发</text>
</text>
<text class="status" v-if="listinfo.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="listinfo.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="listinfo.status == 'cancelled'">
<text>已取消</text>
</text>
<text class="status" v-if="listinfo.status == 'merge'">
<text>合台</text>
</text>
</view>
<view class="tag-wrap">
<text class="tag" v-if="listinfo.sendType == 'post'">快递</text>
<text class="tag" v-if="listinfo.sendType == 'takeaway'">外卖</text>
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<view v-if="listinfo.tableName">
桌号{{listinfo.tableName}}
</view>
<view class="number-wrap" style="margin-top: 20rpx;"
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.outNumber}}</text>
</view>
</view>
<view class="card">
<view class="head border" style="position: relative;">
<text class="title">
<text>点单详情</text>
</text>
<view style="display: flex;align-items: center;"
v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<!-- <text style="font-size:24rpx;">支付时间:</text> -->
<uni-countdown :show-day="false" color="#ff0000" border-color="#00B26A" splitorColor="#000"
:font-size="14" :hour="0" :minute="listinfo.expiredMinutes" :second="listinfo.expiredSeconds" />
</view>
</view>
<view class="shop-info">
<view class="item" v-for="(item,index) in listinfo.details" :key="index">
<view class="cover">
<c-image width="120" height="120" radius="16" :src='item.productImg'></c-image>
</view>
<view class="info">
<text>{{item.productName}}</text>
<text class="n" v-if="item.productSkuName">{{item.productSkuName}}</text>
<text class="n">x{{item.num}}</text>
</view>
<view class="price">
<text class="i"></text>
<text class="num">{{item.priceAmount}}</text>
</view>
</view>
</view>
<view class="total-wrap">
<view class="price">
<text>合计</text>
<text class="i"></text>
<text class="num">{{listinfo.payAmount}}</text>
</view>
</view>
</view>
<view class="card">
<view class="head border">
<text class="title">订单信息</text>
</view>
<view class="order-info">
<view class="row" @click="copyHandle(listinfo.orderNo)">
<text class="t">订单信息</text>
<text class="info">{{listinfo.orderNo}}点击复制</text>
</view>
<view class="row">
<text class="t">创建时间</text>
<text class="info">{{$u.timeFormat(listinfo.time, 'yyyy-mm-dd hh:MM:ss')}}</text>
</view>
</view>
</view>
<view class="card" style="padding-bottom: 20rpx;" v-if="listinfo.shopQrcode">
<image :src="listinfo.shopQrcode" show-menu-by-longpress="true" style="width: 100%;" mode="widthFix">
</image>
</view>
<view class="payType" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<view class="">
支付方式
</view>
<view class="">
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
placement="column">
<u-radio activeColor="#ffd158" name="1">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/balance.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
微信支付
</text>
</view>
</u-radio>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;">
</view>
<u-radio activeColor="#ffd158" name="2">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
会员卡支付</text>
</view>
</u-radio>
</u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
会员卡余额{{ amountVIP?amountVIP.amount:0}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text>
</view>
</view>
</view>
<view :style="{height:height}">
</view>
<view class="fixedview">
<view class="flex-between" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">
<view class="fixedview_one flex-start">
<view class="fixedview_oneone">
实付金额
</view>
<view class="fixedview_onetow">
<text>¥</text>{{listinfo.payAmount}}
</view>
</view>
<view class="fixedview_tow" @tap="$u.debounce(showpopupclickddes,500)">
立即付款
</view>
</view>
</view>
<!-- 支付密码 -->
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-if="ispws"></payPassword>
</view>
</template>
<script>
import payPassword from '@/components/payPassword.vue'
export default {
components: {
payPassword
},
data() {
return {
height: '',
pay_type: 1,
orderId: '',
listinfo: {},
radiovalue: '1', //选择支付方式
ispws: false,
srcimge: 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/wx.jpg'
};
},
async onLoad(e) {
console.log(e)
this.orderId = e.orderId
},
onShow() {
this.orderorderInfo()
},
onUnload() {
uni.switchTab({
url: '/pages/order/order'
})
},
methods: {
groupChange(n) { //选择支付方式
this.radiovalue = n
},
mountedcreateSelectorQuery() {
//#ifdef MP-WEIXIN || H5
var query = uni.createSelectorQuery().in(this).select('.fixedview')
query.boundingClientRect(ele => {
var that = this;
console.log(ele, 111)
that.height = (ele.height) + "px"
that = null;
// uni.getSystemInfo({
// success(res) {
// }
// })
}).exec();
//#endif
//#ifdef MP-ALIPAY
my.createSelectorQuery().selectAll('.fixedview').boundingClientRect().exec(ele => {
var nodeData = ele[0]
var that = this;
that.height = (nodeData.height) + "px";
that = null;
})
//#endif
},
async paymodfiyOrderInfo() {
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfo.orderId,
})
},
showpopupclickddes() {
// radiovalue为1是微信支付
if (this.radiovalue == 1) {
this.showpopupclick() //微信支付
} else {
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
// console.log(isPwd,'是否设置了支付密码')
if (uni.cache.get('userInfo').isPwd == 0) {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
} else {
this.ispws = true
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
}
}
},
async showpopupclick() {
let res = await this.api.payorderPay({
orderId: this.orderId,
}) //判断是否支付成功
if (res.code == 0) {
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
uni.showToast({
title: "支付成功"
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
this.paymodfiyOrderInfo()
},
fail: (err) => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
setTimeout(res => {
uni.hideLoading()
uni.switchTab({
url: '/pages/order/order'
});
}, 500)
}
});
// #endif
}
},
// 余额支付
async accountPayevent(pwd) {
this.ispws = false
let res = await this.api.accountPay({
orderId: this.listinfoid,
memberId: this.amountVIP.id,
// remark: this.remark,
pwd
})
if (res.code == 0) {
// data ->1 支付成功
// ->2 余额不足
// ->3 未设置支付密码,
// ->4 不是会员,
if (res.data == 1) {
this.showToastUppop('支付成功')
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
.listinfoid
});
},
})
} else if (res.data == 2) {
this.showToastUppop('余额不足')
setTimeout(() => {
// 去充值
this.goRecharge()
}, 1500)
} else if (res.data == 3) {
this.showToastUppop('未设置支付密码')
setTimeout(() => {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
}, 1500)
} else if (res.data == 4) {
this.showToastUppop('非会员请充值')
setTimeout(() => {
// 去充值
this.goRecharge()
}, 1500)
}
}
},
showToastUppop(title) {
uni.showToast({
icon: 'none',
title,
success: () => {
}
})
},
async orderorderInfo() {
let res = await this.api.orderorderInfo({
orderId: this.orderId
})
if (res.code == 0) {
this.listinfo = res.data
this.mountedcreateSelectorQuery()
}
},
copyHandle(e) {
uni.setClipboardData({
data: e,
success() {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
clickselect(b) {
this.pay_type = b
},
},
};
</script>
<style scoped lang="scss">
.container {
padding: 28upx;
}
.payType {
padding: 32rpx 34rpx;
margin-top: 48rpx;
background-color: #fff;
>view:first-child {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
margin-top: 32rpx;
}
.dfs {
display: flex;
align-items: center;
}
}
.card {
background-color: #fff;
border-radius: 20upx;
padding: 28upx;
margin-bottom: 28upx;
.head {
display: flex;
justify-content: space-between;
&.border {
padding-bottom: 28upx;
border-bottom: 1upx solid #fafafa;
}
.status {
color: #ff0000;
}
}
.tag-wrap {
padding: 20upx 0;
display: flex;
.tag {
display: flex;
align-items: center;
justify-content: center;
padding: 0 10upx;
color: $color-priamry;
border: 1px solid $color-priamry;
font-size: 24upx;
}
}
.number-wrap {
background-color: #fafafa;
border-radius: 16upx;
padding: 28upx 0;
display: flex;
flex-direction: column;
align-items: center;
.number {
font-size: 42upx;
font-weight: bold;
}
}
.price {
.i {
font-size: 20upx;
}
.num {
font-size: 38upx;
}
}
.shop-info {
padding: 28upx 0;
.item:nth-child(1) {
margin-top: 0;
}
.item {
margin-top: 16rpx;
display: flex;
.info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding-left: 28upx;
.n {
font-size: 24upx;
color: #999;
}
}
}
}
.total-wrap {
display: flex;
justify-content: flex-end;
padding-top: 28upx;
border-top: 1upx solid #fafafa;
}
.order-info {
.row {
display: flex;
justify-content: space-between;
padding-top: 28upx;
.t {
font-size: 24upx;
color: #999;
}
.info {
font-size: 24upx;
}
}
}
}
.sixcontent {
width: 100%;
background: #FFFFFF;
padding: 32rpx;
margin-top: 32rpx;
border-radius: 12rpx;
.sixcontentone {
padding-bottom: 28rpx;
border-bottom: 1px solid #F7F7F7;
.sixcontent_one {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
}
.sixcontenttow {
.sixcontenttowitem {
margin-top: 16rpx;
.sixcontenttowitemone {
image {
margin-left: 24rpx;
width: 31.37rpx;
height: 27.34rpx;
}
.sixcontenttowitemonetext {
margin-left: 14rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
}
}
}
}
.fixedview {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
.flex-between {
width: 100%;
padding: 24rpx 28rpx;
background: #FFFFFF;
.fixedview_one {
.fixedview_oneone {
font-size: 28rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #333333;
}
.fixedview_onetow {
font-size: 44rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #F45C4C;
font-weight: bold;
text {
font-size: 28rpx;
}
}
}
.fixedview_tow {
background: red;
border-radius: 34rpx;
padding: 10rpx 44rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
}
}
</style>

View File

@@ -37,8 +37,10 @@
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<view v-if="listinfo.tableName" style="display: flex;align-items: center;">&nbsp;&nbsp;&nbsp;桌码: <view style="padding: 12rpx 16rpx;background-color: #faf2b6;border-radius: 12rpx;"> {{listinfo.tableName}}</view></view>
<view class="number-wrap"
<view v-if="listinfo.tableName">
桌号{{listinfo.tableName}}
</view>
<view class="number-wrap" style="margin-top: 20rpx;"
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.outNumber}}</text>
@@ -278,7 +280,7 @@
}
.tag-wrap {
padding: 28upx 0;
padding: 20upx 0;
display: flex;
.tag {

View File

@@ -1,59 +1,14 @@
<template>
<view class="container">
<view class="card" v-if="listinfo.tableName">
<view class="head">
<text class="title">
<text>{{listinfo.tableName || '空'}}</text>
</text>
<text class="status" v-if="listinfo.status == 'unpaid'">
<text>待支付</text>
</text>
<text class="status" v-if="listinfo.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="listinfo.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="listinfo.status == 'send'">
<text>已发</text>
</text>
<text class="status" v-if="listinfo.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="listinfo.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="listinfo.status == 'cancelled'">
<text>取消订单</text>
</text>
<text class="status" v-if="listinfo.status == 'merge'">
<text>合台</text>
</text>
</view>
<view class="tag-wrap">
<text class="tag" v-if="listinfo.sendType == 'post'">快递</text>
<text class="tag" v-if="listinfo.sendType == 'takeaway'">外卖</text>
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<view class="number-wrap" v-if="listinfo.status != 'unpaid'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.tableName || '空'}}</text>
</view>
</view>
<view class="card">
<view class="head border">
<text class="title">
<text>点单详情</text>
</text>
</view>
<view class="shop-info">
<view class="item" v-for="(item,index) in listinfo.detailList" :key="index">
<view class="item" v-for="(item,index) in cartLists.data" :key="index">
<view class="cover">
<c-image width="120" height="120" radius="16" :src='item.coverImg'></c-image>
</view>
<view class="info">
<text>{{item.name}}</text>
<text class="n">{{item.skuName}}</text>
<text class="n">x{{item.number}}</text>
</view>
<view class="price">
@@ -62,119 +17,6 @@
</view>
</view>
</view>
<view class="total-wrap">
<view class="price">
<text>合计</text>
<text class="i"></text>
<text class="num">{{listinfo.amounts}}</text>
</view>
</view>
</view>
<!-- <view class="sixcontent">
<view class="sixcontentone flex-between" style="padding: 0 0;" @click="orderfoodindex">
<view class="sixcontent_one" style="padding: 0 0;">
优惠券
</view>
<text style="color: red;">{{emitorderfoodform.couponsPrice}}</text>
</view>
</view> -->
<!-- <view class="redMoney">
<view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png"
style="width: 30rpx;height: 30.24rpx;;" mode=""></image>
红包/抵用券
</view>
<view @click="orderfoodindex">
可用优惠券{{couponAmount}}
</view>
</view> -->
<!-- 支付方式 -->
<view class="payType">
<view class="">
支付方式
</view>
<view class="">
<u-radio-group v-model="radiovalue1" iconPlacement="right" @change="groupChange" :size="28"
placement="column">
<u-radio activeColor="#ffd158" name="1">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/balance.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
微信支付
</text>
</view>
</u-radio>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;">
</view>
<u-radio activeColor="#ffd158" name="2">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
会员卡支付</text>
</view>
</u-radio>
</u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
会员卡余额{{ amountVIP.amount}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text>
</view>
</view>
</view>
<!-- <view class="sixcontent" >
<view class="sixcontentone flex-between">
<view class="sixcontent_one">
支付方式
</view>
</view>
<view class="sixcontenttow">
<view class="sixcontenttowitem flex-between" @click="clickselect(1)">
<view class="sixcontenttowitemone flex-start">
<u-icon name="weixin-fill" color="#999999" size="32"></u-icon>
<text class="sixcontenttowitemonetext">微信支付</text>
</view>
<view class="flex-start">
<u-icon v-if="pay_type == 1" name="checkmark-circle-fill" color="#333333" size="26"></u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#999999" size="26"></u-icon>
</view>
</view>
<view class="sixcontenttowitem flex-between" @click="clickselect(2)">
<view class="sixcontenttowitemone flex-start">
<u-icon name="zhifubao" color="#999999" size="26"></u-icon>
<text class="sixcontenttowitemonetext">余额支付</text>
</view>
<view class="flex-start">
<u-icon v-if="pay_type == 2" name="checkmark-circle-fill" color="#333333" size="26"></u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#999999" size="26"></u-icon>
</view>
</view>
</view>
</view> -->
<view :style="{height:height}">
</view>
<view class="fixedview">
<view class="flex-between">
<view class="fixedview_one flex-start">
<view class="fixedview_oneone">
实付金额
</view>
<view class="fixedview_onetow">
<text>¥</text>{{listinfo.amount}}
</view>
<view class="fixedview_onethere" v-if="emitorderfoodform.couponsPrice">
以优惠¥{{emitorderfoodform.couponsPrice}}
</view>
</view>
<view class="fixedview_tow" @tap="$u.debounce(showpopupclickdd, 500)">
立即付款
</view>
</view>
</view>
<!-- 支付密码 -->
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-if="ispws"></payPassword>
@@ -182,6 +24,7 @@
</template>
<script>
// import {object} from 'prop-types';
import webSocketUtils from '@/common/js/websocket.js'
import payPassword from '@/components/payPassword.vue'
export default {
@@ -192,7 +35,7 @@
return {
height: '',
pay_type: 1,
listinfoid: '',
remark: '',
listinfo: {
detailList: [],
amount: '',
@@ -201,115 +44,54 @@
emitorderfoodform: {
clickiconone: ''
},
amountVIP: null,
radiovalue1: '1',
vipId: null,
orderInfo: '',
// 可用优惠券数据
couponAmount: 0,
// 输入支付密码 123
passwordArr: [],
ispws: false,
listinfoid: ''
};
},
onUnload() {
uni.$off('getMessage')
this.ispws = false
},
onLoad(e) {
// console.log(e, 140)
let res = JSON.parse(e.tableId)
this.listinfo.detailList = res
this.listinfo.amount = e.amount // 算完了的价格
this.listinfo.amounts = e.amount //本来的价格
this.handlemessage()
uni.$on('message', this.getMessage)
// 获取余额
this.getAount()
// 获取可用优惠券数量
this.getcoupon()
this.vipId = uni.cache.get('userInfo').id
},
onShow() {
this.getAount()
},
created() {
uni.$on('emitclickorderfood', (num) => {
// 总金额 couponsAmount 优惠卷购买金额 couponsPrice优惠金额 等于1是团购/不等于1
if (num.clickiconone == 1) {
this.listinfo.amount = (Number(this.listinfo.amounts) + Number(num.couponsPrice) - Number(num
.couponsAmount)).toFixed(2)
} else {
this.listinfo.amount = (Number(this.listinfo.amounts) - Number(num.couponsAmount)).toFixed(2)
props: {
cartLists: {
type: Object,
default () {
return {
amount: '0.00',
data: []
}
this.emitorderfoodform = num
// this.num += num
})
}
},
radiovalue: {
type: String,
default: '1'
},
amountVIP: {
type: Object,
default () {
return {
}
}
}
},
onUnload() {
this.ispws = false
},
methods: {
groupChange(n) {
// console.log('groupChange', n);
this.radiovalue1 = n
uni.cache.set('radiovalue1', n)
},
async getcoupon() {
let res = await this.api.userCoupon({
"orderNum": this.listinfo.amount,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.couponAmount = res.data
}
this.radiovalue = n
},
async getAount() {
let res = await this.api.shopUserInfo({
// shopId:店铺ID
"shopId": this.$store.state.shopId,
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.amountVIP = res.data
}
},
getMessage(msg) {
if (msg.status != 'success') {
uni.showToast({
title: msg.msg,
icon: "none",
})
this.socketTicket.Close()
uni.$off('getMessage')
console.log(msg, 'socke返回数据')
} else if (msg.type == 'createOrder') {
console.log(msg, 'createOrder执行')
this.listinfoid = msg.data.id //下单需要的id
this.orderInfo = msg.data
if (this.radiovalue1 == 1) {
this.showpopupclickdds() //微信支付
}
}
},
handlemessage() {
this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
this.socketTicket = new webSocketUtils(
`${uni.conf.baseUrlwws}/websocket/table/${uni.cache.get('tableCode')}/${uni.cache.get('shopUser')}/${uni.cache.get('userInfo').id}`,
5000)
},
// 数据处理
socketSendMsg(data) {
if (this.socketTicket) {
this.socketTicket.send(data);
}
},
orderfoodindex() {
orderfoodindex() { //优惠劵
uni.pro.navigateTo('index/coupons/index', {
orderfood: 0,
orderId: this.listinfoid,
@@ -327,82 +109,33 @@
}
});
},
async paymodfiyOrderInfo() {
async paymodfiyOrderInfo() { //支付完成后请求
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfoid
orderId: this.listinfoid,
})
},
creactorder(){
let data = { //定义socket数据传参
"skuId": '',
"num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id
"shopId": this.$store.state.shopId,
"userId": uni.cache.get('userInfo').id,
// tableId:uni.cache.get('tableCode')
}
let res = 0
if(res.code==0){
this.listinfoid = msg.data.id //下单需要的id
this.orderInfo = msg.data
if (this.radiovalue1 == 1) {
this.showpopupclickdds() //微信支付
}
}
},
// 去结算
showpopupclick() {
let data = { //定义socket数据传参
"skuId": '',
"num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": this.emitorderfoodform.id ? this.emitorderfoodform.id : '', //优惠券ID,
"isYhq": this.emitorderfoodform.id ? 1 : 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": this.emitorderfoodform.clickiconone == 1 ? 1 : 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id
"shopId": this.$store.state.shopId,
"userId": uni.cache.get('userInfo').id,
// tableId:uni.cache.get('tableCode')
}
this.socketSendMsg(data)
},
// 去充值
goRecharge() {
goRecharge() { // 去充值
uni.pro.navigateTo('/pages/member/index', {
shopId: this.amountVIP.shopId
shopId: uni.cache.get('shopUser')
})
},
showpopupclickdd() {
console.log(this.radiovalue1, 'radiovalue1的值')
if (this.radiovalue1 == 1) {
// this.showpopupclick() //生成订单
this.creactorder()
showpopupclickddes(ID) {
// radiovalue为1是微信支付
this.listinfoid = ID
if (this.radiovalue == 1) {
this.showpopupclickdds() //微信支付
} else {
// 判断是否有绑定支付密码
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
// console.log(isPwd,'是否设置了支付密码')
if (uni.cache.get('userInfo').isPwd == 0) {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
} else {
if (this.amountVIP.amount > this.listinfo.amount) {
this.ispws = true
// this.showpopupclick() //生成订单
this.creactorder()
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
} else {
uni.showToast({
title: "余额不足"
})
}
}
}
},
@@ -412,10 +145,10 @@
orderId: this.listinfoid
}) //判断是否支付成功
if (res.code == 0) {
// uni.showLoading({
// title: '加载中',
// mask: true
// })
uni.showLoading({
title: '加载中',
mask: true
})
// #ifdef MP-WEIXIN
// 微信支付还是余额支付
uni.requestPayment({
@@ -427,51 +160,28 @@
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.showToast({
title: "支付成功"
})
uni.cache.set('shopUser', '') //删除shopUser
this.paymodfiyOrderInfo()
setTimeout(res => {
// uni.redirectTo({
// url: '/pages/order/successful?orderId=' + this
// .listinfoid + '&orderInfo=' + JSON.stringify(
// this.orderInfo) + '&radiovalue1=' + this
// .radiovalue1
// });
// uni.cache.set('shopUser', '') //删除shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this
url: '/pages/order/order_detail?orderId=' + _this
.listinfoid
});
}, 500)
// uni.redirectTo({
// url: "/pages/mall/order/ordersuccess?id=" + datareslane.data
// .order_id,
// });
},
fail: (err) => {
uni.showToast({
icon: 'none',
title: '支付失败'
})
setTimeout(res => {
// uni.redirectTo({
// url: '/pages/order/successful?orderId=' + this
// .listinfoid + '&orderInfo=' + JSON.stringify(
// this.orderInfo) + '&radiovalue1=' + this
// .radiovalue1
// });
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this
.listinfoid
});
}, 500)
},
complete: (data) => {
console.log(data, '成功与否')
fail: () => {
uni.hideLoading()
}
});
// #endif
uni.hideLoading()
}
},
// 余额支付
@@ -480,80 +190,103 @@
let res = await this.api.accountPay({
orderId: this.listinfoid,
memberId: this.amountVIP.id,
pwd: pwd
// remark: this.remark,
pwd
})
if (res.code == 0) {
uni.showToast({
icon: 'none',
title: '支付成功',
success: () => {
setTimeout(res => {
// uni.redirectTo({
// url: '/pages/order/successful?orderId=' + this
// .listinfoid + '&orderInfo=' + JSON.stringify(
// this.orderInfo) + '&radiovalue1=' + this
// .radiovalue1
// });
// data ->1 支付成功
// ->2 余额不足
// ->3 未设置支付密码,
// ->4 不是会员,
if (res.data == 1) {
this.showToastUppop('支付成功')
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this
url: '/pages/order/order_detail?orderId=' + _this
.listinfoid
});
}, 500)
}
},
})
} else if (res.data == 1) {
} else if (res.data == 2) {
this.showToastUppop('余额不足')
setTimeout(() => {
// 去充值
this.goRecharge()
}, 2000)
}, 1500)
} else if (res.data == 3) {
this.showToastUppop('未设置支付密码')
setTimeout(() => {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
}, 1500)
} else if (res.data == 4) {
this.showToastUppop('非会员请充值')
setTimeout(() => {
// 去充值
this.goRecharge()
}, 1500)
}
}
},
showToastUppop(title) {
uni.showToast({
icon: 'none',
title,
success: () => {
clickselect(b) {
this.pay_type = b
},
},
mounted() {
//#ifdef MP-WEIXIN || H5
var query = uni.createSelectorQuery().in(this).select('.fixedview')
query.boundingClientRect(ele => {
var that = this;
that.height = (ele.height) + "px";
that = null;
// uni.getSystemInfo({
// success(res) {
// }
// })
}).exec();
//#endif
//#ifdef MP-ALIPAY
my.createSelectorQuery().selectAll('.fixedview').boundingClientRect().exec(ele => {
var nodeData = ele[0]
var that = this;
that.height = (nodeData.height) + "px";
that = null;
}
})
//#endif
},
},
async mounted() {
uni.getSystemInfo({
success: (data) => {
this.height = (data.windowHeight / 2) + "px";
console.log(this.height, 1111);
}
})
// //#ifdef MP-WEIXIN || H5
// var query = uni.createSelectorQuery().in(this).select('.fixedview')
// query.boundingClientRect(ele => {
// var that = this;
// that.height = (ele.height) + "px";
// that = null;
// }).exec();
// //#endif
// //#ifdef MP-ALIPAY
// my.createSelectorQuery().selectAll('.fixedview').boundingClientRect().exec(ele => {
// var nodeData = ele[0]
// var that = this;
// that.height = (nodeData.height) + "px";
// that = null;
// })
// //#endif
},
};
</script>
<style scoped lang="scss">
.container {
padding: 28upx;
padding: 0 28upx 28upx 28upx 28upx;
max-height: 600px;
overflow: auto;
}
.card {
background-color: #fff;
border-radius: 20upx;
padding: 28upx;
margin-bottom: 28upx;
margin-bottom: 48rpx;
.head {
display: flex;

View File

@@ -0,0 +1,803 @@
<template>
<view class="container">
<view class="card" v-if="listinfo.tableName">
<view class="head">
<text class="title">
<text>{{listinfo.tableName || '空'}}</text>
</text>
<text class="status" v-if="listinfo.status == 'unpaid'">
<text>待支付</text>
</text>
<text class="status" v-if="listinfo.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="listinfo.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="listinfo.status == 'send'">
<text>已发</text>
</text>
<text class="status" v-if="listinfo.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="listinfo.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="listinfo.status == 'cancelled'">
<text>取消订单</text>
</text>
<text class="status" v-if="listinfo.status == 'merge'">
<text>合台</text>
</text>
</view>
<view class="tag-wrap">
<text class="tag" v-if="listinfo.sendType == 'post'">快递</text>
<text class="tag" v-if="listinfo.sendType == 'takeaway'">外卖</text>
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<view class="number-wrap"
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.outNumber || '空'}}</text>
</view>
</view>
<view class="card" v-if="listinfoid && listinfo">
<view class="head border">
<text class="title">
<text>点单详情</text>
</text>
</view>
<view class="shop-info">
<view class="item" v-for="(item,index) in listinfo.details" :key="index">
<view class="cover">
<c-image width="120" height="120" radius="16" :src='item.productImg'></c-image>
</view>
<view class="info">
<text>{{item.productName}}</text>
<text class="n" v-if="item.productSkuName">{{item.productSkuName}}</text>
<text class="n">x{{item.num}}</text>
</view>
<view class="price">
<text class="i"></text>
<text class="num">{{item.price}}</text>
</view>
</view>
</view>
<view class="total-wrap">
<view class="price">
<text>合计</text>
<text class="i"></text>
<text class="num">{{listinfo.payAmount}}</text>
</view>
</view>
</view>
<view class="card" v-else>
<view class="shop-info">
<view class="item" v-for="(item,index) in cartLists.data" :key="index">
<view class="cover">
<c-image width="120" height="120" radius="16" :src='item.coverImg'></c-image>
</view>
<view class="info">
<text>{{item.name}}</text>
<text class="n">{{item.skuName}}</text>
<text class="n">x{{item.number}}</text>
</view>
<view class="price">
<text class="i"></text>
<text class="num">{{item.salePrice}}</text>
</view>
</view>
</view>
</view>
<!-- <view class="sixcontent">
<view class="sixcontentone flex-between" style="padding: 0 0;" @click="orderfoodindex">
<view class="sixcontent_one" style="padding: 0 0;">
优惠券
</view>
<text style="color: red;">{{emitorderfoodform.couponsPrice}}</text>
</view>
</view> -->
<!-- <view class="redMoney">
<view>
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/hongbao.png"
style="width: 30rpx;height: 30.24rpx;;" mode=""></image>
红包/抵用券
</view>
<view @click="orderfoodindex">
可用优惠券{{couponAmount}}
</view>
</view> -->
<!-- <u--textarea v-model="remark" placeholder="订单备注" ></u--textarea> -->
<!-- 支付方式 -->
<view class="payType">
<view class="">
支付方式
</view>
<view class="">
<u-radio-group v-model="radiovalue" iconPlacement="right" @change="groupChange" :size="28"
placement="column">
<u-radio activeColor="#ffd158" name="1">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/balance.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
微信支付
</text>
</view>
</u-radio>
<view style="margin: 22rpx 0;width: 100%;height: 2rpx;background-color: #E5E5E5;">
</view>
<u-radio activeColor="#ffd158" name="2">
<view class="dfs">
<image style="width:44rpx;height:44rpx"
src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/drder/wechat.png" mode="">
</image>
<text style="font-size: 28rpx;margin-left: 16rpx;">
会员卡支付</text>
</view>
</u-radio>
</u-radio-group>
<view style="font-weight: 400;font-size: 24rpx;color: #333333;margin-left: 60rpx;">
会员卡余额{{ amountVIP?amountVIP.amount:0}} <text
style="font-weight: 500;font-size: 28rpx;margin-left: 16rpx;color: #FF4C11;"
@click="goRecharge">去充值</text>
</view>
</view>
</view>
<!-- <view class="sixcontent" >
<view class="sixcontentone flex-between">
<view class="sixcontent_one">
支付方式
</view>
</view>
<view class="sixcontenttow">
<view class="sixcontenttowitem flex-between" @click="clickselect(1)">
<view class="sixcontenttowitemone flex-start">
<u-icon name="weixin-fill" color="#999999" size="32"></u-icon>
<text class="sixcontenttowitemonetext">微信支付</text>
</view>
<view class="flex-start">
<u-icon v-if="pay_type == 1" name="checkmark-circle-fill" color="#333333" size="26"></u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#999999" size="26"></u-icon>
</view>
</view>
<view class="sixcontenttowitem flex-between" @click="clickselect(2)">
<view class="sixcontenttowitemone flex-start">
<u-icon name="zhifubao" color="#999999" size="26"></u-icon>
<text class="sixcontenttowitemonetext">余额支付</text>
</view>
<view class="flex-start">
<u-icon v-if="pay_type == 2" name="checkmark-circle-fill" color="#333333" size="26"></u-icon>
<u-icon v-else name="checkmark-circle-fill" color="#999999" size="26"></u-icon>
</view>
</view>
</view>
</view> -->
<view :style="{height:height}">
</view>
<view class="fixedview">
<view class="flex-between">
<view class="fixedview_one flex-start">
<view class="fixedview_oneone">
实付金额
</view>
<view class="fixedview_onetow" v-if="listinfoid && listinfo">
<text>¥</text>{{listinfo.payAmount}}
</view>
<view class="fixedview_onetow" v-else>
<text>¥</text>{{cartLists.amount}}
</view>
<!-- <view class="fixedview_onethere" v-if="emitorderfoodform.couponsPrice">
以优惠¥{{emitorderfoodform.couponsPrice}}
</view> -->
</view>
<view class="fixedview_tow" @tap="$u.debounce(showpopupclickdd, 500)" v-if="listinfoid && listinfo">
立即付款
</view>
<view class="fixedview_tow" @tap="$u.debounce(orderdetail, 500)" v-else>
立即付款
</view>
</view>
</view>
<!-- 支付密码 -->
<payPassword ref="payPwd" @accountPayevent="accountPayevent" v-if="ispws"></payPassword>
<!-- 弹幕 -->
<l-barrage ref="lBarrage" @end="onEnd" :minTop='0' :maxTop='16'></l-barrage>
</view>
</template>
<script>
// import {object} from 'prop-types';
import webSocketUtils from '@/common/js/websocket.js'
import payPassword from '@/components/payPassword.vue'
import lBarrage from '@/components/l-barrage/l-barrage.vue'
export default {
components: {
payPassword,
lBarrage
},
data() {
return {
userInfo: uni.cache.get('userInfo'), //个人信息
cartLists: {},
height: '',
pay_type: 1,
remark: '',
listinfo: {
detailList: [],
amount: '',
amounts: ''
},
emitorderfoodform: {
clickiconone: ''
},
orderInfo: '',
// 可用优惠券数据
couponAmount: 0,
// 输入支付密码 123
ispws: false,
listinfoid: null,
radiovalue: '1',
amountVIP: null
};
},
onUnload() {
this.socketTicket.Close()
uni.$off('getMessage')
this.ispws = false
},
onHide() {
this.socketTicket.Close()
uni.$off('message')
},
onShow() {
uni.$on('message', this.getMessage)
if (this.listinfoid) {
this.orderorderInfo()
} else {
this.handlemessage()
}
// 获取余额
this.getAount()
},
methods: {
getMessage(msg) {
if (msg == 1) { // 网络在连接
return false
}
if (msg.type == 'heartbeat') { //后台心跳 处理返回 不然控制台一直报错
return false
}
if (msg.status != 'success') {
uni.showToast({
title: msg.msg,
icon: "none",
})
return false;
} else {
switch (msg.type) {
case 'createOrder':
console.log(msg.data)
this.listinfoid = msg.data.id
uni.$off('getMessage')
this.orderorderInfo(1)
break;
case 'addCart':
this.cartLists = msg
this.productqueryProduct() //list 数据
break;
case 'order':
uni.navigateBack()
setTimeout(() => {
uni.showToast({
title: '您的小伙伴已下单了哦~~'
})
}, 1000)
break;
case 'addcart':
/*插入一条弹幕*/
this.$refs.lBarrage.add(
`${msg.reqData.nickName?msg.reqData.nickName:'微信用户'}${msg.reqData.num==-1?'取消了':'添加了'}${msg.reqData.name}(${msg.reqData.num})`
);
break;
}
this.$set(this, 'cartLists', msg)
}
},
handlemessage() {
this.socketTicket ? this.socketTicket.Close() : null //调用前先判断是否有socket正在进行 先关闭后链接
this.socketTicket = new webSocketUtils(`${uni.conf.baseUrlwws}`, 5000, {
tableId: uni.cache.get('tableCode'),
shopId: uni.cache.get('shopUser'),
userId: uni.cache.get('userInfo').id,
"type": "connect",
})
},
// 数据处理
socketSendMsg(data) {
if (this.socketTicket) {
this.socketTicket.send(data);
}
},
onEnd() { //回调弹幕
console.log('一波结束')
},
// 查询订单信息
async orderorderInfo(i) {
let res = await this.api.orderorderInfo({
orderId: this.listinfoid
})
if (res.code == 0) {
this.listinfo = res.data
if (i == 1) { //请求完了详情在去调支付
this.showpopupclickdd()
}
}
},
groupChange(n) {
this.radiovalue = n
},
async getAount() {
let res = await this.api.shopUserInfo({
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.amountVIP = res.data
}
},
orderfoodindex() { //优惠劵
uni.pro.navigateTo('index/coupons/index', {
orderfood: 0,
orderId: this.listinfoid,
amount: this.listinfo.amounts
})
},
copyHandle(e) {
uni.setClipboardData({
data: e,
success() {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
async paymodfiyOrderInfo() { //支付完成后请求
let res = await this.api.paymodfiyOrderInfo({
orderId: this.listinfoid,
})
},
goRecharge() { // 去充值
uni.pro.navigateTo('/pages/member/index', {
shopId: uni.cache.get('shopUser')
})
},
orderdetail() { // 直接生成订单
let data = {
"skuId": '',
"num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": '', //优惠券ID,
"isYhq": 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
}
uni.$u.debounce(this.socketSendMsg(data), 500)
},
showpopupclickdd() {
uni.showLoading({
title: '加载中',
mask: true
})
// radiovalue为1是微信支付
if (this.radiovalue == 1) {
this.showpopupclickdds() //微信支付
} else {
// 先判断是否设置支付密码。0是没设置。没设置的情况下跳转到设置页面。有的话输入支付密码
// console.log(isPwd,'是否设置了支付密码')
if (uni.cache.get('userInfo').isPwd == 0) {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
} else {
uni.hideLoading()
this.ispws = true
this.$nextTick(() => {
this.$refs.payPwd.onPayUp();
})
}
}
},
// 微信支付
async showpopupclickdds() {
let res = await this.api.payorderPay({
orderId: this.listinfoid
}) //判断是否支付成功
if (res.code == 0) {
// #ifdef MP-WEIXIN
// 微信支付还是余额支付
uni.requestPayment({
provider: 'wxpay', //支付类型-固定值
partnerid: res.data.appId, // 微信支付商户号
timeStamp: res.data.timeStamp, // 时间戳(单位:秒)
nonceStr: res.data.nonceStr, // 随机字符串
package: res.data.package, // 固定值
signType: res.data.signType, //固定值
paySign: res.data.paySign, //签名
success: (res) => {
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.showToast({
title: "支付成功"
})
// uni.cache.set('shopUser', '') //删除shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
.listinfoid
});
},
})
},
fail: () => {
uni.hideLoading()
}
});
// #endif
uni.hideLoading()
}
},
// 余额支付
async accountPayevent(pwd) {
this.ispws = false
let res = await this.api.accountPay({
orderId: this.listinfoid,
memberId: this.amountVIP.id,
// remark: this.remark,
pwd
})
if (res.code == 0) {
// data ->1 支付成功
// ->2 余额不足
// ->3 未设置支付密码,
// ->4 不是会员,
if (res.data == 1) {
this.showToastUppop('支付成功')
let _this = this
uni.requestSubscribeMessage({
tmplIds: ['z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ'],
complete() {
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
.listinfoid
});
},
})
} else if (res.data == 2) {
this.showToastUppop('余额不足')
setTimeout(() => {
// 去充值
this.goRecharge()
}, 1500)
} else if (res.data == 3) {
this.showToastUppop('未设置支付密码')
setTimeout(() => {
uni.pro.navigateTo('/pages/user/repairpassword', {
shopId_id: uni.cache.get('shopUser')
})
}, 1500)
} else if (res.data == 4) {
this.showToastUppop('非会员请充值')
setTimeout(() => {
// 去充值
this.goRecharge()
}, 1500)
}
}
},
showToastUppop(title) {
uni.showToast({
icon: 'none',
title,
success: () => {
}
})
},
},
async mounted() {
let rectInfo = await this.$u.getRect('.fixedview');
console.log(rectInfo);
this.height = rectInfo.height + "px"
},
};
</script>
<style scoped lang="scss">
.container {
padding: 0 28upx 28upx 28upx 28upx;
overflow: auto;
}
.card {
background-color: #fff;
border-radius: 20upx;
padding: 28upx;
margin-bottom: 48rpx;
.head {
display: flex;
justify-content: space-between;
&.border {
padding-bottom: 28upx;
border-bottom: 1upx solid #fafafa;
}
.status {
color: #ff0000;
}
}
.tag-wrap {
padding: 28upx 0;
display: flex;
.tag {
display: flex;
align-items: center;
justify-content: center;
padding: 0 10upx;
color: $color-priamry;
border: 1px solid $color-priamry;
font-size: 24upx;
}
}
.number-wrap {
background-color: #fafafa;
border-radius: 16upx;
padding: 28upx 0;
display: flex;
flex-direction: column;
align-items: center;
.number {
font-size: 42upx;
font-weight: bold;
}
}
.price {
.i {
font-size: 20upx;
}
.num {
font-size: 38upx;
}
}
.shop-info {
padding: 28upx 0;
.item:nth-child(1) {
margin-top: 0;
}
.item {
margin-top: 16rpx;
display: flex;
.info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding-left: 28upx;
.n {
font-size: 24upx;
color: #999;
}
}
}
}
.total-wrap {
display: flex;
justify-content: flex-end;
padding-top: 28upx;
border-top: 1upx solid #fafafa;
}
.order-info {
.row {
display: flex;
justify-content: space-between;
padding-top: 28upx;
.t {
font-size: 24upx;
color: #999;
}
.info {
font-size: 24upx;
}
}
}
}
.sixcontent {
width: 100%;
background: #FFFFFF;
padding: 32rpx;
margin-top: 32rpx;
border-radius: 12rpx;
.sixcontentone {
padding-bottom: 28rpx;
border-bottom: 1px solid #F7F7F7;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
.sixcontent_one {
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
}
.sixcontenttow {
.sixcontenttowitem {
margin-top: 16rpx;
.sixcontenttowitemone {
image {
margin-left: 24rpx;
width: 31.37rpx;
height: 27.34rpx;
}
.sixcontenttowitemonetext {
margin-left: 14rpx;
font-size: 28rpx;
font-family: Source Han Sans CN-Medium, Source Han Sans CN;
font-weight: 500;
color: #333333;
}
}
}
}
}
.redMoney {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 30rpx;
background-color: #fff;
padding: 18rpx 14rpx;
>view:first-child {
display: flex;
align-items: center;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
background: #FFE9E9;
border-radius: 16rpx 16rpx 16rpx 16rpx;
font-weight: 400;
font-size: 28rpx;
color: #FF3333;
text-align: center;
padding: 9rpx 13rpx;
}
}
.payType {
padding: 32rpx 34rpx;
margin-top: 48rpx;
background-color: #fff;
>view:first-child {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
margin-top: 32rpx;
}
.dfs {
display: flex;
align-items: center;
}
}
.fixedview {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
height: 180rpx;
padding: 16rpx 34rpx;
background: #FFFFFF;
.flex-between {
width: 100%;
padding: 24rpx 28rpx;
flex-wrap: nowrap;
.fixedview_one {
.fixedview_oneone {
font-size: 28rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #333333;
}
.fixedview_onetow {
font-size: 44rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #F45C4C;
font-weight: bold;
text {
font-size: 28rpx;
}
}
.fixedview_onethere {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
}
.fixedview_tow {
background: red;
border-radius: 34rpx;
padding: 10rpx 44rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
}
}
</style>

View File

@@ -3,7 +3,7 @@
<view class="card" v-if="listinfo.tableName">
<view class="head">
<text class="title">
<text>{{listinfo.tableName || '空'}}</text>
桌号<text>{{listinfo.tableName || '空'}}</text>
</text>
<text class="status" v-if="listinfo.status == 'unpaid'">
<text>待支付</text>
@@ -36,9 +36,10 @@
<text class="tag" v-if="listinfo.sendType == 'takeself'">自提</text>
<text class="tag" v-if="listinfo.sendType == 'table'">堂食</text>
</view>
<view class="number-wrap" v-if="listinfo.status != 'unpaid'">
<view class="number-wrap"
v-if="listinfo.status != 'unpaid' && listinfo.status != 'paying'&& listinfo.status != 'cancelled'">
<text class="t">取餐号</text>
<text class="number">{{listinfo.tableName || '空'}}</text>
<text class="number">{{listinfo.outNumber || '空'}}</text>
</view>
</view>
<view class="card">

File diff suppressed because it is too large Load Diff

View File

@@ -12,11 +12,11 @@
<view class="left-btn">
<view class="btn" :style="{ width: `${menuInfo.height}px`, height: `${menuInfo.height}px` }"
@click="navClickHandle(1)">
<u-icon name="arrow-left" :color="isFixed ? '#333' : '#fff'" size="38"></u-icon>
<u-icon name="arrow-left" :color="isFixed ? '#333' : '#fff'" size="28"></u-icon>
</view>
<view class="btn" :style="{ width: `${menuInfo.height}px`, height: `${menuInfo.height}px` }"
@click="navClickHandle(2)">
<u-icon name="kefu-ermai" :color="isFixed ? '#333' : '#fff'" size="38"></u-icon>
<u-icon name="kefu-ermai" :color="isFixed ? '#333' : '#fff'" size="28"></u-icon>
</view>
</view>
</view>
@@ -89,12 +89,12 @@
<view class="operation-wrap" v-else>
<view class="btn" v-if="item1.cartNumber != '0'"
@click.stop="cartadd(item1,index,index1,'-',item1.productSkuResult == null ? '单规格':'')">
<u-icon :name="require('@/static/icon_sub.png')" size="34"></u-icon>
<u-icon :name="require('@/static/icon_sub.png')" size="36"></u-icon>
</view>
<text class="num">{{ item1.cartNumber }}</text>
<view class="btn"
@click.stop="cartadd(item1,index,index1,'+',item1.productSkuResult == null ? '单规格':'')">
<u-icon :name="require('@/static/icon_add.png')" size="34"></u-icon>
<u-icon :name="require('@/static/icon_add.png')" size="36"></u-icon>
</view>
</view>
</view>
@@ -171,7 +171,7 @@
<view class="col">
<text class="t">{{ shopList.storeInfo.businessTime }}</text>
</view>
<view class="col">
<view class="col" @click="makePhoneCall(shopList.storeInfo.phone)">
<text class="t">{{ shopList.storeInfo.phone }}</text>
</view>
<view class="col">
@@ -230,19 +230,23 @@
</view>
</view>
</u-popup>
<!-- <vastwu-barrage width="750rpx" height="1300rpx" ref="vBarrage"></vastwu-barrage> -->
<l-barrage ref="lBarrage" @end="onEnd" :minTop='8' :maxTop='20' :avatar='barrageavatar'></l-barrage>
</view>
</template>
<script>
import _ from 'lodash';
import navbar from '../../uni_modules/uview-ui/libs/config/props/navbar';
import webSocketUtils from '@/common/js/websocket.js'
// import vastwuBarrage from '@/components/vastwu-barrage/vastwu-barrage.vue'
import webSocketUtils from '@/common/js/websocket.js';
import orderdetail from '@/pages/order_detail/index';
import lBarrage from '@/components/l-barrage/l-barrage.vue'
export default {
// components:{vastwuBarrage},
components: {
orderdetail,
lBarrage
},
data() {
return {
userInfo: uni.cache.get('userInfo'), //个人信息
// #ifndef MP-WEIXIN
menuInfo: uni.getSystemInfo(),
// #endif
@@ -262,12 +266,17 @@
tableCode: '', //code
specifications: {},
skuidname: [],
cartLists: {},
cartLists: {}, //购物车
orderdetailcartLists: {}, //提交订单
socketTicket: null,
amountcartNumber: 0,
skuidsearch: '', //
salePrice: '', //钱数
fixedtrue: true
fixedtrue: true,
datasocket: {}, //储存传参数据
radiovalue: '1', //选择支付方式
amountVIP: null, //余额
barrageavatar: '' //弹幕头像
};
},
onPageScroll(e) {
@@ -292,22 +301,27 @@
uni.cache.set('tableCode', this.tableCode)
}
uni.cache.set('types', 'types');
uni.$on('message', this.getMessage)
this.$nextTick(() => {
this.countTitleTopNum(); //导航栏
});
// this.$refs.vBarrage.init([123])
},
onUnload() {
this.socketTicket.Close()
uni.$off('message')
},
onHide() {
this.socketTicket.Close()
uni.$off('message')
this.fixedtrue = true
},
onShow() {
setTimeout(() => {
uni.$on('message', this.getMessage)
this.productqueryShopIdByTableCode() //获取shop User id
}, 500)
},
methods: {
onEnd() { //回调弹幕
console.log('一波结束')
},
// 单独获取他的shopUserid
async productqueryShopIdByTableCode() {
let res = await this.api.productqueryShopIdByTableCode({
@@ -315,7 +329,7 @@
})
if (res.code == 0) {
uni.cache.set('shopUser', res.data)
this.handlemessage()
this.handlemessage() //监听websocket返回
this.productqueryProduct() //list 数据
} else {
setTimeout(() => {
@@ -324,34 +338,15 @@
}
},
getMessage(msg) { //wss 回显数据
// console.log(this.shopList.productInfo)
// console.log(msg.data)
// const sumValuesByKey = (arr, key) => {
// return arr.reduce((accumulator, current) => {
// const existing = accumulator.find(item => item[key] === current[key]);
// if (existing) {
// existing.number += current.number;
// } else {
// accumulator.push({
// ...current
// });
// }
// return accumulator;
// }, []);
// };
// const result = sumValuesByKey(msg.data, 'productId');
// this.shopList.productInfo.forEach((item, index) => {
// if (item.id == result.categoryId) {
// item.products.forEach((item1,index1) => {
// })
// }
// });
if (msg == 1) { // 网络在连接
this.fixedtrue = true
return false
}
this.fixedtrue = false
if (msg.type == 'heartbeat') { //后台心跳 处理返回 不然控制台一直报错
return false
}
try {
if (msg.status != 'success') {
uni.showToast({
title: msg.msg,
@@ -370,6 +365,8 @@
this.productqueryProduct() //list 数据
break;
case 'clearCart':
this.cartLists = msg
this.productqueryProduct() //list 数据
this.skuidname = []
this.showCart = false
setTimeout(() => {
@@ -378,30 +375,22 @@
icon: "none",
})
}, 500)
this.cartLists = msg
this.productqueryProduct() //list 数据
break;
case 'order':
console.log('clearCart')
this.skuidname = []
this.showCart = false
this.cartLists = msg
this.productqueryProduct() //list 数据
break;
case 'createOrder': //去结算
let item = JSON.stringify(msg.data)
uni.redirectTo({
url: '/pages/order_detail/order_detail?tablelist=' + item
});
break;
case 'queryCart': //待提交
uni.redirectTo({
url: '/pages/order_detail/order_detail?tableId=' + JSON.stringify(msg.data) +
'&amount=' + msg.amount
});
case 'addCart': //初始化add
this.cartLists = msg
this.productqueryProduct() //list 数据
break;
case 'addcart':
this.cartLists = msg
console.log(msg, 1111)
this.productqueryProduct() //list 数据
try {
if (msg.data.length != 0) {
let nums = 0
msg.data.forEach((item, index, arr) => { //初始化skuidname的数据 选择第一个
@@ -413,12 +402,23 @@
} else {
this.$set(this, 'amountcartNumber', 0)
}
this.productqueryProduct() //list 数据
break;
default:
this.cartLists = msg
} catch (e) {
//TODO handle the exception
}
try {
this.barrageavatar = msg.reqData.headImg
/*插入一条弹幕*/
this.$refs.lBarrage.add(
`${msg.reqData.nickName?msg.reqData.nickName:'微信用户'}${msg.reqData.num==-1?'取消了':'添加了'}${msg.reqData.name}(${msg.reqData.num})`
);
} catch (e) {
//TODO handle the exception
}
break;
}
}
} catch (e) {
//TODO handle the exception
}
},
handlemessage() {
@@ -432,12 +432,8 @@
},
// 数据处理
socketSendMsg(data) {
console.log(data, 1111)
if (this.socketTicket) {
console.log(222)
this.socketTicket.send(data);
} else {
console.log(333)
}
},
getQueryString(url, name) { //解码
@@ -449,16 +445,15 @@
return null;
},
async cartadd(item, index, index1, a, b) { //列表添加 a传参加减号 b是判断单规格多规格
console.log(item, index, index1, a, b)
if (b == '单规格') { //没有规格为空
this.skuidname = []
}
this.hodgepodge(item, 1, a) //获取skuid /1添加购物车
},
async cartListadd(item, index, a) {
console.log(item, index, a)
async cartListadd(item, index, a) { //购物车加减
try {
const data = { //定义socket数据传参
"name": item.name,
"skuId": item.skuId,
"num": a == '-' ? -1 : 1, //skuId
"type": "addcart", //“addcart:添加购物车create0rder:生成订单clearCart:清空购物车”,
@@ -466,6 +461,7 @@
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id
};
this.datasocket = data
uni.$u.debounce(this.socketSendMsg(data), 500)
} catch (e) {
//TODO handle the exception
@@ -519,8 +515,6 @@
this.hodgepodge(item, 2)
},
async hodgepodge(item, a, c) { //此接口去获取商品id !!!赋值库存 数量 价格等
console.log(11111)
try {
let res = await this.api.productqueryProductSku({
shopId: uni.cache.get('shopUser'),
@@ -538,6 +532,9 @@
let data = null
if (a == 1) { //1添加购物车 2是websocket返回这个商品的价格(应为不同的多规格商品返回不同的价格)
data = { //定义socket数据传参
"nickName": this.userInfo.nickName,
"barrageavatar": this.userInfo.headImg,
'name': item.name,
"skuId": res.data.id,
"num": c == '-' ? -1 : 1, //数量
"type": "addcart", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
@@ -547,6 +544,7 @@
};
} else {
data = { //查询这个商品的价格
"name": item.name,
"skuId": res.data.id,
"num": '', //数量
"type": "sku", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
@@ -556,23 +554,35 @@
};
this.showShopsku = true //打开弹框
}
this.datasocket = data
uni.$u.debounce(this.socketSendMsg(data), 500)
}
} catch (e) {}
},
orderdetail() { // 直接生成订单
let data = {
"skuId": '',
"num": '', //数量
"type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
"couponsId": '', //优惠券ID,
"isYhq": 0, // 是否使用优惠券( 1 使用, 0 不使用),
"isBuyYhq": 0, // 是否购买优惠券( 1 购买, 0 不够买)
"productId": '', //商品id
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id,
if (this.cartLists.data.length == 0) {
uni.showToast({
title: '请先添加商品',
icon: 'none'
})
return false
}
uni.$u.debounce(this.socketSendMsg(data), 500)
uni.navigateTo({
url: '/pages/order_detail/indexs?tableId=' + JSON.stringify(this.cartLists)
});
// let data = {
// "skuId": '',
// "num": '', //数量
// "type": "createOrder", //“addcart:添加购物车create0rder:生成订单clearCart:庆康购物车”,
// "couponsId": '', //优惠券ID,
// "isYhq": 0, // 是否使用优惠券( 1 使用, 0 不使用),
// "isBuyYhq": 0, // 是否购买优惠券( 1 购买, 0 不够买)
// "productId": '', //商品id
// "shopId": uni.cache.get('shopUser'),
// "userId": uni.cache.get('userInfo').id,
// }
// this.datasocket = data
// uni.$u.debounce(this.socketSendMsg(data), 500)
},
async cartclear() { //清空购物车
try {
@@ -584,11 +594,11 @@
"shopId": uni.cache.get('shopUser'),
"userId": uni.cache.get('userInfo').id
};
this.datasocket = data
uni.$u.debounce(this.socketSendMsg(data), 500)
} catch (e) {
//TODO handle the exception
}
},
// 导航栏点击
navClickHandle(t) {
@@ -608,6 +618,12 @@
break;
}
},
//打电话
makePhoneCall(phone) {
uni.makePhoneCall({
phoneNumber: phone //仅为示例
});
},
// 点击菜单商品滚动到指定为止
titleClickHandle(id) {
uni.createSelectorQuery()
@@ -657,7 +673,7 @@
.exec();
}
this.titleTopNums = topNums;
}
},
}
};
</script>
@@ -687,7 +703,7 @@
display: flex;
align-items: center;
justify-content: center;
margin-right: $paddingSize;
// margin-right: $paddingSize;
}
}
}
@@ -943,12 +959,23 @@
}
.btn {
position: relative;
padding: 6upx 10upx;
background-color: $color-priamry;
border-radius: 12upx;
display: flex;
align-items: center;
justify-content: center;
&::after {
content: "";
position: absolute;
left: -10px;
top: -10px;
right: -10px;
bottom: -10px;
}
}
}
}
@@ -1153,18 +1180,111 @@
}
.btn {
position: relative;
padding: 16upx 20upx;
background-color: $color-priamry;
border-radius: 12upx;
display: flex;
align-items: center;
justify-content: center;
&::after {
content: "";
position: absolute;
left: -10px;
top: -10px;
right: -10px;
bottom: -10px;
}
}
}
}
}
.classorderdetailshow {
position: relative;
.orderdetailuicon {
position: absolute;
top: 10rpx;
left: 10rpx;
}
.payType {
padding: 32rpx 34rpx;
margin-top: 48rpx;
background-color: #fff;
>view:first-child {
font-weight: 500;
font-size: 28rpx;
color: #333333;
}
>view:last-child {
margin-top: 32rpx;
}
.dfs {
display: flex;
align-items: center;
}
}
.fixedview {
position: relative;
width: 100%;
.flex-between {
width: 100%;
padding: 24rpx 28rpx;
background: #FFFFFF;
flex-wrap: nowrap;
.fixedview_one {
.fixedview_oneone {
font-size: 28rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #333333;
}
.fixedview_onetow {
font-size: 44rpx;
font-family: SourceHanSansCN-Bold-, SourceHanSansCN-Bold;
font-weight: normal;
color: #F45C4C;
font-weight: bold;
text {
font-size: 28rpx;
}
}
.fixedview_onethere {
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 400;
font-size: 24rpx;
color: #999999;
}
}
.fixedview_tow {
background: red;
border-radius: 34rpx;
padding: 10rpx 44rpx;
font-size: 32rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
}
}
}
}
.shop-info-wrap {
.info-wrap {
padding: $paddingSize * 2 0;

View File

@@ -6,7 +6,7 @@
<view class="code-wrap">
<view class="num-wrap">
<text class="t">账户余额</text>
<text class="num">{{shopInfo.amount}}</text>
<text class="num">{{shopInfo.amount || '--'}}</text>
</view>
<view class="line-code">
<tki-barcode ref="tkiBarcode" show :opations="tkiOptions"></tki-barcode>
@@ -15,7 +15,7 @@
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="createcardNo"></uqrcode>
</view>
<view class="name">
<text>使用门店{{shopInfo.shopName}}</text>
<text>使用门店{{shopInfo.shopName || '--'}}</text>
</view>
<view class="line"></view>
</view>

View File

@@ -10,7 +10,8 @@
</button> -->
<!-- <image class="onecontentboximage" :src="userHeadImg" mode="" @click="uploadImg"></image> -->
<button type="default" class="btn" open-type="chooseAvatar" @chooseavatar="uploadImg">
<view class="" :style="'background-image:url('+userHeadImg+');'" style="width: 180rxp;height: 180rpx; background-position: center;"></view>
<view class="" :style="'background-image:url('+userHeadImg+');'"
style="width: 180rxp;height: 180rpx; background-position: center;"></view>
</button>
@@ -18,7 +19,9 @@
<view class="onecontentboxitemtext">
昵称
</view>
<input class="onecontentboxiteminput" v-model="userName" type="nickname" placeholder="请输入昵称">
<input class="onecontentboxiteminput" v-model="nickName" type="nickname"
@blur="bindblur" placeholder="请输入昵称" @input="bindinput" />
</view>
<view class="onecontentboxitem flex-between" style="border-top: 1rpx dotted #333333;">
<view class="onecontentboxitemtext">
@@ -42,11 +45,7 @@
components: {
navseat
},
onLoad() {
this.userInfo = uni.cache.get('userInfo')
this.userName = this.userInfo.nickName
this.userHeadImg = this.userInfo.headImg
},
data() {
return {
titlename: '完善信息',
@@ -62,9 +61,14 @@
},
userInfo: uni.cache.get('userInfo'),
userHeadImg: "",
userName: ''
nickName: ''
};
},
onLoad() {
this.userInfo = uni.cache.get('userInfo')
this.nickName = this.userInfo.nickName
this.userHeadImg = this.userInfo.headImg
},
onPageScroll(e) {
if (e.scrollTop <= 44) { //搜索导航栏
this.opacitys = false
@@ -73,6 +77,14 @@
}
},
methods: {
bindblur(e) {
console.log(e,11)
this.nickName = e.detail.value; // 获取微信昵称
},
bindinput(e) {
console.log(e,22)
this.nickName = e.detail.value; // 获取微信昵称
},
// uploadImg() {
// let _this = this
// uni.chooseImage({
@@ -136,7 +148,7 @@
async sumbit() {
let res = await this.api.upUserInfo({
headImg: this.userHeadImg,
nickName: this.userName
nickName: this.nickName
})
if (res.code == 0) {
uni.navigateBack()
@@ -217,11 +229,13 @@
}
}
}
.btn {
width: 180rpx;
height: 180rpx;
border-radius: 100%;
padding: 0;
>view {
border-radius: 100%;
}

View File

@@ -23,7 +23,7 @@
<!-- #endif -->
<view class="boxtop_top flex-between">
<view class="boxtop_topleft">
<view class="flex-start" v-if="userInfo.nickName" @click="clickinformation">
<view class="flex-start" v-if="userInfo" @click="clickinformation">
<image style="width: 108rpx; height: 108rpx; border-radius: 50%;" v-if="userInfo.headImg"
:src="userInfo.headImg" mode="aspectFill">
</image>