modelrz.vue 26 KB

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