Showing
5 changed files
with
48 additions
and
41 deletions
@@ -33,7 +33,7 @@ const refund = { | @@ -33,7 +33,7 @@ const refund = { | ||
33 | res.render('logistics', { | 33 | res.render('logistics', { |
34 | module: 'home', | 34 | module: 'home', |
35 | page: 'logistics', | 35 | page: 'logistics', |
36 | - company_list: result ? JSON.stringify(result.data) : "" | 36 | + company_list: result ? JSON.stringify(result.data) : '' |
37 | }); | 37 | }); |
38 | }).catch(next); | 38 | }).catch(next); |
39 | }, | 39 | }, |
@@ -36,7 +36,7 @@ | @@ -36,7 +36,7 @@ | ||
36 | props: ['brandUrl'], | 36 | props: ['brandUrl'], |
37 | data() { | 37 | data() { |
38 | return { | 38 | return { |
39 | - nullbox : 'hide', | 39 | + nullbox: 'hide', |
40 | busy: false, | 40 | busy: false, |
41 | editmodel: false, | 41 | editmodel: false, |
42 | page: 0, | 42 | page: 0, |
@@ -46,13 +46,13 @@ | @@ -46,13 +46,13 @@ | ||
46 | methods: { | 46 | methods: { |
47 | loadMore: function() { | 47 | loadMore: function() { |
48 | let _this = this; | 48 | let _this = this; |
49 | - this.busy = true; | ||
50 | 49 | ||
50 | + this.busy = true; | ||
51 | $.ajax({ | 51 | $.ajax({ |
52 | url: '/home/favorite/favpaging', | 52 | url: '/home/favorite/favpaging', |
53 | data: { | 53 | data: { |
54 | - page : ++_this.page, | ||
55 | - tab : "brand" | 54 | + page: ++_this.page, |
55 | + tab: 'brand' | ||
56 | } | 56 | } |
57 | }).then(result => { | 57 | }).then(result => { |
58 | if (result.isend) { | 58 | if (result.isend) { |
@@ -62,12 +62,12 @@ | @@ -62,12 +62,12 @@ | ||
62 | } | 62 | } |
63 | 63 | ||
64 | if (result.list.length) { | 64 | if (result.list.length) { |
65 | - result.list.forEach(function(o){ | 65 | + result.list.forEach(function(o) { |
66 | _this.brandData.push(o); | 66 | _this.brandData.push(o); |
67 | }); | 67 | }); |
68 | } | 68 | } |
69 | 69 | ||
70 | - _this.nullbox = _this.brandData.length ? "hide" : ""; | 70 | + _this.nullbox = _this.brandData.length ? 'hide' : ''; |
71 | }).fail(() => { | 71 | }).fail(() => { |
72 | tip('网络错误'); | 72 | tip('网络错误'); |
73 | }); | 73 | }); |
@@ -80,17 +80,19 @@ | @@ -80,17 +80,19 @@ | ||
80 | }, | 80 | }, |
81 | showDelBtn(index) { | 81 | showDelBtn(index) { |
82 | this.hideDelBth(); | 82 | this.hideDelBth(); |
83 | - var delBtn = $("#del-" + index); | ||
84 | - var width = delBtn.width(); | ||
85 | - $("#li-" + index).css("transform","translateX(-" + width + "px)"); | 83 | + let delBtn = $('#del-' + index); |
84 | + let width = delBtn.width(); | ||
85 | + | ||
86 | + $('#li-' + index).css('transform', 'translateX(-' + width + 'px)'); | ||
86 | }, | 87 | }, |
87 | hideDelBth() { | 88 | hideDelBth() { |
88 | - this.brandData.forEach(function(d, index){ | ||
89 | - $("#li-" + index).css("transform","translateX(0px)"); | ||
90 | - }) | 89 | + this.brandData.forEach(function(d, index) { |
90 | + $('#li-' + index).css('transform', 'translateX(0px)'); | ||
91 | + }); | ||
91 | }, | 92 | }, |
92 | delItem(index, id) { | 93 | delItem(index, id) { |
93 | let _this = this; | 94 | let _this = this; |
95 | + | ||
94 | $.ajax({ | 96 | $.ajax({ |
95 | method: 'POST', | 97 | method: 'POST', |
96 | url: '/home/del-favdel', | 98 | url: '/home/del-favdel', |
@@ -44,7 +44,7 @@ | @@ -44,7 +44,7 @@ | ||
44 | props: ['productUrl'], | 44 | props: ['productUrl'], |
45 | data() { | 45 | data() { |
46 | return { | 46 | return { |
47 | - nullbox : 'hide', | 47 | + nullbox: 'hide', |
48 | busy: false, | 48 | busy: false, |
49 | editmodel: false, | 49 | editmodel: false, |
50 | page: 0, | 50 | page: 0, |
@@ -54,12 +54,12 @@ | @@ -54,12 +54,12 @@ | ||
54 | methods: { | 54 | methods: { |
55 | loadMore: function() { | 55 | loadMore: function() { |
56 | let _this = this; | 56 | let _this = this; |
57 | - this.busy = true; | ||
58 | 57 | ||
58 | + this.busy = true; | ||
59 | $.ajax({ | 59 | $.ajax({ |
60 | url: '/home/favorite/favpaging', | 60 | url: '/home/favorite/favpaging', |
61 | data: { | 61 | data: { |
62 | - page : ++_this.page | 62 | + page: ++_this.page |
63 | } | 63 | } |
64 | }).then(result => { | 64 | }).then(result => { |
65 | if (result.isend) { | 65 | if (result.isend) { |
@@ -69,12 +69,12 @@ | @@ -69,12 +69,12 @@ | ||
69 | } | 69 | } |
70 | 70 | ||
71 | if (result.list.length) { | 71 | if (result.list.length) { |
72 | - result.list.forEach(function(o){ | 72 | + result.list.forEach(function(o) { |
73 | _this.productData.push(o); | 73 | _this.productData.push(o); |
74 | }); | 74 | }); |
75 | } | 75 | } |
76 | 76 | ||
77 | - _this.nullbox = _this.productData.length ? "hide" : ""; | 77 | + _this.nullbox = _this.productData.length ? 'hide' : ''; |
78 | }).fail(() => { | 78 | }).fail(() => { |
79 | tip('网络错误'); | 79 | tip('网络错误'); |
80 | }); | 80 | }); |
@@ -87,17 +87,19 @@ | @@ -87,17 +87,19 @@ | ||
87 | }, | 87 | }, |
88 | showDelBtn(index) { | 88 | showDelBtn(index) { |
89 | this.hideDelBth(); | 89 | this.hideDelBth(); |
90 | - var delBtn = $("#del-" + index); | ||
91 | - var width = delBtn.width(); | ||
92 | - $("#li-" + index).css("transform","translateX(-" + width + "px)"); | 90 | + let delBtn = $('#del-' + index); |
91 | + let width = delBtn.width(); | ||
92 | + | ||
93 | + $('#li-' + index).css('transform', 'translateX(-' + width + 'px)'); | ||
93 | }, | 94 | }, |
94 | hideDelBth() { | 95 | hideDelBth() { |
95 | - this.productData.forEach(function(d, index){ | ||
96 | - $("#li-" + index).css("transform","translateX(0px)"); | ||
97 | - }) | 96 | + this.productData.forEach(function(d, index) { |
97 | + $('#li-' + index).css('transform', 'translateX(0px)'); | ||
98 | + }); | ||
98 | }, | 99 | }, |
99 | delItem(index, id) { | 100 | delItem(index, id) { |
100 | let _this = this; | 101 | let _this = this; |
102 | + | ||
101 | $.ajax({ | 103 | $.ajax({ |
102 | method: 'POST', | 104 | method: 'POST', |
103 | url: '/home/del-favdel', | 105 | url: '/home/del-favdel', |
@@ -14,7 +14,6 @@ | @@ -14,7 +14,6 @@ | ||
14 | </template> | 14 | </template> |
15 | 15 | ||
16 | <script> | 16 | <script> |
17 | - const $ = require('yoho-jquery'); | ||
18 | const indexList = require('component/tool/index-list.vue'); | 17 | const indexList = require('component/tool/index-list.vue'); |
19 | 18 | ||
20 | module.exports = { | 19 | module.exports = { |
@@ -31,28 +30,32 @@ | @@ -31,28 +30,32 @@ | ||
31 | }, | 30 | }, |
32 | methods: { | 31 | methods: { |
33 | search: function() { | 32 | search: function() { |
34 | - var inputname = this.inputname; | 33 | + let inputname = this.inputname; |
34 | + | ||
35 | if (!inputname) { | 35 | if (!inputname) { |
36 | this.showData = this.company_list; | 36 | this.showData = this.company_list; |
37 | return; | 37 | return; |
38 | } | 38 | } |
39 | 39 | ||
40 | - var filter = {}; | ||
41 | - for (var k in this.company_list) { | ||
42 | - this.company_list[k].forEach(function(d){ | 40 | + let filter = {}; |
41 | + | ||
42 | + for (let k in this.company_list) { | ||
43 | + this.company_list[k].forEach(function(d) { | ||
43 | if (d.company_name.indexOf(inputname) > -1) { | 44 | if (d.company_name.indexOf(inputname) > -1) { |
44 | - if (!filter[k]) filter[k] = []; | 45 | + if (!filter[k]) { |
46 | + filter[k] = []; | ||
47 | + } | ||
45 | filter[k].push(d); | 48 | filter[k].push(d); |
46 | } | 49 | } |
47 | - }) | 50 | + }); |
48 | } | 51 | } |
49 | this.showData = filter; | 52 | this.showData = filter; |
50 | }, | 53 | }, |
51 | - select: function(company_id, company_name) { | 54 | + select: function(companyId, companyName) { |
52 | this.$dispatch('changeView', { | 55 | this.$dispatch('changeView', { |
53 | view: 'logistics', | 56 | view: 'logistics', |
54 | - company_id: company_id, | ||
55 | - company_name: company_name | 57 | + company_id: companyId, |
58 | + company_name: companyName | ||
56 | }); | 59 | }); |
57 | 60 | ||
58 | // 重置列表 | 61 | // 重置列表 |
@@ -26,19 +26,19 @@ | @@ -26,19 +26,19 @@ | ||
26 | }; | 26 | }; |
27 | }, | 27 | }, |
28 | methods: { | 28 | methods: { |
29 | - companylist: function(){ | 29 | + companylist: function() { |
30 | this.$dispatch('changeView', { | 30 | this.$dispatch('changeView', { |
31 | view: 'logisticsCompany' | 31 | view: 'logisticsCompany' |
32 | }); | 32 | }); |
33 | }, | 33 | }, |
34 | - submit: function(){ | 34 | + submit: function() { |
35 | if (!this.company_name) { | 35 | if (!this.company_name) { |
36 | - tip("请选择快递公司"); | 36 | + tip('请选择快递公司'); |
37 | return false; | 37 | return false; |
38 | } | 38 | } |
39 | if (!this.num || !/^[0-9]*$/.test(this.num)) { | 39 | if (!this.num || !/^[0-9]*$/.test(this.num)) { |
40 | - tip("请输入正确的快递单号"); | ||
41 | - return false; | 40 | + tip('请输入正确的快递单号'); |
41 | + return false; | ||
42 | } | 42 | } |
43 | 43 | ||
44 | $.ajax({ | 44 | $.ajax({ |
@@ -50,7 +50,7 @@ | @@ -50,7 +50,7 @@ | ||
50 | num: this.num | 50 | num: this.num |
51 | } | 51 | } |
52 | }).then(function(res) { | 52 | }).then(function(res) { |
53 | - if ($.type(res) !== 'object') { | 53 | + if ($.type(res) !== 'object') { |
54 | res = {}; | 54 | res = {}; |
55 | } | 55 | } |
56 | if (res.code !== 200) { | 56 | if (res.code !== 200) { |
@@ -67,4 +67,4 @@ | @@ -67,4 +67,4 @@ | ||
67 | } | 67 | } |
68 | }; | 68 | }; |
69 | 69 | ||
70 | -</script> | ||
70 | +</script> |
-
Please register or login to post a comment