This commit is contained in:
Ling53666
2025-08-18 09:11:51 +08:00
commit 02554225da
2516 changed files with 133155 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,95 @@
.container {
padding: 20px;
}
.section-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 10px;
}
.input-row {
display: flex;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #ddd;
}
.label {
flex: 0 0 120px;
color: #333;
}
.input {
flex: 1;
border: none;
outline: none;
}
.avatar-upload {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid #ddd;
width: 50px;
height: 50px;
border-radius: 50%;
}
.icon {
width: 20px;
height: 20px;
color: #ccc;
}
.picker-placeholder {
color: #999;
display: flex;
}
.upload-button {
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
border: 1px solid #ddd;
border-radius: 10px;
margin-right: 10px;
}
.submit-button {
width: 100%;
background-color: #007aff;
color: white;
text-align: center;
padding: 15px;
border: none;
border-radius: 5px;
font-size: 16px;
margin-top: 20px;
}
.button {
width: 80%;
height: 40px;
background-color: #f3bfc1;
color: #000000;
border-radius: 20px;
font-size: 16px;
display: flex;
justify-content: center;
align-items: center;
}
.box{
position: relative;
right: 13px;
}
.tijiao{
width: 100%;
height: 100px;
display: flex;
justify-content: center;
align-items: center;
}

View File

@ -0,0 +1,94 @@
<view class="container">
<view class="section">
<view class="section-title">商家注册</view>
<view class="input-row">
<text class="label">店铺名称</text>
<input class="input" placeholder="请输入店铺名称" onInput="businessName" />
</view>
<view class="input-row">
<text class="label">联系人</text>
<input class="input" placeholder="请输入联系人姓名" onInput="person" />
<icon type="eye" />
</view>
</view>
<view class="section">
<view class="input-row">
<text class="label">联系方式</text>
<input class="input" placeholder="请输入联系人电话" onInput="phone"/>
</view>
<!-- <view class="input-row">
<text class="label">身份证号</text>
<input class="input" placeholder="请输入身份证号" onInput="idcard"/>
</view> -->
<view class="input-row">
<text class="label">账号</text>
<input class="input" placeholder="请输入账号" onInput="userAccount"/>
</view>
<view class="input-row">
<text class="label">密码</text>
<input class="input" placeholder="请输入密码" onInput="userPassword"/>
</view>
<view class="box">
<ant-list-item>
请选择省市
<ant-cascader-picker
slot="extra"
placeholder="请选择归属地"
options="{{cityList}}"
onChange="handleCascaderPickerChange"
onOk="handleCascaderOnOk"
onCancel="handleDismiss"
></ant-cascader-picker>
</ant-list-item>
</view>
<view class="box">
<ant-list-item>
服务方式
<ant-picker
slot="extra"
onCancel="handleDismiss"
onVisibleChange="handleTriggerPicker"
onOk="handleOk"
defaultValue="{{defaultValue}}"
placeholder="请选择服务方式"
title="请选择服务方式"
onChange="handleChange"
options="{{list}}"
emptyText="暂无数据"
></ant-picker>
</ant-list-item>
</view>
</view>
<view class="section">
<view class="input-row">
<text class="label">请上传营业执照</text>
<ant-uploader
onChange="onChange"
onUpload="{{onUpload ? onUpload : 'onUpload'}}"
uploadingText="上传中……"
uploadfailedText="上传失败"
></ant-uploader>
</view>
<view class="input-row">
<text class="label">请上传身份证正面照</text>
<ant-uploader
onChange="onChange"
onUpload="{{onUpload1 ? onUpload1 : 'onUpload1'}}"
uploadingText="上传中……"
uploadfailedText="上传失败"
></ant-uploader>
</view>
<view class="input-row">
<text class="label">请上传身份证反面照</text>
<ant-uploader
onChange="onChange"
onUpload="{{onUpload2 ? onUpload2 : 'onUpload2'}}"
uploadingText="上传中……"
uploadfailedText="上传失败"
></ant-uploader>
</view>
</view>
</view>
<view class="tijiao">
<view class="button" onTap="ruzhu">提交申请</view>
</view>

View File

@ -0,0 +1,308 @@
import cityList from './city';
import {url} from '../request'
Page({
data: {
cityList,
errortext:"",
cascaderValue: ['34', '330'],
cascaderVisible: false,
list: ['可上门可到店', '到店服务'],
},
handleOk(value, column, e) {
console.log('onOk value', value, 'onOk column', column, e);
if(value=='可上门可到店'){
this.setData({
serviceMode:0
})
}else{
this.setData({
serviceMode:1
})
}
console.log(this.data.serviceMode);
},handleTriggerPicker(visible, e) {
console.log('onVisibleChange', visible, e);
}, handleDismiss(e) {
my.showToast({
content: '取消操作,关闭 picker',
});
console.log(e);
},
onLoad() {},
ruzhu(){
if (!this.validateForm()) {
return; // 验证未通过,阻止提交
}
my.request({
url: url+'/api/business/add',
method: 'POST',
data: {
address: this.data.selectedOption,
backIdCard: this.data.backIdCard,
businessName: this.data.businessName,
businessPhone: this.data.phone,
frontIdCard:this.data.frontIdCard,
license: this.data.yingyeimage,
shopkeeper: this.data.person,
userAccount: this.data.userAccount,
userPassword: this.data.userPassword,
serviceMode: this.data.serviceMode,
},
headers: {
'content-type': 'application/json', //默认值
},
dataType: 'json',
success: (res)=> {
this.setData({
errortext:res.data.description
})
if(res.data.code==0){
my.alert({ content: '正在审核中,请耐心等待' });
my.navigateBack()
console.log(res);
}else{
my.alert({content:this.data.errortext})
}
},
fail: function (error) {
console.error('fail: ', JSON.stringify(error));
},
});
},
// 获取数据
businessName(e) {
this.setData({
businessName: e.detail.value,
});
console.log(e.detail.value);
},
person(e) {
this.setData({
person: e.detail.value,
});
console.log(e.detail.value);
},
phone(e) {
this.setData({
phone: e.detail.value,
});
console.log(e.detail.value);
},
// idcard(e) {
// this.setData({
// idcard: e.detail.value,
// });
// console.log(e.detail.value);
// },
userAccount(e) {
this.setData({
userAccount: e.detail.value,
});
console.log(e.detail.value);
},
userPassword(e) {
this.setData({
userPassword: e.detail.value,
});
console.log(e.detail.value);
},
// 地点选择
handleCascaderPickerChange(cascaderValue, selectedOption, e) {
console.log('cityChange', cascaderValue, selectedOption, e);
},
handleCascaderOnOk(cascaderValue, selectedOption, e) {
console.log('cityOk', cascaderValue, selectedOption, e);
const selectedCityLabels = selectedOption.map(option => option.label).join(' ');
this.setData({
selectedOption: selectedCityLabels
});
console.log('Selected cities:', this.data.selectedOption);
},
// 前端校验
validateForm() {
// 验证店铺名(非空)
if (!this.data.businessName) {
my.showToast({
content: '店铺名不能为空',
type: 'none',
duration: 2000,
});
return false;
}
if (!this.data.userPassword&&this.data.userPassword.length>=8) {
my.showToast({
content: '密码不能为空并且不少于8位',
type: 'none',
duration: 2000,
});
return false;
}
if (!this.data.userAccount) {
my.showToast({
content: '账号不能为空',
type: 'none',
duration: 2000,
});
return false;
}
if (!this.data.person) {
my.showToast({
content: '姓名不能为空',
type: 'none',
duration: 2000,
});
return false;
}
// 验证电话(简单的正则校验)
const phoneRegex = /^1[3-9]\d{9}$/;
if (!this.data.phone || !phoneRegex.test(this.data.phone)) {
my.showToast({
content: '请输入有效的手机号码',
type: 'none',
duration: 2000,
});
return false;
}
// 验证身份证号(简单的正则校验)
// const idcardRegex = /^\d{17}(\d|X)$/;
// if (!this.data.idcard || !idcardRegex.test(this.data.idcard)) {
// my.showToast({
// content: '请输入有效的身份证号',
// type: 'none',
// duration: 2000,
// });
// return false;
// }
// 验证是否选择了城市
if (!this.data.selectedOption) {
my.showToast({
content: '请选择省市',
type: 'none',
duration: 2000,
});
return false;
}
// 验证图片是否上传
if (!this.data.yingyeimage) {
my.showToast({
content: '请上传营业执照',
type: 'none',
duration: 2000,
});
return false;
}
if (!this.data.frontIdCard) {
my.showToast({
content: '请上传身份证正面照',
type: 'none',
duration: 2000,
});
return false;
}
if (!this.data.backIdCard) {
my.showToast({
content: '请上传身份证反面照',
type: 'none',
duration: 2000,
});
return false;
}
return true; // 所有验证通过
},
onChange(fileList) {
console.log('图片列表:', fileList);
},
// 营业执照
onUpload(file) {
return new Promise((resolve, reject) => {
console.log('上传文件路径:', file); // 确保文件路径正确
my.uploadFile({
url: url + '/api/file/upload/server/not_login',
fileType: 'image',
name: 'file',
filePath: file.path,
formData: {
biz: 'card',
},
success: res => {
resolve(file.path);
console.log('上传成功:', res);
const cunchu = JSON.parse(res.data)
this.setData({
yingyeimage:cunchu.data,
})
console.log(this.data.yingyeimage,'hhhhhhhhhhhhhhh');
},
fail: (err) => {
console.log('上传失败:', err);
reject();
},
});
});
},
// 身份证正面
onUpload1(file) {
return new Promise((resolve, reject) => {
console.log('上传文件路径:', file); // 确保文件路径正确
my.uploadFile({
url: url + '/api/file/upload/server/not_login',
fileType: 'image',
name: 'file',
filePath: file.path,
formData: {
biz: 'card',
},
success: res => {
resolve(file.path);
console.log('上传成功:', res);
const cunchu = JSON.parse(res.data)
this.setData({
frontIdCard:cunchu.data,
})
console.log(this.data.yingyeimage,'hhhhhhhhhhhhhhh');
},
fail: (err) => {
console.log('上传失败:', err);
reject();
},
});
});
},
// 身份证反面
onUpload2(file) {
return new Promise((resolve, reject) => {
console.log('上传文件路径:', file); // 确保文件路径正确
my.uploadFile({
url: url + '/api/file/upload/server/not_login',
fileType: 'image',
name: 'file',
filePath: file.path,
formData: {
biz: 'card',
},
success: res => {
resolve(file.path);
console.log('上传成功:', res);
const cunchu = JSON.parse(res.data)
this.setData({
backIdCard:cunchu.data,
})
console.log(this.data.yingyeimage,'hhhhhhhhhhhhhhh');
},
fail: (err) => {
console.log('上传失败:', err);
reject();
},
});
});
},
});

View File

@ -0,0 +1,11 @@
{
"defaultTitle": "商家入驻",
"usingComponents": {
"ant-uploader": "antd-mini/es/ImageUpload/index",
"ant-list-item": "antd-mini/es/List/ListItem/index",
"ant-cascader-picker": "antd-mini/es/Picker/CascaderPicker/index",
"ant-container": "antd-mini/es/Container/index",
"ant-picker": "antd-mini/es/Picker/index"
},
"styleIsolation": "apply-shared"
}