支付宝优化

This commit is contained in:
GaoHao
2024-10-29 18:27:43 +08:00
parent a868117cda
commit b2abe69e37
10 changed files with 89 additions and 42 deletions

29
App.vue
View File

@@ -4,9 +4,25 @@
import Api from '@/common/js/api.js'
export default {
globalData: {
systemInfo: null
systemInfo: null,
tableCode: null,
shopId: null,
queueId: null,
},
onLaunch: function() {
onLaunch: function(options) {
console.log(3333)
console.log(options)
if ( options.query.qrCode ) {
if (this.getQueryString(options.query.qrCode, 'code')) {
this.globalData.tableCode = this.getQueryString(options.query.qrCode, 'code')
}
if (this.getQueryString(options.query.qrCode, 'shopId')) {
this.globalData.shopId = this.getQueryString(options.query.qrCode, 'shopId')
}
if (this.getQueryString(options.query.qrCode, 'queueId')) {
this.globalData.queueId = this.getQueryString(options.query.qrCode, 'queueId')
}
}
if ( uni.getStorageSync("NAME") && !uni.getStorageSync("NAME").data) {
uni.cache.clear();
}
@@ -68,7 +84,14 @@
// console.log('App Hide');
},
methods: {
getQueryString(url, name) { //解码
var reg = new RegExp('(^|&|/?)' + name + '=([^&|/?]*)(&|/?|$)', 'i')
var r = url.substr(1).match(reg)
if (r != null) {
return r[2]
}
return null;
},
}
};
</script>

View File

@@ -134,11 +134,17 @@
timer: null //定时器
};
},
onLoad(e) {
onLoad(options) {
// 隐藏首页按钮
if (e.q) {
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
// #ifdef MP-WEIXIN
if (options.q) {
this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
}
// #endif
// #ifdef MP-ALIPAY
if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId }
// #endif
},
computed: {},

View File

@@ -121,33 +121,35 @@
type: "",
}
},
async onLoad(e) {
async onLoad(options) {
// if ( e.type == 'list' || e.type == 'index') {
// this.shopId = e.shopId;
// this.init();
// }
console.log(e)
uni.cache.set('forceUpdate',1)
if (e.q) {
this.shopId = this.getQueryString(decodeURIComponent(e.q), 'shopId')
// #ifdef MP-WEIXIN
if (options.q) {
this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
uni.cache.set('shopId',this.shopId)
this.tokenShow = false;
// 等待登录结果返回
// if (!uni.cache.get('token')) {
// await this.$onLaunched;
// }
this.shopInfo();
this.paygetActive()
} else{
this.shopId = e.shopId;
this.type = e.type;
if ( e.amount ) { this.amount = e.amount; }
uni.cache.set('shopId',this.shopId)
this.shopInfo();
this.paygetActive()
}
// #endif
// #ifdef MP-ALIPAY
if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId }
uni.cache.set('shopId',this.shopId)
// #endif
if (options.shopId) {
this.shopId = options.shopId
uni.cache.set('shopId',this.shopId)
}
if (options.type) {
this.type = options.type
}
if ( options.amount ) { this.amount = options.amount; }
this.shopInfo();
this.paygetActive()
},
methods: {
/**

View File

@@ -374,6 +374,7 @@
shopExtend: null,
shopId: "",
tableCode: "",
orderAMeal: true,
}
},
onPageScroll(e) {
@@ -402,16 +403,24 @@
this.$store.getters.is_BarHeight.customBar)
}
},
onLoad(e) {
if (e.q) {
this.tableCode = this.getQueryString(decodeURIComponent(e.q), 'code')
onLoad(options) {
// #ifdef MP-WEIXIN
if (options.q) {
this.tableCode = this.getQueryString(decodeURIComponent(options.q), 'code')
uni.cache.set('tableCode', this.tableCode)
}
if ( e.shopId ) {
this.shopId = e.shopId
// #endif
// #ifdef MP-ALIPAY
if (getApp().globalData.tableCode) {
this.tableCode = getApp().globalData.tableCode
uni.cache.set('tableCode', this.tableCode)
}
if ( e.tableCode ) {
this.tableCode = e.tableCode
// #endif
if ( options.shopId ) {
this.shopId = options.shopId
}
if ( options.tableCode ) {
this.tableCode = options.tableCode
}
},
@@ -431,7 +440,9 @@
},
async onShow() {
let _this = this;
if (!this.orderAMeal){
uni.pro.switchTab('index/index')
}
this.$nextTick(() => {
uni.pageScrollTo({
scrollTop: 0,
@@ -539,7 +550,8 @@
if (this.shopId) {params.shopId = this.shopId}
let res = await this.api.productqueryShop(params)
if (res.code == 0) {
if ( res.data.shopTableInfo && !res.data.shopTableInfo.choseCount) {
if ( res.data.shopTableInfo && !res.data.shopTableInfo.choseCount&&this.orderAMeal) {
this.orderAMeal = false;
uni.pro.navigateTo('/pagesOrder/orderAMeal/index', {
tableCode: this.tableCode,
shopId: res.data.storeInfo.id,

View File

@@ -40,7 +40,7 @@
textMargin: 14
},
qrcodeSize: 400,
createcardNo: '4637700074809642',
createcardNo: '',
shopInfo: null
};
},

View File

@@ -81,7 +81,7 @@
</view>
<view class="row">
<text class="t">备注</text>
<text class="info">{{ listinfo.orderInfo.remark}}</text>
<text class="info">{{ listinfo.orderInfo.remark||""}}</text>
</view>
<view class="row">
<text class="t">就餐人数</text>

View File

@@ -92,9 +92,8 @@
.paymentMethod{
box-sizing: border-box;
margin-top: 30rpx;
padding: 0 20rpx;
padding: 0 20rpx 220rpx 20rpx;
border-radius: 18rpx;
margin-bottom: 220rpx;
.paymentMethod_content{
background-color: #fff;
border-radius: 22rpx;

View File

@@ -109,7 +109,7 @@
<!-- 充值免单 -->
<!-- <rechargeFree ref="rechargeFree" :shopUserInfo="amountVIP" @changeFree="changeFree"></rechargeFree> -->
<!-- 充值活动 -->
<topUpActivity ref="topUpActivity" :shopUserInfo="amountVIP" ></topUpActivity>
<!-- <topUpActivity ref="topUpActivity" :shopUserInfo="amountVIP" ></topUpActivity> -->
<!-- 支付方式 -->
<paymentMethod ref="paymentMethod" :amountVIP="amountVIP" v-if="storeInfo.registerType == 'munchies'" @groupChange="groupChange"></paymentMethod>
@@ -180,7 +180,7 @@
favorable: [
// { name: "优惠券", type: "coupon", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/coupon.png"},
// { name: "团购优惠", type: "group", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/groupOffer.png"},
{ name: "积分抵扣", type: "points", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png"},
// { name: "积分抵扣", type: "points", url: "https://czg-qr-order.oss-cn-beijing.aliyuncs.com/confirmOrder/points.png"},
],
isPointsChecked: false,
rechargeFreeChecked: false,

View File

@@ -3,10 +3,10 @@
<view class="headStatus" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'||listinfo.status=='closed'">
<view class="status">
<u-icon name="checkmark-circle-fill" color="#03C061" size="46"></u-icon>
<view class="statusName" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">下单成功</view>
<view class="statusName" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">{{listinfo.registerType == 'munchies'?'待支付':'下单成功'}}</view>
<view class="statusName" v-if="listinfo.status=='closed'">已完成</view>
</view>
<view class="time" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">下单时间{{listinfo.createdAt}}</view>
<view class="time" v-if="listinfo.status == 'unpaid' || listinfo.status == 'paying'">下单时间{{ listinfo.createdAt }}</view>
<view class="time" v-if="listinfo.status=='closed'">付款时间{{listinfo.paidTime}}</view>
</view>

View File

@@ -137,11 +137,16 @@
};
},
onLoad(options) {
// #ifdef MP-WEIXIN
if (options.q) {
this.shopId = this.getQueryString(decodeURIComponent(options.q), 'shopId')
this.queueId = this.getQueryString(decodeURIComponent(options.q), 'queueId')
}
// #endif
// #ifdef MP-ALIPAY
if (getApp().globalData.shopId) { this.shopId = getApp().globalData.shopId }
if (getApp().globalData.queueId) { this.queueId = getApp().globalData.queueId }
// #endif
},
onShow() {
this.getQueueUpState();