modelrz.vue 28 KB

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