Commit 8532d3ee authored by 石建新(贵阳日报)'s avatar 石建新(贵阳日报)
parents 00b5bcba fd021984
......@@ -6,21 +6,25 @@
v-for="(item, index) in dataList"
:key="index"
:class="{ active: selectedItem === index }"
@tap="selectItem(index)"
@tap="selectItem(index, item)"
>
{{ item }}
</li>
<li>选择日期</li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm4">
<li>选择日期</li>
</wd-calendar>
</ul>
</view>
</template>
<script setup>
import { defineProps, onMounted } from 'vue';
import { getStartDate, getTour } from '@/api/assistingAgriculture/village';
const items = reactive(['日期不限', '今天', '明天', '一周内', '一月内', '本周末', '七夕节']);
import { getStartDate } from '@/api/assistingAgriculture/village';
const selectedItem = ref(null);
const emit = defineEmits(['dataParams']);
const dataList = ref([]);
const value = ref('');
const formatValue = ref('');
const params = {
current: 1,
size: 10,
......@@ -34,15 +38,20 @@ const props = defineProps({
onMounted(async () => {
getStartDateList();
});
const selectItem = (selectItem) => {
selectedItem.value = selectItem;
const selectItem = (index, item) => {
selectedItem.value = index;
emit('dataParams', item);
};
// 查询景点
// 查询出发日期
const getStartDateList = () => {
getStartDate(params).then((res) => {
dataList.value = res.data;
console.log(Object.keys(dataList.value, 232));
});
};
function handleConfirm4({ value }) {
formatValue.value = new Date(value).toString();
}
</script>
<style lang="scss" scoped>
......
<template>
<view class="sort" :style="{ width: width }">
<view class="date">景点</view>
<ul class="ul">
<li
v-for="(item, index) in placeList"
:key="index"
:class="{ active: selectedItem === index }"
@tap="selectItem(index)"
@tap="selectItem(index, item)"
>
{{ item.attractionName }}
</li>
......@@ -18,7 +17,7 @@
import { defineProps, onMounted } from 'vue';
import { getTour } from '@/api/assistingAgriculture/village';
const placeList = ref([]);
const emit = defineEmits(['sortParams']);
const emit = defineEmits(['placeParams']);
const selectedItem = ref(null);
const props = defineProps({
width: {
......@@ -31,7 +30,7 @@ onMounted(async () => {
});
const selectItem = (index, item) => {
selectedItem.value = index;
emit('sortParams', item);
emit('placeParams', item);
};
// 查询景点
const getTourList = () => {
......
......@@ -25,7 +25,9 @@
<view class="area">
<view class="area_l">
<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 class="area_r">
<wd-icon name="location" size="22px" @tap="changeLocation" />
......@@ -59,7 +61,9 @@
<script setup>
import Header from '@/pages/order/components/Header/index.vue';
import { addAddress, updateAddress, deleteAddress } from '@/api/address';
import api from '@/services';
const newAddressFlag = ref(false);
const reForm = ref();
......@@ -92,46 +96,54 @@ const hdSubmit = async () => {
await addAddress({
...forMData.value,
commonAddr: forMData.value.commonAddr ? 1 : 0,
province: forMData.value.province,
city: forMData.value.city,
area: forMData.value.area,
});
};
function handleSubmit() {
console.log('model的值', reForm.value);
reForm.value
.validate()
.then(({ valid }) => {
if (valid) {
hdSubmit();
// xma.showToast({
// title: '提交成功',
// duration: 2000,
// success: function () {
// console.log('数据更新后跳转地址列表页');
// },
// });
xma.showToast({
title: '提交成功',
duration: 2000,
});
}
})
.catch((error) => {
console.log(error, 'error');
});
}
// 重新定位收货地址
async function changeLocation() {
uni.chooseLocation({
success: function (res) {
forMData.value.city = res.address;
// forMData.value.city = res.address;
forMData.value.addr = res.address;
forMData.value.lng = res.longitude;
forMData.value.lat = res.latitude;
console.log('位置信息:' + JSON.stringify(res));
console.log('位置名称:' + res.name);
console.log('详细地址:' + res.address);
console.log('纬度:' + res.latitude);
console.log('经度:' + res.longitude);
uni.request({
url: '/ws/geocoder/v1/',
data: {
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>
......
......@@ -111,9 +111,9 @@
</view>
</view>
<Sort v-show="rotate" @sortParams="sortParams" />
<DepartureDate v-show="rotate2" />
<ScenicSpots v-show="rotate3" />
<Screen v-show="rotate4" />
<DepartureDate v-show="rotate2" @dataParams="dataParams" />
<ScenicSpots v-show="rotate3" @placeParams="placeParams" />
<Screen v-show="rotate4" @screenParams="screenParams" />
</view>
<view class="list-card">
<view
......@@ -172,6 +172,8 @@ const rotate4 = ref(false);
const cardList = ref([]);
const popularRouterData = ref([]);
const sortType = ref(null);
const attractionId = ref(null);
const dateType = ref(null);
const locationFiltering = (index) => {
switch (index) {
case 0:
......@@ -201,6 +203,8 @@ const locationFiltering = (index) => {
}
if (index === 0) {
sortType.value = null;
attractionId.value = null;
dateType.value = null;
}
};
// 查询热门路线
......@@ -212,9 +216,20 @@ const getPopular = () => {
popularRouterData.value = res.data.records;
});
};
// 智能排序
const sortParams = (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();
};
// 查询列表
......@@ -223,14 +238,14 @@ const getProd = () => {
current: 1,
size: 10,
...(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) => {
res.data.records.forEach((item) => {
item.img = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
cardList.value = res.data.records;
console.log(res, 222);
});
};
function toRouteDetails() {
......
......@@ -9,7 +9,7 @@
class="pubList"
v-for="item in list"
:key="item.shopId"
@click="item.shopStatus != [1, 2, 3] ? shopGto(item) : ''"
@click="item.shopStatus != [1, 2, 3] ? shopGto(item.shopId) : ''"
>
<!-- 列表头部 -->
<view class="titlecon">
......
......@@ -45,6 +45,11 @@ export default defineConfig({
changeOrigin: true,
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