用工小程序前端代码
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.

224 lines
6.0 KiB

7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
4 months ago
7 months ago
  1. <template>
  2. <!-- 个人 -->
  3. <view>
  4. <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm" labelWidth="80">
  5. <view class="se-p-20">
  6. <view class="se-p-20 se-bgc-white se-br-10 se-fs-20">
  7. <u-form-item label="姓名" prop="name">
  8. <u--input v-model="form.name" class="se-bgc-f5" placeholder="请输入姓名名称"></u--input>
  9. </u-form-item>
  10. <!-- <u-form-item label="密码" prop="password">
  11. <u--input v-model="form.password" class="se-bgc-f5" placeholder="请输入您的密码"></u--input>
  12. </u-form-item> -->
  13. <u-form-item label="联系电话" prop="mobile">
  14. <u--input v-model="form.mobile" class="se-bgc-f5" placeholder="请输入联系方式"></u--input>
  15. </u-form-item>
  16. <u-form-item label="居住地址" prop="address">
  17. <u--input v-model="form.address" class="se-bgc-f5" placeholder="请输入详细地址"></u--input>
  18. </u-form-item>
  19. <u-form-item label="行业" prop="industryId" @click="handleIndChange()">
  20. <u--input readonly v-model="form.industryName" placeholder="请选择行业" border="bottom"></u--input>
  21. <u-icon slot="right" name="arrow-right"></u-icon>
  22. </u-form-item>
  23. </view>
  24. </view>
  25. <view class="se-p-20">
  26. <view class="se-px-20 se-pb-20 se-bgc-white se-br-10 se-fs-20">
  27. <u-form-item prop="file" labelWidth="2">
  28. <view class="se-flex se-flex-v-sa">
  29. <view class="se-py-20 se-w-p-100 se-flex">
  30. <view class="line-orange"></view>
  31. <view class="se-ml-10">
  32. 身份证上传(正反面)
  33. </view>
  34. </view>
  35. <view class="se-py-20 se-w-p-100">
  36. <u-upload :fileList="form.idCardFile" @afterRead="afterRead" @delete="deletePic" name="1"
  37. multiple :maxCount="10"></u-upload>
  38. </view>
  39. </view>
  40. </u-form-item>
  41. </view>
  42. </view>
  43. <view class="se-px-20 se-pt-20">
  44. <view class="se-px-20 se-pb-80 se-fs-20 se-flex">
  45. <view @click="submit"
  46. class="se-mx-10 se-flex-1 se-br-40 se-flex-h-c se-h-60 se-lh-60 se-ta-c se-fs-28 se-c-white se-bgc-orange">
  47. <text>申请审核</text>
  48. </view>
  49. <view
  50. class="se-mx-10 se-flex-1 se-b se-br-40 se-flex-h-c se-h-60 se-lh-60 se-ta-c se-fs-28 se-c-66 se-bgc-f5">
  51. <text>联系我们</text>
  52. </view>
  53. </view>
  54. </view>
  55. </u--form>
  56. <u-action-sheet :actions="indList" @select="selectIndClick" title="行业" :show="show" @close="show=false"></u-action-sheet>
  57. </view>
  58. </template>
  59. <script>
  60. import {roleBoss,industryList} from "@/common/api.js"
  61. export default{
  62. data(){
  63. return{
  64. show:false,
  65. indList: [],
  66. fileList: [],
  67. form: {
  68. role:0,
  69. name: 'jerryxiao',
  70. password: '',
  71. mobile: '13189698114',
  72. address:'湖南长沙岳麓区',
  73. industryId:'1865294357074157570',
  74. industryName:'建筑',
  75. idCard:'',
  76. idCardFile:[
  77. {
  78. url:"https://tennis-oss.xzaiyp.top/2024-12-22/cf84422d-dcf7-4efa-82e7-371454eafbee.png"
  79. }
  80. ]
  81. },
  82. rules: {
  83. name: [{
  84. type: 'string',
  85. required: true,
  86. message: '请输入姓名名称',
  87. trigger: ['blur', 'change']
  88. }],
  89. password: [{
  90. type: 'string',
  91. required: true,
  92. message: '请输入您的密码',
  93. trigger: ['blur', 'change']
  94. }],
  95. mobile: [
  96. {
  97. required: true,
  98. message: '请输入手机号',
  99. trigger: ['change','blur'],
  100. },
  101. {
  102. validator: (rule, value, callback) => {
  103. return uni.$u.test.mobile(value);
  104. },
  105. message: '手机号码不正确',
  106. trigger: ['change','blur'],
  107. },
  108. ],
  109. address: [{
  110. type: 'string',
  111. required: true,
  112. message: '请输入公司地址',
  113. trigger: ['blur', 'change']
  114. }],
  115. industryId: [{
  116. type: 'string',
  117. required: true,
  118. message: '请选择行业',
  119. trigger: ['blur', 'change']
  120. }],
  121. idCardFile:[
  122. {
  123. validator: (rule, value, callback) => {
  124. if (value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0)) {
  125. callback(new Error('请选择身份证'));
  126. } else {
  127. callback();
  128. }
  129. },
  130. trigger: 'blur'
  131. }
  132. ]
  133. },
  134. }
  135. },
  136. watch: {
  137. fileList(newValue, oldValue) {
  138. if (newValue.length > 0) {
  139. this.form.file = '有'
  140. } else {
  141. this.form.file = ''
  142. }
  143. }
  144. },
  145. onReady() {
  146. this.onIndustryList()
  147. this.$refs.uForm.setRules(this.rules)
  148. },
  149. methods: {
  150. handleIndChange(){
  151. this.show = true
  152. },
  153. selectIndClick(event){
  154. console.info("selectIndClick",event)
  155. this.form.industryId = event.id
  156. this.form.industryName = event.name
  157. this.show = false
  158. },
  159. onIndustryList(){
  160. industryList({}).then(response=>{
  161. console.info(response)
  162. this.indList = response.result
  163. }).catch(error=>{
  164. })
  165. },
  166. submit() {
  167. let that = this
  168. that.$refs.uForm.validate().then(res => {
  169. that.onRoleBoss()
  170. }).catch(errors => {
  171. uni.$u.toast('校验失败')
  172. })
  173. },
  174. onRoleBoss(){
  175. let that = this
  176. let params={
  177. userName:that.form.name,
  178. role:that.form.role,
  179. phone:that.form.mobile,
  180. industryId:that.form.industryId,
  181. industryName:that.form.industryName,
  182. idCard:that.form.idCardFile.map(item => item.url).join(','),
  183. }
  184. roleBoss(params).then(response=>{
  185. uni.$u.toast("提交成功,等待申请")
  186. setTimeout(()=>{
  187. uni.switchTab({
  188. url:"/pages/home/index"
  189. })
  190. },1500)
  191. }).catch(error=>{
  192. setTimeout(()=>{
  193. uni.switchTab({
  194. url:"/pages/home/index"
  195. })
  196. },1500)
  197. })
  198. },
  199. deletePic(event) {
  200. this.form.idCardFile.splice(e.index, 1)
  201. },
  202. async afterRead(e) {
  203. let self = this
  204. e.file.forEach(file => {
  205. self.$Oss.ossUpload(file.url).then(url => {
  206. self.form.idCardFile.push({
  207. url
  208. })
  209. })
  210. })
  211. }
  212. }
  213. }
  214. </script>
  215. <style lang="scss" scoped>
  216. .line-orange {
  217. width: 8rpx;
  218. height: 32rpx;
  219. background: #ff7a31;
  220. border-radius: 4rpx;
  221. }
  222. </style>