personinfo.vue 17 KB

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