Authored by 陈轩

Merge remote-tracking branch 'origin/develop' into develop

... ... @@ -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 = {
... ... @@ -9,18 +10,42 @@ const refund = {
res.render('refund');
},
order(req, res, next) {
const uid = 8050882;
const orderId = 160181661;
const uid = req.user.uid || 8050882;
const orderId = req.query.orderId;
if (!orderId) {
return next();
}
refundModel.getOrderData(uid, orderId).then(result => {
res.json(result);
}).catch(next);
},
submit(req, res, next) {
const uid = req.user.uid || 8050882;
refundModel.submitRefundData(uid, req.body).then(result => {
res.json(result);
}).catch(next);
},
logistics(req, res) {
res.render('logistics', {
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
});
}
};
... ...
... ... @@ -46,8 +46,8 @@ const _getInfoNumData = (uid) => {
if (data[0].data) {
for (let k in data[0].data) {
if (res[k] !== undefined) {
res[k] = data[0].data[k] ? data[0].data[k] : "";
if (res[k] !== null) {
res[k] = data[0].data[k] ? data[0].data[k] : '';
if (k !== 'yoho_coin_num' && res[k] > 99) {
res[k] = '99+';
}
... ... @@ -56,11 +56,11 @@ const _getInfoNumData = (uid) => {
}
if (data[1].data) {
res = _.merge(res, {
address_num: data[1].data.length ? data[1].data.length : ""
address_num: data[1].data.length ? data[1].data.length : ''
});
}
return res;
})
});
};
... ... @@ -87,15 +87,15 @@ exports.getHelpInfo = (data) => {
infoData = Object.assign(defaultParam, data);
return api.get('', infoData).then(result => {
const helpData = result.data;
const formatData = [];
var helpData = result.data;
var formatData = [];
helpData = helpData || [];
_.forEach(helpData, (item) => {
formatData.push({
name: item.caption,
code: item.code,
url: helpers.urlFormat('/home/helpDetail', {
url: helpers.urlFormat('/home/help-detail', {
code: item.code,
caption: item.caption,
})
... ... @@ -136,4 +136,4 @@ exports.saveFeedback = (data) => {
// 参考接口数据
});
};
\ No newline at end of file
};
... ...
... ... @@ -14,7 +14,22 @@ const refund = {
cache: true,
code: 200
}).then(global.yoho.camelCase);
},
submitRefundData(uid, params) {
console.log(Object.assign({
method: 'app.refund.submit',
uid: uid,
}, params));
return api.post('', Object.assign({
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
... ...
... ... @@ -21,20 +21,23 @@ router.get('/mycurrency', home.coin); // yoho币
router.get('/orderDetail', home.orderDetail); // yoho币
router.get('/help', home.help); // 帮助中心列表页
router.get('/helpDetail', home.helpDetail); // 帮助中心详情页
router.get('/help-detail', home.helpDetail); // 帮助中心详情页
router.get('/feedback', home.feedback); // 个人中心-意见反馈
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.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); // 个人中心 - 关于我们
module.exports = router;
\ No newline at end of file
module.exports = router;
... ...
<div class="about-us">
<div class="description">
<p>From yoho! 2015 high-end store </p>
<p>i fancy, you like.</p>
</div>
<div class="icon-container">
<div class="blk-icon"></div>
... ...
{{{helpDetail}}}
<div class="help-detail-page">
{{{helpDetail}}}
</div>
... ...
<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
... ...

6.48 KB | W: | H:

4.51 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
... ... @@ -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
... ...
... ... @@ -16,7 +16,6 @@
html,
body {
width: 100%;
height: 100%;
font-size: 24px;
font-family: Helvetica, Roboto, "Heiti SC", "黑体", Arial;
line-height: 1.4;
... ... @@ -28,6 +27,15 @@ a {
text-decoration: none;
}
input {
border: 0;
}
ol,
ul {
list-style: none;
}
*:focus {
outline: none;
}
... ... @@ -38,17 +46,12 @@ a {
margin-left: auto;
width: 100%;
max-width: 750px;
min-height: 100%;
}
.text-center {
text-align: center;
}
ol, ul {
list-style: none
}
.hide {
display: none;
}
... ...
... ... @@ -2,17 +2,23 @@
width: 100%;
height: 100%;
background: #fff;
position: relative;
.description {
position:absolute;
position: absolute;
top: 30%;
width: 100%;
width: 411px;
height: 75px;
background: resolve("home/about-us-tip.png") no-repeat;
background-size: 100%;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
}
.icon-container {
position: absolute;
top: 45%;
top: 43%;
left: 0;
right: 0;
margin-left: auto;
... ... @@ -21,8 +27,8 @@
.blk-icon {
background: resolve("home/app-icon.png") no-repeat;
width: 160px;
height: 160px;
width: 180px;
height: 180px;
left: 0;
right: 0;
margin-left: auto;
... ... @@ -31,6 +37,7 @@
}
.icon-label {
margin-top: 10px;
font-size: 30px;
left: 0;
right: 0;
... ... @@ -41,5 +48,6 @@
p {
text-align: center;
font-size: 24px;
font-family: BrownStd Regular;
}
}
\ No newline at end of file
}
... ...
... ... @@ -41,5 +41,9 @@
.iconfont {
color: #fff;
}
}
.help-detail-page {
margin-left: 30px;
margin-right: 30px;
}
... ...
... ... @@ -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="refund">
<product-list v-bind:title="title" v-bind:list="list" v-bind:refund-data="refundData"></product-list>
<div class="return-amount">
<div class="return-amount-item">
退款方法
<span class="icon icon-right"></span>
<select v-model="amount.return_amount_mode" name="amount-mode">
<option v-for="mode in refundData.returnAmountMode" v-bind:value="mode.id">{{mode.name}}</option>
</select>
</div>
<template v-if="amount.return_amount_mode === 2">
<div class="return-amount-item">
<span class="name">银行</span>
<input v-model="amount.bank_name" type="text" placeholder="请填写银行名称">
</div>
<div class="return-amount-item">
<span class="name">卡号</span>
<input v-model="amount.bank_card" type="text" placeholder="请填写银行卡卡号">
</div>
<div class="return-amount-item">
<span class="name">姓名</span>
<input v-model="amount.payee_name" type="text" placeholder="收款人姓名">
</div>
</template>
<template v-if="amount.return_amount_mode === 3">
<div class="return-amount-item">
<span class="name">帐号</span>
<input v-model="amount.alipay_account" type="text" placeholder="请填写支付宝帐号">
</div>
<div class="return-amount-item">
<span class="name">姓名</span>
<input v-model="amount.alipay_name" type="text" placeholder="收款人姓名">
</div>
</template>
</div>
<div v-if="refundData.returnAmountInfo" class="return-amount-info">
{{refundData.returnAmountInfo}}
</div>
</div>
</template>
<script>
const $ = require('yoho-jquery');
const qs = require('yoho-qs');
const productList = require('home/refund/product-list.vue');
... ... @@ -14,12 +58,42 @@
return {
title: '请选择退货商品',
list: [],
amount: {},
refundData: {}
};
},
computed: {
submitData() {
let goods = [];
this.list.forEach(product => {
if (product.checked) {
goods.push({
last_price: product.lastPrice,
remark: product.remark || '',
returned_reason: this.refundData.returnReason[product.reason.id].id + '',
evidence_images: product.imageList || [],
goods_type: product.goodsTypeId + '',
product_skn: product.productSkn,
product_skc: product.productSkc,
product_sku: product.productSku
});
}
});
return {
order_code: qs.orderId,
goods: JSON.stringify(goods),
payment: JSON.stringify(this.amount)
};
}
},
created() {
$.ajax({
url: '/home/refund/order'
url: '/home/refund/order',
data: {
orderId: qs.orderId
}
}).then(res => {
if (res.data && res.data.goodsList) {
res.data.goodsList.forEach(product => {
... ... @@ -27,13 +101,59 @@
product.reason = {
id: 0
};
product.imageList = [];
});
res.data.returnAmountMode.forEach(mode => {
if (mode.isDefault === 'Y') {
this.$set('amount.return_amount_mode', mode.id);
}
});
this.list = res.data.goodsList;
this.refundData = res.data;
}
});
},
methods: {},
methods: {
checkSubmitData() {
const data = this.submitData;
if (!data.order_code) {
return false;
}
// 退到银行卡
if (this.amount.return_amount_mode === 2) {
if (!this.amount.bank_name || !this.amount.bank_card || !this.amount.payee_name) {
return false;
}
}
// 退到支付宝
if (this.amount.return_amount_mode === 3) {
if (!this.amount.alipay_account || !this.amount.alipay_name) {
return false;
}
}
return true;
},
submit() {
if (!this.checkSubmitData()) {
alert('请填写完整退换货信息');
}
$.ajax({
method: 'POST',
url: '/home/refund/submit',
data: this.submitData
}).then(result => {
if (result.code === 200) {
console.log(result);
} else {
alert(result.message);
}
});
}
},
components: {
productList
}
... ... @@ -44,4 +164,61 @@
.main-wrap {
background: #f6f6f6;
}
.refund {
.return-amount {
padding: 0 30px;
font-size: 32px;
line-height: 90px;
background: #fff;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
}
.return-amount-info {
padding: 0 30px 30px;
font-size: 24px;
line-height: 2.5;
color: #b0b0b0;
}
.return-amount-item {
position: relative;
width: 100%;
height: 90px;
&:after {
content: "";
position: absolute;
left: 0;
bottom: -1px;
width: 690px;
height: 0;
border-bottom: 1px solid #eee;
z-index: 1;
}
.name {
float: left;
width: 160px;
color: #000;
}
input {
width: 500px;
}
span,
select {
float: right;
height: 90px;
line-height: 90px;
color: #b0b0b0;
}
select {
direction: rtl;
}
}
}
</style>
... ...
<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
... ...