Commit 8532d3ee authored by 石建新(贵阳日报)'s avatar 石建新(贵阳日报)
parents 00b5bcba fd021984
...@@ -6,21 +6,25 @@ ...@@ -6,21 +6,25 @@
v-for="(item, index) in dataList" v-for="(item, index) in dataList"
:key="index" :key="index"
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index)" @tap="selectItem(index, item)"
> >
{{ item }} {{ item }}
</li> </li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm4">
<li>选择日期</li> <li>选择日期</li>
</wd-calendar>
</ul> </ul>
</view> </view>
</template> </template>
<script setup> <script setup>
import { defineProps, onMounted } from 'vue'; import { defineProps, onMounted } from 'vue';
import { getStartDate, getTour } from '@/api/assistingAgriculture/village'; import { getStartDate } from '@/api/assistingAgriculture/village';
const items = reactive(['日期不限', '今天', '明天', '一周内', '一月内', '本周末', '七夕节']);
const selectedItem = ref(null); const selectedItem = ref(null);
const emit = defineEmits(['dataParams']);
const dataList = ref([]); const dataList = ref([]);
const value = ref('');
const formatValue = ref('');
const params = { const params = {
current: 1, current: 1,
size: 10, size: 10,
...@@ -34,15 +38,20 @@ const props = defineProps({ ...@@ -34,15 +38,20 @@ const props = defineProps({
onMounted(async () => { onMounted(async () => {
getStartDateList(); getStartDateList();
}); });
const selectItem = (selectItem) => { const selectItem = (index, item) => {
selectedItem.value = selectItem; selectedItem.value = index;
emit('dataParams', item);
}; };
// 查询景点 // 查询出发日期
const getStartDateList = () => { const getStartDateList = () => {
getStartDate(params).then((res) => { getStartDate(params).then((res) => {
dataList.value = res.data; dataList.value = res.data;
console.log(Object.keys(dataList.value, 232));
}); });
}; };
function handleConfirm4({ value }) {
formatValue.value = new Date(value).toString();
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
......
<template> <template>
<view class="sort" :style="{ width: width }"> <view class="sort" :style="{ width: width }">
<view class="date">景点</view>
<ul class="ul"> <ul class="ul">
<li <li
v-for="(item, index) in placeList" v-for="(item, index) in placeList"
:key="index" :key="index"
:class="{ active: selectedItem === index }" :class="{ active: selectedItem === index }"
@tap="selectItem(index)" @tap="selectItem(index, item)"
> >
{{ item.attractionName }} {{ item.attractionName }}
</li> </li>
...@@ -18,7 +17,7 @@ ...@@ -18,7 +17,7 @@
import { defineProps, onMounted } from 'vue'; import { defineProps, onMounted } from 'vue';
import { getTour } from '@/api/assistingAgriculture/village'; import { getTour } from '@/api/assistingAgriculture/village';
const placeList = ref([]); const placeList = ref([]);
const emit = defineEmits(['sortParams']); const emit = defineEmits(['placeParams']);
const selectedItem = ref(null); const selectedItem = ref(null);
const props = defineProps({ const props = defineProps({
width: { width: {
...@@ -31,7 +30,7 @@ onMounted(async () => { ...@@ -31,7 +30,7 @@ onMounted(async () => {
}); });
const selectItem = (index, item) => { const selectItem = (index, item) => {
selectedItem.value = index; selectedItem.value = index;
emit('sortParams', item); emit('placeParams', item);
}; };
// 查询景点 // 查询景点
const getTourList = () => { const getTourList = () => {
......
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
<view class="area"> <view class="area">
<view class="area_l"> <view class="area_l">
<view class="area_lt">当前定位</view> <view class="area_lt">当前定位</view>
<view class="area_lb">{{ forMData.city }}</view> <view class="area_lb">
{{ forMData.province }}-{{ forMData.city }}-{{ forMData.area }}
</view>
</view> </view>
<view class="area_r"> <view class="area_r">
<wd-icon name="location" size="22px" @tap="changeLocation" /> <wd-icon name="location" size="22px" @tap="changeLocation" />
...@@ -59,7 +61,9 @@ ...@@ -59,7 +61,9 @@
<script setup> <script setup>
import Header from '@/pages/order/components/Header/index.vue'; import Header from '@/pages/order/components/Header/index.vue';
import { addAddress, updateAddress, deleteAddress } from '@/api/address'; import { addAddress, updateAddress, deleteAddress } from '@/api/address';
import api from '@/services';
const newAddressFlag = ref(false); const newAddressFlag = ref(false);
const reForm = ref(); const reForm = ref();
...@@ -92,46 +96,54 @@ const hdSubmit = async () => { ...@@ -92,46 +96,54 @@ const hdSubmit = async () => {
await addAddress({ await addAddress({
...forMData.value, ...forMData.value,
commonAddr: forMData.value.commonAddr ? 1 : 0, commonAddr: forMData.value.commonAddr ? 1 : 0,
province: forMData.value.province,
city: forMData.value.city,
area: forMData.value.area,
}); });
}; };
function handleSubmit() { function handleSubmit() {
console.log('model的值', reForm.value);
reForm.value reForm.value
.validate() .validate()
.then(({ valid }) => { .then(({ valid }) => {
if (valid) { if (valid) {
hdSubmit(); hdSubmit();
// xma.showToast({ xma.showToast({
// title: '提交成功', title: '提交成功',
// duration: 2000, duration: 2000,
// success: function () { });
// console.log('数据更新后跳转地址列表页');
// },
// });
} }
}) })
.catch((error) => { .catch((error) => {
console.log(error, 'error'); console.log(error, 'error');
}); });
} }
// 重新定位收货地址 // 重新定位收货地址
async function changeLocation() { async function changeLocation() {
uni.chooseLocation({ uni.chooseLocation({
success: function (res) { success: function (res) {
forMData.value.city = res.address; // forMData.value.city = res.address;
forMData.value.addr = res.address; forMData.value.addr = res.address;
forMData.value.lng = res.longitude; forMData.value.lng = res.longitude;
forMData.value.lat = res.latitude; forMData.value.lat = res.latitude;
console.log('位置信息:' + JSON.stringify(res)); console.log('位置信息:' + JSON.stringify(res));
console.log('位置名称:' + res.name); uni.request({
console.log('详细地址:' + res.address); url: '/ws/geocoder/v1/',
console.log('纬度:' + res.latitude); data: {
console.log('经度:' + res.longitude); key: 'MN4BZ-7JXKW-2RYRD-32QGF-AHONV-PAFUN',
location: `${res.latitude},${res.longitude}`,
},
success: function (res) {
// console.log('逆地理编码:' + JSON.stringify(res));
if (res.data.status === 0) {
forMData.value.province = res.data.result.address_component.province;
forMData.value.city = res.data.result.address_component.city;
forMData.value.area = res.data.result.address_component.district;
}
},
});
}, },
}); });
const res = ('26.56806', '106.714304');
console.log('地址转换结果:' + res);
} }
</script> </script>
......
...@@ -111,9 +111,9 @@ ...@@ -111,9 +111,9 @@
</view> </view>
</view> </view>
<Sort v-show="rotate" @sortParams="sortParams" /> <Sort v-show="rotate" @sortParams="sortParams" />
<DepartureDate v-show="rotate2" /> <DepartureDate v-show="rotate2" @dataParams="dataParams" />
<ScenicSpots v-show="rotate3" /> <ScenicSpots v-show="rotate3" @placeParams="placeParams" />
<Screen v-show="rotate4" /> <Screen v-show="rotate4" @screenParams="screenParams" />
</view> </view>
<view class="list-card"> <view class="list-card">
<view <view
...@@ -172,6 +172,8 @@ const rotate4 = ref(false); ...@@ -172,6 +172,8 @@ const rotate4 = ref(false);
const cardList = ref([]); const cardList = ref([]);
const popularRouterData = ref([]); const popularRouterData = ref([]);
const sortType = ref(null); const sortType = ref(null);
const attractionId = ref(null);
const dateType = ref(null);
const locationFiltering = (index) => { const locationFiltering = (index) => {
switch (index) { switch (index) {
case 0: case 0:
...@@ -201,6 +203,8 @@ const locationFiltering = (index) => { ...@@ -201,6 +203,8 @@ const locationFiltering = (index) => {
} }
if (index === 0) { if (index === 0) {
sortType.value = null; sortType.value = null;
attractionId.value = null;
dateType.value = null;
} }
}; };
// 查询热门路线 // 查询热门路线
...@@ -212,9 +216,20 @@ const getPopular = () => { ...@@ -212,9 +216,20 @@ const getPopular = () => {
popularRouterData.value = res.data.records; popularRouterData.value = res.data.records;
}); });
}; };
// 智能排序
const sortParams = (sortMode) => { const sortParams = (sortMode) => {
sortType.value = sortMode; sortType.value = sortMode;
console.log(sortType.value, 211); getProd();
};
// 出发日期
const dataParams = (item) => {
console.log(item, 333);
dateType.value = item;
getProd();
};
// 景点
const placeParams = (id) => {
attractionId.value = id;
getProd(); getProd();
}; };
// 查询列表 // 查询列表
...@@ -223,14 +238,14 @@ const getProd = () => { ...@@ -223,14 +238,14 @@ const getProd = () => {
current: 1, current: 1,
size: 10, size: 10,
...(sortType.value !== null && { sortType: sortType.value.sortMode }), ...(sortType.value !== null && { sortType: sortType.value.sortMode }),
...(attractionId.value !== null && { attractionId: attractionId.value.id }),
...(dateType.value !== null && { dateType: dateType.value }),
}; };
console.log(params, 222);
getProdList(params).then((res) => { getProdList(params).then((res) => {
res.data.records.forEach((item) => { res.data.records.forEach((item) => {
item.img = import.meta.env.VITE_APP_IMG_URL + item.pic; item.img = import.meta.env.VITE_APP_IMG_URL + item.pic;
}); });
cardList.value = res.data.records; cardList.value = res.data.records;
console.log(res, 222);
}); });
}; };
function toRouteDetails() { function toRouteDetails() {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
class="pubList" class="pubList"
v-for="item in list" v-for="item in list"
:key="item.shopId" :key="item.shopId"
@click="item.shopStatus != [1, 2, 3] ? shopGto(item) : ''" @click="item.shopStatus != [1, 2, 3] ? shopGto(item.shopId) : ''"
> >
<!-- 列表头部 --> <!-- 列表头部 -->
<view class="titlecon"> <view class="titlecon">
......
...@@ -45,6 +45,11 @@ export default defineConfig({ ...@@ -45,6 +45,11 @@ export default defineConfig({
changeOrigin: true, changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''), rewrite: (path) => path.replace(/^\/api/, ''),
}, },
'/ws/geocoder': {
target: 'https://apis.map.qq.com',
changeOrigin: true,
bypass: (req, res, options) => res.setHeader("x-req-proxyUr1", options.target + req.url)
}
}, },
}, },
}); });
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment