Authored by 沈志敏

添加索引组件

... ... @@ -28,15 +28,13 @@ const refund = {
res.json(result);
}).catch(next);
},
logistics(req, res) {
res.render('logistics', {
module: 'home',
page: 'logistics'
});
},
companylist(req, res, next) {
logistics(req, res, next) {
refundModel.getExpressCompany().then(result => {
res.json(result);
res.render('logistics', {
module: 'home',
page: 'logistics',
company_list: result ? JSON.stringify(result.data) : ""
});
}).catch(next);
},
saveLogistics(req, res) {
... ...
... ... @@ -42,7 +42,6 @@ router.get('/refund', refund.refund); // 退换货
router.get('/refund/order', refund.order); // 查询订单数据
router.post('/refund/submit', refund.submit); // 提交信息
router.get('/refund/logistics', refund.logistics); // 退换货 - 商品寄回信息
router.get('/refund/companylist', refund.companylist); // 退换货 - 物流公司列表信息
router.post('/save-logistics', refund.saveLogistics); // 退换货 - 添加寄回物流信息
// 换货
... ...
<div class="logistics-page" id="logistics">
<components :is="currentView" :company_id="company_id" :company_name="company_name" keep-alive></components>
</div>
\ No newline at end of file
<components :is="currentView" :company_id="company_id" :company_name="company_name" company_list={{company_list}} keep-alive></components>
</div>
... ...
const Vue = require('yoho-vue');
const infiniteScroll = require('yoho-vue-infinite-scroll');
const Logistics = require('home/refund/logistics.vue');
const LogisticsCompany = require('home/refund/logistics-company.vue');
Vue.use(infiniteScroll);
new Vue({
el: '#logistics',
data: {
... ...
... ... @@ -108,7 +108,7 @@
margin-left: 30px;
.company-item {
h2 {
.tag {
height: 50px;
line-height: 50px;
font-size: 34px;
... ...
... ... @@ -58,7 +58,7 @@
const $ = require('yoho-jquery');
const bus = require('common/vue-bus');
const tip = require('common/tip');
const indexList = require('channel/index-list.vue');
const indexList = require('component/tool/index-list.vue');
module.exports = {
props: ['channel'],
... ...
... ... @@ -5,35 +5,41 @@
</div>
<div class="company-data">
<div class="company-item" v-for="item in showData">
<h2>{{ $key }}</h2>
<a class="tag" :name="$key">{{ $key }}</a>
<span v-for="val in item" track-by="id" @click="select(val.id, val.company_name)">{{val.company_name}}</span>
</div>
</div>
<index-list style="margin-top:70px"></index-list>
</div>
</template>
<script>
const $ = require('yoho-jquery');
const indexList = require('component/tool/index-list.vue');
module.exports = {
props: ['company_list'],
data() {
this.company_list = JSON.parse(this.company_list);
return {
inputname: '',
data: {},
showData: {}
showData: this.company_list
};
},
components: {
indexList
},
methods: {
search: function() {
var inputname = this.inputname;
if (!inputname) {
this.showData = this.data;
this.showData = this.company_list;
return;
}
var filter = {};
for (var k in this.data) {
this.data[k].forEach(function(d){
for (var k in this.company_list) {
this.company_list[k].forEach(function(d){
if (d.company_name.indexOf(inputname) > -1) {
if (!filter[k]) filter[k] = [];
filter[k].push(d);
... ... @@ -51,27 +57,8 @@
// 重置列表
this.inputname = '';
this.showData = this.data;
this.showData = this.company_list;
}
},
activate: function(done) {
let _this = this;
$.ajax({
url: '/home/refund/companylist'
}).then(function(res) {
if ($.type(res) !== 'object') {
res = {};
}
if (res.code === 200) {
_this.data = res.data;
_this.showData = res.data;
}
done();
}).fail(function() {
tip('网络错误');
done();
});
}
};
</script>
\ No newline at end of file
</script>
... ...