123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <template>
- <view>
- <view class="box">
- <view class="top">
- <text class="title">信息管理</text>
- </view>
- <view class="item">
- <view class="l">企业名称:</view>
- <view class="r">
- <u-input v-model="form.name" placeholder="输入企业名称" />
- </view>
- </view>
- <view class="item">
- <view class="l">联系人:</view>
- <view class="r">
- <u-input v-model="form.dutyPeople" placeholder="输入联系人" />
- </view>
- </view>
- <view class="item">
- <view class="l">联系电话:</view>
- <view class="r">
- <u-input maxlength="11" v-model="form.phone" placeholder="输入电话号码" />
- </view>
- </view>
- <view class="item">
- <view class="l">结算方式:</view>
- <view class="r">
- <radio-group @change="payChange">
- <label class="radio">
- <radio value="1" checked />现结
- </label>
- <label class="radio" style="margin-left: 20rpx;">
- <radio value="2" />月结
- </label>
- </radio-group>
- </view>
- </view>
- <view class="item">
- <view class="l">营业执照:</view>
- <view class="r">
- <view class="img">
- <u-upload max-count="1" ref="license" :file-list="imgList" :action="uploadImageUrl" width="300"
- height="200"></u-upload>
- </view>
- </view>
- </view>
- </view>
- <view class="common-btn" @click="confirm">确认</view>
- </view>
- </template>
- <script>
- import request from '../../utils/request.js'
- export default {
- data() {
- return {
- imgList: [],
- uploadImageUrl: request.server + '/upload/image',
- form: {
- name: '',
- dutyPeople: '',
- phone: '',
- payType: '1',
- businessLicence: ''
- }
- }
- },
- mounted() {
- let id = uni.getStorageSync('info').customerId;
- this.getCustomerById(id);
- },
- methods: {
- getCustomerById(id) {
- this.$api.getCustomerById({
- id: id
- }).then(resp => {
- this.form = resp.data;
- })
- },
- payChange(e) {
- this.form.payType = e.detail.value
- },
- check() {
- if (!this.form.name) {
- this.$common.toast('请录入名称');
- return false;
- }
- if (!this.form.dutyPeople) {
- this.$common.toast('请录入联系人');
- return false;
- }
- if (!this.form.phone) {
- this.$common.toast('请录入联系号码');
- return false;
- }
- let licenseFiles = this.$refs.license.lists.filter(val => {
- return val.progress == 100;
- })
- if (licenseFiles.length > 0) {
- this.form.businessLicence = licenseFiles.map(obj => {
- if (obj.response) {
- return obj.response.data;
- } else if (obj.url) {
- return obj.url;
- }
- }).join(',');
- }
- return true;
- },
- confirm() {
- if (this.check()) {
- this.$api.editCustomer(this.$common.removeNull(this.form)).then(resp => {
- if (resp.code == 200) {
- this.$common.toast('修改成功');
- setTimeout(()=>{
- this.$common.back();
- },1000)
- }
- })
- }
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #fff;
- }
- @import '@/common/common.scss'
- </style>
|