modelrz.vue 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000
  1. <template>
  2. <view class="content ">
  3. <view class="item-name">
  4. 上传头像
  5. </view>
  6. <view class="con_box">
  7. <view class="con_image">
  8. <image class="img" @click="navCroper(400,400,'one')"
  9. :src="updata.avatar||`../../../static/image/upImg.png`">
  10. </image>
  11. </view>
  12. </view>
  13. <view class="item-name">
  14. 基本信息
  15. </view>
  16. <view class="listBox">
  17. <view class="list">
  18. <view class="flex listItem">
  19. <view class="flex titleBox">
  20. <text class="font-color-red font-size-sm">✲</text> <text class="title">真实姓名</text>
  21. </view>
  22. <view class="right flex">
  23. <input class="input" v-model="updata.name" type="text" placeholder="请填写真实姓名"
  24. placeholder-class="placeholder" />
  25. </view>
  26. </view>
  27. <view class="flex listItem">
  28. <view class="flex titleBox">
  29. <text class="font-color-red font-size-sm">✲</text><text class="title">手机号</text>
  30. </view>
  31. <view class="right flex">
  32. <input class="input" v-model="updata.phone" type="text" placeholder="请填写手机号"
  33. placeholder-class="placeholder" />
  34. </view>
  35. </view>
  36. <view class="flex listItem">
  37. <view class="flex titleBox">
  38. <text class="font-color-red font-size-sm">✲</text><text class="title">身份证号</text>
  39. </view>
  40. <view class="right flex">
  41. <input class="input" v-model="updata.cardId" type="text" placeholder="请填写身份证号"
  42. placeholder-class="placeholder" />
  43. </view>
  44. </view>
  45. <view class="flex listItem">
  46. <view class="flex titleBox">
  47. <text class="title">从业时长</text>
  48. </view>
  49. <view class="right flex">
  50. <input class="input" v-model="updata.work_year" type="number" placeholder="请填写从业时长"
  51. placeholder-class="placeholder" />
  52. </view>
  53. </view>
  54. <view class="flex listItem">
  55. <view class="flex titleBox">
  56. <text class="title">籍贯</text>
  57. </view>
  58. <!-- <view class="right flex">
  59. <pickerAddress @change="changeAncestralPlace">
  60. {{
  61. updata.ancestral_place||'请选择籍贯'
  62. }}
  63. </pickerAddress>
  64. </view> -->
  65. <view class="right flex">
  66. <input class="input" v-model="updata.ancestral_place" type="text" placeholder="请填写籍贯"
  67. placeholder-class="placeholder" />
  68. </view>
  69. </view>
  70. <view class="flex listItem">
  71. <view class="flex titleBox">
  72. <text class="title">学历</text>
  73. </view>
  74. <view class="right flex">
  75. <picker class="input" :range='educationList' mode="selector" @change="changeEducation">
  76. <view>
  77. {{updata.education||'选择学历'}}
  78. </view>
  79. </picker>
  80. </view>
  81. </view>
  82. <view class="flex listItem">
  83. <view class="flex titleBox">
  84. <text class="title">民族</text>
  85. </view>
  86. <view class="right flex">
  87. <input class="input" v-model="updata.minority" type="text" placeholder="请填写民族"
  88. placeholder-class="placeholder" />
  89. </view>
  90. </view>
  91. <!-- <view class="flex listItem">
  92. <view class="flex titleBox">
  93. <text class="title">出生日期</text>
  94. </view>
  95. <view class="right flex">
  96. <picker class="input" value='2000-01-01' mode="date" @change="changetime">
  97. <view>
  98. {{updata.time||'请选择日期'}}
  99. </view>
  100. </picker>
  101. </view>
  102. </view> -->
  103. <view class="flex listItem">
  104. <view class="flex titleBox">
  105. <text class="font-color-red font-size-sm">✲</text><text class="title">职业</text>
  106. </view>
  107. <view class="right flex">
  108. <picker class="input" :range='workTypeList' range-key='title' mode="selector"
  109. @change="changeWorkType">
  110. <view>
  111. {{updata.word.title||'选择职业'}}
  112. </view>
  113. </picker>
  114. </view>
  115. </view>
  116. <view class="flex listItem">
  117. <view class="flex titleBox">
  118. <text class="font-color-red font-size-sm">✲</text><text class="title">收费类型</text>
  119. </view>
  120. <view class="right flex">
  121. <picker class="input" :value="updata.timetype.ind" :range='timeTypeList' range-key='title'
  122. mode="selector" @change="changetimetype">
  123. <view>
  124. {{updata.timetype.title||'收费时间类型'}}
  125. </view>
  126. </picker>
  127. </view>
  128. </view>
  129. <view class="flex listItem">
  130. <view class="flex titleBox">
  131. <text class="font-color-red font-size-sm">✲</text><text class="title">最低价</text>
  132. </view>
  133. <view class="right flex">
  134. <input class="input" v-model="updata.minMoney" type="number" placeholder="请输入最低收费价"
  135. placeholder-class="placeholder" />
  136. </view>
  137. </view>
  138. <view class="flex listItem">
  139. <view class="flex titleBox">
  140. <text class="font-color-red font-size-sm">✲</text><text class="title">最高价</text>
  141. </view>
  142. <view class="right flex">
  143. <input class="input" v-model="updata.maxMoney" type="number" placeholder="请输入最高收费价"
  144. placeholder-class="placeholder" />
  145. </view>
  146. </view>
  147. <view class="flex listItem">
  148. <view class="flex titleBox">
  149. <text class="font-color-red font-size-sm">✲</text><text class="title">服务次数</text>
  150. </view>
  151. <view class="right flex">
  152. <input class="input" v-model="updata.service_count" type="number" placeholder="请输入已经服务的数量"
  153. placeholder-class="placeholder" />
  154. </view>
  155. </view>
  156. <view class="flex listItem">
  157. <view class="flex titleBox">
  158. <text class="font-color-red font-size-sm">✲</text><text class="title">服务区域是否海外</text>
  159. </view>
  160. <view class="right flex">
  161. <picker class="input" :range='areaList' mode="selector" @change="changeAreaList">
  162. <view>
  163. {{updata.is_wm||'请选择是否海外'}}
  164. </view>
  165. </picker>
  166. </view>
  167. </view>
  168. <view class="flex listItem" v-if="updata.is_wm == '否'">
  169. <view class="flex titleBox">
  170. <text class="font-color-red font-size-sm">✲</text><text class="title">服务区域</text>
  171. </view>
  172. <view class="right">
  173. <view class="citylist">
  174. <view class="flex margin-b-20" v-for="(item,ind) in updata.onCity" :key="ind">
  175. <view></view>
  176. <view>
  177. {{item.province+item.city+item.district}}
  178. <text class="margin-l-10 del" @click="updata.onCity.splice(ind,1)">
  179. 删除
  180. </text>
  181. </view>
  182. </view>
  183. <view class="flex">
  184. <view></view>
  185. <pickerAddress class="buttom" @change="onCityClick">添加地区</pickerAddress>
  186. </view>
  187. </view>
  188. </view>
  189. </view>
  190. <view class="flex listItem">
  191. <view class="flex titleBox">
  192. <text class="font-color-red font-size-sm">✲</text><text class="title">服务内容</text>
  193. </view>
  194. <view class="right">
  195. <checkbox-group @change="checkTypeChange">
  196. <label class="flex timetype margin-b-10" v-for="(item,ind) in typeList" :key="item.id">
  197. <view class="margin-r-10">{{item.title}}</view>
  198. <view>
  199. <checkbox :value="`${item.id}`" :checked="item.checked" />
  200. </view>
  201. </label>
  202. </checkbox-group>
  203. </view>
  204. </view>
  205. </view>
  206. </view>
  207. <view class="item-name">
  208. 自我展示
  209. </view>
  210. <view class="listBox">
  211. <view class="list">
  212. <view class="listItem">
  213. <textarea class="textarea" auto-height :maxlength='-1' v-model="updata.mymask" type="text"
  214. placeholder="自我评价\n\n本人从业***年,已经服务***名客户\n成长经历:\n从事母婴工作之前是做***行业的,于***年经过专业培训后进入母婴行业;先后学习了***\n性格特征:\n本人性格直爽,具有很强的服务意识,做事认真负责,擅长……类工作\n服务格言:\n全心全意服务好每一位客户"
  215. placeholder-class="textareaplaceholder" />
  216. </view>
  217. </view>
  218. <view class="con_box">
  219. <view class="con_image" v-for="(item,ind) in updata.imageList">
  220. <image class="img" @click="navCroper(400,400,'tab',ind)" :src="item"></image>
  221. <image @click="updata.imageList.splice(ind,1)" class="tip" src="../../../static/icon/goodsExit.png"
  222. mode="scaleToFill"></image>
  223. </view>
  224. <view class="con_image">
  225. <image class="img" @click="navCroper(400,400,'all')" src="../../../static/image/upImg.png"></image>
  226. </view>
  227. </view>
  228. </view>
  229. <view class="item-name">
  230. 我的证书
  231. </view>
  232. <view class="listBox">
  233. <view class="con_box">
  234. <view class="con_image" v-for="(item,ind) in updata.service_audit_imgs">
  235. <image class="img" @click="navCroper(400,400,'audit',ind)" :src="item"></image>
  236. <image @click="updata.service_audit_imgs.splice(ind,1)" class="tip"
  237. src="../../../static/icon/goodsExit.png" mode="scaleToFill"></image>
  238. </view>
  239. <view class="con_image">
  240. <image class="img" @click="navCroper(400,400,'auditall')" src="../../../static/image/upImg.png">
  241. </image>
  242. </view>
  243. </view>
  244. </view>
  245. <view class="item-name">
  246. 服务展示
  247. </view>
  248. <view class="listBox">
  249. <view class="con_box">
  250. <view class="con_image" v-for="(item,ind) in updata.service_imgs">
  251. <image class="img" @click="navCroper(400,400,'service',ind)" :src="item"></image>
  252. <image @click="updata.service_imgs.splice(ind,1)" class="tip"
  253. src="../../../static/icon/goodsExit.png" mode="scaleToFill"></image>
  254. </view>
  255. <view class="con_image">
  256. <image class="img" @click="navCroper(400,400,'serviceall')" src="../../../static/image/upImg.png">
  257. </image>
  258. </view>
  259. </view>
  260. </view>
  261. <view class="base-buttom flex">
  262. <view class="updata flex flex-center" :class="{ 'bg-gray': loding }" @click="loding ? '' : confirm()">
  263. 提交
  264. </view>
  265. <view class="ylan flex flex-center" @click="look">
  266. 预览
  267. </view>
  268. </view>
  269. </view>
  270. </template>
  271. <script>
  272. import {
  273. getServiceTimeTypeList,
  274. getServiceTypeList,
  275. subInfoAudit,
  276. getUserWorkTypeList,
  277. getUserCardInfo
  278. } from '@/api/model.js';
  279. import {
  280. isCardNo
  281. } from '@/utils/rocessor.js';
  282. import {
  283. getAstro,
  284. getShengXiao,
  285. IdCard
  286. } from '@/utils/twelve.js';
  287. import {
  288. mapState
  289. } from "vuex"
  290. import pickerAddress from '@/components/wangding-pickerAddress/wangding-pickerAddress.vue';
  291. export default {
  292. components: {
  293. pickerAddress
  294. },
  295. data() {
  296. return {
  297. // 上传数据
  298. updata: {
  299. is_wm: '', //是否海外
  300. avatar: '', //用户头像
  301. name: '', //用户名称
  302. phone: '', //手机号
  303. cardId: '', //身份证号
  304. minMoney: '', //最低价
  305. maxMoney: '', //最高价
  306. checkedType: [], //选中的服务类型
  307. time: '', //出生日期
  308. timetype: {
  309. title: '',
  310. code: '',
  311. ind: 0 //默认0
  312. }, //选中的时间类型
  313. onCity: [], //选中的城市
  314. mymask: '', //自评
  315. imageList: [], //自评上传图片列表
  316. ancestral_place: '', //籍贯
  317. education: '', //学历
  318. minority: '', //民族
  319. work_year: '', //从业时长
  320. word: {
  321. title: '',
  322. id: ''
  323. },
  324. service_audit_imgs: [], //我的证书
  325. service_imgs: [], //服务展示
  326. no: ''
  327. },
  328. typeList: [], //服务类型
  329. timeTypeList: [], //时间类型
  330. workTypeList: [], //工作类型
  331. loding: false, //是否载入中
  332. type: 0, //0为新增,1为修改2为商品页进入注册
  333. userModelData: {}, //保存获取的用户模板
  334. modelid: '', //保存要预览的模板id
  335. educationList: ['小学', '初中', '高中', '大专', '本科', '研究生', '博士'], //学历列表
  336. areaList: ['是', '否']
  337. };
  338. },
  339. async onLoad(options) {
  340. this.modelid = options.modelid
  341. if (options.type == 1) {
  342. this.type = 1;
  343. await this.getUserCardInfo()
  344. } else if (options.type == 2) {
  345. this.type = 0
  346. }
  347. this.init()
  348. },
  349. computed: {
  350. // #ifdef H5
  351. ...mapState(['urlFile']),
  352. // #endif
  353. ...mapState(['baseURL']),
  354. },
  355. methods: {
  356. // 选择学历
  357. changeEducation(res) {
  358. this.updata.education = this.educationList[res.detail.value];
  359. console.log(res);
  360. },
  361. changeAreaList(res) {
  362. this.updata.is_wm = this.areaList[res.detail.value];
  363. console.log(res);
  364. },
  365. // 初始化
  366. init() {
  367. const that = this;
  368. getServiceTimeTypeList().then(
  369. (res) => {
  370. that.timeTypeList = res.data.list.map((arr) => {
  371. return arr
  372. })
  373. if (that.type == 0) {
  374. that.updata.timetype = that.timeTypeList[0];
  375. } else
  376. if (that.type == 1) {
  377. for (let i = 0; i < that.timeTypeList.length; i++) {
  378. if (that.timeTypeList[i].code == that.userModelData.service_type) {
  379. that.updata.timetype = that.timeTypeList[i]
  380. that.updata.timetype.ind = i;
  381. break
  382. }
  383. }
  384. }
  385. }
  386. ).catch(
  387. (res) => {
  388. console.log(res);
  389. }
  390. )
  391. getServiceTypeList().then(
  392. (res) => {
  393. that.typeList = res.data.list
  394. if (that.type == 1) {
  395. for (let i = 0; i < that.userModelData.service_project_ar.length; i++) {
  396. for (let a = 0; a < that.typeList.length; a++) {
  397. if (+that.typeList[a].id == +that.userModelData.service_project_ar[i].id) {
  398. that.typeList[a].checked = true;
  399. that.updata.checkedType.push('' + that.typeList[a].id)
  400. }
  401. }
  402. }
  403. }
  404. console.log(res, '服务');
  405. }
  406. ).catch(
  407. (res) => {
  408. console.log(res);
  409. }
  410. )
  411. getUserWorkTypeList().then(
  412. (res) => {
  413. console.log(res);
  414. that.workTypeList = res.data.list
  415. if (that.type == 0) {
  416. that.updata.word = that.workTypeList[0];
  417. } else if (that.type == 1) {
  418. for (let i = 0; i < that.workTypeList.length; i++) {
  419. console.log(that.userModelData.user_work_type_id, 'word', that.workTypeList[i].id);
  420. if (that.workTypeList[i].id == that.userModelData.user_work_type_id) {
  421. that.updata.word = that.workTypeList[i];
  422. break
  423. }
  424. }
  425. }
  426. }
  427. ).catch(
  428. (res) => {
  429. console.log(res);
  430. }
  431. )
  432. },
  433. // 跳转查看预览页面
  434. look() {
  435. const that = this;
  436. if (!that.rendl()) {
  437. return
  438. }
  439. // 获取生日
  440. const birthday = IdCard('' + that.updata.cardId, 1);
  441. // 复制选中的服务数组
  442. let arr = [...that.updata.checkedType]
  443. let pushar = [];
  444. that.typeList.forEach(
  445. (re) => {
  446. for (let i = 0; i < arr.length; i++) {
  447. console.log(arr[i], '循环');
  448. if (+arr[i] == +re.id) {
  449. // 删除已选中的对象
  450. arr.splice(i, 1)
  451. pushar.push(re)
  452. break
  453. }
  454. }
  455. }
  456. )
  457. console.log(that.updata);
  458. let data = {
  459. is_china: that.updata.is_wm == '是'?0:1,
  460. name: that.updata.name,
  461. avatar: that.updata.avatar,
  462. age: IdCard(that.updata.cardId, 3),
  463. twelve: getShengXiao(birthday),
  464. work_year: that.updata.work_year,
  465. constellation: getAstro(...(birthday.split('-'))),
  466. ancestral_place: that.updata.ancestral_place,
  467. minority: that.updata.minority,
  468. education: that.updata.education,
  469. service_area_all: that.updata.is_wm == '否'?that.updata.onCity.map(
  470. (item) => {
  471. return item.province + item.city + item.district
  472. }
  473. ):['海外,海外,海外'],
  474. service_min_price: that.updata.minMoney,
  475. service_max_price: that.updata.maxMoney,
  476. service_time_type_title: that.updata.timetype.title,
  477. service_intro_content: that.updata.mymask,
  478. service_intro_imgs: that.updata.imageList,
  479. service_audit_imgs: that.updata.service_audit_imgs,
  480. service_project_ar: pushar,
  481. service_imgs: that.updata.service_imgs,
  482. no: that.updata.no,
  483. user_work_type_title: that.updata.word.title,
  484. service_count: that.updata.service_count
  485. }
  486. console.log('baocun',data);
  487. uni.setStorageSync('modeldata', data)
  488. uni.navigateTo({
  489. url: '/pages/user/model/model?mtype=' + that.modelid + '&type=1'
  490. })
  491. },
  492. // 获取用户提交数据
  493. getUserCardInfo() {
  494. const that = this;
  495. return new Promise((resolve, reject) => {
  496. getUserCardInfo().then(
  497. (data) => {
  498. const res = data.data;
  499. console.log(res, '返回');
  500. // 存储返回用户数据
  501. that.userModelData = res;
  502. that.updata = Object.assign(that.updata, {
  503. is_wm: res.is_china == 1 ? '否' : '是',
  504. avatar: res.avatar, //用户头像
  505. name: res.name, //用户名称
  506. phone: res.mobile, //手机号
  507. cardId: res.idcard, //身份证号
  508. minMoney: res.service_min_price, //最低价
  509. maxMoney: res.service_max_price, //最高价
  510. time: res.birthday, //出生日期
  511. onCity:res.is_china == 1 ? res.service_area_all.map((arr) => {
  512. return {
  513. province: arr[0].name,
  514. city: arr[1].name,
  515. district: arr[2].name
  516. }
  517. }): [], //选中的城市
  518. mymask: res.service_intro_content, //自评
  519. imageList: res.service_intro_imgs, //自评上传图片列表
  520. ancestral_place: res.ancestral_place, //籍贯
  521. education: res.education, //学历
  522. minority: res.minority, //民族
  523. work_year: res.work_year, //从业时长
  524. service_audit_imgs: res.service_audit_imgs, //我的证书
  525. service_imgs: res.service_imgs, //服务展示
  526. no: res.no,
  527. service_count: res.service_count
  528. })
  529. console.log(that.updata, 'that.updata');
  530. resolve('初始化数据成功')
  531. }
  532. ).catch(
  533. (res) => {
  534. reject(res)
  535. }
  536. )
  537. })
  538. },
  539. // 选中的服务类型
  540. checkTypeChange(type) {
  541. this.updata.checkedType = type.detail.value;
  542. console.log(type)
  543. },
  544. // 选中的工作类型
  545. changeWorkType(type) {
  546. this.updata.word = this.workTypeList[type.detail.value];
  547. console.log(this.updata.word)
  548. },
  549. // 选择时间类型
  550. changetimetype(res) {
  551. this.updata.timetype = this.timeTypeList[res.detail.value];
  552. },
  553. // 时间选择
  554. changetime(time) {
  555. this.updata.time = time.detail.value;
  556. console.log(time);
  557. },
  558. // 选择籍贯
  559. changeAncestralPlace({
  560. data
  561. }) {
  562. this.updata.ancestral_place = data[2];
  563. },
  564. // 选择省市区
  565. onCityClick({
  566. data
  567. }) {
  568. let address = {};
  569. address.province = data[0];
  570. address.city = data[1];
  571. address.district = data[2];
  572. this.updata.onCity.push(address)
  573. console.log(this.onCity, 'cs');
  574. },
  575. upLoad(path) {
  576. // #ifdef H5
  577. console.log(path, 'h5');
  578. // #endif
  579. uni.showLoading({
  580. title: '图片上传中',
  581. mask: true
  582. });
  583. return new Promise((resolve, error) => {
  584. uni.uploadFile({
  585. url: this.baseURL + '/api/user/qiniuUpload', //仅为示例,非真实的接口地址
  586. filePath: path,
  587. name: 'file',
  588. header: {
  589. "token": uni.getStorageSync('token')
  590. },
  591. success: (uploadFileRes) => {
  592. if ("string" === typeof uploadFileRes.data) {
  593. resolve(JSON.parse(uploadFileRes.data).data)
  594. } else {
  595. resolve(uploadFileRes.data.data)
  596. }
  597. },
  598. complete() {
  599. uni.hideLoading()
  600. }
  601. });
  602. })
  603. },
  604. // 图片裁切
  605. /**
  606. * @param {Number} w 裁切宽度比例
  607. * @param {Number} h 裁切高度比例
  608. * @param {Number} mw 图片最小宽度
  609. * @param {Number} mh 图片最小高度
  610. * @param {String} url url修改
  611. */
  612. navCroper(w, h, type, ind) {
  613. let that = this;
  614. let tt = (type == 'upimg' ? 2 : 1)
  615. this.onImg(tt).then((url) => {
  616. uni.navigateTo({
  617. url: `../realName/cropper?width=${w}&height=${h}`,
  618. events: {
  619. uploadSuccess(res) {
  620. that.upLoad(res).then((urldata) => {
  621. console.log(urldata);
  622. if (type == 'one') {
  623. that.updata.avatar = urldata.img
  624. } else if (type == 'all') {
  625. that.updata.imageList.push(urldata.img)
  626. } else if (type == 'tab') {
  627. that.updata.imageList.splice(ind, 1, urldata.img)
  628. } else if (type == 'audit') {
  629. that.updata.service_audit_imgs.splice(ind, 1, urldata.img)
  630. } else if (type == 'auditall') {
  631. that.updata.service_audit_imgs.push(urldata.img)
  632. } else if (type == 'service') {
  633. that.updata.service_imgs.splice(ind, 1, urldata.img)
  634. } else if (type == 'serviceall') {
  635. that.updata.service_imgs.push(urldata.img)
  636. }
  637. })
  638. }
  639. },
  640. success: function(res) {
  641. // 通过eventChannel向被打开页面传送数据
  642. res.eventChannel.emit('urlNext', {
  643. url
  644. })
  645. }
  646. })
  647. })
  648. },
  649. onImg(type) {
  650. const _this = this
  651. return new Promise((ok, erro) => {
  652. // 判断是否需要选择
  653. if (type == 1) {
  654. uni.showActionSheet({
  655. itemList: ['拍照', '选择一张照片'],
  656. success: function(res) {
  657. _this.chooseImage(res.tapIndex).then((url) => {
  658. ok(url)
  659. }).catch((res) => {
  660. erro(res)
  661. })
  662. },
  663. fail: function(res) {
  664. erro(res)
  665. console.log(res.errMsg);
  666. }
  667. });
  668. }
  669. // 判断是否只需要拍照
  670. if (type == 2) {
  671. _this.chooseImage(0).then((url) => {
  672. ok(url)
  673. }).catch((res) => {
  674. erro(res)
  675. })
  676. }
  677. })
  678. },
  679. chooseImage: function(index) {
  680. const _this = this
  681. return new Promise((ok, error) => {
  682. // 从相册/相机选择
  683. // 如需直接开相机或直接选相册,请只使用一个选项
  684. const sourceType = index === 0 ? ['camera'] : ['album']
  685. uni.chooseImage({
  686. count: 1, //默认9
  687. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  688. sourceType: sourceType,
  689. success: function(res) {
  690. ok(res.tempFilePaths[0])
  691. },
  692. fail(e) {
  693. uni.showModal({
  694. title: '文件打开错误',
  695. content: '请设置授权文件存储权限',
  696. showCancel: false,
  697. });
  698. error(e)
  699. }
  700. });
  701. })
  702. },
  703. // 实名认证
  704. confirm(e) {
  705. const that = this;
  706. if (!that.rendl()) {
  707. return
  708. }
  709. that.loding = true;
  710. subInfoAudit({
  711. is_china: that.updata.is_wm == '是'?0:1,
  712. avatar: that.updata.avatar,
  713. name: that.updata.name,
  714. mobile: that.updata.phone,
  715. idcard: that.updata.cardId,
  716. service_type: that.updata.timetype.code,
  717. service_min_price: that.updata.minMoney,
  718. service_max_price: that.updata.maxMoney,
  719. service_area: that.updata.is_wm == '是' ? ["海外,海外1,海外2"] : that.updata.onCity.map((item) => {
  720. return item.province + ',' + item.city + ',' + item.district;
  721. }),
  722. service_project: that.updata.checkedType,
  723. service_intro_content: that.updata.mymask,
  724. service_intro_imgs: that.updata.imageList,
  725. work_year: that.updata.work_year,
  726. ancestral_place: that.updata.ancestral_place,
  727. education: that.updata.education,
  728. minority: that.updata.minority,
  729. service_audit_imgs: that.updata.service_audit_imgs,
  730. service_imgs: that.updata.service_imgs,
  731. user_work_type_id: that.updata.word.id,
  732. service_count: that.updata.service_count
  733. })
  734. .then((e) => {
  735. that.loding = false;
  736. this.$api.msg(e.msg);
  737. })
  738. .catch(err => {
  739. this.loding = false;
  740. console.log(err);
  741. });
  742. },
  743. // 认证
  744. rendl() {
  745. const that = this;
  746. if (!that.updata.avatar) {
  747. uni.showModal({
  748. title: '错误',
  749. content: '请上传头像',
  750. showCancel: false,
  751. });
  752. return false
  753. }
  754. if (!that.updata.name) {
  755. uni.showModal({
  756. title: '错误',
  757. content: '请填写姓名',
  758. showCancel: false,
  759. });
  760. return false
  761. }
  762. if (!that.updata.cardId) {
  763. uni.showModal({
  764. title: '错误',
  765. content: '请填写身份证号',
  766. showCancel: false,
  767. });
  768. return
  769. } else if (!isCardNo(that.updata.cardId)) {
  770. uni.showModal({
  771. title: '错误',
  772. content: '请填写正确的身份证号',
  773. showCancel: false,
  774. });
  775. return false
  776. }
  777. if (!that.updata.phone) {
  778. uni.showModal({
  779. title: '错误',
  780. content: '请填写手机号',
  781. showCancel: false,
  782. });
  783. return false
  784. }
  785. if (!that.updata.timetype.code) {
  786. uni.showModal({
  787. title: '错误',
  788. content: '请选择收费时间类型',
  789. showCancel: false,
  790. });
  791. return false
  792. }
  793. if (!that.updata.minMoney) {
  794. uni.showModal({
  795. title: '错误',
  796. content: '请填写最低收费价',
  797. showCancel: false,
  798. });
  799. return false
  800. }
  801. if (!that.updata.maxMoney) {
  802. uni.showModal({
  803. title: '错误',
  804. content: '请填写最高收费价',
  805. showCancel: false,
  806. });
  807. return false
  808. }
  809. if(!that.updata.is_wm) {
  810. uni.showModal({
  811. title: '错误',
  812. content: '请选择服务区域是否海外',
  813. showCancel: false,
  814. });
  815. return
  816. }
  817. if ( that.updata.is_wm == '否'&&that.updata.onCity.length == 0) {
  818. uni.showModal({
  819. title: '错误',
  820. content: '请选择服务区域',
  821. showCancel: false,
  822. });
  823. return false
  824. }
  825. if (that.updata.checkedType.length == 0) {
  826. uni.showModal({
  827. title: '错误',
  828. content: '请选择服务内容',
  829. showCancel: false,
  830. });
  831. return false
  832. }
  833. return true
  834. }
  835. }
  836. };
  837. </script>
  838. <style lang="scss">
  839. .content,
  840. page {
  841. min-height: 100%;
  842. }
  843. .content {
  844. padding-bottom: 150rpx;
  845. }
  846. .item-name {
  847. margin: $page-row-spacing;
  848. font-size: $font-lg;
  849. font-weight: bold;
  850. color: $font-color-dark;
  851. }
  852. .con_box {
  853. margin: $page-row-spacing;
  854. .con_image {
  855. width: 150rpx;
  856. height: 150rpx;
  857. display: inline-block;
  858. margin-right: 20rpx;
  859. position: relative;
  860. .img {
  861. width: 100%;
  862. height: 100%;
  863. }
  864. .tip {
  865. position: absolute;
  866. top: -10rpx;
  867. right: -10rpx;
  868. width: 30rpx;
  869. height: 30rpx;
  870. background-color: #FFF;
  871. border-radius: 99rpx;
  872. }
  873. }
  874. }
  875. .listBox {
  876. margin: $page-row-spacing;
  877. margin-top: 30rpx;
  878. border-radius: 20rpx;
  879. overflow: hidden;
  880. background-color: #FFFFFF;
  881. }
  882. .list {
  883. .input {
  884. text-align: right;
  885. font-size: $font-base;
  886. color: $color-gray;
  887. width: 100%;
  888. }
  889. .listItem {
  890. padding: 35rpx 40rpx;
  891. border-bottom: 1px solid $page-color-light;
  892. .textarea {
  893. font-size: $font-base;
  894. width: 100%;
  895. word-wrap: break-word;
  896. white-space: pre-line;
  897. min-height: 9rem;
  898. }
  899. /deep/ .textareaplaceholder {
  900. word-wrap: break-word;
  901. white-space: pre-line;
  902. }
  903. }
  904. .listIconImg {
  905. width: 36rpx;
  906. }
  907. .right {
  908. color: $font-color-light;
  909. font-size: $font-base;
  910. flex-grow: 1;
  911. justify-content: flex-end;
  912. .timetype {
  913. width: 100%;
  914. justify-content: flex-end;
  915. }
  916. .citylist {
  917. .del {
  918. color: $color-red;
  919. font-size: $font-sm;
  920. border: 1px solid $color-red;
  921. border-radius: 10rpx;
  922. line-height: 1;
  923. padding: 5rpx 15rpx;
  924. }
  925. }
  926. .img {
  927. width: 26rpx;
  928. }
  929. .buttom {
  930. color: $base-color;
  931. border: 1px solid $base-color;
  932. border-radius: 10rpx;
  933. line-height: 1;
  934. padding: 10rpx 20rpx;
  935. }
  936. }
  937. .titleBox {
  938. .title {
  939. color: $font-color-base;
  940. font-size: $font-base;
  941. }
  942. }
  943. }
  944. .bg-gray {
  945. background-color: $color-gray;
  946. }
  947. .base-buttom {
  948. position: fixed;
  949. bottom: 0rpx;
  950. right: 0rpx;
  951. left: 0rpx;
  952. margin: 0;
  953. padding: 0;
  954. height: 100rpx;
  955. border-radius: 0;
  956. .updata,
  957. .ylan {
  958. width: 50%;
  959. height: 100%;
  960. justify-content: center;
  961. }
  962. .ylan {
  963. background-color: #FFF;
  964. color: $font-color-dark;
  965. }
  966. }
  967. </style>