modelrz.vue 34 KB

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