modelrz.vue 31 KB

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