Commit b2f9850f460142377f332bb60145a0fb604e59f4
1 parent
d9b9463f
提交12-19
Showing
6 changed files
with
479 additions
and
161 deletions
garbage-removal/src/common/area.js
| 1 | -var areaData=[[[{"label":"芙蓉区","value":"430102"},{"label":"天心区","value":"430103"},{"label":"岳麓区","value":"430104"},{"label":"开福区","value":"430105"},{"label":"雨花区","value":"430111"},{"label":"望城区","value":"430112"},{"label":"长沙县","value":"430121"},{"label":"浏阳市","value":"430181"},{"label":"宁乡市","value":"430182"},{ "label": "湘江新区", "value": "430183" }],[{"label":"荷塘区","value":"430202"},{"label":"芦淞区","value":"430203"},{"label":"石峰区","value":"430204"},{"label":"天元区","value":"430211"},{"label":"株洲县","value":"430221"},{"label":"攸县","value":"430223"},{"label":"茶陵县","value":"430224"},{"label":"炎陵县","value":"430225"},{"label":"云龙示范区","value":"430271"},{"label":"醴陵市","value":"430281"}],[{"label":"雨湖区","value":"430302"},{"label":"岳塘区","value":"430304"},{"label":"湘潭县","value":"430321"},{"label":"湖南湘潭高新技术产业园区","value":"430371"},{"label":"湘潭昭山示范区","value":"430372"},{"label":"湘潭九华示范区","value":"430373"},{"label":"湘乡市","value":"430381"},{"label":"韶山市","value":"430382"}],[{"label":"珠晖区","value":"430405"},{"label":"雁峰区","value":"430406"},{"label":"石鼓区","value":"430407"},{"label":"蒸湘区","value":"430408"},{"label":"南岳区","value":"430412"},{"label":"衡阳县","value":"430421"},{"label":"衡南县","value":"430422"},{"label":"衡山县","value":"430423"},{"label":"衡东县","value":"430424"},{"label":"祁东县","value":"430426"},{"label":"衡阳综合保税区","value":"430471"},{"label":"湖南衡阳高新技术产业园区","value":"430472"},{"label":"湖南衡阳松木经济开发区","value":"430473"},{"label":"耒阳市","value":"430481"},{"label":"常宁市","value":"430482"}],[{"label":"双清区","value":"430502"},{"label":"大祥区","value":"430503"},{"label":"北塔区","value":"430511"},{"label":"邵东县","value":"430521"},{"label":"新邵县","value":"430522"},{"label":"邵阳县","value":"430523"},{"label":"隆回县","value":"430524"},{"label":"洞口县","value":"430525"},{"label":"绥宁县","value":"430527"},{"label":"新宁县","value":"430528"},{"label":"城步苗族自治县","value":"430529"},{"label":"武冈市","value":"430581"}],[{"label":"岳阳楼区","value":"430602"},{"label":"云溪区","value":"430603"},{"label":"君山区","value":"430611"},{"label":"岳阳县","value":"430621"},{"label":"华容县","value":"430623"},{"label":"湘阴县","value":"430624"},{"label":"平江县","value":"430626"},{"label":"岳阳市屈原管理区","value":"430671"},{"label":"汨罗市","value":"430681"},{"label":"临湘市","value":"430682"}],[{"label":"武陵区","value":"430702"},{"label":"鼎城区","value":"430703"},{"label":"安乡县","value":"430721"},{"label":"汉寿县","value":"430722"},{"label":"澧县","value":"430723"},{"label":"临澧县","value":"430724"},{"label":"桃源县","value":"430725"},{"label":"石门县","value":"430726"},{"label":"常德市西洞庭管理区","value":"430771"},{"label":"津市市","value":"430781"}],[{"label":"永定区","value":"430802"},{"label":"武陵源区","value":"430811"},{"label":"慈利县","value":"430821"},{"label":"桑植县","value":"430822"}],[{"label":"资阳区","value":"430902"},{"label":"赫山区","value":"430903"},{"label":"南县","value":"430921"},{"label":"桃江县","value":"430922"},{"label":"安化县","value":"430923"},{"label":"益阳市大通湖管理区","value":"430971"},{"label":"湖南益阳高新技术产业园区","value":"430972"},{"label":"沅江市","value":"430981"}],[{"label":"北湖区","value":"431002"},{"label":"苏仙区","value":"431003"},{"label":"桂阳县","value":"431021"},{"label":"宜章县","value":"431022"},{"label":"永兴县","value":"431023"},{"label":"嘉禾县","value":"431024"},{"label":"临武县","value":"431025"},{"label":"汝城县","value":"431026"},{"label":"桂东县","value":"431027"},{"label":"安仁县","value":"431028"},{"label":"资兴市","value":"431081"}],[{"label":"零陵区","value":"431102"},{"label":"冷水滩区","value":"431103"},{"label":"祁阳县","value":"431121"},{"label":"东安县","value":"431122"},{"label":"双牌县","value":"431123"},{"label":"道县","value":"431124"},{"label":"江永县","value":"431125"},{"label":"宁远县","value":"431126"},{"label":"蓝山县","value":"431127"},{"label":"新田县","value":"431128"},{"label":"江华瑶族自治县","value":"431129"},{"label":"永州经济技术开发区","value":"431171"},{"label":"永州市金洞管理区","value":"431172"},{"label":"永州市回龙圩管理区","value":"431173"}],[{"label":"鹤城区","value":"431202"},{"label":"中方县","value":"431221"},{"label":"沅陵县","value":"431222"},{"label":"辰溪县","value":"431223"},{"label":"溆浦县","value":"431224"},{"label":"会同县","value":"431225"},{"label":"麻阳苗族自治县","value":"431226"},{"label":"新晃侗族自治县","value":"431227"},{"label":"芷江侗族自治县","value":"431228"},{"label":"靖州苗族侗族自治县","value":"431229"},{"label":"通道侗族自治县","value":"431230"},{"label":"怀化市洪江管理区","value":"431271"},{"label":"洪江市","value":"431281"}],[{"label":"娄星区","value":"431302"},{"label":"双峰县","value":"431321"},{"label":"新化县","value":"431322"},{"label":"冷水江市","value":"431381"},{"label":"涟源市","value":"431382"}],[{"label":"吉首市","value":"433101"},{"label":"泸溪县","value":"433122"},{"label":"凤凰县","value":"433123"},{"label":"花垣县","value":"433124"},{"label":"保靖县","value":"433125"},{"label":"古丈县","value":"433126"},{"label":"永顺县","value":"433127"},{"label":"龙山县","value":"433130"},{"label":"湖南吉首经济开发区","value":"433172"},{"label":"湖南永顺经济开发区","value":"433173"}]]];export default areaData; | 1 | +var areaData = [[[{"label": "湘江新区", "value": "430183"},{"label": "芙蓉区", "value": "430102"}, {"label": "天心区", "value": "430103"}, { |
| 2 | + "label": "岳麓区", | ||
| 3 | + "value": "430104" | ||
| 4 | +}, {"label": "开福区", "value": "430105"}, {"label": "雨花区", "value": "430111"}, { | ||
| 5 | + "label": "望城区", | ||
| 6 | + "value": "430112" | ||
| 7 | +}, {"label": "长沙县", "value": "430121"}, {"label": "浏阳市", "value": "430181"}, { | ||
| 8 | + "label": "宁乡市", | ||
| 9 | + "value": "430182" | ||
| 10 | +}], [{"label": "荷塘区", "value": "430202"}, { | ||
| 11 | + "label": "芦淞区", | ||
| 12 | + "value": "430203" | ||
| 13 | +}, {"label": "石峰区", "value": "430204"}, {"label": "天元区", "value": "430211"}, { | ||
| 14 | + "label": "株洲县", | ||
| 15 | + "value": "430221" | ||
| 16 | +}, {"label": "攸县", "value": "430223"}, {"label": "茶陵县", "value": "430224"}, { | ||
| 17 | + "label": "炎陵县", | ||
| 18 | + "value": "430225" | ||
| 19 | +}, {"label": "云龙示范区", "value": "430271"}, {"label": "醴陵市", "value": "430281"}], [{ | ||
| 20 | + "label": "雨湖区", | ||
| 21 | + "value": "430302" | ||
| 22 | +}, {"label": "岳塘区", "value": "430304"}, {"label": "湘潭县", "value": "430321"}, { | ||
| 23 | + "label": "湖南湘潭高新技术产业园区", | ||
| 24 | + "value": "430371" | ||
| 25 | +}, {"label": "湘潭昭山示范区", "value": "430372"}, {"label": "湘潭九华示范区", "value": "430373"}, { | ||
| 26 | + "label": "湘乡市", | ||
| 27 | + "value": "430381" | ||
| 28 | +}, {"label": "韶山市", "value": "430382"}], [{"label": "珠晖区", "value": "430405"}, { | ||
| 29 | + "label": "雁峰区", | ||
| 30 | + "value": "430406" | ||
| 31 | +}, {"label": "石鼓区", "value": "430407"}, {"label": "蒸湘区", "value": "430408"}, { | ||
| 32 | + "label": "南岳区", | ||
| 33 | + "value": "430412" | ||
| 34 | +}, {"label": "衡阳县", "value": "430421"}, {"label": "衡南县", "value": "430422"}, { | ||
| 35 | + "label": "衡山县", | ||
| 36 | + "value": "430423" | ||
| 37 | +}, {"label": "衡东县", "value": "430424"}, {"label": "祁东县", "value": "430426"}, { | ||
| 38 | + "label": "衡阳综合保税区", | ||
| 39 | + "value": "430471" | ||
| 40 | +}, {"label": "湖南衡阳高新技术产业园区", "value": "430472"}, { | ||
| 41 | + "label": "湖南衡阳松木经济开发区", | ||
| 42 | + "value": "430473" | ||
| 43 | +}, {"label": "耒阳市", "value": "430481"}, {"label": "常宁市", "value": "430482"}], [{ | ||
| 44 | + "label": "双清区", | ||
| 45 | + "value": "430502" | ||
| 46 | +}, {"label": "大祥区", "value": "430503"}, {"label": "北塔区", "value": "430511"}, { | ||
| 47 | + "label": "邵东县", | ||
| 48 | + "value": "430521" | ||
| 49 | +}, {"label": "新邵县", "value": "430522"}, {"label": "邵阳县", "value": "430523"}, { | ||
| 50 | + "label": "隆回县", | ||
| 51 | + "value": "430524" | ||
| 52 | +}, {"label": "洞口县", "value": "430525"}, {"label": "绥宁县", "value": "430527"}, { | ||
| 53 | + "label": "新宁县", | ||
| 54 | + "value": "430528" | ||
| 55 | +}, {"label": "城步苗族自治县", "value": "430529"}, {"label": "武冈市", "value": "430581"}], [{ | ||
| 56 | + "label": "岳阳楼区", | ||
| 57 | + "value": "430602" | ||
| 58 | +}, {"label": "云溪区", "value": "430603"}, {"label": "君山区", "value": "430611"}, { | ||
| 59 | + "label": "岳阳县", | ||
| 60 | + "value": "430621" | ||
| 61 | +}, {"label": "华容县", "value": "430623"}, {"label": "湘阴县", "value": "430624"}, { | ||
| 62 | + "label": "平江县", | ||
| 63 | + "value": "430626" | ||
| 64 | +}, {"label": "岳阳市屈原管理区", "value": "430671"}, {"label": "汨罗市", "value": "430681"}, { | ||
| 65 | + "label": "临湘市", | ||
| 66 | + "value": "430682" | ||
| 67 | +}], [{"label": "武陵区", "value": "430702"}, {"label": "鼎城区", "value": "430703"}, { | ||
| 68 | + "label": "安乡县", | ||
| 69 | + "value": "430721" | ||
| 70 | +}, {"label": "汉寿县", "value": "430722"}, {"label": "澧县", "value": "430723"}, { | ||
| 71 | + "label": "临澧县", | ||
| 72 | + "value": "430724" | ||
| 73 | +}, {"label": "桃源县", "value": "430725"}, {"label": "石门县", "value": "430726"}, { | ||
| 74 | + "label": "常德市西洞庭管理区", | ||
| 75 | + "value": "430771" | ||
| 76 | +}, {"label": "津市市", "value": "430781"}], [{"label": "永定区", "value": "430802"}, { | ||
| 77 | + "label": "武陵源区", | ||
| 78 | + "value": "430811" | ||
| 79 | +}, {"label": "慈利县", "value": "430821"}, {"label": "桑植县", "value": "430822"}], [{ | ||
| 80 | + "label": "资阳区", | ||
| 81 | + "value": "430902" | ||
| 82 | +}, {"label": "赫山区", "value": "430903"}, {"label": "南县", "value": "430921"}, { | ||
| 83 | + "label": "桃江县", | ||
| 84 | + "value": "430922" | ||
| 85 | +}, {"label": "安化县", "value": "430923"}, { | ||
| 86 | + "label": "益阳市大通湖管理区", | ||
| 87 | + "value": "430971" | ||
| 88 | +}, {"label": "湖南益阳高新技术产业园区", "value": "430972"}, { | ||
| 89 | + "label": "沅江市", | ||
| 90 | + "value": "430981" | ||
| 91 | +}], [{"label": "北湖区", "value": "431002"}, {"label": "苏仙区", "value": "431003"}, { | ||
| 92 | + "label": "桂阳县", | ||
| 93 | + "value": "431021" | ||
| 94 | +}, {"label": "宜章县", "value": "431022"}, {"label": "永兴县", "value": "431023"}, { | ||
| 95 | + "label": "嘉禾县", | ||
| 96 | + "value": "431024" | ||
| 97 | +}, {"label": "临武县", "value": "431025"}, {"label": "汝城县", "value": "431026"}, { | ||
| 98 | + "label": "桂东县", | ||
| 99 | + "value": "431027" | ||
| 100 | +}, {"label": "安仁县", "value": "431028"}, {"label": "资兴市", "value": "431081"}], [{ | ||
| 101 | + "label": "零陵区", | ||
| 102 | + "value": "431102" | ||
| 103 | +}, {"label": "冷水滩区", "value": "431103"}, {"label": "祁阳县", "value": "431121"}, { | ||
| 104 | + "label": "东安县", | ||
| 105 | + "value": "431122" | ||
| 106 | +}, {"label": "双牌县", "value": "431123"}, {"label": "道县", "value": "431124"}, { | ||
| 107 | + "label": "江永县", | ||
| 108 | + "value": "431125" | ||
| 109 | +}, {"label": "宁远县", "value": "431126"}, {"label": "蓝山县", "value": "431127"}, { | ||
| 110 | + "label": "新田县", | ||
| 111 | + "value": "431128" | ||
| 112 | +}, {"label": "江华瑶族自治县", "value": "431129"}, { | ||
| 113 | + "label": "永州经济技术开发区", | ||
| 114 | + "value": "431171" | ||
| 115 | +}, {"label": "永州市金洞管理区", "value": "431172"}, { | ||
| 116 | + "label": "永州市回龙圩管理区", | ||
| 117 | + "value": "431173" | ||
| 118 | +}], [{"label": "鹤城区", "value": "431202"}, {"label": "中方县", "value": "431221"}, { | ||
| 119 | + "label": "沅陵县", | ||
| 120 | + "value": "431222" | ||
| 121 | +}, {"label": "辰溪县", "value": "431223"}, {"label": "溆浦县", "value": "431224"}, { | ||
| 122 | + "label": "会同县", | ||
| 123 | + "value": "431225" | ||
| 124 | +}, {"label": "麻阳苗族自治县", "value": "431226"}, { | ||
| 125 | + "label": "新晃侗族自治县", | ||
| 126 | + "value": "431227" | ||
| 127 | +}, {"label": "芷江侗族自治县", "value": "431228"}, { | ||
| 128 | + "label": "靖州苗族侗族自治县", | ||
| 129 | + "value": "431229" | ||
| 130 | +}, {"label": "通道侗族自治县", "value": "431230"}, {"label": "怀化市洪江管理区", "value": "431271"}, { | ||
| 131 | + "label": "洪江市", | ||
| 132 | + "value": "431281" | ||
| 133 | +}], [{"label": "娄星区", "value": "431302"}, {"label": "双峰县", "value": "431321"}, { | ||
| 134 | + "label": "新化县", | ||
| 135 | + "value": "431322" | ||
| 136 | +}, {"label": "冷水江市", "value": "431381"}, {"label": "涟源市", "value": "431382"}], [{ | ||
| 137 | + "label": "吉首市", | ||
| 138 | + "value": "433101" | ||
| 139 | +}, {"label": "泸溪县", "value": "433122"}, {"label": "凤凰县", "value": "433123"}, { | ||
| 140 | + "label": "花垣县", | ||
| 141 | + "value": "433124" | ||
| 142 | +}, {"label": "保靖县", "value": "433125"}, {"label": "古丈县", "value": "433126"}, { | ||
| 143 | + "label": "永顺县", | ||
| 144 | + "value": "433127" | ||
| 145 | +}, {"label": "龙山县", "value": "433130"}, { | ||
| 146 | + "label": "湖南吉首经济开发区", | ||
| 147 | + "value": "433172" | ||
| 148 | +}, {"label": "湖南永顺经济开发区", "value": "433173"}]]]; | ||
| 149 | +export default areaData; |
garbage-removal/src/pages/home-info/address/addSite.vue
| @@ -57,6 +57,7 @@ import citySelect from './citySelect/u-city-select.vue'; | @@ -57,6 +57,7 @@ import citySelect from './citySelect/u-city-select.vue'; | ||
| 57 | const { proxy } = getCurrentInstance(); | 57 | const { proxy } = getCurrentInstance(); |
| 58 | const cityPikerShowFlag = ref(false) | 58 | const cityPikerShowFlag = ref(false) |
| 59 | const addFlag = ref(true) | 59 | const addFlag = ref(true) |
| 60 | +const location = ref({}); | ||
| 60 | const addressInfo = reactive({ | 61 | const addressInfo = reactive({ |
| 61 | addressArea: "", | 62 | addressArea: "", |
| 62 | addressDetail: "", | 63 | addressDetail: "", |
| @@ -167,23 +168,65 @@ const submit = () => { | @@ -167,23 +168,65 @@ const submit = () => { | ||
| 167 | const chooseAddressDetail = () => { | 168 | const chooseAddressDetail = () => { |
| 168 | console.log('打开地图选择地址'); | 169 | console.log('打开地图选择地址'); |
| 169 | 170 | ||
| 170 | - // 直接打开地图选择器,不进行定位 | ||
| 171 | - uni.chooseLocation({ | ||
| 172 | - success: (res) => { | ||
| 173 | - addressInfo.addressDetail = res.name; | ||
| 174 | - addressInfo.garLongitude = res.longitude; | ||
| 175 | - addressInfo.garLatitude = res.latitude; | 171 | + // 先获取当前位置的经纬度 |
| 172 | + uni.getLocation({ | ||
| 173 | + type: 'gcj02', // 使用国测局坐标系,与地图选择器的坐标系一致 | ||
| 174 | + altitude: false, | ||
| 175 | + success: (locationRes) => { | ||
| 176 | + console.log('获取当前位置成功', locationRes); | ||
| 177 | + | ||
| 178 | + // 使用获取到的经纬度作为初始位置打开地图选择器 | ||
| 179 | + uni.chooseLocation({ | ||
| 180 | + longitude: location.value.longitude, // 设置初始经度 | ||
| 181 | + latitude: location.value.latitude, // 设置初始纬度 | ||
| 182 | + success: (res) => { | ||
| 183 | + addressInfo.addressDetail = res.name; | ||
| 184 | + addressInfo.garLongitude = res.longitude; | ||
| 185 | + addressInfo.garLatitude = res.latitude; | ||
| 186 | + }, | ||
| 187 | + fail: (err) => { | ||
| 188 | + console.error('地图选择失败:', err); | ||
| 189 | + uni.$u.toast('地图选择失败'); | ||
| 190 | + } | ||
| 191 | + }); | ||
| 176 | }, | 192 | }, |
| 177 | fail: (err) => { | 193 | fail: (err) => { |
| 178 | - console.error('地图选择失败:', err); | 194 | + console.error('获取当前位置失败:', err); |
| 195 | + | ||
| 196 | + // 如果获取位置失败,仍然打开地图选择器,但不自动定位 | ||
| 197 | + uni.chooseLocation({ | ||
| 198 | + success: (res) => { | ||
| 199 | + addressInfo.addressDetail = res.name; | ||
| 200 | + addressInfo.garLongitude = res.longitude; | ||
| 201 | + addressInfo.garLatitude = res.latitude; | ||
| 202 | + }, | ||
| 203 | + fail: (err) => { | ||
| 204 | + console.error('地图选择失败:', err); | ||
| 205 | + uni.$u.toast('地图选择失败'); | ||
| 206 | + } | ||
| 207 | + }); | ||
| 179 | } | 208 | } |
| 180 | }); | 209 | }); |
| 181 | }; | 210 | }; |
| 182 | 211 | ||
| 183 | onMounted(() => { | 212 | onMounted(() => { |
| 184 | proxy.$refs.addressFrom.setRules(rules) | 213 | proxy.$refs.addressFrom.setRules(rules) |
| 214 | + window.takeLocationCallBack = takeLocalCallBack | ||
| 185 | }) | 215 | }) |
| 186 | 216 | ||
| 217 | +const takeLocalCallBack = (lngLat) => { | ||
| 218 | + const ll = lngLat.split(","); | ||
| 219 | + console.log(ll); | ||
| 220 | + location.value = { | ||
| 221 | + longitude: ll[0], | ||
| 222 | + latitude: ll[1] | ||
| 223 | + }; | ||
| 224 | +} | ||
| 225 | + | ||
| 226 | +const takeLocation = () => { | ||
| 227 | + window.JsInterface.takeLocation(); | ||
| 228 | +} | ||
| 229 | + | ||
| 187 | onLoad((options) => { | 230 | onLoad((options) => { |
| 188 | if (options.addressObj) { | 231 | if (options.addressObj) { |
| 189 | let addressObj = JSON.parse(options.addressObj); | 232 | let addressObj = JSON.parse(options.addressObj); |
| @@ -201,6 +244,7 @@ onLoad((options) => { | @@ -201,6 +244,7 @@ onLoad((options) => { | ||
| 201 | if(options.defaultFlag && 'true' == options.defaultFlag){ | 244 | if(options.defaultFlag && 'true' == options.defaultFlag){ |
| 202 | addressInfo.defaultFlag = true; | 245 | addressInfo.defaultFlag = true; |
| 203 | } | 246 | } |
| 247 | + takeLocation(); | ||
| 204 | }) | 248 | }) |
| 205 | const reset = () => { | 249 | const reset = () => { |
| 206 | addressInfo.addressArea = '' | 250 | addressInfo.addressArea = '' |
garbage-removal/src/pages/home-info/type-guide/index.vue
| 1 | <template> | 1 | <template> |
| 2 | - <view class="type-guide"> | ||
| 3 | - <image :src="imageUrl"></image> | ||
| 4 | - </view> | ||
| 5 | - </template> | 2 | + <view class="type-guide"> |
| 3 | + <image :src="imageUrl" mode="widthFix"></image> | ||
| 4 | + </view> | ||
| 5 | +</template> | ||
| 6 | 6 | ||
| 7 | <script setup> | 7 | <script setup> |
| 8 | const imageUrl = import.meta.env.VITE_BASE_URL + "/type-guide.png"; | 8 | const imageUrl = import.meta.env.VITE_BASE_URL + "/type-guide.png"; |
| 9 | </script> | 9 | </script> |
| 10 | - | ||
| 11 | - <style lang="scss" scoped> | ||
| 12 | - .type-guide { | 10 | + |
| 11 | +<style lang="scss" scoped> .type-guide { | ||
| 12 | + width: 100%; | ||
| 13 | + height: 100%; | ||
| 14 | + display: flex; | ||
| 15 | + justify-content: center; | ||
| 16 | + box-sizing: border-box; | ||
| 17 | + background-color: white; | ||
| 18 | + padding-top: 20rpx; | ||
| 19 | + | ||
| 20 | + image { | ||
| 13 | width: 100%; | 21 | width: 100%; |
| 14 | - height: 100%; | ||
| 15 | - display: flex; | ||
| 16 | - justify-content: center; | ||
| 17 | - box-sizing: border-box; | ||
| 18 | - background-color: white; | ||
| 19 | - padding-top: 20rpx; | ||
| 20 | - | ||
| 21 | - image { | ||
| 22 | - background-size: 100% 100%; | ||
| 23 | - width: 750rpx; | ||
| 24 | - height: 4494rpx; | ||
| 25 | - } | 22 | + height: auto; |
| 26 | } | 23 | } |
| 27 | - </style> | 24 | +} |
| 25 | +</style> | ||
| 28 | 26 | ||
| 29 | \ No newline at end of file | 27 | \ No newline at end of file |
garbage-removal/src/pages/home/index.vue
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | <view class="company-box"> | 19 | <view class="company-box"> |
| 20 | <view class="info-box"> | 20 | <view class="info-box"> |
| 21 | <view class="info-box-item" hover-class="click-box" v-for="(item, index) in infoBoxList" :key="index" | 21 | <view class="info-box-item" hover-class="click-box" v-for="(item, index) in infoBoxList" :key="index" |
| 22 | - @click.stop="handlerCLickInfoBox(item.text)"> | 22 | + @click.stop="handlerCLickInfoBox(item.text)"> |
| 23 | <view class="info-box-item-icon" :class="item.icon"> | 23 | <view class="info-box-item-icon" :class="item.icon"> |
| 24 | </view> | 24 | </view> |
| 25 | <view class="info-box-item-text">{{ item.text }}</view> | 25 | <view class="info-box-item-text">{{ item.text }}</view> |
| @@ -44,20 +44,21 @@ | @@ -44,20 +44,21 @@ | ||
| 44 | <view class="company-list-header-left" v-if="(addressInfo && userType == '用户')"> | 44 | <view class="company-list-header-left" v-if="(addressInfo && userType == '用户')"> |
| 45 | <u-dropdown active-color="#19a97c"> | 45 | <u-dropdown active-color="#19a97c"> |
| 46 | <u-dropdown-item :height="'240rpx'" :placement="'left'" v-model="registrationAreaValue" | 46 | <u-dropdown-item :height="'240rpx'" :placement="'left'" v-model="registrationAreaValue" |
| 47 | - @change="handleDropdownAreaChange" :title="'所属区域'" :options="dropdownOptions[0]"></u-dropdown-item> | 47 | + @update:modelValue="handleDropdownAreaChange" :title="registrationAreaLabel" :options="dropdownOptions[0]"></u-dropdown-item> |
| 48 | 48 | ||
| 49 | <u-dropdown-item :placement="'center'" v-model="carTypeValue" @change="handleDropdownCarChange" | 49 | <u-dropdown-item :placement="'center'" v-model="carTypeValue" @change="handleDropdownCarChange" |
| 50 | - :title="'车辆类型'" :options="dropdownOptions[1]"></u-dropdown-item> | 50 | + :title="carTypeValue || '车辆类型'" :options="dropdownOptions[1]"></u-dropdown-item> |
| 51 | 51 | ||
| 52 | <u-dropdown-item :placement="'right'" v-model="sortValue" @change="handleDropdownSortChange" | 52 | <u-dropdown-item :placement="'right'" v-model="sortValue" @change="handleDropdownSortChange" |
| 53 | - :title="'排序'" :options="dropdownOptions[2]"></u-dropdown-item> | 53 | + :title="sortLabel" :options="dropdownOptions[2]"></u-dropdown-item> |
| 54 | </u-dropdown> | 54 | </u-dropdown> |
| 55 | </view> | 55 | </view> |
| 56 | </view> | 56 | </view> |
| 57 | <view class="company-list-content"> | 57 | <view class="company-list-content"> |
| 58 | <view class="company-list-content-box"> | 58 | <view class="company-list-content-box"> |
| 59 | - <z-paging ref="paging" :fixed="false" v-model="companyList" @query="queryList"> | ||
| 60 | - <empty-view slot:empty></empty-view> | 59 | + <!-- 删除z-paging组件,改为普通容器 --> |
| 60 | + <view v-if="companyList.length > 0"> | ||
| 61 | + <empty-view v-if="companyList.length === 0" /> | ||
| 61 | <view class="company-list-item" v-for="(item) in companyList" :key="item.id"> | 62 | <view class="company-list-item" v-for="(item) in companyList" :key="item.id"> |
| 62 | <view class="company-list-item-main"> | 63 | <view class="company-list-item-main"> |
| 63 | <view class="company-list-item-main-right"> | 64 | <view class="company-list-item-main-right"> |
| @@ -69,32 +70,32 @@ | @@ -69,32 +70,32 @@ | ||
| 69 | <view class="company-list-item-main-box" style="display: flex;"> | 70 | <view class="company-list-item-main-box" style="display: flex;"> |
| 70 | <view class="company-list-item-main-left-box" style="flex: 1;"> | 71 | <view class="company-list-item-main-left-box" style="flex: 1;"> |
| 71 | <view class="company-list-item-main-bottom-box" | 72 | <view class="company-list-item-main-bottom-box" |
| 72 | - @click="handleDetailClick(item, item.servicePhone, userAddress)"> | 73 | + @click="handleDetailClick(item, item.servicePhone, userAddress)"> |
| 73 | <view class="company-list-item-main-right-score"> | 74 | <view class="company-list-item-main-right-score"> |
| 74 | <text class="company-list-item-main-right-text">评分:</text> | 75 | <text class="company-list-item-main-right-text">评分:</text> |
| 75 | <view v-if="item.score != 0" class="company-list-item-main-right-score-start"> | 76 | <view v-if="item.score != 0" class="company-list-item-main-right-score-start"> |
| 76 | <u-rate activeColor="#f9ae3d" inactive-color="#f9ae3d" size="28" | 77 | <u-rate activeColor="#f9ae3d" inactive-color="#f9ae3d" size="28" |
| 77 | - :modelValue="item.score" allowHalf readonly></u-rate> | 78 | + :modelValue="item.score" allowHalf readonly></u-rate> |
| 78 | </view> | 79 | </view> |
| 79 | <text v-if="item.score > 0" class="company-list-item-main-right-text" | 80 | <text v-if="item.score > 0" class="company-list-item-main-right-text" |
| 80 | - style="color: #fd5d00;"> | 81 | + style="color: #fd5d00;"> |
| 81 | {{ item.score }}分 | 82 | {{ item.score }}分 |
| 82 | </text> | 83 | </text> |
| 83 | <text v-else class="company-list-item-main-right-text" | 84 | <text v-else class="company-list-item-main-right-text" |
| 84 | - style="color: #fd5d00;">最近一月暂无评分</text> | 85 | + style="color: #fd5d00;">最近一月暂无评分</text> |
| 85 | </view> | 86 | </view> |
| 86 | <view class="company-list-item-main-right-price-number"> | 87 | <view class="company-list-item-main-right-price-number"> |
| 87 | - | 88 | + |
| 88 | <view class="company-list-item-main-right-number"> | 89 | <view class="company-list-item-main-right-number"> |
| 89 | 清运数:<text class="company-list-item-main-right-number-text">{{ item.cleanNumber }}</text> | 90 | 清运数:<text class="company-list-item-main-right-number-text">{{ item.cleanNumber }}</text> |
| 90 | </view> | 91 | </view> |
| 91 | </view> | 92 | </view> |
| 92 | </view> | 93 | </view> |
| 93 | - | 94 | + |
| 94 | </view> | 95 | </view> |
| 95 | <view class="company-list-item-main-right-box" v-if="(addressInfo && userType == '用户')" style="display: flex;font-size: 28rpx; justify-content: flex-end; align-items: flex-end;color:#458B74;font-weight: bold;"> | 96 | <view class="company-list-item-main-right-box" v-if="(addressInfo && userType == '用户')" style="display: flex;font-size: 28rpx; justify-content: flex-end; align-items: flex-end;color:#458B74;font-weight: bold;"> |
| 96 | <view class="company-list-item-main-right-box-text" | 97 | <view class="company-list-item-main-right-box-text" |
| 97 | - @click.stop="handleCleanGarbage(item, item.servicePhone, userAddress)"> | 98 | + @click.stop="handleCleanGarbage(item, item.servicePhone, userAddress)"> |
| 98 | 预约清运 -> | 99 | 预约清运 -> |
| 99 | </view> | 100 | </view> |
| 100 | </view> | 101 | </view> |
| @@ -104,7 +105,8 @@ | @@ -104,7 +105,8 @@ | ||
| 104 | <view class="company-list-item-bottom"> | 105 | <view class="company-list-item-bottom"> |
| 105 | </view> | 106 | </view> |
| 106 | </view> | 107 | </view> |
| 107 | - </z-paging> | 108 | + </view> |
| 109 | + <empty-view v-else /> | ||
| 108 | </view> | 110 | </view> |
| 109 | </view> | 111 | </view> |
| 110 | </view> | 112 | </view> |
| @@ -126,6 +128,7 @@ | @@ -126,6 +128,7 @@ | ||
| 126 | </view> | 128 | </view> |
| 127 | </template> | 129 | </template> |
| 128 | 130 | ||
| 131 | + | ||
| 129 | <script setup> | 132 | <script setup> |
| 130 | import { queryAddress } from '@/apis/address.js'; | 133 | import { queryAddress } from '@/apis/address.js'; |
| 131 | import { queryEnterpriseList } from '@/apis/company.js'; | 134 | import { queryEnterpriseList } from '@/apis/company.js'; |
| @@ -143,58 +146,67 @@ let maxScore = 5 | @@ -143,58 +146,67 @@ let maxScore = 5 | ||
| 143 | const maxStar = ref([]); | 146 | const maxStar = ref([]); |
| 144 | const lightHeight = ref();//胶囊按钮信息 | 147 | const lightHeight = ref();//胶囊按钮信息 |
| 145 | const topMargin = ref(null);//状态栏高度 | 148 | const topMargin = ref(null);//状态栏高度 |
| 146 | -const musicheadHeight = ref(); | ||
| 147 | -const paging = ref(null) | 149 | +const musicheadHeight = ref() |
| 150 | +// 删除paging引用 | ||
| 151 | +// const paging = ref(null) | ||
| 148 | const swiperImageList = ref([{ | 152 | const swiperImageList = ref([{ |
| 149 | image: import.meta.env.VITE_BASE_URL + "/swiper-1.jpg" | 153 | image: import.meta.env.VITE_BASE_URL + "/swiper-1.jpg" |
| 150 | }, { | 154 | }, { |
| 151 | image: import.meta.env.VITE_BASE_URL + "/swiper-2.jpg" | 155 | image: import.meta.env.VITE_BASE_URL + "/swiper-2.jpg" |
| 152 | }]) | 156 | }]) |
| 153 | 157 | ||
| 158 | +// 公司列表缓存 | ||
| 159 | +const companyListCache = ref(new Map()) | ||
| 160 | + | ||
| 154 | const userAddress = ref({}) | 161 | const userAddress = ref({}) |
| 155 | const addressInfo = ref() | 162 | const addressInfo = ref() |
| 156 | const sortValue = ref(0) | 163 | const sortValue = ref(0) |
| 157 | const registrationAreaValue = ref('') | 164 | const registrationAreaValue = ref('') |
| 158 | -const registrationAreaRealValue = ref('') | 165 | +const registrationAreaLabel = ref('所属区域') |
| 166 | +const sortLabel = ref('排序') | ||
| 159 | const carTypeValue = ref('') | 167 | const carTypeValue = ref('') |
| 160 | const carTypeRealValue = ref('') | 168 | const carTypeRealValue = ref('') |
| 161 | const dropdownOptions = ref([ | 169 | const dropdownOptions = ref([ |
| 162 | [{ | 170 | [{ |
| 163 | - label: '湘江新区', | ||
| 164 | - value: '湘江新区' | 171 | + label: '全部', |
| 172 | + value: '' | ||
| 165 | }, | 173 | }, |
| 166 | { | 174 | { |
| 175 | + label: '湘江新区', | ||
| 176 | + value: '湘江新区' | ||
| 177 | + }, | ||
| 178 | + { | ||
| 167 | label: '芙蓉区', | 179 | label: '芙蓉区', |
| 168 | value: '芙蓉区' | 180 | value: '芙蓉区' |
| 169 | }, | 181 | }, |
| 170 | - { | ||
| 171 | - label: '天心区', | ||
| 172 | - value: '天心区' | ||
| 173 | - }, | ||
| 174 | - { | ||
| 175 | - label: '开福区', | ||
| 176 | - value: '开福区' | ||
| 177 | - }, | ||
| 178 | - { | ||
| 179 | - label: '雨花区', | ||
| 180 | - value: '雨花区' | ||
| 181 | - }, | ||
| 182 | - { | ||
| 183 | - label: '望城区', | ||
| 184 | - value: '望城区' | ||
| 185 | - }, | ||
| 186 | - { | ||
| 187 | - label: '长沙县', | ||
| 188 | - value: '长沙县' | ||
| 189 | - }, | ||
| 190 | - { | ||
| 191 | - label: '浏阳市', | ||
| 192 | - value: '浏阳市' | ||
| 193 | - }, | ||
| 194 | - { | ||
| 195 | - label: '宁乡市', | ||
| 196 | - value: '宁乡市' | ||
| 197 | - } | 182 | + { |
| 183 | + label: '天心区', | ||
| 184 | + value: '天心区' | ||
| 185 | + }, | ||
| 186 | + { | ||
| 187 | + label: '开福区', | ||
| 188 | + value: '开福区' | ||
| 189 | + }, | ||
| 190 | + { | ||
| 191 | + label: '雨花区', | ||
| 192 | + value: '雨花区' | ||
| 193 | + }, | ||
| 194 | + { | ||
| 195 | + label: '望城区', | ||
| 196 | + value: '望城区' | ||
| 197 | + }, | ||
| 198 | + { | ||
| 199 | + label: '长沙县', | ||
| 200 | + value: '长沙县' | ||
| 201 | + }, | ||
| 202 | + { | ||
| 203 | + label: '浏阳市', | ||
| 204 | + value: '浏阳市' | ||
| 205 | + }, | ||
| 206 | + { | ||
| 207 | + label: '宁乡市', | ||
| 208 | + value: '宁乡市' | ||
| 209 | + } | ||
| 198 | ], [{ | 210 | ], [{ |
| 199 | label: '暂未开放', | 211 | label: '暂未开放', |
| 200 | value: '暂未开放', | 212 | value: '暂未开放', |
| @@ -240,9 +252,9 @@ const handlerCLickInfoBox = (val) => { | @@ -240,9 +252,9 @@ const handlerCLickInfoBox = (val) => { | ||
| 240 | case '分类指南': | 252 | case '分类指南': |
| 241 | uni.$u.route('/pages/home-info/type-guide/index') | 253 | uni.$u.route('/pages/home-info/type-guide/index') |
| 242 | break; | 254 | break; |
| 243 | - case '车型说明': | ||
| 244 | - uni.$u.route('/pages/home-info/car-guide/index') | ||
| 245 | - break; | 255 | + case '车型说明': |
| 256 | + uni.$u.route('/pages/home-info/car-guide/index') | ||
| 257 | + break; | ||
| 246 | default: | 258 | default: |
| 247 | break; | 259 | break; |
| 248 | } | 260 | } |
| @@ -262,33 +274,50 @@ const handleContactClick = (val) => { | @@ -262,33 +274,50 @@ const handleContactClick = (val) => { | ||
| 262 | * @param {number} val | 274 | * @param {number} val |
| 263 | */ | 275 | */ |
| 264 | const handleDropdownSortChange = (val) => { | 276 | const handleDropdownSortChange = (val) => { |
| 277 | + // 查找选中项的完整对象 | ||
| 278 | + const selectedItem = dropdownOptions.value[2].find(item => item.value === val); | ||
| 279 | + if (selectedItem) { | ||
| 280 | + sortLabel.value = selectedItem.label; | ||
| 281 | + } else { | ||
| 282 | + sortLabel.value = '排序'; // 默认标签 | ||
| 283 | + } | ||
| 284 | + | ||
| 265 | sortValue.value = val; | 285 | sortValue.value = val; |
| 286 | + // 清除缓存 | ||
| 287 | + companyListCache.value.clear(); | ||
| 266 | // 重新获取列表 | 288 | // 重新获取列表 |
| 267 | - paging.value.reload() | 289 | + loadCompanyList() |
| 268 | } | 290 | } |
| 269 | const handleDropdownAreaChange = (val) => { | 291 | const handleDropdownAreaChange = (val) => { |
| 270 | - if (registrationAreaRealValue.value == val) { | ||
| 271 | - registrationAreaValue.value = '' | ||
| 272 | - registrationAreaRealValue.value = '' | ||
| 273 | - // 重新获取列表 | ||
| 274 | - paging.value.reload() | ||
| 275 | - return | 292 | + // 查找选中项的完整对象 |
| 293 | + const selectedItem = dropdownOptions.value[0].find(item => item.value === val); | ||
| 294 | + if (selectedItem) { | ||
| 295 | + registrationAreaLabel.value = selectedItem.label; | ||
| 296 | + } else { | ||
| 297 | + registrationAreaLabel.value = '所属区域'; // 默认标签 | ||
| 276 | } | 298 | } |
| 277 | - registrationAreaRealValue.value = val; | 299 | + |
| 300 | + registrationAreaValue.value = val; | ||
| 301 | + // 清除缓存 | ||
| 302 | + companyListCache.value.clear(); | ||
| 278 | // 重新获取列表 | 303 | // 重新获取列表 |
| 279 | - paging.value.reload() | 304 | + loadCompanyList() |
| 280 | } | 305 | } |
| 281 | const handleDropdownCarChange = (val) => { | 306 | const handleDropdownCarChange = (val) => { |
| 282 | if (carTypeRealValue.value == val) { | 307 | if (carTypeRealValue.value == val) { |
| 283 | carTypeValue.value = '' | 308 | carTypeValue.value = '' |
| 284 | carTypeRealValue.value = '' | 309 | carTypeRealValue.value = '' |
| 310 | + // 清除缓存 | ||
| 311 | + companyListCache.value.clear(); | ||
| 285 | // 重新获取列表 | 312 | // 重新获取列表 |
| 286 | - paging.value.reload() | 313 | + loadCompanyList() |
| 287 | return | 314 | return |
| 288 | } | 315 | } |
| 289 | carTypeRealValue.value = val; | 316 | carTypeRealValue.value = val; |
| 317 | + // 清除缓存 | ||
| 318 | + companyListCache.value.clear(); | ||
| 290 | // 重新获取列表 | 319 | // 重新获取列表 |
| 291 | - paging.value.reload() | 320 | + loadCompanyList() |
| 292 | } | 321 | } |
| 293 | /** | 322 | /** |
| 294 | * 跳转地址 | 323 | * 跳转地址 |
| @@ -323,8 +352,8 @@ const handleCleanClick = () => { | @@ -323,8 +352,8 @@ const handleCleanClick = () => { | ||
| 323 | // 用户已登录但是没有清运地址的情况 | 352 | // 用户已登录但是没有清运地址的情况 |
| 324 | if (userType.value == '用户') { | 353 | if (userType.value == '用户') { |
| 325 | uni.$u.route({ | 354 | uni.$u.route({ |
| 326 | - url: `pages/home-info/address/addSite?defaultFlag=true`, | ||
| 327 | - }); | 355 | + url: `pages/home-info/address/addSite?defaultFlag=true`, |
| 356 | + }); | ||
| 328 | } else { | 357 | } else { |
| 329 | uni.showModal({ | 358 | uni.showModal({ |
| 330 | title: '提示', | 359 | title: '提示', |
| @@ -364,13 +393,18 @@ const handleCleanGarbage = (companyObj, tel, userAddress) => { | @@ -364,13 +393,18 @@ const handleCleanGarbage = (companyObj, tel, userAddress) => { | ||
| 364 | } | 393 | } |
| 365 | 394 | ||
| 366 | const handleSearch = (value) => { | 395 | const handleSearch = (value) => { |
| 396 | + // 清除缓存 | ||
| 397 | + companyListCache.value.clear(); | ||
| 367 | // 重新加载数据 | 398 | // 重新加载数据 |
| 368 | - paging.value.reload() | 399 | + loadCompanyList() |
| 369 | } | 400 | } |
| 370 | 401 | ||
| 371 | const handleClearSearch = () => { | 402 | const handleClearSearch = () => { |
| 372 | searchKeyword.value = '' | 403 | searchKeyword.value = '' |
| 373 | - paging.value.reload() | 404 | + // 清除缓存 |
| 405 | + companyListCache.value.clear(); | ||
| 406 | + // 重新加载数据 | ||
| 407 | + loadCompanyList() | ||
| 374 | } | 408 | } |
| 375 | 409 | ||
| 376 | /** | 410 | /** |
| @@ -407,8 +441,11 @@ onShow(() => { | @@ -407,8 +441,11 @@ onShow(() => { | ||
| 407 | updateOrderBadge() | 441 | updateOrderBadge() |
| 408 | let flag = uni.getStorageSync("refreshFlag"); | 442 | let flag = uni.getStorageSync("refreshFlag"); |
| 409 | if(flag){ | 443 | if(flag){ |
| 410 | - console.log(paging.value); | ||
| 411 | - paging.value.reload(); | 444 | + console.log("refreshing page"); |
| 445 | + // 清除缓存 | ||
| 446 | + companyListCache.value.clear(); | ||
| 447 | + // 重新加载数据 | ||
| 448 | + loadCompanyList(); | ||
| 412 | uni.removeStorageSync("refreshFlag"); | 449 | uni.removeStorageSync("refreshFlag"); |
| 413 | } | 450 | } |
| 414 | }) | 451 | }) |
| @@ -476,9 +513,24 @@ const initData = () => { | @@ -476,9 +513,24 @@ const initData = () => { | ||
| 476 | addressInfo.value = ''; | 513 | addressInfo.value = ''; |
| 477 | userAddress.value = {}; | 514 | userAddress.value = {}; |
| 478 | } | 515 | } |
| 516 | + }).finally(() => { | ||
| 517 | + // 在地址信息加载完成后加载公司列表 | ||
| 518 | + loadCompanyList(); | ||
| 479 | }) | 519 | }) |
| 480 | } | 520 | } |
| 481 | -const queryList = (pageNo, pageSize) => { | 521 | + |
| 522 | +// 新增方法:一次性加载所有公司数据(带缓存) | ||
| 523 | +const loadCompanyList = () => { | ||
| 524 | + // 生成缓存键 | ||
| 525 | + const cacheKey = `${sortValue.value}-${registrationAreaValue.value}-${carTypeValue.value}-${userType.value}-${searchKeyword.value}`; | ||
| 526 | + | ||
| 527 | + // 检查是否有缓存 | ||
| 528 | + if (companyListCache.value.has(cacheKey)) { | ||
| 529 | + console.log('使用缓存数据'); | ||
| 530 | + companyList.value = companyListCache.value.get(cacheKey); | ||
| 531 | + return; | ||
| 532 | + } | ||
| 533 | + | ||
| 482 | let userTypeValue=0; | 534 | let userTypeValue=0; |
| 483 | if(userType == '用户'){ | 535 | if(userType == '用户'){ |
| 484 | userTypeValue=1; | 536 | userTypeValue=1; |
| @@ -489,8 +541,8 @@ const queryList = (pageNo, pageSize) => { | @@ -489,8 +541,8 @@ const queryList = (pageNo, pageSize) => { | ||
| 489 | } | 541 | } |
| 490 | let query = { | 542 | let query = { |
| 491 | companyType: 1, | 543 | companyType: 1, |
| 492 | - pageNum: pageNo, | ||
| 493 | - pageSize, | 544 | + pageNum: 1, |
| 545 | + pageSize: 9999, // 设置一个足够大的数字以获取所有数据 | ||
| 494 | orderByColumn: sortValue.value, | 546 | orderByColumn: sortValue.value, |
| 495 | registrationArea: registrationAreaValue.value, | 547 | registrationArea: registrationAreaValue.value, |
| 496 | searchValue: carTypeValue.value, | 548 | searchValue: carTypeValue.value, |
| @@ -501,11 +553,72 @@ const queryList = (pageNo, pageSize) => { | @@ -501,11 +553,72 @@ const queryList = (pageNo, pageSize) => { | ||
| 501 | // 查询公司信息 | 553 | // 查询公司信息 |
| 502 | queryEnterpriseList(query).then(res => { | 554 | queryEnterpriseList(query).then(res => { |
| 503 | console.log('获取到的公司列表数据:', res); | 555 | console.log('获取到的公司列表数据:', res); |
| 504 | - paging.value.complete(res.data.data.list); | 556 | + |
| 557 | + // 直接设置公司列表数据 | ||
| 558 | + const pageData = res.data.data; | ||
| 559 | + const list = pageData.list || []; | ||
| 560 | + companyList.value = list; | ||
| 561 | + | ||
| 562 | + // 缓存数据 | ||
| 563 | + companyListCache.value.set(cacheKey, list); | ||
| 564 | + }).catch(err => { | ||
| 565 | + console.error('查询公司列表失败:', err); | ||
| 566 | + companyList.value = []; | ||
| 505 | }) | 567 | }) |
| 506 | } | 568 | } |
| 569 | + | ||
| 570 | +// 删除原有的queryList方法 | ||
| 571 | +// const queryList = (pageNo, pageSize) => { | ||
| 572 | +// let userTypeValue=0; | ||
| 573 | +// if(userType == '用户'){ | ||
| 574 | +// userTypeValue=1; | ||
| 575 | +// }else if(userType.value == '清运车辆驾驶员'){ | ||
| 576 | +// userTypeValue=2; | ||
| 577 | +// }else if(userType.value == '运输企业负责人'){ | ||
| 578 | +// userTypeValue=3; | ||
| 579 | +// } | ||
| 580 | +// let query = { | ||
| 581 | +// companyType: 1, | ||
| 582 | +// pageNum: pageNo, | ||
| 583 | +// pageSize, | ||
| 584 | +// orderByColumn: sortValue.value, | ||
| 585 | +// registrationArea: registrationAreaValue.value, | ||
| 586 | +// searchValue: carTypeValue.value, | ||
| 587 | +// userTypeValue:userTypeValue, | ||
| 588 | +// userType:userType.value, | ||
| 589 | +// name: searchKeyword.value | ||
| 590 | +// } | ||
| 591 | +// // 查询公司信息 | ||
| 592 | +// queryEnterpriseList(query).then(res => { | ||
| 593 | +// console.log('获取到的公司列表数据:', res); | ||
| 594 | + | ||
| 595 | +// // 从响应中提取分页信息 | ||
| 596 | +// const pageData = res.data.data; | ||
| 597 | +// const dataList = pageData.list || []; | ||
| 598 | +// const total = pageData.total || 0; | ||
| 599 | +// const currentPage = pageData.pageNum || pageNo; | ||
| 600 | +// const totalPages = pageData.pages || Math.ceil(total / pageSize); | ||
| 601 | + | ||
| 602 | +// console.log('分页信息:', { dataList: dataList.length, total, currentPage, totalPages, pageSize }); | ||
| 603 | + | ||
| 604 | +// // 使用 z-paging 的标准方式处理分页 | ||
| 605 | +// // 如果有数据,调用 complete 并传入数据 | ||
| 606 | +// if (dataList.length > 0) { | ||
| 607 | +// paging.value.complete(dataList); | ||
| 608 | +// } else { | ||
| 609 | +// // 如果没有数据,也要调用 complete 告知没有更多数据 | ||
| 610 | +// paging.value.complete([]); | ||
| 611 | +// } | ||
| 612 | +// }).catch(err => { | ||
| 613 | +// console.error('查询公司列表失败:', err); | ||
| 614 | +// // 数据加载失败时也需要调用 complete | ||
| 615 | +// paging.value.complete(false); | ||
| 616 | +// }) | ||
| 617 | +// } | ||
| 507 | </script> | 618 | </script> |
| 508 | 619 | ||
| 620 | + | ||
| 621 | + | ||
| 509 | <style lang="scss" scoped> | 622 | <style lang="scss" scoped> |
| 510 | .home-container { | 623 | .home-container { |
| 511 | background: linear-gradient(to bottom, $u-info-light, $u-info-light); | 624 | background: linear-gradient(to bottom, $u-info-light, $u-info-light); |
garbage-removal/src/pages/order-info/order-driver/detail/index.vue
| @@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
| 19 | 订单信息 | 19 | 订单信息 |
| 20 | </view> | 20 | </view> |
| 21 | <view class="order-detail-container-header-item" | 21 | <view class="order-detail-container-header-item" |
| 22 | - @click.stop="handlerJumpOtherApp(dataGram.garLatitude, dataGram.garLongitude, dataGram.garCoordinate)"> | 22 | + @click.stop="handlerJumpOtherApp(dataGram.garOrderAddress + dataGram.garOrderAddressDetails)"> |
| 23 | <text class="order-detail-container-header-title">清运地点:</text> | 23 | <text class="order-detail-container-header-title">清运地点:</text> |
| 24 | <view class="order-detail-container-header-content" style="text-decoration: underline"> | 24 | <view class="order-detail-container-header-content" style="text-decoration: underline"> |
| 25 | <text selectable='true'>{{ dataGram.garOrderAddress + dataGram.garOrderAddressDetails }}</text> | 25 | <text selectable='true'>{{ dataGram.garOrderAddress + dataGram.garOrderAddressDetails }}</text> |
| @@ -46,15 +46,16 @@ | @@ -46,15 +46,16 @@ | ||
| 46 | </view> | 46 | </view> |
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | - <view class="order-detail-container-header-item" v-for="(disposal,index) in dataGram.disposalSites"> | ||
| 50 | - <view> | 49 | + <view class="order-detail-container-header-item" v-if="dataGram.disposalSites && dataGram.disposalSites.length > 0" v-for="(disposal,index) in dataGram.disposalSites"> |
| 50 | + <view> | ||
| 51 | <text class="order-detail-container-header-title" v-if="index == 0" >处置场地:</text> | 51 | <text class="order-detail-container-header-title" v-if="index == 0" >处置场地:</text> |
| 52 | <text class="order-detail-container-header-title" v-else >     </text> | 52 | <text class="order-detail-container-header-title" v-else >     </text> |
| 53 | + </view> | ||
| 54 | + <view class="order-detail-container-header-content" style="text-decoration: underline" | ||
| 55 | + @click.stop="handlerJumpOtherApp(disposal.addrStr)"> | ||
| 56 | + <text>{{ disposal.addrStr }}</text> | ||
| 57 | + </view> | ||
| 53 | </view> | 58 | </view> |
| 54 | - <view class="order-detail-container-header-content" style="text-decoration: underline" @click.stop="handlerJumpOtherApp(disposal.latitude, disposal.longitude, dataGram.garCoordinate)"> | ||
| 55 | - <text>{{ disposal.addrStr }}</text> | ||
| 56 | - </view> | ||
| 57 | - </view> | ||
| 58 | 59 | ||
| 59 | 60 | ||
| 60 | <view class="order-detail-container-header-item"> | 61 | <view class="order-detail-container-header-item"> |
| @@ -67,37 +68,6 @@ | @@ -67,37 +68,6 @@ | ||
| 67 | <view @click="handleQrCodeClick(orderId)" class="iconfont icon-erweima-xian"></view> | 68 | <view @click="handleQrCodeClick(orderId)" class="iconfont icon-erweima-xian"></view> |
| 68 | </view> | 69 | </view> |
| 69 | </view> | 70 | </view> |
| 70 | - </view> | ||
| 71 | - <!-- 车辆信息 --> | ||
| 72 | - <view class="order-detail-container-box-card"> | ||
| 73 | - <view class="order-detail-container-header-card-title"> | ||
| 74 | - <view class="order-detail-container-header-card-uicon"></view> | ||
| 75 | - 车辆信息 | ||
| 76 | - </view> | ||
| 77 | - <view class="order-detail-container-header-item" style="justify-content: space-between;" | ||
| 78 | - v-for="(item) in handlerList"> | ||
| 79 | - <text class="order-detail-container-header-title" style="color: #303133;"> | ||
| 80 | - {{item.garOrderHandlerName}}/{{ item.garHandlerCarCode }}/{{item.garOrderContainerVolume}} | ||
| 81 | - </text> | ||
| 82 | - <view class="order-detail-container-header-content"> | ||
| 83 | - <text class="order-detail-container-header-title"> | ||
| 84 | - 趟次:{{item.garCarCount}}车 | ||
| 85 | - </text> | ||
| 86 | - </view> | ||
| 87 | - </view> | ||
| 88 | - </view> | ||
| 89 | - <!-- 订单记录 --> | ||
| 90 | - <view class="order-detail-container-box-card"> | ||
| 91 | - <view class="order-detail-container-header-card-title"> | ||
| 92 | - <view class="order-detail-container-header-card-uicon"></view> | ||
| 93 | - 订单信息 | ||
| 94 | - </view> | ||
| 95 | - <!-- <view class="order-detail-container-header-item"> | ||
| 96 | - <text class="order-detail-container-header-title">订单时间:</text> | ||
| 97 | - <view class="order-detail-container-header-content"> | ||
| 98 | - {{ dataGram.garCreateTime }} | ||
| 99 | - </view> | ||
| 100 | - </view> --> | ||
| 101 | <view class="order-detail-container-header-item"> | 71 | <view class="order-detail-container-header-item"> |
| 102 | <text class="order-detail-container-header-title">预约时间:</text> | 72 | <text class="order-detail-container-header-title">预约时间:</text> |
| 103 | <view class="order-detail-container-header-content"> | 73 | <view class="order-detail-container-header-content"> |
| @@ -110,7 +80,7 @@ | @@ -110,7 +80,7 @@ | ||
| 110 | <text selectable="true">{{ dataGram.garOrderContactTel }}</text> | 80 | <text selectable="true">{{ dataGram.garOrderContactTel }}</text> |
| 111 | <view class="icon-box" style="display: flex; align-items: center; justify-content: center;"> | 81 | <view class="icon-box" style="display: flex; align-items: center; justify-content: center;"> |
| 112 | <u-icon v-if="dataGram.handleFlag" name="phone" size="28" | 82 | <u-icon v-if="dataGram.handleFlag" name="phone" size="28" |
| 113 | - @click="handleContactClick(dataGram.garOrderContactTel)"></u-icon> | 83 | + @click="handleContactClick(dataGram.garOrderContactTel)"></u-icon> |
| 114 | </view> | 84 | </view> |
| 115 | </view> | 85 | </view> |
| 116 | </view> | 86 | </view> |
| @@ -127,11 +97,26 @@ | @@ -127,11 +97,26 @@ | ||
| 127 | {{ dataGram.garRemark }} | 97 | {{ dataGram.garRemark }} |
| 128 | </view> | 98 | </view> |
| 129 | </view> | 99 | </view> |
| 130 | - | ||
| 131 | - <view v-if="dataGram.needFollowCar" class="follow-car-notice"> | ||
| 132 | - <text style="color: red;">该订单需要搬运上车</text> | 100 | + </view> |
| 101 | + <!-- 车辆信息 --> | ||
| 102 | + <view class="order-detail-container-box-card"> | ||
| 103 | + <view class="order-detail-container-header-card-title"> | ||
| 104 | + <view class="order-detail-container-header-card-uicon"></view> | ||
| 105 | + 车辆信息 | ||
| 106 | + </view> | ||
| 107 | + <view class="order-detail-container-header-item" style="justify-content: space-between;" | ||
| 108 | + v-for="(item) in handlerList"> | ||
| 109 | + <text class="order-detail-container-header-title" style="color: #303133;"> | ||
| 110 | + {{item.garOrderHandlerName}}/{{ item.garHandlerCarCode }}/{{item.garOrderContainerVolume}} | ||
| 111 | + </text> | ||
| 112 | + <view class="order-detail-container-header-content"> | ||
| 113 | + <text class="order-detail-container-header-title"> | ||
| 114 | + 趟次:{{item.garCarCount}}车 | ||
| 115 | + </text> | ||
| 116 | + </view> | ||
| 133 | </view> | 117 | </view> |
| 134 | </view> | 118 | </view> |
| 119 | + | ||
| 135 | <!-- 处理信息 --> | 120 | <!-- 处理信息 --> |
| 136 | <view class="order-detail-container-box-card"> | 121 | <view class="order-detail-container-box-card"> |
| 137 | <view class="order-detail-container-header-card-title"> | 122 | <view class="order-detail-container-header-card-title"> |
| @@ -232,7 +217,8 @@ import { | @@ -232,7 +217,8 @@ import { | ||
| 232 | queryGarOrderMatchAsk, | 217 | queryGarOrderMatchAsk, |
| 233 | queryGarOrderMatchAsks, | 218 | queryGarOrderMatchAsks, |
| 234 | queryOrderDetail, | 219 | queryOrderDetail, |
| 235 | - updateOrder | 220 | + updateOrder, |
| 221 | + queryDisposalDispatch | ||
| 236 | } from "@/apis/order.js"; | 222 | } from "@/apis/order.js"; |
| 237 | import { createQrCode } from '@/apis/qrcode.js'; | 223 | import { createQrCode } from '@/apis/qrcode.js'; |
| 238 | import uqrcode from '@/components/Sansnn-uQRCode_4.0.6/components/uqrcode/uqrcode.vue'; | 224 | import uqrcode from '@/components/Sansnn-uQRCode_4.0.6/components/uqrcode/uqrcode.vue'; |
| @@ -356,6 +342,11 @@ const selectClick = (index) => { | @@ -356,6 +342,11 @@ const selectClick = (index) => { | ||
| 356 | const handleOrderDetail = (orderId) => { | 342 | const handleOrderDetail = (orderId) => { |
| 357 | queryOrderDetail(orderId).then(res => { | 343 | queryOrderDetail(orderId).then(res => { |
| 358 | dataGram.value = res.data.data; | 344 | dataGram.value = res.data.data; |
| 345 | + // 确保disposalSites存在,如果不存在则初始化为空数组 | ||
| 346 | + if (!dataGram.value.disposalSites) { | ||
| 347 | + dataGram.value.disposalSites = []; | ||
| 348 | + } | ||
| 349 | + | ||
| 359 | currentImages.value = res.data.data.currentImages.map(item => { | 350 | currentImages.value = res.data.data.currentImages.map(item => { |
| 360 | return { url: import.meta.env.VITE_BASE_URL + item}; | 351 | return { url: import.meta.env.VITE_BASE_URL + item}; |
| 361 | }); | 352 | }); |
| @@ -417,8 +408,38 @@ const handleOrderDetail = (orderId) => { | @@ -417,8 +408,38 @@ const handleOrderDetail = (orderId) => { | ||
| 417 | putDownImages.value = res.data.data.putDownImages.map(item => { | 408 | putDownImages.value = res.data.data.putDownImages.map(item => { |
| 418 | return { url: import.meta.env.VITE_BASE_URL + item }; | 409 | return { url: import.meta.env.VITE_BASE_URL + item }; |
| 419 | }); | 410 | }); |
| 411 | + | ||
| 412 | + // 新增:调用queryDisposalDispatch API获取处置场所信息 | ||
| 413 | + queryDisposalDispatch(orderId).then(disposalRes => { | ||
| 414 | + if (disposalRes.data.success && disposalRes.data.data && disposalRes.data.data.length > 0) { | ||
| 415 | + // 根据实际返回数据结构提取处置场所信息,只显示有选中联系人的处置场所 | ||
| 416 | + const disposalSites = disposalRes.data.data | ||
| 417 | + .map(site => { | ||
| 418 | + // 筛选出personnelInfo中checked为true的联系人 | ||
| 419 | + const selectedPerson = site.personnelInfo && site.personnelInfo.length > 0 ? | ||
| 420 | + site.personnelInfo.find(person => person.checked) : null; | ||
| 421 | + | ||
| 422 | + return { | ||
| 423 | + addrStr: site.garOrderDisposalCompanyName || '', // 使用公司名称作为地址显示 | ||
| 424 | + latitude: site.latitude || 0, | ||
| 425 | + longitude: site.longitude || 0, | ||
| 426 | + selectedPerson: selectedPerson // 保存选中的联系人信息 | ||
| 427 | + }; | ||
| 428 | + }) | ||
| 429 | + // 过滤掉没有选中联系人的处置场所 | ||
| 430 | + .filter(site => site.selectedPerson); | ||
| 431 | + | ||
| 432 | + dataGram.value.disposalSites = disposalSites; | ||
| 433 | + } else { | ||
| 434 | + dataGram.value.disposalSites = []; | ||
| 435 | + } | ||
| 436 | + }).catch(err => { | ||
| 437 | + console.error('获取处置场所信息失败:', err); | ||
| 438 | + dataGram.value.disposalSites = []; | ||
| 439 | + }); | ||
| 420 | }) | 440 | }) |
| 421 | } | 441 | } |
| 442 | + | ||
| 422 | /** | 443 | /** |
| 423 | * 拨打电话回调 | 444 | * 拨打电话回调 |
| 424 | */ | 445 | */ |
| @@ -427,25 +448,13 @@ const handleContactClick = (val) => { | @@ -427,25 +448,13 @@ const handleContactClick = (val) => { | ||
| 427 | }).catch(err => { }); | 448 | }).catch(err => { }); |
| 428 | } | 449 | } |
| 429 | 450 | ||
| 430 | -const handlerJumpOtherApp = (latitude, longitude, garCoordinate) => { | ||
| 431 | - // 给出提示确定要跳转吗 | ||
| 432 | - uni.showModal({ | ||
| 433 | - title: '提示', | ||
| 434 | - content: '是否跳转到app定位进行导航?', | ||
| 435 | - success: function (res) { | ||
| 436 | - if (res.confirm) { | ||
| 437 | - uni.openLocation({ | ||
| 438 | - latitude: latitude, | ||
| 439 | - longitude: longitude, | ||
| 440 | - success: function () { | ||
| 441 | - console.log('success'); | ||
| 442 | - } | ||
| 443 | - }); | ||
| 444 | - } | ||
| 445 | - } | ||
| 446 | - }) | 451 | +const handlerJumpOtherApp = (locationName) => { |
| 452 | + // 方案一:使用腾讯地图URI API(推荐) | ||
| 453 | + // 构建腾讯地图搜索链接,使用更完整的参数 | ||
| 454 | + window.location.href =`https://apis.map.qq.com/uri/v1/search?keyword=${encodeURIComponent(locationName)}®ion=${encodeURIComponent(locationName)}&referer=XICBZ-ALWKT-2KPXZ-VCBL7-XMRYO-2QFS4&policy=1`; | ||
| 447 | } | 455 | } |
| 448 | 456 | ||
| 457 | + | ||
| 449 | const handleEvaluate = (orderId, userType) => { | 458 | const handleEvaluate = (orderId, userType) => { |
| 450 | uni.$u.route(`pages/order-info/order-other/evaluate/index?orderId=${orderId}&userType=${userType}`) | 459 | uni.$u.route(`pages/order-info/order-other/evaluate/index?orderId=${orderId}&userType=${userType}`) |
| 451 | } | 460 | } |
garbage-removal/src/pages/wode/index.vue
| @@ -7,9 +7,14 @@ | @@ -7,9 +7,14 @@ | ||
| 7 | <view style="display: flex; flex-direction: column; width: 100%;"> | 7 | <view style="display: flex; flex-direction: column; width: 100%;"> |
| 8 | <view class="manager-info"> | 8 | <view class="manager-info"> |
| 9 | <view class="manager-info-transport-company-name"> | 9 | <view class="manager-info-transport-company-name"> |
| 10 | - <text>{{ userInfo.transportCompanyName ? userInfo.transportCompanyName : userInfo.userName }}</text> | 10 | + <text v-if="userInfo.transportCompanyName === '' || userInfo.transportCompanyName == null"> |
| 11 | + {{userName}} | ||
| 12 | + </text> | ||
| 13 | + <text v-else> | ||
| 14 | + {{ userInfo.transportCompanyName && userInfo.transportCompanyName === userName ? userInfo.transportCompanyName : (userInfo.transportCompanyName ? userInfo.transportCompanyName + ' ' : '') + (userName ? userName : '') }} | ||
| 15 | + </text> | ||
| 11 | </view> | 16 | </view> |
| 12 | - <view class="choose-type-item-text-right-label">{{ userInfo.userType }} | 17 | + <view class="choose-type-item-text-right-label">{{userInfo.userType}} |
| 13 | </view> | 18 | </view> |
| 14 | 19 | ||
| 15 | </view> | 20 | </view> |
| @@ -74,6 +79,7 @@ import wodeOther from './wode-other/index.vue'; | @@ -74,6 +79,7 @@ import wodeOther from './wode-other/index.vue'; | ||
| 74 | const store = useMainStore(); | 79 | const store = useMainStore(); |
| 75 | const pic = ref(headImg) | 80 | const pic = ref(headImg) |
| 76 | const userInfo = computed(() => store.userInfo) | 81 | const userInfo = computed(() => store.userInfo) |
| 82 | +const userName =computed(() => store.userName) | ||
| 77 | 83 | ||
| 78 | 84 | ||
| 79 | 85 |