areaCode.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="select-box">
  3. <u-popup v-model="areacodeShow" mode="bottom" @close="cancel">
  4. <view class="box" style="color: #333333; font-size: 28rpxrpx">请选择您的国际区号</view>
  5. <view class="box" v-for="item in mobileAreaCode" :key="item.code" style="color: #2c83ff" @click="areacode(item.code)">{{ item.name }}</view>
  6. <view class="box box-bottom" style="color: #a9afb8" @click="cancel">取消</view>
  7. </u-popup>
  8. </view>
  9. </template>
  10. <script>
  11. import { User } from "@/config/api.js";
  12. import { MobileAreaCode } from "@/utils/mobileCode";
  13. export default {
  14. computed: {
  15. mobileAreaCode() {
  16. return MobileAreaCode;
  17. },
  18. },
  19. watch: {
  20. isAreaCode() {
  21. this.areacodeShow = this.isAreaCode;
  22. },
  23. typesignup() {
  24. this.signupType = this.typesignup;
  25. },
  26. },
  27. data() {
  28. return {
  29. areacodeShow: false,
  30. };
  31. },
  32. props: {
  33. isAreaCode: {
  34. type: Boolean,
  35. default: false,
  36. },
  37. areaCode: {
  38. type: Object,
  39. },
  40. },
  41. methods: {
  42. areacode(num) {
  43. User.countryCcodeAdd({
  44. CountryCode: num,
  45. }).then((res) => {
  46. if (res.Ret == 200) {
  47. this.areacodeShow = false;
  48. this.$parent.isAreaCode = false;
  49. this.$parent.signupAdd(this.areaCode.id, this.areaCode.type);
  50. }
  51. });
  52. },
  53. cancel() {
  54. this.areacodeShow = false;
  55. this.$parent.isAreaCode = false;
  56. },
  57. },
  58. };
  59. </script>
  60. <style scoped lang="scss">
  61. .select-box {
  62. width: 100%;
  63. .box {
  64. height: 95prx;
  65. line-height: 95rpx;
  66. text-align: center;
  67. font-size: 32rpx;
  68. border-bottom: 1rpx solid #ebebeb;
  69. }
  70. .box-bottom {
  71. border-bottom: none !important;
  72. }
  73. }
  74. </style>