环卫车小程序前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

199 lines
5.2 KiB

6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
5 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <view>
  3. <view class="se-pt-20 se-pb-20 se-px-40 se-bgc-blue se-c-white se-ta-c se-fs-24" v-if="status==1">
  4. 企业认证-已通过
  5. </view>
  6. <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" labelWidth="80">
  7. <view class="se-p-20">
  8. <view class="se-p-20 se-bgc-white se-br-10 se-fs-20">
  9. <u-form-item label="公司名称" prop="company">
  10. <u--input v-model="form.company" :readonly="status==1?true:false" placeholder="请输入公司名称"></u--input>
  11. </u-form-item>
  12. <u-form-item label="联系人" prop="name">
  13. <u--input v-model="form.name" :readonly="status==1?true:false" placeholder="请输入姓名名称"></u--input>
  14. </u-form-item>
  15. <u-form-item label="联系电话" prop="mobile">
  16. <u--input v-model="form.mobile" :readonly="status==1?true:false" placeholder="请输入联系方式"></u--input>
  17. </u-form-item>
  18. <u-form-item label="公司地址" prop="address">
  19. <u--input v-model="form.address" :readonly="status==1?true:false" placeholder="请输入公司地址"></u--input>
  20. </u-form-item>
  21. </view>
  22. </view>
  23. <view class="se-p-20">
  24. <view class="se-px-20 se-pb-20 se-bgc-white se-br-10 se-fs-20">
  25. <u-form-item prop="fileList" labelWidth="0">
  26. <view class="se-flex se-flex-v-sa">
  27. <view class="se-py-20 se-w-p-100 se-flex">
  28. <view class="line-green"></view>
  29. <view class="se-ml-10">
  30. 营业执照上传
  31. </view>
  32. </view>
  33. <view class="se-py-20 se-w-p-100">
  34. <u-upload :fileList="form.fileList" @afterRead="afterRead" @delete="deletePic" name="1"
  35. multiple :maxCount="10"></u-upload>
  36. </view>
  37. </view>
  38. </u-form-item>
  39. </view>
  40. </view>
  41. <view class="se-px-20 se-pt-20" v-if="status!=1">
  42. <view class="se-px-20 se-pb-80 se-fs-20 se-flex">
  43. <view @click="submit"
  44. class="se-mx-10 se-flex-1 se-br-40 se-flex-h-c se-h-80 se-lh-80 se-ta-c se-fs-28 se-c-white se-bgc-green">
  45. <text>提交申请</text>
  46. </view>
  47. </view>
  48. </view>
  49. </u--form>
  50. </view>
  51. </template>
  52. <script>
  53. import { addCompany,queryAuthenticationCompany } from "@/common/api.js"
  54. export default{
  55. data(){
  56. return{
  57. status:null,
  58. form: {
  59. name: '',
  60. mobile: '',
  61. company:'',
  62. address:'',
  63. fileList:[],
  64. },
  65. rules: {
  66. name: [{
  67. type: 'string',
  68. required: true,
  69. message: '请输入姓名名称',
  70. trigger: ['blur', 'change']
  71. }],
  72. mobile: [
  73. {
  74. required: true,
  75. message: '请输入手机号',
  76. trigger: ['change','blur'],
  77. },
  78. {
  79. validator: (rule, value, callback) => {
  80. return uni.$u.test.mobile(value);
  81. },
  82. message: '手机号码不正确',
  83. trigger: ['change','blur'],
  84. },
  85. ],
  86. company: [{
  87. type: 'string',
  88. required: true,
  89. message: '请输入公司名称',
  90. trigger: ['blur', 'change']
  91. }],
  92. address: [{
  93. type: 'string',
  94. required: true,
  95. message: '请输入公司地址',
  96. trigger: ['blur', 'change']
  97. }],
  98. fileList:[
  99. {
  100. validator: (rule, value, callback) => {
  101. if (value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0)) {
  102. callback(new Error('请选择营业执照'));
  103. } else {
  104. callback();
  105. }
  106. },
  107. trigger: 'blur'
  108. }
  109. ],
  110. },
  111. }
  112. },
  113. onLoad(options) {
  114. if(options.userStatus==1){
  115. this.status=uni.getStorageSync("companyAuthenticationStatus")
  116. this.onQueryAuthenticationCompany()
  117. }
  118. },
  119. onReady() {
  120. this.$refs.uForm.setRules(this.rules)
  121. },
  122. methods: {
  123. onQueryAuthenticationCompany(){
  124. let params={}
  125. queryAuthenticationCompany(params).then(response=>{
  126. let result = response.result
  127. let list =[]
  128. response.result.businessLicense.split(',').forEach(item=>{
  129. list.push({
  130. url: item
  131. })
  132. })
  133. this.form={
  134. name: result.userName,
  135. mobile: result.phone,
  136. company:result.companyName,
  137. address:result.address,
  138. fileList:list,
  139. }
  140. }).catch(error=>{
  141. })
  142. },
  143. submit() {
  144. let that = this;
  145. that.$refs.uForm.validate().then(res => {
  146. // uni.$u.toast('校验通过')
  147. that.onAddCompany()
  148. }).catch(errors => {
  149. // uni.$u.toast('校验失败')
  150. })
  151. },
  152. onAddCompany(){
  153. let that = this
  154. let params={
  155. companyName:that.form.company,
  156. userName:that.form.name,
  157. phone:that.form.mobile,
  158. address:that.form.address,
  159. businessLicense:that.form.fileList.map(item => item.url).join(','),
  160. }
  161. addCompany(params).then(response=>{
  162. uni.$u.toast(response.result)
  163. setTimeout(()=>{
  164. uni.switchTab({
  165. url:"/pages/home/index"
  166. })
  167. },1500)
  168. }).catch(error=>{
  169. })
  170. },
  171. deletePic(event) {
  172. this.form.fileList.splice(event.index, 1)
  173. },
  174. async afterRead(e) {
  175. let self = this
  176. e.file.forEach(file => {
  177. self.$Oss.ossUpload(file.url).then(url => {
  178. self.form.fileList.push({
  179. url
  180. })
  181. })
  182. })
  183. }
  184. }
  185. }
  186. </script>
  187. <style lang="scss" scoped>
  188. .line-green {
  189. width: 8rpx;
  190. height: 32rpx;
  191. background: #669A32;
  192. border-radius: 4rpx;
  193. }
  194. </style>