customer-info.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">信息管理</text>
  6. </view>
  7. <view class="item">
  8. <view class="l">企业名称:</view>
  9. <view class="r">
  10. <u-input v-model="form.name" placeholder="输入企业名称" />
  11. </view>
  12. </view>
  13. <view class="item">
  14. <view class="l">联系人:</view>
  15. <view class="r">
  16. <u-input v-model="form.dutyPeople" placeholder="输入联系人" />
  17. </view>
  18. </view>
  19. <view class="item">
  20. <view class="l">联系电话:</view>
  21. <view class="r">
  22. <u-input maxlength="11" v-model="form.phone" placeholder="输入电话号码" />
  23. </view>
  24. </view>
  25. <view class="item">
  26. <view class="l">结算方式:</view>
  27. <view class="r">
  28. <radio-group @change="payChange">
  29. <label class="radio">
  30. <radio value="1" checked />现结
  31. </label>
  32. <label class="radio" style="margin-left: 20rpx;">
  33. <radio value="2" />月结
  34. </label>
  35. </radio-group>
  36. </view>
  37. </view>
  38. <view class="item">
  39. <view class="l">营业执照:</view>
  40. <view class="r">
  41. <view class="img">
  42. <u-upload max-count="1" ref="license" :file-list="imgList" :action="uploadImageUrl" width="300"
  43. height="200"></u-upload>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="common-btn" @click="confirm">确认</view>
  49. </view>
  50. </template>
  51. <script>
  52. import request from '../../utils/request.js'
  53. export default {
  54. data() {
  55. return {
  56. imgList: [],
  57. uploadImageUrl: request.server + '/upload/image',
  58. form: {
  59. name: '',
  60. dutyPeople: '',
  61. phone: '',
  62. payType: '1',
  63. businessLicence: ''
  64. }
  65. }
  66. },
  67. mounted() {
  68. let id = uni.getStorageSync('info').customerId;
  69. this.getCustomerById(id);
  70. },
  71. methods: {
  72. getCustomerById(id) {
  73. this.$api.getCustomerById({
  74. id: id
  75. }).then(resp => {
  76. this.form = resp.data;
  77. })
  78. },
  79. payChange(e) {
  80. this.form.payType = e.detail.value
  81. },
  82. check() {
  83. if (!this.form.name) {
  84. this.$common.toast('请录入名称');
  85. return false;
  86. }
  87. if (!this.form.dutyPeople) {
  88. this.$common.toast('请录入联系人');
  89. return false;
  90. }
  91. if (!this.form.phone) {
  92. this.$common.toast('请录入联系号码');
  93. return false;
  94. }
  95. let licenseFiles = this.$refs.license.lists.filter(val => {
  96. return val.progress == 100;
  97. })
  98. if (licenseFiles.length > 0) {
  99. this.form.businessLicence = licenseFiles.map(obj => {
  100. if (obj.response) {
  101. return obj.response.data;
  102. } else if (obj.url) {
  103. return obj.url;
  104. }
  105. }).join(',');
  106. }
  107. return true;
  108. },
  109. confirm() {
  110. if (this.check()) {
  111. this.$api.editCustomer(this.$common.removeNull(this.form)).then(resp => {
  112. if (resp.code == 200) {
  113. this.$common.toast('修改成功');
  114. setTimeout(()=>{
  115. this.$common.back();
  116. },1000)
  117. }
  118. })
  119. }
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="scss">
  125. page {
  126. background-color: #fff;
  127. }
  128. @import '@/common/common.scss'
  129. </style>