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