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

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

@@ -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;
}
},
/**
* 查看二维码
*/