diff --git a/src/api/system/order.js b/src/api/system/order.js index 1d1c36a..57b56eb 100644 --- a/src/api/system/order.js +++ b/src/api/system/order.js @@ -42,3 +42,16 @@ export function delOrder(orderId) { method: 'delete' }) } + +// 结束订单 +export function closeBill(orderNo) { + return request({ + url: '/app/order/orderEnd', + method: 'post', + params: { + orderNo: orderNo + } + }) +} + + diff --git a/src/components/MapSelect/index.vue b/src/components/MapSelect/index.vue index 947393f..87310d6 100644 --- a/src/components/MapSelect/index.vue +++ b/src/components/MapSelect/index.vue @@ -2,9 +2,8 @@
@@ -25,9 +24,9 @@ :loading="searching" @keyup.enter.native="searchAddress" > - @@ -37,8 +36,8 @@
取 消 - 确 定 + 确 定
@@ -83,6 +82,11 @@ export default { lng: null, lat: null, address: '' + }, + defaultLocation: { + lng: 116.397428, + lat: 39.90923, + address: '' } } }, @@ -94,76 +98,84 @@ export default { methods: { showMapDialog() { this.dialogVisible = true - this.$nextTick(() => { - // 设置安全密钥配置 - window._AMapSecurityConfig = { - securityJsCode: globalConfig.aMap.secret - } - + // 确保在设置安全密钥后再初始化地图 + this.$nextTick(async () => { // 确保高德地图已加载 - this.$loadAMap().then(() => { + try { + await this.$loadAMap(); this.initMap() - }).catch(err => { + } catch (err) { this.$modal.msgError('地图加载失败,请检查网络后刷新重试') console.error('高德地图加载失败:', err) this.dialogVisible = false - }) + } }) }, initMap() { if (!this.map) { - // 加载所需插件 - AMap.plugin([ - 'AMap.Geocoder', - 'AMap.PlaceSearch', - 'AMap.Geolocation' - ], () => { - this.map = new AMap.Map('map', { - zoom: 13 - }) - - // 添加定位控件 - this.map.addControl(new AMap.Geolocation({ - position: 'RB' - })) + // 等待地图实例创建完成 + this.map = new AMap.Map('map', { + zoom: 13 + }); - // 初始化地理编码服务 - this.geocoder = new AMap.Geocoder({ - radius: 1000, - extensions: 'all' - }) - - // 初始化搜索服务 - this.placeSearch = new AMap.PlaceSearch({ - pageSize: 10, - citylimit: true, - extensions: 'all' - }) + // 确保地图实例创建完成后再加载插件 + this.map.on('complete', () => { + // 加载所需插件 + AMap.plugin([ + 'AMap.Geocoder', + 'AMap.PlaceSearch', + 'AMap.Geolocation' + ], () => { + // 添加定位控件 + this.map.addControl(new AMap.Geolocation({ + position: 'RB' + })) - // 点击地图事件 - this.map.on('click', (e) => { - this.updateMarker(e.lnglat) - this.getAddress(e.lnglat) - }) - - // 如果已有坐标,则定位到该位置 - if (this.currentLocation.lng && this.currentLocation.lat) { - const lnglat = new AMap.LngLat(this.currentLocation.lng, this.currentLocation.lat) - this.updateMarker(lnglat) - this.map.setCenter(lnglat) - this.getAddress(lnglat) - } else { - // 定位到当前位置 - const geolocation = new AMap.Geolocation() - geolocation.getCurrentPosition((status, result) => { - if (status === 'complete') { - this.updateMarker(result.position) - this.map.setCenter(result.position) - this.getAddress(result.position) - } + // 初始化地理编码服务 + this.geocoder = new AMap.Geocoder({ + radius: 1000, + extensions: 'all' }) - } - }) + + // 初始化搜索服务 + this.placeSearch = new AMap.PlaceSearch({ + pageSize: 10, + citylimit: true, + extensions: 'all' + }) + + // 点击地图事件 + this.map.on('click', (e) => { + this.updateMarker(e.lnglat) + this.getAddress(e.lnglat) + }) + + // 如果已有坐标,则定位到该位置 + if (this.currentLocation.lng && this.currentLocation.lat) { + const lnglat = new AMap.LngLat(this.currentLocation.lng, this.currentLocation.lat) + this.updateMarker(lnglat) + this.map.setCenter(lnglat) + this.getAddress(lnglat) + } else { + // 定位到当前位置 + const geolocation = new AMap.Geolocation() + geolocation.getCurrentPosition((status, result) => { + if (status === 'complete') { + this.updateMarker(result.position) + this.map.setCenter(result.position) + this.getAddress(result.position) + } else { + // 定位失败时使用默认位置(北京) + const defaultLnglat = new AMap.LngLat(this.defaultLocation.lng, this.defaultLocation.lat) + this.updateMarker(defaultLnglat) + this.map.setCenter(defaultLnglat) + this.getAddress(defaultLnglat) + this.$message.warning('定位失败,已切换到默认位置') + } + }) + } + }) + }); } }, updateMarker(lnglat) { @@ -175,7 +187,7 @@ export default { map: this.map, draggable: true }) - + // 拖动结束后获取地址 this.marker.on('dragend', (e) => { this.getAddress(e.target.getPosition()) @@ -210,18 +222,18 @@ export default { this.marker.setMap(null) this.marker = null } - + // 显示加载状态 this.$set(this, 'searching', true) - + this.placeSearch.search(this.searchKey, (status, result) => { console.log('搜索结果:', status, result) this.searching = false - + if (status === 'complete') { this.searchResults = result.poiList.pois console.log('解析到的地点:', this.searchResults) - + // 更新搜索结果列表 this.$nextTick(() => { if (this.searchResults.length > 0) { @@ -233,7 +245,7 @@ export default { } }) } else { - console.error('搜索失败:', result) + console.error('搜索失败11111:', result) this.$message.error('搜索失败,请重试') } }, (error) => { @@ -251,9 +263,27 @@ export default { this.searchResults = [] this.searchKey = '' }, + handleAddressChange(val) { + this.$emit('input', val) + // 如果有经纬度信息,一并更新 + if (this.currentLocation.lng && this.currentLocation.lat) { + this.$emit('select', { + ...this.currentLocation, + address: val + }) + } + }, confirmLocation() { - this.$emit('input', this.currentLocation.address) - this.$emit('select', this.currentLocation) + // 即使没有完整的位置信息也允许确认 + const location = { + address: this.currentLocation.address || this.address || '', + lng: this.currentLocation.lng || this.defaultLocation.lng, + lat: this.currentLocation.lat || this.defaultLocation.lat + } + // 更新本地 address 变量 + this.address = location.address + this.$emit('input', location.address) + this.$emit('select', location) this.dialogVisible = false } } @@ -281,14 +311,14 @@ export default { left: 10px; width: 300px; z-index: 1; - + .current-location { margin-top: 10px; padding: 10px; background: rgba(255, 255, 255, 0.9); border-radius: 4px; box-shadow: 0 2px 12px 0 rgba(0,0,0,.1); - + p { margin: 0; font-size: 13px; @@ -296,28 +326,28 @@ export default { word-break: break-all; } } - + .search-result { margin-top: 5px; background: #fff; box-shadow: 0 2px 12px 0 rgba(0,0,0,.1); max-height: 300px; overflow-y: auto; - + ul { margin: 0; padding: 0; list-style: none; - + li { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #eee; - + &:hover { background: #f5f7fa; } - + .address { font-size: 12px; color: #909399; @@ -327,4 +357,4 @@ export default { } } } - \ No newline at end of file + diff --git a/src/main.js b/src/main.js index 0cef65b..cac5c12 100644 --- a/src/main.js +++ b/src/main.js @@ -95,18 +95,18 @@ function loadAMap() { resolve(window.AMap) return } - + const script = document.createElement('script') script.type = 'text/javascript' script.async = true const { version, key, plugins } = globalConfig.aMap script.src = `https://webapi.amap.com/maps?v=${version}&key=${key}&plugin=${plugins.join(',')}` - + script.onerror = reject script.onload = () => { resolve(window.AMap) } - + document.head.appendChild(script) }) } @@ -120,3 +120,8 @@ new Vue({ store, render: h => h(App) }) + +// 设置安全密钥配置 +window._AMapSecurityConfig = { + securityJsCode: globalConfig.aMap.secret +} diff --git a/src/views/system/changeBalance/index.vue b/src/views/system/changeBalance/index.vue index 5ce01a0..621be7f 100644 --- a/src/views/system/changeBalance/index.vue +++ b/src/views/system/changeBalance/index.vue @@ -20,7 +20,7 @@ @@ -102,7 +102,7 @@ @@ -135,7 +135,7 @@ @@ -104,7 +104,7 @@ import { listDetail, getDetail, delDetail, addDetail, updateDetail } from "@/api export default { name: "Detail", - dicts: ['rl_user_type','rl_dividend_status'], + dicts: ['ss_user_type','ss_dividend_status'], props:{ query: { type: Object, @@ -167,7 +167,7 @@ export default { formatProportion(row) { let dividendProportion = row.dividendProportion; if (dividendProportion !== null && dividendProportion !== undefined) { - return (dividendProportion * 100).toFixed(2) + '%'; + return dividendProportion.toFixed(2) + '%'; } return '—'; // 或者返回其他默认值 }, diff --git a/src/views/system/device/device_detail.vue b/src/views/system/device/device_detail.vue index 7e2affd..eeb0e2e 100644 --- a/src/views/system/device/device_detail.vue +++ b/src/views/system/device/device_detail.vue @@ -357,6 +357,22 @@ + + + + + @@ -474,6 +490,7 @@ import QRCode from 'qrcode' import Role from '@/views/system/rule/index.vue' import Log from '@/views/system/commandLog/index.vue' import {getDomain} from "@/api/common/common"; +import { listStore } from "@/api/system/store"; export default { name: "DeviceDetail", components: { @@ -547,7 +564,12 @@ export default { packageName: '', chargeMode: '', chargeType: '' - } + }, + facilityQuery: { + name: undefined, + storeId: undefined + }, + storeOptions: [], } }, computed: { @@ -636,21 +658,19 @@ export default { const queryParams = { pageNum: this.facilityQueryParams.pageNum, pageSize: this.facilityQueryParams.pageSize, - name: this.facilityQueryParams.name, + name: this.facilityQueryParams.equipmentName, type: this.facilityQueryParams.type, status: "0", - storeId: this.deviceData.storeId, + storeId: this.facilityQueryParams.storeId, merchantId: this.deviceData.userId, isBind: false }; - console.log(queryParams, 'queryParams'); listUnifiedEquipment(queryParams).then(response => { this.facilityList = response.rows; this.facilityTotal = response.total; this.facilityTableLoading = false; }).catch(() => { - this.$message.error("获取设施列表失败"); this.facilityTableLoading = false; }); }, @@ -755,7 +775,9 @@ export default { openBindFacilityDialog() { this.bindFacilityDialogVisible = true; - this.getFacilityList(); + this.getStoreOptions().then(() => { + this.getFacilityList(); + }); }, handleBindFacility(row) { @@ -855,10 +877,10 @@ export default { this.facilityQueryParams = { pageNum: 1, pageSize: 10, - name: undefined, + equipmentName: undefined, type: undefined, + storeId: undefined, status: "0", - storeId: this.deviceData.storeId, merchantId: this.deviceData.userId, isBind: false }; @@ -882,14 +904,16 @@ export default { return ''; } }, - getGateAndRestroomList() { - // 假设有一个 API 可以获取大门和卫生间的列表 - listGateAndRestroom({ storeId: this.deviceData.storeId }).then(response => { - this.gateAndRestroomList = response.rows || []; - }).catch(() => { - this.$message.error("获取大门和卫生间列表失败"); + getStoreOptions() { + return listStore({ pageSize: 999 ,merchantId: this.deviceData.userId}).then(response => { + this.storeOptions = response.rows; }); - } + }, + /** 搜索按钮操作 */ + handleFacilityQuery() { + this.facilityQueryParams.pageNum = 1; + this.getFacilityList(); + }, } } diff --git a/src/views/system/order/index.vue b/src/views/system/order/index.vue index 83aab3d..08a4e07 100644 --- a/src/views/system/order/index.vue +++ b/src/views/system/order/index.vue @@ -264,13 +264,13 @@ @@ -521,4 +511,20 @@ export default { } } } + +.empty-history { + padding: 40px 0; + text-align: center; + color: #909399; + + i { + font-size: 32px; + margin-bottom: 10px; + } + + p { + margin: 0; + font-size: 14px; + } +} diff --git a/src/views/system/store/index.vue b/src/views/system/store/index.vue index 3125a09..c6676a6 100644 --- a/src/views/system/store/index.vue +++ b/src/views/system/store/index.vue @@ -230,7 +230,7 @@ - + - - + +