金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

224 lines
5.7 KiB

  1. <template>
  2. <view>
  3. <lf-nav :spreadOut="true" :showIcon="true" bgColor="#F8F8F8" title="会员资料"></lf-nav>
  4. <view class="lf-font-26 lf-color-primary lf-p-30 lf-row-center">
  5. 尊敬的会员完善资料可以让我们为您提供更贴切的服务
  6. </view>
  7. <view class="lf-p-l-32 lf-p-r-32">
  8. <view class="set-tag lf-border-bottom">
  9. <view class="lf-font-28 lf-color-black">
  10. *姓名
  11. </view>
  12. <view class="lf-flex">
  13. <input type="text" class="edit-input" v-model="info.name" placeholder="请输入姓名" />
  14. </view>
  15. </view>
  16. </view>
  17. <view class="lf-p-l-32 lf-p-r-32">
  18. <view class="set-tag lf-border-bottom">
  19. <view class="lf-font-28 lf-color-black">
  20. 国籍
  21. </view>
  22. <view class="lf-flex">
  23. <input type="text" class="edit-input" v-model="info.native_place" placeholder="请输入你的国籍" />
  24. </view>
  25. </view>
  26. </view>
  27. <view class="lf-p-l-32 lf-p-r-32">
  28. <view class="set-tag lf-border-bottom">
  29. <view class="lf-font-28 lf-color-black">
  30. 性别
  31. </view>
  32. <view class="lf-flex">
  33. <input type="text" class="edit-input" :value="info.sex" :disabled="true" placeholder="未填写" />
  34. </view>
  35. </view>
  36. </view>
  37. <view class="lf-p-l-32 lf-p-r-32">
  38. <view class="set-tag lf-border-bottom">
  39. <view class="lf-font-28 lf-color-black">
  40. 出生日期
  41. </view>
  42. <view class="lf-flex">
  43. <input type="text" class="edit-input" :value="info.birthday" :disabled="true" placeholder="未填写" />
  44. </view>
  45. </view>
  46. </view>
  47. <view class="lf-p-l-32 lf-p-r-32">
  48. <view class="set-tag lf-border-bottom">
  49. <view class="lf-font-28 lf-color-black">
  50. 身份证号
  51. </view>
  52. <view class="lf-flex">
  53. <input type="text" class="edit-input" :value="info.id_number" :disabled="true" placeholder="未填写" />
  54. </view>
  55. </view>
  56. </view>
  57. <view class="lf-p-l-32 lf-p-r-32">
  58. <view class="set-tag lf-border-bottom">
  59. <view class="lf-font-28 lf-color-black">
  60. 通讯地址
  61. </view>
  62. <view class="lf-flex">
  63. <picker mode="region" :value="info.address" @change="addressChange" >
  64. <text class="address-picker">{{ info.address.join('') || '请选择' }}</text>
  65. </picker>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="lf-p-l-32 lf-p-r-32">
  70. <view class="set-tag lf-border-bottom">
  71. <view class="lf-font-28 lf-color-black"></view>
  72. <view class="lf-flex lf-w-100">
  73. <input type="text" class="edit-input lf-w-100" v-model="info.address_detail" placeholder="请输入您的详细地址" />
  74. </view>
  75. </view>
  76. </view>
  77. <view class="lf-p-l-32 lf-p-r-32">
  78. <view class="set-tag lf-border-bottom">
  79. <view class="lf-font-28 lf-color-black">
  80. 家庭地址
  81. </view>
  82. <view class="lf-flex">
  83. <input type="text" class="edit-input" v-model="info.home_address" placeholder="请输入您的家庭地址" />
  84. </view>
  85. </view>
  86. </view>
  87. <view class="lf-p-l-32 lf-p-r-32">
  88. <view class="set-tag lf-border-bottom">
  89. <view class="lf-font-28 lf-color-black">
  90. 学历
  91. </view>
  92. <view class="lf-flex">
  93. <input type="text" class="edit-input" v-model="info.education" placeholder="请输入您的学历" />
  94. </view>
  95. </view>
  96. </view>
  97. <view class="lf-font-26 lf-color-999 lf-p-30 lf-row-center">
  98. 温馨提示身份证号出生日期不支持线上修改如需修改请前往服务台办理
  99. </view>
  100. <button class="set-btn" hover-class="lf-opacity" @click="submit">保存</button>
  101. </view>
  102. </template>
  103. <script>
  104. export default {
  105. data() {
  106. return {
  107. info: {
  108. name: '',
  109. native_place: '',
  110. sex: '',
  111. birthday: '',
  112. id_number: '',
  113. address: [],
  114. address_detail: '',
  115. home_address: '',
  116. education: ''
  117. },
  118. token: ''
  119. }
  120. },
  121. onLoad(){
  122. var token = this.$cookieStorage.get('user_token');
  123. this.token = token;
  124. this.getMeInfo();
  125. },
  126. methods: {
  127. getMeInfo(){
  128. this.$http.get({
  129. api: 'api/me',
  130. header: {
  131. Authorization: this.token
  132. }
  133. }).then(res => {
  134. let detail = res.data.data;
  135. let info = this.info;
  136. info.name = detail.name;
  137. info.sex = detail.sex;
  138. info.birthday = detail.birthday;
  139. // todo 其他信息待补充...
  140. this.info = info;
  141. })
  142. },
  143. getValue(current, event){
  144. this[current +'_index'] = event.detail.value;
  145. },
  146. addressChange(event){
  147. this.info.address = event.detail.value;
  148. },
  149. submit(){
  150. console.log(this.info);
  151. uni.showLoading({
  152. title: '正在保存中'
  153. });
  154. // TODO 其他参数待传入对接
  155. this.$http.post({
  156. api: 'api/users/update/info',
  157. data: {
  158. name: this.info.name,
  159. // education: this.info.education
  160. },
  161. header: {
  162. Authorization: this.token,
  163. Accept: 'application/json'
  164. }
  165. }).then(res => {
  166. uni.hideLoading();
  167. this.$msg('保存成功', {icon: 'success'});
  168. }).catch(err => {
  169. uni.hideLoading();
  170. this.$msg('保存失败', {icon: 'error'});
  171. })
  172. }
  173. }
  174. }
  175. </script>
  176. <style scoped lang="scss">
  177. // .input{
  178. // width: 400rpx;
  179. // text-align: right;
  180. // }
  181. .picker-w{
  182. width: 400rpx;
  183. text-align: right;
  184. }
  185. .set-btn {
  186. width: 550rpx;
  187. height: 100rpx;
  188. background: #15716E;
  189. border-radius: 50rpx;
  190. margin: 40rpx auto;
  191. font-size: 32rpx;
  192. color: white;
  193. line-height: 100rpx;
  194. }
  195. .edit-input {
  196. text-align: right;
  197. font-size: 28rpx;
  198. color: #777;
  199. }
  200. .set-tag {
  201. height: 100rpx;
  202. width: 100%;
  203. display: flex;
  204. align-items: center;
  205. justify-content: space-between;
  206. // border-bottom: 1rpx solid rgba(0, 0, 0, 0.1);
  207. }
  208. .address-picker{
  209. font-size: 28rpx;
  210. color: #777777;
  211. display: inline-block;
  212. width: 400rpx;
  213. text-align: right;
  214. }
  215. /deep/.input-placeholder {
  216. font-size: 28rpx;
  217. color: #777;
  218. }
  219. </style>