Authored by ccbikai

Merge branch 'develop' of git.yoho.cn:fe/yohoblk-wap into develop

... ... @@ -25,8 +25,8 @@ module.exports = {
});
},
/* 获取品牌介绍 */
getBrandIntro: (req, res) => {
/* 获取品牌店铺介绍 */
getShopInfo: (req, res) => {
brandModel.getBrandData({
domain: req.query.domain,
uid: req.user.uid
... ... @@ -86,8 +86,8 @@ module.exports = {
/* 收藏店铺 */
collectShop: (req, res) => {
brandModel.collectShopData({
shopId: req.query.shopId,
favId: req.query.favId,
shopId: req.body.shopId,
favId: req.body.favId,
uid: req.user.uid,
type: 'shop'
}).then(result => {
... ...
... ... @@ -5,11 +5,14 @@
* Time: 13:51
*/
'use strict';
const path = require('path');
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const brandApi = require('./brand-api');
const logger = global.yoho.logger;
const _ = require('lodash');
const processProductList = require(path.join(global.utils, '/beautify/product')).processProductList;
const camelCase = global.yoho.camelCase;
/**
* 处理品牌一览品牌列表数据
... ... @@ -84,8 +87,7 @@ const getBrandData = params => {
showBrandLogo: false,
brandLogo: subResult[0].data.shop_logo,
brandName: subResult[0].data.shop_name,
brandIntro: subResult[0].data.shop_intro,
showMore: false
brandIntro: subResult[0].data.shop_intro
});
return finalResult;
} else {
... ... @@ -112,9 +114,18 @@ const getBrandData = params => {
const getBrandShopGoodsData = params => {
let finalResult = {};
/* TODO 获取店铺商品暂时没有接口 */
return api.all([brandApi.getBrandShopGoodsOriginData(params)]).then(result => {
if (result[0].code === 200) {
Object.assign(finalResult, {
data: {
productList: processProductList(result[0].data.productList)
}
});
} else {
logger.error('getBrandShopGoodsOriginData api code no 200');
}
return camelCase(finalResult);
});
};
... ... @@ -124,15 +135,8 @@ const getBrandShopGoodsData = params => {
* @returns {*|Promise.<TResult>}
*/
const collectShopData = params => {
let finalResult = {};
/* TODO 收藏店铺接口返回状态处理*/
return api.all([brandApi.collectShopOriginData(params)]).then(result => {
if (result[0].code === 200) {
} else {
logger.error('collectShopOriginData api code no 200');
}
return result[0];
});
};
... ... @@ -248,5 +252,6 @@ module.exports = {
getBrandShopGoodsData,
getBrandListData,
getCateListData,
getCateResource
getCateResource,
collectShopData
};
... ...
... ... @@ -17,14 +17,14 @@ router.get('/', channel.index); // 首页
router.get('/channel/resources.json', channel.resources); // 资源位接口
router.get('/channel/goods.json', channel.goods); // 首页查询商品列表
router.get('/brand', brand.index); // 店铺首页
router.get('/get-brand-intro', brand.getBrandIntro); // 店铺介绍
router.get('/get-shop-info', brand.getShopInfo); // 店铺介绍
router.post('/get-brand-shop-goods', brand.getBrandShopGoods); // 店铺介绍
router.get('/brand-list', brand.brandList); // 品牌列表页
router.get('/get-brand-list', brand.getBrandList); // 获取品牌列表数据
router.get('/brand-share', brand.brandShare); // 获取品牌列表数据
router.get('/cate-resource', brand.cateResource); // 品类资源位页面
router.get('/collect-shop', brand.collectShop); // 收藏品牌店铺
router.post('/collect-shop', brand.collectShop); // 收藏品牌店铺
router.get('/cate', brand.cate); // 全部分类
router.get('/get-cate-list', brand.getCateList); // 全部分类数据列表
... ...
... ... @@ -124,6 +124,26 @@ const order = {
module: 'home',
page: 'order'
});
},
// 订单-物流
logistic: (req, res) => {
res.render('order-logistic', {
module: 'home',
page: 'order-logistic',
title: '物流详情'
});
},
// API- 订单-物流
getOrderLogisticdate: (req, res) => {
orderModel.getOrderLogisticdate({
uid: req.user.uid || '',
type: req.query.type || '',
order_code: req.query.orderCode
}).then(result => {
res.json(result);
});
}
};
... ...
... ... @@ -9,6 +9,7 @@ const api = global.yoho.API;
// const serviceAPI = global.yoho.ServiceAPI;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
/**
* 获取订单列表数据
... ... @@ -89,3 +90,33 @@ exports.deleteOrder = (orderCode, uid) => {
return result;
});
};
/**
* 查看订单物流详情
* @param {[int]} order_code 订单号
* @param {[int]} uid 用户uid
* @param {[string]} type 退换货物流(退货:refund,换货:change)
* @return {[array]}
*/
exports.getOrderLogisticdate = (params) => {
let method;
if (_.isEmpty(params.order_code)) {
return [];
}
// getNewExpress:退换货物流,li:订单物流
method = _.indexOf(['refund', 'change'], params.type) >= 0 ?
'app.express.getNewExpress' : 'app.express.li';
return api.get('', Object.assign({
method: method
}, params)).then(result => {
if (result.code === 200) {
return result.data;
}
return [];
});
};
... ...
... ... @@ -51,4 +51,7 @@ router.get('/exchange/order', exchange.order);
router.get('/about-us', home.aboutUs); // 个人中心 - 关于我们
router.get('/logistic', order.logistic); // 个人中心 - 订单物流详情页面
router.get('/get-order-logistic-date', order.getOrderLogisticdate); // 个人中心 - 订单物流详情数据
module.exports = router;
... ...
<div class="order-logistic" id="order-logistic">
<order-logistic></order-logistic>
</div>
\ No newline at end of file
... ...
const Vue = require('yoho-vue');
const orderLogistic = require('home/order-logistic.vue');
new Vue({
el: '#order-logistic',
data: {
company_id: ''
},
components: {
'order-logistic': orderLogistic
}
});
... ...
... ... @@ -11,10 +11,6 @@
const tip = require('common/tip');
window.yohoWapInterface = {
headerRightTopBtn: function() {}
};
const yoho = {
/**
* 判断是否是 APP
... ... @@ -28,7 +24,7 @@ const yoho = {
/**
* 跳转至指定index的tab(从0开始)
* @param args 传递给 APP 的参数
* @param args 传递给 APP 的参数 {"index":tab_index}
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
... ... @@ -45,7 +41,7 @@ const yoho = {
/**
* 跳转至登陆页面
* @param args 传递给 APP 的参数
* @param args 传递给 APP 的参数 {""}
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
... ... @@ -61,8 +57,42 @@ const yoho = {
},
/**
* 退出登录,清除本地用户数据
* @param args {""}
* @param success
* @param fail
*/
goLogout(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.loginout',
arguments: args
});
} else {
tip('暂不支持,请在BLK应用中打开');
}
},
/**
* 设置shoppingkey
* @param args 传递给 APP 的参数 {"shoppingkey":""}
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
goShopingKey(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.shoppingkey',
arguments: args
});
} else {
tip('暂不支持,请在BLK应用中打开');
}
},
/**
* 跳转至购物车页面
* @param args 传递给 APP 的参数
* @param args 传递给 APP 的参数 {""}
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
... ... @@ -78,8 +108,8 @@ const yoho = {
},
/**
* 跳转至地址管理页面
* @param args 传递给 APP 的参数
* 跳转地址页面 1:地址选择页面 2:地址管理页面
* @param args 传递给 APP 的参数 {"type":"1"}
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
... ... @@ -95,8 +125,8 @@ const yoho = {
},
/**
* 跳转至图片浏览页面
* @param args 传递给 APP 的参数
* 跳转至图片浏览页面;images:浏览图片的url index:点击的图片序号
* @param args 传递给 APP 的参数 {"images":[imgUrl1,imgUrl2...],"index":"1"}
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
... ... @@ -113,7 +143,7 @@ const yoho = {
/**
* 跳转至新页面(页面内容为html)
* @param args 传递给 APP 的参数
* @param args 传递给 APP 的参数 {"url":""}
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
... ... @@ -130,7 +160,7 @@ const yoho = {
/**
* 跳转至支付页面
* @param args 传递给 APP 的参数
* @param args 传递给 APP 的参数 {"orderid":"098768"}
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
... ... @@ -146,8 +176,8 @@ const yoho = {
},
/**
* 回到上一个原生界面
* @param args
* 返回上一级页面
* @param args {}
* @param success
* @param fail
*/
... ... @@ -164,7 +194,7 @@ const yoho = {
/**
* 分享
* @param args
* @param args {"title":"标题","des":"描述","img":"icon地址","url":"网页地址"}
* @param success
* @param fail
*/
... ... @@ -180,12 +210,46 @@ const yoho = {
},
/**
* 跳转到搜索页面
* @param args {}
* @param success
* @param fail
*/
goSearch(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.search',
arguments: args
});
} else {
tip('暂不支持,请在BLK应用中打开');
}
},
/**
* 跳转到设置页面
* @param args {}
* @param success
* @param fail
*/
goSetting(args, success, fail) {
if (this.isApp) {
window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, {
method: 'go.setting',
arguments: args
});
} else {
tip('暂不支持,请在BLK应用中打开');
}
},
/**
* 原生调用 JS 方法
* @param name 方法名
* @param callback 回调
*/
addNativeMethod(name, callback) {
window.yohoWapInterface[name] = callback;
window.yohoInterface[name] = callback;
}
};
... ...
<template>
<brand-top v-bind:share-data="shareData"></brand-top>
<brand-shop-top></brand-shop-top>
<brand-top-bar v-bind:share-data="shareData"></brand-top-bar>
<brand-shop-top v-bind:shop-info="shopInfo"></brand-shop-top>
<goods-list v-bind:data="productList"></goods-list>
<drawer v-ref:drawer>
<filter :config.once="filterConfig"></filter>
... ... @@ -9,10 +9,11 @@
<script>
const $ = require('yoho-jquery');
const qs = require('yoho-qs');
const bus = require('common/vue-bus');
const tip = require('common/tip');
const brandTop = require('channel/brand-top.vue');
const brandShopTop = require('channel/brand-shop-top.vue');
const brandTopBar = require('channel/brand-top-bar.vue'); // 顶部栏,包括返回、收藏店铺、分享,打开筛选页面
const brandShopTop = require('channel/brand-shop-top.vue'); // 店铺头部信息
const goodsList = require('product/list.vue');
const drawer = require('product/drawer.vue');
const filter = require('product/filter.vue');
... ... @@ -22,11 +23,10 @@
module.exports = {
data() {
return {
shareData: {
title: 'BLK',
link: 'm.blk.com',
img: 'https://img11.static.yhbimg.com/brandLogo/2016/04/13/15/010eb8606c1072fd2e769c62567d3bbe93.png?imageView2/2/w/140/h/140'
},
domain: qs.domain,
shareData: {}, // 分享相关数据
shopInfo: {}, // 店铺介绍相关数据
sortConfig: global.sortConfig,
filterConfig: global.filterConfig,
... ... @@ -45,6 +45,10 @@
};
},
watch: {
domain: function() {
this.getShopInfo();
},
/* sort 和 filter 改变 都会触发 重新搜索 (想象成清空所有分页) */
sort: function() {
this.research();
... ... @@ -54,6 +58,28 @@
}
},
methods: {
/* 获取店铺简介相关数据 */
getShopInfo() {
$.get({
url: '/get-shop-info',
data: { domain: this.domain }
}).done(result => {
if (result) {
this.shopInfo = result;
this.shopInfo.showBrandInfo = true;
this.shareData = {
title: result.brandName,
link: '/brand-share?domain=' + this.domain,
img: result.brandBg
};
} else {
this.shopInfo.showBrandInfo = false;
}
}).fail(() => {
tip('网络错误');
});
},
getProductList() {
let data = {};
... ... @@ -106,14 +132,16 @@
}
},
components: {
brandTop,
brandTopBar,
brandShopTop,
goodsList,
drawer,
filter
},
created() {
this.search();
this.getShopInfo();
// this.search();
bus.$on('list.paging', function() {
this.search();
});
... ...
<template>
<div v-if="showBrandInfo" class="brand-top-box" v-bind:style="{ 'background-image': `url(${brandIntro.brandBg})` }">
<div v-if="shopInfo.showBrandInfo" class="brand-top-box" v-bind:style="{ 'background-image': `url(${shopInfo.brandBg})` }">
<div class="brand-bottom">
<img v-if="brandIntro.showBrandLogo" v-lazy="brandIntro.brandLogo" alt="{{ brandIntro.brandName }}">
<div v-else class="brand-title">{{ brandIntro.brandName }}</div>
<img v-if="shopInfo.showBrandLogo" v-lazy="brandIntro.brandLogo" alt="{{ shopInfo.brandName }}">
<div v-else class="brand-title">{{ shopInfo.brandName }}</div>
<hr>
<div v-show="showMore" transition="brand-intro" v-bind:class="{ 'brand-short': !showMore }">{{ brandIntro.brandIntro }}</div>
<div v-show="showMore" transition="brand-intro" v-bind:class="{ 'brand-short': !showMore }">{{ shopInfo.brandIntro }}</div>
</div>
<div v-if="!showMore" class="showmore expand" @click="introTrans()"><span class="icon">&#xe602;</span></div>
<div v-else class="showmore collapse" @click="introTrans()"><span class="icon">&#xe617;</span></div>
... ... @@ -42,7 +42,7 @@
transition: all 0.3s ease;
font-size: 16px;
line-height: 32px;
width: 82%;
width: 90%;
height: 220px;
overflow-y: auto;
}
... ... @@ -57,7 +57,7 @@
display: -webkit-box !important;
font-size: 16px;
line-height: 32px;
width: 82%;
width: 90%;
text-overflow: ellipsis;
overflow-y: hidden;
display: -webkit-box;
... ... @@ -77,47 +77,21 @@
}
</style>
<script>
const $ = require('yoho-jquery');
const tip = require('common/tip');
const qs = require('yoho-qs');
module.exports = {
props: {
shopInfo: {
type: Object
}
},
data() {
return {
brandIntro: {},
showMore: false,
showBrandInfo: false
showMore: false
};
},
watch: {
domain() {
this.getShopIntro();
}
},
methods: {
getShopIntro() {
let data = {
domain: qs.domain
};
$.ajax({
url: '/get-brand-intro',
data: data
}).then(result => {
if (result) {
this.showBrandInfo = true;
this.brandIntro = result;
}
}).fail(() => {
tip('网络错误');
});
},
introTrans() {
this.showMore = this.showMore !== true;
}
},
created() {
this.getShopIntro();
}
};
</script>
... ...
... ... @@ -2,7 +2,7 @@
<div class="top-box clearfix">
<span class="icon back" @click="goBack()">&#xe606;</span>
<div class="right">
<span class="icon" v-bind:class="{'favorite': isFav}" @click="collectShop()">&#xe609;</span>
<span class="icon" v-bind:class="{'favorite': shareData.isFav}" @click="collectShop()">&#xe609;</span>
<span class="icon share" @click="goShare()">&#xe60e;</span>
<span class="icon filter" @click="showFilter()">&#xe60b;</span>
</div>
... ... @@ -59,32 +59,30 @@
},
methods: {
goShare() {
// TODO 这边应该需要一个分享后的页面链接,需要与 APP 确定分享要传的参数
let link = this.shareData.title +
this.shareData.link +
this.shareData.img;
yoho.goShare({link: link}, function() {}, function() {});
yoho.goShare(this.shareData, function() {}, function() {});
},
goBack() {
yoho.goBack({}, function() {}, function() {});
},
/* 收藏或者取消收藏店铺 */
collectShop() {
/* TODO 获取数据策略待确定 */
let data = {
shopId: this.shareData.shopId,
favId: this.shareData.shopId,
isFav: this.shareData.isFav
};
$.ajax({
$.post({
url: '/collect-shop',
data: data
}).done(result => {
/* TODO 处理收藏状态 */
if (result.code === 200) {
this.shareData.isFav = this.shareData.isFav !== true;
} else {
tip('网络错误');
}
}).fail(() => {
tip('网络错误');
});
... ...
... ... @@ -15,8 +15,7 @@
data() {
return {
page: 'brand',
contentCode: contentCode.brand[qs.brand || 'men'],
channel: qs.channel
contentCode: contentCode.cate[qs.channel || 'men']
};
},
components: {
... ...
<template>
<button @click="yoho.goTap()">跳转 TAP</button>
<button @click="yoho.goLogin()">跳转登录</button>
<button @click='yoho.goTap({"index":2})'>TAP</button>
<button @click="yoho.goLogin()">登录</button>
<button @click="yoho.goLogout()">退出登录</button>
<button @click='yoho.goShopingKey("shoppingkey":"123456789")'>设置ShopingKey</button>
<button @click="yoho.goShopingCart()">跳转购物车</button>
<button @click="yoho.goAddress()">跳转地址管理列表</button>
<button @click="yoho.goImageBrowser()">跳转图片浏览</button>
<button @click="yoho.goNewPage()">跳转新的 WAP 页面</button>
<button @click="yoho.goPay()">跳转支付页面</button>
<button @click='yoho.goAddress({"type":"1"})'>地址选择页面</button>
<button @click='yoho.goAddress({"type":"2"})'>地址管理页面</button>
<button @click='yoho.goImageBrowser({"images":["http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg"], {"index": "1"})'>图片浏览</button>
<button @click='yoho.goNewPage("url":"http://m.yohoblk.com")'>新页面</button>
<button @click="yoho.goPay()">支付</button>
<button @click="yoho.goBack()">返回</button>
<button @click='yoho.goShare({"title":"标题","des":"描述","img":"http://7xwj52.com1.z0.glb.clouddn.com/brandbg.jpg","url":"http://m.yohoblk.com"})'>分享</button>
<button @click='yoho.goSearch()'>搜索</button>
<button @click='yoho.goSetting()'>设置</button>
</template>
<style>
button {
... ...
<template>
<div class="logistic-page yoho-page">
<div class="overview">
<div class="left" >
<a href="{{logisticDate.url}}">
<img class="icon" v-bind:src="logo" />
</a>
</div>
<div class="right">
<div>
<span class='info'>物流公司:</span>
<span >{{logisticDate.caption}}</span>
</div>
<div>
<span class='info'>快递单号:</span>
<span>{{logisticDate.express_number}}</span>
</div>
</div>
</div><!--end overview-->
<div class="title">
<span>物流详情</span>
</div>
<div class="detail">
<div class="timeline-box" v-for="(index, detail) in logisticDate.express_detail">
<span class="timeline-node"></span>
<div class="timeline-info">
<div class="timeline-info-row">
{{detail.accept_address}}
</div>
<div class="timeline-info-row">
{{detail.acceptTime}}
</div>
</div>
</div>
</div><!--end detail-->
</div><!--end logistic-page-->
</template>
<style>
$logistic_gray: #f0f0f0;
$border_color_strong: #e5e5e5;
$border_color_light: #eee;
.logistic-page {
background-color: $logistic_gray;
.overview {
height: 120px;
line-height: 120px;
width: 100%;
margin-bottom: 40px;
background-color: #fff;
color: #464646;
border-bottom: 1px solid $border_color_strong;
.left {
width: 19%;
float: left;
text-align: center;
height: 100%;
.icon {
width: 88px;
height: 88px;
margin: 0 auto;
background-size: 100%;
background-repeat: no-repeat;
background-position: center;
margin-top: 16px;
}
}
.right {
width: 81%;
float: left;
padding-top: 20px;
padding-bottom: 20px;
height: 80px;
div {
height: 40px;
line-height: 44px;
color: #595959;
font-size: 24px;
}
}
.info {
padding-right: 4px;
}
}
.title {
height: 112px;
line-height: 112px;
background-color: #fff;
padding-left: 40px;
font-size: 40px;
}
.detail {
background-color: #fff;
padding-left: 80px;
margin-bottom: 40px;
}
.timeline-box {
border-left: 1px solid $border_color_strong;
position: relative;
padding-left: 52px;
}
.timeline-node {
position: absolute;
top: 32px;
left: -9.04444px;
display: inline-block;
width: 16.4px;
height: 16.4px;
background-color: $border_color_strong;
border-radius: 100%;
}
.timeline-box:first-child {
.timeline-node {
background-color: #989898;
}
.timeline-info-row {
color: #606060;
}
}
.timeline-info {
padding: 20px 0;
border-bottom: 1px solid $border_color_strong;
}
.timeline-box:last-child {
.timeline-info {
border: none;
}
}
.timeline-info-row {
min-height: 40px;
line-height: 40px;
font-size: 28px;
color: #bababa;
padding-right: 32px;
}
}
</style>
<script>
const $ = require('yoho-jquery');
const qs = require('yoho-qs');
const tip = require('common/tip');
module.exports = {
props: [],
data() {
return {
logisticDate: [],
logo: ''
};
},
methods: {
getLogisticDate() {
let data = {
orderCode: qs.order_code || '',
type: qs.type || '',
};
$.ajax({
url: '/home/get-order-logistic-date',
data: data
}).then(result => {
this.logisticDate = result;
if (result && result.logo) {
this.logo = result.logo;
}
}).fail(() => {
tip('网络错误');
});
}
},
created() {
this.getLogisticDate();
}
};
</script>
... ...