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
+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>