personinfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  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. await this.getlist()
  147. this.getlist1()
  148. },
  149. methods: {
  150. // 信息表
  151. getlist() {
  152. return this.$https.get('/youngee/c/g/get-info-tables')
  153. .then(res => {
  154. console.log(res)
  155. this.array = res.data.data.AgeBracket
  156. })
  157. },
  158. // 达人详细信息表
  159. getlist1() {
  160. return this.$https.get('/youngee/c/t/g/get-talent-info')
  161. .then(res => {
  162. console.log(res)
  163. if (res.data.data.talent_wx_number !== null) {
  164. if (res.data.data.talent_age_bracket !== 0) {
  165. for (var i = 0; i < this.array.length; i++) {
  166. if (this.array[i].age_aid == res.data.data.talent_age_bracket) {
  167. this.Xage = this.array[i].age_bracket_discribe
  168. }
  169. this.formData.age = res.data.data.talent_age_bracket
  170. }
  171. }
  172. if (res.data.data.talent_nationality !== 0) {
  173. this.index1 = res.data.data.talent_nationality
  174. this.formData.nationality = res.data.data.talent_nationality
  175. }
  176. if (res.data.data.visit_store_region !== 0) {
  177. let a = res.data.data.visit_store_region.toString().slice(0, 2)
  178. let b = res.data.data.visit_store_region.toString().slice(0, 4)
  179. let c = 0
  180. for (var i = 0; i < region.length; i++) {
  181. if (region[i].code == a) {
  182. a = region[i].name
  183. for (var j = 0; j < region[i].children.length; j++) {
  184. if (region[i].children[j].code == b) {
  185. b = region[i].children[j].name
  186. for (var o = 0; o < region[i].children[j].children
  187. .length; o++) {
  188. if (region[i].children[j].children[o].code == res.data.data
  189. .visit_store_region) {
  190. c = region[i].children[j].children[o].name
  191. }
  192. }
  193. }
  194. }
  195. }
  196. }
  197. this.regionStr = a + ' ' + b + ' ' + c
  198. this.formData.visitStoreRegion = res.data.data.visit_store_region
  199. }
  200. this.formData.phone = res.data.data.talent_phone_number
  201. }
  202. })
  203. },
  204. // 年龄选择的
  205. bindPickerChange: function(e) {
  206. this.index = e.detail.value;
  207. this.formData.age = this.array[this.index].age_aid
  208. this.Xage = this.array[this.index].age_bracket_discribe
  209. console.log(this.formData.age)
  210. },
  211. //国籍选择
  212. bindPickerChange1: function(e) {
  213. console.log(e)
  214. this.index1 = e.detail.value;
  215. this.formData.nationality = this.array1[this.index1].id
  216. console.log(this.formData.nationality)
  217. },
  218. /**
  219. * 手动提交
  220. * @param {Object} form
  221. */
  222. submitForm(form) {
  223. this.$refs[form]
  224. .submit()
  225. .then(res => {
  226. const iphoneReg1 = /^1[0-9]{10}$/
  227. if (!iphoneReg1.test(this.formData.phone)) {
  228. uni.showToast({
  229. title: '电话号码格式不正确',
  230. icon: 'none'
  231. })
  232. return
  233. }
  234. this.$https.post('/youngee/c/t/p/talent-info', {
  235. talent_age_bracket: this.formData.age,
  236. talent_nationality: this.formData.nationality,
  237. visit_store_region: this.formData.visitStoreRegion,
  238. talent_phone_number: this.formData.phone,
  239. })
  240. .then(res => {
  241. if (res.data.code == 0) {
  242. console.log(res)
  243. uni.navigateTo({
  244. url: './mylocation'
  245. });
  246. } else {
  247. uni.showToast({
  248. title: res.data.msg,
  249. icon: 'none',
  250. duration: 2000
  251. });
  252. }
  253. })
  254. })
  255. .catch(errors => {
  256. console.error('验证失败:', errors)
  257. uni.showToast({
  258. title: '请填写所有信息',
  259. icon: 'none'
  260. })
  261. })
  262. },
  263. //城市选择
  264. pickerChange(e) {
  265. // console.log(e, '1');
  266. this.regionIndex = e.detail.value;
  267. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[
  268. 1]]
  269. .name + ' ' +
  270. this.region[2][this.regionIndex[2]].name;
  271. // 组件传值
  272. this.$emit('region', [this.region[0][this.regionIndex[0]].code, this.region[1][this.regionIndex[1]]
  273. .code,
  274. this.region[
  275. 2][this.regionIndex[2]].code
  276. ]);
  277. this.formData.visitStoreRegion = this.region[2][this.regionIndex[2]].code;
  278. },
  279. pickerColumnchange(e) {
  280. // console.log(e);
  281. // 第几列滑动
  282. // console.log(e.detail.column);
  283. // 第几列滑动的下标
  284. // console.log(e.detail.value)
  285. if (e.detail.column === 0) {
  286. // 声明城市数组
  287. let cityArr = [];
  288. let countyArr = [];
  289. // 设置下标
  290. this.regionIndex = [e.detail.value, 0, 0];
  291. // 改变城市列表
  292. this.region[1] = this.oldRegion[e.detail.value].children.map(item => {
  293. cityArr.push({
  294. name: item.name,
  295. code: item.code
  296. });
  297. })
  298. this.$set(this.region, 1, cityArr);
  299. // 改变县区列表
  300. this.oldRegion[e.detail.value].children[0].children.map(item => {
  301. countyArr.push({
  302. name: item.name,
  303. code: item.code
  304. });
  305. })
  306. this.$set(this.region, 2, countyArr);
  307. }
  308. if (e.detail.column === 1) {
  309. this.regionIndex[1] = e.detail.value;
  310. this.regionIndex[2] = 0;
  311. let countyArr = [];
  312. this.oldRegion[this.regionIndex[0]].children[this.regionIndex[1]].children.map(item => {
  313. countyArr.push({
  314. name: item.name,
  315. code: item.code
  316. });
  317. })
  318. this.$set(this.region, 2, countyArr);
  319. }
  320. if (e.detail.column === 2) {
  321. this.regionIndex[2] = e.detail.value;
  322. }
  323. }
  324. },
  325. created() {
  326. let provinceArr = [];
  327. let cityArr = [];
  328. this.oldRegion.map((item, index) => {
  329. this.region[0].push({
  330. name: item.name,
  331. code: item.code
  332. });
  333. if (this.previnceId == item.code) {
  334. provinceArr = item.children;
  335. this.regionIndex[0] = index;
  336. }
  337. })
  338. // console.log(provinceArr);
  339. provinceArr.map((item, index) => {
  340. this.region[1].push({
  341. name: item.name,
  342. code: item.code
  343. });
  344. if (this.cityId == item.code) {
  345. cityArr = item.children;
  346. this.regionIndex[1] = index;
  347. }
  348. })
  349. cityArr.map((item, index) => {
  350. this.region[2].push({
  351. name: item.name,
  352. code: item.code
  353. });
  354. if (this.countyId == item.code) {
  355. this.regionIndex[2] = index;
  356. }
  357. })
  358. if (this.isRevise) {
  359. this.regionStr = this.region[0][this.regionIndex[0]].name + ' ' + this.region[1][this.regionIndex[
  360. 1]]
  361. .name + ' ' +
  362. this.region[2][this.regionIndex[2]].name;
  363. } else {
  364. this.regionStr = '请选择省市区';
  365. }
  366. }
  367. };
  368. </script>
  369. <style>
  370. picker {
  371. position: relative;
  372. display: block;
  373. cursor: pointer;
  374. padding-left: 20rpx !important;
  375. padding-top: 20rpx !important;
  376. color: grey !important;
  377. }
  378. /deep/.uni-forms-item__inner {
  379. border-bottom: none !important;
  380. margin-bottom: 0 !important;
  381. }
  382. </style>
  383. <style lang="scss" scoped>
  384. @charset "UTF-8";
  385. /* 头条小程序组件内不能引入字体 */
  386. /* #ifdef MP-TOUTIAO */
  387. @font-face {
  388. font-family: uniicons;
  389. font-weight: normal;
  390. font-style: normal;
  391. src: url("~@/static/uni.ttf") format("truetype");
  392. }
  393. /* #endif */
  394. /* #ifndef APP-NVUE */
  395. page {
  396. display: flex;
  397. flex-direction: column;
  398. box-sizing: border-box;
  399. background-color: #FFFFFF;
  400. min-height: 100%;
  401. height: auto;
  402. }
  403. view {
  404. font-size: 14px;
  405. // line-height: inherit;
  406. }
  407. .menu {
  408. position: fixed;
  409. top: 180rpx;
  410. background-color: #FFFFFF;
  411. justify-content: space-around;
  412. height: 80rpx;
  413. // height: 5%;
  414. width: 100%;
  415. display: flex;
  416. z-index: 10;
  417. margin-bottom: 10rpx;
  418. }
  419. .menu-item p {
  420. font-weight: 600;
  421. &.lor {
  422. border-bottom: 5rpx solid #F0D232;
  423. color: #F0D232;
  424. padding-bottom: 15rpx;
  425. }
  426. }
  427. .btn1 {
  428. margin: 30rpx;
  429. font-size: 35rpx;
  430. color: #000;
  431. background-color: #F0D232;
  432. border: none;
  433. border-radius: 0;
  434. }
  435. .uni-input-border,
  436. .uni-textarea-border {
  437. flex: 1;
  438. font-size: 14px;
  439. color: #666;
  440. border: 1px #FFFFFF solid;
  441. border-radius: 5px;
  442. /* #ifndef APP-NVUE */
  443. box-sizing: border-box;
  444. /* #endif */
  445. }
  446. .uni-input-border {
  447. padding: 0 10px;
  448. height: 35px;
  449. }
  450. .uni-textarea-border {
  451. padding: 10px;
  452. height: 80px;
  453. }
  454. .label-box {
  455. margin-right: 10px;
  456. }
  457. .transform-scale {
  458. transform: scale(0.7);
  459. }
  460. .butto {
  461. text-align: center;
  462. }
  463. .option {
  464. padding: 20rpx;
  465. }
  466. .uni-margin-wrap {
  467. width: 690rpx;
  468. width: 100%;
  469. ;
  470. }
  471. .swiper {
  472. height: 300rpx;
  473. }
  474. .swiper-item {
  475. display: block;
  476. height: 300rpx;
  477. line-height: 300rpx;
  478. text-align: center;
  479. }
  480. .swiper-list {
  481. margin-top: 40rpx;
  482. margin-bottom: 0;
  483. }
  484. .uni-common-mt {
  485. margin-top: 60rpx;
  486. position: relative;
  487. }
  488. .info {
  489. position: absolute;
  490. right: 20rpx;
  491. }
  492. .uni-padding-wrap {
  493. width: 550rpx;
  494. padding: 0 100rpx;
  495. }
  496. .signup {
  497. box-shadow: 0rpx 5rpx 40rpx #ccc;
  498. width: 100%;
  499. position: fixed;
  500. bottom: 0rpx;
  501. display: flex;
  502. height: 90rpx;
  503. padding-top: 2%;
  504. background-color: #FFFFFF;
  505. justify-content: space-around;
  506. }
  507. .signuptext {
  508. text-align: center;
  509. margin-top: 2%;
  510. }
  511. .signuptext p {
  512. font-size: 60%;
  513. color: #333333;
  514. }
  515. .signupbut {
  516. text-align: center;
  517. margin-top: 2%;
  518. }
  519. .but1 {
  520. width: 120%;
  521. text-align: center;
  522. background-color: #FCCF41;
  523. border-radius: 10rpx;
  524. color: #464100;
  525. font-size: 28rpx;
  526. line-height: 156%;
  527. font-weight: 500;
  528. height: 65%;
  529. }
  530. /deep/.uni-searchbar__box {
  531. border-color: #267CFF !important;
  532. border-width: 2rpx !important;
  533. }
  534. /deep/.uni-searchbar__box {
  535. background-color: #FFFFFF !important;
  536. }
  537. /deep/.uni-searchbar__text-placeholder {
  538. font-size: 30rpx !important;
  539. }
  540. /deep/.segmented-control__text {
  541. font-size: 34rpx !important;
  542. }
  543. /deep/.uni-data-checklist {
  544. padding-left: 20upx;
  545. }
  546. uni-picker {
  547. position: relative;
  548. display: block;
  549. cursor: pointer;
  550. padding-left: 20rpx !important;
  551. padding-top: 14rpx !important;
  552. color: grey !important;
  553. }
  554. /deep/.uni-date-x--border {
  555. border: 0px solid #dcdfe6 !important;
  556. }
  557. /deep/.is-input-border {
  558. border: 0px solid #c8c7cc !important;
  559. }
  560. /deep/.uni-progress-info {
  561. font-size: 25rpx !important;
  562. }
  563. /deep/.uni-error-message {
  564. position: absolute;
  565. bottom: -20rpx !important;
  566. left: 20rpx !important;
  567. text-align: left;
  568. }
  569. /deep/.uni-forms-item__inner {
  570. padding-bottom: 0rpx !important;
  571. margin-bottom: 30rpx !important;
  572. border-bottom: 0.5rpx solid #CCCCCC;
  573. }
  574. /deep/.uni-group__title {
  575. background-color: #FFFFFF !important;
  576. }
  577. /deep/.uni-list-item__content-title {
  578. font-size: 30rpx !important;
  579. color: #111111 !important;
  580. }
  581. /deep/.uni-progress-bar {
  582. border-radius: 10rpx !important;
  583. }
  584. /deep/.uni-progress-inner-bar {
  585. border-radius: 10rpx !important;
  586. }
  587. /deep/.is-input-border {
  588. border-radius: 20px !important;
  589. background-color: #fff;
  590. }
  591. .uni-easyinput__content-input {
  592. font-size: 30upx !important;
  593. }
  594. .content-clear-icon {
  595. font-size: 40upx !important;
  596. }
  597. /deep/.input-box {
  598. padding: 50upx;
  599. font-size: 30upx;
  600. .input-item {
  601. display: flex;
  602. border: 1upx solid #F8F8F8;
  603. line-height: 90upx;
  604. height: 90upx;
  605. margin-top: 20upx;
  606. background: #F8F8F8;
  607. border-radius: 48upx;
  608. .input-label {
  609. width: 150upx;
  610. text-align: center;
  611. }
  612. .input-body {
  613. position: relative;
  614. height: 100upx;
  615. width: calc(100% - 150upx);
  616. .input {
  617. line-height: 90upx;
  618. height: 90upx;
  619. position: relative;
  620. font-size: 28upx;
  621. }
  622. .eye {
  623. position: absolute;
  624. height: 50upx;
  625. width: 50upx;
  626. right: 20upx;
  627. top: 50%;
  628. transform: translateY(-50%);
  629. }
  630. .btn-code {
  631. position: absolute;
  632. right: 0upx;
  633. top: 50%;
  634. transform: translateY(-50%);
  635. background: none;
  636. color: #205592;
  637. width: 160upx;
  638. font-size: 24upx;
  639. box-sizing: border-box;
  640. text-align: center;
  641. padding: 0;
  642. height: 100upx;
  643. line-height: 100upx;
  644. }
  645. }
  646. }
  647. .select {
  648. // padding-top: 40upx;
  649. display: flex;
  650. justify-content: space-between;
  651. color: #003B67;
  652. }
  653. }
  654. /deep/.title-left {
  655. width: 3px;
  656. height: 16px;
  657. background: #267CFF;
  658. display: inline-block;
  659. border-radius: 3px;
  660. margin-top: 3px;
  661. vertical-align: top;
  662. margin-right: 10px;
  663. }
  664. </style>