Commit 426291f3 authored by 彭佳妮(贵阳日报)'s avatar 彭佳妮(贵阳日报)
parents e6f57993 d7697f6e
......@@ -8,18 +8,19 @@
:class="{ active: selectedItem === index }"
@tap="selectItem(index, item)"
>
{{ item }}
{{ item.startDate }}
</li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm4">
<li>选择日期</li>
<wd-calendar use-default-slot v-model="value" @confirm="handleConfirm">
<li @tap="selectItem(index, item)">选择日期</li>
</wd-calendar>
</ul>
</view>
</template>
<script setup>
import { defineProps, onMounted } from 'vue';
import { defineProps, onMounted, ref } from 'vue';
import { getStartDate } from '@/api/assistingAgriculture/village';
const selectedItem = ref(null);
const emit = defineEmits(['dataParams']);
const dataList = ref([]);
......@@ -35,29 +36,33 @@ const props = defineProps({
default: '100%',
},
});
onMounted(async () => {
getStartDateList();
});
const selectItem = (index, item) => {
console.log('item', item);
console.log(item, 323);
const datePart = timestampToDateBasic(value.value);
selectedItem.value = index;
emit('dataParams', item);
emit('dataParams', item, datePart);
console.log(datePart, 'datePart');
};
// 查询出发日期
const getStartDateList = () => {
getStartDate(params).then((res) => {
console.log('res.data', res.data);
const transformedData = Object.keys(res.data).reduce((acc, key) => {
acc[key] = { [key]: res.data[key] };
return acc;
}, {});
dataList.value = res.data;
console.log(Object.keys(dataList.value, 232));
});
};
function handleConfirm4({ value }) {
formatValue.value = new Date(value).toString();
function handleConfirm({ value }) {
const datePart = timestampToDateBasic(value);
console.log(datePart, 'datePart---111');
selectItem(undefined, undefined);
}
function timestampToDateBasic(timestamp) {
const date = new Date(timestamp);
const year = date.getFullYear();
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
return `${year}/${month}/${day}`;
}
</script>
......
......@@ -20,7 +20,7 @@ export async function updateAddress(data) {
export async function deleteAddress(addrId) {
return request({
url: `/sgyrdd/useraddr/delete/${addrId}`,
method: 'GET',
method: 'POST',
});
}
// 查询收货地址列表
......
......@@ -64,3 +64,10 @@ export function getItinerary(data) {
data,
});
}
// 店铺信息
export function getStoreInformation(data) {
return request({
url: `/sgyrdd/shop/getById?shopId=${data}`,
method: 'GET',
});
}
......@@ -64,3 +64,11 @@ export function sgyOrderOrderInfo(data) {
data,
});
}
// 筑农首页-3、订单详情
export function quantity(data) {
return request({
url: `/sgyrdd/sgyBasket/quantity`,
method: 'POST',
data,
});
}
import { request } from '../utils/request';
// 查询商家相册列表
export function getPhoto(data) {
return request({
url: `/sgyrdd/photo/getPhoto`,
method: 'GET',
data,
});
}
......@@ -79,9 +79,11 @@ const forMData = ref({
lat: '',
commonAddr: false,
});
const content = ref([]);
onLoad((options) => {
newAddressFlag.value = options.new;
content.value = JSON.parse(options.content);
forMData.value = content.value;
});
function fieldNotEmpty(val) {
......@@ -93,12 +95,22 @@ function fieldNotEmpty(val) {
}
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,
if (!content.value.addrId) {
await addAddress({
...forMData.value,
commonAddr: forMData.value.commonAddr ? 1 : 0,
province: forMData.value.province,
city: forMData.value.city,
area: forMData.value.area,
});
} else {
await updateAddress({
...forMData.value,
commonAddr: forMData.value.commonAddr ? 1 : 0,
});
}
uni.navigateTo({
url: '/pages/address/addressList',
});
};
function handleSubmit() {
......@@ -126,7 +138,6 @@ async function changeLocation() {
forMData.value.addr = res.address;
forMData.value.lng = res.longitude;
forMData.value.lat = res.latitude;
console.log('位置信息:' + JSON.stringify(res));
uni.request({
url: '/ws/geocoder/v1/',
data: {
......
......@@ -9,29 +9,31 @@
</view>
<view class="full_list" v-else>
<view class="additem" v-for="(item, index) in addressList" :key="index">
<view class="additem_l">
<view class="address">{{ item.addr }}</view>
<view class="info">
<view class="name">{{ item.receiver }}</view>
<view class="phone">{{ item.mobile }}</view>
</view>
<view class="address_status">
<view v-if="item.commonAddr === 1" class="box active">
<wd-icon name="check-circle-filled" size="12px"></wd-icon>
<view class="txt">默认</view>
<wd-swipe-action>
<view class="additem" v-for="(item, index) in addressList" :key="index">
<view class="additem_l">
<view class="address">{{ item.addr }}</view>
<view class="info">
<view class="name">{{ item.receiver }}</view>
<view class="phone">{{ item.mobile }}</view>
</view>
<view v-else class="box">
<wd-icon name="circle1" size="12px"></wd-icon>
<view class="txt">默认</view>
<view class="address_status">
<view v-if="item.commonAddr === 1" class="box active">
<wd-icon name="check-circle-filled" size="12px"></wd-icon>
<view class="txt">默认</view>
</view>
<view v-else class="box" @click="deleteAdd(item.addrId)">
<wd-icon name="circle1" size="12px"></wd-icon>
<view class="txt">删除</view>
</view>
</view>
</view>
<view class="additem_r">
<wd-icon name="edit-outline" size="14px" @tap="editAddress(item)"></wd-icon>
</view>
</view>
<view class="additem_r">
<wd-icon name="edit-outline" size="14px" @tap="editAddress"></wd-icon>
</view>
</view>
</wd-swipe-action>
<wd-button type="error" block class="addBtn" @tap="addNewAddress">新增地址</wd-button>
</view>
......@@ -45,7 +47,6 @@ import Header from '@/pages/order/components/Header/index.vue';
import { getAddressList, deleteAddress } from '@/api/address';
const isAdressEmpty = ref(false);
const mainAddFlag = ref(false);
const addressList = ref([]);
const getAddressListData = async () => {
......@@ -56,26 +57,32 @@ const getAddressListData = async () => {
res.length === 0 ? (isAdressEmpty.value = true) : (isAdressEmpty.value = false);
}
};
onLoad(() => {});
getAddressListData();
const addNewAddress = () => {
xma.navigateTo({ url: '/pages/address/addressEdit?new=true' });
};
const editAddress = () => {
xma.navigateTo({ url: '/pages/address/addressEdit' });
const editAddress = (col) => {
xma.navigateTo({
url: `/pages/address/addressEdit?content=${JSON.stringify(col)}`,
});
};
onLoad(() => {
xma.getLocation({
success: (res) => {
console.log(res);
},
fail: (err) => {
console.log(err);
const deleteAdd = async (id) => {
console.log(id);
xma.showModal({
title: '提示',
content: '确定删除该地址吗?',
showCancel: true,
confirmText: '确定',
cancelText: '取消',
success: async (res) => {
if (res.confirm) {
await deleteAddress(id);
getAddressListData();
}
},
});
});
};
</script>
<style lang="scss" scoped>
......@@ -92,6 +99,7 @@ page {
.full_list {
margin-top: 20rpx;
padding-bottom: 180rpx;
.additem {
width: 710rpx;
......@@ -146,6 +154,7 @@ page {
display: flex;
font-size: 18rpx;
align-items: center;
// justify-content: space-between;
.txt {
margin-left: 5rpx;
......
......@@ -20,10 +20,10 @@
<p class="t2">月销{{ prodData.monthSoldNum }}</p>
</div>
<div class="name">{{ prodData.prodName }}</div>
<div class="tags flex-align-center">
<!-- <div class="tags flex-align-center">
<p>无购物</p>
<p>无自费</p>
</div>
</div> -->
</div>
<!-- 保障 -->
<!-- <div class="guarantee">
......@@ -292,9 +292,10 @@
</div>
</scroll-view>
<div class="footer flex-between">
<div class="like">
<wd-icon name="star"></wd-icon>
<p>收藏</p>
<div class="like" @click="getCollectFn">
<wd-icon v-if="shopInfo.isCollect === 0" name="star"></wd-icon>
<wd-icon v-else color="red" name="star-on"></wd-icon>
<p>{{ shopInfo.privateIntFcount || 0 }}</p>
</div>
<button>立即预定</button>
</div>
......@@ -313,7 +314,9 @@ import {
getMealList,
getPriceList,
getItinerary,
getStoreInformation,
} from '@/api/assistingAgriculture/route';
import { getCollect } from '@/api/packageDetail';
const swiperList = ref([
'https://registry.npmmirror.com/wot-design-uni-assets/*/files/redpanda.jpg',
......@@ -338,6 +341,7 @@ const priceList = ref([]);
const viewPriceList = ref([]);
const activePrice = ref({});
const show = ref(false);
const shopIds = ref('');
watch(show, (value) => {
let index = priceList.value.indexOf(activePrice.value);
index = Math.max(1, index);
......@@ -355,9 +359,26 @@ const getPriceListFn = (mealId) => {
viewPriceList.value = res.data.slice(0, 4);
});
};
const shopInfo = ref({});
// 获取店铺信息
const getStoreInformationFn = (id) => {
return new Promise((resolve, reject) => {
getStoreInformation(id).then((res) => {
if (res.code === 0) {
shopInfo.value = res.data.shop;
resolve();
}
});
});
};
// 行程
const itineraryData = ref([]);
/* shopId:1821388624367861761
prodId:43835 */
onLoad(({ shopId, prodId }) => {
shopIds.value = shopId;
// const shopId = 1821388624367861761n;
// const prodId = 43835;
getProd({
prodId,
}).then((res) => {
......@@ -387,7 +408,22 @@ onLoad(({ shopId, prodId }) => {
getItinerary({ prodId }).then((res) => {
itineraryData.value = res.data;
});
// 获取店铺信息
getStoreInformationFn(shopId);
});
function getCollectFn() {
getCollect(shopIds.value).then((res) => {
if (res.code === 0) {
if (shopInfo.value.isCollect === 0) {
shopInfo.value.privateIntFcount++;
shopInfo.value.isCollect = 1;
} else {
shopInfo.value.privateIntFcount--;
shopInfo.value.isCollect = 0;
}
}
});
}
// 返回上一级
function back() {
xma.navigateBack({
......@@ -605,16 +641,17 @@ uni-page-body {
margin-top: 20rpx;
display: grid;
gap: 40rpx;
grid-template-columns: 1fr 1fr;
grid-template-columns: 1fr 1fr 1fr 1fr;
overflow-x: scroll;
.package-item {
border-radius: 16rpx;
width: 280rpx;
opacity: 1;
padding: 20rpx;
background: linear-gradient(180deg, #feeeee 0%, #ffffff 100%);
box-shadow: 0rpx 4rpx 8rpx 0rpx rgba(0, 0, 0, 0.08);
&.active {
border: 1px solid #fa5151;
box-sizing: border-box;
}
.price {
font-size: 24rpx;
......
......@@ -180,6 +180,7 @@ const sortType = ref(null);
const attractionId = ref(null);
const startCity = ref(null);
const dateType = ref(null);
const allocateDate = ref(null);
const serviceCommitment = ref(null);
const labelId = ref(null);
const locationFiltering = (index) => {
......@@ -213,6 +214,9 @@ const locationFiltering = (index) => {
sortType.value = null;
attractionId.value = null;
dateType.value = null;
startCity.value = null;
serviceCommitment.value = null;
labelId.value = null;
}
};
// 查询热门路线
......@@ -230,9 +234,16 @@ const sortParams = (sortMode) => {
getProd();
};
// 出发日期
const dataParams = (item) => {
dateType.value = item;
getProd();
const dataParams = (item, datePart) => {
if (item !== undefined) {
dateType.value = item.key;
getProd();
} else if (item === undefined) {
console.log(item, 3333333);
dateType.value = 8;
allocateDate.value = datePart;
getProd();
}
};
// 景点
const placeParams = (id) => {
......@@ -262,6 +273,7 @@ const getProd = () => {
...(startCity.value !== null && { startCity: startCity.value }),
...(serviceCommitment.value !== null && { serviceCommitment: serviceCommitment.value }),
...(labelId.value !== null && { labelId: labelId.value }),
...(dateType.value === 8 && { allocateDate: allocateDate.value }),
};
getProdList(params).then((res) => {
res.data.records.forEach((item) => {
......@@ -270,11 +282,12 @@ const getProd = () => {
cardList.value = res.data.records;
});
};
function toRouteDetails(item) {
console.log(item, 22222);
// TODO: 跳转到线路详情
xma.navigateTo({
url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?prodId=${item.prodId}`,
url: `/pages/assistingAgriculture/RouteDetails/RouteDetails?shopId=${item.shopId}&prodId=${item.prodId}`,
});
}
function toSpecialOfferZoneList() {
......
<template>
<div class="card">
<div class="card" v-for="(item, index) in photoData" :key="index">
<div class="img-wrap">
<wd-img
v-for="v in 3"
:key="v"
:src="`/src/static/assistingAgriculture/comment/${v}.png`"
enable-preview
/>
<wd-img v-for="(item, index) in item.images" :key="index" :src="item" enable-preview />
</div>
<div class="text">
跟团游行程紧凑有序,充分利用了时间,让游客...跟团游行程紧凑有序,充分利用了时间,让游客...跟团游行程紧凑有序,充分利用了时间,让游客...跟团游行程紧凑有序,充分利用了时间,让游客...跟团游行程紧凑有序,充分利用了时间,让游客...跟团游行程紧凑有序,充分利用了时间,让游客...跟团游行程紧凑有序,充分利用了时间,让游客...跟团游行程紧凑有序,充分利用了时间,让游客...
{{ item.evaluation }}
</div>
<div class="user-info flex-between">
<div class="info flex-align-center">
......@@ -24,7 +19,15 @@
</div>
</template>
<script setup></script>
<script setup>
const showMore = ref(false);
const props = defineProps({
photoData: {
type: Array,
default: () => [],
},
});
</script>
<style lang="scss" scoped>
.card {
......
<template>
<div class="album">
<scroll-view class="content" scroll-y>
<div class="filter-box">
<scroll-view class="content" @scrolltolower="scrolltolower" scroll-y>
<!-- <div class="filter-box">
<div class="active">全部</div>
<div v-for="(v, i) in filterList" :key="i">{{ v.text }}({{ v.value }})</div>
</div>
</div> -->
<div class="card-wrap">
<card v-for="v in 13" :key="v" />
<card :photoData="photoData" />
</div>
</scroll-view>
<div class="back">
......@@ -17,6 +17,9 @@
<script setup>
import card from './card.vue';
import { getPhoto } from '../../../api/photo';
const imgUrl = import.meta.env.VITE_APP_IMG_URL;
// let total
const filterList = [
{
text: '家人',
......@@ -59,6 +62,36 @@ const filterList = [
value: 514,
},
];
const photoData = ref([]);
const params = {
prodId: '43828',
shopId: '1818876196597334017',
};
onLoad(() => {
getPhotoFn();
});
// const scrolltolower = () => {
// console.log('触底加载触底加载触底加载');
// if (commentData.value.length < total) {
// commentParameters.current++;
// getCommentListFn();
// return;
// }
// show.value = true;
// };
const getPhotoFn = () => {
getPhoto(params).then((res) => {
res.data.forEach((v) => {
if (v.images) {
v.images = v.images.split(',').map((item) => {
item = imgUrl + item;
return item;
});
}
});
photoData.value = [...photoData.value, ...res.data];
});
};
</script>
<style lang="scss" scoped>
......@@ -94,7 +127,7 @@ uni-page-body {
}
}
.card-wrap {
margin-top: 5px;
// margin-top: 5px;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 5px;
......
......@@ -31,7 +31,7 @@
<span></span>
{{ item.skuPrice }}
</div>
<wd-input-number v-model="item.count" />
<wd-input-number v-model="item.count" @change="changeQuantity(item)" />
</div>
</div>
</div>
......@@ -60,6 +60,7 @@
import { ref, computed, onMounted } from 'vue';
import { getshoppingCartList } from '../../../api/packageDetail';
import { categoryPresaleList } from '../../../api/assistingAgriculture/building';
import { quantity } from '../../../api/assistingAgriculture/shop';
// 计算是否全选
const checkedAll = computed(() => {
return cartList.value.every((item) => item.isChecked);
......@@ -114,6 +115,13 @@ const presaleSortList = (index) => {
});
});
};
// 购物车数量修改
const changeQuantity = async (item) => {
const res = await quantity({
basketId: item.basket.basketId,
basketCount: item.count,
});
};
const selectedItems = computed(() => {
return cartList.value.reduce((acc, shop) => {
const selectedProducts = shop.prodInfos.filter((item) => item.isChecked);
......
<template>
<div class="card">
<div class="card" v-for="(item, index) in commentData" :key="index">
<div class="card-top">
<div class="avatar flex-align-center">
<img src="/static/assistingAgriculture/comment/1.png" alt="" />
<img :src="item.avatar" alt="" />
<div class="name">
<p>不爱吃鱼的小猫咪</p>
<div class="flex-align-center">
<img src="/src/static/assistingAgriculture/comment/emoji.png" alt="" />
5.0分 好评
</div>
<p>{{ item.nickName }}</p>
<text class="grade flex-align-center">5.0分</text>
</div>
</div>
<div class="info">2024-08-03发表于贵州 | 朋友出游 | 2024-07-22出发</div>
<div class="info">{{ item.createTime[0] }}发表</div>
</div>
<div class="card-content">
<div class="text-wrap" :style="showMore ? 'max-height:none;' : ''">
跟团游行程紧凑有序,充分利用了时间,让游客能够在有限的时间内充分游览黄果树的主要景点,如黄果树大瀑布、陡坡塘瀑布、天星桥景区等,不留遗憾。导游专业且热情,对景区有深入的了解,能够生动有趣地讲解景点的历史、文化和特色,同时耐心解答游跟团游行程紧凑有序,充分利用了时间,让游客能够在有限的时间内充分游览黄果树的主要景点,如黄果树大瀑布、陡坡塘瀑布、天星桥景区等,不留遗憾。导游专业且热情,对景区有深入的了解,能够生动有趣地讲解景点的历史、文化和特色,同时耐心解答游跟团游行程紧凑有序,充分利用了时间,让游客能够在有限的时间内充分游览黄果树的主要景点,如黄果树大瀑布、陡坡塘瀑布、天星桥景区等,不留遗憾。导游专业且热情,对景区有深入的了解,能够生动有趣地讲解景点的历史、文化和特色,同时耐心解答游
<div class="more" v-if="!showMore" @click="showMore = true">全文</div>
<div class="text-wrap">
{{ item.evaluation }}
</div>
<div class="img-wrap">
<wd-img
v-for="v in Math.floor(Math.random() * 6 + 1)"
:key="v"
:src="`/src/static/assistingAgriculture/comment/${v}.png`"
enable-preview
/>
<wd-img v-for="(item, index) in item.images" :key="index" :src="item" enable-preview />
</div>
</div>
</div>
......@@ -33,6 +24,12 @@
<script setup>
import { ref } from 'vue';
const showMore = ref(false);
const props = defineProps({
commentData: {
type: Array,
default: () => [],
},
});
</script>
<style lang="scss" scoped>
......@@ -40,6 +37,7 @@ const showMore = ref(false);
background-color: #fff;
border-radius: 16rpx;
padding: 20rpx;
margin-bottom: 10rpx;
.card-top {
padding-bottom: 20rpx;
border-bottom: 2rpx solid #f3f3f3;
......@@ -55,23 +53,23 @@ const showMore = ref(false);
font-size: 28rpx;
color: #3d3d3d;
}
div {
.grade {
margin-top: 18rpx;
display: inline-block;
font-size: 16rpx;
background: rgba(253, 223, 109, 0.1686);
line-height: 24rpx;
color: #e1961d;
width: 116rpx;
border-radius: 200rpx;
padding-left: 32rpx;
box-sizing: border-box;
position: relative;
img {
height: 24rpx;
position: absolute;
left: 0;
width: 24rpx;
}
padding: 2rpx 10rpx;
border-radius: 16rpx;
// // padding-left: 32rpx;
// box-sizing: border-box;
// position: relative;
// img {
// height: 24rpx;
// position: absolute;
// left: 0;
// width: 24rpx;
// }
}
}
}
......@@ -88,7 +86,7 @@ const showMore = ref(false);
line-height: normal;
color: #3d3d3d;
overflow: hidden;
max-height: 150rpx;
// max-height: 150rpx;
position: relative;
.more {
position: absolute;
......
......@@ -2,37 +2,52 @@
<div class="comment-list">
<div class="top-bar flex-align-center">
<wd-icon name="thin-arrow-left"></wd-icon>
<wd-search hide-cancel placeholder="点评关键词/特色" placeholder-left />
<wd-search @search="search" hide-cancel placeholder="点评关键词/特色" placeholder-left />
</div>
<scroll-view class="content" :scroll-y="true">
<scroll-view @scrolltolower="scrolltolower" class="content" :scroll-y="true">
<div class="filter-box">
<div class="score-sort flex-between">
<div class="score">
<span class="num">6.9</span>
<span class="t1">超棒</span>
<span class="t2">527</span>
<wd-icon name="check-outline" class="t1"></wd-icon>
<span class="num">{{ topData.score }}</span>
<!-- <span class="t1">超棒</span> -->
<span class="t2">{{ topData.count }}</span>
<!-- <wd-icon name="check-outline" class="t1"></wd-icon> -->
</div>
<div class="sort">
<!-- <div class="sort">
<span class="active">推荐排序</span>
<span>重新点评</span>
</div>
</div> -->
</div>
<div class="type flex-between">
<p class="active">全部</p>
<p v-for="(v, i) in commentTypeList" :key="i">{{ v.text }}({{ v.value }})</p>
<p @tap="choice(-1)" :class="{ active: select === -1 }">全部</p>
<p
@tap="choice(i, v.type)"
:class="{ active: select === i }"
v-for="(v, i) in commentTypeList"
:key="i"
>
{{ v.text }}({{ v.value }})
</p>
</div>
<div class="tags" :style="{ 'max-height': showMoreTag ? '600px' : '90rpx' }">
<div class="item" v-for="(v, i) in tagList" :key="i">{{ v.text }}({{ v.value }})</div>
<div class="more" @click="showMoreTag = !showMoreTag">
<div class="tags">
<div class="item" v-for="(v, i) in tagList" :key="i">
{{ v.evaluation }}({{ v.count }})
</div>
<!-- <div class="more" @click="showMoreTag = !showMoreTag">
更多
<wd-icon name="arrow-down" :class="{ rotate: showMoreTag }"></wd-icon>
</div>
</div> -->
</div>
</div>
<div class="card-list">
<card v-for="v in 10" :key="v" />
<card :commentData="commentData" />
<view
style="width: 100%; text-align: center; font-size: 24rpx; margin: 10rpx 0; color: #888989"
v-if="show"
>
没有更多啦~
</view>
</div>
</scroll-view>
<div class="back">
......@@ -44,91 +59,120 @@
<script setup>
import { ref } from 'vue';
import card from './card.vue';
import { getCommentList } from '../../../api/packageDetail';
const commentTypeList = [
import { getCommentList, getEvalStatis } from '../../../api/packageDetail';
const commentTypeList = reactive([
{
text: '图/视频',
value: 183,
value: 0,
type: 'img',
},
{
text: '追评',
value: 5,
value: 0,
type: 'append',
},
{
text: '中差评',
value: 5,
value: 0,
type: 'diff',
},
{
text: '好评',
value: 514,
},
];
const tagList = [
{
text: '餐食棒',
value: 44,
},
{
text: '导游负责耐心',
value: 44,
},
{
text: '车辆条件好',
value: 514,
},
{
text: '餐食棒',
value: 44,
},
{
text: '餐食棒',
value: 44,
},
{
text: '导游负责耐心',
value: 44,
},
{
text: '行程安排合理',
value: 5,
},
{
text: '车辆条件好',
value: 514,
},
{
text: '行程安排合理',
value: 5,
value: 0,
type: 'good',
},
{
text: '导游负责耐心',
value: 44,
},
{
text: '行程安排合理',
value: 5,
},
{
text: '车辆条件好',
value: 514,
},
];
]);
const imgUrl = import.meta.env.VITE_APP_IMG_URL;
const tagList = ref([]);
const commentData = ref([]);
const commentParameters = {
shopId: '1818876196597334017',
prodId: '43828',
current: 1,
size: 10,
};
const show = ref(false);
let total;
const select = ref(-1);
const topData = ref({});
onLoad((options) => {
getEvalStatisFn();
getCommentListFn();
});
const search = (e) => {
reset();
commentParameters.evaluation = e.value;
getCommentListFn();
};
// 数据重置
const reset = () => {
commentParameters.current = 1;
commentData.value = [];
show.value = false;
};
const scrolltolower = () => {
console.log('触底加载触底加载触底加载');
if (commentData.value.length < total) {
commentParameters.current++;
getCommentListFn();
return;
}
show.value = true;
};
// 触底加载
onReachBottom(() => {
if (cardData2.value.length + 5 < total) {
listParams.current++;
getMerchantListPaging();
}
});
const showMoreTag = ref(false);
// 评论列表数量统计和相同好评最多的评语
const getEvalStatisFn = () => {
getEvalStatis({ prodId: commentParameters.prodId }).then((res) => {
console.log('评论数量统计和相同好评最多的评语', res);
res.data.score = res.data.score.toFixed(1);
topData.value = res.data;
tagList.value = res.data.evals;
commentTypeList[0].value = res.data.imgCount;
commentTypeList[1].value = res.data.append;
commentTypeList[2].value = res.data.diffCount;
commentTypeList[3].value = res.data.goodCount;
});
};
// 评论列表
const getCommentListFn = () => {
xma.showLoading({
title: '加载中...',
mask: true,
});
getCommentList(commentParameters).then((res) => {
console.log('打印评论', res);
xma.hideLoading();
total = res.data.total;
res.data.records.forEach((v) => {
v.avatar = imgUrl + v.avatar;
v.prodPic = imgUrl + v.prodPic;
v.createTime = v.createTime.split(' ');
if (v.images) {
v.images = v.images.split(',').map((item) => {
item = imgUrl + item;
return item;
});
}
// console.log('v.images', v.images);
});
console.log('res.data.records', res.data.records);
commentData.value = [...commentData.value, ...res.data.records];
});
};
// tabs选择
const choice = (i, type) => {
select.value = i;
reset();
commentParameters.type = type;
getCommentListFn();
};
</script>
<style lang="scss" scoped>
......@@ -188,6 +232,7 @@ uni-page-body {
.type {
font-size: 22rpx;
color: #767676;
box-sizing: border-box;
.active {
color: #3d3d3d;
font-size: 24rpx;
......@@ -212,7 +257,7 @@ uni-page-body {
flex-wrap: wrap;
gap: 10rpx;
position: relative;
max-height: 80rpx;
// max-height: 80rpx;
overflow: hidden;
transition: all 0.3s;
.item {
......
......@@ -14,7 +14,7 @@
v-for="(item, index) in classificationT"
:key="index"
>
<image class="imgs" :src="item.icon" mode="widthFix" />
<image class="imgs" :src="item.icon" />
<text class="introduce">{{ item.categoryName }}</text>
</view>
</view>
......@@ -25,7 +25,7 @@
v-for="(item, index) in classificationB"
:key="index"
>
<image class="imgs" :src="item.icon" mode="widthFix" />
<image class="imgs" :src="item.icon" />
<text class="introduce">{{ item.categoryName }}</text>
</view>
</view>
......@@ -541,7 +541,7 @@ page {
display: flex;
justify-content: space-evenly;
margin-top: 32rpx;
align-items: center;
align-items: flex-end;
.choice {
display: flex;
flex-direction: column;
......@@ -554,6 +554,7 @@ page {
Source Han Sans;
.imgs {
width: 88rpx;
height: 88rpx;
}
}
}
......@@ -561,7 +562,7 @@ page {
display: flex;
justify-content: space-evenly;
margin-top: 34rpx;
align-items: center;
align-items: flex-end;
.choice {
display: flex;
flex-direction: column;
......@@ -574,6 +575,7 @@ page {
Source Han Sans;
.imgs {
width: 68rpx;
height: 68rpx;
margin-bottom: 8rpx;
}
}
......
......@@ -35,7 +35,7 @@ export default defineConfig({
alias: {
'@': path.resolve(__dirname, './src'),
},
},
},
server: {
open: true,
// 代理配置
......
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