支付宝兼容,排队预约修改,订单逻辑修改

This commit is contained in:
GaoHao
2024-09-24 15:22:34 +08:00
parent 861e97b775
commit 5f03e44701
31 changed files with 823 additions and 737 deletions

View File

@@ -86,10 +86,15 @@
// #endif
success: async (infoRes) => {
console.log(infoRes)
uni.cache.set('weixincode', data.code);
let res = await Api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
code: data.code, //临时登录凭证
rawData: infoRes.rawData,
// #ifdef MP-WEIXIN
source: 'wechat',
// #endif
// #ifdef MP-ALIPAY
source: 'alipay',
// #endif
})
if (res.code == 0) {
uni.cache.set('token', res.data.token);

View File

@@ -1,9 +1,9 @@
export default {
userwxlogin(data) { //登录
return uni.api.post("/login/wx/custom/login", data);
return uni.api.post("/login/auth/custom/login", data);
},
loginwxuserInfo(data) { //获取用户详情
return uni.api.get("/login/userInfo", data);
return uni.api.get("/login/userInfo", data,false);
},
userwxlogins(data) { // 获取手机号
return uni.api.post("/login/getPhoneNumber", data);
@@ -13,7 +13,7 @@ export default {
},
// 获取弹窗广告列表
getPopUpAd(data) {
return uni.api.get("/tbShopAd/list", data);
return uni.api.get("/tbShopAd/list", data,false);
},
productqueryShop(data) { //通过桌码获取店铺信息
@@ -87,7 +87,7 @@ export default {
// 获取店铺会员信息
shopUserInfo(data) {
return uni.api.get("/user/shopUserInfo", data);
return uni.api.get("/user/shopUserInfo", data,false);
},
// 注册会员
openMember(data) {
@@ -236,12 +236,20 @@ export default {
},
/**
* 获取排状态
* 获取排状态
* @param {Object} param
*/
getQueueUpState(param) {
return uni.api.get("/callTable/state", param);
},
/**
* 获取订阅
* @param {Object} data
*/
setSubMsg(data) {
return uni.api.post("/callTable/subMsg", data,false);
},
/**
* 取号

View File

@@ -27,7 +27,6 @@ class webSocketUtils {
connectSocketInit(data) {
let _this = this;
this.data = data;
console.log(this.url)
// #ifdef MP-WEIXIN
this.socketTask = uni.connectSocket({
// #endif
@@ -42,7 +41,6 @@ class webSocketUtils {
return this.socketTask;
},
fail: (res) => {
console.log(res)
}
});
@@ -221,7 +219,6 @@ class webSocketUtils {
//停止发送心跳
clearInterval(this.heartbeatInterval);
//如果不是人为关闭的话,进行重连
console.log(!this.is_open_socket)
if (!this.is_open_socket) {
console.log('进行重连');
this.canReconnect = true;

View File

@@ -54,6 +54,7 @@
watch: {
forceUpdate(val,oldval) {
// 在 forceUpdate 改变时执行更新操作
console.log(val,oldval)
let time = uni.cache.get('popUpTime') ? new Date().getTime() - uni.cache.get('popUpTime') : 1000;
if ( time >= 1000 ) {
uni.cache.set('popUpTime', new Date().getTime())

View File

@@ -83,7 +83,6 @@
onUnload: function() {},
methods: {
setval(n) {
console.log(n)
this.val = n
if (!this._empty(n)) {
setTimeout(() => {
@@ -167,8 +166,6 @@
},
watch: {
val(n, o) {
console.log(n,0)
console.log(this.onval)
if (this.onval) {
console.log(!this._empty(n))
if (n != o && !this._empty(n)) {

View File

@@ -87,6 +87,15 @@ export default {
}
},
methods: {
setval(n) {
console.log("setval==",n)
this.val = n
if (!this._empty(n)) {
setTimeout(() => {
this._makeCode()
}, 0);
}
},
_makeCode() {
let that = this
if (!this._empty(this.val)) {

View File

@@ -244,6 +244,7 @@ const getUserInfo = function (successCallback, failCallback) {
uni.login({
provider: 'weixin',
success: (data) => {
console.log(data)
// 微信小程序环境
uni.getUserInfo({
provider: 'weixin',
@@ -251,23 +252,14 @@ const getUserInfo = function (successCallback, failCallback) {
let res = await Api.userwxlogin({
code: data.code, //临时登录凭证
rawData: infoRes.rawData,
source: 'wechat'
})
if (res.code == 0) {
resolve(res)
// uni.cache.set('token', res.data.token);
// uni.cache.set('miniAppOpenId', res.data.userInfo
// .miniAppOpenId)
// uni.cache.set('userInfo', res.data.userInfo);
// let pages = getCurrentPages()
// let curPage = pages[pages.length -1 ]
// curPage.onLoad(curPage.options)
// curPage.onShow()
// // curPage.mounted()
// curPage.onReady()
}
},
fail: (err) => {}
});
});
}
});
@@ -279,30 +271,21 @@ const getUserInfo = function (successCallback, failCallback) {
my.getAuthCode({
scopes: 'auth_user',
success: (data) => {
console.log(data)
// 支付宝小程序环境
my.getAuthUserInfo({
success: async (infoRes) => {
uni.cache.set('weixincode', data.authCode);
let res = await Api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
rawData: JSON.stringify(infoRes),
})
if (res.code == 0) {
resolve(res)
// uni.cache.set('token', res.data.token);
// uni.cache.set('miniAppOpenId', res.data.userInfo
// .miniAppOpenId)
// uni.cache.set('userInfo', res.data.userInfo);
// let pages = getCurrentPages()
// let curPage = pages[pages.length -1 ]
// curPage.onLoad(curPage.options)
// curPage.onShow()
// // curPage.mounted()
// curPage.onReady()
}
},
fail: (err) => {}
});
// my.getAuthUserInfo({
// success: async (infoRes) => {
// let res = await Api.userwxlogin({
// code: data.authCode, //临时登录凭证
// rawData: JSON.stringify(infoRes),
// source: 'alipay'
// })
// if (res.code == 0) {
// resolve(res)
// }
// },
// fail: (err) => {}
// });
}
});
})

View File

@@ -80,13 +80,13 @@ async function request(options) {
environment: 'app',
// #endif
// #ifdef H5
environment: 'wx',
environment: 'h5',
// #endif
// #ifdef MP-WEIXIN
environment: 'wx',
// #endif
// #ifdef MP-ALIPAY
environment: 'wx',
environment: 'alipay',
// environment: 'alipay',
// #endif
token: uni.cache.get('token'),
@@ -125,21 +125,20 @@ async function request(options) {
uni.cache.set('storage:offset-time', offset, -1)
return await request(options)
} else {
if (options.toast) {
uni.showToast({
title: res.message || res.msg || res.error,
icon: "none",
success: () => {
setTimeout(res => {
if (options.toast) {
// #ifndef MP-WEIXIN || MP-ALIPAY
uni.pro.hideLoading()
// #endif
}
}, 2000)
}
})
}
console.log(options)
uni.showToast({
title: res.message || res.msg || res.error,
icon: "none",
success: () => {
setTimeout(res => {
if (options.toast) {
// #ifndef MP-WEIXIN || MP-ALIPAY
uni.pro.hideLoading()
// #endif
}
}, 2000)
}
})
return res
}
} else {

View File

@@ -127,13 +127,6 @@
"navigationBarTitleText": "订单列表"
}
},
{
"path": "pages/order/order_detail",
"style": {
"navigationBarTitleText": "订单详情"
}
},
{
"path": "pages/order/successful",
@@ -227,13 +220,6 @@
}
}
},
{
"path": "pages/order_food/confirm_order",
"style": {
"navigationBarTitleText": "确认订单",
"navigationBarBackgroundColor": "#E8AD7B"
}
},
{
"path": "pages/make/list",
"style": {
@@ -363,6 +349,30 @@
}
}
]
},
{
"root": "pagesOrder",
"pages": [
{
"path": "orderAMeal/index",
"style": {
"navigationBarTitleText": "点单"
}
},
{
"path": "confirm_order/index",
"style": {
"navigationBarTitleText": "确认订单",
"navigationBarBackgroundColor": "#E8AD7B"
}
},
{
"path": "order_detail/index",
"style": {
"navigationBarTitleText": "订单详情"
}
}
]
}
],
"globalStyle": {

View File

@@ -58,7 +58,9 @@
let tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
uni.cache.set('tableCode', tableCode)
if (tableCode) {
uni.pro.navigateTo('order_food/order_food')
uni.pro.navigateTo('order_food/order_food', {
tableCode: tableCode,
})
}
},
fail:( res) =>{

View File

@@ -236,7 +236,7 @@
</view>
<indexs v-if="showindex == 'shopIndex'" :shopExtend="shopExtend" :usershopUserinfo='usershopUserinfo' :userInfo='userInfo'></indexs>
<indexs v-if="showindex == 'shopIndex'" :shopExtend="shopExtend" :shopUserInfo='shopUserInfo' ></indexs>
<popupad id="popupad" :forceUpdate='forceUpdate' :showPosition="'home'"></popupad>
</view>
</view>
@@ -265,7 +265,6 @@
data() {
return {
showindex: "",
userInfo: {},//个人信息
NAME: uni.cache.get('NAME'),
timersetInterval: '0', //定时器
isFixedTop: false, //吸顶是否显示
@@ -305,7 +304,7 @@
categoryList: [],
subCategoryList: [], //二级菜单数据
// 登录后店铺信息
usershopUserinfo:{},
shopUserInfo:{},
popupadList: [], //广告数据
forceUpdate: false,
shopExtend: null,
@@ -368,10 +367,9 @@
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.usershopUserinfo = res.data
uni.cache.set('shopUserInfo',this.usershopUserinfo)
this.shopUserInfo = res.data
uni.cache.set('shopUserInfo',this.shopUserInfo)
}
this.loginwxuserInfo() //个人信息接口
if ( uni.cache.get('forceUpdate') == 1) {
this.forceUpdate = !this.forceUpdate;
}
@@ -442,17 +440,7 @@
this.shopExtend = res.data;
}
},
// 个人信息
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
this.userInfo = uni.cache.get('userInfo')
}
},
closeproductlist() {
this.showproductlist = false
// console.log('close');

View File

@@ -9,7 +9,7 @@
<text class="contentboxitemlefttexttow">在线点不排队</text>
</view>
<view class="contentboxitemright">
<view class="contentboxitemright_item flex-between" @click="scanCodehandle(1)">
<view class="contentboxitemright_item flex-between" @click="memberindex('member/memberdetails')">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xvip.png" mode="aspectFill">
</image>
<view class="contentboxitemright_itembox flex-colum">
@@ -17,7 +17,7 @@
<text>入会享权益</text>
</view>
</view>
<view class="contentboxitemright_item flex-between" @click="memberindex(0)">
<view class="contentboxitemright_item flex-between" @click="memberindex('member/index')">
<image src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/indexs/Xchong.png"
mode="aspectFill"></image>
<view class="contentboxitemright_itembox flex-colum">
@@ -34,10 +34,12 @@
<script>
export default {
data() {
return {};
return {
userInfo: null,
};
},
props: {
usershopUserinfo: {
shopUserInfo: {
type: Object,
default () {
return {
@@ -46,12 +48,6 @@
}
}
},
userInfo: {
type: Object,
default () {
return {}
}
},
shopExtend: {
type: Object,
default () {
@@ -59,51 +55,34 @@
}
},
},
mounted() {
this.userInfo = uni.cache.get('userInfo');
},
methods: {
scanCodehandle(i) {
setTimeout(()=>{
uni.cache.set('forceUpdate',2)
},200)
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', {
// shopId_id: uni.cache.get('shopId'),
})
}
},
fail: () => {
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', {
tableCode: tableCode,
})
// uni.pro.navigateTo('/pagesOrder/orderAMeal/index')
}
})
} else {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: uni.cache.get('shopId'),
})
}
},
memberindex(i) {
console.log(2)
if (i == 0) {
uni.pro.navigateTo('member/index', {
shopId: uni.cache.get('shopId'),
type: 'index',
})
} else {
let data = {
shopName: this.usershopUserinfo.shopName,
amount: this.usershopUserinfo.amount,
shopId: uni.cache.get('shopId')
},
fail: () => {
}
uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(data)
})
}
})
},
memberindex(url) {
uni.pro.navigateTo(url, {
shopId: uni.cache.get('shopId'),
type: 'index',
})
},
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
@@ -114,30 +93,6 @@
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()
})
},
}
};

View File

@@ -59,9 +59,8 @@
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
code: data.code, //临时登录凭证
rawData: infoRes.rawData,
// signature: infoRes.signature,
// iv: infoRes.detail.iv,

View File

@@ -55,10 +55,8 @@
uni.getUserInfo({
provider: 'weixin',
success: async (infoRes) => {
console.log(infoRes, 81);
uni.cache.set('weixincode', data.code);
let res = await this.api.userwxlogin({
code: uni.cache.get('weixincode'), //临时登录凭证
code: data.code, //临时登录凭证
encryptedData: infoRes
.encryptedData, // 用户非敏感信息
rawData: infoRes.rawData,

View File

@@ -1,13 +1,18 @@
<template>
<!-- 店铺详情 -->
<u-popup :show="show" :round="20" overlayOpacity="0.8" mode="bottom" @close="showClose" height="500">
<u-popup :show="memberOpen" :round="20" overlayOpacity="0.8" mode="bottom" @close="showClose" height="500">
<view class="register-member-wrap">
<view class="register-title">欢迎加入{{shopUserInfo.shopName?shopUserInfo.shopName:'本店'}}</view>
<view class="register-tip">请完善个人信息完成会员注册</view>
<view class="register-content">
<view class="reg-head">
<view class="reg-head-img">
<!-- #ifdef MP-WEIXIN -->
<button class="reg-head-img" type="default" open-type="chooseAvatar" @chooseavatar="uploadImg">
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="reg-head-img" type="default" open-type="chooseAvatar" @chooseAvatar="uploadImg">
<!-- #endif -->
<image class="reg-head-img" :src="userHeadImg || 'https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/head_default.png'" mode="aspectFill"></image>
</button>
</view>
@@ -37,7 +42,13 @@
<view class="reg-cell">
<view class="lable">手机号</view>
<u-input class="value" v-model="telephone" fontSize="14px" type="text" input-align="left" readonly placeholder="获取微信手机号" :custom-style="{border:'none'}" placeholder-style="color:#999;font-size: 28rpx"/>
<!-- #ifdef MP-WEIXIN -->
<button class="getPhone" open-type="getPhoneNumber" @getphonenumber="getPhone">
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="getPhone" open-type="getAuthorize" scope='phoneNumber' @getAuthorize="getPhone" @error="getPhoneError">
<!-- #endif -->
<view class="text">{{phonetitle || '获取微信手机号'}}</view>
</button>
</view>
@@ -64,7 +75,18 @@
<script>
export default {
props: ['show',"shopId"],
props: {
shopId: {
type: String,
default: ''
},
show: {
type: Boolean,
default: false,
},
},
data() {
return {
value1: Number(new Date()),
@@ -76,10 +98,13 @@
birthDay: "",
isProtocol: false,
shopUserInfo: null,
memberOpen: false,
}
},
mounted() {
console.log(13)
this.shopId = uni.cache.get('shopId')
console.log(this.memberOpen)
this.init()
// console.log(this.userInfo)
// this.userId = this.userInfo.id;
@@ -88,14 +113,18 @@
methods: {
async init() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
})
console.log(res)
if (res.code == 0) {
this.shopUserInfo = res.data;
if ( uni.cache.get('shopUserInfo') && this.shopId == uni.cache.get('shopUserInfo').id ) {
this.shopUserInfo = uni.cache.get('shopUserInfo');
} else {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopUserInfo = res.data;
}
}
this.memberOpen = this.shopUserInfo.isVip == 0 ? true : false;
this.userHeadImg = this.shopUserInfo.headImg;
this.nickName = this.shopUserInfo.nickName && this.shopUserInfo.nickName != '微信用户' ? this.shopUserInfo.nickName : '';
this.telephone = this.shopUserInfo.telephone;
@@ -126,15 +155,12 @@
* @param {Object} e
*/
uploadImg(e) {
console.log(e)
const {
avatarUrl
} = e.detail
console.log(e)
console.log(e.detail)
// this.userHeadImg = avatarUrl
uni.uploadFile({
url: 'https://wxcashiertest.sxczgkj.cn/cashierService/common/upload',
url: uni.conf.baseUrl + '/common/upload',
// url: uni.conf.baseUrl + '/common/upload',
filePath: avatarUrl,
header: {
@@ -150,6 +176,9 @@
let { data } = JSON.parse(uploadFileRes.data)
this.userHeadImg = data
},
fail: (res) => {
console.log(res)
}
});
},
@@ -168,6 +197,7 @@
* @param {Object} d
*/
async getPhone(d) {
// #ifdef MP-WEIXIN
if (d.detail.iv) {
uni.login({
provider: 'weixin',
@@ -182,6 +212,32 @@
}
})
}
// #endif
// #ifdef MP-ALIPAY
// 支付宝小程序环境
my.getAuthCode({
scopes: 'auth_user',
success: (res) => {
console.log(res)
my.getPhoneNumber({
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: res.authCode,
encryptedData: d.response,
iv: d.detail.iv,
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;
}
});
}
});
// #endif
},
getPhoneError (e) {
console.log(e)
},
/**
@@ -252,6 +308,7 @@
if ( res.code == 0 ) {
this.$emit('getRegisterMember', false)
this.memberOpen = false;
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
@@ -330,12 +387,19 @@
}
}
.getPhone{
line-height: initial;
background-color: none;
border: 2rpx solid #E3AD7F;
color: #E3AD7F;
font-size: 28rpx;
padding: 5rpx 10rpx;
// #ifdef MP-ALIPAY
padding-top: 0;
display: initial;
height: 70rpx;
line-height: 70rpx;
box-sizing: border-box;
border-radius: 5rpx;
// #endif
}
}
.agreement{

View File

@@ -90,7 +90,7 @@
</view>
<view class="recharge" @tap="$u.debounce(userbalancerechangesub, 500)">立即充值</view>
</view>
<registermember :show="memberOpen" :shopUserInfo="shopUserInfo" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember>
<registermember :show="memberOpen" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember>
</view>
</template>
@@ -129,6 +129,7 @@
uni.cache.set('forceUpdate',1)
if (e.q) {
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
uni.cache.set('shopId',this.shopId)
this.tokenShow = false;
// 等待登录结果返回
// if (!uni.cache.get('token')) {
@@ -138,25 +139,26 @@
this.paygetActive()
} else{
this.shopId = e.shopId;
uni.cache.set('shopId',this.shopId)
this.shopInfo();
this.paygetActive()
}
console.log(this.shopId)
},
methods: {
/**
* 初始化
*/
async shopInfo() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
shopId: this.shopId,
userId: uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopUserInfo = res.data;
uni.cache.remove('memberOpen',this.memberOpen)
if ( this.shopUserInfo.isVip == 0 ) {
this.memberOpen = true;
uni.cache.set('memberOpen',this.memberOpen)
}
} else {
let pages = getCurrentPages()
@@ -177,7 +179,8 @@
}
this.$forceUpdate();
console.log(this.memberOpen)
},

View File

@@ -19,7 +19,7 @@
</view>
</view>
</view>
<view v-if="list.length <= 0" class="flex-colum">
<view v-if="list.length <= 0 && is_end" class="flex-colum">
<image style="width: 402rpx;height: 442rpx;margin:240rpx auto 32rpx;" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/nomore.png" mode="aspectFill"></image>
</view>
<u-loadmore :status="form.status" iconSize='24' fontSize='24' height='40' />
@@ -91,20 +91,28 @@
}, 500)
}
},
eeInfo(item) {
if ( this.type && this.type == 'user_payCode') {
uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(item)
})
} else if ( this.type && this.type == 'user_recharge') {
uni.pro.navigateTo('member/index', {
shopId: item.shopId,
type: 'index',
})
} else {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: item.shopId
})
async eeInfo(item) {
let res = await this.api.shopUserInfo({
"shopId": item.shopId,
"userId": uni.cache.get('userInfo').id,
})
if ( res.code == 0 ) {
uni.cache.set('shopUserInfo',res.data)
uni.cache.set('shopId', item.shopId)
if ( this.type && this.type == 'user_payCode') {
uni.navigateTo({
url: '/pages/pay_code/pay_code?shopInfo=' + JSON.stringify(item)
})
} else if ( this.type && this.type == 'user_recharge') {
uni.pro.navigateTo('member/index', {
shopId: item.shopId,
type: 'index',
})
} else {
uni.pro.navigateTo('member/memberdetails', {
shopId_id: item.shopId
})
}
}
},

View File

@@ -9,7 +9,7 @@
<view class="card_head">
<view class="card_head_left">
<image class="card_head_left_head" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_head.png" mode="aspectFill"></image>
<text class="card_head_left_name">{{shopUserInfo.shopName}}会员卡</text>
<text class="card_head_left_name">{{shopUserInfo.shopName||''}}会员卡</text>
<view class="card_head_left_icon_box" v-if="shopUserInfo.isVip != 0">
<image class="card_head_left_icon1" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/menber/member_icon1.png" mode="aspectFill"></image>
<text class="card_head_left_iconText">VL1</text>
@@ -73,7 +73,7 @@
</view>
</view>
<registermember :show="memberOpen" :shopUserInfo="shopUserInfo" :shopId="shopId_id" @getRegisterMember="getRegisterMember"></registermember>
<registermember :show="memberOpen" :shopId="shopId" @getRegisterMember="getRegisterMember"></registermember>
</view>
</template>
@@ -86,7 +86,7 @@
},
data() {
return {
shopId_id: null,
shopId: null,
memberOpen: false,
amount: '',
shopUserInfo: null,
@@ -99,11 +99,12 @@
}
},
onLoad(e) {
this.shopId_id = e.shopId_id;
this.shopId = e.shopId;
this.shopUserInfo = uni.cache.get('shopUserInfo')
uni.cache.set('forceUpdate',1)
this.init();
},
onShow() {
this.init();
this.getShopExtend();
},
methods: {
@@ -111,16 +112,7 @@
* 获取店铺信息
*/
async init() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId_id,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopUserInfo = res.data
uni.cache.set('shopUserInfo',res.data)
}
if ( this.shopUserInfo.isVip == 0 ) {
if ( this.shopUserInfo.isVip == 0) {
this.memberOpen = true;
}
},
@@ -129,7 +121,7 @@
*/
async getShopExtend () {
let res = await this.api.getShopExtend({
shopId: this.shopId_id,
shopId: this.shopId,
autokey: "member_bg" //index_bg my_bg member_bg shopInfo_bg
})
if ( res.code == 0) {
@@ -139,7 +131,7 @@
itemClick ( type ) {
if ( type == 1) {
uni.pro.navigateTo('member/index', {
shopId: this.shopUserInfo.shopId,
shopId: this.shopUserInfo.id,
type: 'index',
})
} else if ( type == 3 ) {

View File

@@ -185,9 +185,7 @@
};
},
onShow() {
if (uni.cache.get('token')) {
this.loginwxuserInfo()
}
if (this.tabs.findIndex((item) => item.type == this.useStorage.get('orderType')) == -1) {
this.active = 0
} else {
@@ -223,17 +221,9 @@
this.navtabindex = i
this.init_fn()
},
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
this.userInfo = uni.cache.get('userInfo')
}
},
orderinfo(e) {
uni.pro.navigateTo('order/order_detail', {
uni.pro.navigateTo('/pagesOrder/order_detail/index', {
orderId: e.id
})
},
@@ -383,7 +373,7 @@
// uni.cache.set('shopUser', '') //删除shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
url: '/pagesOrder/order_detail/index?orderId=' + _this
.listinfoid
});
},

View File

@@ -1,336 +0,0 @@
<template>
<view>
<u-sticky bgColor="#fff">
<view class="tab-wrap">
<view class="item" v-for="(item, index) in tabs" :key="index" @click="orderswitch(item,index)">
<text>{{ item.name }}</text>
</view>
<view class="line-wrap"
:style="{ left: `${(100 / tabs.length) * active}%`, width: `${100 / tabs.length}%` }">
<view class="line"></view>
</view>
</view>
</u-sticky>
<view class="list-wrap">
<view class="item" v-for="(item,index) in list" :key="index" @click="orderinfo(item)">
<view class="header-wrap">
<text v-if="item.sendType == 'post'">快递</text>
<text v-if="item.sendType == 'takeaway'">外卖</text>
<text v-if="item.sendType == 'takeself'">自提</text>
<text v-if="item.sendType == 'table'">堂食</text>
<text class="status" v-if="item.status == 'unpaid' || item.status == 'paying'">
<text>待支付</text>
</text>
<text class="status" v-if="item.status == 'unsend'">
<text>待发货</text>
</text>
<text class="status" v-if="item.status == 'closed'">
<text>订单完成</text>
</text>
<text class="status" v-if="item.status == 'send'">
<text> 已发</text>
</text>
<text class="status" v-if="item.status == 'refunding'">
<text>申请退单</text>
</text>
<text class="status" v-if="item.status == 'refund'">
<text>退单</text>
</text>
<text class="status" v-if="item.status == 'cancelled'">
<text>取消订单</text>
</text>
<text class="status" v-if="item.status == 'merge'">
<text>合台</text>
</text>
</view>
<view class="content">
<view class="shop-info">
<view class="shop-item">
<view class="cover flex-start" v-for="(item1,index1) in item.detailList" :key="index1">
<!-- <image :src="item1.productImg" style="width: 200rpx;height: 200rpx; border-radius: 20rpx;" mode="widthFix"></image> -->
<u-image width="200" height="200" radius="20" :src="item1.productImg"></u-image>
</view>
<!-- <view class="info">
<text class="name">美味大宅蟹</text>
<text class="num">数量1</text>
</view> -->
</view>
</view>
<view class="total">
<text class="t">需付款</text>
<text class="i"></text>
<text class="num">{{item.orderAmount}}</text>
</view>
<view class="intro-wrap">
<text class="time">下单日期{{$u.timeFormat(item.createdAt, 'yyyy-mm-dd hh:MM')}}</text>
<text class="intro num">{{item.totalNumber}}件商品 合计{{item.orderAmount}}</text>
</view>
</view>
<view class="footer-wrap">
<view class="btn">
<text>查看详情</text>
</view>
</view>
</view>
</view>
<u-loadmore :status="form.status" fontSize="28" color="#999" iconSize="28" />
</view>
</template>
<script>
import list from '../../uni_modules/uview-ui/libs/config/props/list';
export default {
data() {
return {
active: 0,
tabs: [{
name: '全部',
type: 1,
status: ''
},
{
name: '待支付',
type: 2,
status: 'unpaid'
},
{
name: '待发货',
type: 3,
status: 'unsend'
},
{
name: '已完成',
type: 4,
status: 'closed'
},
{
name: '退款',
type: 5,
status: 'refund'
}
],
list: [],
is_end: false,
swiperCurrent: '',
form: {
page: 1,
size: 10,
status: 'loadmore',
},
};
},
onShow() {
if (uni.cache.get('token')) {
this.loginwxuserInfo()
}
if (this.tabs.findIndex((item) => item.type == this.useStorage.get('orderType')) == -1) {
this.active = 0
} else {
this.active = (this.tabs.findIndex((item) => item.type == this.useStorage.get('orderType')));
}
this.init_fn()
},
onReachBottom() {
this.orderorderList()
},
methods: {
async loginwxuserInfo() {
let res = await this.api.loginwxuserInfo({
userId: uni.cache.get('userInfo').id
})
if (res.code == 0) {
uni.cache.set('userInfo', res.data);
this.userInfo = uni.cache.get('userInfo')
}
},
orderinfo(e) {
uni.pro.navigateTo('order/order_detail', {
orderId: e.id
})
},
init_fn() {
this.list = []
this.is_end = false
this.form.page = 1
this.form.status = 'loadmore'
this.orderorderList()
},
orderswitch(e, a) {
this.active = a
if (e.type == 1) {
this.swiperCurrent = ''
} else {
this.swiperCurrent = e.status
}
this.init_fn()
},
async orderorderList() {
let res = await this.api.orderorderList({
page: this.form.page,
size: this.form.size,
userId: uni.cache.get('userInfo').id, //userId
status: this.swiperCurrent
})
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
},
}
};
</script>
<style scoped lang="scss">
$tabH: 80upx;
$color: #ff411d;
.tab-wrap {
display: flex;
height: $tabH;
position: relative;
.item {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
position: relative;
z-index: 2;
}
.line-wrap {
position: absolute;
bottom: 0;
display: flex;
justify-content: center;
padding-bottom: 8upx;
transition: all 0.3s ease-in-out;
.line {
$h: 6upx;
width: 30%;
height: $h;
border-radius: $h;
background-color: $color;
}
}
}
.list-wrap {
padding: $paddingSize;
.item {
border-radius: 20upx;
background-color: #fff;
&:not(:first-child) {
margin-top: $paddingSize;
}
.header-wrap {
padding: $paddingSize;
border-bottom: 1upx solid #ececec;
display: flex;
justify-content: space-between;
.status {
color: $color;
}
}
.content {
padding: $paddingSize;
.shop-info {
.shop-item {
display: flex;
overflow: hidden;
overflow-x: scroll;
.cover:nth-child(1) {
margin-left: 0rpx;
}
.cover {
// white-space: nowrap;
margin-left: 10rpx;
}
.info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-around;
padding-left: 20upx;
}
}
}
.total {
display: flex;
align-items: flex-end;
justify-content: flex-end;
.t {
font-weight: bold;
font-size: 32upx;
}
.i {
font-size: 24upx;
}
.num {
font-size: 38upx;
position: relative;
top: 8upx;
}
}
.intro-wrap {
display: flex;
justify-content: space-between;
padding-top: $paddingSize;
.time {
color: #999;
font-size: 24upx;
}
.intro {
font-size: 24upx;
}
}
}
.footer-wrap {
display: flex;
justify-content: flex-end;
border-top: 1upx solid #ececec;
padding: $paddingSize;
.btn {
padding: 8upx 24upx;
border-radius: 100upx;
border: 1px solid #333;
display: flex;
align-items: center;
}
}
}
}
</style>

View File

@@ -170,7 +170,7 @@
},
wantEvent() {
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + this.orderId
url: '/pagesOrder/order_detail/index?orderId=' + this.orderId
});
},
async DoublingEvent() {

View File

@@ -226,6 +226,8 @@
</view>
</view>
</view>
<view class="placedOrderTip"><u-avatar :src="src" shape="circle"></u-avatar><view style="margin-left: 8rpx;">已下单菜品</view></view>
<!-- 购物车 -->
<u-popup :show="showCart" :round="20" :safeAreaInsetBottom="false" :zIndex="98" :overlayStyle="{ zIndex: 98 }"
@@ -241,31 +243,41 @@
<scroll-view scroll-y class="scroll-view">
<view class="list-wrap">
<view class="shop-item" v-for="(item,index) in cartLists.data" :key="item.id">
<view class="cover">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<view class="operation-wrap">
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'-')"></view>
<view class="shop-item-content">
<view class="cover">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'+')"></view>
<view class="operation-wrap">
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'-')"></view>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,index,'+')"></view>
</view>
</view>
</view>
</view>
</view>
<view class="shop-item-remark">
<view class="label">备注</view>
<u--input
placeholder="商品备注(选填)"
border="none"
v-model="item.remark"
></u--input>
</view>
</view>
</view>
</scroll-view>
@@ -378,6 +390,7 @@
</view>
</u-popup>
<popupad :forceUpdate="forceUpdate" :showPosition="'make_order'"></popupad>
</view>
</template>
@@ -427,6 +440,7 @@
forceUpdate: false,
shopExtend: null,
shopId: null,
tableCode: null,
}
},
onPageScroll(e) {
@@ -456,10 +470,14 @@
}
},
onLoad(e) {
console.log(e)
if (e.q) {
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
uni.cache.set('tableCode', this.tableCode)
}
if ( e.tableCode ) {
this.tableCode = e.tableCode
}
},
onUnload() {
if (this.socketTicket) {
@@ -581,6 +599,7 @@
this.shopId = res.data.storeInfo.id;
this.shopInfo = res.data;
this.productqueryProduct() //list 数据
this.getShopUserInfo() //list 数据
this.handlemessage() //监听websocket返回
this.getShopExtend();
} else {
@@ -590,7 +609,21 @@
}
},
/**
* 获取门店会员信息
*/
async getShopUserInfo() {
let res = await this.api.shopUserInfo({
"shopId": this.shopId,
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopUserInfo = res.data;
uni.cache.set('shopUserInfo', res.data)
}
},
/**
* 图片加载
*/
@@ -1022,8 +1055,9 @@
})
return false
}
console.log(JSON.stringify(this.shopInfo.storeInfo))
uni.navigateTo({
url: `/pages/order_food/confirm_order?storeInfo=${JSON.stringify(this.shopInfo.storeInfo)}&cartList=${JSON.stringify(this.cartLists)}`
url: `/pagesOrder/confirm_order/index?storeInfo=${encodeURIComponent(JSON.stringify(this.shopInfo.storeInfo))}&cartLists=${JSON.stringify(this.cartLists)}&tableCode=${this.tableCode}`
});
},
@@ -1822,8 +1856,23 @@
.shop-item {
display: flex;
flex-direction: column;
padding-bottom: $paddingSize;
.shop-item-content{
display: flex;
}
.shop-item-remark{
display: flex;
align-items: center;
padding-right: 180rpx;
margin-top: 10rpx;
.label{
font-size: 28rpx;
color: #666;
margin-right: 20rpx;
}
}
.langcover {
position: relative;
}
@@ -1951,7 +2000,25 @@
}
}
.placedOrderTip{
width: 200rpx;
height: 60rpx;
display: flex;
align-items: center;
position: fixed;
justify-content: center;
right: 0;
top: 0;
bottom: 0;
margin: auto;
z-index: 99;
background-color: #fff;
font-weight: 400;
font-size: 24rpx;
color: #333333;
border-radius: 40rpx 0rpx 0rpx 40rpx;
box-shadow: 0rpx 6rpx 12rpx 2rpx rgba(0,0,0,0.16);
}
}
@@ -2250,5 +2317,6 @@
}
}
}
</style>

View File

@@ -125,31 +125,41 @@
<scroll-view scroll-y class="scroll-view">
<view class="list-wrap">
<view class="shop-item" v-for="(item,index) in cartLists.data" :key="item.id">
<view class="cover">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<view class="operation-wrap">
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'-')"></view>
<view class="shop-item-content">
<view class="cover">
<u-image :src="item.coverImg" width="120" height="120"></u-image>
</view>
<view class="info">
<view class="name"> {{ item.name }} </view>
<view class="select-sku-wrap"> {{ item.skuName }} </view>
<view class="price-wrap" style="padding-top: 0;">
<view class="price">
<text class="i"></text>
<text class="num">{{ item.salePrice }}</text>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'+')"></view>
<view class="operation-wrap">
<view class="btn" v-if="item.number" >
<u-icon name="minus-circle-fill" color="#E9AB7A" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'-')"></view>
</view>
<text class="num" v-if="item.number">{{ item.number }}</text>
<view class="btn">
<u-icon name="plus-circle-fill" :color="item.isVip == 1 ? '#CECECE' : '#E9AB7A'" size="50"></u-icon>
<view class="btnClick" @click="cartListadd(item,'+')"></view>
</view>
</view>
</view>
</view>
</view>
<view class="shop-item-remark">
<view class="label">备注</view>
<u--input
placeholder="商品备注(选填)"
border="none"
v-model="item.remark"
></u--input>
</view>
</view>
</view>
</scroll-view>
@@ -792,7 +802,7 @@
return false
}
uni.redirectTo({
url: `/pages/order_food/confirm_order?storeInfo=${JSON.stringify(this.shopInfo.storeInfo)}&cartList=${JSON.stringify(this.cartLists)}`
url: `/pagesOrder/confirm_order/index?storeInfo=${JSON.stringify(this.shopInfo.storeInfo)}&cartList=${JSON.stringify(this.cartLists)}`
});
},
@@ -1399,8 +1409,23 @@
.shop-item {
display: flex;
flex-direction: column;
padding-bottom: $paddingSize;
.shop-item-content{
display: flex;
}
.shop-item-remark{
display: flex;
align-items: center;
padding-right: 180rpx;
margin-top: 10rpx;
.label{
font-size: 28rpx;
color: #666;
margin-right: 20rpx;
}
}
.langcover {
position: relative;
}

View File

@@ -12,7 +12,8 @@
<tki-barcode ref="tkiBarcode" show :opations="tkiOptions"></tki-barcode>
</view>
<view class="ewm-wrap">
<uqrcode ref="uqrcode" canvas-id="qrcode" :value="createcardNo"></uqrcode>
<tki-qrcode ref="tkiQrcode" show :size="qrcodeSize"></tki-qrcode>
<!-- <uqrcode ref="uqrcode" canvas-id="qrcode" :value="createcardNo"></uqrcode> -->
</view>
<view class="name">
<text>使用门店{{shopInfo.shopName || '--'}}</text>
@@ -23,10 +24,13 @@
</template>
<script>
import tkiBarcode from '@/components/tki-barcode/tki-barcode.vue';
import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
export default {
components: {
tkiBarcode
tkiBarcode,
tkiQrcode,
},
data() {
return {
@@ -35,12 +39,15 @@
fontSize: 28,
textMargin: 14
},
createcardNo: '',
qrcodeSize: 400,
createcardNo: '4637700074809642',
shopInfo: null
};
},
onLoad(e) {
this.shopInfo = JSON.parse(e.shopInfo)
},
mounted() {
this.logincreateCardNo();
},
methods: {
@@ -48,9 +55,12 @@
let res = await this.api.logincreateCardNo({
"shopId": this.shopInfo.shopId
})
console.log(res)
if (res.code == 0) {
this.createcardNo = res.data
this.createcardNo = res.data;
console.log(this.$refs.tkiBarcode)
this.$refs.tkiBarcode.setval(this.createcardNo) //操作属性
this.$refs.tkiQrcode.setval(this.createcardNo) //操作属性
}
}
}

View File

@@ -7,10 +7,10 @@
<view class="list_item_left">头像</view>
<view class="list_item_right flex-center">
<!-- #ifdef MP-WEIXIN -->
<button class="list_item_right_head" type="default" open-type="chooseAvatar" @chooseavatar="uploadImg">
<button class="list_item_right_head" type="default" open-type="chooseAvatar" @chooseavatar="onChooseAvatar">
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="list_item_right_head" type="default" open-type="chooseAvatar" onChooseAvatar="uploadImg">
<button class="list_item_right_head" type="default" open-type="chooseAvatar" @chooseAvatar="onChooseAvatar">
<!-- #endif -->
<image class="list_item_right_head" :src="userHeadImg" mode="aspectFill"></image>
</button>
@@ -26,7 +26,12 @@
<view class="list_item">
<view class="list_item_left">账号</view>
<view class="list_item_right ">
<button v-if="!mobile" open-type="getPhoneNumber" @getphonenumber="getPhone">
<!-- #ifdef MP-WEIXIN -->
<button class="phone" v-if="!mobile" open-type="getPhoneNumber" @getphonenumber="getPhone">
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<button class="phone" v-if="!mobile" open-type="getAuthorize" scope='phoneNumber' @getAuthorize="getPhone" @error="getPhoneError">
<!-- #endif -->
<view class="flex-colum-end">
<view class="text">请授权手机号</view>
</view>
@@ -178,8 +183,8 @@
*/
getPhone(d) {
console.log(d)
// #ifdef MP-WEIXIN
if (d.detail.iv) {
// #ifdef MP-WEIXIN
uni.login({
provider: 'weixin',
success: async (data) => {
@@ -194,27 +199,36 @@
this.mobile = res.data;
}
});
// #endif
// #ifdef MP-ALIPAY
// 支付宝小程序环境
my.getAuthCode({
scopes: 'auth_user',
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: data.code,
encryptedData: d.detail.encryptedData,
iv: d.detail.iv,
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;
}
});
// #endif
}
// #endif
// #ifdef MP-ALIPAY
// 支付宝小程序环境
my.getAuthCode({
scopes: 'auth_user',
success: (res) => {
console.log(res)
my.getPhoneNumber({
success: async (data) => {
console.log(data)
let res = await this.api.userwxlogins({
code: res.authCode,
encryptedData: d.response,
iv: d.detail.iv,
})
this.phonetitle = res.data.substr(0, 3) + "****" + res.data.substr(7)
this.mobile = res.data;
}
});
}
});
// #endif
},
getPhoneError (e) {
console.log(e)
},
/**
@@ -244,12 +258,11 @@
* 上传头像
* @param {Object} e
*/
uploadImg(e) {
console.log(e)
onChooseAvatar(e) {
const { avatarUrl } = e.detail
// this.userHeadImg = avatarUrl
uni.uploadFile({
url: 'https://wxcashiertest.sxczgkj.cn/cashierService/common/upload',
url: uni.conf.baseUrl + '/common/upload',
// url: uni.conf.baseUrl + '/common/upload',
filePath: avatarUrl,
header: {
@@ -289,6 +302,7 @@
uni.navigateBack()
}
}
},
computed: {
HeighT() { //手机类型的尺寸
@@ -334,6 +348,13 @@
margin-right: 16rpx;
padding: 0;
}
.phone{
border: none;
background-color: transparent;
// #ifdef MP-ALIPAY
display: initial;
// #endif
}
.place{
font-size: 28rpx;
color: #999;

View File

@@ -86,22 +86,16 @@
},
onShow() {
this.init_fn()
this.loginwxuserInfo()
if (uni.cache.get('shopId') ) {
this.getShopInfo();
this.shopInfo = uni.cache.get('shopUserInfo')
this.getShopExtend();
} else{
}
},
methods: {
// 下面初始数据
init_fn() {
},
/**
* 获取背景图
*/
@@ -154,23 +148,6 @@
});
},
/**
* 获取店铺信息
*/
async getShopInfo() {
let res = await this.api.shopUserInfo({
"shopId": uni.cache.get('shopId'),
"userId": uni.cache.get('userInfo').id,
})
if (res.code == 0) {
this.shopInfo = res.data
}
if ( res.data.isVip == 0 ) {
this.memberOpen = true;
return;
}
},
/**
* 查看二维码
*/

View File

@@ -13,38 +13,49 @@
<image class="informIcon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/informIcon.png" mode="aspectFill"/>
<text class="informText">温馨提示请适量点餐避免浪费</text>
</view>
<!-- <view class="tabBox"> -->
<!-- <view class="tab">
<view class="tabBox">
<view class="tab">
<view :class="is_type==(index+1)?'tab_item'+is_type+' tab_item active ':'tab_item'" v-for="(item,index) in is_typeList" :key="index" @click="tabClick(index+1)">
<view></view>
<image class="icon" :src="is_type==(index+1)?item.url_active:item.url" mode="aspectFill"/>
<text class="title" :class="{active:is_type==(index+1)}">{{item.title}}</text>
</view>
</view> -->
</view>
<!-- 送餐到桌 -->
<!-- <view class="table" v-if="is_type==1">
<view>
<view class="table" v-if="is_type==1">
<view class="table_left">
<image class="icon" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/table.png" mode="aspectFill"/>
<text class="title">桌台</text>
</view>
<view class="value"> {{ tableValue }} </view>
</view> -->
<view class="value" v-if="tableCode"> {{ shopTableInfo.name }} </view>
<u-icon v-else @click="scan" name="scan" size="60"></u-icon>
</view>
<!-- 打包外带 -->
<!-- <view class="pack" v-else>
<view class="pack" v-else>
<view class="top">
<text class="title">后海&双屿</text>
<text class="address">浐灞生态区灞河东路东三环至欧亚大道段商业用房09号</text>
<text class="title">{{ storeInfo.shopName }}</text>
<text class="address">{{ storeInfo.address }}</text>
</view>
<view class="list">
<!-- <view class="list">
<view class="item">
<view class="lable">取餐时间</view><view class="text">立即取餐</view>
</view>
<view class="item">
<view class="lable">预留电话</view><view class="getPhone text"><u-input class="inputVal" v-model="order.phone" input-align="right" placeholder="请输入预留电话以便联系您" ></u-input><text class="getBtn">获取手机号</text></view>
</view>
</view>
</view> -->
<!-- </view> -->
</view> -->
</view>
</view>
<view class="addDish" @click="addDish">加菜下单</view>
<view class="tabBox_t ">
<view class="shopName">{{ listinfo.name }}</view>
<view class="tableName">
<view>桌号</view>
<view class="name">{{ shopTableInfo.name }} </view><view></view></view>
</view>
</view>
<!-- 订单内容区域 -->
<view class="content_box">
@@ -119,6 +130,7 @@
</view>
<view class="paymentBtnText" @tap="$u.debounce(showpopupclickdd, 500)" v-if="listinfoid && listinfo"> {{ paymentBtnText }} </view>
<view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" v-else> {{ paymentBtnText }} </view>
<!-- <view class="paymentBtnText" @tap="$u.debounce(orderdetail, 500)" > 提交订单 </view> -->
</view>
<u-popup :show="ispws" :round="20" mode="bottom" @close="ispws = false" height="500" :safeAreaInsetBottom="false">
@@ -181,13 +193,13 @@
order: {
phone: "",
},
shopTableInfo: null,
cartLists: [],
listinfo: {
details: [],
payAmount: 0,
name: "",
},
tableValue: "A203", //
totalPrice: 0, //
totalAmount: 20, //
remark: "", //
@@ -199,6 +211,10 @@
paymentBtnText: "余额支付",
isSocket: false,
socketTicket: null,
shopId: null,
storeInfo: null,
tableCode: null,
}
},
computed: {
@@ -221,10 +237,16 @@
}
},
onLoad(e) {
console.log(JSON.parse(e.cartList))
this.listinfo.name = JSON.parse(e.storeInfo).shopName;
this.listinfo.details = JSON.parse(e.cartList).data;
this.listinfo.payAmount = JSON.parse(e.cartList).amount;
console.log(e)
this.shopId = JSON.parse(decodeURIComponent(e.storeInfo)).shopId;
this.storeInfo = JSON.parse(decodeURIComponent(e.storeInfo));
this.listinfo.name = JSON.parse(decodeURIComponent(e.storeInfo)).shopName;
this.tableCode = e.tableCode;
this.listinfo.details = JSON.parse(e.cartLists).data;
this.listinfo.payAmount = JSON.parse(e.cartLists).amount;
if ( e.tableCode ) {
this.getProductqueryShop()
}
},
onShow() {
console.log(this.listinfoid)
@@ -238,11 +260,63 @@
},
methods: {
/**
* 获取桌台码
*/
scan () {
uni.scanCode({
success: (res) => {
console.log(res)
this.tableCode = this.getQueryString(decodeURIComponent(res.result), 'code')
if (this.tableCode) {
this.getProductqueryShop();
}
},
fail: () => {
}
})
},
async getProductqueryShop (tableCode) {
let res = await this.api.productqueryShop({
code: this.tableCode,
shopId: this.shopId,
lng: uni.cache.get('getLocationstorage').lng ? uni.cache.get('getLocationstorage').lng :
'',
lat: uni.cache.get('getLocationstorage').lat ? uni.cache.get('getLocationstorage').lat :
'',
})
this.shopTableInfo = res.data.shopTableInfo;
console.log(res)
},
/**
* 解码
* @param {Object} url
* @param {Object} name
*/
getQueryString(url, name) {
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
/**
* 加菜下单
*/
addDish () {
uni.pro.navigateBack()
},
/**
* 消息监听
* @param {Object} msg
*/
getMessage(msg) {
console.log(msg)
if (msg == 1) { //
return false
}
@@ -260,8 +334,8 @@
switch (msg.type) {
case 'createOrder':
this.isSocket = true;
this.listinfoid = msg.data.id
console.log(msg)
this.listinfoid = msg.data.id
this.listinfo.details = msg.data.detailList;
this.listinfo.payAmount = msg.data.amount;
uni.$off('getMessage')
@@ -306,7 +380,6 @@
*/
tabClick ( val ) {
this.is_type = val;
console.log(this.is_type)
},
/**
@@ -353,7 +426,7 @@
})
if (res.code == 0) {
console.log("会员信息===",res)
this.amountVIP = res.data
this.amountVIP = res.data;
}
},
@@ -498,7 +571,7 @@
// uni.cache.set('shopUser', '') //shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
url: '/pagesOrder/order_detail/index?orderId=' + _this
.listinfoid
});
},
@@ -526,8 +599,7 @@
// uni.cache.set('shopUser', '') //shopUser
_this.paymodfiyOrderInfo()
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
.listinfoid
url: '/pagesOrder/order_detail/index?orderId=' + _this.listinfoid
});
},
})
@@ -575,7 +647,7 @@
tmplIds:["z0fUG7-jhSfYCrw6poOvSRzh4_hgnPkm_5C7E5s5bCQ","AV-KybUHaK3KtFVLqpy6PHccHBS7XeX__mOM4RbufnQ"],
complete() {
uni.redirectTo({
url: '/pages/order/order_detail?orderId=' + _this
url: '/pagesOrder/order_detail/index?orderId=' + _this
.listinfoid
});
},
@@ -736,11 +808,21 @@
height: 90rpx;
background-color: $uni-bg-color;
border-radius: 0 0 22rpx 22rpx;
.title{
.table_left{
display: flex;
align-items: center;
color: #E8AD7B;
.icon{
width: 32.86rpx;
height: 39.07rpx;
margin-right: 24rpx;
}
.title{
display: flex;
align-items: center;
color: #E8AD7B;
}
}
.value{
font-weight: 500;
font-size: 32rpx;
@@ -815,6 +897,47 @@
}
}
.addDish{
width: 176rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
background: #FFF8E8;
border-radius: 28rpx 28rpx 28rpx 28rpx;
font-weight: 500;
font-size: 28rpx;
color: #333333;
position: relative;
z-index: 1;
}
.tabBox_t{
font-weight: 500;
font-size: 28rpx;
color: #333333;
padding: 32rpx 24rpx;
background-color: #fff;
border-radius: 18rpx;
display: flex;
flex-direction: column;
position: relative;
z-index: 1;
margin-top: 32rpx;
}
.shopName{
margin-bottom: 16rpx;
}
.tableName{
display: flex;
.name{
border-right: 2rpx solid #d6d6d6;
padding-right: 16rpx;
margin-right: 16rpx;
}
}
}
.content_box{
@@ -850,6 +973,7 @@
height: 142rpx;
margin-right: 34rpx;
flex-shrink: 0;
border-radius: 20rpx;
}
.center{
width: 100%;

View File

@@ -0,0 +1,143 @@
<template>
<view class="container">
<image class="top_bg" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/order/orderAMeal.png" mode="aspectFill"></image>
<view class="content_box">
<view class="content">
<view class="title">
<view class="title_text">请选择就餐人数</view>
<view class="title_tabNum">桌号A2</view>
</view>
<view class="num">
<view class="num_item" :class="{'active':numIndex==index }" @click="tabCut(index)" v-for="(item,index) in 9" :key="index">{{item+1}}</view>
<view class="num_item" :class="{'active':numIndex==-1 }" @click="tabCut(-1)">其他</view>
</view>
<view class="startBtn">
开始点餐
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
tableCode: null,
shopId: null,
numIndex: 0,
num: 1,
};
},
onLoad(options) {
this.tableCode = uni.cache.get('tableCode');
},
onShow() {
},
methods: {
/**
* 切换桌型
*/
tabCut(index) {
this.numIndex = index;
if ( index != -1) {
this.num = index+1;
}
},
}
};
</script>
<style scoped lang="scss">
page {
// background: #f6f6f6;
}
.top_bg{
width: 100%;
height: 100%;
position: absolute;
z-index: 1;
top: 0;
}
.content_box{
width: 100%;
padding: 0 28rpx;
position: absolute;
bottom: 148rpx;
}
.content{
width: 100%;
position: relative;
z-index: 2;
display: flex;
flex-direction: column;
padding: 48rpx 32rpx 32rpx 32rpx;
background: #FFFFFF;
border-radius: 44rpx 44rpx 44rpx 44rpx;
.title{
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 48rpx;
.title_text{
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.title_tabNum{
font-weight: 400;
font-size: 28rpx;
color: #666666;
}
}
.num{
display: flex;
flex-wrap: wrap;
.num_item{
width: 104rpx;
height: 56rpx;
line-height: 56rpx;
text-align: center;
margin-right: 28rpx;
margin-bottom: 32rpx;
background: #FEF4EB;
border-radius: 12rpx;
font-weight: 400;
font-size: 28rpx;
color: #333333;
}
.num_item:nth-child(5n){
margin-right: 0;
}
.active{
color: #fff;
background-color: #E8AD7B;
}
}
}
.startBtn{
width: 100%;
height: 96rpx;
line-height: 96rpx;
text-align: center;
background-color: #E8AD7B;
border-radius: 48rpx;
font-weight: bold;
font-size: 32rpx;
color: #FFFFFF;
}
</style>

View File

@@ -5,7 +5,7 @@
<view class="content">
<image class="top_img" src="https://czg-qr-order.oss-cn-beijing.aliyuncs.com/queueUp/queueUp_img.png" mode="aspectFill"></image>
<view class="head">
<image class="avatar" :src="shopInfo.coverImg" mode="aspectFill"></image>
<image class="avatar" :src="shopInfo.logo" mode="aspectFill"></image>
<view class="head_text">
<text class="shopName">{{shopInfo.shopName}}</text>
<text class="tip">{{shopInfo.status == 1 ? '营业中' : '休息中'}}</text>
@@ -20,8 +20,8 @@
<!-- queueUpList -->
<view class="center_list" v-for="(item,index) in queueUpList" :key="index">
<view class="w center_list_item">
<text>{{item.tableName}}</text>
<text>{{item.tableNote}}</text>
<text>{{item.tableName||''}}</text>
<text>{{item.tableNote||''}}</text>
</view>
<view class="w center_list_item">
<text>{{item.waitingCount}}</text>
@@ -49,7 +49,7 @@
<view class="tip">当前门店</view>
</view>
<view class="sort">{{queueInfo.callNum}}</view>
<view class="note">{{queueInfo.tableName}}{{queueInfo.tableNote}}</view>
<view class="note">{{queueInfo.tableName}}{{queueInfo.tableNote||''}}</view>
</view>
<view class="footer">
<view class="footer_item">
@@ -57,14 +57,20 @@
<view class="footer_item_bom">前方等待桌数</view>
</view>
<view class="footer_item">
<view class="footer_item_top"><text>{{queueInfo.waitTime}}</text><text>分钟</text></view>
<view class="footer_item_top"><text>{{queueInfo.waitTime||''}}</text><text>分钟</text></view>
<view class="footer_item_bom">预计等待时长</view>
</view>
</view>
<view class="cancelBtn" @click="cancelTakeNumber">
取消排队
<view class="result_btn">
<view class="subscribe" @click="subscribe">
订阅通知
</view>
<view class="cancelBtn" @click="cancelTakeNumber">
取消排队
</view>
</view>
</view>
</block>
@@ -88,8 +94,8 @@
v-for="(item,index) in tableList" :key="index"
@click="tableCut(item)"
>
<view>{{item.name}}</view>
<view>{{item.note}}</view>
<view>{{item.name||''}}</view>
<view>{{item.note||''}}</view>
</view>
</view>
@@ -123,15 +129,17 @@
phone: "",
queueUpList: [],
tableList: [],
callTableId: null,
callTableId: "",
shopInfo: null,
queueInfo: null,
shopId: null,
shopId: "",
queueId: "",
};
},
onLoad(options) {
if (options.q) {
this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
this.queueId = this.getQueryString(decodeURIComponent(options.q), 'queueId')
}
},
@@ -140,9 +148,7 @@
this.getQueueUpList();
this.getQueueUpTablList();
},
onReachBottom() {
},
methods: {
/**
@@ -163,10 +169,15 @@
* 获取排号状态
*/
async getQueueUpState () {
let res = await this.api.getQueueUpState({
let params = {
openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId,
})
}
if (this.queueId) {
params.queueId = this.queueId;
}
let res = await this.api.getQueueUpState(params)
if ( res.code == 0) {
this.shopInfo = res.data.shopInfo;
this.queueInfo = res.data.queueInfo;
@@ -199,6 +210,26 @@
}
},
/**
* 订阅通知
*/
async subscribe () {
let res = await this.api.setSubMsg({
openId: uni.cache.get('miniAppOpenId'),
shopId: this.shopId,
queueId: this.queueId,
})
if ( res.code == 0) {
uni.requestSubscribeMessage({
tmplIds:["qUhvEfvCtIcBA3DOn3QMqsGOolrEpyr0YBh99i-AUqw","yxOjWK-KjMEZ_BaHWqDJJpHiUPXN6JWqr7u9y65RIWM","3BgFazRpVlvreh5z9u4cNP_VeclXKSQfh-r3x2_bYx4"],
complete() {
},
})
}
},
/**
* 取号
@@ -218,6 +249,8 @@
callTableId: this.callTableId,
})
if ( res.code == 0) {
this.phone = "";
this.queueId = res.data.id;
this.getQueueUpState();
this.show = false;
uni.requestSubscribeMessage({
@@ -568,18 +601,32 @@
border-right: 1rpx solid #E5E5E5;
}
}
.cancelBtn{
width: 336rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 56rpx;
border: 2rpx solid #333333;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #333333;
margin: 64rpx auto;
.result_btn{
display: flex;
align-items: center;
view{
height: 80rpx;
line-height: 80rpx;
text-align: center;
border-radius: 56rpx;
border: 2rpx solid #333333;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: bold;
font-size: 32rpx;
color: #333333;
}
.subscribe{
width: 336rpx;
margin: 64rpx auto;
}
.cancelBtn{
width: 336rpx;
margin: 64rpx auto;
}
}
}
</style>

View File

@@ -71,7 +71,6 @@ const store = new Vuex.Store({
let curPage = pages[pages.length -1 ]
curPage.onLoad(curPage.options)
curPage.onShow()
// curPage.mounted()
curPage.onReady()