personinfo.vue 18 KB

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