省市的接口对接

身份认证的完成
This commit is contained in:
wangzimeng 2025-07-31 11:33:46 +08:00
parent d07da60e60
commit 8349ab4440
9 changed files with 375 additions and 65 deletions

View File

@ -353,8 +353,8 @@
"meta": {
"auth": true,
"sync": true,
"title": "用户信息",
"group": "用户中心"
"title": "我的信息",
"group": "个人中心"
}
},
{
@ -366,7 +366,7 @@
"auth": true,
"sync": true,
"title": "我的发布",
"group": "用户中心"
"group": "个人中心"
}
},
{
@ -378,7 +378,7 @@
"auth": true,
"sync": true,
"title": "我的收藏",
"group": "用户中心"
"group": "个人中心"
}
},
{
@ -390,7 +390,7 @@
"auth": true,
"sync": true,
"title": "我的足迹",
"group": "用户中心"
"group": "个人中心"
}
},
{
@ -402,7 +402,7 @@
"auth": true,
"sync": true,
"title": "地址管理",
"group": "用户中心"
"group": "个人中心"
}
},
{
@ -424,7 +424,7 @@
"auth": true,
"sync": true,
"title": "发票管理",
"group": "用户中心"
"group": "个人中心"
}
},
{
@ -446,7 +446,7 @@
"auth": true,
"sync": true,
"title": "用户余额",
"group": "用户中心"
"group": "个人中心"
}
},
{
@ -470,7 +470,19 @@
"auth": true,
"sync": true,
"title": "我的积分",
"group": "用户中心"
"group": "个人中心"
}
},
{
"path": "authentication",
"style": {
"navigationBarTitleText": "身份认证"
},
"meta": {
"auth": true,
"sync": true,
"title": "身份认证",
"group": "个人中心"
}
}
]

View File

@ -199,8 +199,22 @@
</view>
</su-popup>
<!-- 身份证是否认证
<su-popup @touchmove.native.stop.prevent :closeable="false" :show="cardShow" :round="10" mode="center"
<!-- 身份证是否认证 -->
<su-popup :show="cardShow == true" type="center" round="10" :isMaskClick="false">
<view class="popupContacted">
<view class="contactedBox">
<image style="width: 198rpx;height: 122rpx;position: relative;left: 12rpx;" src="https://jiangxiaoxian.0rui.cn/couponSuccess.png"></image>
<view style="font-size: 36rpx;line-height: 50rpx;font-weight: 900;color: #3d3d3d;text-align: center;">身份认证</view>
<view style="font-size: 30rpx;line-height: 44rpx;font-weight: 400;color: #3d3d3d;text-align: center;">认证后即可发布信息</view>
</view>
<view class="contactBtn">
<view class="tactBtnBox" style="color: #999999;" @click="cardShow = false">取消</view>
<view class="tactBtnBox2" style="color: #323232;" @click="toPage('')">去认证</view>
</view>
</view>
</su-popup>
<!-- <su-popup @touchmove.native.stop.prevent :closeable="false" :show="cardShow" :round="10" mode="center"
@close="cardShow = false" :safeAreaInsetBottom="false" :custom-style="{
width: '600rpx',
padding: '24rpx 24rpx 20rpx 24rpx',
@ -279,7 +293,8 @@
} from '@dcloudio/uni-app';
import {
ref,
reactive
reactive,
computed
} from 'vue';
import sheep from '@/sheep';
import {
@ -291,7 +306,8 @@
import {
baseUrl
} from '@/sheep/config';
const isLogin = computed(() => sheep.$store('user').isLogin);
const state = reactive({
showRegion: false,
model: {
@ -342,7 +358,6 @@
cateName: '',
imageList: [],
})
const onRegionConfirm = (e) => {
console.log('onRegionConfirm', e);
state.model = {
@ -369,6 +384,39 @@
getTagList();
getTypeList();
})
function getAuthentied() {
sheep.$api.rent.isAuthentied().then((res) => {
if(res.code == 1) {
if(res.data !=1) {
cardShow.value = true;
}else {
cardShow.value = false;
}
}
})
}
const toPage = () => {
if (isLogin.value == true) {
uni.navigateTo({
url: e
})
} else {
uni.showToast({
title: '请先登录',
icon: 'none',
duration: 2000
})
setTimeout(function() {
uni.switchTab({
url: '/pages/index/user'
})
}, 2000);
}
}
async function getTagList() {
const res = await sheep.$api.rent.tagsList({});
if (res.code == 1) {
@ -577,6 +625,23 @@
const res = await sheep.$api.rent.addRent(form.value)
if(res.code == 1){
console.log('发布成功');
agreeAdd.value = false;
form.value = {
title: '',
area: '',
tags: '',
contacts: '',
contact_number: '',
content: '',
address_detail: '',
type: '',
images: '',
province: '',
city: '',
cate_ids: '',
cateName: '',
imageList: [],
}
}
}

View File

@ -159,10 +159,16 @@
region
} from '@/sheep/validate/form';
// tabBar
uni.hideTabBar({
fail: () => {},
});
function getAreaCity() {
// if (_.isEmpty(uni.getStorageSync('areaCity'))) {
sheep.$api.rent.getCity().then((res) => {
if (res.code === 1) {
uni.setStorageSync('areaCity', res.data);
}
});
// }
};
const template = computed(() => sheep.$store('app').template?.home);
const isLogin = computed(() => sheep.$store('user').isLogin);
@ -194,6 +200,8 @@
});
}
};
const proCity = ref('')
@ -204,8 +212,14 @@
...state.model,
...e,
};
if(state.model.province_name == state.model.city_name) {
proCity.value = state.model.province_name
}else {
proCity.value = state.model.province_name + " " + state.model.city_name
}
proCity.value = state.model.province_name + " " + state.model.city_name
// proCity.value = state.model.province_name + " " + state.model.city_name
console.log('onRegionConfirm33', state.model, proCity.value);
listQuery.value.province = state.model.province_id
@ -236,6 +250,7 @@
onLoad((options) => {
getAreaCity();
getList();
getBanner();
// #ifdef MP
@ -350,6 +365,11 @@
// }
console.log('getList', rentList.value);
}
// tabBar
uni.hideTabBar({
fail: () => {},
});
</script>
<style lang="scss" scoped>

View File

@ -18,7 +18,7 @@
<view class="headAvatar-info justify-start">
<view class="info-name fs-36 weight8 flexD" v-if="isLogin == true">
<view style="font-weight: 800;" @click="toLogin">{{ userInfo.nickname}} </view>
<view class="UnAuthenBox weight8 fs-20" v-if="authenInfo.status == -1 ">未认证</view>
<view class="UnAuthenBox weight8 fs-20" v-if="authenInfo.status == -1 " @click="toPage('/pages/user/authentication')">未认证</view>
<view class="authenticationBox weight8 fs-20" v-if="authenInfo.status == 1 ">已认证</view>
</view>
<view class="info-name fs-36 weight8 flexD" v-else>

View File

@ -0,0 +1,168 @@
<template>
<s-layout title="认证信息" :bgStyle="{ color: '#ffffff' }">
<view class="container">
<view class="contifionType">
<su-tabs :list="tabMaps" @change="onChange" :scrollable="false" :current="currentTab"></su-tabs>
</view>
<view style="padding: 0 30rpx;width: 100%;">
<view v-if="currentTab == 0">
<image v-if="form.workimage != '' && form.status == 1" style="width: 690rpx;height: 350rpx;" :src="baseUrl + form.workimage" @click="afterRead"></image>
<image v-else style="width: 690rpx;height: 350rpx;"
src="https://jiangxiaoxian.0rui.cn/manager.png" @click="afterRead"></image>
</view>
<view v-if="currentTab == 1">
<image v-if="form.gateimage != '' && form.status == 2" style="width: 690rpx;height: 350rpx;"
:src="baseUrl + form.gateimage" @click="afterRead"></image>
<image v-else style="width: 690rpx;height: 350rpx;" @click="afterRead"
src="https://jiangxiaoxian.0rui.cn/Merchant.png">
</image>
</view>
</view>
<view class="footer-box">
<view class="submitAuth" @click="submit()">提交认证</view>
</view>
</view>
</s-layout>
</template>
<script setup>
import sheep from '@/sheep';
import {
onLoad,
onShow,
onReachBottom
} from '@dcloudio/uni-app';
import {
ref,
reactive
} from 'vue';
import _ from 'lodash';
import {
baseUrl
} from '@/sheep/config';
const tabMaps = [{
name: '餐厅经理',
value: '1',
},
{
name: '档口商户',
value: '2',
},
];
const currentTab = ref(0)
//tabs
function onChange(e) {
console.log('onChange', e);
currentTab.value = e.index
console.log('切换tabs', currentTab.value);
if (currentTab.value == 0) {
form.value.status = 1
form.value.workimage = '';
form.value.gateimage = '';
} else {
form.value.status = 2
form.value.gateimage = '';
form.value.workimage = '';
}
}
const form = ref({
workimage: '',
gateimage: '',
status: 0,
})
async function uploadAvatar(tempUrl) {
if (!tempUrl) return;
let {
url
} = await sheep.$api.app.upload(tempUrl, 'ugc');
console.log('url', url);
if (currentTab.value == 0) {
form.value.status = 1
form.value.workimage = url;
} else {
form.value.status = 2
form.value.gateimage = url;
}
}
async function afterRead() {
console.log('afterRead触发了吗');
uni.chooseImage({
success: async (chooseImageRes) => {
const tempUrl = chooseImageRes.tempFilePaths[0];
uploadAvatar(tempUrl);
},
});
}
function submit() {
const data = {
status: form.value.status,
workimage: form.value.workimage,
gateimage: form.value.gateimage,
}
sheep.$api.user.authPhoto(data).then((res) => {
if(res.code == 1) {
console.log('提交认证成功');
uni.showToast({
title:'提交认证成功',
icon: 'success',
})
setTimeout(() => {
uni.navigateBack()
},1000)
}
})
}
</script>
<style lang="scss" scoped>
.container {
background: #ffffff;
width: 100%;
// display: grid;
// justify-content: center;
.contifionType {
margin-bottom: 30rpx;
}
.footer-box {
width: 100%;
height: 90rpx;
padding: 30rpx;
position: fixed;
bottom: 10rpx;
left: 0;
.submitAuth {
background: linear-gradient(to right, #FFBD25, #FCCA58);
width: 690rpx;
height: 90rpx;
display: flex;
align-items: center;
justify-content: center;
color: #333333;
font-size: 32rpx;
font-weight: 45rpx;
font-weight: bold;
border-radius: 148rpx;
}
}
}
</style>

View File

@ -1,25 +1,26 @@
import request from '@/sheep/request';
export default {
//省市区列表
area: () =>
request({
url: 'data.area',
method: 'GET',
}),
//常见问题
faq: () =>
request({
url: 'data.faq',
method: 'GET',
}),
//富文本
richtext: (id) =>
request({
url: 'data.richtext',
method: 'GET',
params: {
id: id,
},
}),
};
//省市区列表
area: () =>
request({
url: 'data.area',
method: 'GET',
}),
//常见问题
faq: () =>
request({
url: 'data.faq',
method: 'GET',
}),
//富文本
richtext: (id) =>
request({
url: 'data.richtext',
method: 'GET',
params: {
id: id,
},
}),
};

View File

@ -43,13 +43,32 @@ export default {
url: 'meal.information/type_list',
method: 'GET',
params,
}),
//提交发布
addRent: (data)=>
addRent: (data) =>
request({
url: 'meal.information/add',
method: 'POST',
data,
}),
//省市
getCity: () =>
request({
url: 'index/city',
method: 'GET',
}),
//发布须知
fabuAgree: (params) =>
request({
url: 'meal.information/agreement',
method: 'GET',
params,
}),
//发布身份认证查询
isAuthentied: () =>
request({
url: 'meal.auth/info',
method: 'GET',
})
};

View File

@ -352,6 +352,14 @@ export default {
auth: true,
},
}),
//提交认证信息
authPhoto: (data) =>
request({
url: 'meal.auth/save',
method: 'POST',
data,
}),
};

View File

@ -4,7 +4,7 @@
<su-toolbar :cancelColor="cancelColor" :confirmColor="confirmColor" :cancelText="cancelText"
:confirmText="confirmText" title="选择区域" @cancel="onCancel" @confirm="onConfirm('confirm')"></su-toolbar>
<view class="ui-picker-body">
<picker-view :value="state.currentIndex" @change="change" class="ui-picker-view" @pickstart="pickstart"
<picker-view :value="state.currentCityIndex" @change="change" class="ui-picker-view" @pickstart="pickstart"
@pickend="pickend">
<picker-view-column>
<view class="ui-column-item" v-for="province in provinceList" :key="province.id">
@ -45,6 +45,7 @@
computed,
reactive
} from 'vue';
import sheep from '@/sheep';
const props = defineProps({
show: {
type: Boolean,
@ -71,12 +72,24 @@
default: '确认',
},
});
const getAreaCity = () => {
// if (_.isEmpty(uni.getStorageSync('areaCity'))) {}
sheep.$api.rent.getCity().then((res) => {
if (res.code === 1) {
uni.setStorageSync('areaCity', res.data);
}
});
};
// const areaData = uni.getStorageSync('areaData')
const proFirst = [{
children: [{
child: [{
id: '',
level: "city",
name: "全部",
name: "全",
pid: 0
}], //
id: '',
@ -84,8 +97,8 @@
name: "全国",
pid: 0
}]
const areaData = proFirst.concat(uni.getStorageSync('areaData'))
const areaData = proFirst.concat(uni.getStorageSync('areaCity'))
console.log('province',provinceList,uni.getStorageSync('areaCity'));
const getSizeByNameLength = (name) => {
// if (!name) return ''; //
@ -99,21 +112,20 @@
}
};
const state = reactive({
currentIndex: [0, 0, 0],
currentCityIndex: [0, 0],
moving: false, //
});
const emits = defineEmits(['confirm', 'cancel', 'change']);
// const provinceList = areaData;
const provinceList = proFirst.concat(uni.getStorageSync('areaData'))
console.log('province',provinceList.value);
const provinceList = areaData;
// const provinceList = proFirst.concat(uni.getStorageSync('areaData'))
const cityList = computed(() => {
return areaData[state.currentIndex[0]].children;
});
const districtList = computed(() => {
return cityList.value[state.currentIndex[1]]?.children;
return areaData[state.currentCityIndex[0]].child;
});
// const districtList = computed(() => {
// return cityList.value[state.currentCityIndex[1]]?.child;
// });
//
const pickstart = () => {
// #ifdef MP-WEIXIN
@ -136,21 +148,21 @@
// picker
const change = (e) => {
if (
state.currentIndex[0] === e.detail.value[0] &&
state.currentIndex[1] === e.detail.value[1]
state.currentCityIndex[0] === e.detail.value[0] &&
state.currentCityIndex[1] === e.detail.value[1]
) {
//
state.currentIndex[2] = e.detail.value[2];
state.currentCityIndex[2] = e.detail.value[2];
return;
} else {
//
if (state.currentIndex[0] !== e.detail.value[0]) {
if (state.currentCityIndex[0] !== e.detail.value[0]) {
e.detail.value[1] = 0;
}
e.detail.value[2] = 0;
state.currentIndex = e.detail.value;
state.currentCityIndex = e.detail.value;
}
emits('change', state.currentIndex);
emits('change', state.currentCityIndex);
};
//
@ -158,8 +170,13 @@
// #ifdef MP-WEIXIN
if (state.moving) return;
// #endif
let index = state.currentIndex;
let index = state.currentCityIndex;
let province = provinceList[index[0]];
// if(province == '') {
// let city = cityList.value[index[1]];
// }else {
// }
let city = cityList.value[index[1]];
// let district = districtList.value[index[2]];
let result = {