环卫车小程序前端代码
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.

210 lines
5.4 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 months ago
5 months ago
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 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="top" :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="name">
  10. <u--input v-model="form.name" :readonly="status==1?true:false" placeholder="请输入姓名名称"></u--input>
  11. </u-form-item>
  12. <!-- <u-form-item label="身份证号码" prop="idCard">
  13. <u--input v-model="form.idCard" :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="company">
  19. <u--input v-model="form.company" :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="2">
  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 { addUser,queryAuthenticationPerson } from "@/common/api.js"
  54. export default{
  55. data(){
  56. return{
  57. status:null,
  58. form: {
  59. name: '',
  60. idCard:'',
  61. mobile: '',
  62. company:'',
  63. fileList:[]
  64. },
  65. rules: {
  66. name: [{
  67. type: 'string',
  68. required: true,
  69. message: '请输入姓名名称',
  70. trigger: ['blur', 'change']
  71. }],
  72. idCard:[
  73. {
  74. required: true,
  75. message: '请输入身份证号码',
  76. trigger: ['change','blur'],
  77. },
  78. {
  79. validator: (rule, value, callback) => {
  80. if (!uni.$u.test.idCard(value)) {
  81. callback(new Error('请输入正确身份证'));
  82. } else {
  83. callback();
  84. }
  85. },
  86. trigger: ['change','blur'],
  87. }
  88. ],
  89. mobile: [
  90. {
  91. required: true,
  92. message: '请输入手机号',
  93. trigger: ['change','blur'],
  94. },
  95. {
  96. validator: (rule, value, callback) => {
  97. return uni.$u.test.mobile(value);
  98. },
  99. message: '手机号码不正确',
  100. trigger: ['change','blur'],
  101. },
  102. ],
  103. fileList:[
  104. {
  105. validator: (rule, value, callback) => {
  106. if (value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0)) {
  107. callback(new Error('请选择身份证'));
  108. } else {
  109. callback();
  110. }
  111. },
  112. trigger: 'blur'
  113. }
  114. ],
  115. },
  116. }
  117. },
  118. watch: {},
  119. onLoad(options) {
  120. if(options.userStatus==1){
  121. this.status=uni.getStorageSync("personAuthenticationStatus")
  122. this.onQueryAuthenticationPerson()
  123. }
  124. },
  125. onReady() {
  126. this.$refs.uForm.setRules(this.rules)
  127. },
  128. methods: {
  129. onQueryAuthenticationPerson(){
  130. let params={}
  131. queryAuthenticationPerson(params).then(response=>{
  132. let result = response.result
  133. // let list =[]
  134. // response.result.cerImage.split(',').forEach(item=>{
  135. // list.push({
  136. // url: item
  137. // })
  138. // })
  139. this.form={
  140. name: result.name,
  141. mobile: result.phone,
  142. idCard:result.cerNo,
  143. company:result.company,
  144. fileList:[],
  145. }
  146. }).catch(error=>{
  147. })
  148. },
  149. submit() {
  150. let that = this
  151. that.$refs.uForm.validate().then(res => {
  152. // uni.$u.toast('校验成功')
  153. that.onAddUser()
  154. }).catch(errors => {
  155. console.info(errors)
  156. })
  157. },
  158. onAddUser(){
  159. let that = this
  160. let params={
  161. // cerImage:that.form.fileList.map(item => item.url).join(','),
  162. cerImage:[],
  163. cerNo:that.form.idCard,
  164. id:uni.getStorageSync('userInfo').id,
  165. name:that.form.name,
  166. phone:that.form.mobile,
  167. company:that.form.company
  168. }
  169. addUser(params).then(response=>{
  170. uni.$u.toast(response.result)
  171. setTimeout(()=>{
  172. uni.switchTab({
  173. url:"/pages/home/index"
  174. })
  175. },1500)
  176. }).catch(error=>{
  177. })
  178. },
  179. deletePic(e) {
  180. this.form.fileList.splice(e.index, 1)
  181. },
  182. async afterRead(e) {
  183. let self = this
  184. e.file.forEach(file => {
  185. self.$Oss.ossUpload(file.url).then(url => {
  186. self.form.fileList.push({
  187. url
  188. })
  189. })
  190. })
  191. }
  192. }
  193. }
  194. </script>
  195. <style>
  196. page{
  197. background-color: #ffffff;
  198. }
  199. </style>
  200. <style lang="scss" scoped>
  201. .line-green {
  202. width: 8rpx;
  203. height: 32rpx;
  204. background: #669A32;
  205. border-radius: 4rpx;
  206. }
  207. </style>