addressinfo_body.html 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <!DOCTYPE html>
  2. <html class="">
  3. <!--STATUS OK-->
  4. <head>
  5. <meta name="referrer" content="always" />
  6. <meta charset='utf-8' />
  7. <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
  8. <meta http-equiv="x-dns-prefetch-control" content="on">
  9. <meta name="description" content="">
  10. <meta name="format-detection" content="telephone=no" />
  11. <link rel="stylesheet" type="text/css" href="css/vant-ui.css" />
  12. <link rel="stylesheet" type="text/css" href="css/iconfont.css">
  13. <link rel="stylesheet" type="text/css" href="css/main.css" />
  14. <script src="js/vue.js"></script>
  15. <script src="js/vant-ui.js"></script>
  16. <script src="js/main.js"></script>
  17. <title></title>
  18. </head>
  19. <style>
  20. </style>
  21. <body>
  22. <div id="app" v-cloak>
  23. <div class="login">
  24. <div class="shouhuodizhiBox">
  25. <div class="addressTitle flex a-center">
  26. <div class="icon"></div>
  27. 联系人
  28. </div>
  29. <input type="text" placeholder="" v-model="contactsName">
  30. <div class="addressTitle flex a-center">
  31. <div class="icon i2"></div>
  32. 联系电话
  33. </div>
  34. <input type="text" placeholder="" v-model="contactsTel">
  35. <div v-on:click="chooseAddress">
  36. <div class="addressTitle flex a-center">
  37. <div class="icon i3"></div>
  38. 选择地区
  39. <i class="iconfont icon-right"></i>
  40. </div>
  41. <input type="text" placeholder="" disabled="disabled" v-model="level">
  42. </div>
  43. <div class="addressTitle flex a-center">
  44. <div class="icon i3"></div>
  45. 详细地址
  46. </div>
  47. <input type="text" placeholder="" v-model="address">
  48. <div style="display:flex;justify-content:space-between;font-size:.24rem;margin:.2rem 0;display:flex;align-items:center">
  49. <div style="display:flex;align-items:center">
  50. <div class="icon i3"></div>
  51. 默认地址
  52. </div>
  53. <van-switch v-model="checked" size=".5rem" active-value="1" inactive-value="0"/>
  54. </div>
  55. </div>
  56. <div class="addressFooter flex a-center j-center" v-on:click="addAddress">确认提交</div>
  57. </div>
  58. </div>
  59. </body>
  60. <link rel="stylesheet" href="./mescroll/mescroll.min.css">
  61. <script type="text/javascript" src="./js/qrcode.min.js"></script>
  62. <script type="text/javascript" src="../script/aui-scroll.js"></script>
  63. <script type="text/javascript" src="./mescroll/mescroll.min.js"></script>
  64. <script type="text/javascript" src="../script/api.js"></script>
  65. <script type="text/javascript" src="../script/httpRequest.js"></script>
  66. <script type="text/javascript" src="../script/vue_plugins.js"></script>
  67. <script type="text/javascript">
  68. apiready = function() {
  69. var type = api.pageParam.type;
  70. new Vue({
  71. el: '#app',
  72. data: {
  73. pas: '',
  74. type: type,
  75. file: 'widget://res/city.json',
  76. level: '',
  77. checked: 0,
  78. address: "",
  79. contactsTel: "",
  80. contactsName: ""
  81. },
  82. methods: {
  83. init: function() {
  84. this.UIActionSelector = api.require("UIActionSelector");
  85. this.storeId = $api.getStorage('userid');
  86. },
  87. chooseAddress: function() {
  88. var _this = this;
  89. this.chooseRegion(this.UIActionSelector, 3, this.file, function(ret) {
  90. _this.level = ret.level1 + '-' + ret.level2 + '-' + ret.level3;
  91. _this.level1 = ret.level1;
  92. _this.level2 = ret.level2;
  93. _this.level3 = ret.level3;
  94. })
  95. },
  96. // 添加地址
  97. addAddress: function() {
  98. if (this.contactsName == '') {
  99. api.toast({
  100. msg: '请完善联系人'
  101. });
  102. return;
  103. }
  104. if (this.contactsTel == '') {
  105. api.toast({
  106. msg: '请完善联系电话'
  107. });
  108. return;
  109. }
  110. if (!(/^1[3456789]\d{9}$/.test(this.contactsTel))) {
  111. api.toast({
  112. msg: '联系手机号格式有误'
  113. });
  114. return;
  115. }
  116. if (this.level1 == ''||this.level2 == ''||this.level3 == '') {
  117. api.toast({
  118. msg: '请完善选择地区'
  119. });
  120. return;
  121. }
  122. if (this.address == '') {
  123. api.toast({
  124. msg: '请完善详细地址'
  125. });
  126. return;
  127. }
  128. var params = {
  129. "storeId":this.storeId,
  130. "province":this.level1,
  131. "city":this.level2,
  132. "county" :this.level3,
  133. "street" :null,
  134. "contactsName":this.contactsName,
  135. "contactsTel":this.contactsTel,
  136. "address":this.address,
  137. "addressType":"1",
  138. "beDefault":this.checked,
  139. "url": 'json',
  140. "type": 'body'
  141. },
  142. _this = this;
  143. this.$post('addAddressU', params, function(ret) {
  144. if (ret.code == 0 || ret.code == '0') {
  145. api.toast({
  146. msg: '成功提交'
  147. });
  148. setTimeout(function() {
  149. _this.closeWin();
  150. }, 500)
  151. api.sendEvent({
  152. name: 'refreshaddress',
  153. extra: {}
  154. });
  155. }
  156. });
  157. }
  158. },
  159. filters: {
  160. },
  161. mounted: function() {
  162. this.init();
  163. }
  164. })
  165. }
  166. </script>
  167. </html>