| | |
| | | <template> |
| | | <view class="full-page"> |
| | | <view class="full-page-fff"> |
| | | <view class="content"> |
| | | <up-form labelPosition="left" :model="enterpriseInfo" :rules="rules" ref="form1" labelWidth='90'> |
| | | <up-form-item label="公司营业执照" prop="enterpriseInfo.businessLicense" required borderBottom ref="item1"> |
| | | <fui-upload immediate :url="`${apiBaseUrl}api/UpFile/UpBizLicense`" ref="uploadB" max='1' |
| | | <up-form labelPosition="left" :model="enterpriseInfo" :rules="rules" ref="formRef" labelWidth='90'> |
| | | <up-form-item label="营业执照" prop="businessLicense" required ref="item1"> |
| | | <fui-upload immediate :url="`${apiBaseUrl}/api/UpFile/UpBizLicense`" ref="uploadB" max='1' |
| | | background='#fff' @success="success" @error="error" @complete="complete" width="300" |
| | | height="150"> |
| | | <image |
| | |
| | | <up-icon name="arrow-right"></up-icon> |
| | | </template> --> |
| | | </up-form-item> |
| | | <up-form-item label="企业名称" required prop="enterpriseInfo.suppliername" borderBottom ref="item1"> |
| | | <up-form-item label="企业名称" required prop="suppliername" ref="item1"> |
| | | <up-input v-model="enterpriseInfo.suppliername" border="none" placeholder="请输入企业名称" |
| | | readonly></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="企业注册号" required prop="enterpriseInfo.suppliercode" borderBottom ref="item1"> |
| | | <up-form-item label="企业注册号" required prop="suppliercode" ref="item1"> |
| | | <up-input v-model="enterpriseInfo.suppliercode" border="none" placeholder="请输入企业注册号" |
| | | readonly></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="注册时间" required prop="enterpriseInfo.regtime" borderBottom ref="item1"> |
| | | <up-form-item label="注册时间" required prop="regtime" ref="item1"> |
| | | <up-input v-model="enterpriseInfo.regtime" border="none" placeholder="请输入企业注册号" readonly></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="企业注册地址" required prop="enterpriseInfo.address" borderBottom ref="item1"> |
| | | <up-input v-model="enterpriseInfo.address" border="none" placeholder="请输入企业注册地址" |
| | | <up-form-item label="企业地址" required prop="address" ref="item1"> |
| | | <up-input v-model="enterpriseInfo.address" border="none" placeholder="请输入企业地址" |
| | | readonly></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="联系人" required prop="enterpriseInfo.contact" borderBottom ref="item1"> |
| | | <up-form-item label="联系人" required prop="contact" ref="item1"> |
| | | <up-input v-model="enterpriseInfo.contact" border="none" placeholder="请输入联系人"></up-input> |
| | | </up-form-item> |
| | | <up-form-item label="联系电话" required prop="enterpriseInfo.phone" borderBottom ref="item1"> |
| | | <up-form-item label="联系电话" required prop="phone" ref="item1"> |
| | | <up-input v-model="enterpriseInfo.phone" border="none" placeholder="请输入联系电话"></up-input> |
| | | </up-form-item> |
| | | |
| | | <up-form-item label="公司简介" required prop="enterpriseInfo.resume" borderBottom ref="item1"> |
| | | <up-textarea v-model="enterpriseInfo.resume" count placeholder="请输入公司简介" |
| | | maxlength='800'></up-textarea> |
| | | <up-form-item label="公司简介" required prop="resume" ref="item1"> |
| | | |
| | | </up-form-item> |
| | | <up-textarea v-model="enterpriseInfo.resume" count placeholder="请输入公司简介" height='200' |
| | | maxlength='800'></up-textarea> |
| | | <view class="tabbtns"> |
| | | <up-button color='#fece01' class="text-69" text="保存"></up-button> |
| | | <up-button color='#fece01' class="text-69" text="保存" @click="saveUserCompany"></up-button> |
| | | </view> |
| | | </up-form> |
| | | </view> |
| | |
| | | apiBaseUrl |
| | | } from '@/common/setting/constVarsHelper.js'; |
| | | import { |
| | | onLoad, |
| | | onShow, |
| | | onReady |
| | | } from "@dcloudio/uni-app"; |
| | | let rules = { |
| | | businessLicense: { |
| | | required: true, |
| | | message: '营业执照不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, //营业执照路径 |
| | | suppliername: { |
| | | required: true, |
| | | message: '企业名称不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, //企业名称 |
| | | regtime: { |
| | | required: true, |
| | | message: '注册时间不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, //注册时间 |
| | | address: { |
| | | required: true, |
| | | message: '企业地址不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, //联系地址 |
| | | suppliercode: { |
| | | required: true, |
| | | message: '企业注册号不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, //企业注册号 |
| | | contact: { |
| | | required: true, |
| | | message: '联系人不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, //联系人 |
| | | resume: { |
| | | required: true, |
| | | message: '公司简介不能为空', |
| | | trigger: ['blur', 'change'] |
| | | }, //公司简介 |
| | | phone: { |
| | | required: true, |
| | | message: '电话号码不能为空', |
| | | trigger: ['blur', 'change'] |
| | | } |
| | | } |
| | | import { |
| | | ref, |
| | | reactive |
| | | reactive, |
| | | getCurrentInstance, |
| | | onMounted |
| | | } from 'vue'; |
| | | |
| | | // 使用 reactive 创建响应式状态 |
| | | const state = reactive({ |
| | | showSex: false, |
| | | |
| | | |
| | | |
| | | radio: '', |
| | | switchVal: false, |
| | | }); |
| | | const { |
| | | $upload, |
| | | $api, |
| | | $util, |
| | | $db |
| | | } = getCurrentInstance().appContext.config.globalProperties |
| | | onLoad(() => { |
| | | let data = JSON.parse($db.get('userInfo')).userCompany |
| | | if (data) { |
| | | enterpriseInfo.businessLicense = data.businessLicense |
| | | enterpriseInfo.suppliername = data.suppliername //企业名称 |
| | | enterpriseInfo.regtime = data.regtime //注册时间 |
| | | enterpriseInfo.address = data.address //联系地址 |
| | | enterpriseInfo.suppliercode = data.suppliercode //企业注册号 |
| | | enterpriseInfo.contact = data.contact //联系人 |
| | | enterpriseInfo.phone = data.phone //联系电话 |
| | | enterpriseInfo.id = data.id |
| | | enterpriseInfo.resume = data.resume |
| | | } |
| | | }) |
| | | |
| | | // 使用 ref 创建响应式引用 |
| | | const formRef = ref(null); |
| | | onReady(() => { |
| | | formRef.value.setRules(rules); |
| | | }) |
| | | onMounted(() => { |
| | | formRef.value.setRules(rules); |
| | | console.log(formRef.value, 'formRef'); // 访问子组件Demo中的属性 |
| | | }); |
| | | const enterpriseInfo = reactive({ |
| | | id: 0, //用户公司Id |
| | | businessLicense: '', //营业执照路径 |
| | |
| | | }) |
| | | |
| | | //上传成功时触发 |
| | | const success = (text, e) => { |
| | | const success = (e) => { |
| | | //e.res 为服务器返回数据 |
| | | //上传成功回调,处理服务器返回数据【此处根据实际返回数据进行处理】 |
| | | let res = JSON.parse(e.res.data.replace(/\ufeff/g, "") || "{}") |
| | | console.log(res.data, 'res.data'); |
| | | console.log(res.data); |
| | | if (res.data.url) { |
| | | enterpriseInfo.businessLicense = res.data.url |
| | | |
| | | enterpriseInfo.suppliername = res.data.info.name //企业名称 |
| | | enterpriseInfo.regtime = res.data.info.setDate //注册时间 |
| | | enterpriseInfo.address = res.data.info.address //联系地址 |
| | | enterpriseInfo.suppliercode = res.data.info.regNum //企业注册号 |
| | | enterpriseInfo.contact = res.data.info.person //联系人 |
| | | } |
| | | } |
| | | //上传失败时触发 |
| | |
| | | console.log(e, '删除') |
| | | |
| | | } |
| | | const saveUserCompany = () => { |
| | | formRef.value.validate().then(res => { |
| | | $api.saveUserCompany(enterpriseInfo).then(res => { |
| | | if (res.code == 1) { |
| | | $api.getUser().then(res => { |
| | | $db.set('userInfo', JSON.stringify(res.data)) |
| | | }) |
| | | $util.showToast({ |
| | | title: "保存成功!", |
| | | icon: "success" |
| | | }) |
| | | } |
| | | }) |
| | | }).catch(errors => { |
| | | console.log(errors) |
| | | uni.$u.toast(errors[0].message) |
| | | }) |
| | | |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | |
| | | background-color: #fff; |
| | | padding: 0 20rpx; |
| | | } |
| | | .u-form-item__body{ |
| | | padding: 5px 0 !important; |
| | | } |
| | | </style> |