From 385863ded174152838c3bb2c501881d16a4e091a Mon Sep 17 00:00:00 2001 From: hflllll Date: Sun, 27 Apr 2025 19:09:45 +0800 Subject: [PATCH] =?UTF-8?q?1.9=20=E5=BC=80=E5=A7=8B=E8=AF=BB=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/order/OrderItem.vue | 14 +++++++++----- manifest.json | 8 ++++++-- pages.json | 3 ++- pages/index/cart.vue | 9 ++++----- pages/index/category.vue | 13 +++++++++++-- pages/index/order.vue | 38 +++++++++++++++++++++++++++++++------- pages_order/mine/share.vue | 40 ++++++---------------------------------- pages_order/mine/updateUser.vue | 3 ++- store/store.js | 3 +++ utils/authorize.js | 3 +++ utils/index.js | 1 - utils/pay.js | 2 +- 12 files changed, 78 insertions(+), 59 deletions(-) diff --git a/components/order/OrderItem.vue b/components/order/OrderItem.vue index 50e681c..b1fb892 100644 --- a/components/order/OrderItem.vue +++ b/components/order/OrderItem.vue @@ -39,20 +39,20 @@ 全力奔跑中,请耐心等待哦! 您的餐点已送到取餐点,请尽快取餐 - + 取消订单 - + 立即下单 + @click.stop="clickOrder"> 查看订单 - + 订单售后 - + 取餐完成 @@ -101,6 +101,10 @@ export default { this.$utils.navigateTo({ url: '/pages_order/order/afterSale?id=' + this.order.id }) + }, + // 取餐完成 + pickOrder() { + this.$emit('pick', this.order) } } } diff --git a/manifest.json b/manifest.json index 3d12310..1652766 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name" : "unapp模板", - "appid" : "__UNI__197A38F", + "appid" : "__UNI__098D831", "description" : "", "versionName" : "1.0.0", "versionCode" : "100", @@ -57,7 +57,11 @@ "urlCheck" : false }, "usingComponents" : true, - "permission" : {}, + "permission" : { + "scope.userLocation" : { + "desc" : "你的位置信息将用于小程序位置接口的效果展示" // 高速公路行驶持续后台定位 + } + }, "requiredPrivateInfos" : [ "chooseLocation" ], "unipush" : { "enable" : true diff --git a/pages.json b/pages.json index ca114cc..1aa0209 100644 --- a/pages.json +++ b/pages.json @@ -42,7 +42,8 @@ }, "subPackages": [{ "root": "pages_order", - "pages": [{ + "pages": [ + { "path": "mine/partner" }, { diff --git a/pages/index/cart.vue b/pages/index/cart.vue index 7d6481d..e64286c 100644 --- a/pages/index/cart.vue +++ b/pages/index/cart.vue @@ -286,8 +286,7 @@ export default { } .cart-footer { position: fixed; - bottom: 120rpx; - // bottom: calc(120rpx + env(safe-area-inset-bottom)); + bottom: calc(120rpx + env(safe-area-inset-bottom)); left: 0; width: 100%; height: 100rpx; @@ -317,7 +316,7 @@ export default { margin-right: 20rpx; // background-color: red; .total-price { - color: #ff0000; + color: $uni-color-second; font-size: 32rpx; font-weight: bold; margin-left: 10rpx; @@ -334,7 +333,7 @@ export default { font-size: 28rpx; } .checkbox-primary{ - background-color: #019245; + background-color: $uni-color; color: #fff; } .checkbox-collect{ @@ -345,7 +344,7 @@ export default { .control-text{ position: absolute; right: 150rpx; - top: 60rpx; + top: calc(env(safe-area-inset-bottom) + 60rpx); font-size: 26rpx; color: #fff; z-index: 10000; diff --git a/pages/index/category.vue b/pages/index/category.vue index 3ef1d64..10746c3 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -5,11 +5,11 @@ - + + actionText=" " /> 搜索 @@ -114,6 +114,7 @@ export default { change(e) { // this.queryParams.classId = this.category[e].id this.currentChildren = e + }, clickTabs({ index }) { this.current = index @@ -132,6 +133,14 @@ export default { // url: `/pages_order/product/productDetail?id=${id}` // }) this.$utils.navigateTo(`/pages_order/product/productDetail?id=${id}`); + }, + testUtiles() { + try{ + this.$authorize('scope.userLocation') + }catch(error){ + console.log(error); + } + } } } diff --git a/pages/index/order.vue b/pages/index/order.vue index 12678fd..03b9386 100644 --- a/pages/index/order.vue +++ b/pages/index/order.vue @@ -4,17 +4,17 @@ - + + bgColor="#F5F5F5" inputAlign="center" color="#000" placeholderColor="#979797" + searchIconSize="50rpx"> - + + :inactiveStyle="{color: 'black'}" lineHeight="6rpx" lineWidth="55rpx" :current="current" + @click="clickTabs" /> @@ -31,7 +31,8 @@ + @pick="handlePickOrder" + @pay="handlePayOrder" @click="goToOrderDetail" /> @@ -191,6 +192,7 @@ } // 关闭请求 // this.getData() + console.log('点击了tab栏', index); // 模拟根据状态筛选订单 this.filterOrdersByStatus(index) @@ -234,6 +236,7 @@ uni.showModal({ title: '提示', content: '确定要取消订单吗?', + confirmColor: '#019245', success: (res) => { if (res.confirm) { // 模拟取消订单API调用 @@ -283,6 +286,27 @@ } } }, 1500) + }, + // 处理取餐完成 + handlePickOrder(order) { + uni.showModal( { + title: '提示', + content: '确定取餐完成?', + confirmColor: '#019245', + success: (res) => { + if (res.confirm) { + order.status = 'completed', + this.clickTabs({ + index: 3 + }) + uni.showToast({ + title: '取餐完成', + icon: 'success', + duration: 2000 + }) + } + } + }) } } } diff --git a/pages_order/mine/share.vue b/pages_order/mine/share.vue index b96991a..048ce3f 100644 --- a/pages_order/mine/share.vue +++ b/pages_order/mine/share.vue @@ -72,40 +72,12 @@ export default { // 保存到本地 saveToLocal() { // 微信小程序保存图片需要用户授权 - uni.getSetting({ - success: (res) => { - if (!res.authSetting['scope.writePhotosAlbum']) { - uni.authorize({ - scope: 'scope.writePhotosAlbum', // 判断的是相册权限 - success: () => { - this.saveImage() - }, - fail: () => { - // 授权失败 - uni.showModal({ - title: '提示', - content: '需要您授权保存图片', - confirmText: '去设置', - confirmColor: '#019245', - success: (res) => { - if (res.confirm) { - uni.openSetting() - } - }, - fail: () => { - uni.showToast({ - title: '授权失败', - icon: 'none' - }) - } - }) - } - }) - } else { - this.saveImage() - } - } - }) + try{ + this.$authorize('scope.writePhotosAlbum') + this.saveImage() + } catch (error) { + + } }, // 保存图片的具体实现 diff --git a/pages_order/mine/updateUser.vue b/pages_order/mine/updateUser.vue index bee7ddb..728c0f2 100644 --- a/pages_order/mine/updateUser.vue +++ b/pages_order/mine/updateUser.vue @@ -14,7 +14,8 @@ 点击更换头像 diff --git a/store/store.js b/store/store.js index e7e45a0..6c6b331 100644 --- a/store/store.js +++ b/store/store.js @@ -29,6 +29,8 @@ const store = new Vuex.Store({ configList[n.keyName] = n.keyContent; configList[n.keyName + '_keyValue'] = n.keyValue; }); + console.log(configList); + } state.configList = configList uni.$emit('initConfig', state.configList) @@ -57,6 +59,7 @@ const store = new Vuex.Store({ code: res.code, } + // 如果通过分享者链接进入小程序时,会将分享者ID存储在本地 if (uni.getStorageSync('shareId')) { data.shareId = uni.getStorageSync('shareId') } diff --git a/utils/authorize.js b/utils/authorize.js index eca6537..862fc56 100644 --- a/utils/authorize.js +++ b/utils/authorize.js @@ -9,6 +9,7 @@ function authorize(scope){ success, complete(res) { /* 判断如果没有授权就打开设置选项让用户重新授权 */ + // 获取授权信息 uni.getSetting({ success(res) { if (!res.authSetting[scope]) { @@ -24,10 +25,12 @@ function authorize(scope){ title: '当前操作未授权,请授权!', content: '拒绝授权将影响本小程序部分功能的使用', confirmText: '授权', + confirmColor: '#019245', success(e) { if(!e.confirm){ return error() } + // 打开小程序设置页 手动设置 uni.openSetting({ success(res) { if (!res.authSetting[scope]) { diff --git a/utils/index.js b/utils/index.js index 1cbcb29..bc410c0 100644 --- a/utils/index.js +++ b/utils/index.js @@ -1,4 +1,3 @@ - import Vue from 'vue' import util from './utils.js' diff --git a/utils/pay.js b/utils/pay.js index a41698d..682d8e0 100644 --- a/utils/pay.js +++ b/utils/pay.js @@ -2,7 +2,7 @@ // #ifdef H5 import jWeixin from './lib/jweixin-module.js' // #endif - +// 这部分是H5端的微信支付!!!!!! /** * 调用微信支付 * @param {Object} res - 支付参数对象,包含appId、timeStamp、nonceStr等必要信息