Authored by 沈志敏

格式化代码

... ... @@ -33,7 +33,7 @@ const refund = {
res.render('logistics', {
module: 'home',
page: 'logistics',
company_list: result ? JSON.stringify(result.data) : ""
company_list: result ? JSON.stringify(result.data) : ''
});
}).catch(next);
},
... ...
... ... @@ -36,7 +36,7 @@
props: ['brandUrl'],
data() {
return {
nullbox : 'hide',
nullbox: 'hide',
busy: false,
editmodel: false,
page: 0,
... ... @@ -46,13 +46,13 @@
methods: {
loadMore: function() {
let _this = this;
this.busy = true;
this.busy = true;
$.ajax({
url: '/home/favorite/favpaging',
data: {
page : ++_this.page,
tab : "brand"
page: ++_this.page,
tab: 'brand'
}
}).then(result => {
if (result.isend) {
... ... @@ -62,12 +62,12 @@
}
if (result.list.length) {
result.list.forEach(function(o){
result.list.forEach(function(o) {
_this.brandData.push(o);
});
}
_this.nullbox = _this.brandData.length ? "hide" : "";
_this.nullbox = _this.brandData.length ? 'hide' : '';
}).fail(() => {
tip('网络错误');
});
... ... @@ -80,17 +80,19 @@
},
showDelBtn(index) {
this.hideDelBth();
var delBtn = $("#del-" + index);
var width = delBtn.width();
$("#li-" + index).css("transform","translateX(-" + width + "px)");
let delBtn = $('#del-' + index);
let width = delBtn.width();
$('#li-' + index).css('transform', 'translateX(-' + width + 'px)');
},
hideDelBth() {
this.brandData.forEach(function(d, index){
$("#li-" + index).css("transform","translateX(0px)");
})
this.brandData.forEach(function(d, index) {
$('#li-' + index).css('transform', 'translateX(0px)');
});
},
delItem(index, id) {
let _this = this;
$.ajax({
method: 'POST',
url: '/home/del-favdel',
... ...
... ... @@ -44,7 +44,7 @@
props: ['productUrl'],
data() {
return {
nullbox : 'hide',
nullbox: 'hide',
busy: false,
editmodel: false,
page: 0,
... ... @@ -54,12 +54,12 @@
methods: {
loadMore: function() {
let _this = this;
this.busy = true;
this.busy = true;
$.ajax({
url: '/home/favorite/favpaging',
data: {
page : ++_this.page
page: ++_this.page
}
}).then(result => {
if (result.isend) {
... ... @@ -69,12 +69,12 @@
}
if (result.list.length) {
result.list.forEach(function(o){
result.list.forEach(function(o) {
_this.productData.push(o);
});
}
_this.nullbox = _this.productData.length ? "hide" : "";
_this.nullbox = _this.productData.length ? 'hide' : '';
}).fail(() => {
tip('网络错误');
});
... ... @@ -87,17 +87,19 @@
},
showDelBtn(index) {
this.hideDelBth();
var delBtn = $("#del-" + index);
var width = delBtn.width();
$("#li-" + index).css("transform","translateX(-" + width + "px)");
let delBtn = $('#del-' + index);
let width = delBtn.width();
$('#li-' + index).css('transform', 'translateX(-' + width + 'px)');
},
hideDelBth() {
this.productData.forEach(function(d, index){
$("#li-" + index).css("transform","translateX(0px)");
})
this.productData.forEach(function(d, index) {
$('#li-' + index).css('transform', 'translateX(0px)');
});
},
delItem(index, id) {
let _this = this;
$.ajax({
method: 'POST',
url: '/home/del-favdel',
... ...
... ... @@ -14,7 +14,6 @@
</template>
<script>
const $ = require('yoho-jquery');
const indexList = require('component/tool/index-list.vue');
module.exports = {
... ... @@ -31,28 +30,32 @@
},
methods: {
search: function() {
var inputname = this.inputname;
let inputname = this.inputname;
if (!inputname) {
this.showData = this.company_list;
return;
}
var filter = {};
for (var k in this.company_list) {
this.company_list[k].forEach(function(d){
let filter = {};
for (let k in this.company_list) {
this.company_list[k].forEach(function(d) {
if (d.company_name.indexOf(inputname) > -1) {
if (!filter[k]) filter[k] = [];
if (!filter[k]) {
filter[k] = [];
}
filter[k].push(d);
}
})
});
}
this.showData = filter;
},
select: function(company_id, company_name) {
select: function(companyId, companyName) {
this.$dispatch('changeView', {
view: 'logistics',
company_id: company_id,
company_name: company_name
company_id: companyId,
company_name: companyName
});
// 重置列表
... ...
... ... @@ -26,19 +26,19 @@
};
},
methods: {
companylist: function(){
companylist: function() {
this.$dispatch('changeView', {
view: 'logisticsCompany'
});
},
submit: function(){
submit: function() {
if (!this.company_name) {
tip("请选择快递公司");
tip('请选择快递公司');
return false;
}
if (!this.num || !/^[0-9]*$/.test(this.num)) {
tip("请输入正确的快递单号");
return false;
tip('请输入正确的快递单号');
return false;
}
$.ajax({
... ... @@ -50,7 +50,7 @@
num: this.num
}
}).then(function(res) {
if ($.type(res) !== 'object') {
if ($.type(res) !== 'object') {
res = {};
}
if (res.code !== 200) {
... ... @@ -67,4 +67,4 @@
}
};
</script>
\ No newline at end of file
</script>
... ...