modelrz.vue 34 KB

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