幼教产品B2B生态平台小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

310 lines
9.2 KiB

12 months ago
<template>
11 months ago
<view class="page">
12 months ago
<view class="block">
12 months ago
<view class="form-list edit-form">
12 months ago
<view class="line with-arrow">
<view class="name">LOGO</view>
11 months ago
<image class="avatar" :src="form.logoUrl" @click="uploadLogo"></image>
12 months ago
</view>
<view class="line with-arrow">
11 months ago
<view class="name">{{ platformName }}名称</view>
<input type="text" :placeholder="'请输入' + platformName + '幼儿园名称'" v-model="form.classificationName" :disabled="info.authenticationStatus !== 0" />
12 months ago
</view>
11 months ago
<view v-if="info.platformSource === '6'" class="line with-arrow">
<view class="name">供应商分类</view>
<view class="inline">
<uni-data-picker class="picker-input" :clear-icon="false" placeholder="请选择供应商分类" popup-title="请选择供应商分类" preload :localdata="classifications" :map="{text: 'classificationName', value: 'id'}" v-model="classificationId"></uni-data-picker>
</view>
</view>
12 months ago
<view class="line textarea-line">
11 months ago
<view class="name">{{ platformName }}slogan</view>
<textarea :placeholder="'请输入' + platformName + 'slogan'" v-model="form.slogan"></textarea>
12 months ago
</view>
11 months ago
<view class="line with-arrow">
<view class="name">省份</view>
<view class="inline">
11 months ago
<uni-data-picker class="picker-input" :clear-icon="false" placeholder="请选择省份" popup-title="请选择省份" preload :localdata="provinces" :map="{text: 'provinceName', value: 'provinceName'}" v-model="form.province" @change="getCity"></uni-data-picker>
</view>
</view>
<view class="line with-arrow">
<view class="name">城市</view>
<view class="inline">
<uni-data-picker class="picker-input" :clear-icon="false" :readonly="!form.province" placeholder="请选择城市" popup-title="请选择城市" preload :localdata="cities" :map="{text: 'cityName', value: 'cityName'}" v-model="form.city"></uni-data-picker>
11 months ago
</view>
</view>
12 months ago
<view class="line textarea-line">
<view class="name">地址</view>
11 months ago
<textarea placeholder="请输入详细地址" v-model="form.address"></textarea>
</view>
<view class="line with-arrow">
<view class="name">联系电话</view>
<input type="text" placeholder="请输入联系电话" v-model="form.phone" />
12 months ago
</view>
11 months ago
<view class="line textarea-line no-bd">
11 months ago
<view class="name">{{ platformName }}简介</view>
<textarea :placeholder="'请输入' + platformName + '简介'" v-model="form.briefIntroduction"></textarea>
12 months ago
</view>
11 months ago
<view class="py">
11 months ago
<uni-file-picker v-model="desPics" limit="3" title="最多选择3张图片" :auto-upload="false" @select="uploadDes"></uni-file-picker>
11 months ago
</view>
12 months ago
</view>
</view>
11 months ago
<view class="block">
<view class="form-list edit-form">
11 months ago
<view class="line with-arrow no-bd">
<view class="name">二维码描述一</view>
<input type="text" placeholder="输入二维码描述一" v-model="form.qrCodeOneName" />
<uni-icons type="right" size="18" color="#ababab"></uni-icons>
11 months ago
</view>
11 months ago
<view class="py">
<uni-file-picker v-model="qrCodeOne" limit="1" title="上传二维码一" :auto-upload="false" @select="e => uploadQrcode(e, 'qrCodeOne')" ></uni-file-picker>
</view>
</view>
</view>
<view class="block">
<view class="form-list edit-form">
<view class="line with-arrow no-bd">
<view class="name">二维码描述二</view>
<input type="text" placeholder="输入二维码描述二" v-model="form.qrCodeTwoName" />
11 months ago
<uni-icons type="right" size="18" color="#ababab"></uni-icons>
</view>
<view class="py">
11 months ago
<uni-file-picker v-model="qrCodeTwo" limit="1" title="上传二维码二" :auto-upload="false" @select="e => uploadQrcode(e, 'qrCodeTwo')" ></uni-file-picker>
</view>
</view>
</view>
<view class="block">
<view class="form-list edit-form">
<view class="line with-arrow no-bd">
<view class="name">二维码描述三</view>
<input type="text" placeholder="输入二维码描述三" v-model="form.qrCodeThreeName" />
<uni-icons type="right" size="18" color="#ababab"></uni-icons>
</view>
<view class="py">
<uni-file-picker v-model="qrCodeThree" limit="1" title="上传二维码三" :auto-upload="false" @select="e => uploadQrcode(e, 'qrCodeThree')" ></uni-file-picker>
11 months ago
</view>
</view>
12 months ago
</view>
<view class="btn-wrap">
<view class="btn" @click="submit">保存</view>
</view>
</view>
</template>
<script>
11 months ago
import { queryProvince, queryCity, queryTeamInfo, updateTeamInfo, enterpriseCertificationStatus } from '@/apis/modules/user.js'
11 months ago
import { treeStructureList, saveSupplierClassification } from '@/apis/modules/supplier.js'
12 months ago
import OSS from '@/libs/Oss/upload'
11 months ago
import Common from '@/config/common'
12 months ago
export default {
data() {
return {
11 months ago
openId: uni.getStorageSync('openId'),
info: {},
form: {
address: '',
briefIntroduction: '',
city: '',
classificationName: '',
id: uni.getStorageSync('teamId'),
logoUrl: '',
pictureUrl: '',
province: '',
qrCodeOneName: '',
qrCodeOneUrl: '',
qrCodeThreeName: '',
qrCodeThreeUrl: '',
qrCodeTwoName: '',
qrCodeTwoUrl: '',
slogan: '',
},
qrCodeOne: [],
qrCodeTwo: [],
qrCodeThree: [],
qrcodeLen: 1,
11 months ago
provinces: [],
cities: [],
11 months ago
desPics: [],
11 months ago
submiting: false,
uploading: false,
11 months ago
classifications: [],
classificationId: ''
12 months ago
}
},
11 months ago
computed: {
// 平台名字
platformName() {
return this.info.platformSource === '6' ? '供应商' : this.info.platformSource === '5' ? '幼儿园' : ''
},
},
11 months ago
onLoad() {
11 months ago
this.getEnterInfo()
11 months ago
this.getProvince()
12 months ago
},
methods: {
11 months ago
// 企业认证信息
async getEnterInfo() {
const { data } = await enterpriseCertificationStatus(this.openId)
if (data) {
this.info = data
11 months ago
data.platformSource === '6' && this.getClassification()
11 months ago
}
},
12 months ago
// 获取个人信息
getInfo() {
11 months ago
queryTeamInfo({
teamId: this.form.id
}).then(res => {
const data = res.teamInfo
if (!data.logoUrl) data.logoUrl = Common.avatar
11 months ago
// 分类回显
const type = res.supplierClassification
if (type && type.length) {
this.classificationId = type[0].supplierClassificationId
}
11 months ago
if (data.pictureUrl) {
const pics = data.pictureUrl.split(',')
const result = []
pics.forEach(url => {
result.push({
url
})
})
this.desPics = result
}
// 二维码回显
if (data.qrCodeOneUrl) {
this.qrCodeOne = [{
url: data.qrCodeOneUrl
}]
}
if (data.qrCodeTwoUrl) {
this.qrCodeTwo = [{
url: data.qrCodeTwoUrl
}]
}
if (data.qrCodeThreeUrl) {
this.qrCodeThree = [{
url: data.qrCodeThreeUrl
}]
}
this.form = data
this.$nextTick(() => {
data.province && this.getCity()
})
12 months ago
}).catch(e => {})
},
11 months ago
// 供应商分类
async getClassification() {
const { list } = await treeStructureList()
this.classifications = list
},
11 months ago
// 获取省份
11 months ago
async getProvince() {
const { list } = await queryProvince()
this.provinces = list
this.getInfo()
11 months ago
},
// 获取城市
11 months ago
async getCity() {
const { list } = await queryCity({
provinceId: this.provinces.find(e => e.provinceName == this.form.province).provinceId
11 months ago
})
11 months ago
this.cities = list
this.cityId = ''
11 months ago
},
12 months ago
// 上传logo
uploadLogo() {
const that = this
uni.chooseImage({
success: (res) => {
const file = res.tempFilePaths[0];
11 months ago
OSS(file, ({ url }) => {
11 months ago
that.form.logoUrl = url
12 months ago
})
}
});
},
11 months ago
// 上传描述图片
uploadDes(e){
OSS(e.tempFilePaths[0], (res) => {
this.desPics.push({
name: res.name,
extname: res.ext,
url: res.url,
})
})
},
// 上传二维码
uploadQrcode(e, field){
OSS(e.tempFilePaths[0], (res) => {
this[field].push({
name: res.name,
extname: res.ext,
url: res.url,
})
})
12 months ago
},
12 months ago
// 提交
11 months ago
async submit() {
11 months ago
if (this.submiting) return false
11 months ago
const { form } = this
if (!form.classificationName) return this.$util.errMsg(`请输入幼儿园名称!`)
11 months ago
this.submiting = true
11 months ago
form.pictureUrl = this.desPics.map(e => e.url).join()
form.qrCodeOneUrl = this.qrCodeOne.length ? this.qrCodeOne[0].url : ''
form.qrCodeTwoUrl = this.qrCodeTwo.length ? this.qrCodeTwo[0].url : ''
form.qrCodeThreeUrl = this.qrCodeThree.length ? this.qrCodeThree[0].url : ''
11 months ago
try {
11 months ago
// 选择了供应商分类,则保存分类
if (this.classificationId) {
form.supplierClassificationConfigs = [
{
classificationId: this.classificationId
}
]
}
11 months ago
await updateTeamInfo(form)
this.$util.sucMsg('保存成功!')
setTimeout(() => {
uni.navigateBack()
}, 1500)
} catch(e) {
this.submiting = false
}
12 months ago
}
}
}
</script>
<style scoped lang="scss">
11 months ago
.page {
padding-bottom: 170rpx;
-webkit-overflow-scrolling: touch;
}
12 months ago
.avatar {
width: 80rpx;
height: 80rpx;
border: 0;
border-radius: 50%;
}
11 months ago
/deep/.picker-input {
.arrow-area {
display: none;
12 months ago
}
11 months ago
.input-value, .selected-list {
padding: 0;
}
12 months ago
}
</style>