Authored by 沈志敏

fix bug

... ... @@ -5,7 +5,7 @@
v-touch:panstart="panstart(item.fav_id)"
v-touch:panmove="panmove(item.fav_id)"
v-touch:panend="panend(item.fav_id)"
v-touch-options:pan="{direction:'horizontal'}">
v-touch-options:pan="{direction:'horizontal', threshold: 100}">
<div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
<span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
</div>
... ... @@ -136,25 +136,24 @@
},
panstart(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
if (this.pandata.id && this.pandata.id !== id) {
$('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
$('#del-' + this.pandata.id).addClass('hide');
return false;
}
} else {
this.pageX = event.targetTouches[0].pageX;
var delBtn = $('#del-' + id);
$('#del-' + id).removeClass('hide');
this.pageX = event.targetTouches[0].pageX;
if (this.pandata.id !== id) {
if (this.pandata.id !== undefined) {
$('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
$('#del-' + this.pandata.id).addClass('hide');
if (delBtn.hasClass('hide')) {
delBtn.removeClass('hide');
this.pandata.objX = 0;
this.pandata.id = id;
}
this.pandata.objX = 0;
this.pandata.id = id;
}
},
panmove(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
if (this.pandata.id && this.pandata.id !== id) {
return false;
}
... ... @@ -181,7 +180,8 @@
},
panend(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
if (this.pandata.id && this.pandata.id !== id) {
this.pandata = {};
return false;
}
... ... @@ -197,7 +197,7 @@
}
li.css('transform', 'translateX(' + this.pandata.objX + 'px)');
if (this.editmodel && this.pandata.id === id && this.pandata.objX === 0) {
if (this.pandata.objX === 0) {
this.pandata = {};
}
}
... ...
<template>
<div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10">
<div class="fav-type" v-infinite-scroll="loadMore()" infinite-scroll-disabled="busy" infinite-scroll-distance="10" >
<ul class="fav-product-list">
<li v-for="item in productData" track-by="fav_id" id="li-{{item.fav_id}}"
v-touch-options:pan="{ direction: 'horizontal', threshold: 100}"
v-touch:panstart="panstart(item.fav_id)"
v-touch:panmove="panmove(item.fav_id)"
v-touch:panend="panend(item.fav_id)"
v-touch-options:pan="{ direction: 'horizontal' }">
v-touch:panend="panend(item.fav_id)">
<div class="fav-del-left {{editmodel ? 'delshow': ''}}" @click="showDelBtn(item.fav_id)">
<span class="fav-del-span"><span class="icon icon-edit-del"></span></span>
</div>
... ... @@ -55,8 +55,8 @@
page: 0,
pageX: 0,
currentX: 0,
pandata: {},
productData: [],
pandata: {},
keys: {}
};
},
... ... @@ -154,25 +154,24 @@
},
panstart(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
if (this.pandata.id && this.pandata.id !== id) {
$('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
$('#del-' + this.pandata.id).addClass('hide');
return false;
}
} else {
this.pageX = event.targetTouches[0].pageX;
var delBtn = $('#del-' + id);
$('#del-' + id).removeClass('hide');
this.pageX = event.targetTouches[0].pageX;
if (this.pandata.id !== id) {
if (this.pandata.id !== undefined) {
$('#li-' + this.pandata.id).css('transform', 'translateX(0px)');
$('#del-' + this.pandata.id).addClass('hide');
if (delBtn.hasClass('hide')) {
delBtn.removeClass('hide');
this.pandata.objX = 0;
this.pandata.id = id;
}
this.pandata.objX = 0;
this.pandata.id = id;
}
},
panmove(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
if (this.pandata.id && this.pandata.id !== id) {
return false;
}
... ... @@ -199,7 +198,8 @@
},
panend(id) {
event.preventDefault();
if (this.editmodel && this.pandata.id !== id) {
if (this.pandata.id && this.pandata.id !== id) {
this.pandata = {};
return false;
}
... ... @@ -215,7 +215,7 @@
}
li.css('transform', 'translateX(' + this.pandata.objX + 'px)');
if (this.editmodel && this.pandata.id === id && this.pandata.objX === 0) {
if (this.pandata.objX === 0) {
this.pandata = {};
}
}
... ...
... ... @@ -111,7 +111,7 @@
if (Number(this.order.status) === 0) {
this.getCancelReason();
}
} else {
} else if (result.code !== 500) {
tip(result.message);
}
}).fail(() => {
... ... @@ -126,7 +126,7 @@
}, (result) => {
if (result.code === 200) {
location.reload();
} else {
} else if (result.code !== 500) {
tip(result.message);
}
}, () => {
... ... @@ -189,7 +189,7 @@
if (result.code === 200) {
interceptClick.intercept('/me/order?type=1');
return false;
} else {
} else if (result.code !== 500) {
tip(result.message);
}
}).fail(() => {
... ... @@ -207,7 +207,7 @@
}).then(result => {
if (result.code === 200) {
location.reload();
} else {
} else if (result.code !== 500) {
tip(result.message);
}
}).fail(() => {
... ... @@ -228,11 +228,7 @@
dropDown(elementId) {
let dropdown = document.getElementById(elementId);
try {
this.showDropdown(dropdown);
} catch(e) {
console.log(e)
}
this.showDropdown(dropdown);
return false;
},
showDropdown(element) {
... ...
... ... @@ -122,7 +122,7 @@
}, (result) => {
if (result.code === 200) {
location.reload();
} else {
} else if (result.code !== 500) {
tip(result.message);
}
}, () => {
... ... @@ -187,7 +187,7 @@
}).then(result => {
if (result.code === 200) {
_that.orderList.splice(index, 1);
} else {
} else if (result.code !== 500) {
tip(result.message);
}
}).fail(() => {
... ... @@ -205,7 +205,7 @@
}).then(result => {
if (result.code === 200) {
location.reload();
} else {
} else if (result.code !== 500) {
tip(result.message);
}
}).fail(() => {
... ... @@ -218,11 +218,7 @@
dropDown(elementId){
let dropdown = document.getElementById(elementId);
try {
this.showDropdown(dropdown);
} catch(e) {
console.log(e)
}
this.showDropdown(dropdown);
return false;
},
showDropdown(element) {
... ...