addressSet.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. <template>
  2. <view class="page">
  3. <view class="list_info">
  4. <view class="name">收件人:</view>
  5. <view class="item">
  6. <input type="text" class="input" placeholder="请输入收件人姓名" v-model="info.realname" maxlength="10" />
  7. </view>
  8. <view class="name">联系方式:</view>
  9. <view class="item">
  10. <input type="text" class="input" placeholder="请输入联系方式" v-model="info.mobile" maxlength="11" />
  11. </view>
  12. <view class="name">所在地区:</view>
  13. <view class="item" @click="SelAddrArea">
  14. <input type="text" class="input" placeholder="请选择所在地区" v-model="info.area" disabled="true" />
  15. <image class="arrow" src="../../static/me/arrow_right_gray.png" mode="widthFix" />
  16. </view>
  17. <view class="name">详细地址:</view>
  18. <view class="item">
  19. <input type="text" class="input" placeholder="请输入详细地址" v-model="info.address" maxlength="30" />
  20. </view>
  21. <view class="blankHeight"></view>
  22. </view>
  23. <view class="btn_submit" @click="submitData">提交</view>
  24. <cityPicker :column="column" :default-value="defaultValue" :mask-close-able="maskCloseAble" @confirm="confirm"
  25. @cancel="cancel" :visible="visible" />
  26. </view>
  27. </template>
  28. <script>
  29. import cityPicker from '@/uni_modules/piaoyi-cityPicker/components/piaoyi-cityPicker/piaoyi-cityPicker'
  30. export default {
  31. components: {
  32. cityPicker
  33. },
  34. data() {
  35. return {
  36. title: '',
  37. sel: 1,
  38. info: {},
  39. area: '',
  40. realname: '',
  41. mobile: '',
  42. address: '',
  43. visible: false,
  44. maskCloseAble: true,
  45. str: '',
  46. defaultValue: '',
  47. // defaultValue: ['河北省','唐山市','丰南区'],
  48. column: 3
  49. }
  50. },
  51. onLoad() {},
  52. onShow() {
  53. this.getInfo();
  54. },
  55. methods: {
  56. onBack() {},
  57. chkSel() {
  58. if (this.sel == 1) {
  59. this.sel = 0;
  60. } else {
  61. this.sel = 1;
  62. }
  63. },
  64. SelAddrArea() {
  65. this.visible = true
  66. },
  67. confirm(val) {
  68. console.log(val)
  69. this.info.area = val.name; //JSON.stringify(val)
  70. this.visible = false
  71. },
  72. cancel() {
  73. this.visible = false
  74. },
  75. getInfo() {
  76. uni.request({
  77. url: this.$apiHost + '/Address/getinfo', //仅为示例,并非真实接口地址。
  78. data: {
  79. uuid: getApp().globalData.uuid
  80. },
  81. header: {
  82. 'content-type': 'application/json' //自定义请求头信息
  83. },
  84. success: (res) => {
  85. console.log("----", res.data);
  86. this.info = res.data.info;
  87. }
  88. });
  89. },
  90. submitData() {
  91. if (this.info.realname == "") {
  92. uni.showToast({
  93. title: "请输入收件人",
  94. icon: 'none'
  95. });
  96. return;
  97. }
  98. if (this.info.mobile == "") {
  99. uni.showToast({
  100. title: "请输入联系电话",
  101. icon: 'none'
  102. });
  103. return;
  104. }
  105. if (this.info.address == "") {
  106. uni.showToast({
  107. title: "请输入地址",
  108. icon: 'none'
  109. });
  110. return;
  111. }
  112. uni.request({
  113. url: this.$apiHost + '/Address/submitaddress', //仅为示例,并非真实接口地址。
  114. data: {
  115. uuid: getApp().globalData.uuid,
  116. realname: this.info.realname,
  117. mobile: this.info.mobile,
  118. area: this.info.area,
  119. address: this.info.address,
  120. },
  121. header: {
  122. 'content-type': 'application/json' //自定义请求头信息
  123. },
  124. success: (res) => {
  125. console.log("----", res.data);
  126. uni.showToast({
  127. title: res.data.str,
  128. icon: 'none'
  129. });
  130. if (res.data.success == "yes") {
  131. }
  132. }
  133. });
  134. },
  135. }
  136. }
  137. </script>
  138. <style scoped lang="scss">
  139. @import 'normal.scss';
  140. </style>