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

241 lines
6.5 KiB

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