Commit d3a4a685 authored by 石建新(贵阳日报)'s avatar 石建新(贵阳日报)
parents e9163ecd c7aafb04
......@@ -3,7 +3,7 @@
<view class="date">出发日期</view>
<ul class="ul">
<li
v-for="(item, index) in items"
v-for="(item, index) in dataList"
:key="index"
:class="{ active: selectedItem === index }"
@tap="selectItem(index)"
......@@ -16,18 +16,33 @@
</template>
<script setup>
import { defineProps } from 'vue';
import { defineProps, onMounted } from 'vue';
import { getStartDate, getTour } from '@/api/assistingAgriculture/village';
const items = reactive(['日期不限', '今天', '明天', '一周内', '一月内', '本周末', '七夕节']);
const selectedItem = ref(null);
const dataList = ref([]);
const params = {
current: 1,
size: 10,
};
const props = defineProps({
width: {
type: String,
default: '100%',
},
});
onMounted(async () => {
getStartDateList();
});
const selectItem = (selectItem) => {
selectedItem.value = selectItem;
};
// 查询景点
const getStartDateList = () => {
getStartDate(params).then((res) => {
dataList.value = res.data;
});
};
</script>
<style lang="scss" scoped>
......
......@@ -8,7 +8,7 @@
:class="{ active: selectedItem === index }"
@tap="selectItem(index)"
>
{{ item.brief }}
{{ item.attractionName }}
</li>
</ul>
</view>
......@@ -35,7 +35,7 @@ const selectItem = (index, item) => {
};
// 查询景点
const getTourList = () => {
getTour({ prodId: 0 }).then((res) => {
getTour().then((res) => {
placeList.value = res.data;
});
};
......
......@@ -5,7 +5,7 @@
v-for="(item, index) in items"
:key="index"
:class="{ active: selectedItem === index }"
@tap="selectItem(index)"
@tap="selectItem(index, item)"
>
{{ item.name }}
</li>
......@@ -16,11 +16,11 @@
<script setup>
import { defineProps } from 'vue';
const items = ref([
{ name: '距离优先', sortModel: 1 },
{ name: '好评优先', sortModel: 2 },
{ name: '销量优先', sortModel: 3 },
{ name: '低价优先', sortModel: 4 },
{ name: '高价优先', sortModel: 5 },
{ name: '距离优先', sortMode: 1 },
{ name: '好评优先', sortMode: 2 },
{ name: '销量优先', sortMode: 3 },
{ name: '低价优先', sortMode: 4 },
{ name: '高价优先', sortMode: 5 },
]);
const emit = defineEmits(['sortParams']);
const selectedItem = ref(null);
......
......@@ -3,7 +3,7 @@ import { request } from '../../utils/request';
// 查询景点
export function getTour(data) {
return request({
url: `/sgyrdd/znprod/tour/list`,
url: `/sgyrdd/znprod/attraction/list`,
method: 'GET',
data,
});
......@@ -24,3 +24,11 @@ export function getProdList(data) {
data,
});
}
// 查询出发日期
export function getStartDate(data) {
return request({
url: `/sgyrdd/prod/startDate/page`,
method: 'GET',
data,
});
}
......@@ -55,3 +55,21 @@ export function receiveCoupon(data) {
data,
});
}
// 商家评论列表
export function getCommentList(data) {
return request({
url: `/sgyrdd/evaluation/page`,
method: 'GET',
data,
});
}
// 评论列表数量统计和相同好评最多的评语
export function getEvalStatis(data) {
return request({
url: `/sgyrdd/evaluation/getEvalStatis`,
method: 'GET',
data,
});
}
......@@ -255,7 +255,8 @@
{
"path": "pages/assistingAgriculture/detail/comment",
"style": {
"navigationBarTitleText": "评论"
"navigationBarTitleText": "评论",
"enablePullDownRefresh": true
}
}
],
......
......@@ -171,10 +171,6 @@ const rotate3 = ref(false);
const rotate4 = ref(false);
const cardList = ref([]);
const popularRouterData = ref([]);
const params = ref({
current: 1,
size: 10,
});
const sortType = ref(null);
const locationFiltering = (index) => {
switch (index) {
......@@ -203,6 +199,9 @@ const locationFiltering = (index) => {
rotate3.value = false;
break;
}
if (index === 0) {
sortType.value = null;
}
};
// 查询热门路线
const getPopular = () => {
......@@ -213,9 +212,20 @@ const getPopular = () => {
popularRouterData.value = res.data.records;
});
};
const sortParams = (sortMode) => {
sortType.value = sortMode;
console.log(sortType.value, 211);
getProd();
};
// 查询列表
const getProd = () => {
getProdList({ current: 1, size: 10 }).then((res) => {
const params = {
current: 1,
size: 10,
...(sortType.value !== null && { sortType: sortType.value.sortMode }),
};
console.log(params, 222);
getProdList(params).then((res) => {
res.data.records.forEach((item) => {
item.img = import.meta.env.VITE_APP_IMG_URL + item.pic;
});
......
......@@ -44,6 +44,7 @@
<script setup>
import { ref } from 'vue';
import card from './card.vue';
import { getCommentList } from '../../../api/packageDetail';
const commentTypeList = [
{
text: '图/视频',
......@@ -114,7 +115,20 @@ const tagList = [
value: 514,
},
];
const commentParameters = {
shopId: '1818876196597334017',
current: 1,
size: 10,
};
onLoad((options) => {
getCommentListFn();
});
const showMoreTag = ref(false);
const getCommentListFn = () => {
getCommentList(commentParameters).then((res) => {
console.log('打印评论', res);
});
};
</script>
<style lang="scss" scoped>
......
......@@ -35,37 +35,33 @@
</view>
<view class="comment-list">
<view class="comment-item" v-for="item in 3" :key="item">
<view class="comment-item" v-for="(item, index) in commentData" :key="index">
<view class="top">
<view class="row">
<image
class="headPortrait"
mode="aspectFill"
src="@/static/assistingAgriculture/detail/detail-img.png"
></image>
<image class="headPortrait" mode="aspectFill" :src="fileDomain + item.avatar"></image>
<view class="right">
<text class="name">略略略</text>
<text class="name">{{ item.nickName }}</text>
<view class="ratebox">
<image
class="rate-img"
src="@/static/assistingAgriculture/detail/fiveStars.png"
src="../static/assistingAgriculture/index/fiveStars.png"
></image>
<text>5.0分</text>
<text>好评</text>
<text>{{ item.merchantServices }}.0分</text>
<text>{{ rateList[item.merchantServices].text }}</text>
</view>
</view>
</view>
<text class="detail">2024-08-03 筑农散养虫子土鸡(未下蛋小母鸡)x2</text>
<text class="detail">{{ item.createTime.slice(0, 10) }} {{ item.prodName }}x2</text>
</view>
<view class="info">
<text class="text">味道鲜美,煲出来的汤非常好喝,值得购买!</text>
<view class="imgbox">
<text class="text">{{ item.evaluation }}</text>
<view class="imgbox" v-if="item.images.length > 0">
<image
class="img"
mode="aspectFill"
src="@/static/assistingAgriculture/detail/detail-img.png"
v-for="item in 6"
:key="item"
:src="fileDomain + img"
v-for="img in item.images"
:key="img"
></image>
</view>
</view>
......@@ -76,6 +72,8 @@
</template>
<script setup>
import { getCommentList } from '@/api/packageDetail';
const fileDomain = import.meta.env.VITE_APP_IMG_URL;
const searchValue = ref('');
const tab = ref(0);
......@@ -102,33 +100,67 @@ const tabs = ref([
},
]);
const rateList = ref([
{
value: 1,
url: '@/static/assistingAgriculture/index/oneStar.png',
const rateList = ref({
1: {
url: '../../static/assistingAgriculture/index/oneStar.png',
text: '很糟',
},
{
value: 2,
url: '@/static/assistingAgriculture/index/twoStars.png',
2: {
url: '../../static/assistingAgriculture/index/twoStars.png',
text: '较差',
},
{
value: 3,
url: '@/static/assistingAgriculture/index/threeStars.png',
3: {
url: '../../static/assistingAgriculture/index/threeStars.png',
text: '一般',
},
{
value: 4,
url: '@/static/assistingAgriculture/index/fourStars.png',
4: {
url: '../../static/assistingAgriculture/index/fourStars.png',
text: '还行',
},
{
value: 5,
url: '@/static/assistingAgriculture/index/fiveStars.png',
5: {
url: '../../static/assistingAgriculture/index/fiveStars.png',
text: '超赞',
},
]);
});
/**
* 获取用户优惠券列表
*/
const isEnd = ref(false);
const total = ref(0);
const commentData = ref([]);
const catalog = reactive({
current: 0,
size: 10,
shopId: '1818876196597334017',
evaluation: '', // 关键字搜索
type: '', // img-图片,append-追评,diff-中差评,good-好评
});
const getList = async () => {
catalog.current++;
xma.showLoading({
title: '加载中...',
mask: true,
});
const res = await getCommentList(catalog);
if (res.data.records.length < catalog.size) {
isEnd.value = true;
}
if (res.data.records.length > 0) {
res.data.records.forEach((item) => {
if (item.images === '') {
item.images = [];
} else {
item.images = item.images.split(',');
}
});
commentData.value.push(...res.data.records);
total.value = res.data.total;
console.log(commentData.value);
}
xma.hideLoading();
};
getList();
const handleChangeTab = (e) => {
if (e === tab.value) return;
......
<template>
<view class="container">
<Header title="全部订单"></Header>
<view class="tabs">
<wd-tabs v-model="tab" animated :lineWidth="38" :lineHeight="3" @change="handleChange">
<!-- 顶部搜索框-->
<view class="top">
<wd-icon
class="icon"
name="thin-arrow-left"
color="#000"
size="32rpx"
@click="handleBack"
></wd-icon>
<view class="searchBox">
<view class="search">
<wd-icon name="search" size="30rpx" color="#999"></wd-icon>
<input
type="text"
:value="catalog.keyword"
class="text"
placeholder="搜索我的订单"
placeholder-style="font-size:28rpx;"
@confirm="handleSearch"
@input="handleInput"
confirm-type="搜索"
/>
</view>
<wd-icon
name="error-fill"
size="30rpx"
color="#999"
v-if="catalog.keyword"
@tap="handleClear"
></wd-icon>
</view>
</view>
<view class="tabs" v-if="orderDic">
<wd-tabs v-model="tab" animated :lineWidth="38" :lineHeight="3" @change="handleChange" sticky>
<block v-for="item in tabs" :key="item.value">
<wd-tab :title="`${item.name}`" :name="item.value">
<view class="content" v-if="dataList.length > 0">
<view class="box" v-for="(item, index) in dataList" :key="index">
<view class="header" @click="toShopDetail(item)">
<view class="header" @click="handleDetail(item)">
<view class="left">
<image src="@/static/order/shop.png" />
<text
class="icon"
:style="{ 'background-color': iconList[item.orderType].color }"
>
{{ iconList[item.orderType].text }}
</text>
<!-- <image src="@/static/order/shop.png" /> -->
<view class="title">{{ item.shopName }}</view>
</view>
<view class="right">
<span class="status">{{ stateList[item.status].label }}</span>
<span class="status">{{ stateList[item.orderType][item.status].label }}</span>
<wd-count-down
:time="item.countDown"
:format="format"
......@@ -23,7 +60,7 @@
</view>
</view>
<view class="info" @click="handleDetail(item.orderNumber)">
<view class="info" @click="handleDetail(item)">
<image mode="aspectFill" :src="fileDomain + item.orderItems[0].pic" />
<view class="info-box">
<view class="text">下单时间:{{ item.createTime.slice(0, 16) }}</view>
......@@ -122,7 +159,7 @@
</template>
<script setup>
import Header from './components/Header/index.vue';
// import Header from './components/Header/index.vue';
import Payment from './components/Payment/index.vue';
import {
getOrderList,
......@@ -132,19 +169,32 @@ import {
getOrderDetail,
} from '@/api/order';
import { getOrderDic } from '@/utils/orderDic';
import { orderStatus, signIn } from '@/utils/signIn';
import testJson from '@/static/json/test.json';
import { getTokenUser } from '@/api/index';
import { getToken } from '@/utils/auth';
const fileDomain = import.meta.env.VITE_APP_IMG_URL;
const stateList = ref();
onLoad((options) => {
const orderDic = getOrderDic();
stateList.value = orderDic.reduce((obj, item) => {
obj[item.baseStatus] = item;
return obj;
}, {});
const stateList = ref({});
const orderDic = ref();
onLoad(async (options) => {
// await signIn();
if (!getToken()) await signIn2();
if (!getOrderDic()) await orderStatus();
orderDic.value = getOrderDic();
orderDic.value.baseOrder[0].value = 'all';
for (const key in orderDic.value) {
const data = orderDic.value[key].reduce((obj, item) => {
obj[item.baseStatus] = item;
return obj;
}, {});
stateList.value[key] = data;
}
if (options.status) {
tab.value = options.status;
}
getList();
await getList();
});
const tabs = ref([
......@@ -164,10 +214,10 @@ const tabs = ref([
name: '待评价',
value: 'not_eval',
},
{
name: '已完成',
value: 'complete',
},
// {
// name: '已完成',
// value: 'complete',
// },
{
name: '退款/售后',
value: 'after_sales',
......@@ -175,6 +225,21 @@ const tabs = ref([
]);
const tab = ref('all');
const iconList = ref({
logistics: {
color: '#FF0909',
text: '物流',
},
store: {
color: '#FF4C0D',
text: '到店',
},
takeaway: {
color: '#FFB023',
text: '外卖',
},
});
onShow(() => {
if (pendingPaymentOrder.value) {
// 查询订单状态决定是否支付
......@@ -292,6 +357,26 @@ const initDataList = () => {
});
};
/**
* 搜索订单
*/
const handleSearch = (e) => {
catalog.keyword = e.detail.value;
initDataList().then(() => {
getList();
});
};
const handleInput = (e) => {
catalog.keyword = e.detail.value;
};
const handleClear = () => {
catalog.keyword = '';
initDataList().then(() => {
getList();
});
};
/**
* 删除订单
* @param {*} orderNumber
......@@ -415,11 +500,16 @@ const onFinish = async (orderNumber) => {
});
};
const handleDetail = (id) => {
const handleDetail = (item) => {
// 清空查询待付款状态
pendingPaymentOrder.value = null;
if (item.orderType === 'logistics') {
uni.navigateTo({
url: `pages/assistingAgriculture/order/detail?orderNumber=${item.orderNumber}`,
});
}
uni.navigateTo({
url: `/pages/order/detail?orderNumber=${id}`,
url: `/pages/order/detail?orderNumber=${item.orderNumber}`,
});
};
......@@ -489,6 +579,25 @@ const toShopDetail = (item) => {
url: `/pages/shop/shop?shopId=${item.shopId}`,
});
};
// 登录
const signIn2 = () => {
xma.showLoading({
title: '加载中',
mask: true,
});
return getTokenUser(testJson).then((res) => {
const token = res.data.access_token;
const userInfo = res.data.user_info;
xma.setStorageSync('Authorization', token);
xma.setStorageSync('userInfo', userInfo);
console.log('登录...');
});
};
const handleBack = () => {
uni.navigateBack();
};
</script>
<style scoped lang="scss">
......@@ -501,9 +610,9 @@ page {
margin: 0 auto;
.tabs {
padding-top: 88rpx;
padding-top: 108rpx;
.wd-tabs {
&:deep(.wd-tabs) {
background-color: #f5f5f5;
}
......@@ -518,12 +627,52 @@ page {
}
}
.top {
height: 108rpx;
position: fixed;
width: 100%;
z-index: 999;
display: flex;
background-color: #f5f5f5;
margin: 0 auto;
align-items: center;
padding: 0 30rpx;
gap: 14rpx;
.searchBox {
width: 492rpx;
height: 66rpx;
background: #f3f3f3;
border-radius: 33rpx;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0rpx 28rpx;
background-color: #fff;
.search {
gap: 10rpx;
display: flex;
align-items: center;
.text {
margin-left: 10rpx;
font-family:
PingFang SC,
PingFang SC;
font-weight: 500;
font-size: 28rpx;
}
}
}
}
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
padding: 20rpx;
padding: 10rpx 20rpx 20rpx;
gap: 24rpx;
.box {
......@@ -544,7 +693,7 @@ page {
.left {
display: flex;
align-items: center;
gap: 6rpx;
gap: 12rpx;
font-weight: bold;
image {
......@@ -552,6 +701,15 @@ page {
width: 38rpx;
}
.icon {
font-family: PingFang SC;
font-weight: 500;
font-size: 24rpx;
color: #ffffff;
border-radius: 8rpx;
padding: 2rpx 8rpx;
}
.title {
color: #333;
font-size: 32rpx;
......
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