Fix(入驻):[#1876, #1844]1、审核中状态不可编辑内容;2、供应商入驻获取验证码按钮变形

This commit is contained in:
lifizer
2024-06-28 15:48:51 +08:00
parent f02a7c5514
commit 14ceb895d3
4 changed files with 872 additions and 653 deletions
+51 -49
View File
@@ -1,23 +1,42 @@
<template>
<view class="pkg-join-index">
<image class="img-banner" :src="images.topImage" mode="scaleToFill"/>
<!-- <view class="box flex flex-col ai-center">-->
<!-- <image class="img-title" :src="webUrl+'/20230413103123003753.png'" mode="scaleToFill"/>-->
<!-- </view>-->
<image class="img-item" mode="widthFix" :src="images.goodSupplierImage"
@click="goto('goods_supplier')" v-show="partnerType==='province_partner'||partnerType===''"/>
<image class="img-item" mode="widthFix" :src="images.wenwanSupplierImage"
@click="goto('wenwan_supplier')" v-show="partnerType==='pioneer'||partnerType===''"/>
<image class="img-item" mode="widthFix" :src="images.hotelImage"
@click="goto('shop')" v-show="partnerType==='pioneer'||partnerType===''"/>
<image class="img-item" mode="widthFix" :src="images.wholesalerImage" @click="goto('wholesaler')"/>
<image
:src="images.topImage"
class="img-banner"
mode="scaleToFill"
/>
<image
v-show="partnerType === 'province_partner' || partnerType === ''"
:src="images.goodSupplierImage"
class="img-item"
mode="widthFix"
@click="goto('goods_supplier')"
/>
<image
v-show="partnerType === 'pioneer' || partnerType === ''"
:src="images.wenwanSupplierImage"
class="img-item"
mode="widthFix"
@click="goto('wenwan_supplier')"
/>
<image
v-show="partnerType === 'pioneer' || partnerType === ''"
:src="images.hotelImage"
class="img-item"
mode="widthFix"
@click="goto('shop')"
/>
<image
:src="images.wholesalerImage"
class="img-item"
mode="widthFix"
@click="goto('wholesaler')"
/>
</view>
</template>
<script>
import {getImages, getShopData} from '@/api/join'
import { getImages, getShopData } from '@/api/join'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'PkgJoinIndex',
@@ -37,63 +56,46 @@ export default {
},
onLoad(options) {
this.partnerId = options.partnerId || ''
getImages().then(({data}) => this.images = data);
getImages().then(({data}) => this.images = data)
getShopData(this.partnerId).then(({data}) => {
this.partnerType = data.partnerType;
this.hotelId = data.hotelId;
this.hasHotel = data.hasHotel;
this.hasSupplier = data.hasSupplier;
this.hasWholesaler = data.hasWholesaler;
this.partnerType = data.partnerType
this.hotelId = data.hotelId
this.hasHotel = data.hasHotel
this.hasSupplier = data.hasSupplier
this.hasWholesaler = data.hasWholesaler
})
},
methods: {
goto(target) {
switch (target) {
case "goods_supplier":
case 'goods_supplier':
if (this.hasSupplier === 1) {
this.$global.goSupplierMini();
// uni.showToast({
// title: "您已成为供应商/员工,无需重复申请",
// icon: "none"
// })
this.$global.goSupplierMini()
} else {
this.$yrouter.push(`/pkg_join/views/supplier?type=goods_supplier&partnerId=${this.partnerId}`)
}
break;
case "wenwan_supplier":
break
case 'wenwan_supplier':
if (this.hasSupplier === 1) {
this.$global.goSupplierMini();
// uni.showToast({
// title: "您已成为供应商/员工,无需重复申请",
// icon: "none"
// })
this.$global.goSupplierMini()
} else {
this.$yrouter.push(`/pkg_join/views/supplier?type=wenwan_supplier&partnerId=${this.partnerId}`)
}
break;
case "shop":
break
case 'shop':
if (this.hasHotel === 1) {
// uni.showToast({
// title: "您已开通店铺,无需重复申请",
// icon: "none"
// })
this.$yrouter.push("/pagesInn/inn/innHome?id="+this.hotelId)
this.$yrouter.push('/pagesInn/inn/innHome?id='+this.hotelId)
} else {
this.$yrouter.push('/pkg_join/views/shop?partnerId=' + this.partnerId)
}
break;
case "wholesaler":
break
case 'wholesaler':
if (this.hasWholesaler === 1) {
this.$global.goSupplierMini();
// uni.showToast({
// title: "您已成为采购批发商,无需重复申请",
// icon: "none"
// })
this.$global.goSupplierMini()
} else {
this.$yrouter.push(`/pkg_join/views/wholesaler`)
}
break;
break
}
}
}
+228 -156
View File
@@ -1,18 +1,37 @@
<template>
<u--form :model="form" errorType="toast" labelWidth="216rpx" ref="shopForm">
<view class="box-state" v-if="stateTitle && isDraft!==1">
<u-alert :center="stateType==='primary'" :title="stateTitle" :type="stateType"/>
<u--form
ref="shopForm"
:model="form"
errorType="toast"
labelWidth="216rpx"
>
<view
v-if="stateTitle && isDraft !== 1"
class="box-state"
>
<u-alert
:center="stateType === 'primary'"
:title="stateTitle"
:type="stateType"
/>
</view>
<u-cell-group title="店铺基本信息" :border="false" :customStyle="{'fontSize':'40rpx'}">
<u-cell-group
:border="false"
:customStyle="{'fontSize':'40rpx'}"
title="店铺基本信息"
>
<u-form-item prop="name">
<u-cell title="店铺名称" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="form.name" border="none" placeholder="请填写店铺名称"/>
<u-input
v-model="form.name"
:disabled="reviewing"
border="none"
placeholder="请填写店铺名称"
/>
</template>
</u-cell>
</u-form-item>
@@ -24,6 +43,7 @@
<template #value>
<u-radio-group
v-model="form.coverType"
:disabled="reviewing"
placement="row"
>
<u-radio
@@ -94,22 +114,21 @@
</template>
</u-cell>
</u-form-item>
<u-form-item prop="pics">
<u-cell title="店铺图片" :border="false">
<template #label>
<u-upload
:fileList="pics"
@afterRead="afterRead"
@delete="deletePic"
name="pics"
multiple
:maxCount="9"
></u-upload>
:fileList="pics"
:maxCount="9"
:disabled="reviewing"
name="pics"
multiple
@afterRead="afterRead"
@delete="deletePic"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="logo">
<u-cell title="店铺logo" :border="false">
<template #icon>
@@ -119,13 +138,19 @@
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoImg('logo')">
<view class="btn-upload" v-if="form.logo.length===0 || form.logo==null">上传图片</view>
<image class="img-preview" :src="form.logo" v-else/>
<view
v-if="!form.logo"
class="btn-upload"
>上传图片</view>
<image
v-else
:src="form.logo"
class="img-preview"
/>
</view>
</template>
</u-cell>
</u-form-item>
<view class="full-title">
<u-cell :border="false">
<template #title>
@@ -137,17 +162,17 @@
</template>
<template #label>
<u-upload
:fileList="quaPics"
@afterRead="quaAfterRead"
@delete="quaDeletePic"
name="quaPics"
multiple
:maxCount="9"
></u-upload>
:maxCount="9"
:fileList="quaPics"
:disabled="reviewing"
name="quaPics"
multiple
@afterRead="quaAfterRead"
@delete="quaDeletePic"
/>
</template>
</u-cell>
</view>
<u-form-item prop="typeText">
<u-cell title="店铺类型" :border="false" isLink>
<template #icon>
@@ -157,6 +182,7 @@
<picker
:value="indexType"
:range="columnsType"
:disabled="reviewing"
mode=selector
range-key="name"
class="picker"
@@ -174,22 +200,31 @@
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="form.contact" border="none" placeholder="请填写姓名"/>
<u-input
v-model="form.contact"
:disabled="reviewing"
border="none"
placeholder="请填写姓名"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="phone">
<u-cell title="联系方式" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="form.phone" border="none" placeholder="请填写联系方式"/>
<u-input
v-model="form.phone"
:disabled="reviewing"
type="number"
border="none"
placeholder="请填写联系方式"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="captcha">
<u-cell title="验证码" :border="false">
<template #icon>
@@ -198,9 +233,14 @@
<template #value>
<view class="captcha-wrap">
<view class="captcha-wrap-input">
<u-input v-model="form.captcha" border="none" placeholder="请填写验证码" />
<u-input
v-model="form.captcha"
:disabled="reviewing"
border="none"
placeholder="请填写验证码"
/>
</view>
<view class="captcha-wrap-ft">
<view v-if="!reviewing" class="captcha-wrap-ft">
<u-code
ref="uCode"
seconds="30"
@@ -218,7 +258,6 @@
</template>
</u-cell>
</u-form-item>
<u-form-item prop="area">
<u-cell title="省市区" :border="false" isLink>
<template #icon>
@@ -226,74 +265,99 @@
</template>
<template #value>
<view class="u-text__value" :class="{'area-item':form.area.length===0}">
<CitySelect ref="cityselect" :defaultValue="form.area" @callback="result" :items="district"/>
<CitySelect
ref="cityselect"
:defaultValue="form.area"
:disabled="reviewing"
:items="district"
@callback="result"
/>
</view>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="address">
<u-cell title="详细地址" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="form.address" border="none" placeholder="请填写详细地址"/>
<u-input
v-model="form.address"
:disabled="reviewing"
border="none"
placeholder="请填写详细地址"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="position">
<u-cell title="地理定位选择" :border="false" isLink @click="chooLocation">
<u-cell
title="地理定位选择"
:border="false"
isLink
@click="chooLocation"
>
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u--text :text="form.position" v-if="form.position"></u--text>
<u--text text="请选择" color="#c0c4cc" v-else></u--text>
<u--text v-if="form.position" :text="form.position"></u--text>
<u--text v-else text="请选择" color="#c0c4cc"></u--text>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="content">
<u-cell title="一句话介绍" :border="false">
<template #icon>
<text class="required">*</text>
</template>
</u-cell>
<view class="content-section">
<u-cell :border="false">
<template #title>
<view class="line">
<u-input v-model="form.content" border="none" placeholder="请填写一句话..."/>
<u-input
v-model="form.content"
:disabled="reviewing"
border="none"
placeholder="请填写一句话..."
/>
</view>
</template>
</u-cell>
</view>
</u-form-item>
<view style="height: 100rpx;width: 100%;"></view>
<!-- <u-form-item prop="desc">
<view class="content-section">
<u-cell title="店铺简介" :border="false">
<template #label>
<view class="line">
<u--textarea v-model="form.desc" border="none" placeholder="请填写店铺简介..."></u--textarea>
</view>
</template>
</u-cell>
</view>
</u-form-item> -->
</u-cell-group>
<view class="btn-submit btn-remove" v-if="reviewStatus===0 && isDraft!==1" @click="changeRemove(true)">撤销申请</view>
<view class="btn-submit" @click="onSubmit" v-else>提交申请</view>
<u-modal :show="showRemove" content="您确定撤销申请吗?" showCancelButton @cancel="changeRemove(false)"
@confirm="onRemove"></u-modal>
<u-popup :show="show" mode="center" round="10" closeable @close="show=false">
<view
v-if="reviewStatus === 0 && isDraft !== 1"
class="btn-submit btn-remove"
@click="changeRemove(true)"
>
撤销申请
</view>
<view
v-else
class="btn-submit"
@click="onSubmit"
>
提交申请
</view>
<u-modal
:show="showRemove"
content="您确定撤销申请吗?"
showCancelButton
@cancel="changeRemove(false)"
@confirm="onRemove"
/>
<u-popup
:show="show"
mode="center"
round="10"
closeable
@close="show=false"
>
<view class="popup-body">
<view class="tc bold">入驻申请须知</view>
<view class="content">
@@ -307,34 +371,39 @@
<text>我已仔细阅读并同意</text>
</checkbox-group>
</view>
<u-button type="error" text="确定" :disabled="!isAgree" @click="save"></u-button>
<u-button
type="error"
text="确定"
:disabled="!isAgree"
@click="save"
/>
</view>
</u-popup>
</u--form>
</template>
<script>
import CitySelect from "@/components/CitySelect"
import CitySelect from '@/components/CitySelect'
import { pageListenMixins } from '@/mixins/pageListenMixins'
import {
getShopData,
getShopInfo,
removeApply,
saveShop
} from "@/api/join"
} from '@/api/join'
import {
getCity,
registerVerify
} from "@/api/user"
} from '@/api/user'
import {
chooseImage,
moreImage,
uploadImage,
chooseVideoToUpload
} from "@/utils"
} from '@/utils'
export default {
name: "PkgJoinShop",
name: 'PkgJoinShop',
components: {
CitySelect
},
@@ -344,7 +413,7 @@ export default {
partnerId: null,
pics: [],
quaPics: [],
tips: '',
tips: '获取验证码',
form: {
name: '',
cover: '',
@@ -447,45 +516,56 @@ export default {
reviewStatus: null,
stateTitle: '',
stateType: 'primary',
isPass: false,
// 是否为审核中
reviewing: false,
pageKeyId: Object.freeze('merchantApplyHotel')
}
},
onLoad(options) {
this.partnerId = options.partnerId;
this.init();
this.partnerId = options.partnerId
this.init()
},
onReady() {
this.$refs.shopForm.setRules(this.rules);
this.$refs.shopForm.setRules(this.rules)
},
methods: {
changeRemove(state){
this.showRemove=state
this.showRemove = state
},
codeChange(text) {
this.tips = text;
this.tips = text
},
getCode() {
if (this.form.phone.length === 0) return;
if (this.reviewing) return
if (this.form.phone.length === 0) {
uni.$u.toast('请输入位手机号')
return
}
if (this.form.phone.length !== 11) {
uni.$u.toast('请输入11位手机号')
return
}
if (this.$refs.uCode.canGetCode) {
uni.showLoading({
title: '正在获取验证码'
})
registerVerify({phone: this.form.phone, type: "merchantApply"}).then(() => {
uni.hideLoading();
registerVerify({
phone: this.form.phone,
type: 'merchantApply'
}).then(() => {
uni.hideLoading()
// 这里此提示会被this.start()方法中的提示覆盖
uni.$u.toast('验证码已发送');
uni.$u.toast('验证码已发送')
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
this.$refs.uCode.start()
}).catch(err => {
uni.hideLoading();
uni.$u.toast(err.msg);
uni.hideLoading()
uni.$u.toast(err.msg)
})
} else {
uni.$u.toast('倒计时结束后再发送');
uni.$u.toast('倒计时结束后再发送')
}
},
init() {
getCity().then(({data}) => {
this.district = data
@@ -500,30 +580,30 @@ export default {
initInfo() {
getShopInfo().then(({data}) => {
if (data.partnerId != null) {
this.partnerId = data.partnerId;
this.partnerId = data.partnerId
}
this.isDraft = data.isDraft;
this.reviewStatus = data.reviewStatus;
this.isDraft = data.isDraft
this.reviewStatus = data.reviewStatus
switch (data.reviewStatus) {
case 0:
this.stateTitle = "审核中";
this.stateType = "primary";
break;
this.stateTitle = '审核中'
this.stateType = 'primary'
this.reviewing = true
break
case 1:
this.isPass = true;
break;
this.reviewing = false
break
case 2:
this.stateTitle = "审核驳回:" + data.reviewMsg;
this.stateType = "error";
break;
this.stateTitle = '审核驳回:' + data.reviewMsg
this.stateType = 'error'
this.reviewing = false
break
}
if (data.hotelInfo) {
// 店铺图片
this.pics = []
this.form = data.hotelInfo
const picsTemp = this.form.pics.split(",")
const picsTemp = this.form.pics.split(',')
if (picsTemp.length > 0) {
picsTemp.map(item => {
if (item) {
@@ -533,7 +613,7 @@ export default {
}
// 商家资质
this.quaPics = []
const quaPicsTemp = this.form.qualification.split(",")
const quaPicsTemp = this.form.qualification.split(',')
if (quaPicsTemp.length > 0) {
quaPicsTemp.map(item => {
if (item) {
@@ -545,57 +625,55 @@ export default {
if (this.indexType !== -1) {
this.form.typeText = this.columnsType[this.indexType].name
}
this.form.position = this.$forceToDecimal(this.form.longitude, 6) + ',' + this.$forceToDecimal(this.form.latitude, 6);
this.form.area = `${this.form.provinceName} ${this.form.cityName} ${this.form.areaName}`;
this.form.position = this.$forceToDecimal(this.form.longitude, 6) + ',' + this.$forceToDecimal(this.form.latitude, 6)
this.form.area = `${this.form.provinceName} ${this.form.cityName} ${this.form.areaName}`
}
});
})
},
chooseLogoImg(target) {
if (this.reviewing) return
chooseImage(img => {
this.form[target] = img;
});
this.form[target] = img
})
},
chooseLogoVideo() {
if (this.reviewing) return
chooseVideoToUpload(path => {
this.form.coverVideo = path
this.$forceUpdate()
})
},
chooseShopImg() {
let that = this;
let count = 0;
if (this.reviewing) return
const _this = this
let count = 0
moreImage(9, (img, total) => {
if (img) that.pics.push(img);
count++;
if (img) {
_this.pics.push(img)
count++
}
if (count === total) {
that.form.pics = that.pics.join(",");
_this.form.pics = _this.pics.join(',')
}
})
},
// 删除图片
deletePic(event) {
this[`${event.name}`].splice(event.index, 1)
},
afterRead(event) {
let that = this;
const _this = this
if (event.file.length > 0) {
event.file.map(item => {
uploadImage(item.url, img => {
that.pics.push({url: img})
_this.pics.push({url: img})
})
})
}
},
// 删除图片
quaDeletePic(event) {
this[`${event.name}`].splice(event.index, 1)
},
quaAfterRead(event) {
let that = this;
if (event.file.length > 0) {
@@ -616,73 +694,68 @@ export default {
}
})
},
// 省市区
result(values) {
this.address = {
province: values.province.name || "",
city: values.city.name || "",
district: values.district.name || "",
province: values.province.name || '',
city: values.city.name || '',
district: values.district.name || '',
provinceId: values.province.id,
cityId: values.city.id,
areaId: values.district.id
};
this.form.area = `${this.address.province} ${this.address.city} ${this.address.district}`;
this.form.provinceId = values.province.id;
this.form.cityId = values.city.id;
this.form.areaId = values.district.id;
}
this.form.area = `${this.address.province} ${this.address.city} ${this.address.district}`
this.form.provinceId = values.province.id
this.form.cityId = values.city.id
this.form.areaId = values.district.id
},
// 定位
chooLocation() {
let that = this;
const _this = this
uni.chooseLocation({
success: function (res) {
that.form.address = res.address;
that.form.longitude = that.$forceToDecimal(res.longitude, 6);
that.form.latitude = that.$forceToDecimal(res.latitude, 6);
that.form.position = that.$forceToDecimal(res.longitude, 6) + ',' + that.$forceToDecimal(res.latitude, 6);
_this.form.address = res.address
_this.form.longitude = _this.$forceToDecimal(res.longitude, 6)
_this.form.latitude = _this.$forceToDecimal(res.latitude, 6)
_this.form.position = _this.$forceToDecimal(res.longitude, 6) + ',' + _this.$forceToDecimal(res.latitude, 6)
}
});
})
},
onSubmit() {
if (this.reviewStatus === 0) return;
if (this.reviewStatus === 0) return
if (this.quaPics.length === 0) {
uni.showToast({
title: "请上传营业执照",
icon: "none"
title: '请上传营业执照',
icon: 'none'
})
return;
return
}
this.$refs.shopForm.validate().then(res => {
// 校验通过
this.show = true;
this.show = true
}).catch(errors => {
// 校验失败
console.log(errors)
})
},
onRemove() {
removeApply().then(res => {
uni.showToast({
title: res.msg,
icon: "none",
icon: 'none',
duration: 3000,
success: () => {
this.showRemove = false;
this.showRemove = false
setTimeout(() => {
uni.navigateBack();
uni.navigateBack()
}, 3000)
}
})
});
})
},
changeAgree(event) {
this.isAgree = event.detail.value.length > 0
},
save() {
this.form.pics = ''
const picsLength = this.pics.length
@@ -693,7 +766,6 @@ export default {
})
this.form.pics = tempArr.join(',')
}
this.form.qualification = ''
const quaPicsLength = this.quaPics.length
if (quaPicsLength > 0) {
@@ -710,20 +782,20 @@ export default {
saveShop(postData, this.partnerId).then(res => {
if (res.status === 200) {
uni.showToast({
title: "您的入驻申请已提交成功,请耐心等待审核",
icon: "none",
title: '您的入驻申请已提交成功,请耐心等待审核',
icon: 'none',
success: () => {
this.initInfo();
this.show = false;
this.initInfo()
this.show = false
}
})
}
}).catch(err => {
uni.showToast({
title: err.msg,
icon: "none",
icon: 'none',
success: () => {
this.show = false;
this.show = false
}
})
})
File diff suppressed because it is too large Load Diff
+215 -130
View File
@@ -1,82 +1,122 @@
<template>
<u--form :model="form" errorType="toast" labelWidth="216rpx" ref="wholesalerForm">
<view class="box-state" v-if="stateTitle && isDraft!==1 && applyType === 4">
<u-alert :center="stateType==='primary'" :title="stateTitle" :type="stateType"/>
<u--form
ref="wholesalerForm"
:model="form"
errorType="toast"
labelWidth="216rpx"
>
<view
v-if="stateTitle && isDraft!==1 && applyType === 4"
class="box-state"
>
<u-alert
:center="stateType === 'primary'"
:title="stateTitle"
:type="stateType"
/>
</view>
<u-cell-group title="采购批发商基本信息" :border="false" :customStyle="{'fontSize':'40rpx'}">
<u-cell-group
:border="false"
:customStyle="{'fontSize':'40rpx'}"
title="采购批发商基本信息"
>
<u-form-item prop="name">
<u-cell title="批发商名称" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="form.name" border="none" placeholder="请填写批发商名称"/>
<u-input
v-model="form.name"
:disabled="reviewing"
border="none"
placeholder="请填写批发商名称"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="avatar">
<u-cell title="头像" :border="false"/>
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoImg('avatar')">
<view class="btn-upload" v-if="form.avatar.length===0">上传图片</view>
<image class="img-preview" :src="form.avatar" v-else/>
<view
v-if="!form.avatar"
class="btn-upload"
>上传图片</view>
<image
v-else
:src="form.avatar"
class="img-preview"
/>
</view>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="contact">
<u-cell title="联系人姓名" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="form.contact" border="none" placeholder="请填写联系人姓名"/>
<u-input
v-model="form.contact"
:disabled="reviewing"
border="none"
placeholder="请填写姓名"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="phone">
<u-cell title="联系方式" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="form.phone" border="none" placeholder="请填写联系方式"/>
<u-input
v-model="form.phone"
:disabled="reviewing"
type="number"
border="none"
placeholder="请填写联系方式"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="captcha">
<u-cell title="验证码" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="form.captcha" border="none" placeholder="请填写验证码">
<template slot="suffix">
<view class="captcha-wrap">
<view class="captcha-wrap-input">
<u-input
v-model="form.captcha"
:disabled="reviewing"
border="none"
placeholder="请填写验证码"
/>
</view>
<view class="captcha-wrap-ft">
<u-code
ref="uCode"
@change="codeChange"
seconds="30"
changeText="X秒重新获取"
></u-code>
ref="uCode"
seconds="30"
changeText="X秒重新获取"
@change="codeChange"
/>
<u-button
@tap="getCode"
:text="tips"
type="success"
size="normal"
></u-button>
</template>
</u-input>
:text="tips"
type="success"
size="normal"
@tap="getCode"
/>
</view>
</view>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="qualification">
<view class="licence-section">
<u-cell :border="false">
@@ -92,14 +132,20 @@
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoImg('licence')">
<view class="btn-upload" v-if="form.qualification.length===0">上传图片</view>
<image class="img-preview" :src="form.qualification" v-else/>
<view
v-if="!form.qualification"
class="btn-upload"
>上传图片</view>
<image
v-else
:src="form.qualification"
class="img-preview"
/>
</view>
</template>
</u-cell>
</view>
</u-form-item>
<u-form-item prop="area">
<u-cell title="省市区" :border="false" isLink>
<template #icon>
@@ -107,30 +153,54 @@
</template>
<template #value>
<view class="u-text__value" :class="{'area-item':form.area.length===0}">
<CitySelect ref="cityselect" :defaultValue="form.area" @callback="result" :items="district"/>
<CitySelect
ref="cityselect"
:defaultValue="form.area"
:disabled="reviewing"
:items="district"
@callback="result"
/>
</view>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="address">
<u-cell title="详细地址" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="form.address" border="none" placeholder="请填写详细地址"/>
<u-input
v-model="form.address"
:disabled="reviewing"
border="none"
placeholder="请填写详细地址"
/>
</template>
</u-cell>
</u-form-item>
</u-cell-group>
<view class="btn-submit btn-remove" v-if="reviewStatus===0 && isDraft!==1" @click="changeRemove(true)">撤销申请</view>
<view class="btn-submit" @click="onSubmit" v-else>提交申请</view>
<u-modal :show="showRemove" content="您确定撤销申请吗?" showCancelButton @cancel="changeRemove(false)"
@confirm="onRemove"></u-modal>
<view
v-if="reviewStatus === 0 && isDraft !== 1"
class="btn-submit btn-remove"
@click="changeRemove(true)"
>
撤销申请
</view>
<view
v-else
class="btn-submit"
@click="onSubmit"
>
提交申请
</view>
<u-modal
:show="showRemove"
content="您确定撤销申请吗?"
showCancelButton
@cancel="changeRemove(false)"
@confirm="onRemove"
/>
<u-popup :show="show" mode="center" round="10" closeable @close="show=false">
<view class="popup-body">
<view class="tc bold">入驻申请须知</view>
@@ -145,37 +215,42 @@
<text>我已仔细阅读并同意</text>
</checkbox-group>
</view>
<u-button type="error" text="确定" :disabled="!isAgree" @click="save"></u-button>
<u-button
type="error"
text="确定"
:disabled="!isAgree"
@click="save"
/>
</view>
</u-popup>
</u--form>
</template>
<script>
import CitySelect from "@/components/CitySelect";
import {getShopData, getWholesaler, removeApply, saveWholesaler} from "@/api/join";
import {getCity, registerVerify} from "@/api/user";
import {chooseImage} from "@/utils";
import CitySelect from '@/components/CitySelect'
import {getShopData, getWholesaler, removeApply, saveWholesaler} from '@/api/join'
import {getCity, registerVerify} from '@/api/user'
import {chooseImage} from '@/utils'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: "pkgJoinWholesaler",
name: 'pkgJoinWholesaler',
components: {
CitySelect
},
mixins: [pageListenMixins],
data() {
return {
tips: "",
tips: '获取验证码',
form: {
name: "",
avatar: "",
contact: "",
phone: "",
captcha: "",
qualification: "",
area: "",
address: ""
name: '',
avatar: '',
contact: '',
phone: '',
captcha: '',
qualification: '',
area: '',
address: ''
},
rules: {
'name': {
@@ -221,175 +296,178 @@ export default {
trigger: ['blur', 'change']
}
},
district: [],
address: {},
isAgree: false,
show: false,
notice: "",
notice: '',
showRemove: false,
applyType: null,
isDraft: null,
reviewStatus: null,
stateTitle: "",
stateType: "primary",
isPass: false,
stateTitle: '',
stateType: 'primary',
// 是否为审核中
reviewing: false,
pageKeyId: Object.freeze('merchantApplyWholesaler')
}
},
onLoad(options) {
this.init();
this.init()
},
onReady() {
this.$refs.wholesalerForm.setRules(this.rules);
this.$refs.wholesalerForm.setRules(this.rules)
},
methods: {
changeRemove(state){
this.showRemove=state
this.showRemove = state
},
codeChange(text) {
this.tips = text;
this.tips = text
},
getCode() {
if (this.form.phone.length === 0) return;
if (this.reviewing) return
if (this.form.phone.length === 0) {
uni.$u.toast('请输入位手机号')
return
}
if (this.form.phone.length !== 11) {
uni.$u.toast('请输入11位手机号')
return
}
if (this.$refs.uCode.canGetCode) {
uni.showLoading({
title: '正在获取验证码'
})
registerVerify({phone: this.form.phone, type: "merchantApply"}).then(() => {
uni.hideLoading();
registerVerify({
phone: this.form.phone,
type: 'merchantApply'
}).then(() => {
uni.hideLoading()
// 这里此提示会被this.start()方法中的提示覆盖
uni.$u.toast('验证码已发送');
uni.$u.toast('验证码已发送')
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
this.$refs.uCode.start()
}).catch(err => {
uni.hideLoading();
uni.$u.toast(err.msg);
uni.hideLoading()
uni.$u.toast(err.msg)
})
} else {
uni.$u.toast('倒计时结束后再发送');
uni.$u.toast('倒计时结束后再发送')
}
},
init() {
getCity().then(({data}) => {
this.district = data;
});
this.district = data
})
getShopData().then(({data}) => {
this.notice = data.merchantApplyNotice;
this.initInfo();
});
this.notice = data.merchantApplyNotice
this.initInfo()
})
},
initInfo() {
getWholesaler().then(({data}) => {
this.applyType = data.applyType;
this.applyType = data.applyType
if (data.applyType === 4) {
this.isDraft = data.isDraft;
this.reviewStatus = data.reviewStatus;
this.isDraft = data.isDraft
this.reviewStatus = data.reviewStatus
}
switch (data.reviewStatus) {
case 0:
this.stateTitle = "审核中";
this.stateType = "primary";
this.stateTitle = '审核中'
this.stateType = 'primary'
this.reviewing = true
break;
case 1:
this.isPass = true;
this.reviewing = false
break;
case 2:
this.stateTitle = "审核驳回:" + data.reviewMsg;
this.stateType = "error";
this.stateTitle = '审核驳回:' + data.reviewMsg
this.stateType = 'error'
this.reviewing = false
break;
}
if (data.wholesalerInfo) {
this.form = data.wholesalerInfo;
this.form.position = this.$forceToDecimal(this.form.longitude, 6) + ',' + this.$forceToDecimal(this.form.latitude, 6);
this.form.area = `${this.form.provinceName} ${this.form.cityName} ${this.form.areaName}`;
this.form = data.wholesalerInfo
this.form.position = this.$forceToDecimal(this.form.longitude, 6) + ',' + this.$forceToDecimal(this.form.latitude, 6)
this.form.area = `${this.form.provinceName} ${this.form.cityName} ${this.form.areaName}`
}
});
})
},
chooseLogoImg(target) {
if (this.reviewing) return
chooseImage(img => {
switch (target) {
case "avatar":
this.form.avatar = img;
break;
case "licence":
this.form.qualification = img;
break;
case 'avatar':
this.form.avatar = img
break
case 'licence':
this.form.qualification = img
break
}
});
})
},
// 省市区
result(values) {
this.address = {
province: values.province.name || "",
city: values.city.name || "",
district: values.district.name || "",
province: values.province.name || '',
city: values.city.name || '',
district: values.district.name || '',
provinceId: values.province.id,
cityId: values.city.id,
areaId: values.district.id
};
this.form.area = `${this.address.province} ${this.address.city} ${this.address.district}`;
this.form.provinceId = values.province.id;
this.form.cityId = values.city.id;
this.form.areaId = values.district.id;
}
this.form.area = `${this.address.province} ${this.address.city} ${this.address.district}`
this.form.provinceId = values.province.id
this.form.cityId = values.city.id
this.form.areaId = values.district.id
},
onSubmit() {
this.$refs.wholesalerForm.validate().then(res => {
// 校验通过
this.show = true;
this.show = true
}).catch(errors => {
// 校验失败
console.log(errors)
})
},
onRemove() {
removeApply().then(res => {
uni.showToast({
title: res.msg,
icon: "none",
icon: 'none',
duration: 3000,
success: () => {
this.showRemove = false;
this.showRemove = false
setTimeout(() => {
uni.navigateBack();
uni.navigateBack()
}, 3000)
}
})
});
})
},
changeAgree(event) {
this.isAgree = event.detail.value.length > 0
},
save() {
saveWholesaler(this.form).then(res => {
if (res.status === 200) {
uni.showToast({
title: "您的入驻申请已提交成功,请耐心等待审核",
icon: "none",
title: '您的入驻申请已提交成功,请耐心等待审核',
icon: 'none',
success: () => {
this.initInfo();
this.show = false;
this.initInfo()
this.show = false
}
})
}
}).catch(err => {
uni.showToast({
title: err.msg,
icon: "none",
icon: 'none',
success: () => {
this.show = false;
this.show = false
}
})
})
@@ -421,4 +499,11 @@ export default {
.font-color-red{
font-size: 24rpx;
}
.captcha-wrap {
display: flex;
align-items: center;
.captcha-wrap-input {
flex: 1;
}
}
</style>