Authored by 郭成尧

show-close

@@ -31,6 +31,6 @@ @@ -31,6 +31,6 @@
31 </div> 31 </div>
32 </div> 32 </div>
33 33
34 -<div id="app">  
35 - <app></app> 34 +<div id="vAddressAct">
  35 + <vue-address-act></vue-address-act>
36 </div> 36 </div>
@@ -22,6 +22,16 @@ var $addressForm = $('.edit-address'), @@ -22,6 +22,16 @@ var $addressForm = $('.edit-address'),
22 currentPage = 'edit', 22 currentPage = 'edit',
23 newArea = []; 23 newArea = [];
24 24
  25 +var Vue = require('vue');
  26 +var vueAddressAct = require('home/address/address-act.vue');
  27 +
  28 +var addressVact = new Vue({
  29 + el: '#vAddressAct',
  30 + components: {
  31 + vueAddressAct: vueAddressAct
  32 + }
  33 +});
  34 +
25 require('../common.js'); 35 require('../common.js');
26 36
27 $($editAddressPage, $addressListPage).css('min-height', function() { 37 $($editAddressPage, $addressListPage).css('min-height', function() {
@@ -81,7 +91,7 @@ $addressForm.on('submit', function() { @@ -81,7 +91,7 @@ $addressForm.on('submit', function() {
81 isSubmiting = true; 91 isSubmiting = true;
82 loading.showLoadingMask(); 92 loading.showLoadingMask();
83 $submit.css('background', '#777'); 93 $submit.css('background', '#777');
84 - console.log(window.queryString.refer); 94 +
85 $.ajax({ 95 $.ajax({
86 method: 'POST', 96 method: 'POST',
87 url: '/home/saveAddress', 97 url: '/home/saveAddress',
@@ -132,10 +142,7 @@ function bindAddressListEvent(html) { @@ -132,10 +142,7 @@ function bindAddressListEvent(html) {
132 142
133 // 省市区 143 // 省市区
134 $area.on('touchend', function() { 144 $area.on('touchend', function() {
135 - $editAddressPage.hide();  
136 - $addressListPage.show();  
137 - currentPage = 'list';  
138 - $navTitle.html('地区选择'); 145 + addressVact.$children[0].show = true;
139 }); 146 });
140 147
141 // touchend 在下滑的时候会触发 148 // touchend 在下滑的时候会触发
@@ -191,16 +198,7 @@ function bindAddressListEvent(html) { @@ -191,16 +198,7 @@ function bindAddressListEvent(html) {
191 }); 198 });
192 } 199 }
193 200
194 -// 读取省市区列表缓存  
195 -// if (window.localStorage && window.localStorage.getItem) {  
196 -// chinaAddressList = window.localStorage.getItem('chinaAddressList');  
197 -// }  
198 -  
199 -// if (chinaAddressList) {  
200 -// bindAddressListEvent(chinaAddressList);  
201 -// } else {  
202 -  
203 - // 省市区列表异步加载 201 +// 省市区列表异步加载
204 $.ajax({ 202 $.ajax({
205 method: 'GET', 203 method: 'GET',
206 url: '/home/locationList', 204 url: '/home/locationList',
@@ -208,22 +206,6 @@ $.ajax({ @@ -208,22 +206,6 @@ $.ajax({
208 cache: true 206 cache: true
209 }).then(function(html) { 207 }).then(function(html) {
210 bindAddressListEvent(html); 208 bindAddressListEvent(html);
211 -  
212 - // if (window.localStorage && window.localStorage.setItem) {  
213 - // window.localStorage.setItem('chinaAddressList', html);  
214 - // }  
215 }).fail(function() { 209 }).fail(function() {
216 tip.show('获取省市区列表失败'); 210 tip.show('获取省市区列表失败');
217 }); 211 });
218 -  
219 -// }  
220 -var Vue = require('vue');  
221 -  
222 -var app = require('home/address/address-act.vue');  
223 -  
224 -new Vue({  
225 - el: '#app',  
226 - components: {  
227 - app: app  
228 - }  
229 -});  
1 <template> 1 <template>
2 - <div class="address-select-component"> 2 + <div class="address-select-component" v-show="show">
3 <div class="address-select-box"> 3 <div class="address-select-box">
4 - <div class="component-title"><span class="title">所在地区</span><span class="iconfont close">X</span></div> 4 + <div class="component-title"><span class="title">所在地区</span><span class="iconfont close" @click="closeAddBox">X</span></div>
5 <ul class="head-address-ul"> 5 <ul class="head-address-ul">
6 <li class="head-address-li">请选择</li> 6 <li class="head-address-li">请选择</li>
7 <li></li> 7 <li></li>
@@ -135,22 +135,22 @@ @@ -135,22 +135,22 @@
135 </style> 135 </style>
136 <script> 136 <script>
137 require('../../../scss/home/_address.css'); 137 require('../../../scss/home/_address.css');
138 - let headerComponent = require('common/header.vue');  
139 138
140 module.exports = { 139 module.exports = {
141 data() { 140 data() {
142 return { 141 return {
143 - addresses:[] 142 + addresses:[],
  143 + show: false
144 }; 144 };
145 }, 145 },
146 - components: {  
147 - headerComponent  
148 - },  
149 methods: { 146 methods: {
150 selectProvince() { 147 selectProvince() {
151 $.get('/home/getaddress.json', resultData => { 148 $.get('/home/getaddress.json', resultData => {
152 this.addresses = resultData; 149 this.addresses = resultData;
153 }); 150 });
  151 + },
  152 + closeAddBox() {
  153 + this.show = false;
154 } 154 }
155 }, 155 },
156 created: function() { 156 created: function() {