Feat(时令尝鲜):接口对接

This commit is contained in:
lifizer
2023-09-23 18:13:26 +08:00
parent c9ceac9f37
commit 2d73c2fe46
35 changed files with 2834 additions and 1547 deletions
+45 -78
View File
@@ -2,28 +2,22 @@
<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 class="content flex ai-center">-->
<!-- <image class="img-fire" :src="webUrl+'/20230413103130660107.png'" mode="scaleToFill"/>-->
<!-- <view class="txt flex ai-center">目前已有-->
<!-- <text>{{ count }}</text>-->
<!-- 人参加活动-->
<!-- </view>-->
<!-- </view>-->
</view>
<!-- <view class="box flex flex-col ai-center">-->
<!-- <image class="img-title" :src="webUrl+'/20230413103123003753.png'" mode="scaleToFill"/>-->
<!-- </view>-->
<image class="img-item" :src="images.goodSupplierImage"
<image class="img-item" mode="widthFix" :src="images.goodSupplierImage"
@click="goto('goods_supplier')" v-show="partnerType==='province_partner'||partnerType===''"/>
<image class="img-item" :src="images.wenwanSupplierImage"
<image class="img-item" mode="widthFix" :src="images.wenwanSupplierImage"
@click="goto('wenwan_supplier')" v-show="partnerType==='pioneer'||partnerType===''"/>
<image class="img-item" :src="images.hotelImage"
<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')"/>
</view>
</template>
<script>
import {getCount, getImages, getShopData} from "@/api/join";
import {getImages, getShopData} from "@/api/join";
export default {
name: "pkgJoinIndex",
@@ -32,55 +26,72 @@ export default {
webUrl: this.$VUE_APP_RESOURCES_URL,
partnerId: "",
partnerType: "",
count: 0,
hotelId: null,
hasHotel: null,
hasSupplier: null,
hasWholesaler: null,
images: null
}
},
onLoad(options) {
this.partnerId = options.partnerId || "";
getCount().then(({data}) => this.count = data.count);
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;
})
},
methods: {
goto(target) {
switch (target) {
case "goods_supplier":
if (this.hasSupplier === 1) {
uni.showToast({
title: "您已成为供应商/员工,无需重复申请",
icon: "none"
})
this.$global.goSupplierMini();
// uni.showToast({
// title: "您已成为供应商/员工,无需重复申请",
// icon: "none"
// })
} else {
this.$yrouter.push(`/pkg_join/views/supplier?type=goods_supplier&partnerId=${this.partnerId}`)
}
break;
case "wenwan_supplier":
if (this.hasSupplier === 1) {
uni.showToast({
title: "您已成为供应商/员工,无需重复申请",
icon: "none"
})
this.$global.goSupplierMini();
// uni.showToast({
// title: "您已成为供应商/员工,无需重复申请",
// icon: "none"
// })
} else {
this.$yrouter.push(`/pkg_join/views/supplier?type=wenwan_supplier&partnerId=${this.partnerId}`)
}
break;
case "shop":
if (this.hasHotel === 1) {
uni.showToast({
title: "您已开通店铺,无需重复申请",
icon: "none"
})
// uni.showToast({
// title: "您已开通店铺,无需重复申请",
// icon: "none"
// })
this.$yrouter.push("/pagesInn/inn/innHome?id="+this.hotelId)
} else {
this.$yrouter.push('/pkg_join/views/shop?partnerId=' + this.partnerId)
}
break;
case "wholesaler":
if (this.hasWholesaler === 1) {
this.$global.goSupplierMini();
// uni.showToast({
// title: "您已成为采购批发商,无需重复申请",
// icon: "none"
// })
} else {
this.$yrouter.push(`/pkg_join/views/wholesaler`)
}
break;
}
}
}
@@ -89,6 +100,8 @@ export default {
<style scoped lang="less">
.pkg-join-index {
padding-bottom: 46rpx;
image {
vertical-align: middle;
}
@@ -98,57 +111,11 @@ export default {
height: 378rpx;
}
.img-title {
width: 556rpx;
height: 104rpx;
margin: 20rpx 0;
}
.img-fire {
width: 56rpx;
height: 56rpx;
margin-right: 4rpx;
}
.img-item {
width: 682rpx;
height: 320rpx;
margin: 0 34rpx 46rpx;
}
.box {
width: 682rpx;
//height: 240rpx;
margin: 24rpx auto 30rpx;
border-radius: 40rpx;
background: rgba(255, 0, 85, 0.02);
}
.content {
width: 516rpx;
height: 64rpx;
box-sizing: border-box;
padding: 0 28rpx;
border-radius: 36rpx;
background: rgba(255, 86, 74, 0.08);
}
.txt {
color: #FF564A;
font-size: 32rpx;
font-weight: bold;
text {
display: inline-flex;
align-items: center;
height: 40rpx;
margin: 0 8rpx;
padding: 0 18rpx;
border-radius: 8rpx;
background: #FF0055;
color: #FFFFFF;
font-size: 28rpx;
}
height: auto;
margin: 40rpx 34rpx 0;
border-radius: 20px;
}
}
</style>
</style>
+152 -9
View File
@@ -25,7 +25,7 @@
</u-cell>
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoImg('shop')">
<view class="box-upload" @click="chooseLogoImg('cover')">
<view class="btn-upload" v-if="form.cover.length===0 || form.cover==null">上传图片</view>
<image class="img-preview" :src="form.cover" v-else/>
</view>
@@ -48,6 +48,44 @@
</u-cell>
</u-form-item>
<u-form-item prop="logo">
<u-cell title="店铺logo" :border="false">
<template #icon>
<text class="required">*</text>
</template>
</u-cell>
<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>
</template>
</u-cell>
</u-form-item>
<view class="full-title">
<u-cell :border="false">
<template #title>
<view>
<text class="required" style="margin-right: 10rpx">*</text>
商家资质
<text class="font-color-red">请上传营业执照及行业相关资质证明</text>
</view>
</template>
<template #label>
<u-upload
:fileList="quaPics"
@afterRead="quaAfterRead"
@delete="quaDeletePic"
name="quaPics"
multiple
:maxCount="9"
></u-upload>
</template>
</u-cell>
</view>
<u-form-item prop="typeText">
<u-cell title="店铺类型" :border="false" isLink @click="showType=true">
<template #icon>
@@ -85,6 +123,32 @@
</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">
<u-code
ref="uCode"
@change="codeChange"
seconds="30"
changeText="X秒重新获取"
></u-code>
<u-button
@tap="getCode"
:text="tips"
type="success"
size="normal"
></u-button>
</template>
</u-input>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="area">
<u-cell title="省市区" :border="false" isLink>
<template #icon>
@@ -179,7 +243,7 @@
<script>
import CitySelect from "@/components/CitySelect";
import {getShopData, getShopInfo, removeApply, saveShop} from "@/api/join";
import {getCity} from "@/api/user";
import {getCity, registerVerify} from "@/api/user";
import {chooseImage, moreImage, uploadImage} from "@/utils";
export default {
@@ -192,12 +256,17 @@ export default {
partnerId: null,
pics: [],
quaPics: [],
tips: "",
form: {
name: "",
cover: "",
logo: "",
qualification: "",
type: 0,
typeText: "",
phone: "",
captcha: "",
area: "",
address: "",
position: "",
@@ -216,6 +285,12 @@ export default {
message: '请上传店铺封面图',
trigger: ['blur', 'change']
},
'logo': {
type: 'string',
required: true,
message: '请上传店铺LOGO',
trigger: ['blur', 'change']
},
'typeText': {
type: 'string',
required: true,
@@ -234,6 +309,12 @@ export default {
message: '请填写联系方式',
trigger: ['blur', 'change']
},
'captcha': {
type: 'string',
required: true,
message: '请填写验证码',
trigger: ['blur', 'change']
},
'area': {
type: 'string',
required: true,
@@ -281,12 +362,36 @@ export default {
},
onLoad(options) {
this.partnerId = options.partnerId;
this.init();
},
onReady() {
this.$refs.shopForm.setRules(this.rules);
this.init();
},
methods: {
codeChange(text) {
this.tips = text;
},
getCode() {
if (this.form.phone.length === 0) return;
if (this.$refs.uCode.canGetCode) {
uni.showLoading({
title: '正在获取验证码'
})
registerVerify({phone: this.form.phone, type: "merchantApply"}).then(() => {
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
uni.$u.toast('验证码已发送');
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
}).catch(err => {
uni.hideLoading();
uni.$u.toast(err.msg);
})
} else {
uni.$u.toast('倒计时结束后再发送');
}
},
init() {
getCity().then(({data}) => {
this.district = data;
@@ -342,9 +447,9 @@ export default {
});
},
chooseLogoImg() {
chooseLogoImg(target) {
chooseImage(img => {
this.form.cover = img;
this.form[target] = img;
});
},
@@ -376,6 +481,21 @@ export default {
}
},
// 删除图片
quaDeletePic(event) {
this[`${event.name}`].splice(event.index, 1)
},
quaAfterRead(event) {
let that = this;
if (event.file.length > 0) {
event.file.map(item => {
uploadImage(item.url, img => {
that.quaPics.push({url: img})
})
})
}
},
// 回调参数为包含column indexs、value、values
confirmType(e) {
@@ -420,6 +540,13 @@ export default {
onSubmit() {
if (this.reviewStatus === 0) return;
if (this.quaPics.length === 0) {
uni.showToast({
title: "请上传营业执照",
icon: "none"
})
return;
}
this.$refs.shopForm.validate().then(res => {
// 校验通过
this.show = true;
@@ -434,11 +561,11 @@ export default {
title: res.msg,
icon: "none",
duration: 3000,
success:()=> {
success: () => {
this.showRemove = false;
setTimeout(()=>{
setTimeout(() => {
uni.navigateBack();
},3000)
}, 3000)
}
})
});
@@ -455,6 +582,12 @@ export default {
})
this.form.pics = this.form.pics.substring(0, this.form.pics.length - 1);
this.form.qualification = "";
this.quaPics.map(item => {
this.form.qualification += (item.url + ",");
})
this.form.qualification = this.form.qualification.substring(0, this.form.qualification.length - 1);
saveShop(this.form, this.partnerId).then(res => {
if (res.status === 200) {
uni.showToast({
@@ -494,4 +627,14 @@ export default {
font-size: 30rpx !important;
}
}
</style>
/deep/ .full-title {
.u-cell__title {
width: 100% !important;
}
}
.font-color-red {
font-size: 22rpx;
}
</style>
+164 -25
View File
@@ -51,26 +51,75 @@
</u-cell>
</u-form-item>
<u-form-item prop="qualification">
<view class="licence-section">
<u-cell title="营业执照" :border="false">
<template #icon>
<text class="required">*</text>
</template>
</u-cell>
</view>
<view class="licence-image">
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoImg('licence')">
<view class="btn-upload" v-if="formSupplier.qualification.length===0">上传图片</view>
<image class="img-preview" :src="formSupplier.qualification" v-else/>
</view>
</template>
</u-cell>
</view>
<u-form-item prop="captcha">
<u-cell title="验证码" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input v-model="formSupplier.captcha" border="none" placeholder="请填写验证码">
<template slot="suffix">
<u-code
ref="uCode"
@change="codeChange"
seconds="30"
changeText="X秒重新获取"
></u-code>
<u-button
@tap="getCode"
:text="tips"
type="success"
size="normal"
></u-button>
</template>
</u-input>
</template>
</u-cell>
</u-form-item>
<!-- <u-form-item prop="qualification">-->
<!-- <view class="licence-section">-->
<!-- <u-cell title="营业执照" :border="false">-->
<!-- <template #icon>-->
<!-- <text class="required">*</text>-->
<!-- </template>-->
<!-- </u-cell>-->
<!-- </view>-->
<!-- <view class="licence-image">-->
<!-- <u-cell :border="false">-->
<!-- <template #title>-->
<!-- <view class="box-upload" @click="chooseLogoImg('licence')">-->
<!-- <view class="btn-upload" v-if="formSupplier.qualification.length===0">上传图片</view>-->
<!-- <image class="img-preview" :src="formSupplier.qualification" v-else/>-->
<!-- </view>-->
<!-- </template>-->
<!-- </u-cell>-->
<!-- </view>-->
<!-- </u-form-item>-->
<view class="full-title">
<u-cell :border="false">
<template #title>
<view v-if="infoTitle==='特产'">商家资质
<text class="font-color-red">营业执照食品经营许可证生产许可证等行业资质</text>
</view>
<view v-else>商家资质
<text class="font-color-red">请上传营业执照及行业相关资质证明</text>
</view>
</template>
<template #label>
<u-upload
:fileList="quaPics"
@afterRead="quaAfterRead"
@delete="quaDeletePic"
name="quaPics"
multiple
:maxCount="9"
></u-upload>
</template>
</u-cell>
</view>
<!-- <u-form-item prop="typeText">-->
<!-- <u-cell title="类型" :border="false" isLink @click="showSupplierType=true">-->
<!-- <template #icon>-->
@@ -149,7 +198,7 @@
</u-cell>
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoImg('shop')">
<view class="box-upload" @click="chooseLogoImg('cover')">
<view class="btn-upload" v-if="form.cover.length===0 || form.cover==null">上传图片</view>
<image class="img-preview" :src="form.cover" v-else/>
</view>
@@ -172,6 +221,22 @@
</u-cell>
</u-form-item>
<u-form-item prop="logo">
<u-cell title="店铺logo" :border="false">
<template #icon>
<text class="required">*</text>
</template>
</u-cell>
<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>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="typeText">
<u-cell title="店铺类型" :border="false" isLink @click="showType=true">
<template #icon>
@@ -305,7 +370,7 @@
<script>
import CitySelect from "@/components/CitySelect";
import {getShopData, getShopInfo, removeApply, saveSupplier, saveWenwanSupplier} from "@/api/join";
import {getCity} from "@/api/user";
import {getCity, registerVerify} from "@/api/user";
import {chooseImage, moreImage, uploadImage} from "@/utils";
export default {
@@ -316,14 +381,17 @@ export default {
data() {
return {
partnerId: "",
tips: "",
infoTitle: "",
pics: [],
quaPics: [],
formSupplier: {
name: "",
avatar: "",
contact: "",
phone: "",
captcha: "",
qualification: "",
subType: "",
area: "",
@@ -333,6 +401,7 @@ export default {
form: {
name: "",
cover: "",
logo: "",
type: 0,
typeText: "",
phone: "",
@@ -360,6 +429,12 @@ export default {
message: '请填写联系方式',
trigger: ['blur', 'change']
},
'captcha': {
type: 'string',
required: true,
message: '请填写验证码',
trigger: ['blur', 'change']
},
'qualification': {
type: 'string',
required: true,
@@ -404,6 +479,12 @@ export default {
message: '请上传店铺封面图',
trigger: ['blur', 'change']
},
'logo': {
type: 'string',
required: true,
message: '请上传店铺LOGO',
trigger: ['blur', 'change']
},
'typeText': {
type: 'string',
required: true,
@@ -477,13 +558,37 @@ export default {
uni.setNavigationBarTitle({
title: this.infoTitle + "供应商入驻"
})
this.init();
},
onReady() {
this.$refs.shopForm.setRules(this.rules);
this.$refs.supplierForm.setRules(this.rulesSupplier);
this.init();
},
methods: {
codeChange(text) {
this.tips = text;
},
getCode() {
if (this.formSupplier.phone.length === 0) return;
if (this.$refs.uCode.canGetCode) {
uni.showLoading({
title: '正在获取验证码'
})
registerVerify({phone: this.formSupplier.phone, type: "merchantApply"}).then(() => {
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
uni.$u.toast('验证码已发送');
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
}).catch(err => {
uni.hideLoading();
uni.$u.toast(err.msg);
})
} else {
uni.$u.toast('倒计时结束后再发送');
}
},
init() {
getCity().then(({data}) => {
this.district = data;
@@ -559,9 +664,12 @@ export default {
case "licence":
this.formSupplier.qualification = img;
break;
case "shop":
case "cover":
this.form.cover = img;
break;
case "logo":
this.form.logo = img;
break;
}
});
},
@@ -594,6 +702,22 @@ export default {
}
},
// 删除图片
quaDeletePic(event) {
this[`${event.name}`].splice(event.index, 1)
},
quaAfterRead(event) {
let that = this;
if (event.file.length > 0) {
event.file.map(item => {
uploadImage(item.url, img => {
that.quaPics.push({url: img})
})
})
}
},
// 回调参数为包含column indexs、value、values
confirmType(e) {
this.indexType = e.indexs;
@@ -685,9 +809,9 @@ export default {
duration: 3000,
success: () => {
this.showRemove = false;
setTimeout(()=>{
setTimeout(() => {
uni.navigateBack();
},3000)
}, 3000)
}
})
});
@@ -703,6 +827,11 @@ export default {
this.form.pics += (item.url + ",");
})
this.formSupplier.qualification = "";
this.quaPics.map(item => {
this.formSupplier.qualification += (item.url + ",");
})
if (this.infoTitle === "特产") {
saveSupplier(this.form, this.formSupplier, this.partnerId).then(res => {
if (res.status === 200) {
@@ -777,4 +906,14 @@ export default {
font-size: 30rpx !important;
}
}
</style>
/deep/ .full-title {
.u-cell__title {
width: 100% !important;
}
}
.font-color-red {
font-size: 22rpx;
}
</style>
+416
View File
@@ -0,0 +1,416 @@
<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"/>
</view>
<u-cell-group title="采购批发商基本信息" :border="false" :customStyle="{'fontSize':'40rpx'}">
<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="请填写批发商名称"/>
</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>
</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="请填写联系人姓名"/>
</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="请填写联系方式"/>
</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">
<u-code
ref="uCode"
@change="codeChange"
seconds="30"
changeText="X秒重新获取"
></u-code>
<u-button
@tap="getCode"
:text="tips"
type="success"
size="normal"
></u-button>
</template>
</u-input>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="qualification">
<view class="licence-section">
<u-cell :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #title>
<view>商家资质<text class="font-color-red">请上传营业执照及行业相关资质证明</text></view>
</template>
</u-cell>
</view>
<view class="licence-image">
<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>
</template>
</u-cell>
</view>
</u-form-item>
<u-form-item prop="area">
<u-cell title="省市区" :border="false" isLink>
<template #icon>
<text class="required">*</text>
</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"/>
</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="请填写详细地址"/>
</template>
</u-cell>
</u-form-item>
</u-cell-group>
<view class="btn-submit btn-remove" v-if="reviewStatus===0 && isDraft!==1" @click="showRemove=true">撤销申请</view>
<view class="btn-submit" @click="onSubmit" v-else>提交申请</view>
<u-modal :show="showRemove" content="您确定撤销申请吗?" showCancelButton @cancel="showRemove=false"
@confirm="onRemove"></u-modal>
<u-popup :show="show" mode="center" round="10" closeable @close="show=false">
<view class="popup-body">
<view class="tc bold">入驻申请须知</view>
<view class="content" v-html="notice"></view>
<view class="agree-box">
<checkbox-group @change="changeAgree">
<label>
<checkbox value="yes" style="transform:scale(0.8)"/>
</label>
<text>我已仔细阅读并同意</text>
</checkbox-group>
</view>
<u-button type="error" text="确定" :disabled="!isAgree" @click="save"></u-button>
</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";
export default {
name: "pkgJoinWholesaler",
components: {
CitySelect
},
data() {
return {
tips: "",
form: {
name: "",
avatar: "",
contact: "",
phone: "",
captcha: "",
qualification: "",
area: "",
address: ""
},
rules: {
'name': {
type: 'string',
required: true,
message: '请填写批发商名称',
trigger: ['blur', 'change']
},
'contact': {
type: 'string',
required: true,
message: '请填写联系人姓名',
trigger: ['blur', 'change']
},
'phone': {
type: 'string',
required: true,
message: '请填写联系方式',
trigger: ['blur', 'change']
},
'captcha': {
type: 'string',
required: true,
message: '请填写验证码',
trigger: ['blur', 'change']
},
'qualification': {
type: 'string',
required: true,
message: '请上传营业执照',
trigger: ['blur', 'change']
},
'area': {
type: 'string',
required: true,
message: '请选择所在省市',
trigger: ['blur', 'change']
},
'address': {
type: 'string',
required: true,
message: '请填写详细地址',
trigger: ['blur', 'change']
}
},
district: [],
address: {},
isAgree: false,
show: false,
notice: "",
showRemove: false,
applyType: null,
isDraft: null,
reviewStatus: null,
stateTitle: "",
stateType: "primary",
isPass: false
}
},
onLoad(options) {
this.init();
},
onReady() {
this.$refs.wholesalerForm.setRules(this.rules);
},
methods: {
codeChange(text) {
this.tips = text;
},
getCode() {
if (this.form.phone.length === 0) return;
if (this.$refs.uCode.canGetCode) {
uni.showLoading({
title: '正在获取验证码'
})
registerVerify({phone: this.form.phone, type: "merchantApply"}).then(() => {
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
uni.$u.toast('验证码已发送');
// 通知验证码组件内部开始倒计时
this.$refs.uCode.start();
}).catch(err => {
uni.hideLoading();
uni.$u.toast(err.msg);
})
} else {
uni.$u.toast('倒计时结束后再发送');
}
},
init() {
getCity().then(({data}) => {
this.district = data;
});
getShopData().then(({data}) => {
this.notice = data.merchantApplyNotice;
this.initInfo();
});
},
initInfo() {
getWholesaler().then(({data}) => {
this.applyType = data.applyType;
if (data.applyType === 4) {
this.isDraft = data.isDraft;
this.reviewStatus = data.reviewStatus;
}
switch (data.reviewStatus) {
case 0:
this.stateTitle = "审核中";
this.stateType = "primary";
break;
case 1:
this.isPass = true;
break;
case 2:
this.stateTitle = "审核驳回:" + data.reviewMsg;
this.stateType = "error";
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}`;
}
});
},
chooseLogoImg(target) {
chooseImage(img => {
switch (target) {
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 || "",
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;
},
onSubmit() {
this.$refs.wholesalerForm.validate().then(res => {
// 校验通过
this.show = true;
}).catch(errors => {
// 校验失败
})
},
onRemove() {
removeApply().then(res => {
uni.showToast({
title: res.msg,
icon: "none",
duration: 3000,
success: () => {
this.showRemove = false;
setTimeout(() => {
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",
success: () => {
this.initInfo();
this.show = false;
}
})
}
}).catch(err => {
uni.showToast({
title: err.msg,
icon: "none",
success: () => {
this.show = false;
}
})
})
}
}
}
</script>
<style lang="less">
@import "@/assets/css/pkg_join.less";
/deep/ .cityselect-nav {
.item {
font-size: 30rpx !important;
}
}
/deep/ .cityselect-item {
.cityselect-item-box {
font-size: 30rpx !important;
}
}
/deep/ .licence-section{
.u-cell__title{
width: 650rpx!important;
}
}
.font-color-red{
font-size: 24rpx;
}
</style>