modelrz.vue 27 KB

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