第一次提交
This commit is contained in:
282
package/apply/components/delivery.vue
Executable file
282
package/apply/components/delivery.vue
Executable file
@@ -0,0 +1,282 @@
|
||||
<template>
|
||||
<view :style="appThemeStyle">
|
||||
<u-form :model="form" ref="uForm" label-width="140rpx">
|
||||
<!-- {{JSON.stringify(setting)}} -->
|
||||
<u-form-item label="意向配送区域" prop="region">
|
||||
<select-region ref="sRegion" :disabled="disabled" v-model="form.region" />
|
||||
</u-form-item>
|
||||
<u-form-item label="姓名" prop="real_name">
|
||||
<u-input v-model="form.real_name" :disabled="disabled" placeholder="请输入商户姓名" />
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" prop="mobile">
|
||||
<u-input v-model="form.mobile" maxlength="11" :disabled="disabled" placeholder="请输入商户手机号" />
|
||||
</u-form-item>
|
||||
<Partner :form="form"></Partner>
|
||||
<u-form-item v-for="(item,imageIndex) in imageList" :key="imageIndex" :label="itemLabel[imageIndex]"
|
||||
:prop="itemProp[imageIndex]">
|
||||
<view class="image-preview">
|
||||
<image mode="widthFix" :src="item.path" class="sfz" @click="chooseImage(imageIndex)"></image>
|
||||
<text class="image-delete iconfont icon-shanchu" @click="deleteImage(imageIndex)"></text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<view class="form-license dis-flex flex-x-center flex-y-center">
|
||||
<view class="license-radio dis-flex flex-y-center" @click="isRead = !isRead">
|
||||
<text class="license-icon f-38 iconfont icon-radio"
|
||||
:class="[isRead ? 'c-violet' : 'col-bb']"></text>
|
||||
<text class="f-28 col-80">我已阅读并了解</text>
|
||||
</view>
|
||||
<text @click="handleShowLicense()" class="f-28 c-violet">【{{ setting.words.apply.words.license.value }}】</text>
|
||||
</view>
|
||||
</u-form>
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<u-modal v-model="showLicense" title="入驻协议">
|
||||
<scroll-view class="pops-content" :scroll-y="true">
|
||||
<text>{{ setting.license }}</text>
|
||||
</scroll-view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectRegion from '@/components/select-region/select-region'
|
||||
import {
|
||||
isMobile
|
||||
} from '@/utils/verify'
|
||||
import Empty from '@/components/empty'
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import * as UploadApi from '@/api/upload'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
|
||||
// 图片上传类型
|
||||
const itemProp = ["sfz1", "sfz2", "yyzz"]
|
||||
// 图片上传名称
|
||||
const itemLabel = ["身份证(正)", "身份证(反)", "营业执照"]
|
||||
// 用户选择的图片列表
|
||||
const imageList = [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 100
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 100
|
||||
}
|
||||
]
|
||||
|
||||
// 表单字段元素
|
||||
const form = {
|
||||
// 入驻类型 (商家10001,配送员10002,社区门店10003,省代10004)
|
||||
grade_id: 10001,
|
||||
company: '',
|
||||
real_name: '',
|
||||
phone: '',
|
||||
mobile: '',
|
||||
region: [],
|
||||
detail: '',
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
real_name: [{
|
||||
required: true,
|
||||
message: '请输入您的真实姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
company: [{
|
||||
required: true,
|
||||
message: '请输入您的公司名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur', 'change']
|
||||
}, {
|
||||
// 自定义验证函数
|
||||
validator: (rule, value, callback) => {
|
||||
// 返回true表示校验通过,返回false表示不通过
|
||||
return isMobile(value)
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
// 触发器可以同时用blur和change
|
||||
trigger: ['blur'],
|
||||
}],
|
||||
region: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: ['blur', 'change'],
|
||||
type: 'array'
|
||||
}],
|
||||
detail: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
}
|
||||
|
||||
const maxImageLength = 2
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Empty
|
||||
},
|
||||
props: {
|
||||
record: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
setting: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
itemProp,
|
||||
itemLabel,
|
||||
imageList,
|
||||
form,
|
||||
rules,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
// 按钮禁用
|
||||
disabled: false,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// 设置分类列表高度
|
||||
this.getSetting()
|
||||
},
|
||||
// onLoad(options) {
|
||||
// const app = this
|
||||
// this.getSetting()
|
||||
// // 获取用户坐标
|
||||
// app.getLocation((res) => {
|
||||
// app.getData(res.longitude, res.latitude)
|
||||
// })
|
||||
|
||||
// },
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
methods: {
|
||||
// 获取分销设置
|
||||
getSetting() {
|
||||
const app = this
|
||||
console.log("app.setting: ",this.setting);
|
||||
// SettingModel.data()
|
||||
// .then(setting => {
|
||||
// // 赋值属性
|
||||
// app.words = setting.words.apply.words
|
||||
// app.background = setting.background.apply
|
||||
// app.license = setting.license.license
|
||||
// // 设置当前页面标题
|
||||
// // app.setPageTitle(setting.words.apply.title)
|
||||
// })
|
||||
},
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense() {
|
||||
this.showLicense = true
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.form-license {
|
||||
padding: 20rpx;
|
||||
}
|
||||
// 上传凭证
|
||||
.row-voucher {
|
||||
padding: 24rpx 20rpx;
|
||||
|
||||
.image-list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: -20rpx;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-picker,
|
||||
.image-preview {
|
||||
width: 184rpx;
|
||||
height: 184rpx;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
float: left;
|
||||
|
||||
&:nth-child(3n+0) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.image-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1rpx dashed #ccc;
|
||||
color: #ccc;
|
||||
|
||||
.choose-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.choose-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -15rpx;
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
background: rgba(0, 0, 0, 0.64);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-weight: bolder;
|
||||
font-size: 22rpx;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.pops-content{padding: 20rpx;}
|
||||
.sfz,
|
||||
.sfz1,
|
||||
.sfz2,
|
||||
.yyzz {
|
||||
width: 140rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
415
package/apply/components/index.vue
Normal file
415
package/apply/components/index.vue
Normal file
@@ -0,0 +1,415 @@
|
||||
<template>
|
||||
<view class="container" :style="appThemeStyle">
|
||||
<!-- 标题 -->
|
||||
<view class="page-title">申请入驻</view>
|
||||
<!-- 合伙人 -->
|
||||
<Partner v-if=" currentType == 0 " :form="dataType[currentType]"
|
||||
@handleSubmit="handleSubmit" @chooseImage="chooseImage" @deleteImage="deleteImage" @showLicense="handleShowLicense" />
|
||||
<!-- 配送员 -->
|
||||
<Delivery v-if=" currentType == 1 " :form="dataType[currentType]"
|
||||
@handleSubmit="handleSubmit" @chooseImage="chooseImage" @deleteImage="deleteImage" />
|
||||
<!-- 团长 -->
|
||||
<Teamer v-if=" currentType == 2 " :form="dataType[currentType]"
|
||||
@handleSubmit="handleSubmit" @chooseImage="chooseImage" @deleteImage="deleteImage" />
|
||||
<!-- 个人商户 -->
|
||||
<Personal v-if=" currentType == 3 " :form="dataType[currentType]"
|
||||
@handleSubmit="handleSubmit" @chooseImage="chooseImage" @deleteImage="deleteImage" />
|
||||
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<u-modal v-model="showLicense" title="入驻协议">
|
||||
<scroll-view class="pops-content" :scroll-y="true">
|
||||
<text>{{ dataType[currentType].license }}</text>
|
||||
</scroll-view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import * as UploadApi from '@/api/upload'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
import Partner from './components/partner.vue'
|
||||
import Delivery from './components/delivery.vue'
|
||||
import Teamer from './components/teamer.vue'
|
||||
import Personal from './components/personal.vue'
|
||||
|
||||
// 数据类型
|
||||
const dataType = [
|
||||
{
|
||||
name: "商户",
|
||||
title: '申请成为商户',
|
||||
label: "partner",
|
||||
regionText: '所在地区',
|
||||
licenseTitle: '',
|
||||
license: '',
|
||||
submitText: '提交申请',
|
||||
disabled: false,
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
imageProp: ["sfz1", "sfz2", "yyzz"],
|
||||
itemLabel: ["身份证(正)", "身份证(反)", "营业执照"],
|
||||
imageList: [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 0
|
||||
}],
|
||||
|
||||
},
|
||||
{
|
||||
name: "配送员",
|
||||
title: '申请成为配送员',
|
||||
label: "delivery",
|
||||
regionText: '意向配送区域',
|
||||
licenseTitle: '',
|
||||
license: '',
|
||||
submitText: '提交申请',
|
||||
disabled: false,
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
imageProp: ["sfz1", "sfz2", "yyzz"],
|
||||
itemLabel: ["身份证(正)", "身份证(反)", "营业执照"],
|
||||
imageList: [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 0
|
||||
}],
|
||||
|
||||
},
|
||||
{
|
||||
name: "团长",
|
||||
title: '申请成为团长',
|
||||
label: "teamer",
|
||||
regionText: '所在地区',
|
||||
licenseTitle: '',
|
||||
license: '',
|
||||
submitText: '提交申请',
|
||||
disabled: false,
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
imageProp: ["sfz1", "sfz2", "yyzz"],
|
||||
itemLabel: ["身份证(正)", "身份证(反)", "营业执照"],
|
||||
imageList: [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 0
|
||||
}],
|
||||
|
||||
},
|
||||
{
|
||||
name: "个人商户",
|
||||
title: '申请成为个人商户',
|
||||
label: "personal",
|
||||
regionText: '所在地区',
|
||||
submitText: '提交申请',
|
||||
licenseTitle: '',
|
||||
license: '',
|
||||
disabled: false,
|
||||
longitude: '',
|
||||
latitude: '',
|
||||
imageProp: ["sfz1", "sfz2", "yyzz"],
|
||||
itemLabel: ["身份证(正)", "身份证(反)", "营业执照"],
|
||||
imageList: [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 0
|
||||
}],
|
||||
|
||||
}
|
||||
]
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Partner,
|
||||
Delivery,
|
||||
Teamer,
|
||||
Personal
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 数据类型
|
||||
dataType,
|
||||
// 当前类型
|
||||
currentType: 0,
|
||||
// 文字设置
|
||||
words: undefined,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false,
|
||||
// 当前记录
|
||||
form: {},
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const app = this
|
||||
// 切换类型
|
||||
this.setDataType(options.dataType)
|
||||
// 获取设置信息
|
||||
this.getSetting()
|
||||
// 获取用户坐标及当前入驻申请记录
|
||||
app.getLocation((res) => {
|
||||
app.getData(res.longitude, res.latitude)
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 切换类型
|
||||
setDataType(dataType) {
|
||||
if (dataType == 'partner') {
|
||||
this.currentType = 0
|
||||
}
|
||||
if (dataType == 'delivery') {
|
||||
this.currentType = 1
|
||||
}
|
||||
if (dataType == 'teamer') {
|
||||
this.currentType = 2
|
||||
}
|
||||
if (dataType == 'personal') {
|
||||
this.currentType = 3
|
||||
}
|
||||
console.log("dataType: ",this.dataType[this.currentType]);
|
||||
},
|
||||
|
||||
// 获取用户坐标
|
||||
// 参考文档:https://uniapp.dcloud.io/api/location/location?id=getlocation
|
||||
getLocation(callback) {
|
||||
const app = this
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: callback,
|
||||
fail() {
|
||||
app.$toast('获取定位失败,请点击右下角按钮重新尝试定位')
|
||||
app.isAuthor = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 加载数据
|
||||
getData(longitude, latitude) {
|
||||
const app = this
|
||||
const { currentType, dataType } = this
|
||||
dataType[currentType].longitude = longitude
|
||||
dataType[currentType].latitude = latitude
|
||||
ApplyApi.detail().then(res => {
|
||||
const detail = res.data.detail
|
||||
console.log("detail: ",detail);
|
||||
// 编辑信息
|
||||
if (detail) {
|
||||
app.createFormData(detail)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 生成默认的表单数据
|
||||
createFormData(detail) {
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
form.region = this.createRegion(detail)
|
||||
// 是否可编辑
|
||||
this.disabled = true
|
||||
// 状态
|
||||
console.log("recore.apply_status: ", form.apply_status);
|
||||
if (form.apply_status == 10) {
|
||||
this.submitText = '待审核'
|
||||
}
|
||||
if (form.apply_status == 20) {
|
||||
this.submitText = '审核通过'
|
||||
}
|
||||
if (form.apply_status == 30) {
|
||||
this.submitText = '重新提交'
|
||||
this.disabled = false
|
||||
}
|
||||
|
||||
// 加载图片
|
||||
this.imageList = detail.images.map(d => {
|
||||
return {
|
||||
path: d.image_url,
|
||||
size: 101
|
||||
}
|
||||
})
|
||||
form.images = detail.images.map(d => {
|
||||
return d.image_id
|
||||
})
|
||||
},
|
||||
|
||||
// 地区
|
||||
createRegion(detail) {
|
||||
console.log("detail: ", detail);
|
||||
return [{
|
||||
label: detail.region.province,
|
||||
value: detail.province_id
|
||||
}, {
|
||||
label: detail.region.city,
|
||||
value: detail.city_id
|
||||
}, {
|
||||
label: detail.region.region,
|
||||
value: detail.region_id
|
||||
}]
|
||||
},
|
||||
|
||||
// 获取分销设置
|
||||
getSetting() {
|
||||
const app = this
|
||||
SettingModel.data()
|
||||
.then(setting => {
|
||||
app.dataType[app.currentType].licenseTitle = setting.words.apply.words.license.value
|
||||
// // 赋值属性
|
||||
app.dataType[app.currentType].license = setting.license.license
|
||||
// 设置当前页面标题
|
||||
app.setPageTitle()
|
||||
})
|
||||
},
|
||||
|
||||
// 设置当前页面标题
|
||||
setPageTitle() {
|
||||
uni.setNavigationBarTitle({
|
||||
title: this.dataType[this.currentType].title
|
||||
})
|
||||
},
|
||||
|
||||
// 选择图片
|
||||
chooseImage(imageIndex,tempFiles){
|
||||
console.log("imageIndex: ",imageIndex);
|
||||
console.log("tempFiles: ",tempFiles);
|
||||
const {dataType, currentType} = this
|
||||
dataType[currentType].imageList.splice(imageIndex,1,tempFiles)
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deleteImage(imageIndex) {
|
||||
const { disabled } = this
|
||||
if (disabled == true) {
|
||||
return false
|
||||
}
|
||||
this.imageList[imageIndex].path = '/static/not-dealer.png'
|
||||
},
|
||||
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense(e) {
|
||||
this.showLicense = e
|
||||
},
|
||||
|
||||
// 提交到后台
|
||||
handleSubmit(form,imageList){
|
||||
const app = this
|
||||
if (app.disabled) {
|
||||
return false
|
||||
}
|
||||
app.disabled = true
|
||||
app.form = form
|
||||
ApplyApi.checkAvailable(form).then(res => {
|
||||
if (imageList.length > 0 && imageList[0].size != 100) {
|
||||
app.uploadFile()
|
||||
.then(() => app.onSubmit())
|
||||
.catch(err => {
|
||||
app.disabled = false
|
||||
if (err.statusCode !== 0) {
|
||||
app.$toast(err.errMsg)
|
||||
}
|
||||
console.log('err', err)
|
||||
})
|
||||
} else {
|
||||
app.onSubmit()
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("err: ", err);
|
||||
if (err.statusCode == 0) {
|
||||
app.disabled = false
|
||||
app.$toast(err.errMsg)
|
||||
return false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 上传图片
|
||||
uploadFile() {
|
||||
const app = this
|
||||
const {
|
||||
imageList,
|
||||
form
|
||||
} = app
|
||||
// 批量上传
|
||||
return new Promise((resolve, reject) => {
|
||||
if (imageList.length > 0) {
|
||||
UploadApi.image(imageList)
|
||||
.then(fileIds => {
|
||||
form.images = fileIds
|
||||
resolve(fileIds)
|
||||
})
|
||||
.catch(reject)
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 提交到后端
|
||||
onSubmit() {
|
||||
const app = this
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
let req;
|
||||
if (form.apply_status == 30) {
|
||||
req = ApplyApi.edit(form.apply_id, form)
|
||||
} else {
|
||||
req = ApplyApi.add(form)
|
||||
}
|
||||
req.then(result => {
|
||||
console.log("result: ", result);
|
||||
app.$toast(result.message)
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
|
||||
})
|
||||
.finally(() => app.disabled = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background: #f7f8fa;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.page-title {
|
||||
width: 94%;
|
||||
margin: 0 auto;
|
||||
padding-top: 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(69, 90, 100, 0.6);
|
||||
}
|
||||
.pops-content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
</style>
|
||||
566
package/apply/components/partner.2.vue
Normal file
566
package/apply/components/partner.2.vue
Normal file
@@ -0,0 +1,566 @@
|
||||
<template>
|
||||
<view class="container" :style="appThemeStyle">
|
||||
|
||||
<!-- 表单组件 -->
|
||||
<view class="form-wrapper">
|
||||
<u-form :model="form" ref="uForm" label-width="140rpx">
|
||||
<u-form-item label="所在地区" prop="region">
|
||||
<select-region ref="sRegion" :disabled="disabled" v-model="form.region" />
|
||||
</u-form-item>
|
||||
<u-form-item label="公司名称" prop="company">
|
||||
<u-input v-model="form.company" :disabled="disabled" placeholder="请输入公司名称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="联系电话" prop="phone">
|
||||
<u-input v-model="form.phone" :disabled="disabled" placeholder="请输入联系电话" />
|
||||
</u-form-item>
|
||||
<u-form-item label="姓名" prop="real_name">
|
||||
<u-input v-model="form.real_name" :disabled="disabled" placeholder="请输入商户姓名" />
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" prop="mobile">
|
||||
<u-input v-model="form.mobile" maxlength="11" :disabled="disabled" placeholder="请输入商户手机号" />
|
||||
</u-form-item>
|
||||
<u-form-item v-for="(item,imageIndex) in imageList" :key="imageIndex" :label="itemLabel[imageIndex]"
|
||||
:prop="itemProp[imageIndex]">
|
||||
<view class="image-preview">
|
||||
<image mode="widthFix" :src="item.path" class="sfz" @click="chooseImage(imageIndex)"></image>
|
||||
<text class="image-delete iconfont icon-shanchu" @click="deleteImage(imageIndex)"></text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<view class="form-license dis-flex flex-x-center flex-y-center">
|
||||
<view class="license-radio dis-flex flex-y-center" @click="isRead = !isRead">
|
||||
<text class="license-icon f-38 iconfont icon-radio"
|
||||
:class="[isRead ? 'c-violet' : 'col-bb']"></text>
|
||||
<text class="f-28 col-80">我已阅读并了解{{words}}</text>
|
||||
</view>
|
||||
<text @click="handleShowLicense()" class="f-28 c-violet">【{{ words.license.value }}】</text>
|
||||
</view>
|
||||
</u-form>
|
||||
</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="footer">
|
||||
<view class="btn-wrapper">
|
||||
<view class="btn-item btn-item-main" :class="{ disabled }" @click="handleSubmit()">{{ submitText }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<u-modal v-model="showLicense" title="申请协议">
|
||||
<scroll-view class="pops-content" :scroll-y="true">
|
||||
<text>{{ license }}</text>
|
||||
</scroll-view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectRegion from '@/components/select-region/select-region'
|
||||
import {
|
||||
isMobile
|
||||
} from '@/utils/verify'
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import * as UploadApi from '@/api/upload'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
// 入驻类型
|
||||
const dataType = [
|
||||
"partner", // 合伙人
|
||||
"teamer", // 团长
|
||||
"delivery", // 配送员
|
||||
"personal" // 个人商户
|
||||
]
|
||||
// 图片上传类型
|
||||
const itemProp = ["sfz", "yyzz"]
|
||||
// 图片上传名称
|
||||
const itemLabel = ["身份证", "营业执照"]
|
||||
|
||||
// 用户选择的图片列表
|
||||
const imageList = [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 100
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 100
|
||||
}
|
||||
]
|
||||
|
||||
// 表单字段元素
|
||||
const form = {
|
||||
// 入驻类型 (合伙人10001,配送员10002,社区门店10003,省代10004)
|
||||
grade_id: 10001,
|
||||
company: '',
|
||||
real_name: '',
|
||||
phone: '',
|
||||
mobile: '',
|
||||
region: [],
|
||||
detail: '',
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
real_name: [{
|
||||
required: true,
|
||||
message: '请输入您的真实姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
company: [{
|
||||
required: true,
|
||||
message: '请输入您的公司名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur', 'change']
|
||||
}, {
|
||||
// 自定义验证函数
|
||||
validator: (rule, value, callback) => {
|
||||
// 返回true表示校验通过,返回false表示不通过
|
||||
return isMobile(value)
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
// 触发器可以同时用blur和change
|
||||
trigger: ['blur'],
|
||||
}],
|
||||
region: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: ['blur', 'change'],
|
||||
type: 'array'
|
||||
}],
|
||||
detail: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
}
|
||||
|
||||
const maxImageLength = 2
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SelectRegion
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataType,
|
||||
itemProp,
|
||||
itemLabel,
|
||||
imageList,
|
||||
form,
|
||||
rules,
|
||||
// 按钮禁用
|
||||
disabled: false,
|
||||
submitText: '提交申请',
|
||||
|
||||
// 文字设置
|
||||
words: undefined,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
// 入驻协议
|
||||
license: undefined,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
this.getSetting()
|
||||
this.getData()
|
||||
},
|
||||
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 加载数据
|
||||
getData() {
|
||||
const app = this
|
||||
ApplyApi.detail().then(res => {
|
||||
const detail = res.data.detail
|
||||
// 编辑信息
|
||||
if (detail) {
|
||||
app.form = detail
|
||||
app.createFormData(detail)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 生成默认的表单数据
|
||||
createFormData(detail) {
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
form.company = detail.company
|
||||
form.phone = detail.phone
|
||||
form.region = this.createRegion(detail.shop)
|
||||
// 是否可编辑
|
||||
this.disabled = true
|
||||
// 状态
|
||||
if (form.apply_status == 10) {
|
||||
this.submitText = '待审核'
|
||||
}
|
||||
if (form.apply_status == 20) {
|
||||
this.submitText = '审核通过'
|
||||
}
|
||||
if (form.apply_status == 30) {
|
||||
this.submitText = '重新提交'
|
||||
this.disabled = false
|
||||
}
|
||||
|
||||
// 加载图片
|
||||
this.imageList = detail.images.map(d => {
|
||||
return {
|
||||
path: d.image_url,
|
||||
size: 101
|
||||
}
|
||||
})
|
||||
form.images = detail.images.map(d => {
|
||||
return d.image_id
|
||||
})
|
||||
},
|
||||
|
||||
createRegion(detail) {
|
||||
return [{
|
||||
label: detail.region.province,
|
||||
value: detail.province_id
|
||||
}, {
|
||||
label: detail.region.city,
|
||||
value: detail.city_id
|
||||
}, {
|
||||
label: detail.region.region,
|
||||
value: detail.region_id
|
||||
}]
|
||||
},
|
||||
|
||||
// 获取分销设置
|
||||
getSetting() {
|
||||
console.log("setting: ");
|
||||
const app = this
|
||||
SettingModel.data()
|
||||
.then(setting => {
|
||||
// 赋值属性
|
||||
app.words = setting.words.apply.words
|
||||
app.background = setting.background.apply
|
||||
app.license = setting.license.license
|
||||
})
|
||||
},
|
||||
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense() {
|
||||
this.showLicense = true
|
||||
},
|
||||
|
||||
// 选择图片
|
||||
chooseImage(imageIndex) {
|
||||
const app = this
|
||||
const oldImageList = app.imageList
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
// 是否可编辑
|
||||
if (form.apply_status && form.apply_status != 30) {
|
||||
app.disabled = true
|
||||
return false
|
||||
}
|
||||
// 选择图片
|
||||
uni.chooseImage({
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success({
|
||||
tempFiles
|
||||
}) {
|
||||
// 删除第imageIndex个元素,并在数组的第imageIndex个位置添加新元素:
|
||||
app.imageList.splice(imageIndex, 1, tempFiles[0])
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deleteImage(imageIndex) {
|
||||
const {
|
||||
disabled
|
||||
} = this
|
||||
if (disabled == true) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.imageList[imageIndex].path = '../../static/not-dealer.png'
|
||||
},
|
||||
|
||||
// 选择微信地址
|
||||
// #ifdef MP-WEIXIN
|
||||
chooseAddress() {
|
||||
const {
|
||||
form,
|
||||
$refs
|
||||
} = this
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
const names = $refs.sRegion.getOptionItemByNames(res)
|
||||
form.name = res.userName
|
||||
form.phone = res.telNumber
|
||||
form.detail = res.detailInfo
|
||||
form.region = names.length > 0 ? names : []
|
||||
}
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
|
||||
// 表单提交
|
||||
handleSubmit() {
|
||||
const app = this
|
||||
if (app.disabled) {
|
||||
return false
|
||||
}
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
const {
|
||||
imageList
|
||||
} = this
|
||||
app.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
app.disabled = true
|
||||
ApplyApi.checkShop(form).then(res => {
|
||||
// 判断是否需要上传图片
|
||||
if (imageList[0].size == 100 || imageList[1].size == 100) {
|
||||
app.$toast('请上传图片!')
|
||||
app.disabled = false
|
||||
return false
|
||||
}
|
||||
if (imageList.length > 0 && imageList[0].size != 101) {
|
||||
app.uploadFile()
|
||||
.then(() => app.onSubmit())
|
||||
.catch(err => {
|
||||
app.disabled = false
|
||||
if (err.statusCode !== 0) {
|
||||
app.$toast(err.errMsg)
|
||||
}
|
||||
console.log('err', err)
|
||||
})
|
||||
} else {
|
||||
app.onSubmit()
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("err: ", err);
|
||||
if (err.statusCode == 0) {
|
||||
app.disabled = false
|
||||
app.$toast(err.errMsg)
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
uploadFile() {
|
||||
const app = this
|
||||
const {
|
||||
imageList,
|
||||
form
|
||||
} = app
|
||||
// 批量上传
|
||||
return new Promise((resolve, reject) => {
|
||||
if (imageList.length > 0) {
|
||||
UploadApi.image(imageList)
|
||||
.then(fileIds => {
|
||||
form.images = fileIds
|
||||
resolve(fileIds)
|
||||
})
|
||||
.catch(reject)
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 提交到后端
|
||||
onSubmit() {
|
||||
const app = this
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
let req;
|
||||
if (form.apply_status == 30) {
|
||||
req = ApplyApi.edit(form.apply_id, form)
|
||||
} else {
|
||||
req = ApplyApi.add(form)
|
||||
}
|
||||
req.then(result => {
|
||||
console.log("result: ", result);
|
||||
app.$toast(result.message)
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
|
||||
})
|
||||
.finally(() => app.disabled = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background: #f7f8fa;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.page-title {
|
||||
width: 94%;
|
||||
margin: 0 auto;
|
||||
padding-top: 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(69, 90, 100, 0.6);
|
||||
}
|
||||
|
||||
.form-wrapper {
|
||||
margin: 20rpx auto 20rpx auto;
|
||||
padding: 0 40rpx;
|
||||
width: 94%;
|
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* 底部操作栏 */
|
||||
|
||||
.footer {
|
||||
margin-top: 80rpx;
|
||||
|
||||
.btn-wrapper {
|
||||
height: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.btn-item {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
height: 86rpx;
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-item-wechat {
|
||||
background: #0ba90b;
|
||||
margin-bottom: 26rpx;
|
||||
}
|
||||
|
||||
.btn-item-main {
|
||||
background: linear-gradient(to right, $main-bg, $main-bg2);
|
||||
|
||||
// 禁用按钮
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 上传凭证
|
||||
.row-voucher {
|
||||
padding: 24rpx 20rpx;
|
||||
|
||||
.image-list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: -20rpx;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-picker,
|
||||
.image-preview {
|
||||
width: 184rpx;
|
||||
height: 184rpx;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
float: left;
|
||||
|
||||
&:nth-child(3n+0) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.image-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1rpx dashed #ccc;
|
||||
color: #ccc;
|
||||
|
||||
.choose-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.choose-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -15rpx;
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
background: rgba(0, 0, 0, 0.64);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-weight: bolder;
|
||||
font-size: 22rpx;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-license {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.sfz,
|
||||
.sfz1,
|
||||
.sfz2,
|
||||
.yyzz {
|
||||
width: 140rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
</style>
|
||||
327
package/apply/components/partner.vue
Executable file
327
package/apply/components/partner.vue
Executable file
@@ -0,0 +1,327 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 表单组件 -->
|
||||
<view class="form-wrapper" :style="appThemeStyle">
|
||||
{{form.imageList}}{{form.license}}
|
||||
<u-form :model="form" ref="uForm" label-width="140rpx">
|
||||
<!-- {{JSON.stringify(setting)}} -->
|
||||
<u-form-item label="所在地区" prop="region">
|
||||
<select-region ref="sRegion" :disabled="disabled" v-model="form.region" />
|
||||
</u-form-item>
|
||||
<u-form-item label="公司名称" prop="company">
|
||||
<u-input v-model="form.company" :disabled="disabled" placeholder="请输入公司名称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="联系电话" prop="phone">
|
||||
<u-input v-model="form.phone" :disabled="disabled" placeholder="请输入联系电话" />
|
||||
</u-form-item>
|
||||
<u-form-item label="姓名" prop="real_name">
|
||||
<u-input v-model="form.real_name" :disabled="disabled" placeholder="请输入商户姓名" />
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" prop="mobile">
|
||||
<u-input v-model="form.mobile" maxlength="11" :disabled="disabled" placeholder="请输入商户手机号" />
|
||||
</u-form-item>
|
||||
<u-form-item v-for="(item,imageIndex) in imageList" :key="imageIndex" :label="form.itemLabel[imageIndex]"
|
||||
:prop="form.imageProp[imageIndex]">
|
||||
<view class="image-preview">
|
||||
<image mode="widthFix" :src="item.path" class="sfz" @click="chooseImage(imageIndex)"></image>
|
||||
<text class="image-delete iconfont icon-shanchu" @click="deleteImage(imageIndex)"></text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<view class="form-license dis-flex flex-x-center flex-y-center">
|
||||
<view class="license-radio dis-flex flex-y-center" @click="isRead = !isRead">
|
||||
<text class="license-icon f-38 iconfont icon-radio"
|
||||
:class="[isRead ? 'c-violet' : 'col-bb']"></text>
|
||||
<text class="f-28 col-80">我已阅读并了解</text>
|
||||
</view>
|
||||
<text @click="handleShowLicense()"
|
||||
class="f-28 c-violet">【{{ form.licenseTitle }}】</text>
|
||||
</view>
|
||||
</u-form>
|
||||
</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="footer">
|
||||
<view class="btn-wrapper">
|
||||
<view class="btn-item btn-item-main" :class="{ disabled }" @click="handleSubmit()">{{ form.submitText }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectRegion from '@/components/select-region/select-region'
|
||||
import {
|
||||
isMobile
|
||||
} from '@/utils/verify'
|
||||
import Empty from '@/components/empty'
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
real_name: [{
|
||||
required: true,
|
||||
message: '请输入您的真实姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
company: [{
|
||||
required: true,
|
||||
message: '请输入您的公司名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur', 'change']
|
||||
}, {
|
||||
// 自定义验证函数
|
||||
validator: (rule, value, callback) => {
|
||||
// 返回true表示校验通过,返回false表示不通过
|
||||
return isMobile(value)
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
// 触发器可以同时用blur和change
|
||||
trigger: ['blur'],
|
||||
}],
|
||||
region: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: ['blur', 'change'],
|
||||
type: 'array'
|
||||
}],
|
||||
detail: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
}
|
||||
|
||||
const maxImageLength = 2
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Empty
|
||||
},
|
||||
props: {
|
||||
form: {
|
||||
type: Object,
|
||||
default: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
rules,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
methods: {
|
||||
// 选择图片
|
||||
chooseImage(imageIndex) {
|
||||
const app = this
|
||||
const oldImageList = app.imageList
|
||||
const { form } = this
|
||||
// 是否可编辑
|
||||
if (form.apply_status && form.apply_status != 30) {
|
||||
return false
|
||||
}
|
||||
// 选择图片
|
||||
uni.chooseImage({
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success({
|
||||
tempFiles
|
||||
}) {
|
||||
// 传递给父级
|
||||
app.$emit('chooseImage',imageIndex,tempFiles[0])
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deleteImage(imageIndex) {
|
||||
// 传递给父级
|
||||
this.$emit('deleteImage', imageIndex)
|
||||
|
||||
},
|
||||
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense() {
|
||||
this.$emit('showLicense',true)
|
||||
this.showLicense = true
|
||||
},
|
||||
|
||||
// 表单提交
|
||||
handleSubmit() {
|
||||
const app = this
|
||||
const { form, imageList } = this
|
||||
// 判断是否需要上传图片
|
||||
if (imageList[0].size == 100 || imageList[1].size == 100 || imageList[2].size == 100) {
|
||||
app.$toast('请上传图片!')
|
||||
return false
|
||||
}
|
||||
app.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
// 传递给父级
|
||||
app.$emit('handleSubmit', form, imageList)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.form-wrapper {
|
||||
margin: 20rpx auto 20rpx auto;
|
||||
padding: 0 40rpx;
|
||||
width: 94%;
|
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.form-license {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
// 上传凭证
|
||||
.row-voucher {
|
||||
padding: 24rpx 20rpx;
|
||||
|
||||
.image-list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: -20rpx;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-picker,
|
||||
.image-preview {
|
||||
width: 184rpx;
|
||||
height: 184rpx;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
float: left;
|
||||
|
||||
&:nth-child(3n+0) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.image-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1rpx dashed #ccc;
|
||||
color: #ccc;
|
||||
|
||||
.choose-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.choose-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -15rpx;
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
background: rgba(0, 0, 0, 0.64);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-weight: bolder;
|
||||
font-size: 22rpx;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pops-content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.sfz,
|
||||
.sfz1,
|
||||
.sfz2,
|
||||
.yyzz {
|
||||
width: 140rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
|
||||
/* 底部操作栏 */
|
||||
|
||||
.footer {
|
||||
margin-top: 80rpx;
|
||||
|
||||
.btn-wrapper {
|
||||
height: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.btn-item {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
height: 86rpx;
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-item-wechat {
|
||||
background: #0ba90b;
|
||||
margin-bottom: 26rpx;
|
||||
}
|
||||
|
||||
.btn-item-main {
|
||||
background: linear-gradient(to right, $main-bg, $main-bg2);
|
||||
|
||||
// 禁用按钮
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
412
package/apply/components/personal.vue
Normal file
412
package/apply/components/personal.vue
Normal file
@@ -0,0 +1,412 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 表单组件 -->
|
||||
<view class="form-wrapper" :style="appThemeStyle">
|
||||
<u-form :model="form" ref="uForm" label-width="140rpx">
|
||||
<!-- {{JSON.stringify(setting)}} -->
|
||||
<u-form-item label="所在地区" prop="region">
|
||||
<select-region ref="sRegion" :disabled="disabled" v-model="form.region" />
|
||||
</u-form-item>
|
||||
<u-form-item label="公司名称" prop="company">
|
||||
<u-input v-model="form.company" :disabled="disabled" placeholder="请输入公司名称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="联系电话" prop="phone">
|
||||
<u-input v-model="form.phone" :disabled="disabled" placeholder="请输入联系电话" />
|
||||
</u-form-item>
|
||||
<u-form-item label="姓名" prop="real_name">
|
||||
<u-input v-model="form.real_name" :disabled="disabled" placeholder="请输入商户姓名" />
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" prop="mobile">
|
||||
<u-input v-model="form.mobile" maxlength="11" :disabled="disabled" placeholder="请输入商户手机号" />
|
||||
</u-form-item>
|
||||
<Partner :form="form"></Partner>
|
||||
<u-form-item v-for="(item,imageIndex) in imageList" :key="imageIndex" :label="itemLabel[imageIndex]"
|
||||
:prop="itemProp[imageIndex]">
|
||||
<view class="image-preview">
|
||||
<image mode="widthFix" :src="item.path" class="sfz" @click="chooseImage(imageIndex)"></image>
|
||||
<text class="image-delete iconfont icon-shanchu" @click="deleteImage(imageIndex)"></text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<view class="form-license dis-flex flex-x-center flex-y-center">
|
||||
<view class="license-radio dis-flex flex-y-center" @click="isRead = !isRead">
|
||||
<text class="license-icon f-38 iconfont icon-radio"
|
||||
:class="[isRead ? 'c-violet' : 'col-bb']"></text>
|
||||
<text class="f-28 col-80">我已阅读并了解</text>
|
||||
</view>
|
||||
<text @click="handleShowLicense()"
|
||||
class="f-28 c-violet">【{{ setting.words.apply.words.license.value }}】</text>
|
||||
</view>
|
||||
</u-form>
|
||||
</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="footer">
|
||||
<view class="btn-wrapper">
|
||||
<view class="btn-item btn-item-main" :class="{ disabled }" @click="handleSubmit()">{{ submitText }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<u-modal v-model="showLicense" title="入驻协议">
|
||||
<scroll-view class="pops-content" :scroll-y="true">
|
||||
<text>{{ setting.license }}</text>
|
||||
</scroll-view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectRegion from '@/components/select-region/select-region'
|
||||
import {
|
||||
isMobile
|
||||
} from '@/utils/verify'
|
||||
import Empty from '@/components/empty'
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
|
||||
// 图片上传类型
|
||||
const itemProp = ["sfz1", "sfz2", "yyzz"]
|
||||
// 图片上传名称
|
||||
const itemLabel = ["身份证(正)", "身份证(反)", "营业执照"]
|
||||
// 用户选择的图片列表
|
||||
const imageList = [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 100
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 100
|
||||
}
|
||||
]
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
real_name: [{
|
||||
required: true,
|
||||
message: '请输入您的真实姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
company: [{
|
||||
required: true,
|
||||
message: '请输入您的公司名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur', 'change']
|
||||
}, {
|
||||
// 自定义验证函数
|
||||
validator: (rule, value, callback) => {
|
||||
// 返回true表示校验通过,返回false表示不通过
|
||||
return isMobile(value)
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
// 触发器可以同时用blur和change
|
||||
trigger: ['blur'],
|
||||
}],
|
||||
region: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: ['blur', 'change'],
|
||||
type: 'array'
|
||||
}],
|
||||
detail: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
}
|
||||
|
||||
const maxImageLength = 2
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Empty
|
||||
},
|
||||
props: {
|
||||
form: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
setting: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
imageList: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
submitText: {
|
||||
type: String,
|
||||
default: '提交申请'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
itemProp,
|
||||
itemLabel,
|
||||
rules,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
methods: {
|
||||
// 选择图片
|
||||
chooseImage(imageIndex) {
|
||||
const app = this
|
||||
const oldImageList = app.imageList
|
||||
const { form } = this
|
||||
// 是否可编辑
|
||||
if (form.apply_status && form.apply_status != 30) {
|
||||
return false
|
||||
}
|
||||
// 选择图片
|
||||
uni.chooseImage({
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success({
|
||||
tempFiles
|
||||
}) {
|
||||
// 删除第imageIndex个元素,并在数组的第imageIndex个位置添加新元素:
|
||||
app.imageList.splice(imageIndex, 1, tempFiles[0])
|
||||
}
|
||||
});
|
||||
// 传递给父级
|
||||
this.$emit('chooseImage',app.imageList)
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deleteImage(imageIndex) {
|
||||
const { disabled } = this
|
||||
if (disabled == true) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.imageList[imageIndex].path = '../../static/not-dealer.png'
|
||||
},
|
||||
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense() {
|
||||
this.showLicense = true
|
||||
},
|
||||
|
||||
|
||||
// 表单提交
|
||||
handleSubmit() {
|
||||
const app = this
|
||||
const { form } = this
|
||||
app.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
// 传递给父级
|
||||
app.$emit('handleSubmit', form)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
uploadFile() {
|
||||
const app = this
|
||||
const {
|
||||
imageList,
|
||||
form
|
||||
} = app
|
||||
// 批量上传
|
||||
return new Promise((resolve, reject) => {
|
||||
if (imageList.length > 0) {
|
||||
UploadApi.image(imageList)
|
||||
.then(fileIds => {
|
||||
form.images = fileIds
|
||||
resolve(fileIds)
|
||||
})
|
||||
.catch(reject)
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 提交到后端
|
||||
onSubmit() {
|
||||
const app = this
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
let req;
|
||||
if (form.apply_status == 30) {
|
||||
req = ApplyApi.edit(form.apply_id, form)
|
||||
} else {
|
||||
req = ApplyApi.add(form)
|
||||
}
|
||||
req.then(result => {
|
||||
console.log("result: ", result);
|
||||
app.$toast(result.message)
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
|
||||
})
|
||||
.finally(() => app.disabled = false)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.form-wrapper {
|
||||
margin: 20rpx auto 20rpx auto;
|
||||
padding: 0 40rpx;
|
||||
width: 94%;
|
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.form-license {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
// 上传凭证
|
||||
.row-voucher {
|
||||
padding: 24rpx 20rpx;
|
||||
|
||||
.image-list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: -20rpx;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-picker,
|
||||
.image-preview {
|
||||
width: 184rpx;
|
||||
height: 184rpx;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
float: left;
|
||||
|
||||
&:nth-child(3n+0) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.image-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1rpx dashed #ccc;
|
||||
color: #ccc;
|
||||
|
||||
.choose-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.choose-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -15rpx;
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
background: rgba(0, 0, 0, 0.64);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-weight: bolder;
|
||||
font-size: 22rpx;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pops-content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.sfz,
|
||||
.sfz1,
|
||||
.sfz2,
|
||||
.yyzz {
|
||||
width: 140rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
|
||||
/* 底部操作栏 */
|
||||
|
||||
.footer {
|
||||
margin-top: 80rpx;
|
||||
|
||||
.btn-wrapper {
|
||||
height: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.btn-item {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
height: 86rpx;
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-item-wechat {
|
||||
background: #0ba90b;
|
||||
margin-bottom: 26rpx;
|
||||
}
|
||||
|
||||
.btn-item-main {
|
||||
background: linear-gradient(to right, $main-bg, $main-bg2);
|
||||
|
||||
// 禁用按钮
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
412
package/apply/components/teamer.vue
Executable file
412
package/apply/components/teamer.vue
Executable file
@@ -0,0 +1,412 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 表单组件 -->
|
||||
<view class="form-wrapper" :style="appThemeStyle">
|
||||
<u-form :model="form" ref="uForm" label-width="140rpx">
|
||||
<!-- {{JSON.stringify(setting)}} -->
|
||||
<u-form-item label="所在地区" prop="region">
|
||||
<select-region ref="sRegion" :disabled="disabled" v-model="form.region" />
|
||||
</u-form-item>
|
||||
<u-form-item label="公司名称" prop="company">
|
||||
<u-input v-model="form.company" :disabled="disabled" placeholder="请输入公司名称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="联系电话" prop="phone">
|
||||
<u-input v-model="form.phone" :disabled="disabled" placeholder="请输入联系电话" />
|
||||
</u-form-item>
|
||||
<u-form-item label="姓名" prop="real_name">
|
||||
<u-input v-model="form.real_name" :disabled="disabled" placeholder="请输入商户姓名" />
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" prop="mobile">
|
||||
<u-input v-model="form.mobile" maxlength="11" :disabled="disabled" placeholder="请输入商户手机号" />
|
||||
</u-form-item>
|
||||
<Partner :form="form"></Partner>
|
||||
<u-form-item v-for="(item,imageIndex) in imageList" :key="imageIndex" :label="itemLabel[imageIndex]"
|
||||
:prop="itemProp[imageIndex]">
|
||||
<view class="image-preview">
|
||||
<image mode="widthFix" :src="item.path" class="sfz" @click="chooseImage(imageIndex)"></image>
|
||||
<text class="image-delete iconfont icon-shanchu" @click="deleteImage(imageIndex)"></text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<view class="form-license dis-flex flex-x-center flex-y-center">
|
||||
<view class="license-radio dis-flex flex-y-center" @click="isRead = !isRead">
|
||||
<text class="license-icon f-38 iconfont icon-radio"
|
||||
:class="[isRead ? 'c-violet' : 'col-bb']"></text>
|
||||
<text class="f-28 col-80">我已阅读并了解</text>
|
||||
</view>
|
||||
<text @click="handleShowLicense()"
|
||||
class="f-28 c-violet">【{{ setting.words.apply.words.license.value }}】</text>
|
||||
</view>
|
||||
</u-form>
|
||||
</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="footer">
|
||||
<view class="btn-wrapper">
|
||||
<view class="btn-item btn-item-main" :class="{ disabled }" @click="handleSubmit()">{{ submitText }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<u-modal v-model="showLicense" title="入驻协议">
|
||||
<scroll-view class="pops-content" :scroll-y="true">
|
||||
<text>{{ setting.license }}</text>
|
||||
</scroll-view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectRegion from '@/components/select-region/select-region'
|
||||
import {
|
||||
isMobile
|
||||
} from '@/utils/verify'
|
||||
import Empty from '@/components/empty'
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
|
||||
// 图片上传类型
|
||||
const itemProp = ["sfz1", "sfz2", "yyzz"]
|
||||
// 图片上传名称
|
||||
const itemLabel = ["身份证(正)", "身份证(反)", "营业执照"]
|
||||
// 用户选择的图片列表
|
||||
const imageList = [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 100
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 100
|
||||
}
|
||||
]
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
real_name: [{
|
||||
required: true,
|
||||
message: '请输入您的真实姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
company: [{
|
||||
required: true,
|
||||
message: '请输入您的公司名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur', 'change']
|
||||
}, {
|
||||
// 自定义验证函数
|
||||
validator: (rule, value, callback) => {
|
||||
// 返回true表示校验通过,返回false表示不通过
|
||||
return isMobile(value)
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
// 触发器可以同时用blur和change
|
||||
trigger: ['blur'],
|
||||
}],
|
||||
region: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: ['blur', 'change'],
|
||||
type: 'array'
|
||||
}],
|
||||
detail: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
}
|
||||
|
||||
const maxImageLength = 2
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
Empty
|
||||
},
|
||||
props: {
|
||||
form: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
setting: {
|
||||
type: Object,
|
||||
default: null
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
imageList: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
submitText: {
|
||||
type: String,
|
||||
default: '提交申请'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
itemProp,
|
||||
itemLabel,
|
||||
rules,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
}
|
||||
},
|
||||
created() {},
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
methods: {
|
||||
// 选择图片
|
||||
chooseImage(imageIndex) {
|
||||
const app = this
|
||||
const oldImageList = app.imageList
|
||||
const { form } = this
|
||||
// 是否可编辑
|
||||
if (form.apply_status && form.apply_status != 30) {
|
||||
return false
|
||||
}
|
||||
// 选择图片
|
||||
uni.chooseImage({
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success({
|
||||
tempFiles
|
||||
}) {
|
||||
// 删除第imageIndex个元素,并在数组的第imageIndex个位置添加新元素:
|
||||
app.imageList.splice(imageIndex, 1, tempFiles[0])
|
||||
}
|
||||
});
|
||||
// 传递给父级
|
||||
this.$emit('chooseImage',app.imageList)
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deleteImage(imageIndex) {
|
||||
const { disabled } = this
|
||||
if (disabled == true) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.imageList[imageIndex].path = '../../static/not-dealer.png'
|
||||
},
|
||||
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense() {
|
||||
this.showLicense = true
|
||||
},
|
||||
|
||||
|
||||
// 表单提交
|
||||
handleSubmit() {
|
||||
const app = this
|
||||
const { form } = this
|
||||
app.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
// 传递给父级
|
||||
app.$emit('handleSubmit', form)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
uploadFile() {
|
||||
const app = this
|
||||
const {
|
||||
imageList,
|
||||
form
|
||||
} = app
|
||||
// 批量上传
|
||||
return new Promise((resolve, reject) => {
|
||||
if (imageList.length > 0) {
|
||||
UploadApi.image(imageList)
|
||||
.then(fileIds => {
|
||||
form.images = fileIds
|
||||
resolve(fileIds)
|
||||
})
|
||||
.catch(reject)
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 提交到后端
|
||||
onSubmit() {
|
||||
const app = this
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
let req;
|
||||
if (form.apply_status == 30) {
|
||||
req = ApplyApi.edit(form.apply_id, form)
|
||||
} else {
|
||||
req = ApplyApi.add(form)
|
||||
}
|
||||
req.then(result => {
|
||||
console.log("result: ", result);
|
||||
app.$toast(result.message)
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
|
||||
})
|
||||
.finally(() => app.disabled = false)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
|
||||
.form-wrapper {
|
||||
margin: 20rpx auto 20rpx auto;
|
||||
padding: 0 40rpx;
|
||||
width: 94%;
|
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
}
|
||||
.form-license {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
// 上传凭证
|
||||
.row-voucher {
|
||||
padding: 24rpx 20rpx;
|
||||
|
||||
.image-list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: -20rpx;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-picker,
|
||||
.image-preview {
|
||||
width: 184rpx;
|
||||
height: 184rpx;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
float: left;
|
||||
|
||||
&:nth-child(3n+0) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.image-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1rpx dashed #ccc;
|
||||
color: #ccc;
|
||||
|
||||
.choose-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.choose-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -15rpx;
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
background: rgba(0, 0, 0, 0.64);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-weight: bolder;
|
||||
font-size: 22rpx;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pops-content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.sfz,
|
||||
.sfz1,
|
||||
.sfz2,
|
||||
.yyzz {
|
||||
width: 140rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
|
||||
/* 底部操作栏 */
|
||||
|
||||
.footer {
|
||||
margin-top: 80rpx;
|
||||
|
||||
.btn-wrapper {
|
||||
height: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.btn-item {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
height: 86rpx;
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-item-wechat {
|
||||
background: #0ba90b;
|
||||
margin-bottom: 26rpx;
|
||||
}
|
||||
|
||||
.btn-item-main {
|
||||
background: linear-gradient(to right, $main-bg, $main-bg2);
|
||||
|
||||
// 禁用按钮
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
595
package/apply/delivery.vue
Normal file
595
package/apply/delivery.vue
Normal file
@@ -0,0 +1,595 @@
|
||||
<template>
|
||||
<view class="container" :style="appThemeStyle">
|
||||
<!-- 标题 -->
|
||||
<view class="page-title">申请入驻</view>
|
||||
<!-- 表单组件 -->
|
||||
<view class="form-wrapper">
|
||||
<u-form :model="form" ref="uForm" label-width="140rpx">
|
||||
<u-form-item label="意向配送区域" prop="region">
|
||||
<select-region ref="sRegion" :disabled="disabled" v-model="form.region" />
|
||||
</u-form-item>
|
||||
<u-form-item label="姓名" prop="real_name">
|
||||
<u-input v-model="form.real_name" :disabled="disabled" placeholder="请输入商户姓名" />
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" prop="mobile">
|
||||
<u-input v-model="form.mobile" maxlength="11" :disabled="disabled" placeholder="请输入商户手机号" />
|
||||
</u-form-item>
|
||||
<u-form-item v-for="(item,imageIndex) in imageList" :key="imageIndex" :label="itemLabel[imageIndex]"
|
||||
:prop="itemProp[imageIndex]">
|
||||
<view class="image-preview">
|
||||
<image mode="widthFix" :src="item.path" class="sfz" @click="chooseImage(imageIndex)"></image>
|
||||
<text class="image-delete iconfont icon-shanchu" @click="deleteImage(imageIndex)"></text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<view class="form-license dis-flex flex-x-center flex-y-center">
|
||||
<view class="license-radio dis-flex flex-y-center" @click="isRead = !isRead">
|
||||
<text class="license-icon f-38 iconfont icon-radio"
|
||||
:class="[isRead ? 'c-violet' : 'col-bb']"></text>
|
||||
<text class="f-28 col-80">我已阅读并了解</text>
|
||||
</view>
|
||||
<text @click="handleShowLicense()" class="f-28 c-violet">【{{ words.license.value }}】</text>
|
||||
</view>
|
||||
</u-form>
|
||||
</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="footer">
|
||||
<view class="btn-wrapper">
|
||||
<view class="btn-item btn-item-main" :class="{ disabled }" @click="handleSubmit()">{{ submitText }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<u-modal v-model="showLicense" title="申请协议">
|
||||
<scroll-view class="pops-content" :scroll-y="true">
|
||||
<text>{{ license }}</text>
|
||||
</scroll-view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectRegion from '@/components/select-region/select-region'
|
||||
import {
|
||||
isMobile
|
||||
} from '@/utils/verify'
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import * as UploadApi from '@/api/upload'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
// 入驻类型
|
||||
const dataType = [
|
||||
"partner", // 商家
|
||||
"teamer", // 团长
|
||||
"delivery", // 配送员
|
||||
"personal" // 个人商户
|
||||
]
|
||||
// 图片上传类型
|
||||
const itemProp = ["sfz1", "sfz2"]
|
||||
// 图片上传名称
|
||||
const itemLabel = ["身份证(正)", "身份证(反)"]
|
||||
|
||||
// 用户选择的图片列表
|
||||
const imageList = [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
}
|
||||
]
|
||||
|
||||
// 表单字段元素
|
||||
const form = {
|
||||
// 入驻类型 (商家10001,配送员10002,社区门店10003,省代10004)
|
||||
grade_id: 10002,
|
||||
company: '',
|
||||
real_name: '',
|
||||
phone: '',
|
||||
mobile: '',
|
||||
region: [],
|
||||
detail: '',
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
real_name: [{
|
||||
required: true,
|
||||
message: '请输入您的真实姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
company: [{
|
||||
required: true,
|
||||
message: '请输入您的公司名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur', 'change']
|
||||
}, {
|
||||
// 自定义验证函数
|
||||
validator: (rule, value, callback) => {
|
||||
// 返回true表示校验通过,返回false表示不通过
|
||||
return isMobile(value)
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
// 触发器可以同时用blur和change
|
||||
trigger: ['blur'],
|
||||
}],
|
||||
region: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: ['blur', 'change'],
|
||||
type: 'array'
|
||||
}],
|
||||
detail: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
}
|
||||
|
||||
const maxImageLength = 2
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SelectRegion
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataType,
|
||||
itemProp,
|
||||
itemLabel,
|
||||
imageList,
|
||||
form,
|
||||
rules,
|
||||
// 按钮禁用
|
||||
disabled: false,
|
||||
submitText: '提交申请',
|
||||
|
||||
// 文字设置
|
||||
words: undefined,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
// 入驻协议
|
||||
license: undefined,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const app = this
|
||||
app.getSetting()
|
||||
// 获取用户坐标及当前入驻申请记录
|
||||
app.getLocation((res) => {
|
||||
app.getData(res.longitude, res.latitude)
|
||||
})
|
||||
},
|
||||
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 获取用户坐标
|
||||
// 参考文档:https://uniapp.dcloud.io/api/location/location?id=getlocation
|
||||
getLocation(callback) {
|
||||
const app = this
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: callback,
|
||||
fail() {
|
||||
app.$toast('获取定位失败,请点击右下角按钮重新尝试定位')
|
||||
app.isAuthor = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 加载数据
|
||||
getData(longitude,latitude) {
|
||||
const app = this
|
||||
console.log("long: ",longitude);
|
||||
app.form.longitude = longitude
|
||||
app.form.latitude = latitude
|
||||
ApplyApi.detail().then(res => {
|
||||
const detail = res.data.detail
|
||||
console.log(detail);
|
||||
// 编辑信息
|
||||
if (detail) {
|
||||
app.form = detail
|
||||
app.createFormData(detail)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 生成默认的表单数据
|
||||
createFormData(detail) {
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
form.company = detail.company
|
||||
form.phone = detail.phone
|
||||
form.region = this.createRegion(detail.shop)
|
||||
// 是否可编辑
|
||||
this.disabled = true
|
||||
// 状态
|
||||
if (form.apply_status == 10) {
|
||||
this.submitText = '待审核'
|
||||
}
|
||||
if (form.apply_status == 20) {
|
||||
this.submitText = '审核通过'
|
||||
}
|
||||
if (form.apply_status == 30) {
|
||||
this.submitText = '重新提交'
|
||||
this.disabled = false
|
||||
}
|
||||
|
||||
// 加载图片
|
||||
this.imageList = detail.images.map(d => {
|
||||
return {
|
||||
path: d.image_url,
|
||||
size: 101
|
||||
}
|
||||
})
|
||||
form.images = detail.images.map(d => {
|
||||
return d.image_id
|
||||
})
|
||||
},
|
||||
|
||||
createRegion(detail) {
|
||||
return [{
|
||||
label: detail.region.province,
|
||||
value: detail.province_id
|
||||
}, {
|
||||
label: detail.region.city,
|
||||
value: detail.city_id
|
||||
}, {
|
||||
label: detail.region.region,
|
||||
value: detail.region_id
|
||||
}]
|
||||
},
|
||||
|
||||
// 获取分销设置
|
||||
getSetting() {
|
||||
const app = this
|
||||
SettingModel.data()
|
||||
.then(setting => {
|
||||
// 赋值属性
|
||||
app.words = setting.words.apply.words
|
||||
app.background = setting.background.apply
|
||||
app.license = setting.license.license
|
||||
// 设置当前页面标题
|
||||
app.setPageTitle(setting.words.apply.title)
|
||||
})
|
||||
},
|
||||
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense() {
|
||||
this.showLicense = true
|
||||
},
|
||||
|
||||
// 设置当前页面标题
|
||||
setPageTitle(title) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '申请成为配送员'
|
||||
})
|
||||
},
|
||||
|
||||
// 选择图片
|
||||
chooseImage(imageIndex) {
|
||||
const app = this
|
||||
const oldImageList = app.imageList
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
// 是否可编辑
|
||||
if (form.apply_status && form.apply_status != 30) {
|
||||
app.disabled = true
|
||||
return false
|
||||
}
|
||||
// 选择图片
|
||||
uni.chooseImage({
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success({
|
||||
tempFiles
|
||||
}) {
|
||||
// 删除第imageIndex个元素,并在数组的第imageIndex个位置添加新元素:
|
||||
app.imageList.splice(imageIndex, 1, tempFiles[0])
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deleteImage(imageIndex) {
|
||||
const {
|
||||
disabled
|
||||
} = this
|
||||
if (disabled == true) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.imageList[imageIndex].path = '../../static/not-dealer.png'
|
||||
},
|
||||
|
||||
// 选择微信地址
|
||||
// #ifdef MP-WEIXIN
|
||||
chooseAddress() {
|
||||
const {
|
||||
form,
|
||||
$refs
|
||||
} = this
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
const names = $refs.sRegion.getOptionItemByNames(res)
|
||||
form.name = res.userName
|
||||
form.phone = res.telNumber
|
||||
form.detail = res.detailInfo
|
||||
form.region = names.length > 0 ? names : []
|
||||
}
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
|
||||
// 表单提交
|
||||
handleSubmit() {
|
||||
const app = this
|
||||
console.log(app.disabled);
|
||||
if (app.disabled) {
|
||||
return false
|
||||
}
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
const {
|
||||
imageList
|
||||
} = this
|
||||
app.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
app.disabled = true
|
||||
ApplyApi.checkAvailable(form).then(res => {
|
||||
// 判断是否需要上传图片
|
||||
if (imageList[0].size == 0 || imageList[1].size == 0) {
|
||||
app.$toast('请上传图片!')
|
||||
app.disabled = false
|
||||
return false
|
||||
}
|
||||
if (imageList.length > 0 && imageList[0].size > 0) {
|
||||
app.uploadFile()
|
||||
.then(() => app.onSubmit())
|
||||
.catch(err => {
|
||||
app.disabled = false
|
||||
if (err.statusCode !== 0) {
|
||||
app.$toast(err.errMsg)
|
||||
}
|
||||
console.log('err', err)
|
||||
})
|
||||
} else {
|
||||
app.onSubmit()
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("err: ", err);
|
||||
if (err.statusCode == 0) {
|
||||
app.disabled = false
|
||||
app.$toast(err.errMsg)
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
uploadFile() {
|
||||
const app = this
|
||||
const {
|
||||
imageList,
|
||||
form
|
||||
} = app
|
||||
// 批量上传
|
||||
return new Promise((resolve, reject) => {
|
||||
if (imageList.length > 0) {
|
||||
UploadApi.image(imageList)
|
||||
.then(fileIds => {
|
||||
form.images = fileIds
|
||||
resolve(fileIds)
|
||||
})
|
||||
.catch(reject)
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 提交到后端
|
||||
onSubmit() {
|
||||
const app = this
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
let req;
|
||||
if (form.apply_status == 30) {
|
||||
req = ApplyApi.edit(form.apply_id, form)
|
||||
} else {
|
||||
req = ApplyApi.add(form)
|
||||
}
|
||||
req.then(result => {
|
||||
console.log("result: ", result);
|
||||
app.$toast(result.message)
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
|
||||
})
|
||||
.finally(() => app.disabled = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background: #f7f8fa;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.page-title {
|
||||
width: 94%;
|
||||
margin: 0 auto;
|
||||
padding-top: 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(69, 90, 100, 0.6);
|
||||
}
|
||||
|
||||
.form-wrapper {
|
||||
margin: 20rpx auto 20rpx auto;
|
||||
padding: 0 40rpx;
|
||||
width: 94%;
|
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* 底部操作栏 */
|
||||
|
||||
.footer {
|
||||
margin-top: 80rpx;
|
||||
|
||||
.btn-wrapper {
|
||||
height: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.btn-item {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
height: 86rpx;
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-item-wechat {
|
||||
background: #0ba90b;
|
||||
margin-bottom: 26rpx;
|
||||
}
|
||||
|
||||
.btn-item-main {
|
||||
background: linear-gradient(to right, $main-bg, $main-bg2);
|
||||
|
||||
// 禁用按钮
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 上传凭证
|
||||
.row-voucher {
|
||||
padding: 24rpx 20rpx;
|
||||
|
||||
.image-list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: -20rpx;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-picker,
|
||||
.image-preview {
|
||||
width: 184rpx;
|
||||
height: 184rpx;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
float: left;
|
||||
|
||||
&:nth-child(3n+0) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.image-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1rpx dashed #ccc;
|
||||
color: #ccc;
|
||||
|
||||
.choose-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.choose-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -15rpx;
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
background: rgba(0, 0, 0, 0.64);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-weight: bolder;
|
||||
font-size: 22rpx;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-license {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.pops-content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.sfz,
|
||||
.sfz1,
|
||||
.sfz2,
|
||||
.yyzz {
|
||||
width: 140rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
</style>
|
||||
625
package/apply/index.vue
Normal file
625
package/apply/index.vue
Normal file
@@ -0,0 +1,625 @@
|
||||
<template>
|
||||
<view class="container" :style="appThemeStyle">
|
||||
<view class="reject" v-if="form.apply_status == 10">
|
||||
<u-alert-tips type="error" title="申请已提交:" description="请耐心等待工作人员的审核"></u-alert-tips>
|
||||
</view>
|
||||
<view class="reject" v-else-if="form.apply_status == 30">
|
||||
<u-alert-tips type="error" title="您的申请已被驳回:" :description="form.reject_reason"></u-alert-tips>
|
||||
</view>
|
||||
<u-form :model="form" ref="uForm" label-width="140rpx">
|
||||
<!-- 标题 -->
|
||||
<view class="page-title">基本信息</view>
|
||||
<view class="form-wrapper">
|
||||
<u-form-item label="站点名称" prop="company">
|
||||
<u-input v-model="form.company" :disabled="disabled" placeholder="请输入站点名称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="门脸照" prop="shopImage">
|
||||
<u-upload ref="shopImage" :fileList="fileList1" :action="action" :header="headers"
|
||||
@delete="deletePic" index="1" name="file" :maxCount="1" @afterRead="afterRead">
|
||||
</u-upload>
|
||||
</u-form-item>
|
||||
</view>
|
||||
<!-- 标题 -->
|
||||
<view class="page-title">经营信息</view>
|
||||
<!-- 表单组件 -->
|
||||
<view class="form-wrapper">
|
||||
<u-form-item label="所在地区" prop="region">
|
||||
<!-- {{form.region}}
|
||||
<u-select v-if="show" :disabled="disabled" :list="cityList" v-model="form.region"></u-select>
|
||||
<text @click="openSelect">{{ cityName }}</text> -->
|
||||
<select-region ref="sRegion" :disabled="disabled" v-model="form.region" />
|
||||
</u-form-item>
|
||||
<u-form-item label="站点地址" prop="address">
|
||||
<u-input v-model="form.address" :disabled="disabled" placeholder="请输入站点地址" />
|
||||
</u-form-item>
|
||||
<u-form-item label="食品经营许可证" prop="shipincard">
|
||||
<u-upload ref="shipinCardImage" :fileList="fileList2" :action="action" :header="headers"
|
||||
@delete="deletePic" index="2" name="file" :maxCount="1">
|
||||
</u-upload>
|
||||
</u-form-item>
|
||||
<u-form-item label="法定代表人身份证" prop="sfz">
|
||||
<u-upload ref="sfzImage" :fileList="fileList3" :action="action" :header="headers"
|
||||
@delete="deletePic" index="3" name="file" :maxCount="2">
|
||||
</u-upload>
|
||||
</u-form-item>
|
||||
<u-form-item label="营业执照" prop="yyzz">
|
||||
<u-upload ref="yyzzImage" :fileList="fileList4" :action="action" :header="headers"
|
||||
@delete="deletePic" index="4" name="file" :maxCount="1">
|
||||
</u-upload>
|
||||
</u-form-item>
|
||||
<u-form-item label="姓名" prop="real_name">
|
||||
<u-input v-model="form.real_name" :disabled="disabled" placeholder="请输入姓名" />
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" prop="mobile">
|
||||
<u-input v-model="form.mobile" maxlength="11" :disabled="disabled" placeholder="请输入手机号" />
|
||||
</u-form-item>
|
||||
<u-form-item label="微信号" prop="weixin">
|
||||
<u-input v-model="form.weixin" :disabled="disabled" placeholder="请输入微信号" />
|
||||
</u-form-item>
|
||||
</view>
|
||||
</u-form>
|
||||
<view class="btn">
|
||||
<u-button type="primary" shape="circle" @click="handleSubmit()">
|
||||
{{ submitText }}
|
||||
</u-button>
|
||||
</view>
|
||||
<view class="btn"></view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import store from '@/store'
|
||||
import SelectRegion from '@/components/select-region/select-region'
|
||||
import {
|
||||
isMobile
|
||||
} from '@/utils/verify'
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import * as UploadApi from '@/api/upload'
|
||||
import * as RegionApi from '@/api/region.js'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
// 入驻类型
|
||||
const dataType = [
|
||||
"partner", // 合伙人
|
||||
"teamer", // 团长
|
||||
"delivery", // 配送员
|
||||
"personal" // 个人商户
|
||||
]
|
||||
|
||||
// 表单字段元素
|
||||
const form = {
|
||||
// 入驻类型 (合伙人10001,配送员10002,社区门店10003,省代10004)
|
||||
grade_id: 10001,
|
||||
company: '',
|
||||
real_name: '',
|
||||
phone: '',
|
||||
mobile: '',
|
||||
region: [],
|
||||
detail: '',
|
||||
address: '',
|
||||
shop_image: '',
|
||||
shipin_card_image: '',
|
||||
sfz_image1: '',
|
||||
sfz_image2: '',
|
||||
yyzz_image: '',
|
||||
cityList: [],
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
real_name: [{
|
||||
required: true,
|
||||
message: '请输入您的真实姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
company: [{
|
||||
required: true,
|
||||
message: '请输入您的商户名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
address: [{
|
||||
required: true,
|
||||
message: '请输入站点地址',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
weixin: [{
|
||||
required: true,
|
||||
message: '请输入微信号',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur', 'change']
|
||||
}, {
|
||||
// 自定义验证函数
|
||||
validator: (rule, value, callback) => {
|
||||
// 返回true表示校验通过,返回false表示不通过
|
||||
return isMobile(value)
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
// 触发器可以同时用blur和change
|
||||
trigger: ['blur'],
|
||||
}],
|
||||
region: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: ['blur', 'change'],
|
||||
type: 'array'
|
||||
}]
|
||||
}
|
||||
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SelectRegion
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataType,
|
||||
fileList1: [],
|
||||
fileList2: [],
|
||||
fileList3: [],
|
||||
fileList4: [],
|
||||
form,
|
||||
rules,
|
||||
show: false,
|
||||
cityName: '选择所在城市',
|
||||
// 按钮禁用
|
||||
disabled: false,
|
||||
submitText: '申请创建商户',
|
||||
|
||||
// 文字设置
|
||||
words: undefined,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
// 入驻协议
|
||||
license: undefined,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
action: 'https://dev.gxwebsoft.com/ylx/api/upload/image',
|
||||
headers: {
|
||||
'storeId': 10001,
|
||||
'Access-Token': uni.getStorageSync('AccessToken'),
|
||||
'platform': store.getters.platform
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const app = this
|
||||
app.getSetting()
|
||||
// 获取用户坐标及当前入驻申请记录
|
||||
app.getLocation((res) => {
|
||||
app.getData(res.longitude, res.latitude)
|
||||
})
|
||||
app.getRegion()
|
||||
},
|
||||
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
|
||||
methods: {
|
||||
openSelect() {
|
||||
this.show = !this.show
|
||||
},
|
||||
// 删除图片
|
||||
deletePic(event) {
|
||||
if (this.disabled) {
|
||||
return false
|
||||
}
|
||||
this[`fileList${event.name}`].splice(event.index, 1)
|
||||
},
|
||||
// 获取用户坐标
|
||||
// 参考文档:https://uniapp.dcloud.io/api/location/location?id=getlocation
|
||||
getLocation(callback) {
|
||||
const app = this
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: callback,
|
||||
fail(e) {
|
||||
app.$toast('获取定位失败,请点击右下角按钮重新尝试定位')
|
||||
app.isAuthor = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 加载数据
|
||||
getData(longitude, latitude) {
|
||||
const app = this
|
||||
app.form.longitude = longitude
|
||||
app.form.latitude = latitude
|
||||
ApplyApi.detail().then(res => {
|
||||
const detail = res.data.detail
|
||||
// 编辑信息
|
||||
if (detail) {
|
||||
app.form = detail
|
||||
if (detail.apply_status == 10) {
|
||||
app.submitText = '待审核'
|
||||
}
|
||||
if (detail.apply_status == 20) {
|
||||
app.submitText = '审核通过'
|
||||
}
|
||||
if (detail.apply_status == 30) {
|
||||
app.submitText = '重新提交'
|
||||
}
|
||||
app.createFormData(detail)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
onAfterRead(e){
|
||||
console.log("e: ",e);
|
||||
},
|
||||
|
||||
getRegion() {
|
||||
RegionApi.list({
|
||||
status: 20,
|
||||
level: 2
|
||||
}).then(res => {
|
||||
this.cityList = res.data.list.map(d => {
|
||||
return {
|
||||
label: d.name,
|
||||
value: d.id,
|
||||
code: d.code,
|
||||
id: d.id,
|
||||
name: d.name,
|
||||
pid: d.pid,
|
||||
status: d.status
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
|
||||
// 生成默认的表单数据
|
||||
createFormData(detail) {
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
form.company = detail.company
|
||||
form.phone = detail.phone
|
||||
form.mobile = detail.mobile
|
||||
form.region = this.createRegion(detail)
|
||||
|
||||
// 加载图片
|
||||
this.fileList1.push({
|
||||
'url': detail.shop_image
|
||||
})
|
||||
this.fileList2.push({
|
||||
'url': detail.shipin_card_image
|
||||
})
|
||||
this.fileList3.push({
|
||||
'url': detail.sfz_image1
|
||||
})
|
||||
this.fileList3.push({
|
||||
'url': detail.sfz_image2
|
||||
})
|
||||
this.fileList4.push({
|
||||
'url': detail.yyzz_image
|
||||
})
|
||||
|
||||
// 是否可编辑
|
||||
this.disabled = true
|
||||
// 状态
|
||||
if (form.apply_status == 10) {
|
||||
this.submitText = '待审核'
|
||||
}
|
||||
if (form.apply_status == 20) {
|
||||
this.submitText = '审核通过'
|
||||
}
|
||||
if (form.apply_status == 30) {
|
||||
this.submitText = '重新提交'
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
|
||||
createRegion(detail) {
|
||||
return [{
|
||||
label: detail.region.province,
|
||||
value: detail.province_id
|
||||
}, {
|
||||
label: detail.region.city,
|
||||
value: detail.city_id
|
||||
}, {
|
||||
label: detail.region.region,
|
||||
value: detail.region_id
|
||||
}]
|
||||
},
|
||||
|
||||
// 获取分销设置
|
||||
getSetting() {
|
||||
const app = this
|
||||
SettingModel.data()
|
||||
.then(setting => {
|
||||
// 赋值属性
|
||||
app.words = setting.words.apply.words
|
||||
app.background = setting.background.apply
|
||||
app.license = setting.license.license
|
||||
// 设置当前页面标题
|
||||
app.setPageTitle(setting.words.apply.title)
|
||||
})
|
||||
},
|
||||
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense() {
|
||||
this.showLicense = true
|
||||
},
|
||||
|
||||
// 设置当前页面标题
|
||||
setPageTitle(title) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '商户入驻'
|
||||
})
|
||||
},
|
||||
|
||||
// 选择微信地址
|
||||
// #ifdef MP-WEIXIN
|
||||
chooseAddress() {
|
||||
const {
|
||||
form,
|
||||
$refs
|
||||
} = this
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
const names = $refs.sRegion.getOptionItemByNames(res)
|
||||
form.name = res.userName
|
||||
form.phone = res.telNumber
|
||||
form.detail = res.detailInfo
|
||||
form.region = names.length > 0 ? names : []
|
||||
}
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
|
||||
afterRead(e){
|
||||
console.log("e: ",e);
|
||||
},
|
||||
|
||||
// 表单提交
|
||||
handleSubmit() {
|
||||
const app = this
|
||||
if (app.disabled) {
|
||||
return false
|
||||
}
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
if(app.$refs.shopImage.lists.length == 0){
|
||||
app.$toast('请上传门脸照')
|
||||
return false
|
||||
}
|
||||
if(app.$refs.shipinCardImage.lists.length == 0){
|
||||
app.$toast('请上传食品经营许可证')
|
||||
return false
|
||||
}
|
||||
if(app.$refs.sfzImage.lists.length != 2){
|
||||
app.$toast('请上传法定代表人身份证正反面')
|
||||
return false
|
||||
}
|
||||
if(app.$refs.yyzzImage.lists.length == 0){
|
||||
app.$toast('请上传营业执照')
|
||||
return false
|
||||
}
|
||||
app.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
// 上传图片
|
||||
if (app.fileList1.length == 0) {
|
||||
form.shop_image = app.$refs.shopImage.lists[0].response.data.fileInfo.preview_url;
|
||||
}
|
||||
if (app.fileList2.length == 0) {
|
||||
form.shipin_card_image = app.$refs.shipinCardImage.lists[0].response.data.fileInfo.preview_url;
|
||||
}
|
||||
if (app.fileList3.length == 0) {
|
||||
form.sfz_image1 = app.$refs.sfzImage.lists[0].response.data.fileInfo.preview_url;
|
||||
form.sfz_image2 = app.$refs.sfzImage.lists[1].response.data.fileInfo.preview_url;
|
||||
}
|
||||
if (app.fileList4.length == 0) {
|
||||
form.yyzz_image = app.$refs.yyzzImage.lists[0].response.data.fileInfo.preview_url;
|
||||
}
|
||||
form.phone = form.mobile
|
||||
ApplyApi.checkAvailable(form).then(res => {
|
||||
app.disabled = true
|
||||
app.onSubmit()
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 提交到后端
|
||||
onSubmit() {
|
||||
const app = this
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
let req;
|
||||
if (form.apply_status == 30) {
|
||||
req = ApplyApi.edit(form.apply_id, form)
|
||||
} else {
|
||||
console.log('add');
|
||||
req = ApplyApi.add(form)
|
||||
}
|
||||
req.then(result => {
|
||||
console.log("result: ", result);
|
||||
app.$toast(result.message)
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
|
||||
})
|
||||
.finally(() => app.disabled = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background: #f7f8fa;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.page-title {
|
||||
width: 94%;
|
||||
margin: 0 auto;
|
||||
padding-top: 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(69, 90, 100, 0.6);
|
||||
}
|
||||
|
||||
.form-wrapper {
|
||||
margin: 20rpx auto 20rpx auto;
|
||||
padding: 0 40rpx;
|
||||
width: 94%;
|
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* 底部操作栏 */
|
||||
|
||||
.footer {
|
||||
margin-top: 80rpx;
|
||||
|
||||
.btn-wrapper {
|
||||
height: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.btn-item {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
height: 86rpx;
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-item-wechat {
|
||||
background: #0ba90b;
|
||||
margin-bottom: 26rpx;
|
||||
}
|
||||
|
||||
.btn-item-main {
|
||||
background: linear-gradient(to right, $main-bg, $main-bg2);
|
||||
|
||||
// 禁用按钮
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 上传凭证
|
||||
.row-voucher {
|
||||
padding: 24rpx 20rpx;
|
||||
|
||||
.image-list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: -20rpx;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-picker,
|
||||
.image-preview {
|
||||
width: 184rpx;
|
||||
height: 184rpx;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
float: left;
|
||||
|
||||
&:nth-child(3n+0) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.image-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1rpx dashed #ccc;
|
||||
color: #ccc;
|
||||
|
||||
.choose-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.choose-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -15rpx;
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
background: rgba(0, 0, 0, 0.64);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-weight: bolder;
|
||||
font-size: 22rpx;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-license {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.pops-content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.sfz,
|
||||
.sfz1,
|
||||
.sfz2,
|
||||
.yyzz {
|
||||
width: 140rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
|
||||
.btn {
|
||||
width: 700rpx;
|
||||
margin: 20rpx auto;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.reject {
|
||||
width: 700rpx;
|
||||
margin: 20rpx auto;
|
||||
}
|
||||
</style>
|
||||
604
package/apply/personal.vue
Normal file
604
package/apply/personal.vue
Normal file
@@ -0,0 +1,604 @@
|
||||
<template>
|
||||
<view class="container" :style="appThemeStyle">
|
||||
<!-- 标题 -->
|
||||
<view class="page-title">申请入驻</view>
|
||||
<!-- 表单组件 -->
|
||||
<view class="form-wrapper">
|
||||
<u-form :model="form" ref="uForm" label-width="140rpx">
|
||||
<u-form-item label="所在地区" prop="region">
|
||||
<select-region ref="sRegion" :disabled="disabled" v-model="form.region" />
|
||||
</u-form-item>
|
||||
<u-form-item label="公司名称" prop="company">
|
||||
<u-input v-model="form.company" :disabled="disabled" placeholder="请输入公司名称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="联系电话" prop="phone">
|
||||
<u-input v-model="form.phone" :disabled="disabled" placeholder="请输入联系电话" />
|
||||
</u-form-item>
|
||||
<u-form-item label="姓名" prop="real_name">
|
||||
<u-input v-model="form.real_name" :disabled="disabled" placeholder="请输入商户姓名" />
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" prop="mobile">
|
||||
<u-input v-model="form.mobile" maxlength="11" :disabled="disabled" placeholder="请输入商户手机号" />
|
||||
</u-form-item>
|
||||
<u-form-item v-for="(item,imageIndex) in imageList" :key="imageIndex" :label="itemLabel[imageIndex]"
|
||||
:prop="itemProp[imageIndex]">
|
||||
<view class="image-preview">
|
||||
<image mode="widthFix" :src="item.path" class="sfz" @click="chooseImage(imageIndex)"></image>
|
||||
<text class="image-delete iconfont icon-shanchu" @click="deleteImage(imageIndex)"></text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<view class="form-license dis-flex flex-x-center flex-y-center">
|
||||
<view class="license-radio dis-flex flex-y-center" @click="isRead = !isRead">
|
||||
<text class="license-icon f-38 iconfont icon-radio"
|
||||
:class="[isRead ? 'c-violet' : 'col-bb']"></text>
|
||||
<text class="f-28 col-80">我已阅读并了解</text>
|
||||
</view>
|
||||
<text @click="handleShowLicense()" class="f-28 c-violet">【{{ words.license.value }}】</text>
|
||||
</view>
|
||||
</u-form>
|
||||
</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="footer">
|
||||
<view class="btn-wrapper">
|
||||
<view class="btn-item btn-item-main" :class="{ disabled }" @click="handleSubmit()">{{ submitText }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<u-modal v-model="showLicense" title="申请协议">
|
||||
<scroll-view class="pops-content" :scroll-y="true">
|
||||
<text>{{ license }}</text>
|
||||
</scroll-view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectRegion from '@/components/select-region/select-region'
|
||||
import {
|
||||
isMobile
|
||||
} from '@/utils/verify'
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import * as UploadApi from '@/api/upload'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
// 入驻类型
|
||||
const dataType = [
|
||||
"partner", // 合伙人
|
||||
"teamer", // 团长
|
||||
"delivery", // 配送员
|
||||
"personal" // 个人商户
|
||||
]
|
||||
// 图片上传类型
|
||||
const itemProp = ["sfz1", "sfz2", "yyzz"]
|
||||
// 图片上传名称
|
||||
const itemLabel = ["身份证(正)", "身份证(反)", "营业执照"]
|
||||
|
||||
// 用户选择的图片列表
|
||||
const imageList = [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 0
|
||||
}
|
||||
]
|
||||
|
||||
// 表单字段元素
|
||||
const form = {
|
||||
// 入驻类型 (合伙人10001,配送员10002,社区门店10003,省代10004)
|
||||
grade_id: 10004,
|
||||
company: '',
|
||||
real_name: '',
|
||||
phone: '',
|
||||
mobile: '',
|
||||
region: [],
|
||||
detail: '',
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
real_name: [{
|
||||
required: true,
|
||||
message: '请输入您的真实姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
company: [{
|
||||
required: true,
|
||||
message: '请输入您的公司名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur', 'change']
|
||||
}, {
|
||||
// 自定义验证函数
|
||||
validator: (rule, value, callback) => {
|
||||
// 返回true表示校验通过,返回false表示不通过
|
||||
return isMobile(value)
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
// 触发器可以同时用blur和change
|
||||
trigger: ['blur'],
|
||||
}],
|
||||
region: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: ['blur', 'change'],
|
||||
type: 'array'
|
||||
}],
|
||||
detail: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
}
|
||||
|
||||
const maxImageLength = 2
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SelectRegion
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataType,
|
||||
itemProp,
|
||||
itemLabel,
|
||||
imageList,
|
||||
form,
|
||||
rules,
|
||||
// 按钮禁用
|
||||
disabled: false,
|
||||
submitText: '提交申请',
|
||||
|
||||
// 文字设置
|
||||
words: undefined,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
// 入驻协议
|
||||
license: undefined,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const app = this
|
||||
app.getSetting()
|
||||
// 获取用户坐标及当前入驻申请记录
|
||||
app.getLocation((res) => {
|
||||
app.getData(res.longitude, res.latitude)
|
||||
})
|
||||
},
|
||||
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 获取用户坐标
|
||||
// 参考文档:https://uniapp.dcloud.io/api/location/location?id=getlocation
|
||||
getLocation(callback) {
|
||||
const app = this
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: callback,
|
||||
fail() {
|
||||
app.$toast('获取定位失败,请点击右下角按钮重新尝试定位')
|
||||
app.isAuthor = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 加载数据
|
||||
getData(longitude,latitude) {
|
||||
const app = this
|
||||
app.form.longitude = longitude
|
||||
app.form.latitude = latitude
|
||||
ApplyApi.detail().then(res => {
|
||||
const detail = res.data.detail
|
||||
console.log(detail);
|
||||
// 编辑信息
|
||||
if (detail) {
|
||||
app.form = detail
|
||||
app.createFormData(detail)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 生成默认的表单数据
|
||||
createFormData(detail) {
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
form.company = detail.company
|
||||
form.phone = detail.phone
|
||||
form.region = this.createRegion(detail.shop)
|
||||
// 是否可编辑
|
||||
this.disabled = true
|
||||
// 状态
|
||||
if (form.apply_status == 10) {
|
||||
this.submitText = '待审核'
|
||||
}
|
||||
if (form.apply_status == 20) {
|
||||
this.submitText = '审核通过'
|
||||
}
|
||||
if (form.apply_status == 30) {
|
||||
this.submitText = '重新提交'
|
||||
this.disabled = false
|
||||
}
|
||||
|
||||
// 加载图片
|
||||
this.imageList = detail.images.map(d => {
|
||||
return {
|
||||
path: d.image_url,
|
||||
size: 101
|
||||
}
|
||||
})
|
||||
form.images = detail.images.map(d => {
|
||||
return d.image_id
|
||||
})
|
||||
},
|
||||
|
||||
createRegion(detail) {
|
||||
return [{
|
||||
label: detail.region.province,
|
||||
value: detail.province_id
|
||||
}, {
|
||||
label: detail.region.city,
|
||||
value: detail.city_id
|
||||
}, {
|
||||
label: detail.region.region,
|
||||
value: detail.region_id
|
||||
}]
|
||||
},
|
||||
|
||||
// 获取分销设置
|
||||
getSetting() {
|
||||
const app = this
|
||||
SettingModel.data()
|
||||
.then(setting => {
|
||||
// 赋值属性
|
||||
app.words = setting.words.apply.words
|
||||
app.background = setting.background.apply
|
||||
app.license = setting.license.license
|
||||
// 设置当前页面标题
|
||||
app.setPageTitle(setting.words.apply.title)
|
||||
})
|
||||
},
|
||||
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense() {
|
||||
this.showLicense = true
|
||||
},
|
||||
|
||||
// 设置当前页面标题
|
||||
setPageTitle(title) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '申请成为商家'
|
||||
})
|
||||
},
|
||||
|
||||
// 选择图片
|
||||
chooseImage(imageIndex) {
|
||||
const app = this
|
||||
const oldImageList = app.imageList
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
// 是否可编辑
|
||||
if (form.apply_status && form.apply_status != 30) {
|
||||
app.disabled = true
|
||||
return false
|
||||
}
|
||||
// 选择图片
|
||||
uni.chooseImage({
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success({
|
||||
tempFiles
|
||||
}) {
|
||||
// 删除第imageIndex个元素,并在数组的第imageIndex个位置添加新元素:
|
||||
app.imageList.splice(imageIndex, 1, tempFiles[0])
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deleteImage(imageIndex) {
|
||||
const {
|
||||
disabled
|
||||
} = this
|
||||
if (disabled == true) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.imageList[imageIndex].path = '../../static/not-dealer.png'
|
||||
},
|
||||
|
||||
// 选择微信地址
|
||||
// #ifdef MP-WEIXIN
|
||||
chooseAddress() {
|
||||
const {
|
||||
form,
|
||||
$refs
|
||||
} = this
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
const names = $refs.sRegion.getOptionItemByNames(res)
|
||||
form.name = res.userName
|
||||
form.phone = res.telNumber
|
||||
form.detail = res.detailInfo
|
||||
form.region = names.length > 0 ? names : []
|
||||
}
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
|
||||
// 表单提交
|
||||
handleSubmit() {
|
||||
const app = this
|
||||
console.log(app.disabled);
|
||||
if (app.disabled) {
|
||||
return false
|
||||
}
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
const {
|
||||
imageList
|
||||
} = this
|
||||
app.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
app.disabled = true
|
||||
ApplyApi.checkAvailable(form).then(res => {
|
||||
// 判断是否需要上传图片
|
||||
if (imageList[0].size == 0 || imageList[1].size == 0 || imageList[2].size == 0) {
|
||||
app.$toast('请上传图片!')
|
||||
app.disabled = false
|
||||
return false
|
||||
}
|
||||
if (imageList.length > 0 && imageList[0].size > 0) {
|
||||
app.uploadFile()
|
||||
.then(() => app.onSubmit())
|
||||
.catch(err => {
|
||||
app.disabled = false
|
||||
if (err.statusCode !== 0) {
|
||||
app.$toast(err.errMsg)
|
||||
}
|
||||
console.log('err', err)
|
||||
})
|
||||
} else {
|
||||
app.onSubmit()
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("err: ", err);
|
||||
if (err.statusCode == 0) {
|
||||
app.disabled = false
|
||||
app.$toast(err.errMsg)
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
uploadFile() {
|
||||
const app = this
|
||||
const {
|
||||
imageList,
|
||||
form
|
||||
} = app
|
||||
// 批量上传
|
||||
return new Promise((resolve, reject) => {
|
||||
if (imageList.length > 0) {
|
||||
UploadApi.image(imageList)
|
||||
.then(fileIds => {
|
||||
form.images = fileIds
|
||||
resolve(fileIds)
|
||||
})
|
||||
.catch(reject)
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 提交到后端
|
||||
onSubmit() {
|
||||
const app = this
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
let req;
|
||||
if (form.apply_status == 30) {
|
||||
req = ApplyApi.edit(form.apply_id, form)
|
||||
} else {
|
||||
req = ApplyApi.add(form)
|
||||
}
|
||||
req.then(result => {
|
||||
console.log("result: ", result);
|
||||
app.$toast(result.message)
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
|
||||
})
|
||||
.finally(() => app.disabled = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background: #f7f8fa;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.page-title {
|
||||
width: 94%;
|
||||
margin: 0 auto;
|
||||
padding-top: 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(69, 90, 100, 0.6);
|
||||
}
|
||||
|
||||
.form-wrapper {
|
||||
margin: 20rpx auto 20rpx auto;
|
||||
padding: 0 40rpx;
|
||||
width: 94%;
|
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* 底部操作栏 */
|
||||
|
||||
.footer {
|
||||
margin-top: 80rpx;
|
||||
|
||||
.btn-wrapper {
|
||||
height: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.btn-item {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
height: 86rpx;
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-item-wechat {
|
||||
background: #0ba90b;
|
||||
margin-bottom: 26rpx;
|
||||
}
|
||||
|
||||
.btn-item-main {
|
||||
background: linear-gradient(to right, $main-bg, $main-bg2);
|
||||
|
||||
// 禁用按钮
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 上传凭证
|
||||
.row-voucher {
|
||||
padding: 24rpx 20rpx;
|
||||
|
||||
.image-list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: -20rpx;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-picker,
|
||||
.image-preview {
|
||||
width: 184rpx;
|
||||
height: 184rpx;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
float: left;
|
||||
|
||||
&:nth-child(3n+0) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.image-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1rpx dashed #ccc;
|
||||
color: #ccc;
|
||||
|
||||
.choose-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.choose-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -15rpx;
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
background: rgba(0, 0, 0, 0.64);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-weight: bolder;
|
||||
font-size: 22rpx;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-license {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.pops-content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.sfz,
|
||||
.sfz1,
|
||||
.sfz2,
|
||||
.yyzz {
|
||||
width: 140rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
</style>
|
||||
80
package/apply/select.vue
Normal file
80
package/apply/select.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<template>
|
||||
<view class="wrap" :style="appThemeStyle">
|
||||
<u-row gutter="16">
|
||||
<u-col span="6">
|
||||
<view class="wrap-item bg-purple-light" v-if="gradeId == 0 || gradeId == 10001" @click="navTo('package/apply/index')"><image src="http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/b437b0213516d446f2bbd2e4ca4aa1d3.png" class="wrap-avatar" mode="widthFix"></image><text class="item-text">商户入驻</text></view>
|
||||
</u-col>
|
||||
<!-- <u-col span="6">
|
||||
<view class="wrap-item bg-purple-light" v-if="gradeId == 0 || gradeId == 10002" @click="navTo('package/apply/delivery')"><image src="http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/92ba7cadfa6459034c3570e9141c49f5.png" class="wrap-avatar" mode="widthFix"></image><text class="item-text">配送员入驻</text></view>
|
||||
</u-col> -->
|
||||
<u-col span="6">
|
||||
<!-- <view class="wrap-item bg-purple-light" v-if="gradeId == 0 || gradeId == 10003" @click="navTo('package/apply/teamer')"><image src="http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/4df3d4d3a575467d9216b081ef23fe7a.png" class="wrap-avatar" mode="widthFix"></image><text class="item-text">团长入驻</text></view> -->
|
||||
</u-col>
|
||||
<!-- <u-col span="6">
|
||||
<view class="wrap-item bg-purple-light" v-if="gradeId == 0 || gradeId == 10004" @click="navTo('package/apply/personal')"><image src="http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/127c0a1f401a1119937eb3995235dc26.png" class="wrap-avatar" mode="widthFix"></image><text class="item-text">个人商户入驻</text></view>
|
||||
</u-col> -->
|
||||
</u-row>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
gradeId: 0,
|
||||
disabled: false
|
||||
}
|
||||
},
|
||||
onLoad(){
|
||||
ApplyApi.detail().then(res => {
|
||||
let detail = res.data.detail
|
||||
if(detail){
|
||||
this.gradeId = detail.grade_id
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
navTo(url){
|
||||
this.$navTo(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.wrap {
|
||||
padding: 24rpx;
|
||||
}
|
||||
|
||||
.u-row {
|
||||
margin: 40rpx 0;
|
||||
}
|
||||
|
||||
.wrap-item {
|
||||
height: 120rpx;
|
||||
border-radius: 8rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.bg-purple {
|
||||
background: #d3dce6;
|
||||
}
|
||||
|
||||
.bg-purple-light {
|
||||
background: #e5e9f2;
|
||||
}
|
||||
|
||||
.bg-purple-dark {
|
||||
background: #99a9bf;
|
||||
}
|
||||
.wrap-avatar{
|
||||
width: 80rpx;
|
||||
}
|
||||
.item-text{
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
</style>
|
||||
605
package/apply/teamer.vue
Normal file
605
package/apply/teamer.vue
Normal file
@@ -0,0 +1,605 @@
|
||||
<template>
|
||||
<view class="container" :style="appThemeStyle">
|
||||
<!-- 标题 -->
|
||||
<view class="page-title">申请入驻</view>
|
||||
<!-- 表单组件 -->
|
||||
<view class="form-wrapper">
|
||||
<u-form :model="form" ref="uForm" label-width="140rpx">
|
||||
<u-form-item label="所在地区" prop="region">
|
||||
<select-region ref="sRegion" :disabled="disabled" v-model="form.region" />
|
||||
</u-form-item>
|
||||
<u-form-item label="公司名称" prop="company">
|
||||
<u-input v-model="form.company" :disabled="disabled" placeholder="请输入公司名称" />
|
||||
</u-form-item>
|
||||
<u-form-item label="联系电话" prop="phone">
|
||||
<u-input v-model="form.phone" :disabled="disabled" placeholder="请输入联系电话" />
|
||||
</u-form-item>
|
||||
<u-form-item label="姓名" prop="real_name">
|
||||
<u-input v-model="form.real_name" :disabled="disabled" placeholder="请输入商家姓名" />
|
||||
</u-form-item>
|
||||
<u-form-item label="手机号码" prop="mobile">
|
||||
<u-input v-model="form.mobile" maxlength="11" :disabled="disabled" placeholder="请输入商家手机号" />
|
||||
</u-form-item>
|
||||
<u-form-item v-for="(item,imageIndex) in imageList" :key="imageIndex" :label="itemLabel[imageIndex]"
|
||||
:prop="itemProp[imageIndex]">
|
||||
<view class="image-preview">
|
||||
<image mode="widthFix" :src="item.path" class="sfz" @click="chooseImage(imageIndex)"></image>
|
||||
<text class="image-delete iconfont icon-shanchu" @click="deleteImage(imageIndex)"></text>
|
||||
</view>
|
||||
</u-form-item>
|
||||
<view class="form-license dis-flex flex-x-center flex-y-center">
|
||||
<view class="license-radio dis-flex flex-y-center" @click="isRead = !isRead">
|
||||
<text class="license-icon f-38 iconfont icon-radio"
|
||||
:class="[isRead ? 'c-violet' : 'col-bb']"></text>
|
||||
<text class="f-28 col-80">我已阅读并了解</text>
|
||||
</view>
|
||||
<text @click="handleShowLicense()" class="f-28 c-violet">【{{ words.license.value }}】</text>
|
||||
</view>
|
||||
</u-form>
|
||||
</view>
|
||||
<!-- 操作按钮 -->
|
||||
<view class="footer">
|
||||
<view class="btn-wrapper">
|
||||
<view class="btn-item btn-item-main" :class="{ disabled }" @click="handleSubmit()">{{ submitText }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 入驻协议弹窗 -->
|
||||
<u-modal v-model="showLicense" title="申请协议">
|
||||
<scroll-view class="pops-content" :scroll-y="true">
|
||||
<text>{{ license }}</text>
|
||||
</scroll-view>
|
||||
</u-modal>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import SelectRegion from '@/components/select-region/select-region'
|
||||
import {
|
||||
isMobile
|
||||
} from '@/utils/verify'
|
||||
import * as ApplyApi from '@/api/apply.js'
|
||||
import * as UploadApi from '@/api/upload'
|
||||
import SettingModel from '@/common/model/dealer/Setting'
|
||||
// 入驻类型
|
||||
const dataType = [
|
||||
"partner", // 合伙人
|
||||
"teamer", // 团长
|
||||
"delivery", // 配送员
|
||||
"personal" // 个人商户
|
||||
]
|
||||
// 图片上传类型
|
||||
const itemProp = ["sfz1", "sfz2", "yyzz"]
|
||||
// 图片上传名称
|
||||
const itemLabel = ["身份证(正)", "身份证(反)", "营业执照"]
|
||||
|
||||
// 用户选择的图片列表
|
||||
const imageList = [{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/6b52b67ed9291757163c10ef96be1a54.png',
|
||||
size: 0
|
||||
},
|
||||
{
|
||||
path: 'http://dev.gxwebsoft.com/hainiu/uploads/10001/20220522/55faad35f5ee30f3e8791bdfd2f75eb9.png',
|
||||
size: 0
|
||||
}
|
||||
]
|
||||
|
||||
// 表单字段元素
|
||||
const form = {
|
||||
// 入驻类型 (合伙人10001,配送员10002,社区门店10003,省代10004)
|
||||
grade_id: 10003,
|
||||
company: '',
|
||||
real_name: '',
|
||||
phone: '',
|
||||
mobile: '',
|
||||
region: [],
|
||||
detail: '',
|
||||
}
|
||||
|
||||
// 表单验证规则
|
||||
const rules = {
|
||||
real_name: [{
|
||||
required: true,
|
||||
message: '请输入您的真实姓名',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
company: [{
|
||||
required: true,
|
||||
message: '请输入您的公司名称',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
phone: [{
|
||||
required: true,
|
||||
message: '请输入联系电话',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
mobile: [{
|
||||
required: true,
|
||||
message: '请输入手机号',
|
||||
trigger: ['blur', 'change']
|
||||
}, {
|
||||
// 自定义验证函数
|
||||
validator: (rule, value, callback) => {
|
||||
// 返回true表示校验通过,返回false表示不通过
|
||||
return isMobile(value)
|
||||
},
|
||||
message: '手机号码不正确',
|
||||
// 触发器可以同时用blur和change
|
||||
trigger: ['blur'],
|
||||
}],
|
||||
region: [{
|
||||
required: true,
|
||||
message: '请选择省市区',
|
||||
trigger: ['blur', 'change'],
|
||||
type: 'array'
|
||||
}],
|
||||
detail: [{
|
||||
required: true,
|
||||
message: '请输入详细地址',
|
||||
trigger: ['blur', 'change']
|
||||
}],
|
||||
}
|
||||
|
||||
const maxImageLength = 2
|
||||
|
||||
export default {
|
||||
components: {
|
||||
SelectRegion
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dataType,
|
||||
itemProp,
|
||||
itemLabel,
|
||||
imageList,
|
||||
form,
|
||||
rules,
|
||||
// 按钮禁用
|
||||
disabled: false,
|
||||
submitText: '提交申请',
|
||||
|
||||
// 文字设置
|
||||
words: undefined,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
// 入驻协议
|
||||
license: undefined,
|
||||
// 入驻协议阅读状态
|
||||
isRead: false,
|
||||
// 显示入驻协议弹窗
|
||||
showLicense: false,
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
const app = this
|
||||
app.getSetting()
|
||||
// 获取用户坐标及当前入驻申请记录
|
||||
app.getLocation((res) => {
|
||||
app.getData(res.longitude, res.latitude)
|
||||
})
|
||||
},
|
||||
|
||||
// 必须要在onReady生命周期,因为onLoad生命周期组件可能尚未创建完毕
|
||||
onReady() {
|
||||
this.$refs.uForm.setRules(this.rules)
|
||||
},
|
||||
|
||||
methods: {
|
||||
// 获取用户坐标
|
||||
// 参考文档:https://uniapp.dcloud.io/api/location/location?id=getlocation
|
||||
getLocation(callback) {
|
||||
const app = this
|
||||
uni.getLocation({
|
||||
type: 'wgs84',
|
||||
success: callback,
|
||||
fail() {
|
||||
app.$toast('获取定位失败,请点击右下角按钮重新尝试定位')
|
||||
app.isAuthor = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 加载数据
|
||||
getData(longitude,latitude) {
|
||||
const app = this
|
||||
app.form.longitude = longitude
|
||||
app.form.latitude = latitude
|
||||
ApplyApi.detail().then(res => {
|
||||
const detail = res.data.detail
|
||||
console.log(detail);
|
||||
// 编辑信息
|
||||
if (detail) {
|
||||
app.form = detail
|
||||
app.createFormData(detail)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
// 生成默认的表单数据
|
||||
createFormData(detail) {
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
form.company = detail.company
|
||||
form.phone = detail.phone
|
||||
form.region = this.createRegion(detail.shop)
|
||||
// 是否可编辑
|
||||
this.disabled = true
|
||||
// 状态
|
||||
if (form.apply_status == 10) {
|
||||
this.submitText = '待审核'
|
||||
}
|
||||
if (form.apply_status == 20) {
|
||||
this.submitText = '审核通过'
|
||||
}
|
||||
if (form.apply_status == 30) {
|
||||
this.submitText = '重新提交'
|
||||
this.disabled = false
|
||||
}
|
||||
|
||||
// 加载图片
|
||||
this.imageList = detail.images.map(d => {
|
||||
return {
|
||||
path: d.image_url,
|
||||
size: 101
|
||||
}
|
||||
})
|
||||
form.images = detail.images.map(d => {
|
||||
return d.image_id
|
||||
})
|
||||
},
|
||||
|
||||
createRegion(detail) {
|
||||
return [{
|
||||
label: detail.region.province,
|
||||
value: detail.province_id
|
||||
}, {
|
||||
label: detail.region.city,
|
||||
value: detail.city_id
|
||||
}, {
|
||||
label: detail.region.region,
|
||||
value: detail.region_id
|
||||
}]
|
||||
},
|
||||
|
||||
// 获取分销设置
|
||||
getSetting() {
|
||||
const app = this
|
||||
SettingModel.data()
|
||||
.then(setting => {
|
||||
// 赋值属性
|
||||
app.words = setting.words.apply.words
|
||||
app.background = setting.background.apply
|
||||
app.license = setting.license.license
|
||||
// 设置当前页面标题
|
||||
app.setPageTitle(setting.words.apply.title)
|
||||
})
|
||||
},
|
||||
|
||||
// 显示入驻协议弹窗
|
||||
handleShowLicense() {
|
||||
this.showLicense = true
|
||||
},
|
||||
|
||||
// 设置当前页面标题
|
||||
setPageTitle(title) {
|
||||
uni.setNavigationBarTitle({
|
||||
title: '申请成为团长'
|
||||
})
|
||||
},
|
||||
|
||||
// 选择图片
|
||||
chooseImage(imageIndex) {
|
||||
const app = this
|
||||
const oldImageList = app.imageList
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
// 是否可编辑
|
||||
if (form.apply_status && form.apply_status != 30) {
|
||||
app.disabled = true
|
||||
return false
|
||||
}
|
||||
// 选择图片
|
||||
uni.chooseImage({
|
||||
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
|
||||
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
|
||||
success({
|
||||
tempFiles
|
||||
}) {
|
||||
// 删除第imageIndex个元素,并在数组的第imageIndex个位置添加新元素:
|
||||
app.imageList.splice(imageIndex, 1, tempFiles[0])
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
// 删除图片
|
||||
deleteImage(imageIndex) {
|
||||
const {
|
||||
disabled
|
||||
} = this
|
||||
if (disabled == true) {
|
||||
return false
|
||||
}
|
||||
|
||||
this.imageList[imageIndex].path = '../../static/not-dealer.png'
|
||||
},
|
||||
|
||||
// 选择微信地址
|
||||
// #ifdef MP-WEIXIN
|
||||
chooseAddress() {
|
||||
const {
|
||||
form,
|
||||
$refs
|
||||
} = this
|
||||
uni.chooseAddress({
|
||||
success(res) {
|
||||
const names = $refs.sRegion.getOptionItemByNames(res)
|
||||
form.name = res.userName
|
||||
form.phone = res.telNumber
|
||||
form.detail = res.detailInfo
|
||||
form.region = names.length > 0 ? names : []
|
||||
}
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
|
||||
// 表单提交
|
||||
handleSubmit() {
|
||||
const app = this
|
||||
console.log(app.disabled);
|
||||
if (app.disabled) {
|
||||
return false
|
||||
}
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
const {
|
||||
imageList
|
||||
} = this
|
||||
app.$refs.uForm.validate(valid => {
|
||||
if (valid) {
|
||||
app.disabled = true
|
||||
ApplyApi.checkAvailable(form).then(res => {
|
||||
// 判断是否需要上传图片
|
||||
if (imageList[0].size == 0 || imageList[1].size == 0 || imageList[2].size == 0) {
|
||||
app.$toast('请上传图片!')
|
||||
app.disabled = false
|
||||
return false
|
||||
}
|
||||
if (imageList.length > 0 && imageList[0].size > 0) {
|
||||
app.uploadFile()
|
||||
.then(() => app.onSubmit())
|
||||
.catch(err => {
|
||||
app.disabled = false
|
||||
if (err.statusCode !== 0) {
|
||||
app.$toast(err.errMsg)
|
||||
}
|
||||
console.log('err', err)
|
||||
})
|
||||
} else {
|
||||
app.onSubmit()
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("err: ", err);
|
||||
if (err.statusCode == 0) {
|
||||
app.disabled = false
|
||||
app.$toast(err.errMsg)
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 上传图片
|
||||
uploadFile() {
|
||||
const app = this
|
||||
const {
|
||||
imageList,
|
||||
form
|
||||
} = app
|
||||
// 批量上传
|
||||
return new Promise((resolve, reject) => {
|
||||
if (imageList.length > 0) {
|
||||
UploadApi.image(imageList)
|
||||
.then(fileIds => {
|
||||
form.images = fileIds
|
||||
resolve(fileIds)
|
||||
})
|
||||
.catch(reject)
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// 提交到后端
|
||||
onSubmit() {
|
||||
const app = this
|
||||
const {
|
||||
form
|
||||
} = this
|
||||
let req;
|
||||
if (form.apply_status == 30) {
|
||||
req = ApplyApi.edit(form.apply_id, form)
|
||||
} else {
|
||||
req = ApplyApi.add(form)
|
||||
}
|
||||
req.then(result => {
|
||||
console.log("result: ", result);
|
||||
app.$toast(result.message)
|
||||
setTimeout(function() {
|
||||
uni.navigateBack()
|
||||
}, 2000)
|
||||
|
||||
})
|
||||
.finally(() => app.disabled = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background: #f7f8fa;
|
||||
}
|
||||
</style>
|
||||
<style lang="scss" scoped>
|
||||
.page-title {
|
||||
width: 94%;
|
||||
margin: 0 auto;
|
||||
padding-top: 40rpx;
|
||||
font-size: 28rpx;
|
||||
color: rgba(69, 90, 100, 0.6);
|
||||
}
|
||||
|
||||
.form-wrapper {
|
||||
margin: 20rpx auto 20rpx auto;
|
||||
padding: 0 40rpx;
|
||||
width: 94%;
|
||||
box-shadow: 0 1rpx 5rpx 0px rgba(0, 0, 0, 0.05);
|
||||
border-radius: 16rpx;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
/* 底部操作栏 */
|
||||
|
||||
.footer {
|
||||
margin-top: 80rpx;
|
||||
|
||||
.btn-wrapper {
|
||||
height: 100%;
|
||||
// display: flex;
|
||||
// align-items: center;
|
||||
padding: 0 20rpx;
|
||||
}
|
||||
|
||||
.btn-item {
|
||||
flex: 1;
|
||||
font-size: 28rpx;
|
||||
height: 86rpx;
|
||||
color: #fff;
|
||||
border-radius: 50rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.btn-item-wechat {
|
||||
background: #0ba90b;
|
||||
margin-bottom: 26rpx;
|
||||
}
|
||||
|
||||
.btn-item-main {
|
||||
background: linear-gradient(to right, $main-bg, $main-bg2);
|
||||
|
||||
// 禁用按钮
|
||||
&.disabled {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 上传凭证
|
||||
.row-voucher {
|
||||
padding: 24rpx 20rpx;
|
||||
|
||||
.image-list {
|
||||
padding: 0 20rpx;
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: -20rpx;
|
||||
|
||||
&:after {
|
||||
clear: both;
|
||||
content: " ";
|
||||
display: table;
|
||||
}
|
||||
|
||||
.image {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.image-picker,
|
||||
.image-preview {
|
||||
width: 184rpx;
|
||||
height: 184rpx;
|
||||
margin-right: 30rpx;
|
||||
margin-bottom: 30rpx;
|
||||
float: left;
|
||||
|
||||
&:nth-child(3n+0) {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.image-picker {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border: 1rpx dashed #ccc;
|
||||
color: #ccc;
|
||||
|
||||
.choose-icon {
|
||||
font-size: 48rpx;
|
||||
margin-bottom: 6rpx;
|
||||
}
|
||||
|
||||
.choose-text {
|
||||
font-size: 24rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.image-preview {
|
||||
position: relative;
|
||||
|
||||
.image-delete {
|
||||
position: absolute;
|
||||
top: -15rpx;
|
||||
right: -15rpx;
|
||||
height: 42rpx;
|
||||
width: 42rpx;
|
||||
background: rgba(0, 0, 0, 0.64);
|
||||
border-radius: 50%;
|
||||
color: #fff;
|
||||
font-weight: bolder;
|
||||
font-size: 22rpx;
|
||||
z-index: 10;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.form-license {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.pops-content {
|
||||
padding: 20rpx;
|
||||
}
|
||||
|
||||
.sfz,
|
||||
.sfz1,
|
||||
.sfz2,
|
||||
.yyzz {
|
||||
width: 140rpx;
|
||||
padding-top: 20rpx;
|
||||
padding-right: 10rpx;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user