Authored by 沈志敏

添加物流信息

... ... @@ -72,8 +72,8 @@ const fav = {
link: link,
imgUrl: d.image ? helpers.image(d.image) : '',
title: d.product_name,
price: '¥' + Number(d.market_price).toFixed(2),
discountPrice: (Number(d.market_price) - Number(d.sales_price) > 0) ? '¥' + Number(d.sales_price).toFixed(2) : false,
price: '¥' + Number(Math.max(d.market_price, 0)).toFixed(2),
discountPrice: (Number(d.market_price) - Number(d.sales_price) > 0) ? '¥' + Number(Math.max(d.sales_price, 0)).toFixed(2) : false,
sellOut: d.storage < 0,
invalidGoods: d.status == 0
});
... ... @@ -90,7 +90,7 @@ const fav = {
}).catch(next);
}
},
favdel: (req, res, next) => {
deletefav: (req, res, next) => {
let uid = req.user.uid;
uid = 20000134; // 测试uid
... ...
... ... @@ -30,8 +30,8 @@ const component = {
let result = {
module: 'home',
page: 'index',
head_ico: proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '',
profile_name: uid ? proData.profile_name : '登录/注册',
head_ico: proData && proData.head_ico ? helpers.image(proData.head_ico, 200, 200) : '',
profile_name: uid && proData ? proData.profile_name : '登录/注册',
userinfourl: uid ? '/home/mydetails' : helpers.urlFormat('/signin.html', {
refer: req.originalUrl
}),
... ...
... ... @@ -2,6 +2,7 @@
* 退换货
* @type {Object}
*/
'use strict';
const refundModel = require('../models/refund');
const refund = {
... ... @@ -32,6 +33,19 @@ const refund = {
module: 'home',
page: 'logistics'
});
},
companylist(req, res, next) {
refundModel.getExpressCompany().then(result => {
res.json(result);
}).catch(next);
},
saveLogistics(req, res, next) {
const company = req.body.company;
const num = req.body.num;
res.json({
code: 200
});
}
};
... ...
... ... @@ -24,7 +24,12 @@ const refund = {
method: 'app.refund.submit',
uid: uid,
}, params)).then(global.yoho.camelCase);
},
getExpressCompany() {
return api.get('', {
method: 'app.express.getExpressCompany'
});
}
};
module.exports = refund;
module.exports = refund;
\ No newline at end of file
... ...
... ... @@ -27,12 +27,14 @@ router.post('/save-feedback', home.saveFeedback); // 个人中心-提交意见
router.get('/favorite', favorite.favorite); // 个人中心 - 收藏
router.get('/favorite/favpaging', favorite.favpaging); // 个人中心 - 收藏商品/品牌(翻页)
router.post('/favorite/favdel', favorite.favdel); // 个人中心 - 收藏商品/品牌(刪除)
router.post('/del-favdel', favorite.deletefav); // 个人中心 - 收藏商品/品牌(刪除)
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); // 退换货 - 添加寄回物流信息
router.get('/about-us', home.aboutUs); // 个人中心 - 关于我们
... ...
<div class="my-page">
<div class="my-header">
<a class="user-info" href={{userinfourl}}>
<span class="user-avatar" data-avatar="{{head_ico}}"></span>
<span class="user-avatar" {{#if head_ico}} style="background-image: url('{{head_ico}}');" {{/if}}></span>
<br><span class="username">{{profile_name}}</span>
</a>
</div>
... ...
<div class="logistics-page">
<div class="edit-logistics-page">
<form class="edit-logistics">
<label class="company">
选择快递公司
<input type="text" name="company" value="{{company}}" readonly>
<span class="icon icon-right"></span>
</label>
<label class="num">
快递单号
<input type="text" name="num" value="{{num}}">
</label>
</form>
<div class="submit">确认</div>
</div>
<div class="logistics-page" id="logistics">
<components :is="currentView" :company="company" keep-alive></components>
</div>
\ No newline at end of file
... ...
... ... @@ -7,6 +7,6 @@ Vue.use(infiniteScroll);
new Vue({
el: '#fav-content',
components: {
'fav-brand-list': BrandList
'favBrandList': BrandList
}
});
});
\ No newline at end of file
... ...
... ... @@ -7,6 +7,6 @@ Vue.use(infiniteScroll);
new Vue({
el: '#fav-content',
components: {
'fav-product-list': ProductList
'favProductList': ProductList
}
});
});
\ No newline at end of file
... ...
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: {
company: '',
currentView: 'logistics',
},
components: {
logistics: Logistics,
logisticsCompany: LogisticsCompany
},
events: {
changeView: function(obj) {
this.currentView = obj.view;
this.company = obj.company;
}
}
});
\ No newline at end of file
... ...
... ... @@ -5,15 +5,17 @@
.edit-logistics-page {
width: 100%;
color: #d0d0d0;
background: #f0f0f0;
.edit-logistics {
display: inline-block;
margin-top: 20px;
padding: 0 30px;
width: 100%;
background: #fff;
font-size: 30px;
line-height: 88px;
border-bottom: 1px solid #e0e0e0;
label {
display: block;
position: relative;
... ... @@ -25,9 +27,15 @@
content: none;
}
input {
.company-val {
direction: rtl;
}
margin-right: 10px;
}
.icon {
margin-top: 27px;
margin-right: 10px;
float: right;
}
}
input {
... ... @@ -42,32 +50,57 @@
-webkit-appearance: none;
}
p {
position: absolute;
top: 0;
right: 40px;
width: 360px;
height: 88px;
color: #444;
padding: 0;
border: none;
.num {
width: 440px;
text-align: right;
}
}
.submit {
margin: auto 30px;
width: 100%;
position: fixed;
bottom: 20px;
width: 92%;
margin: 0 4%;
height: 100px;
color: #fff;
background: #000;
text-align: center;
font-size: 28px;
line-height: 88px;
line-height: 100px;
&.highlight {
background: rgba(0, 0, 0, 0.6);
}
}
}
.companylist-page {
width: 100%;
color: #d0d0d0;
.search-input {
position: relative;
padding: 14px 22px;
background: #f8f8f8;
.icon {
position: absolute;
font-size: 24px;
top: 26px;
left: 36px;
color: #b2b2b2;
}
input {
height: 56px;
width: 378px;
border-radius: 28px;
padding: 0 52px;
font-size: 24px;
background: #fff;
border: none;
}
}
}
}
... ...
... ... @@ -73,8 +73,8 @@
delItem(index, id) {
let _this = this;
$.ajax({
method: 'post',
url: '/home/favorite/favdel',
method: 'POST',
url: '/home/del-favdel',
data: {
favId: id,
type: 'brand'
... ...
... ... @@ -80,8 +80,8 @@
delItem(index, id) {
let _this = this;
$.ajax({
method: 'post',
url: '/home/favorite/favdel',
method: 'POST',
url: '/home/del-favdel',
data: {
favId: id,
type: 'product'
... ...
<template>
<div class="companylist-page">
<div class="search-input">
<input class="buriedpoint icon" type="text" placeholder="&#xe608;搜索快递公司">
</div>
<ul class="search-associate"></ul>
</div>
</template>
<script>
module.exports = {
data() {
return {
companyData: {},
};
},
methods: {
submit: function(){
console.log(this.num);
this.$dispatch('changeView', {
view: 'logistics',
company: "aaaf啊啊啊"
});
}
},
activate: function(done) {
$.ajax({
url: '/home/refund/companylist'
}).then(function(res) {
if ($.type(res) !== 'object') {
res = {};
}
if (res.code === 200) {
}
done();
}).fail(function() {
tip('网络错误');
done();
});
}
};
</script>
\ No newline at end of file
... ...
<template>
<div class="edit-logistics-page">
<form class="edit-logistics">
<label @click="companylist">
选择快递公司<input class="company-val" type="text" name="company" value="{{company}}" readonly>
<span class="icon icon-right"></span>
</label>
<label>
快递单号
<input class="num" type="number" name="num" v-model='num'>
</label>
</form>
<div class="submit" @click="submit">确认</div>
</div>
</template>
<script>
const $ = require('yoho-jquery');
const tip = require('common/tip');
module.exports = {
props: ['company'],
data() {
return {
num: '',
};
},
methods: {
companylist: function(){
this.$dispatch('changeView', {
view: 'logisticsCompany'
});
},
submit: function(){
if (!this.company) {
tip("请选择快递公司");
return false;
}
if (!/^[0-9]*$/.test(this.num)) {
tip("请输入正确的快递单号");
return false;
}
$.ajax({
method: 'POST',
url: '/home/save-logistics',
data: {
company: company,
num: num
}
}).then(function(res) {
if ($.type(res) !== 'object') {
res = {};
}
if (res.code !== 200) {
tip(res.message || '网络出了点问题~');
} else {
// todo 跳转到什么页面呢?
// window.location.href
}
}).fail(function() {
tip('网络错误');
});
return false;
}
}
};
</script>
\ No newline at end of file
... ...