Authored by 沈志敏

fix bug

@@ -5,7 +5,7 @@ @@ -5,7 +5,7 @@
5 v-touch:panstart="panstart(item.fav_id)" 5 v-touch:panstart="panstart(item.fav_id)"
6 v-touch:panmove="panmove(item.fav_id)" 6 v-touch:panmove="panmove(item.fav_id)"
7 v-touch:panend="panend(item.fav_id)" 7 v-touch:panend="panend(item.fav_id)"
8 - v-touch-options:pan="{direction:'horizontal'}"> 8 + v-touch-options:pan="{direction:'horizontal', threshold: 100}">
9 <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)"> 9 <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
10 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span> 10 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
11 </div> 11 </div>
@@ -136,25 +136,24 @@ @@ -136,25 +136,24 @@
136 }, 136 },
137 panstart(id) { 137 panstart(id) {
138 event.preventDefault(); 138 event.preventDefault();
139 - if (this.editmodel && this.pandata.id !== id) { 139 + if (this.pandata.id && this.pandata.id !== id) {
  140 + $('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
  141 + $('#del-' + this.pandata.id).addClass('hide');
140 return false; 142 return false;
141 - } 143 + } else {
  144 + this.pageX = event.targetTouches[0].pageX;
  145 + var delBtn = $('#del-' + id);
142 146
143 - $('#del-' + id).removeClass('hide');  
144 - this.pageX = event.targetTouches[0].pageX;  
145 - if (this.pandata.id !== id) {  
146 - if (this.pandata.id !== undefined) {  
147 - $('#li-' + this.pandata.id).css('transform', 'translateX(0px)');  
148 - $('#del-' + this.pandata.id).addClass('hide'); 147 + if (delBtn.hasClass('hide')) {
  148 + delBtn.removeClass('hide');
  149 + this.pandata.objX = 0;
  150 + this.pandata.id = id;
149 } 151 }
150 -  
151 - this.pandata.objX = 0;  
152 - this.pandata.id = id;  
153 } 152 }
154 }, 153 },
155 panmove(id) { 154 panmove(id) {
156 event.preventDefault(); 155 event.preventDefault();
157 - if (this.editmodel && this.pandata.id !== id) { 156 + if (this.pandata.id && this.pandata.id !== id) {
158 return false; 157 return false;
159 } 158 }
160 159
@@ -181,7 +180,8 @@ @@ -181,7 +180,8 @@
181 }, 180 },
182 panend(id) { 181 panend(id) {
183 event.preventDefault(); 182 event.preventDefault();
184 - if (this.editmodel && this.pandata.id !== id) { 183 + if (this.pandata.id && this.pandata.id !== id) {
  184 + this.pandata = {};
185 return false; 185 return false;
186 } 186 }
187 187
@@ -197,7 +197,7 @@ @@ -197,7 +197,7 @@
197 } 197 }
198 li.css('transform', 'translateX(' + this.pandata.objX + 'px)'); 198 li.css('transform', 'translateX(' + this.pandata.objX + 'px)');
199 199
200 - if (this.editmodel && this.pandata.id === id && this.pandata.objX === 0) { 200 + if (this.pandata.objX === 0) {
201 this.pandata = {}; 201 this.pandata = {};
202 } 202 }
203 } 203 }
1 <template> 1 <template>
2 - <div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10"> 2 + <div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10" >
3 <ul class="fav-product-list"> 3 <ul class="fav-product-list">
4 <li v-for="item in productData" track-by="fav_id" id="li-{{item.fav_id}}" 4 <li v-for="item in productData" track-by="fav_id" id="li-{{item.fav_id}}"
  5 + v-touch-options:pan="{ direction: 'horizontal', threshold: 100}"
5 v-touch:panstart="panstart(item.fav_id)" 6 v-touch:panstart="panstart(item.fav_id)"
6 v-touch:panmove="panmove(item.fav_id)" 7 v-touch:panmove="panmove(item.fav_id)"
7 - v-touch:panend="panend(item.fav_id)"  
8 - v-touch-options:pan="{ direction: 'horizontal' }"> 8 + v-touch:panend="panend(item.fav_id)">
9 <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)"> 9 <div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
10 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span> 10 <span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
11 </div> 11 </div>
@@ -55,8 +55,8 @@ @@ -55,8 +55,8 @@
55 page: 0, 55 page: 0,
56 pageX: 0, 56 pageX: 0,
57 currentX: 0, 57 currentX: 0,
58 - pandata: {},  
59 productData: [], 58 productData: [],
  59 + pandata: {},
60 keys: {} 60 keys: {}
61 }; 61 };
62 }, 62 },
@@ -154,25 +154,24 @@ @@ -154,25 +154,24 @@
154 }, 154 },
155 panstart(id) { 155 panstart(id) {
156 event.preventDefault(); 156 event.preventDefault();
157 - if (this.editmodel && this.pandata.id !== id) { 157 + if (this.pandata.id && this.pandata.id !== id) {
  158 + $('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
  159 + $('#del-' + this.pandata.id).addClass('hide');
158 return false; 160 return false;
159 - } 161 + } else {
  162 + this.pageX = event.targetTouches[0].pageX;
  163 + var delBtn = $('#del-' + id);
160 164
161 - $('#del-' + id).removeClass('hide');  
162 - this.pageX = event.targetTouches[0].pageX;  
163 - if (this.pandata.id !== id) {  
164 - if (this.pandata.id !== undefined) {  
165 - $('#li-' + this.pandata.id).css('transform', 'translateX(0px)');  
166 - $('#del-' + this.pandata.id).addClass('hide'); 165 + if (delBtn.hasClass('hide')) {
  166 + delBtn.removeClass('hide');
  167 + this.pandata.objX = 0;
  168 + this.pandata.id = id;
167 } 169 }
168 -  
169 - this.pandata.objX = 0;  
170 - this.pandata.id = id;  
171 } 170 }
172 }, 171 },
173 panmove(id) { 172 panmove(id) {
174 event.preventDefault(); 173 event.preventDefault();
175 - if (this.editmodel && this.pandata.id !== id) { 174 + if (this.pandata.id && this.pandata.id !== id) {
176 return false; 175 return false;
177 } 176 }
178 177
@@ -199,7 +198,8 @@ @@ -199,7 +198,8 @@
199 }, 198 },
200 panend(id) { 199 panend(id) {
201 event.preventDefault(); 200 event.preventDefault();
202 - if (this.editmodel && this.pandata.id !== id) { 201 + if (this.pandata.id && this.pandata.id !== id) {
  202 + this.pandata = {};
203 return false; 203 return false;
204 } 204 }
205 205
@@ -215,7 +215,7 @@ @@ -215,7 +215,7 @@
215 } 215 }
216 li.css('transform', 'translateX(' + this.pandata.objX + 'px)'); 216 li.css('transform', 'translateX(' + this.pandata.objX + 'px)');
217 217
218 - if (this.editmodel && this.pandata.id === id && this.pandata.objX === 0) { 218 + if (this.pandata.objX === 0) {
219 this.pandata = {}; 219 this.pandata = {};
220 } 220 }
221 } 221 }
@@ -111,7 +111,7 @@ @@ -111,7 +111,7 @@
111 if (Number(this.order.status) === 0) { 111 if (Number(this.order.status) === 0) {
112 this.getCancelReason(); 112 this.getCancelReason();
113 } 113 }
114 - } else { 114 + } else if (result.code !== 500) {
115 tip(result.message); 115 tip(result.message);
116 } 116 }
117 }).fail(() => { 117 }).fail(() => {
@@ -126,7 +126,7 @@ @@ -126,7 +126,7 @@
126 }, (result) => { 126 }, (result) => {
127 if (result.code === 200) { 127 if (result.code === 200) {
128 location.reload(); 128 location.reload();
129 - } else { 129 + } else if (result.code !== 500) {
130 tip(result.message); 130 tip(result.message);
131 } 131 }
132 }, () => { 132 }, () => {
@@ -189,7 +189,7 @@ @@ -189,7 +189,7 @@
189 if (result.code === 200) { 189 if (result.code === 200) {
190 interceptClick.intercept('/me/order?type=1'); 190 interceptClick.intercept('/me/order?type=1');
191 return false; 191 return false;
192 - } else { 192 + } else if (result.code !== 500) {
193 tip(result.message); 193 tip(result.message);
194 } 194 }
195 }).fail(() => { 195 }).fail(() => {
@@ -207,7 +207,7 @@ @@ -207,7 +207,7 @@
207 }).then(result => { 207 }).then(result => {
208 if (result.code === 200) { 208 if (result.code === 200) {
209 location.reload(); 209 location.reload();
210 - } else { 210 + } else if (result.code !== 500) {
211 tip(result.message); 211 tip(result.message);
212 } 212 }
213 }).fail(() => { 213 }).fail(() => {
@@ -228,11 +228,7 @@ @@ -228,11 +228,7 @@
228 dropDown(elementId) { 228 dropDown(elementId) {
229 let dropdown = document.getElementById(elementId); 229 let dropdown = document.getElementById(elementId);
230 230
231 - try {  
232 - this.showDropdown(dropdown);  
233 - } catch(e) {  
234 - console.log(e)  
235 - } 231 + this.showDropdown(dropdown);
236 return false; 232 return false;
237 }, 233 },
238 showDropdown(element) { 234 showDropdown(element) {
@@ -122,7 +122,7 @@ @@ -122,7 +122,7 @@
122 }, (result) => { 122 }, (result) => {
123 if (result.code === 200) { 123 if (result.code === 200) {
124 location.reload(); 124 location.reload();
125 - } else { 125 + } else if (result.code !== 500) {
126 tip(result.message); 126 tip(result.message);
127 } 127 }
128 }, () => { 128 }, () => {
@@ -187,7 +187,7 @@ @@ -187,7 +187,7 @@
187 }).then(result => { 187 }).then(result => {
188 if (result.code === 200) { 188 if (result.code === 200) {
189 _that.orderList.splice(index, 1); 189 _that.orderList.splice(index, 1);
190 - } else { 190 + } else if (result.code !== 500) {
191 tip(result.message); 191 tip(result.message);
192 } 192 }
193 }).fail(() => { 193 }).fail(() => {
@@ -205,7 +205,7 @@ @@ -205,7 +205,7 @@
205 }).then(result => { 205 }).then(result => {
206 if (result.code === 200) { 206 if (result.code === 200) {
207 location.reload(); 207 location.reload();
208 - } else { 208 + } else if (result.code !== 500) {
209 tip(result.message); 209 tip(result.message);
210 } 210 }
211 }).fail(() => { 211 }).fail(() => {
@@ -218,11 +218,7 @@ @@ -218,11 +218,7 @@
218 dropDown(elementId){ 218 dropDown(elementId){
219 let dropdown = document.getElementById(elementId); 219 let dropdown = document.getElementById(elementId);
220 220
221 - try {  
222 - this.showDropdown(dropdown);  
223 - } catch(e) {  
224 - console.log(e)  
225 - } 221 + this.showDropdown(dropdown);
226 return false; 222 return false;
227 }, 223 },
228 showDropdown(element) { 224 showDropdown(element) {