Authored by 郭成尧

get-company-list

... ... @@ -4,6 +4,7 @@
*/
'use strict';
const _ = require('lodash');
const headerModel = require('../../../doraemon/models/header'); // 头部model
const refundModel = require('../models/refund');
const notLoginCode = 400;
... ... @@ -52,22 +53,32 @@ const refund = {
* @param {*} res
* @param {*} next
*/
logistics(req, res, next) {
logistics(req, res) {
let headerData = headerModel.setNav({
navTitle: '退换货订单列表'
});
res.render('refund/logistics', {
module: 'home',
page: 'refund-logistics',
pageHeader: headerData,
applyid: req.query.applyid,
type: req.query.type
});
},
/**
* 获取快递公司名称
* @param {*} req
* @param {*} res
* @param {*} next
*/
getCompanyList(req, res, next) {
refundModel.getExpressCompany().then(result => {
res.render('refund/logistics', {
module: 'home',
page: 'refund-logistics',
pageHeader: headerData,
applyid: req.query.applyid,
type: req.query.type,
company_list: result ? JSON.stringify(result.data) : ''
});
res.json(_.get(result, 'data', []));
}).catch(next);
},
saveLogistics(req, res, next) {
const uid = req.user.uid;
const applyid = req.body.applyid;
... ...
... ... @@ -167,6 +167,7 @@ router.post('/return/refund/submit', auth, refund.submit); // AJAX 提交信息
router.get('/return/logistics', auth, refund.logistics); // 退换货 - 商品寄回信息
router.post('/return/save-logistics', auth, refund.saveLogistics); // 退换货 - 添加寄回物流信息
router.post('/return/refund/cancel-apply', auth, refund.cancelApply); // 退货 - 取消申请
router.get('/return/refund/getCompanyList', auth, refund.getCompanyList); // 获取快递公司
// 换货申请
router.get('/return/exchange', auth, exchange.exchange); // 换货申请
... ...
<div class="logistics-page" id="logistics">
<components :is="currentView" :company_id="company_id" :company_name="company_name" applyid='{{applyid}}' type='{{type}}' company_list='{{company_list}}' keep-alive></components>
<component :is="currentView" :company_id="company_id" :company_name="company_name" applyid='{{applyid}}' type='{{type}}' keep-alive></component>
</div>
... ...
... ... @@ -4,8 +4,8 @@
<input class="icon" type="text" placeholder="&#xe608; 搜索快递公司" v-model="inputname" @input="search">
</div>
<div class="company-data">
<div class="company-item" v-for="item in showData" :key="item.key">
<a class="tag" :name="key">{{ key }}</a>
<div class="company-item" v-for="(item, index) in showData" :key="index">
<a class="tag" :name="index">{{ index }}</a>
<span v-for="val in item" :key="val.id" @click="select(val.id, val.company_name)">{{val.company_name}}</span>
</div>
</div>
... ... @@ -14,22 +14,31 @@
</template>
<script>
const $ = require('yoho-jquery');
const indexList = require('components/tools/index-list.vue');
const bus = require('plugin/vue-bus');
module.exports = {
props: ['company_list'],
data() {
this.company_list = JSON.parse(this.company_list);
return {
inputname: '',
showData: this.company_list
company_list: [],
showData: []
};
},
components: {
indexList
},
methods: {
/**
* 获取快递公司列表
*/
getCompanyList() {
$.get('/home/return/refund/getCompanyList', result => {
this.showData = this.company_list = result;
});
},
search() {
let inputname = this.inputname;
... ... @@ -65,6 +74,9 @@
this.inputname = '';
this.showData = this.company_list;
}
},
created() {
this.getCompanyList();
}
};
</script>
... ...