Files
xdd-uniapp-new/pkg_join/views/supplier.vue
T

1319 lines
39 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<view>
<u--form
ref="supplierForm"
:model="formSupplier"
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
:border="false"
:customStyle="{'fontSize':'40rpx'}"
:title="infoTitle+'供应商基本信息'"
>
<u-form-item prop="name">
<u-cell title="供应商名称" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input
v-model="formSupplier.name"
:disabled="reviewing"
border="none"
placeholder="请填写供应商名称"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="businessLicense">
<u-cell title="营业执照名称" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-input
v-model="formSupplier.businessLicense"
:disabled="reviewing"
border="none"
placeholder="请填写营业执照名称"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="avatar">
<u-cell title="头像" :border="false">
<template #label>
<view class="box-upload" @click="chooseLogoImg('supplier')">
<view
v-if="!formSupplier.avatar"
class="btn-upload"
>上传图片</view>
<view v-else class="img-wrap">
<image
:src="formSupplier.avatar"
class="img-preview"
/>
<view
v-if="!reviewing"
class="delete-badge"
@click.stop="deleteImg('supplier')"
>
x
</view>
</view>
</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="formSupplier.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="formSupplier.phone"
maxlength="11"
: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>
<view class="captcha-wrap">
<view class="captcha-wrap-input">
<u-input
v-model="formSupplier.captcha"
:disabled="reviewing"
border="none"
placeholder="请填写验证码"
/>
</view>
<view v-if="!reviewing" class="captcha-wrap-ft">
<u-code
ref="uCode"
seconds="30"
changeText="X秒重新获取"
@change="codeChange"
/>
<u-button
:text="tips"
type="success"
size="normal"
@tap="getCode"
/>
</view>
</view>
</template>
</u-cell>
</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
v-if="showUpload"
:fileList="quaPics"
:maxCount="9"
:deletable="!reviewing"
:disabled="reviewing"
name="quaPics"
multiple
@afterRead="quaAfterRead"
@delete="quaDeletePic"
/>
</template>
</u-cell>
</view>
<u-form-item prop="area">
<u-cell title="省市区" :border="false" isLink @click="$refs.cityselect.open()">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<view class="u-text__value" :class="{'area-item':formSupplier.area && formSupplier.area.length===0}">
<CitySelect
ref="cityselect"
:defaultValue="formSupplier.area || ''"
:disabled="reviewing"
:items="district"
@callback="resultSupplier"
/>
</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="formSupplier.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('supplier')">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u--text v-if="formSupplier.position" :text="formSupplier.position"></u--text>
<u--text v-else text="请选择" color="#c0c4cc"></u--text>
</template>
</u-cell>
</u-form-item>
</u-cell-group>
</u--form>
<u--form
ref="shopForm"
:model="form"
errorType="toast"
labelWidth="216rpx"
>
<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"
:disabled="reviewing"
border="none"
placeholder="请填写店铺名称"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="coverType">
<u-cell title="封面类型" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u-radio-group
v-model="form.coverType"
placement="row"
>
<u-radio
:name="1"
:customStyle="{marginRight: '16px'}"
active-color="red"
label="图片"
/>
<u-radio
:name="2"
active-color="red"
label="视频"
/>
</u-radio-group>
</template>
</u-cell>
</u-form-item>
<u-form-item v-if="form.coverType === 1" :prop="form.coverType === 1 ? 'cover' : 'coverVideo'">
<u-cell title="店铺封面图" :border="false">
<template #icon>
<text class="required">*</text>
</template>
</u-cell>
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoImg('cover')">
<view
v-if="!form.cover"
class="btn-upload"
>上传图片</view>
<view v-else class="img-wrap">
<image
:src="form.cover"
class="img-preview"
/>
<view
v-if="!reviewing"
class="delete-badge"
@click.stop="deleteImg('cover')"
>
x
</view>
</view>
</view>
</template>
</u-cell>
</u-form-item>
<u-form-item v-if="form.coverType === 2" :prop="form.coverType === 1 ? 'cover' : 'coverVideo'">
<u-cell title="店铺视频封面" :border="false">
<template #icon>
<text class="required">*</text>
</template>
</u-cell>
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoVideo()">
<view
v-if="!form.coverVideo"
class="btn-upload"
>上传视频</view>
<view v-else class="img-wrap">
<video
:src="form.coverVideo"
:poster="form.coverVideo + '?vframe/jpg/offset/1'"
:controls="false"
play-btn-position="center"
class="video-item"
/>
<view
v-if="!reviewing"
style="position: absolute; top: 0; right: 0;"
class="delete-badge"
@click.stop="deleteVideo"
>
x
</view>
</view>
</view>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="pics">
<u-cell title="店铺图片" :border="false">
<template #icon>
<text class="required">*</text>
</template>
</u-cell>
<u-cell :border="false">
<template #title>
<u-upload
:fileList="pics"
:maxCount="99999"
:disabled="reviewing"
:deletable="!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>
<text class="required">*</text>
</template>
</u-cell>
<u-cell :border="false">
<template #title>
<view class="box-upload" @click="chooseLogoImg('logo')">
<view
v-if="!form.logo"
class="btn-upload"
>上传图片</view>
<view v-else class="img-wrap">
<image
:src="form.logo"
class="img-preview"
/>
<view
v-if="!reviewing"
class="delete-badge"
@click.stop="deleteImg('logo')"
>
x
</view>
</view>
</view>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="typeText">
<u-cell title="店铺类型" :border="false">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<picker
:value="indexType"
:range="columnsType"
:disabled="reviewing"
mode="selector"
range-key="name"
class="picker"
@change="typeChange"
>
<view style="display: flex; align-items: center; justify-content: flex-end;">
<u--text v-if="form.typeText" :text="form.typeText"></u--text>
<u--text v-else text="请选择类型" color="#c0c4cc"></u--text>
<u-icon name="arrow-right" color="#909399" size="18"></u-icon>
</view>
</picker>
</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"
: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"
:disabled="reviewing"
type="number"
border="none"
placeholder="请填写联系方式"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="area">
<u-cell title="省市区" :border="false" isLink @click="$refs.cityselect2.open()">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<view class="u-text__value" :class="{'area-item':form.area && form.area.length===0}">
<CitySelect
ref="cityselect2"
: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"
:disabled="reviewing"
border="none"
placeholder="请填写详细地址"
/>
</template>
</u-cell>
</u-form-item>
<u-form-item prop="position">
<u-cell title="地理定位选择" :border="false" isLink @click="chooLocation">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<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="serviceTime">
<u-cell title="营业时间" :border="false" isLink @click="showTimePicker">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u--text :text="`${form.serviceTime || ''} - ${form.serviceEndTime || ''}`"></u--text>
<tpf-time-range
startTime="00:00"
endTime="23:59"
:startDefaultTime="form.serviceTime"
:endDefaultTime="form.serviceEndTime"
ref="TimePickerPopupRef"
@timeRange="timeRange"
>
</tpf-time-range>
</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-textarea
:maxlength="-1"
autoHeight
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-cell-group>
<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--form>
<u-modal
:show="showRemove"
content="您确定撤销申请吗?"
showCancelButton
@cancel="changeRemove(false)"
@confirm="onRemove"
/>
<u-popup :show="show" mode="center" round="10" @close="handlePopupClose">
<view class="popup-body">
<view class="tc bold">入驻申请须知</view>
<view class="content">
<rich-text :nodes="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="确定"
@click="handlAgree"
/>
</view>
</u-popup>
</view>
</template>
<script>
import CitySelect from '@/components/CitySelect'
import TimePickerPopup from '@/components/timePickerPopup/time-picker-popup.vue';
import {
getShopData,
getShopInfo,
removeApply,
saveSupplier,
saveWenwanSupplier,
saveSupplierDraft
} from '@/api/join'
import {getCity, registerVerify} from '@/api/user'
import {
chooseImage,
moreImage,
uploadImage,
chooseVideoToUpload,
formatRichText
} from '@/utils'
import { pageListenMixins } from '@/mixins/pageListenMixins'
export default {
name: 'PkgJoinSupplier',
components: {
CitySelect,
TimePickerPopup
},
mixins: [pageListenMixins],
data() {
return {
partnerId: '',
promoterUid: '',
tips: '获取验证码',
infoTitle: '',
pics: [],
quaPics: [],
formSupplier: {
name: '',
businessLicense: '',
avatar: '',
contact: '',
phone: '',
captcha: '',
qualification: '',
subType: '',
area: '',
address: '',
position: '',
},
form: {
name: '',
cover: '',
coverVideo: '',
// coverType: 1-图片,2-视频
coverType: 1,
logo: '',
type: 0,
typeText: '',
phone: '',
area: '',
address: '',
position: '',
content: '',
serviceTime: '00:00',
serviceEndTime: '23:59'
},
rulesSupplier: {
'name': {
type: 'string',
required: true,
message: '请填写供应商名称',
trigger: ['blur', 'change']
},
'businessLicense': {
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']
},
'typeText': {
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']
},
'position': {
type: 'string',
required: true,
message: '请选择定位信息',
trigger: ['blur', 'change']
}
},
columnsType: [],
indexType: 0,
columnsSupplierType: [],
indexSupplierType: 0,
district: [],
isAgree: false,
show: false,
notice: '',
showRemove: false,
isDraft: null,
reviewStatus: null,
stateTitle: '',
stateType: 'primary',
// 是否为审核中
reviewing: false,
pageKeyId: '',
showUpload: false,
pageType: ''
}
},
computed: {
rules () {
return {
'name': {
type: 'string',
required: true,
message: '请填写店铺名称',
trigger: ['blur', 'change']
},
'cover': {
type: 'string',
required: this.form.coverType === 1 ? true : false,
message: '请上传店铺封面图',
trigger: ['blur', 'change']
},
'coverVideo': {
type: 'string',
required: this.form.coverType === 1 ? false : true,
message: '请上传店铺视频封面',
trigger: ['blur', 'change']
},
'logo': {
type: 'string',
required: true,
message: '请上传店铺LOGO',
trigger: ['blur', 'change']
},
'typeText': {
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']
},
'area': {
type: 'string',
required: true,
message: '请选择所在省市',
trigger: ['blur', 'change']
},
'address': {
type: 'string',
required: true,
message: '请填写详细地址',
trigger: ['blur', 'change']
},
'position': {
type: 'string',
required: true,
message: '请选择定位信息',
trigger: ['blur', 'change']
},
'content': {
type: 'string',
required: true,
message: '请填写介绍内容',
trigger: ['blur', 'change']
},
'serviceTime': {
type:'string',
required: true,
message: '请选择营业时间',
trigger: ['blur', 'change']
},
}
}
},
onLoad(options) {
this.partnerId = options.partnerId || ''
this.promoterUid = options.promoterUid || ''
const type = options.type
this.pageType = type
this.formSupplier.subType = type
if (type === 'goods_supplier') {
this.infoTitle = '特产'
this.pageKeyId = 'merchantApplyGoodsSupplier'
} else {
this.infoTitle = '文玩'
this.pageKeyId = 'merchantApplyWenwanSupplier'
}
uni.setNavigationBarTitle({
title: this.infoTitle + '供应商入驻'
})
this.init()
},
onUnload() {
this.saveDraft()
},
onReady() {
this.$refs.shopForm.setRules(this.rules)
this.$refs.supplierForm.setRules(this.rulesSupplier)
},
methods: {
handlAgree() {
if (!this.isAgree) {
uni.showToast({
title: '请先阅读并同意入驻申请须知',
icon: 'none'
})
return
}
this.show = false
},
handlePopupClose() {
if (!this.isAgree) {
uni.showToast({
title: '请先阅读并同意入驻申请须知',
icon: 'none'
})
return
}
this.show = false
},
timeRange(e) {
this.form.serviceTime = e[0]
this.form.serviceEndTime = e[1]
this.$forceUpdate()
},
showTimePicker() {
this.$refs.TimePickerPopupRef.open()
},
changeRemove(state){
this.showRemove = state
},
codeChange(text) {
this.tips = text
},
getCode() {
if (this.reviewing) return
if (!this.formSupplier.phone) {
uni.$u.toast('请输入手机号')
return
}
if (this.formSupplier.phone.length !== 11) {
uni.$u.toast('请输入11位手机号')
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() {
uni.showLoading({ title: '加载中...', mask: true })
getCity().then(({data}) => {
this.district = data
})
getShopData({partnerId: this.partnerId, promoterUid: this.promoterUid}).then(({data}) => {
this.columnsType = data.hotelTypeList
this.columnsSupplierType = data.supplierTypeList
this.notice = formatRichText(data.merchantApplyNotice)
this.initInfo()
}).catch(() => {
uni.hideLoading()
})
},
initInfo() {
// 是否缺少参数区分文玩和特产?
// 2026-08-25 BUG 5882 确实需要区分参数
const params = {
subType: this.pageType
}
getShopInfo(params).then((res) => {
this.showUpload = true
const {data} = res
// console.log(res, 'initInfo--------');
// console.log(data, 'data--------');
if (data.partnerId != null) {
this.partnerId = data.partnerId
}
this.isDraft = data.isDraft
this.reviewStatus = data.reviewStatus
if(data.isDraft === null || data.isDraft === 1) {
this.show = true
}
if (data.isDraft !== 1) {
switch (data.reviewStatus) {
case 0:
this.stateTitle = '审核中'
this.stateType = 'primary'
this.reviewing = true
break
case 1:
this.reviewing = false
break
case 2:
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(',')
if (picsTemp.length > 0) {
picsTemp.map(item => {
if (item) {
this.pics.push({url: item})
}
})
}
this.indexType = this.columnsType.findIndex(item => item.id === this.form.type)
this.form.typeText = this.indexType > -1 ? 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 || ''}`
if (data.hotelInfo.coverType === 2) {
this.form.coverVideo = data.hotelInfo.cover
this.form.cover = ''
}
}
if (data.supplierInfo) {
// 仅在已提交且申请类型明确不匹配时跳过,草稿状态下正常回显
if (data.isDraft !== 1 && data.applyType != null) {
if (this.infoTitle === "特产" && data.applyType !== 1) return
if (this.infoTitle === "文玩" && data.applyType !== 3) return
}
this.formSupplier = data.supplierInfo
// 后端草稿可能未回传 subType,用当前页面类型补齐
if (!this.formSupplier.subType) {
this.formSupplier.subType = this.pageType
}
// 商家资质
this.quaPics = []
const quaPicsTemp = (this.formSupplier.qualification || '').split(',')
if (quaPicsTemp.length > 0) {
quaPicsTemp.map(item => {
if (item) {
this.quaPics.push({url: item})
}
})
}
this.indexSupplierType = this.columnsSupplierType.findIndex(item => item.key === this.formSupplier.subType)
this.formSupplier.typeText = this.indexSupplierType > -1 ? this.columnsSupplierType[this.indexSupplierType].value : ''
this.formSupplier.position = this.$forceToDecimal(this.formSupplier.longitude, 6) + ',' + this.$forceToDecimal(this.formSupplier.latitude, 6)
this.formSupplier.area = `${this.formSupplier.provinceName || ''} ${this.formSupplier.cityName || ''} ${this.formSupplier.areaName || ''}`
}
}).finally(() => {
uni.hideLoading()
})
},
chooseLogoImg(target) {
if (this.reviewing) return
chooseImage(img => {
switch (target) {
case 'supplier':
this.formSupplier.avatar = img
break
case 'licence':
this.formSupplier.qualification = img
break
case 'cover':
this.form.cover = img
break
case 'logo':
this.form.logo = img
break
}
})
},
// 删除单张图片(供应商头像 / 店铺封面图 / 店铺logo)
deleteImg(target) {
if (this.reviewing) return
if (target === 'supplier') {
this.formSupplier.avatar = ''
} else if (target === 'cover') {
this.form.cover = ''
} else if (target === 'logo') {
this.form.logo = ''
}
},
chooseLogoVideo() {
if (this.reviewing) return
chooseVideoToUpload(path => {
this.form.coverVideo = path
this.$forceUpdate()
})
},
// 删除视频封面
deleteVideo() {
if (this.reviewing) return
this.form.coverVideo = ''
this.$forceUpdate()
},
chooseShopImg() {
if (this.reviewing) return
const _this = this
let count = 0
moreImage(9, (img, total) => {
if (img) {
_this.pics.push(img)
count++
}
if (count === total) {
_this.form.pics = _this.pics.join(',')
}
})
},
// 删除图片
deletePic(event) {
this[`${event.name}`].splice(event.index, 1)
},
afterRead(event) {
const _this = this
if (event.file.length > 0) {
event.file.map(item => {
uploadImage(item.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) {
event.file.map(item => {
uploadImage(item.url, img => {
that.quaPics.push({url: img})
})
})
}
},
typeChange(e) {
const idx = parseInt(e.detail.value)
this.columnsType.map((item, index) => {
if (index === idx) {
this.form.typeText = item.name
this.indexType = index
this.form.type = item.id
}
})
},
supplierTypeChange(e) {
const idx = parseInt(e.detail.value)
this.columnsSupplierType.map((item, index) => {
if (index === idx) {
this.formSupplier.typeText = item.value
this.indexSupplierType = index
this.formSupplier.type = item.key
}
})
},
resultSupplier(values) {
const 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.formSupplier.area = `${address.province || ''} ${address.city || ''} ${address.district || ''}`
this.formSupplier.provinceId = values.province.id
this.formSupplier.cityId = values.city.id
this.formSupplier.areaId = values.district.id
},
// 省市区
result(values) {
const 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 = `${address.province || ''} ${address.city || ''} ${address.district || ''}`
this.form.provinceId = values.province.id
this.form.cityId = values.city.id
this.form.areaId = values.district.id
},
// 定位
chooLocation(target) {
const _this = this
uni.chooseLocation({
success: function (res) {
if (target === 'supplier') {
_this.formSupplier.address = res.address
_this.formSupplier.longitude = _this.$forceToDecimal(res.longitude, 6)
_this.formSupplier.latitude = _this.$forceToDecimal(res.latitude, 6)
_this.formSupplier.position = _this.$forceToDecimal(res.longitude, 6) + ',' + _this.$forceToDecimal(res.latitude, 6)
} else {
_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() {
const _this = this
_this.$refs.shopForm.validate().then(res => {
// 校验通过
_this.$refs.supplierForm.validate().then(() => {
// _this.show = true
_this.save()
}).catch(errors => {
// 校验失败
console.log(errors)
})
}).catch(errors => {
// 校验失败
console.log(errors)
})
},
onRemove() {
removeApply().then(res => {
uni.showToast({
title: res.msg,
icon: 'none',
duration: 3000,
success: () => {
this.showRemove = false
this.reviewing = false
}
})
this.initInfo()
})
},
changeAgree(event) {
this.isAgree = event.detail.value.length > 0
},
buildPostData() {
this.form.pics = ''
const picsLength = this.pics.length
if (picsLength > 0) {
const tempArr = []
this.pics.map(item => {
item.url && tempArr.push(item.url)
})
this.form.pics = tempArr.join(',')
}
this.formSupplier.qualification = ''
const quaPicsLength = this.quaPics.length
if (quaPicsLength > 0) {
const tempArr = []
this.quaPics.map(item => {
item.url && tempArr.push(item.url)
})
this.formSupplier.qualification = tempArr.join(',')
}
const postData = Object.assign({}, this.form)
if (postData.coverType === 2) {
postData.cover = postData.coverVideo
}
return postData
},
save() {
const postData = this.buildPostData()
if (this.infoTitle === '特产') {
saveSupplier(postData, this.formSupplier, this.partnerId, this.promoterUid).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;
}
})
})
} else {
saveWenwanSupplier(postData, this.formSupplier, this.partnerId, this.promoterUid).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
}
})
})
}
},
saveDraft() {
if (this.reviewing) return
// 确保按当前入驻类型(特产/文玩)区分保存,避免共用同一份草稿
this.formSupplier.subType = this.pageType
const postData = this.buildPostData()
saveSupplierDraft(postData, this.formSupplier, this.partnerId, this.promoterUid)
}
}
}
</script>
<style lang="less">
@import "@/assets/css/pkg_join.less";
.licence-image {
.u-cell__body {
padding-top: 0 !important;
}
.box-upload {
margin-top: 0;
}
}
/deep/ .cityselect-nav {
.item {
font-size: 30rpx !important;
}
}
/deep/ .cityselect-item {
.cityselect-item-box {
font-size: 30rpx !important;
}
}
/deep/ .full-title {
.u-cell__title {
width: 100% !important;
}
}
.font-color-red {
font-size: 22rpx;
}
.img-wrap {
position: relative;
display: inline-block;
.delete-badge {
position: absolute;
top: 0;
right: 20rpx;
background: #000;
color: #fff;
padding: 2rpx 8rpx;
border-radius: 0 0 0 200rpx;
font-size: 22rpx;
z-index: 10;
text-align: center;
}
}
.captcha-wrap {
display: flex;
align-items: center;
.captcha-wrap-input {
flex: 1;
}
}
</style>