personinfo.vue 15 KB

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