fix:新增电话号码授权,修复订单创建/取消时用户手机消失的情况

This commit is contained in:
2025-07-11 17:03:34 +08:00
parent 4851e0500d
commit f8ff55758b
24 changed files with 628 additions and 70 deletions
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
<view class="container data-v-2faa63bb"><view class="device-header data-v-2faa63bb"><view class="{{['device-status-card', 'data-v-2faa63bb', b]}}"><view class="status-indicator data-v-2faa63bb"></view><text class="status-text data-v-2faa63bb">{{a}}</text></view><view class="device-title data-v-2faa63bb"><text class="name data-v-2faa63bb">共享风扇</text><view class="device-meta data-v-2faa63bb"><text class="id-label data-v-2faa63bb">设备号:</text><text class="id-value data-v-2faa63bb">{{c}}</text></view></view></view><view class="card device-info-card data-v-2faa63bb"><view class="card-row data-v-2faa63bb"><view class="card-item data-v-2faa63bb"><view class="item-icon location-icon data-v-2faa63bb"><image class="data-v-2faa63bb" src="{{d}}" mode="aspectFill" style="width:45rpx;height:45rpx"></image></view><view class="item-content data-v-2faa63bb"><text class="item-label data-v-2faa63bb">当前位置</text><text class="item-value data-v-2faa63bb">{{e}}</text></view></view><view class="card-item data-v-2faa63bb"><view class="{{['item-icon', 'battery-icon', 'data-v-2faa63bb', g && 'battery-low']}}"><image class="data-v-2faa63bb" src="{{f}}" mode="aspectFill" style="width:45rpx;height:45rpx"></image></view><view class="item-content data-v-2faa63bb"><text class="item-label data-v-2faa63bb">电池电量</text><text class="item-value data-v-2faa63bb">{{h}}%</text></view></view></view></view><view class="card pricing-card data-v-2faa63bb"><view class="card-header data-v-2faa63bb"><text class="card-title data-v-2faa63bb">计费规则</text></view><view class="pricing-banner data-v-2faa63bb"><view class="pricing-main data-v-2faa63bb"><text class="price data-v-2faa63bb">¥5.00</text><text class="unit data-v-2faa63bb">/小时</text></view><text class="cap-price data-v-2faa63bb">封顶 ¥99</text></view><view class="pricing-rules data-v-2faa63bb"><view class="rule-item data-v-2faa63bb"><view class="rule-dot data-v-2faa63bb"></view><text class="rule-text data-v-2faa63bb">前15分钟内归还<text class="highlight data-v-2faa63bb">免费</text></text></view><view class="rule-item data-v-2faa63bb"><view class="rule-dot data-v-2faa63bb"></view><text class="rule-text data-v-2faa63bb">不足60分钟按60分钟计费</text></view><view class="rule-item data-v-2faa63bb"><view class="rule-dot data-v-2faa63bb"></view><text class="rule-text data-v-2faa63bb">持续计费至99元视为买断</text></view></view></view><view class="card notice-card data-v-2faa63bb"><view class="card-header data-v-2faa63bb"><text class="card-title data-v-2faa63bb">使用须知</text></view><view class="notice-items data-v-2faa63bb"><view class="notice-item data-v-2faa63bb"><view class="notice-dot data-v-2faa63bb"></view><text class="notice-text data-v-2faa63bb">请在使用前检查设备是否完好</text></view><view class="notice-item data-v-2faa63bb"><view class="notice-dot data-v-2faa63bb"></view><text class="notice-text data-v-2faa63bb">请在指定区域内使用设备</text></view><view class="notice-item data-v-2faa63bb"><view class="notice-dot data-v-2faa63bb"></view><text class="notice-text data-v-2faa63bb">归还时请确保设备完好,避免损坏</text></view></view></view><view class="footer data-v-2faa63bb"><view class="wechat-credit data-v-2faa63bb"><image src="{{i}}" mode="aspectFit" class="wx-icon data-v-2faa63bb"></image><view class="credit-text data-v-2faa63bb"><text class="data-v-2faa63bb">微信支付分</text><text class="credit-divider data-v-2faa63bb">|</text><text class="credit-score data-v-2faa63bb">支付分200分及以上优享</text></view></view><button class="{{['rent-button', 'data-v-2faa63bb', k && 'return-button']}}" bindtap="{{l}}"><text class="data-v-2faa63bb">{{j}}</text></button><view class=" data-v-2faa63bb" style="align-items:center;align-content:center;text-align:center;line-height:50rpx" bindtap="{{m}}"> 无法免押点这里></view></view></view>
<view class="container data-v-981f4200"><view class="device-header data-v-981f4200"><view class="{{['device-status-card', 'data-v-981f4200', b]}}"><view class="status-indicator data-v-981f4200"></view><text class="status-text data-v-981f4200">{{a}}</text></view><view class="device-title data-v-981f4200"><text class="name data-v-981f4200">共享风扇</text><view class="device-meta data-v-981f4200"><text class="id-label data-v-981f4200">设备号:</text><text class="id-value data-v-981f4200">{{c}}</text></view></view></view><view class="card device-info-card data-v-981f4200"><view class="card-row data-v-981f4200"><view class="card-item data-v-981f4200"><view class="item-icon location-icon data-v-981f4200"><image class="data-v-981f4200" src="{{d}}" mode="aspectFill" style="width:45rpx;height:45rpx"></image></view><view class="item-content data-v-981f4200"><text class="item-label data-v-981f4200">当前位置</text><text class="item-value data-v-981f4200">{{e}}</text></view></view><view class="card-item data-v-981f4200"><view class="{{['item-icon', 'battery-icon', 'data-v-981f4200', g && 'battery-low']}}"><image class="data-v-981f4200" src="{{f}}" mode="aspectFill" style="width:45rpx;height:45rpx"></image></view><view class="item-content data-v-981f4200"><text class="item-label data-v-981f4200">电池电量</text><text class="item-value data-v-981f4200">{{h}}%</text></view></view></view></view><view class="card pricing-card data-v-981f4200"><view class="card-header data-v-981f4200"><text class="card-title data-v-981f4200">计费规则</text></view><view class="pricing-banner data-v-981f4200"><view class="pricing-main data-v-981f4200"><text class="price data-v-981f4200">¥5.00</text><text class="unit data-v-981f4200">/小时</text></view><text class="cap-price data-v-981f4200">封顶 ¥99</text></view><view class="pricing-rules data-v-981f4200"><view class="rule-item data-v-981f4200"><view class="rule-dot data-v-981f4200"></view><text class="rule-text data-v-981f4200">前15分钟内归还<text class="highlight data-v-981f4200">免费</text></text></view><view class="rule-item data-v-981f4200"><view class="rule-dot data-v-981f4200"></view><text class="rule-text data-v-981f4200">不足60分钟按60分钟计费</text></view><view class="rule-item data-v-981f4200"><view class="rule-dot data-v-981f4200"></view><text class="rule-text data-v-981f4200">持续计费至99元视为买断</text></view></view></view><view class="card notice-card data-v-981f4200"><view class="card-header data-v-981f4200"><text class="card-title data-v-981f4200">使用须知</text></view><view class="notice-items data-v-981f4200"><view class="notice-item data-v-981f4200"><view class="notice-dot data-v-981f4200"></view><text class="notice-text data-v-981f4200">请在使用前检查设备是否完好</text></view><view class="notice-item data-v-981f4200"><view class="notice-dot data-v-981f4200"></view><text class="notice-text data-v-981f4200">请在指定区域内使用设备</text></view><view class="notice-item data-v-981f4200"><view class="notice-dot data-v-981f4200"></view><text class="notice-text data-v-981f4200">归还时请确保设备完好,避免损坏</text></view></view></view><view class="footer data-v-981f4200"><view class="wechat-credit data-v-981f4200"><image src="{{i}}" mode="aspectFit" class="wx-icon data-v-981f4200"></image><view class="credit-text data-v-981f4200"><text class="data-v-981f4200">微信支付分</text><text class="credit-divider data-v-981f4200">|</text><text class="credit-score data-v-981f4200">支付分200分及以上优享</text></view></view><button class="{{['rent-button', 'data-v-981f4200', k && 'return-button']}}" bindtap="{{l}}"><text class="data-v-981f4200">{{j}}</text></button><view class=" data-v-981f4200" style="align-items:center;align-content:center;text-align:center;line-height:50rpx" bindtap="{{m}}"> 无法免押点这里></view></view><view wx:if="{{n}}" class="phone-auth-popup data-v-981f4200"><view class="popup-mask data-v-981f4200" catchtap="{{o}}"></view><view class="popup-content data-v-981f4200"><view class="popup-header data-v-981f4200"><text class="popup-title data-v-981f4200">授权获取手机号</text></view><view class="popup-body data-v-981f4200"><view class="auth-desc data-v-981f4200"><text class="data-v-981f4200">为了提供更好的服务,需要授权获取您的手机号</text></view><button class="auth-btn data-v-981f4200" open-type="getPhoneNumber" bindgetphonenumber="{{p}}"> 一键获取手机号 </button><view class="auth-cancel data-v-981f4200" bindtap="{{q}}"><text class="data-v-981f4200">暂不授权</text></view></view></view></view></view>
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
"use strict";const e=require("../../common/vendor.js"),o=require("../../util/index.js"),n=require("../../config/url.js"),t=require("../../config/user.js"),i=require("../../common/assets.js"),a={methods:{async handleScan(){try{const d=await new Promise(((o,n)=>{e.index.scanCode({success:o,fail:n})}));console.log(d.path);let r=o.getQueryString(d.path,"deviceNo");if(console.log("扫码路径:",d.path),console.log("解析到的设备号:",r),!r)return void e.index.showToast({title:"无效的设备二维码",icon:"none"});e.index.getStorageSync("token")||await o.wxLogin();const c=await e.index.request({url:`${n.URL||"http://127.0.0.1:8080"}/app/order/inUse`,method:"GET",header:{Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")}});if(console.log("使用中订单检查结果:",JSON.stringify(c)),200==c.statusCode&&200==c.data.code&&c.data.data){const o=c.data.data;return console.log("检测到使用中订单,准备跳转:",o),e.index.reLaunch({url:`/pages/return/index?orderId=${o.orderId}&deviceId=${r||o.deviceNo}`}),void console.log("已发起页面跳转")}const s=await e.index.request({url:`${n.URL||"http://127.0.0.1:8080"}/app/order/unpaid`,method:"GET",header:{Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")}});if(console.log("待支付订单检查结果:",JSON.stringify(s)),200==s.statusCode&&200==s.data.code&&s.data.data){const o=s.data.data;console.log("检测到待支付订单,准备跳转:",o),e.index.navigateTo({url:`/pages/order/payment?orderId=${o.orderId}`})}else{console.log("无待支付订单,获取设备信息, deviceNo:",r);try{const o=await t.getDeviceInfo(r);if(200==o.code&&o.data&&o.data.device){const n=o.data.device;if(n.feeConfig){console.log("获取到设备feeConfig信息:",n.feeConfig);try{JSON.parse(n.feeConfig);e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}&feeConfig=${encodeURIComponent(n.feeConfig)}`})}catch(i){console.error("解析feeConfig失败:",i),e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}`})}}else e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}`})}else console.error("获取设备信息失败:",o.msg||"未知错误"),e.index.showToast({title:"获取设备信息失败",icon:"none"}),e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}`})}catch(a){console.error("获取设备信息异常:",a),e.index.showToast({title:"获取设备信息失败",icon:"none"}),e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}`})}}}catch(a){console.error("扫码处理失败:",a),e.index.showToast({title:"扫码失败",icon:"none"})}}}};const d=e._export_sfc(a,[["render",function(o,n,t,a,d,r){return{a:i._imports_0,b:i._imports_1,c:e.o(((...e)=>r.handleScan&&r.handleScan(...e)))}}],["__scopeId","data-v-764894e1"]]);wx.createPage(d);
"use strict";const e=require("../../common/vendor.js"),o=require("../../util/index.js"),t=require("../../config/url.js"),n=require("../../config/user.js"),i=require("../../common/assets.js"),a={methods:{async handleScan(){try{const d=await new Promise(((o,t)=>{e.index.scanCode({success:o,fail:t})}));console.log(d.path);let r=o.getQueryString(d.path,"deviceNo");if(!r)return void e.index.showToast({title:"无效的设备二维码",icon:"none"});e.index.getStorageSync("token")||await o.wxLogin();const c=await e.index.request({url:`${t.URL||"http://127.0.0.1:8080"}/app/order/inUse`,method:"GET",header:{Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")}});if(200==c.statusCode&&200==c.data.code&&c.data.data){const o=c.data.data;return e.index.reLaunch({url:`/pages/return/index?orderId=${o.orderId}&deviceId=${r||o.deviceNo}`}),void console.log("已发起页面跳转")}const s=await e.index.request({url:`${t.URL||"http://127.0.0.1:8080"}/app/order/unpaid`,method:"GET",header:{Authorization:"Bearer "+e.index.getStorageSync("token"),Clientid:e.index.getStorageSync("client_id")}});if(console.log("待支付订单检查结果:",JSON.stringify(s)),200==s.statusCode&&200==s.data.code&&s.data.data){const o=s.data.data;e.index.navigateTo({url:`/pages/order/payment?orderId=${o.orderId}`})}else try{const o=await n.getDeviceInfo(r);if(200==o.code&&o.data&&o.data.device){const t=o.data.device;if(t.feeConfig){console.log("获取到设备feeConfig信息:",t.feeConfig);try{JSON.parse(t.feeConfig);e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}&feeConfig=${encodeURIComponent(t.feeConfig)}`})}catch(i){console.error("解析feeConfig失败:",i),e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}`})}}else e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}`})}else console.error("获取设备信息失败:",o.msg||"未知错误"),e.index.showToast({title:"获取设备信息失败",icon:"none"}),e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}`})}catch(a){console.error("获取设备信息异常:",a),e.index.showToast({title:"获取设备信息失败",icon:"none"}),e.index.navigateTo({url:`/pages/device/detail?deviceNo=${r}`})}}catch(a){console.error("扫码处理失败:",a),e.index.showToast({title:"扫码失败",icon:"none"})}}}};const d=e._export_sfc(a,[["render",function(o,t,n,a,d,r){return e.e({a:i._imports_0,b:i._imports_1,c:e.o(((...e)=>r.handleScan&&r.handleScan(...e))),d:o.showPhoneAuthPopup},o.showPhoneAuthPopup?{e:e.o((e=>o.showPhoneAuthPopup=!1)),f:e.o(((...e)=>o.onGetPhoneNumber&&o.onGetPhoneNumber(...e))),g:e.o((e=>o.showPhoneAuthPopup=!1))}:{})}],["__scopeId","data-v-527ff3b8"]]);wx.createPage(d);
+1 -1
View File
@@ -1 +1 @@
<view class="container data-v-764894e1"><view class="header data-v-764894e1"><view class="header-bg data-v-764894e1"><view class="circle-decoration circle-1 data-v-764894e1"></view><view class="circle-decoration circle-2 data-v-764894e1"></view><view class="wave-decoration data-v-764894e1"></view></view><view class="header-content data-v-764894e1"><view class="brand-area data-v-764894e1"><image class="brand-logo data-v-764894e1" src="{{a}}" mode="aspectFit"></image><view class="brand-text data-v-764894e1"><text class="title data-v-764894e1">共享风扇</text><text class="subtitle data-v-764894e1">随时随地,享受清凉</text></view></view><view class="header-info data-v-764894e1"><view class="service-tag data-v-764894e1"><text class="data-v-764894e1">便捷租赁</text><text class="dot data-v-764894e1">·</text><text class="data-v-764894e1">品质保障</text></view></view></view></view><view class="scan-section data-v-764894e1"><view class="scan-card data-v-764894e1"><view class="scan-btn data-v-764894e1" bindtap="{{c}}"><image class="scan-icon data-v-764894e1" src="{{b}}" mode="aspectFit"/><text class="scan-text data-v-764894e1">扫码使用</text></view><view class="scan-desc data-v-764894e1"><text class="data-v-764894e1">扫描设备二维码即可使用或归还</text></view></view></view><view class="price-card data-v-764894e1"><view class="card-header data-v-764894e1"><text class="card-title data-v-764894e1">收费规则</text></view><view class="price-rules data-v-764894e1"><view class="price-item data-v-764894e1"><view class="price-tag data-v-764894e1">5.0<text class="unit data-v-764894e1">元/小时</text></view></view><view class="divider data-v-764894e1"></view><view class="rule-list data-v-764894e1"><view class="rule-item data-v-764894e1"><view class="rule-dot data-v-764894e1"></view><text class="data-v-764894e1">15分钟内归还免费</text></view><view class="rule-item data-v-764894e1"><view class="rule-dot data-v-764894e1"></view><text class="data-v-764894e1">不足1小时按1小时计费</text></view><view class="rule-item data-v-764894e1"><view class="rule-dot data-v-764894e1"></view><text class="data-v-764894e1">封顶99元,计费达99元视为买断</text></view></view></view></view><view class="usage-steps data-v-764894e1"><view class="steps-header data-v-764894e1"><text class="steps-title data-v-764894e1">使用流程</text></view><view class="steps-container data-v-764894e1"><view class="step-item data-v-764894e1"><view class="step-icon data-v-764894e1"><text class="step-number data-v-764894e1">1</text></view><text class="step-text data-v-764894e1">扫码弹出</text></view><view class="step-arrow data-v-764894e1"></view><view class="step-item data-v-764894e1"><view class="step-icon data-v-764894e1"><text class="step-number data-v-764894e1">2</text></view><text class="step-text data-v-764894e1">使用风扇</text></view><view class="step-arrow data-v-764894e1"></view><view class="step-item data-v-764894e1"><view class="step-icon data-v-764894e1"><text class="step-number data-v-764894e1">3</text></view><text class="step-text data-v-764894e1">插入归还</text></view><view class="step-arrow data-v-764894e1"></view><view class="step-item data-v-764894e1"><view class="step-icon data-v-764894e1"><text class="step-number data-v-764894e1">4</text></view><text class="step-text data-v-764894e1">结束订单</text></view></view></view></view>
<view class="container data-v-527ff3b8"><view class="header data-v-527ff3b8"><view class="header-bg data-v-527ff3b8"><view class="circle-decoration circle-1 data-v-527ff3b8"></view><view class="circle-decoration circle-2 data-v-527ff3b8"></view><view class="wave-decoration data-v-527ff3b8"></view></view><view class="header-content data-v-527ff3b8"><view class="brand-area data-v-527ff3b8"><image class="brand-logo data-v-527ff3b8" src="{{a}}" mode="aspectFit"></image><view class="brand-text data-v-527ff3b8"><text class="title data-v-527ff3b8">共享风扇</text><text class="subtitle data-v-527ff3b8">随时随地,享受清凉</text></view></view><view class="header-info data-v-527ff3b8"><view class="service-tag data-v-527ff3b8"><text class="data-v-527ff3b8">便捷租赁</text><text class="dot data-v-527ff3b8">·</text><text class="data-v-527ff3b8">品质保障</text></view></view></view></view><view class="scan-section data-v-527ff3b8"><view class="scan-card data-v-527ff3b8"><view class="scan-btn data-v-527ff3b8" bindtap="{{c}}"><image class="scan-icon data-v-527ff3b8" src="{{b}}" mode="aspectFit"/><text class="scan-text data-v-527ff3b8">扫码使用</text></view><view class="scan-desc data-v-527ff3b8"><text class="data-v-527ff3b8">扫描设备二维码即可使用或归还</text></view></view></view><view class="price-card data-v-527ff3b8"><view class="card-header data-v-527ff3b8"><text class="card-title data-v-527ff3b8">收费规则</text></view><view class="price-rules data-v-527ff3b8"><view class="price-item data-v-527ff3b8"><view class="price-tag data-v-527ff3b8">5.0<text class="unit data-v-527ff3b8">元/小时</text></view></view><view class="divider data-v-527ff3b8"></view><view class="rule-list data-v-527ff3b8"><view class="rule-item data-v-527ff3b8"><view class="rule-dot data-v-527ff3b8"></view><text class="data-v-527ff3b8">15分钟内归还免费</text></view><view class="rule-item data-v-527ff3b8"><view class="rule-dot data-v-527ff3b8"></view><text class="data-v-527ff3b8">不足1小时按1小时计费</text></view><view class="rule-item data-v-527ff3b8"><view class="rule-dot data-v-527ff3b8"></view><text class="data-v-527ff3b8">封顶99元,计费达99元视为买断</text></view></view></view></view><view class="usage-steps data-v-527ff3b8"><view class="steps-header data-v-527ff3b8"><text class="steps-title data-v-527ff3b8">使用流程</text></view><view class="steps-container data-v-527ff3b8"><view class="step-item data-v-527ff3b8"><view class="step-icon data-v-527ff3b8"><text class="step-number data-v-527ff3b8">1</text></view><text class="step-text data-v-527ff3b8">扫码弹出</text></view><view class="step-arrow data-v-527ff3b8"></view><view class="step-item data-v-527ff3b8"><view class="step-icon data-v-527ff3b8"><text class="step-number data-v-527ff3b8">2</text></view><text class="step-text data-v-527ff3b8">使用风扇</text></view><view class="step-arrow data-v-527ff3b8"></view><view class="step-item data-v-527ff3b8"><view class="step-icon data-v-527ff3b8"><text class="step-number data-v-527ff3b8">3</text></view><text class="step-text data-v-527ff3b8">插入归还</text></view><view class="step-arrow data-v-527ff3b8"></view><view class="step-item data-v-527ff3b8"><view class="step-icon data-v-527ff3b8"><text class="step-number data-v-527ff3b8">4</text></view><text class="step-text data-v-527ff3b8">结束订单</text></view></view></view><view wx:if="{{d}}" class="phone-auth-popup data-v-527ff3b8"><view class="popup-mask data-v-527ff3b8" catchtap="{{e}}"></view><view class="popup-content data-v-527ff3b8"><view class="popup-header data-v-527ff3b8"><text class="popup-title data-v-527ff3b8">授权获取手机号</text></view><view class="popup-body data-v-527ff3b8"><view class="auth-desc data-v-527ff3b8"><text class="data-v-527ff3b8">为了提供更好的服务和紧急联系,需要授权获取您的手机号</text></view><button class="auth-btn data-v-527ff3b8" open-type="getPhoneNumber" bindgetphonenumber="{{f}}"><text class="data-v-527ff3b8">一键获取手机号</text></button><view class="auth-cancel data-v-527ff3b8" bindtap="{{g}}"><text class="data-v-527ff3b8">暂不授权</text></view></view></view></view></view>
File diff suppressed because one or more lines are too long