personinfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759
  1. <template>
  2. <view style="position: relative;">
  3. <!-- 胶囊 -->
  4. <mvBar :mysNavConfig="mysNavConfig"></mvBar>
  5. <view :style="{marginTop:navH}"></view>
  6. <view>
  7. <!-- 个人信息完善 -->
  8. <view style="margin: 0 20rpx;">
  9. <uni-forms :rules="rules" :value="formData" ref="form" validate-trigger="bind"
  10. err-show-type="undertext">
  11. <uni-forms-item name="age" label="年龄区间">
  12. <picker @change="bindPickerChange" :value="index" :range="array"
  13. range-key="age_bracket_discribe">
  14. <view>{{ Xage }}</view>
  15. </picker>
  16. </uni-forms-item>
  17. <uni-forms-item name="skintype" label="国籍">
  18. <picker @change="bindPickerChange1" :value="index1" :range="array1" range-key="name">
  19. <view>{{ array1[index1].name }}</view>
  20. </picker>
  21. </uni-forms-item>
  22. <uni-forms-item name="vregion" label="探店地区">
  23. <picker class="picker" mode="multiSelector" :range="region" range-key="name"
  24. :value="regionIndex" @change="pickerChange" @columnchange="pickerColumnchange">
  25. <view class="pbox" :class="{'pbox_hover':regionStr != '请选择省市区'}">
  26. <view>{{regionStr}}</view>
  27. <text class="iconfont icon-you"></text>
  28. </view>
  29. </picker>
  30. </uni-forms-item>
  31. <uni-forms-item name="phone" required label="联系电话">
  32. <uni-easyinput type="number" maxlength="11" :inputBorder="true" v-model="formData.phone"
  33. placeholder="请输入联系电话">
  34. </uni-easyinput>
  35. </uni-forms-item>
  36. </uni-group>
  37. </uni-forms>
  38. <button class="btn1" @click="submitForm('form')">保存</button>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import region from '@/components/pca-code.json';
  45. import mvBar from "@/components/mys_navBar/mysNavBar";
  46. export default {
  47. components: {
  48. mvBar,
  49. },
  50. data() {
  51. return {
  52. navH: getApp().globalData.navHeight,
  53. // 原数组
  54. oldRegion: region,
  55. // 处理后的数组
  56. region: [
  57. [],
  58. [],
  59. []
  60. ],
  61. // 选择省市区的下标Index 传则默认选中传递的
  62. regionIndex: [0, 0, 0],
  63. // 省市区字符串
  64. regionStr: '请选择省市区',
  65. formData: {
  66. wechat: '',
  67. age: '',
  68. nationality: '',
  69. phone: '',
  70. sex: '',
  71. visitStoreRegion: '',
  72. },
  73. index: 0,
  74. index1: 0,
  75. Xage: '请选择',
  76. array: [{
  77. age_bracket_discribe: '请选择',
  78. age_aid: 0
  79. }, {
  80. age_bracket_discribe: '0~18',
  81. age_aid: 1
  82. }, {
  83. age_bracket_discribe: '18~25',
  84. age_aid: 2
  85. }, {
  86. age_bracket_discribe: '26~30',
  87. age_aid: 3
  88. }, {
  89. age_bracket_discribe: '30~40',
  90. age_aid: 4
  91. }, {
  92. age_bracket_discribe: '40+',
  93. age_aid: 5
  94. }],
  95. array1: [{
  96. name: '请选择',
  97. id: 0
  98. }, {
  99. name: '中国',
  100. id: 1
  101. }, {
  102. name: '外国',
  103. id: 2
  104. }],
  105. data: {},
  106. show: false,
  107. rules: {
  108. phone: {
  109. rules: [{
  110. required: true,
  111. errorMessage: '请输入联系电话'
  112. }, ]
  113. },
  114. },
  115. mysNavConfig: {
  116. /* 开启单页显示首页图标 */
  117. isHome: true,
  118. /* 固定导航 */
  119. navFixed: true,
  120. /* 标题 (屏幕中心居中 两边图标中心居中使用slot center1) */
  121. navTitle: {
  122. text: "个人资料管理",
  123. color: "",
  124. fontSize: "32rpx", // px upx rpx
  125. fontWeight: "normal", // 100 - 700
  126. },
  127. btnType: "type2",
  128. onLeftClick: '',
  129. /* type2 按钮 */
  130. type2Config: {
  131. // 左图标
  132. leftPath: "/static/img/png2.png",
  133. // 右图标
  134. rightPath: "/static/img/png4.png",
  135. // 圆角
  136. radius: "40rpx",
  137. },
  138. },
  139. };
  140. },
  141. onLoad() {},
  142. onReady() {
  143. this.$refs.form.setRules(this.rules)
  144. },
  145. async onShow() {
  146. this.initRegion()
  147. await this.getlist()
  148. this.getlist1()
  149. },
  150. methods: {
  151. initRegion() {
  152. // 声明城市数组
  153. let cityArr = [];
  154. let countyArr = [];
  155. // 设置下标
  156. this.regionIndex = [0, 0, 0];
  157. // 改变城市列表
  158. this.region[1] = this.oldRegion[0].children.map(item => {
  159. cityArr.push({
  160. name: item.name,
  161. code: item.code
  162. });
  163. })
  164. this.$set(this.region, 1, cityArr);
  165. // 改变县区列表
  166. this.oldRegion[0].children[0].children.map(item => {
  167. countyArr.push({
  168. name: item.name,
  169. code: item.code
  170. });
  171. })
  172. this.$set(this.region, 2, countyArr);
  173. },
  174. // 信息表
  175. getlist() {
  176. return this.$https.get('/youngee/c/g/get-info-tables')
  177. .then(res => {
  178. console.log(res)
  179. this.array = res.data.data.AgeBracket
  180. })
  181. },
  182. // 达人详细信息表
  183. getlist1() {
  184. return this.$https.get('/youngee/c/t/g/get-talent-info')
  185. .then(res => {
  186. console.log(res)
  187. if (res.data.data.talent_wx_number !== null) {
  188. if (res.data.data.talent_age_bracket !== 0) {
  189. for (var i = 0; i < this.array.length; i++) {
  190. if (this.array[i].age_aid == res.data.data.talent_age_bracket) {
  191. this.Xage = this.array[i].age_bracket_discribe
  192. }
  193. this.formData.age = res.data.data.talent_age_bracket
  194. }
  195. }
  196. if (res.data.data.talent_nationality !== 0) {
  197. this.index1 = res.data.data.talent_nationality
  198. this.formData.nationality = res.data.data.talent_nationality
  199. }
  200. if (res.data.data.visit_store_region !== 0) {
  201. let a = res.data.data.visit_store_region.toString().slice(0, 2)
  202. let b = res.data.data.visit_store_region.toString().slice(0, 4)
  203. let c = 0
  204. for (var i = 0; i < region.length; i++) {
  205. if (region[i].code == a) {
  206. a = region[i].name
  207. for (var j = 0; j < region[i].children.length; j++) {
  208. if (region[i].children[j].code == b) {
  209. b = region[i].children[j].name
  210. for (var o = 0; o < region[i].children[j].children
  211. .length; o++) {
  212. if (region[i].children[j].children[o].code == res.data.data
  213. .visit_store_region) {
  214. c = region[i].children[j].children[o].name
  215. }
  216. }
  217. }
  218. }
  219. }
  220. }
  221. this.regionStr = a + ' ' + b + ' ' + c
  222. this.formData.visitStoreRegion = res.data.data.visit_store_region
  223. }
  224. this.formData.phone = res.data.data.talent_phone_number
  225. }
  226. })
  227. },
  228. // 年龄选择的
  229. bindPickerChange: function(e) {
  230. this.index = e.detail.value;
  231. this.formData.age = this.array[this.index].age_aid
  232. this.Xage = this.array[this.index].age_bracket_discribe
  233. console.log(this.formData.age)
  234. },
  235. //国籍选择
  236. bindPickerChange1: function(e) {
  237. console.log(e)
  238. this.index1 = e.detail.value;
  239. this.formData.nationality = this.array1[this.index1].id
  240. console.log(this.formData.nationality)
  241. },
  242. /**
  243. * 手动提交
  244. * @param {Object} form
  245. */
  246. submitForm(form) {
  247. this.$refs[form]
  248. .submit()
  249. .then(res => {
  250. const iphoneReg1 = /^1[0-9]{10}$/
  251. if (!iphoneReg1.test(this.formData.phone)) {
  252. uni.showToast({
  253. title: '电话号码格式不正确',
  254. icon: 'none'
  255. })
  256. return
  257. }
  258. let nickName = uni.getStorageSync('nickName');
  259. let avatarUrl = uni.getStorageSync('avatarUrl');
  260. this.$https.post('/youngee/c/t/p/talent-info', {
  261. talent_age_bracket: this.formData.age,
  262. talent_nationality: this.formData.nationality,
  263. visit_store_region: this.formData.visitStoreRegion,
  264. talent_phone_number: this.formData.phone,
  265. talent_wx_nickname: nickName,
  266. avatar: avatarUrl,
  267. })
  268. .then(res => {
  269. if (res.data.code == 0) {
  270. console.log(res)
  271. uni.navigateBack()
  272. } else {
  273. uni.showToast({
  274. title: res.data.msg,
  275. icon: 'none',
  276. duration: 2000
  277. });
  278. }
  279. })
  280. })
  281. .catch(errors => {
  282. console.error('验证失败:', errors)
  283. uni.showToast({
  284. title: '请填写所有信息',
  285. icon: 'none'
  286. })
  287. })
  288. },
  289. //城市选择
  290. pickerChange(e) {
  291. // console.log(e, '1');
  292. this.regionIndex = e.detail.value;
  293. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[
  294. 1]]
  295. .name + ' ' +
  296. this.region[2][this.regionIndex[2]].name;
  297. // 组件传值
  298. this.$emit('region', [this.region[0][this.regionIndex[0]].code, this.region[1][this.regionIndex[1]]
  299. .code,
  300. this.region[
  301. 2][this.regionIndex[2]].code
  302. ]);
  303. this.formData.visitStoreRegion = this.region[2][this.regionIndex[2]].code;
  304. },
  305. pickerColumnchange(e) {
  306. // console.log(e);
  307. // 第几列滑动
  308. // console.log(e.detail.column);
  309. // 第几列滑动的下标
  310. // console.log(e.detail.value)
  311. if (e.detail.column === 0) {
  312. // 声明城市数组
  313. let cityArr = [];
  314. let countyArr = [];
  315. // 设置下标
  316. this.regionIndex = [e.detail.value, 0, 0];
  317. // 改变城市列表
  318. this.region[1] = this.oldRegion[e.detail.value].children.map(item => {
  319. cityArr.push({
  320. name: item.name,
  321. code: item.code
  322. });
  323. })
  324. this.$set(this.region, 1, cityArr);
  325. // 改变县区列表
  326. this.oldRegion[e.detail.value].children[0].children.map(item => {
  327. countyArr.push({
  328. name: item.name,
  329. code: item.code
  330. });
  331. })
  332. this.$set(this.region, 2, countyArr);
  333. }
  334. if (e.detail.column === 1) {
  335. this.regionIndex[1] = e.detail.value;
  336. this.regionIndex[2] = 0;
  337. let countyArr = [];
  338. this.oldRegion[this.regionIndex[0]].children[this.regionIndex[1]].children.map(item => {
  339. countyArr.push({
  340. name: item.name,
  341. code: item.code
  342. });
  343. })
  344. this.$set(this.region, 2, countyArr);
  345. }
  346. if (e.detail.column === 2) {
  347. this.regionIndex[2] = e.detail.value;
  348. }
  349. }
  350. },
  351. created() {
  352. let provinceArr = [];
  353. let cityArr = [];
  354. this.oldRegion.map((item, index) => {
  355. this.region[0].push({
  356. name: item.name,
  357. code: item.code
  358. });
  359. if (this.previnceId == item.code) {
  360. provinceArr = item.children;
  361. this.regionIndex[0] = index;
  362. }
  363. })
  364. // console.log(provinceArr);
  365. provinceArr.map((item, index) => {
  366. this.region[1].push({
  367. name: item.name,
  368. code: item.code
  369. });
  370. if (this.cityId == item.code) {
  371. cityArr = item.children;
  372. this.regionIndex[1] = index;
  373. }
  374. })
  375. cityArr.map((item, index) => {
  376. this.region[2].push({
  377. name: item.name,
  378. code: item.code
  379. });
  380. if (this.countyId == item.code) {
  381. this.regionIndex[2] = index;
  382. }
  383. })
  384. if (this.isRevise) {
  385. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[
  386. 1]]
  387. .name + ' ' +
  388. this.region[2][this.regionIndex[2]].name;
  389. } else {
  390. this.regionStr = '请选择省市区';
  391. }
  392. }
  393. };
  394. </script>
  395. <style>
  396. picker {
  397. position: relative;
  398. display: block;
  399. cursor: pointer;
  400. padding-left: 20rpx !important;
  401. /* padding-top: 20rpx !important; */
  402. /* color: grey !important; */
  403. }
  404. /deep/.uni-forms-item__inner {
  405. border-bottom: none !important;
  406. margin-bottom: 0 !important;
  407. }
  408. </style>
  409. <style lang="scss" scoped>
  410. @charset "UTF-8";
  411. /* 头条小程序组件内不能引入字体 */
  412. /* #ifdef MP-TOUTIAO */
  413. @font-face {
  414. font-family: uniicons;
  415. font-weight: normal;
  416. font-style: normal;
  417. src: url("~@/static/uni.ttf") format("truetype");
  418. }
  419. /* #endif */
  420. /* #ifndef APP-NVUE */
  421. page {
  422. display: flex;
  423. flex-direction: column;
  424. box-sizing: border-box;
  425. background-color: #FFFFFF;
  426. min-height: 100%;
  427. height: auto;
  428. }
  429. view {
  430. font-size: 14px;
  431. // line-height: inherit;
  432. }
  433. .menu {
  434. position: fixed;
  435. top: 180rpx;
  436. background-color: #FFFFFF;
  437. justify-content: space-around;
  438. height: 80rpx;
  439. // height: 5%;
  440. width: 100%;
  441. display: flex;
  442. z-index: 10;
  443. margin-bottom: 10rpx;
  444. }
  445. .menu-item p {
  446. font-weight: 600;
  447. &.lor {
  448. border-bottom: 5rpx solid #F0D232;
  449. color: #F0D232;
  450. padding-bottom: 15rpx;
  451. }
  452. }
  453. .btn1 {
  454. margin: 30rpx;
  455. font-size: 35rpx;
  456. color: #000;
  457. background-color: #F0D232;
  458. border: none;
  459. border-radius: 0;
  460. }
  461. .uni-input-border,
  462. .uni-textarea-border {
  463. flex: 1;
  464. font-size: 14px;
  465. color: #666;
  466. border: 1px #FFFFFF solid;
  467. border-radius: 5px;
  468. /* #ifndef APP-NVUE */
  469. box-sizing: border-box;
  470. /* #endif */
  471. }
  472. .uni-input-border {
  473. padding: 0 10px;
  474. height: 35px;
  475. }
  476. .uni-textarea-border {
  477. padding: 10px;
  478. height: 80px;
  479. }
  480. .label-box {
  481. margin-right: 10px;
  482. }
  483. .transform-scale {
  484. transform: scale(0.7);
  485. }
  486. .butto {
  487. text-align: center;
  488. }
  489. .option {
  490. padding: 20rpx;
  491. }
  492. .uni-margin-wrap {
  493. width: 690rpx;
  494. width: 100%;
  495. ;
  496. }
  497. .swiper {
  498. height: 300rpx;
  499. }
  500. .swiper-item {
  501. display: block;
  502. height: 300rpx;
  503. line-height: 300rpx;
  504. text-align: center;
  505. }
  506. .swiper-list {
  507. margin-top: 40rpx;
  508. margin-bottom: 0;
  509. }
  510. .uni-common-mt {
  511. margin-top: 60rpx;
  512. position: relative;
  513. }
  514. .info {
  515. position: absolute;
  516. right: 20rpx;
  517. }
  518. .uni-padding-wrap {
  519. width: 550rpx;
  520. padding: 0 100rpx;
  521. }
  522. .signup {
  523. box-shadow: 0rpx 5rpx 40rpx #ccc;
  524. width: 100%;
  525. position: fixed;
  526. bottom: 0rpx;
  527. display: flex;
  528. height: 90rpx;
  529. padding-top: 2%;
  530. background-color: #FFFFFF;
  531. justify-content: space-around;
  532. }
  533. .signuptext {
  534. text-align: center;
  535. margin-top: 2%;
  536. }
  537. .signuptext p {
  538. font-size: 60%;
  539. color: #333333;
  540. }
  541. .signupbut {
  542. text-align: center;
  543. margin-top: 2%;
  544. }
  545. .but1 {
  546. width: 120%;
  547. text-align: center;
  548. background-color: #FCCF41;
  549. border-radius: 10rpx;
  550. color: #464100;
  551. font-size: 28rpx;
  552. line-height: 156%;
  553. font-weight: 500;
  554. height: 65%;
  555. }
  556. /deep/.uni-searchbar__box {
  557. border-color: #267CFF !important;
  558. border-width: 2rpx !important;
  559. }
  560. /deep/.uni-searchbar__box {
  561. background-color: #FFFFFF !important;
  562. }
  563. /deep/.uni-searchbar__text-placeholder {
  564. font-size: 30rpx !important;
  565. }
  566. /deep/.segmented-control__text {
  567. font-size: 34rpx !important;
  568. }
  569. /deep/.uni-data-checklist {
  570. padding-left: 20upx;
  571. }
  572. uni-picker {
  573. position: relative;
  574. display: block;
  575. cursor: pointer;
  576. padding-left: 20rpx !important;
  577. // padding-top: 14rpx !important;
  578. // color: grey !important;
  579. }
  580. /deep/.uni-date-x--border {
  581. border: 0px solid #dcdfe6 !important;
  582. }
  583. /deep/.is-input-border {
  584. border: 0px solid #c8c7cc !important;
  585. }
  586. /deep/.uni-progress-info {
  587. font-size: 25rpx !important;
  588. }
  589. /deep/.uni-error-message {
  590. position: absolute;
  591. bottom: -20rpx !important;
  592. left: 20rpx !important;
  593. text-align: left;
  594. }
  595. /deep/.uni-forms-item__inner {
  596. padding-bottom: 0rpx !important;
  597. margin-bottom: 30rpx !important;
  598. border-bottom: 0.5rpx solid #CCCCCC;
  599. }
  600. /deep/.uni-group__title {
  601. background-color: #FFFFFF !important;
  602. }
  603. /deep/.uni-list-item__content-title {
  604. font-size: 30rpx !important;
  605. color: #111111 !important;
  606. }
  607. /deep/.uni-progress-bar {
  608. border-radius: 10rpx !important;
  609. }
  610. /deep/.uni-progress-inner-bar {
  611. border-radius: 10rpx !important;
  612. }
  613. /deep/.is-input-border {
  614. border-radius: 20px !important;
  615. background-color: #fff;
  616. }
  617. .uni-easyinput__content-input {
  618. font-size: 30upx !important;
  619. }
  620. .content-clear-icon {
  621. font-size: 40upx !important;
  622. }
  623. /deep/.input-box {
  624. padding: 50upx;
  625. font-size: 30upx;
  626. .input-item {
  627. display: flex;
  628. border: 1upx solid #F8F8F8;
  629. line-height: 90upx;
  630. height: 90upx;
  631. margin-top: 20upx;
  632. background: #F8F8F8;
  633. border-radius: 48upx;
  634. .input-label {
  635. width: 150upx;
  636. text-align: center;
  637. }
  638. .input-body {
  639. position: relative;
  640. height: 100upx;
  641. width: calc(100% - 150upx);
  642. .input {
  643. line-height: 90upx;
  644. height: 90upx;
  645. position: relative;
  646. font-size: 28upx;
  647. }
  648. .eye {
  649. position: absolute;
  650. height: 50upx;
  651. width: 50upx;
  652. right: 20upx;
  653. top: 50%;
  654. transform: translateY(-50%);
  655. }
  656. .btn-code {
  657. position: absolute;
  658. right: 0upx;
  659. top: 50%;
  660. transform: translateY(-50%);
  661. background: none;
  662. color: #205592;
  663. width: 160upx;
  664. font-size: 24upx;
  665. box-sizing: border-box;
  666. text-align: center;
  667. padding: 0;
  668. height: 100upx;
  669. line-height: 100upx;
  670. }
  671. }
  672. }
  673. .select {
  674. // padding-top: 40upx;
  675. display: flex;
  676. justify-content: space-between;
  677. color: #003B67;
  678. }
  679. }
  680. /deep/.title-left {
  681. width: 3px;
  682. height: 16px;
  683. background: #267CFF;
  684. display: inline-block;
  685. border-radius: 3px;
  686. margin-top: 3px;
  687. vertical-align: top;
  688. margin-right: 10px;
  689. }
  690. </style>