modelrz.vue 28 KB

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