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

275 lines
7.4 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 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" 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">
  49. <text>{{form.id?'保存':'提交审核'}}</text>
  50. </view>
  51. <!-- <view
  52. 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">
  53. <text>联系我们</text>
  54. </view> -->
  55. </view>
  56. </view>
  57. </u--form>
  58. <u-action-sheet :actions="indList" @select="selectIndClick" title="行业" :show="show" @close="show=false"></u-action-sheet>
  59. </view>
  60. </template>
  61. <script>
  62. import {roleBoss,industryList,updateRoleBoss,addAuthenticationCompany,queryCategoryList,getAuthenticationCompany} from "@/common/api.js"
  63. export default{
  64. data(){
  65. return{
  66. show:false,
  67. indList: [],
  68. form: {
  69. id:"",
  70. role:1,
  71. name: '',
  72. password: '',
  73. mobile: '',
  74. company:'',
  75. idCard:'',
  76. address:'',
  77. industryId:'',
  78. industryName:'',
  79. businessLicenseFile:[]
  80. },
  81. rules: {
  82. name: [{
  83. type: 'string',
  84. required: true,
  85. message: '请输入姓名名称',
  86. trigger: ['blur', 'change']
  87. }],
  88. password: [{
  89. type: 'string',
  90. required: true,
  91. message: '请输入您的密码',
  92. trigger: ['blur', 'change']
  93. }],
  94. mobile: [
  95. {
  96. required: true,
  97. message: '请输入手机号',
  98. trigger: ['change','blur'],
  99. },
  100. {
  101. validator: (rule, value, callback) => {
  102. return uni.$u.test.mobile(value);
  103. },
  104. message: '手机号码不正确',
  105. trigger: ['change','blur'],
  106. },
  107. ],
  108. company: [{
  109. type: 'string',
  110. required: true,
  111. message: '请输入公司名称',
  112. trigger: ['blur', 'change']
  113. }],
  114. address: [{
  115. type: 'string',
  116. required: true,
  117. message: '请输入公司地址',
  118. trigger: ['blur', 'change']
  119. }],
  120. industryId: [{
  121. type: 'string',
  122. required: true,
  123. message: '请选择行业',
  124. trigger: ['blur', 'change']
  125. }],
  126. businessLicenseFile:[
  127. {
  128. validator: (rule, value, callback) => {
  129. if (value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0)) {
  130. callback(new Error('请选择营业执照'));
  131. } else {
  132. callback();
  133. }
  134. },
  135. trigger: 'blur'
  136. }
  137. ]
  138. },
  139. }
  140. },
  141. watch: {
  142. },
  143. onReady() {
  144. this.onQueryCategoryList()
  145. this.onAuthenticationCompany()
  146. this.$refs.uForm.setRules(this.rules)
  147. },
  148. mounted() {
  149. },
  150. methods: {
  151. onAuthenticationCompany(){
  152. let params={}
  153. getAuthenticationCompany(params).then(response=>{
  154. let company = response.result
  155. if(response.result){
  156. this.form.id = company.id
  157. this.form.name = company.name
  158. this.form.mobile = company.phone
  159. this.form.company = company.company
  160. this.form.address = company.address
  161. this.form.industryId = company.industry
  162. this.form.industryName = company.industryName
  163. this.form.businessLicenseFile = this.stringToKeyValueArray(company.license)
  164. }
  165. }).catch(error=>{
  166. })
  167. },
  168. stringToKeyValueArray(str, delimiter1 = ',') {
  169. if(str){
  170. let arro = str.split(delimiter1);
  171. let arr = [];
  172. arro.forEach(items=>{
  173. let obj = {};
  174. obj["url"] = items
  175. arr.push(obj)
  176. })
  177. console.info(arr)
  178. return arr
  179. }else{
  180. return []
  181. }
  182. },
  183. handleIndChange(){
  184. this.show = true
  185. },
  186. selectIndClick(event){
  187. this.form.industryId = event.id
  188. this.form.industryName = event.name
  189. this.show = false
  190. },
  191. onQueryCategoryList(){
  192. queryCategoryList({}).then(response=>{
  193. console.info(response)
  194. this.indList = response.result
  195. }).catch(error=>{
  196. })
  197. },
  198. onRoleBoss(){
  199. let that = this
  200. let params={
  201. userId:uni.getStorageSync("userInfo").id,
  202. id:that.form.id,
  203. name:that.form.name,
  204. role:that.form.role,
  205. phone:that.form.mobile,
  206. company:that.form.company,
  207. address:that.form.address,
  208. industry:that.form.industryId,
  209. industryName:that.form.industryName,
  210. license:that.form.businessLicenseFile.map(item => item.url).join(','),
  211. }
  212. // if(that.form.id){
  213. // updateRoleBoss(params).then(response=>{
  214. // uni.$u.toast("保存成功!")
  215. // setTimeout(()=>{
  216. // uni.navigateBack({
  217. // delta:1
  218. // })
  219. // },1500)
  220. // }).catch(error=>{
  221. // })
  222. // }else{
  223. addAuthenticationCompany(params).then(response=>{
  224. uni.$u.toast("提交成功,等待申请")
  225. setTimeout(()=>{
  226. uni.switchTab({
  227. url:"/pages/home/index"
  228. })
  229. },1500)
  230. }).catch(error=>{
  231. })
  232. // }
  233. },
  234. submit() {
  235. let that = this
  236. that.$refs.uForm.validate().then(res => {
  237. that.onRoleBoss()
  238. }).catch(errors => {
  239. // uni.$u.toast('校验失败')
  240. })
  241. },
  242. deletePic(event) {
  243. this.form.businessLicenseFile.splice(event.index, 1)
  244. },
  245. async afterRead(e) {
  246. let self = this
  247. e.file.forEach(file => {
  248. self.$Oss.ossUpload(file.url).then(url => {
  249. console.info(url)
  250. self.form.businessLicenseFile.push({
  251. url
  252. })
  253. })
  254. })
  255. }
  256. }
  257. }
  258. </script>
  259. <style lang="scss" scoped>
  260. .line-orange {
  261. width: 8rpx;
  262. height: 32rpx;
  263. background: #ff7a31;
  264. border-radius: 4rpx;
  265. }
  266. </style>