|
|
<template>
|
|
|
<div class="companylist-page">
|
|
|
<div class="search-input">
|
|
|
<input class="buriedpoint icon" type="text" placeholder="搜索快递公司">
|
|
|
<input class="icon" type="text" placeholder=" 搜索快递公司" v-model="inputname" @input="search">
|
|
|
</div>
|
|
|
<div class="company-data">
|
|
|
<div class="company-item" v-for="item in showData">
|
|
|
<h2>{{ $key }}</h2>
|
|
|
<span v-for="val in item" track-by="id" @click="select(val.id, val.company_name)">{{val.company_name}}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
<ul class="search-associate"></ul>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
const $ = require('yoho-jquery');
|
|
|
|
|
|
module.exports = {
|
|
|
data() {
|
|
|
return {
|
|
|
companyData: {},
|
|
|
inputname: '',
|
|
|
data: {},
|
|
|
showData: {}
|
|
|
};
|
|
|
},
|
|
|
methods: {
|
|
|
submit: function(){
|
|
|
console.log(this.num);
|
|
|
search: function() {
|
|
|
var inputname = this.inputname;
|
|
|
if (!inputname) {
|
|
|
this.showData = this.data;
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var filter = {};
|
|
|
for (var k in this.data) {
|
|
|
this.data[k].forEach(function(d){
|
|
|
if (d.company_name.indexOf(inputname) > -1) {
|
|
|
if (!filter[k]) filter[k] = [];
|
|
|
filter[k].push(d);
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
this.showData = filter;
|
|
|
},
|
|
|
select: function(company_id, company_name) {
|
|
|
this.$dispatch('changeView', {
|
|
|
view: 'logistics',
|
|
|
company: "aaaf啊啊啊"
|
|
|
company_id: company_id,
|
|
|
company_name: company_name
|
|
|
});
|
|
|
|
|
|
// 重置列表
|
|
|
this.inputname = '';
|
|
|
this.showData = this.data;
|
|
|
}
|
|
|
},
|
|
|
activate: function(done) {
|
|
|
let _this = this;
|
|
|
$.ajax({
|
|
|
url: '/home/refund/companylist'
|
|
|
}).then(function(res) {
|
...
|
...
|
@@ -31,9 +63,9 @@ |
|
|
res = {};
|
|
|
}
|
|
|
if (res.code === 200) {
|
|
|
|
|
|
_this.data = res.data;
|
|
|
_this.showData = res.data;
|
|
|
}
|
|
|
|
|
|
done();
|
|
|
}).fail(function() {
|
|
|
tip('网络错误');
|
...
|
...
|
|