diff --git a/App.vue b/App.vue index 8434f37..4e988ba 100644 --- a/App.vue +++ b/App.vue @@ -4,9 +4,23 @@ 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) { + if ( options.query&&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 +82,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; + }, } }; diff --git a/common/js/api.js b/common/js/api.js index 2236663..8f69837 100644 --- a/common/js/api.js +++ b/common/js/api.js @@ -161,7 +161,9 @@ export default { getUserConpons(data) { //我的优惠券 return uni.api.post("/userConpons/find", data); }, - + conponList(data) { //获取优惠券 + return uni.api.post("/coupon/find", data); + }, ordergetYhqPara(data) { //获取优惠券参数列表 return uni.api.get("/order/getYhqPara", data); }, diff --git a/components/cwx-keyboard/cwx-keyboard.vue b/components/cwx-keyboard/cwx-keyboard.vue index 2b4a0ff..9478598 100644 --- a/components/cwx-keyboard/cwx-keyboard.vue +++ b/components/cwx-keyboard/cwx-keyboard.vue @@ -82,7 +82,12 @@ //处理按键 _handleKeyPress(e) { // console.log('点击传e', e.target.dataset.num); + // #ifdef MP-WEIXIN let num = e.target.dataset.num; + // #endif + // #ifdef MP-ALIPAY + let num = e.target.targetDataset.num; + // #endif //不同按键处理逻辑 // -1 代表无效按键,直接返回 if (num == -1) return false; @@ -154,6 +159,7 @@ // this.money = S + num; // } // } + console.log(num) if (this.money.length == 6) { this.$emit('confirmEvent', this.money); //提交参数 return diff --git a/components/payPassword.vue b/components/payPassword.vue index 37531ca..408b4b0 100644 --- a/components/payPassword.vue +++ b/components/payPassword.vue @@ -6,22 +6,22 @@ - + - + - + - + - + - + @@ -67,8 +67,8 @@ * @param {Object} val */ KeyInfo(val) { - - if (val.index >= 6) { + console.log(val) + if (val.index&&val.index >= 6) { return; } // 判断是否输入的是删除键 diff --git a/components/payPasswordtwo.vue b/components/payPasswordtwo.vue index 8eb5a54..03a7b2f 100644 --- a/components/payPasswordtwo.vue +++ b/components/payPasswordtwo.vue @@ -7,22 +7,22 @@ - + - + - + - + - + - + @@ -56,7 +56,7 @@ }, watch: { consumeFee(newVal, oldVal) { - + console.log(this.consumeFee) } }, methods: { diff --git a/pages/chooseasong/index.vue b/pages/chooseasong/index.vue index 8531df7..2521395 100644 --- a/pages/chooseasong/index.vue +++ b/pages/chooseasong/index.vue @@ -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: {}, diff --git a/pages/index/components/diamond.vue b/pages/index/components/diamond.vue index 106878f..e920283 100644 --- a/pages/index/components/diamond.vue +++ b/pages/index/components/diamond.vue @@ -1,6 +1,6 @@ @@ -109,7 +123,7 @@ payPassword }, onLoad(e) { - this.$store.dispatch("set_shopid"); //获取shapid + // this.$store.dispatch("set_shopid"); //获取shapid this.getInfo(e.id) this.orderIds = e.id this.amount = uni.cache.get('userInfo').amount @@ -143,6 +157,12 @@ // 余额支付 async accountPayevent(pwd) { this.ispws = false + if ( this.amountVIP.isVip == 0 ) { + uni.pro.navigateTo('/pages/member/index', { + shopId: this.info.shopId, + }) + return; + } let res = await this.api.payOrderPay({ orderId: this.listinfoid.id, payType: "deposit", @@ -207,7 +227,7 @@ let isVip = uni.cache.get('userInfo').isPwd if (isVip == 0) { uni.pro.navigateTo('/pages/user/repairpassword', { - shopId_id: uni.cache.get('shopId') + shopId_id: this.info.shopId }) } else { this.ispws = true @@ -221,12 +241,19 @@ }, async payEvent(id) { let res = await this.api.payOrderPay({ + // #ifdef MP-WEIXIN payType: 'wechatPay', + // #endif + // #ifdef MP-ALIPAY + payType: 'aliPay', + // #endif orderId: id, orderType: 'group' }) if (res) { + // 微信支付还是余额支付 uni.requestPayment({ + // #ifdef MP-WEIXIN provider: 'wxpay', //支付类型-固定值 partnerid: res.data.appId, // 微信支付商户号 timeStamp: res.data.timeStamp, // 时间戳(单位:秒) @@ -234,22 +261,32 @@ package: res.data.package, // 固定值 signType: res.data.signType, //固定值 paySign: res.data.paySign, //签名 + // #endif + // #ifdef MP-ALIPAY + provider: 'alipay', //支付类型-固定值 + orderInfo: res.data.tradeNo, // 支付宝支付商户号 + // #endif success: (res) => { + let _this = this uni.showToast({ title: "支付成功" }) uni.navigateBack() }, - fail: (err) => { - setTimeout(res => { - uni.showToast({ - icon: 'none', - title: '支付失败' - }) - uni.hideLoading() - }, 2000) + fail: async (err) => { + console.log(err) + let res = await this.api.cancelOrderPay({ + orderId: this.listinfoid.id, + }) + + uni.showToast({ + icon: 'none', + title: '支付失败' + }) + uni.hideLoading() } }); + } }, diff --git a/pages/user/coupon.vue b/pages/user/coupon.vue index e60afef..b2c5fec 100644 --- a/pages/user/coupon.vue +++ b/pages/user/coupon.vue @@ -3,10 +3,10 @@ + :class="tabIndex == index?'towcontentlistxitemboxopacity':''" + v-for="(item,index) in tabList" :key="index" @click="towcontentclick(index,item)"> {{item.name}} - @@ -74,27 +74,27 @@ export default { data() { return { - listbox: [{ + tabList: [{ name: '全部', type: '' }, { name: '未使用', - type: '0' + type: '1' }, { name: '已使用', - type: '1' + type: '2' } ], - towcontentclickindex: 0, + tabIndex: 0, list: [], status: "", }; }, onLoad() { - this.ordermineCouponsthis() + this.getCouponList() }, methods: { @@ -105,15 +105,15 @@ * @param {Object} item */ towcontentclick(index, item) { - this.towcontentclickindex = index; + this.tabIndex = index; this.status = item.type; - this.ordermineCouponsthis() + this.getCouponList() }, /** * 获取优惠券数据 */ - async ordermineCouponsthis() { + async getCouponList() { try { let res = await this.api.getUserConpons({ userId: uni.cache.get('userInfo').id, diff --git a/pagesOrder/components/orderInfoAfter.vue b/pagesOrder/components/orderInfoAfter.vue index c656ffe..bae1e76 100644 --- a/pagesOrder/components/orderInfoAfter.vue +++ b/pagesOrder/components/orderInfoAfter.vue @@ -81,7 +81,7 @@ 备注: - {{ listinfo.orderInfo.remark}} + {{ listinfo.orderInfo.remark||""}} 就餐人数: diff --git a/pagesOrder/components/orderInfoPoints.vue b/pagesOrder/components/orderInfoPoints.vue new file mode 100644 index 0000000..d99a700 --- /dev/null +++ b/pagesOrder/components/orderInfoPoints.vue @@ -0,0 +1,300 @@ + + + + + diff --git a/pagesOrder/components/paymentMethod.vue b/pagesOrder/components/paymentMethod.vue index ca35a7a..d69cd2d 100644 --- a/pagesOrder/components/paymentMethod.vue +++ b/pagesOrder/components/paymentMethod.vue @@ -92,6 +92,7 @@ .paymentMethod{ box-sizing: border-box; margin-top: 30rpx; + padding: 0 20rpx 220rpx 20rpx; border-radius: 18rpx; .paymentMethod_content{ background-color: #fff; diff --git a/pagesOrder/components/rechargeFree.vue b/pagesOrder/components/rechargeFree.vue new file mode 100644 index 0000000..2671dfc --- /dev/null +++ b/pagesOrder/components/rechargeFree.vue @@ -0,0 +1,80 @@ + + + + + diff --git a/pagesOrder/components/topUpActivity.vue b/pagesOrder/components/topUpActivity.vue new file mode 100644 index 0000000..dc7a6b1 --- /dev/null +++ b/pagesOrder/components/topUpActivity.vue @@ -0,0 +1,142 @@ + + + + + diff --git a/pagesOrder/confirm_order/index.vue b/pagesOrder/confirm_order/index.vue index c903705..0d802f6 100644 --- a/pagesOrder/confirm_order/index.vue +++ b/pagesOrder/confirm_order/index.vue @@ -1,11 +1,5 @@