Feat(时令尝鲜):接口对接
This commit is contained in:
+152
-9
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user