enterprise-reg.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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">
  9. <text style="color: red;">*</text>
  10. 企业名称:
  11. </view>
  12. <view class="r">
  13. <u-input v-model="form.name" placeholder="输入企业名称"/>
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="l">
  18. <text style="color: red;">*</text>
  19. 联系人:
  20. </view>
  21. <view class="r">
  22. <u-input v-model="form.dutyPeople" placeholder="输入联系人"/>
  23. </view>
  24. </view>
  25. <view class="item">
  26. <view class="l">
  27. <text style="color: red;">*</text>
  28. 联系电话:
  29. </view>
  30. <view class="r">
  31. <u-input maxlength="11" v-model="form.phone" placeholder="输入电话号码"/>
  32. </view>
  33. </view>
  34. <view class="item">
  35. <view class="l">结算方式:</view>
  36. <view class="r">
  37. <radio-group @change="payChange">
  38. <label class="radio">
  39. <radio value="1" checked/>
  40. 现结
  41. </label>
  42. <label class="radio" style="margin-left: 20rpx;">
  43. <radio value="2"/>
  44. 月结
  45. </label>
  46. </radio-group>
  47. </view>
  48. </view>
  49. <!-- <view class="item">
  50. <view class="l">验证码:</view>
  51. <view class="r">
  52. <u-input placeholder="输入验证码"/>
  53. <view class="btn">发送</view>
  54. </view>
  55. </view> -->
  56. <view class="item">
  57. <view class="l">营业执照:</view>
  58. <view class="r">
  59. <view class="img">
  60. <uni-file-picker v-model="imageValue" fileMediatype="image" mode="grid" limit="1"
  61. @select="select" @progress="progress" @success="success" @fail="fail"
  62. @delete="form.businessLicence=''" :image-styles="imageStyles"/>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="common-btn" @click="confirm">确认注册</view>
  68. </view>
  69. </template>
  70. <script>
  71. import request from '../../utils/request.js'
  72. export default {
  73. data() {
  74. return {
  75. imgList: [],
  76. imageValue: [],
  77. imageStyles: {
  78. width: 150,
  79. height: 100,
  80. border: {
  81. color: "#eee",
  82. width: 1,
  83. style: 'dashed',
  84. radius: '5px'
  85. }
  86. },
  87. imgList: [],
  88. uploadImageUrl: request.server + '/upload/image',
  89. form: {
  90. name: '',
  91. dutyPeople: '',
  92. phone: '',
  93. payType: '1',
  94. businessLicence: ''
  95. }
  96. }
  97. },
  98. methods: {
  99. // 获取上传状态
  100. select(e) {
  101. let that = this;
  102. uni.uploadFile({
  103. url: that.uploadImageUrl,
  104. filePath: e.tempFilePaths[0],
  105. name: 'file',
  106. success: (resp => {
  107. that.form.businessLicence = JSON.parse(resp.data).data;
  108. })
  109. })
  110. },
  111. // 获取上传进度
  112. progress(e) {
  113. console.log('上传进度:', e)
  114. },
  115. // 上传成功
  116. success(e) {
  117. console.log('上传成功')
  118. },
  119. // 上传失败
  120. fail(e) {
  121. console.log('上传失败:', e)
  122. },
  123. payChange(e) {
  124. this.form.payType = e.detail.value
  125. },
  126. check() {
  127. if (!this.form.name) {
  128. this.$common.toast('请录入名称');
  129. return false;
  130. }
  131. if (!this.form.dutyPeople) {
  132. this.$common.toast('请录入联系人');
  133. return false;
  134. }
  135. if (!this.$common.isPhone(this.form.phone)) {
  136. this.$common.toast('联系号码不正确');
  137. return false;
  138. }
  139. if (!this.form.businessLicence) {
  140. this.$common.toast('请上传营业执照');
  141. return false;
  142. }
  143. return true;
  144. },
  145. confirm() {
  146. if (this.check()) {
  147. this.$api.register(this.form).then(resp => {
  148. if (resp.code == 200) {
  149. this.$common.to('/pages/ok/registerSuccess')
  150. }
  151. })
  152. }
  153. }
  154. }
  155. }
  156. </script>
  157. <style lang="scss">
  158. page {
  159. background-color: #fff;
  160. }
  161. @import '@/common/common.scss'
  162. </style>