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

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

@@ -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 ) {