modelrz.vue 28 KB

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