Commit 24bf7b0b authored by 石建新(贵阳日报)'s avatar 石建新(贵阳日报)
parents 7574fe96 9d36cb55
......@@ -11,10 +11,13 @@
/>
<input
type="text"
:value="test"
class="text"
:placeholder="placeholderText"
placeholder-style="font-size:16rpx;"
:value="modelValue"
@input="updateModelValue"
@keyup.enter="toSearch"
@focus="toSearch"
/>
</view>
</view>
......@@ -22,6 +25,7 @@
<script setup>
import { defineProps } from 'vue';
const emit = defineEmits(['search']);
const props = defineProps({
iconSrc: {
type: String,
......@@ -31,7 +35,14 @@ const props = defineProps({
type: String,
default: '',
},
modelValue: String,
});
const updateModelValue = (event) => {
emit('update:modelValue', event.target.value);
};
const toSearch = (test) => {
emit('search', test);
};
// 返回上一级
function back() {
xma.navigateBack({
......
......@@ -56,7 +56,7 @@ export function sgyrddShopPage(data) {
});
}
// 获取店铺入驻类型
// 获取店铺入驻分类(弹窗)
export function sgyrShopCategory() {
return request({
url: `/sgyrdd/category/tree`,
......@@ -73,7 +73,7 @@ export function applyShop(data) {
});
}
// 申请成为商家
// 更改申请信息
export function editShop(data) {
return request({
url: `/sgyrdd/shop/update`,
......@@ -81,3 +81,11 @@ export function editShop(data) {
data,
});
}
export function getShopInfoById(data) {
return request({
url: `/sgyrdd/shop/getShopById`,
method: 'GET',
data,
});
}
......@@ -210,7 +210,8 @@
{
"path": "pages/assistingAgriculture/RuralTravel/RuralTravel",
"style": {
"navigationBarTitleText": "乡村旅居"
"navigationBarTitleText": "乡村旅居",
"enablePullDownRefresh": true,
}
},
......
......@@ -7,6 +7,8 @@
backIcon="black"
iconSrc="/static/assistingAgriculture/assets/left.png"
placeholderText="请输入要搜索的关键词"
@search="toSearch"
v-model="keyword"
></Search>
</view>
<view class="bac-img">
......@@ -137,23 +139,23 @@
<img class="card-img" :src="item.img" style="width: 248rpx; height: 240rpx" />
<view class="detail-text">
<text class="detail-title">{{ item.prodName }}</text>
<text class="give">{{ item.prodName }}</text>
<text class="give">{{ item.brief }}</text>
<view class="tag">
<wd-tag
bg-color="#EEEEEE"
round
v-for="(tag, tagIndex) in item.tag"
v-for="(tag, tagIndex) in item.serveList"
:key="tagIndex"
>
{{ tag }}
{{ tag.labelName }}
</wd-tag>
</view>
<view class="detail-score">
<text class="score">{{ item.deliveryAmount }}</text>
<text class="num">月销{{ item.deliveryAmount }}</text>
<text class="score">{{ item.score }}</text>
<text class="num">月销{{ item.monthSoldNum }}</text>
</view>
<view class="venue">
<text class="place">{{ item.prodName }}</text>
<text class="place">{{ item.tripArea }}出发</text>
<text class="price">{{ item.price }}</text>
</view>
</view>
......@@ -189,6 +191,7 @@ const startCity = ref(null);
const dateType = ref(null);
const allocateDate = ref(null);
const serviceCommitment = ref(null);
const keyword = ref('');
const labelId = ref(null);
const locationFiltering = (index) => {
switch (index) {
......@@ -226,6 +229,13 @@ const locationFiltering = (index) => {
labelId.value = null;
}
};
onPullDownRefresh(() => {
keyword.value = '';
getProd();
setTimeout(() => {
uni.stopPullDownRefresh();
}, 1000);
});
// 查询热门路线
const getPopular = () => {
getPopularList({ current: 1, size: 10 }).then((res) => {
......@@ -271,8 +281,14 @@ const screenParams = (item, type) => {
getProd();
}
};
// 搜索
const toSearch = (data) => {
keyword.value = data.detail.value;
getProd(keyword.value);
};
// 查询列表
const getProd = () => {
const getProd = (searchKeyword = '') => {
const params = {
current: 1,
size: 10,
......@@ -283,14 +299,17 @@ const getProd = () => {
...(serviceCommitment.value !== null && { serviceCommitment: serviceCommitment.value }),
...(labelId.value !== null && { labelId: labelId.value }),
...(dateType.value === 8 && { allocateDate: allocateDate.value }),
...(searchKeyword && { keyword: searchKeyword }),
};
getProdList(params).then((res) => {
res.data.records.forEach((item) => {
item.img = import.meta.env.VITE_APP_IMG_URL + item.pic;
item.serveList = item.serviceList.slice(0, 3);
});
cardList.value = res.data.records;
});
};
const resetParams = () => {
sortType.value = null;
attractionId.value = null;
......@@ -549,6 +568,6 @@ page {
height: 56rpx;
}
.detail-score {
margin-top: 90rpx;
margin-top: 30rpx;
}
</style>
......@@ -3,7 +3,7 @@
<div class="img-wrap">
<wd-img v-for="(item, index) in item.images" :key="index" :src="item" enable-preview />
</div>
<div class="text">
<div class="text" @click="toReviewDetails(item.evaluationId)">
{{ item.evaluation }}
</div>
<div class="user-info flex-between">
......@@ -27,6 +27,12 @@ const props = defineProps({
default: () => [],
},
});
// 查看评论详情
const toReviewDetails = (id) => {
xma.navigateTo({
url: `/pages/assistingAgriculture/reviewDetails/reviewDetails?evaluationId=${id}`,
});
};
</script>
<style lang="scss" scoped>
......
......@@ -7,6 +7,7 @@
backIcon="black"
iconSrc="/static/assistingAgriculture/assets/blackLeft.png"
placeholderText="请输入要搜索的内容"
@search="toSearch"
></Search>
</view>
<!-- 轮播图-->
......@@ -173,6 +174,11 @@ onMounted(async () => {
platformProdList();
getshoppingCartListFn();
});
// 搜索
const toSearch = () => {
xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage' });
};
// 获取购物车列表
const getshoppingCartListFn = () => {
getshoppingCartList({}).then((res) => {
......
......@@ -6,6 +6,7 @@
backIcon="black"
iconSrc="/static/assistingAgriculture/assets/left.png"
placeholderText="输入商品名称"
@search="toSearch"
></Search>
</view>
<view class="nav">
......@@ -158,6 +159,10 @@ onMounted(async () => {
presaleSortList();
getshoppingCartListFn();
});
// 搜索
const toSearch = () => {
xma.navigateTo({ url: '/pages/assistingAgriculture/searchPage/searchPage' });
};
// 获取购物车列表
const getshoppingCartListFn = () => {
getshoppingCartList({}).then((res) => {
......
......@@ -71,6 +71,11 @@ const baseImgurl = import.meta.env.VITE_APP_IMG_URL;
function changeValue({ value }) {
console.log(value);
}
const back = () => {
uni.navigateBack({
delta: 1,
});
};
// 搜索
const toSearch = (data) => {
const keyword = data.detail.value;
......
......@@ -555,6 +555,7 @@ page {
.imgs {
width: 88rpx;
height: 88rpx;
margin-bottom: 5rpx;
}
}
}
......
......@@ -33,11 +33,11 @@
<wd-input
label="所在地区"
label-width="100px"
v-model="formData.area"
v-model="ssq"
prop="area"
readonly
placeholder="请选择所在地区"
@click="chooseShopPosition"
@click="changeLocation"
/>
<wd-input
label="详细地址"
......@@ -116,10 +116,10 @@
</view>
</view>
<view class="flex flexcenter">
<view class="logo">店铺分类{{ chooseCategory.categoryId }}</view>
<view class="logo">店铺分类</view>
<view class="shopcatebox">
<view class="text shopcateboxtxt" @click="showclass">
<template v-if="choosedShopInfo.length != 0">
<template v-if="choosedShopInfo?.length !== 0">
<wd-tag
v-for="(item, index) in choosedShopInfo"
:key="index"
......@@ -138,7 +138,7 @@
:file-list="testFileList[item.areaId]"
image-mode="aspectFill"
:action="action"
@change="handleCategoyChange($event, item.areaId)"
@change="handleCategoyChange($event, item.areaId, item.areaName)"
:limit="1"
class="img1"
:header="headers"
......@@ -146,7 +146,9 @@
></wd-upload>
</view>
</view>
<text class="text errormsg" v-if="isCategoryNull">店铺分类未选择</text>
<text class="text errormsg" v-if="isCategoryNull">
店铺分类未选择{{ choosedShopInfo }}
</text>
</view>
</view>
<wd-textarea
......@@ -227,9 +229,32 @@
import Header from '@/pages/order/components/Header/index.vue';
import { getToken } from '@/utils/auth';
import { ref, reactive } from 'vue';
import { sgyrShopCategory, applyShop, editShop } from '@/api/shop';
import { sgyrShopCategory, applyShop, editShop, getShopInfoById } from '@/api/shop';
const token = getToken();
const action = ref(import.meta.env.VITE_APP_BASE_URL + '/sgyrdd/file/update');
const headers = ref('');
const fileDomain = import.meta.env.VITE_APP_IMG_URL;
// 店铺logo图片组
const fileListShopLogo = ref([]);
// 身份证正面图片组
const fileListCardForward = ref([]);
// 身份证反面图片组
const fileListCardBackward = ref([]);
// 店铺营业执照图片组
const fileListQualifications = ref([]);
// 门头图片上传是否为空
const shopLogoNull = ref(false);
// 身份证正面上传是否为空
const cardForwardNull = ref(false);
// 身份证反面上传是否为空
const cardBackwardNull = ref(false);
// 营业执照上传是否为空
const qualificationsNull = ref(false);
// 用户选择的分类
const choosedShopInfo = ref([]);
// 临时创建的用户选择分类
const tempChoosedData = ref([]);
// 确保choosedShopInfo内是用户最新选择的分类
const chooseShopType = (id, name) => {
let hasSameData = false;
......@@ -239,13 +264,16 @@ const chooseShopType = (id, name) => {
}
});
if (!hasSameData) {
choosedShopInfo.value.push({ areaId: id, areaName: name });
choosedShopInfo.value.push({ areaId: id, areaName: name, qualifications: '' });
tempChoosedData.value.push(id);
} else {
choosedShopInfo.value = choosedShopInfo.value.filter((item) => {
return item.areaId !== id;
});
}
};
// 删除图片之前的提示
const beforeRemove = ({ file, fileList, resolve }) => {
xma.showModal({
title: '提示',
......@@ -253,7 +281,6 @@ const beforeRemove = ({ file, fileList, resolve }) => {
success: function (res) {
if (res.confirm) {
xma.showToast({ title: '删除成功', duration: 2000 });
console.log(fileList);
resolve(true);
} else if (res.cancel) {
xma.showToast({ title: '取消删除操作', duration: 2000 });
......@@ -261,50 +288,49 @@ const beforeRemove = ({ file, fileList, resolve }) => {
},
});
};
const token = getToken();
// 上传图片地址
const action = ref(import.meta.env.VITE_APP_BASE_URL + '/sgyrdd/file/update');
const headers = ref('');
// const fileDomain = import.meta.env.VITE_APP_IMG_URL;
// 店铺logo图片组
const fileListShopLogo = ref([]);
// 身份证正面图片组
const fileListCardForward = ref([]);
// 身份证反面图片组
const fileListCardBackward = ref([]);
// 店铺资质图片组
const fileListQualifications = ref([]);
// 门头图片上传是否为空
const shopLogoNull = ref(false);
// 身份证正面上传是否为空
const cardForwardNull = ref(false);
// 身份证反面上传是否为空
const cardBackwardNull = ref(false);
// 资质图片上传是否为空
const qualificationsNull = ref(false);
/**
* 图片地址处理
* 图片地址处理,以逗号拼接
*/
const processingImageAddresses = (fileList) => {
const data = fileList.value.map((item) => {
console.log(JSON.parse(item.response));
return JSON.parse(item.response).data.url;
});
return data.join(',');
};
const processingImageAddresses1 = (fileList) => {
const data = fileList.map((item) => {
return JSON.parse(item.response).data.url;
});
return data.join(',');
};
const categoryShopsList = ref({});
// 新增经营资质上传
const testFileList = ref([]);
const handleCategoyChange = ({ fileList: files }, val) => {
testFileList.value[val] = files;
const handleCategoyChange = ({ fileList: files }, valId, valName) => {
testFileList.value[valId] = files;
// 资质上传图片
// 资质清空图片
choosedShopInfo.value.forEach((item) => {
if (item.areaId === valId) {
choosedShopInfo.value.forEach((item) => {
if (item.areaId === valId) {
item.qualifications =
files.length === 0 ? '' : processingImageAddresses1(testFileList.value[valId]);
}
});
}
});
categoryShopsList.value[val] = processingImageAddresses1(testFileList.value[val]);
console.log('在删除或上传资质图片时');
console.log(choosedShopInfo.value);
};
// 店铺logo门头上传
const handleLogoFileChange = ({ fileList: files }) => {
if (files.length > 0) {
shopLogoNull.value = false;
......@@ -315,6 +341,7 @@ const handleLogoFileChange = ({ fileList: files }) => {
fileListShopLogo.value = [];
}
};
// 身份证正面上传
const handleIndentityForwardChange = ({ fileList: files }) => {
if (files.length > 0) {
cardForwardNull.value = false;
......@@ -325,7 +352,7 @@ const handleIndentityForwardChange = ({ fileList: files }) => {
fileListCardForward.value = [];
}
};
// 身份证反面上传
const handleIndentityBackwardChange = ({ fileList: files }) => {
if (files.length > 0) {
cardBackwardNull.value = false;
......@@ -336,12 +363,12 @@ const handleIndentityBackwardChange = ({ fileList: files }) => {
fileListCardBackward.value = [];
}
};
// 营业执照上传
const handleQualificationsChange = ({ fileList: files }) => {
if (files.length > 0) {
qualificationsNull.value = false;
fileListQualifications.value = files;
categoryShops.qualifications = processingImageAddresses(fileListQualifications);
formData.license = processingImageAddresses(fileListQualifications);
} else {
qualificationsNull.value = true;
fileListQualifications.value = [];
......@@ -352,138 +379,171 @@ const shopCategoryTree = ref([]);
const categoryActiveIndex = ref(0);
const isNewFlag = ref(true);
const exsitedData = ref();
const dealCategoryData = ref([]);
onLoad((options) => {
console.log(options.content);
headers.value = { Authorization: 'Bearer ' + token };
getShopCategoryFun();
if (options.content === 0) {
if (options.content != null) {
isNewFlag.value = false;
console.log(options.content);
getShopInfoByIdFun({ shopId: options.content });
}
getShopCategoryFun();
});
// 获取店铺入驻分类(弹窗tree)
const getShopCategoryFun = async () => {
const res = await sgyrShopCategory();
shopCategoryTree.value = res.data;
// console.log(shopCategoryTree.value);
};
// 新增店铺数据
const applyShopFun = async (data) => {
const res = await applyShop(data);
console.log(res);
};
// 编辑店铺数据
const editShopFun = async (data) => {
const res = await editShop(data);
console.log(res);
};
// 根据shopId获取店铺数据
const getShopInfoByIdFun = async (data) => {
console.log(data);
const res = await getShopInfoById(data);
exsitedData.value = res.data;
console.log(exsitedData.value);
// 店铺信息
const shopDetail = reactive(exsitedData.value.shopDetail);
const categoryShopsChoosed = reactive(exsitedData.value.categoryShops);
console.log('~~~~');
console.log(categoryShopsChoosed.length);
const information = reactive(exsitedData.value.information);
// information.value = exsitedData.value.information;
// 店铺名称
formData.shopId = data.shopId;
formData.shopName = shopDetail.shopName;
// 店铺简介
formData.intro = shopDetail.intro;
// 联系电话
formData.tel = shopDetail.tel;
// 店铺所在纬度
formData.shopLat = shopDetail.shopLat;
// 店铺所在经度
formData.shopLng = shopDetail.shopLng;
// 店铺详细地址
formData.shopAddress = shopDetail.shopAddress;
// 省份
formData.province = shopDetail.province;
// 城市
formData.city = shopDetail.city;
// 区县
formData.area = shopDetail.area;
ssq.value = shopDetail.province + shopDetail.city + shopDetail.area;
console.log(fileDomain + shopDetail.shopLogo);
// 店铺LOGO
// fileListShopLogo.value = fileDomain + shopDetail.value.shopLogo;
// 店铺logo图片组
fileListShopLogo.value[0] = { url: fileDomain + shopDetail.shopLogo };
formData.shopLogo = shopDetail.shopLogo;
// 店铺营业执照图片组
fileListQualifications.value[0] = { url: fileDomain + shopDetail.license };
formData.license = shopDetail.license;
// 身份证正面图片组
fileListCardForward.value[0] = { url: fileDomain + information.identityCardFront };
shopPersonalInformation.identityCardFront = information.identityCardFront;
// 身份证反面图片组
fileListCardBackward.value[0] = { url: fileDomain + information.identityCardReverse };
shopPersonalInformation.identityCardReverse = information.identityCardReverse;
categoryShopsChoosed.forEach((item) => {
choosedShopInfo.value.push({
areaId: item.categoryId,
areaName: item.categoryName,
qualifications: item.qualifications,
});
});
testFileList.value = choosedShopInfo.value.reduce((obj, item) => {
if (item.qualifications === '') {
obj[item.areaId] = [];
} else {
obj[item.areaId] = [{ url: fileDomain + item.qualifications }];
}
return obj;
}, {});
};
// 店铺分类:点击左侧团购、助农tab,添加active样式,清空选择的店铺类型数组
const setActiveCategory = (index) => {
console.log(index);
categoryActiveIndex.value = index;
choosedShopArr.value = [];
};
/* const promotionlist = ref([
{
value: '1',
label: '连锁直营',
},
{
value: '2',
label: '连锁加盟',
},
]); */
// 店铺分类是否显示
const show = ref(false);
// 关闭店铺分类弹出层
const handleClose = () => {
show.value = false;
// choosedShopInfo.value = [];
// categoryShopsList.value = {};
// testFileList.value = [];
// choosedShopArr.value = [];
};
let originChooseCategoryLength = 0;
// 原添加的店铺分类个数
const originChooseCategoryLength = 0;
// 店铺分类弹窗点击“确定”按钮
// 新增资质,添加动态变量绑定
// 根据choosedShopInfo,更新categoryShopsList的值
const chooseCategory = () => {
show.value = false;
// 对新增资质上传,添加动态变量绑定
if (choosedShopInfo.value.length > originChooseCategoryLength) {
for (let i = originChooseCategoryLength; i < choosedShopInfo.value.length; i++) {
testFileList.value[choosedShopInfo.value[i].areaId] = [];
// testFileList.value.push({ areaId: choosedShopInfo.value[i].areaId, arr: [] });
testFileList.value = choosedShopInfo.value.reduce((obj, item) => {
if (item.qualifications === '') {
obj[item.areaId] = [];
} else {
obj[item.areaId] = [{ url: fileDomain + item.qualifications }];
}
originChooseCategoryLength = choosedShopInfo.value.length;
}
// 对于移除资质上传,重新匹配choosedShopInfo和categoryShopsList的值
// choosedShopInfo [{ areaId: id, areaName: name },{ areaId: id, areaName: name }]
// categoryShopsList {'3235':'xxxxx','3699':'yyyy'}
for (const key in categoryShopsList.value) {
let hasThisKey = false;
for (let i = 0; i < choosedShopInfo.value.length; i++) {
if (choosedShopInfo.value[i].areaId === key) {
hasThisKey = true;
}
}
if (!hasThisKey) {
delete categoryShopsList.value[key];
}
}
console.log(choosedShopInfo.value);
console.log(categoryShopsList.value);
return obj;
}, {});
};
// 显示店铺分类弹窗
const showclass = () => {
show.value = true;
};
const isCategoryNull = ref(false);
function chooseImage({ fileList: files }) {
xma.chooseImage({
count: 6, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], // 从相册选择
success: function (res) {
console.log(JSON.stringify(res.tempFilePaths));
},
});
}
const shopDetail = reactive({
shopName: '', // 店铺名称
intro: '', // 店铺简介
tel: '', // 联系电话
shopLat: 0.0, // 店铺所在纬度
shopLng: 0.0, // 店铺所在经度
shopAddress: '', // 店铺详细地址
province: '贵州', // 省份
city: '贵阳', // 城市
area: '南明', // 区县
shopLogo: '', // 店铺LOGO
transactionStart: '', // 营业开始时间
transactionEnd: '', // 营业结束时间
communities: [], // 绑定小区
});
// 身份证信息获取
const shopPersonalInformation = reactive({
identityCardFront: '', // 身份证正面
identityCardReverse: '', // 身份证反面
});
const categoryShops = reactive({
categoryId: '3237', // 分类id
categoryId: '', // 分类id
qualifications: '', // 经营资质图片,以,分割
});
const formData = reactive({
shopName: '我是店铺名称', // 店铺名称
intro: '我是店铺简介', // 店铺简介
tel: '13699999999', // 联系电话
shopId: '', // 店铺
shopName: '', // 店铺名称
intro: '', // 店铺简介
tel: '', // 联系电话
shopLat: 0.0, // 店铺所在纬度
shopLng: 0.0, // 店铺所在经度
shopAddress: '', // 店铺详细地址
province: '贵州', // 省份
city: '贵阳', // 城市
area: '南明', // 区县
province: '贵州', // 省份
city: '贵阳', // 城市
area: '南明', // 区县
shopLogo: '', // 店铺LOGO
license: '',
transactionStart: '', // 营业开始时间
transactionEnd: '', // 营业结束时间
communities: [], // 绑定小区
});
const ssq = ref();
const form = ref();
const test = ref();
......@@ -509,9 +569,6 @@ const rules = ref({
shopAddress: [{ required: true, message: '请输入详细地址' }],
area: [{ required: true, message: '请选择地区' }],
});
/* const shopDetail = ref({
shopAddress: '',
}); */
const chooseShopPosition = async () => {
const res = await getLocationFn();
......@@ -549,8 +606,11 @@ const getLocationFn = () => {
}); */
};
const getShopRelatedInfo = () => {};
const submitData = () => {
categoryShops.categoryId === '' ? (isCategoryNull.value = true) : (isCategoryNull.value = false);
choosedShopInfo.value.length === 0
? (isCategoryNull.value = true)
: (isCategoryNull.value = false);
fileListShopLogo.value.length === 0 ? (shopLogoNull.value = true) : (shopLogoNull.value = false);
fileListCardForward.value.length === 0
? (cardForwardNull.value = true)
......@@ -561,17 +621,17 @@ const submitData = () => {
fileListQualifications.value.length === 0
? (qualificationsNull.value = true)
: (qualificationsNull.value = false);
const dealCategoryData = ref([]);
console.log('choosedShopInfo的值为');
console.log(choosedShopInfo.value);
dealCategoryData.value = [];
// 获取需要上传的店铺分类数据
for (let i = 0; i < choosedShopInfo.value.length; i++) {
dealCategoryData.value.push({
categoryId: choosedShopInfo.value[i].areaId,
qualifications: categoryShopsList.value[choosedShopInfo.value[i].areaId] || '',
qualifications: choosedShopInfo.value[i].qualifications,
});
}
console.log(dealCategoryData.value);
form.value
.validate()
.then(({ valid, errors }) => {
......@@ -597,6 +657,37 @@ const submitData = () => {
console.log(error, 'error');
});
};
// 重新定位收货地址
async function changeLocation() {
uni.chooseLocation({
success: function (res) {
// forMData.value.city = res.address;
formData.shopAddress = res.address;
formData.shopLng = res.longitude;
formData.shopLat = res.latitude;
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.province = res.data.result.address_component.province;
formData.city = res.data.result.address_component.city;
formData.area = res.data.result.address_component.district;
ssq.value = formData.province + formData.city + formData.area;
}
},
});
},
});
}
</script>
<style lang="scss" scoped>
......
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