diff --git a/App.vue b/App.vue index 48bb5c7..0181ccc 100644 --- a/App.vue +++ b/App.vue @@ -31,7 +31,6 @@ }) } // #endif - this.initLog({ mch_id: 0 }) // 访问记录 @@ -39,7 +38,10 @@ setHeaderHeight(); }, onShow(options) { - + uni.hideTabBar() + }, + onLoad() { + uni.hideTabBar() }, onHide() { // console.log("App Hide"); diff --git a/api/modules/common.js b/api/modules/common.js index 65fe454..d4e743e 100644 --- a/api/modules/common.js +++ b/api/modules/common.js @@ -143,7 +143,7 @@ export default { needLogin: true, }); }, - + wechatPageH5(data) { return request({ url: "/common/wechatPageH5", @@ -152,7 +152,7 @@ export default { needLogin: true, }); }, - + aliH5(data) { return request({ url: "/common/aliH5", @@ -170,7 +170,7 @@ export default { needLogin: true, }); }, - + getFlashMch(data) { return request({ url: "/common/FlashListMch", @@ -187,7 +187,7 @@ export default { needLogin: true, }); }, - + getAliCard(data = {}) { return request({ url: "/common/getAliCard", @@ -196,4 +196,70 @@ export default { needLogin: true, }); }, + + + getFootCat(data) { + return request({ + url: "/common/getFootCat", + method: "GET", + data, + needLogin: true, + }); + }, + getFootGoods(data) { + return request({ + url: "/common/getFootGoods", + method: "GET", + data, + needLogin: true, + }); + }, + goodsInfo(data) { + return request({ + url: "/goods/goodsInfo", + method: "POST", + data, + }); + }, + + getIsBusinessHours(data) { + return request({ + url: "/common/getIsBusinessHours", + method: "POST", + data, + needLogin: true, + }); + }, + DiningRoom(data) { + return request({ + url: "/goodFood/DiningRoom", + method: "POST", + data, + needLogin: true, + }); + }, + FoodOrderPreview(data) { + return request({ + url: "/order/FoodOrderPreview", + method: "GET", + data, + needLogin: true, + }); + }, + FoodPlaceOrder(data) { + return request({ + url: "/order/FoodPlaceOrder", + method: "POST", + data, + needLogin: true, + }); + }, + getFootOrder(data = {}) { + return request({ + url: "/common/getFootOrder", + method: "POST", + data, + needLogin: true, + }); + }, }; \ No newline at end of file diff --git a/api/modules/user.js b/api/modules/user.js index 49ab90e..3d80070 100644 --- a/api/modules/user.js +++ b/api/modules/user.js @@ -11,6 +11,13 @@ export default { data, }); }, + wxH5Login(data) { + return request({ + url: "/auth/wxH5Login", + method: "POST", + data, + }); + }, // 手机号注册 regPhone(data) { return request({ diff --git a/components/login/logins.vue b/components/login/logins.vue index 7d1a199..aa1d52a 100644 --- a/components/login/logins.vue +++ b/components/login/logins.vue @@ -41,15 +41,23 @@ // #ifdef H5 // 如果是支付宝h5自动完成登陆 if (this.type == 0) { - if (this.$utils.isInAliBrowser() || this.$utils.isInWeChatBrowser()) { - this.login() - } + this.h5IsLogin() } // #endif } }, methods: { + async h5IsLogin() { + if (this.$utils.isInAliBrowser() || this.$utils.isInWeChatBrowser()) { + const res = await this.$api.user.isLogin(); + if (res.data.is_login > 0) { + this.$emit('isLogin') + } else { + this.login() + } + } + }, async login({ phone_code } = {}) { @@ -120,8 +128,8 @@ var fruits = redirect_uri.split("?"); // console.log(fruits, 'fruits') redirect_uri = encodeURIComponent(fruits[0]); - // 构建微信授权链接,包含应用的appid、重定向地址等参数 - // const wxAuthUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`; + + // 构建微信授权链接,包含应用的appid、重定向地址等参数; const wxAuthUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_base&state=STATE&component_appid=${component_appid}#wechat_redirect` // 通过重定向将用户导向微信授权页面 window.location.href = wxAuthUrl; diff --git a/components/login/logins11.vue b/components/login/logins11.vue new file mode 100644 index 0000000..e315e6e --- /dev/null +++ b/components/login/logins11.vue @@ -0,0 +1,207 @@ + + + \ No newline at end of file diff --git a/components/the/keyword.vue b/components/the/keyword.vue new file mode 100644 index 0000000..f34b399 --- /dev/null +++ b/components/the/keyword.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/pages.json b/pages.json index 1d66cd4..561dbd3 100644 --- a/pages.json +++ b/pages.json @@ -47,6 +47,24 @@ "titlePenetrate": "YES" } } + }, + { + "path": "pages/takeaway/index", + "style": { + "navigationBarTitleText": "点餐" + } + }, + { + "path": "pages/takeaway/orderAndSettlement/index", + "style": { + "navigationBarTitleText": "点餐" + } + }, + { + "path": "pages/takeaway/orderAndSettlement/edit", + "style": { + "navigationBarTitleText": "点餐" + } } ], "subPackages": [ @@ -120,6 +138,7 @@ "selectedColor": "#E2231A", "borderStyle": "black", "backgroundColor": "#fff", + "height": "0px", "list": [ { "pagePath": "pages/index/index", diff --git a/pages/takeaway/compontents/goods.vue b/pages/takeaway/compontents/goods.vue new file mode 100644 index 0000000..b472a4b --- /dev/null +++ b/pages/takeaway/compontents/goods.vue @@ -0,0 +1,77 @@ + + + + + \ No newline at end of file diff --git a/pages/takeaway/compontents/page-banner.vue b/pages/takeaway/compontents/page-banner.vue new file mode 100644 index 0000000..88fb63a --- /dev/null +++ b/pages/takeaway/compontents/page-banner.vue @@ -0,0 +1,188 @@ + + + + + \ No newline at end of file diff --git a/pages/takeaway/compontents/page-detail.vue b/pages/takeaway/compontents/page-detail.vue new file mode 100644 index 0000000..97d4535 --- /dev/null +++ b/pages/takeaway/compontents/page-detail.vue @@ -0,0 +1,94 @@ + + + + + \ No newline at end of file diff --git a/pages/takeaway/compontents/page-info.vue b/pages/takeaway/compontents/page-info.vue new file mode 100644 index 0000000..692b9d0 --- /dev/null +++ b/pages/takeaway/compontents/page-info.vue @@ -0,0 +1,279 @@ + + + + \ No newline at end of file diff --git a/pages/takeaway/compontents/page-sku.vue b/pages/takeaway/compontents/page-sku.vue new file mode 100644 index 0000000..b509d61 --- /dev/null +++ b/pages/takeaway/compontents/page-sku.vue @@ -0,0 +1,547 @@ + + + + + + + \ No newline at end of file diff --git a/pages/takeaway/compontents/smallMaterial.vue b/pages/takeaway/compontents/smallMaterial.vue new file mode 100644 index 0000000..5a98a0c --- /dev/null +++ b/pages/takeaway/compontents/smallMaterial.vue @@ -0,0 +1,244 @@ + + + + + \ No newline at end of file diff --git a/pages/takeaway/index.vue b/pages/takeaway/index.vue new file mode 100644 index 0000000..7d8af7a --- /dev/null +++ b/pages/takeaway/index.vue @@ -0,0 +1,486 @@ + + + + \ No newline at end of file diff --git a/pages/takeaway/orderAndSettlement/edit.vue b/pages/takeaway/orderAndSettlement/edit.vue new file mode 100644 index 0000000..b83b4bb --- /dev/null +++ b/pages/takeaway/orderAndSettlement/edit.vue @@ -0,0 +1,126 @@ + + + + + \ No newline at end of file diff --git a/pages/takeaway/orderAndSettlement/index.vue b/pages/takeaway/orderAndSettlement/index.vue new file mode 100644 index 0000000..6e7f699 --- /dev/null +++ b/pages/takeaway/orderAndSettlement/index.vue @@ -0,0 +1,734 @@ + + + + + \ No newline at end of file diff --git a/subPackages/inPersonToPay/index/index.vue b/subPackages/inPersonToPay/index/index.vue index af1d35f..0f713df 100644 --- a/subPackages/inPersonToPay/index/index.vue +++ b/subPackages/inPersonToPay/index/index.vue @@ -8,18 +8,21 @@ - + {{ info.name }} - + - + - + + {{ total_price }} + + @@ -34,30 +37,11 @@ - - - - 微信 - - - - - - - - - 支付宝 - - - - - - - 微信 + 微信支付 @@ -65,7 +49,7 @@ - 支付宝 + 支付宝支付 @@ -73,7 +57,16 @@ - + + + + + @@ -82,6 +75,7 @@ import coupons from '../compontents/coupons.vue'; import logins from '@/components/login/logins.vue' + import keyword from '@/components/the/keyword.vue' // #ifndef MP import wxConfig from '@/utils/wxConfig' @@ -91,7 +85,8 @@ components: { coupons, isPhone, - logins + logins, + keyword }, data() { return { @@ -183,24 +178,29 @@ } this.coupon = res.data.coupon }, + valueChange(e) { + this.total_price += ('' + e) + this.formatInput() + }, + valueBackspace() { + let value = this.total_price.toString() + value = value.slice(0, -1) + this.total_price = value + }, formatInput() { if (this.total_price !== null) { - let value = this.total_price.toString(); - value = value.replace(/[^\d.]/g, ""); // 去掉非数字和小数点 - value = value.replace(/^\./g, ""); // 去掉开头的小数点 - value = value.replace(/\.{2,}/g, "."); // 去掉多余的小数点 - value = value.replace(".", "$#$").replace(/\./g, "").replace("$#$", "."); - // 将第一个小数点替换成分隔符 - value = parseFloat(value); - if (isNaN(value)) { - value = null; - } else { - value = value.toFixed(2); // 保留两位小数 + let value = this.total_price + let value_arr = value.toString().split('.') + if (value_arr.length > 1) { + var len = value_arr.pop().length; + if (len > 2) { + value = parseFloat(value); + value = value.toFixed(2); // 保留两位小数 + } } this.total_price = value; } }, - async pay(type) { if (this.submit()) return this.payCurrent = true @@ -496,6 +496,15 @@