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

277 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
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. status:'',
  80. businessLicenseFile:[]
  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. company: [{
  110. type: 'string',
  111. required: true,
  112. message: '请输入公司名称',
  113. trigger: ['blur', 'change']
  114. }],
  115. address: [{
  116. type: 'string',
  117. required: true,
  118. message: '请输入公司地址',
  119. trigger: ['blur', 'change']
  120. }],
  121. industryId: [{
  122. type: 'string',
  123. required: true,
  124. message: '请选择行业',
  125. trigger: ['blur', 'change']
  126. }],
  127. businessLicenseFile:[
  128. {
  129. validator: (rule, value, callback) => {
  130. if (value === null || value === undefined || value === '' || (Array.isArray(value) && value.length === 0)) {
  131. callback(new Error('请选择营业执照'));
  132. } else {
  133. callback();
  134. }
  135. },
  136. trigger: 'blur'
  137. }
  138. ]
  139. },
  140. }
  141. },
  142. watch: {
  143. },
  144. onReady() {
  145. this.onQueryCategoryList()
  146. this.onAuthenticationCompany()
  147. this.$refs.uForm.setRules(this.rules)
  148. },
  149. mounted() {
  150. },
  151. methods: {
  152. onAuthenticationCompany(){
  153. let params={}
  154. getAuthenticationCompany(params).then(response=>{
  155. let company = response.result
  156. if(response.result){
  157. this.form.id = company.id
  158. this.form.name = company.name
  159. this.form.mobile = company.phone
  160. this.form.company = company.company
  161. this.form.address = company.address
  162. this.form.industryId = company.industry
  163. this.form.industryName = company.industryName
  164. this.form.status = company.status
  165. this.form.businessLicenseFile = this.stringToKeyValueArray(company.license)
  166. }
  167. }).catch(error=>{
  168. })
  169. },
  170. stringToKeyValueArray(str, delimiter1 = ',') {
  171. if(str){
  172. let arro = str.split(delimiter1);
  173. let arr = [];
  174. arro.forEach(items=>{
  175. let obj = {};
  176. obj["url"] = items
  177. arr.push(obj)
  178. })
  179. console.info(arr)
  180. return arr
  181. }else{
  182. return []
  183. }
  184. },
  185. handleIndChange(){
  186. this.show = true
  187. },
  188. selectIndClick(event){
  189. this.form.industryId = event.id
  190. this.form.industryName = event.name
  191. this.show = false
  192. },
  193. onQueryCategoryList(){
  194. queryCategoryList({}).then(response=>{
  195. console.info(response)
  196. this.indList = response.result
  197. }).catch(error=>{
  198. })
  199. },
  200. onRoleBoss(){
  201. let that = this
  202. let params={
  203. userId:uni.getStorageSync("userInfo").id,
  204. id:that.form.id,
  205. name:that.form.name,
  206. role:that.form.role,
  207. phone:that.form.mobile,
  208. company:that.form.company,
  209. address:that.form.address,
  210. industry:that.form.industryId,
  211. industryName:that.form.industryName,
  212. license:that.form.businessLicenseFile.map(item => item.url).join(','),
  213. }
  214. // if(that.form.id){
  215. // updateRoleBoss(params).then(response=>{
  216. // uni.$u.toast("保存成功!")
  217. // setTimeout(()=>{
  218. // uni.navigateBack({
  219. // delta:1
  220. // })
  221. // },1500)
  222. // }).catch(error=>{
  223. // })
  224. // }else{
  225. addAuthenticationCompany(params).then(response=>{
  226. uni.$u.toast("提交成功,等待申请")
  227. setTimeout(()=>{
  228. uni.switchTab({
  229. url:"/pages/home/index"
  230. })
  231. },1500)
  232. }).catch(error=>{
  233. })
  234. // }
  235. },
  236. submit() {
  237. let that = this
  238. that.$refs.uForm.validate().then(res => {
  239. that.onRoleBoss()
  240. }).catch(errors => {
  241. // uni.$u.toast('校验失败')
  242. })
  243. },
  244. deletePic(event) {
  245. this.form.businessLicenseFile.splice(event.index, 1)
  246. },
  247. async afterRead(e) {
  248. let self = this
  249. e.file.forEach(file => {
  250. self.$Oss.ossUpload(file.url).then(url => {
  251. console.info(url)
  252. self.form.businessLicenseFile.push({
  253. url
  254. })
  255. })
  256. })
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. .line-orange {
  263. width: 8rpx;
  264. height: 32rpx;
  265. background: #ff7a31;
  266. border-radius: 4rpx;
  267. }
  268. </style>