Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohoblk-wap
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
沈志敏
9 years ago
Commit
2988e57b024198058192e20f4c213de24a4f9f01
1 parent
1354649b
fix bug
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
47 additions
and
371 deletions
apps/me/models/index.js
public/js/common/intercept-click.js
public/js/index.js
public/vue/component/product/filter.vue.bk
public/vue/component/product/filter/filter-sub.vue.bk
public/vue/me/exchange.vue
public/vue/me/fav-brand-list.vue
public/vue/me/fav-product-list.vue
public/vue/me/order-detail.vue
public/vue/me/refund.vue
public/vue/me/refund/status.vue
apps/me/models/index.js
View file @
2988e57
...
...
@@ -21,7 +21,7 @@ const _getUserProfileData = exports.getUserProfileData = (uid) => {
},
{
code
:
200
}).
then
(
result
=>
{
return
result
.
data
;
return
result
.
data
||
{}
;
});
};
...
...
public/js/common/intercept-click.js
View file @
2988e57
...
...
@@ -215,8 +215,7 @@ const matchHeader = (url) => {
return
header
;
};
module
.
exports
=
(
url
)
=>
{
const
intercept
=
(
url
)
=>
{
if
(
yoho
.
isApp
)
{
let
[
path
,
qs
]
=
url
.
split
(
'?'
);
...
...
@@ -272,4 +271,9 @@ module.exports = (url) => {
}
else
{
location
.
href
=
url
;
}
};
}
module
.
exports
=
{
titleMap
:
titleMap
,
intercept
:
intercept
}
...
...
public/js/index.js
View file @
2988e57
...
...
@@ -37,7 +37,7 @@ $(() => {
$body
.
on
(
'click'
,
'a[href]'
,
function
()
{
// 拦截跳转
if
(
!
$
(
this
).
hasClass
(
'no-intercept'
))
{
interceptClick
(
$
(
this
).
attr
(
'href'
));
interceptClick
.
intercept
(
$
(
this
).
attr
(
'href'
));
return
false
;
}
});
...
...
public/vue/component/product/filter.vue.bk
deleted
100644 → 0
View file @
1354649
<template>
<div class="filter" :class="{ 'filter-open': isVisible}">
<div class="filter-actions">
<a href="javascript:;" class="filter-action" @click="clearVals">清空</a>
<button class="button button-small filter-action" @click="okAction">确定</button>
</div>
<div class="filter-params">
<ul class="filter-cates">
<li class="filter-cate" v-for="classify in config" @click="entrySub($key)">
<i class="icon icon-right right"></i>
<span class="filter-cate-label">{{$key | txt }}</span>
<span class="filter-cate-val">{{params[$key] | unifyTxt $key }}</span>
</li>
</ul>
</div>
</div>
</template>
<script>
const $ = require('jquery');
const bus = require('common/vue-bus');
const Overlay = require('common/overlay');
const yoho = require('yoho');
module.exports = {
props: {
config: Object,
isVisible: Boolean,
action: '',
},
data: function() {
return {
// 选择的值
params: {},
// 确定的值
selected: {}
};
},
watch: {
isVisible(newVal) {
if (newVal) {
this.overlay.show();
} else {
this.overlay.hide();
}
}
},
methods: {
clearVals: function() {
// remove all value
this.$set('params', {});
},
/**
* 当二级筛选, 返回数据时, 调用该方法
* @param {[type]} cate [description]
* @param {[type]} val [description]
*/
setCateParams: function(cate, val) {
this.$set(`params.${cate}`, val);
},
okAction: function() {
bus.$emit('filter.change', {
val: this.params,
ref: this._uid
});
},
entrySub: function(key) {
const urlQuery = $.param({
action: this.action,
f_type: key,
old_val: ''
}).concat('&', decodeURIComponent(location.search).replace(/^\?/, ''));
const url = ['/product/sub-filter', '?', urlQuery].join('');
// console.log(location.host+url);
yoho.goNewPage({url});
}
},
filters: {
unifyTxt: function(val, category) {
let txt = '';
let arr = [];
let foo = $.noop;
if ($.isArray(val)) { // [{categoryName,..},{}..]
foo = (index, obj) => {
arr.push(obj[category + 'Name']);
};
}
$.each(val, foo);
txt = arr.join(',');
return txt;
},
txt: function(val) {
const dict = {
color: 'Color颜色',
gender: 'Gender性别',
size: 'Size尺寸',
brand: 'Brand品牌',
priceRange: 'Price价格',
groupSort: 'Category品类',
discount: 'Sale折扣',
style: 'Style风格',
ageLevel: 'Age年龄'
};
return dict[val] || '';
}
},
created() {
const self = this;
this.overlay = new Overlay({
disableScrolling: true,
onClose: function() {
self.isVisible = false;
}
});
}
};
</script>
<style>
@import "../../../scss/common/color";
.filter {
position: fixed;
z-index: 1001;
top: 0;
right: 0;
bottom: 0;
left: 20%;
background-color: #fff;
transform: translate3d(100%, 0, 0);
transition: all 0.3s 0.2s;
padding: 0 30px;
&.filter-open {
transform: translate3d(0, 0, 0);
}
}
.filter-actions {
font-size: 34px;
text-align: right;
padding: 45px 0;
}
.filter-action {
font-size: inherit;
margin-left: 40px;
}
.filter-actions,
.filter-cate {
border-bottom: 1px solid $grey;
}
.filter-cates {
list-style: none;
margin: 0;
padding: 0;
}
.filter-cate .icon-right {
margin-left: 24px;
}
.filter-cate,
.icon-right {
height: 118px;
line-height: 118px;
}
.filter-cate-label {
font-size: 36px;
font-weight: bold;
}
.filter-cate-val {
float: right;
font-size: 28px;
}
.filter-cate-val,
.filter-cate .icon {
color: $grey;
}
</style>
public/vue/component/product/filter/filter-sub.vue.bk
deleted
100644 → 0
View file @
1354649
<template>
<div>
<brand-filter v-if="type === 'brand'" :data="data" :val.sync="val"></brand-filter>
<normal-filter v-else :data="data" :val.sync="val"></normal-filter>
</div>
</template>
<script>
const $ = require('jquery');
const parser = require('yoho-qs/parse');
const tip = require('common/tip');
const brandFilter = require('./brand.vue');
const normalFilter = require('./normal.vue');
module.exports = {
props: ['type', 'data', 'val'],
components: {
brandFilter,
normalFilter
},
watch: {
val: function(newV, oldV) {
console.log(`type: ${this.type}, value: ${newV}`);
}
},
created() {
const self = this;
const urlQuery = parser(decodeURIComponent(location.search.replace(/^\?/, '')));
const filterUrl = urlQuery.action;
this.type = urlQuery.f_type;
this.val = urlQuery.old_val;
delete urlQuery.f_type;
delete urlQuery.old_val;
delete urlQuery.action;
$.get(filterUrl, urlQuery)
.done(result => {
if (!result.data) {
tip('加载失败~');
}
self.$set('data', result.data.filter[self.type]);
})
.fail(()=>{
tip('加载失败~');
});
}
};
</script>
<style>
@import "../../../../scss/common/_color.css";
.filter-detail {
$w: 30px;
list-style: none;
margin: 0;
padding: 0;
font-size: 40px;
color: $grey;
.item,
.index {
margin-left: $w;
margin-right: $w;
border-bottom: 1px solid $division;
}
.index {
font-size: 32px;
font-weight: bold;
color: $black;
height: 60px;
line-height: 60px;
}
.item.active .item-inner {
color: $black;
background-color: #f6f6f6;
}
.item-inner {
margin-left: -$w;
margin-right: -$w;
padding: 0 $w;
height: 100px;
line-height: 100px;
}
}
</style>
public/vue/me/exchange.vue
View file @
2988e57
...
...
@@ -38,6 +38,7 @@
const tip = require('common/tip');
const bus = require('common/vue-bus');
const modal = require('common/modal');
const interceptClick = require('common/intercept-click');
const yoho = require('yoho');
const productList = require('me/return/list.vue');
...
...
@@ -244,14 +245,13 @@
data
}).then(result => {
if (result.code === 200) {
yoho.goNewPage({
url: `/me/return/exchange/detail/${result.data.applyId}`,
header: {
headerid: 1,
left: {
action: [location.protocol, '//', location.host , '/me/return'].join('')
}
}
let header = interceptClick.titleMap[1];
header.left.action = location.origin + '/me/return'
header.title.des = '换货状态';;
return yoho.goNewPage({
header: header,
url: location.origin + `/me/return/exchange/detail/${result.data.applyId}`
});
} else {
modal.alert(result.message);
...
...
public/vue/me/fav-brand-list.vue
View file @
2988e57
...
...
@@ -37,6 +37,7 @@
<script>
const $ = require('jquery');
const tip = require('common/tip');
const interceptClick = require('common/intercept-click');
const yoho = require('yoho');
module.exports = {
...
...
@@ -207,34 +208,17 @@
},
created: function() {
let _this = this;
yoho.addNativeMethod('editModel', function() {
_this.hideDelBth();
_this.editmodel = !_this.editmodel;
if (yoho.isApp) {
yoho.goNewPage({
header: {
headerid: '5',
left: {
action: ''
},
ltitle: {
des: '商品',
action: location.origin + '/me/collection'
},
rtitle: {
des: '品牌',
action: location.origin + '/me/collection?tab=brand'
},
right: {
des: _this.editmodel ? '完成' : '编辑',
action: 'editModel'
},
defaultSelectedIndex: '1'
},
url: location.href
});
}
let header = interceptClick.titleMap[5];
header.defaultSelectedIndex = '1';
header.right.des = _this.editmodel ? '完成' : '编辑';
return yoho.goPageView({
header: header
});
});
}
};
...
...
public/vue/me/fav-product-list.vue
View file @
2988e57
...
...
@@ -42,6 +42,7 @@
<script>
const $ = require('jquery');
const tip = require('common/tip');
const interceptClick = require('common/intercept-click');
const yoho = require('yoho');
module.exports = {
...
...
@@ -228,30 +229,14 @@
yoho.addNativeMethod('editModel', function() {
_this.hideDelBth();
_this.editmodel = !_this.editmodel;
if (yoho.isApp) {
yoho.goNewPage({
header: {
headerid: '5',
left: {
action: ''
},
ltitle: {
des: '商品',
action: location.origin + '/me/collection'
},
rtitle: {
des: '品牌',
action: location.origin + '/me/collection?tab=brand'
},
right: {
des: _this.editmodel ? '完成' : '编辑',
action: 'editModel'
},
defaultSelectedIndex: '0'
},
url: location.href
});
}
let header = interceptClick.titleMap[5];
header.defaultSelectedIndex = '0';
header.right.des = _this.editmodel ? '完成' : '编辑';
return yoho.goPageView({
header: header
});
});
}
};
...
...
public/vue/me/order-detail.vue
View file @
2988e57
...
...
@@ -180,7 +180,7 @@
}
}).then(result => {
if (result.code === 200) {
interceptClick('/me/order?type=1');
interceptClick
.intercept
('/me/order?type=1');
return false;
} else {
tip(result.message);
...
...
@@ -213,7 +213,7 @@
applyRefund() {
genderSel.show(function(item) {
if (item.url) {
interceptClick(item.url);
interceptClick
.intercept
(item.url);
}
return false;
});
...
...
public/vue/me/refund.vue
View file @
2988e57
...
...
@@ -52,8 +52,8 @@
const $ = require('jquery');
const qs = require('yoho-qs');
const modal = require('common/modal');
const interceptClick = require('common/intercept-click');
const yoho = require('yoho');
const productList = require('me/return/list.vue');
const reasonConfig = require('me/return/reason');
...
...
@@ -159,14 +159,13 @@
data: this.submitData
}).then(result => {
if (result.code === 200) {
yoho.goNewPage({
url: `/me/return/refund/detail/${result.data.applyId}`,
header: {
headerid: 1,
left: {
action: [location.protocol, '//', location.host , '/me/return'].join('')
}
}
let header = interceptClick.titleMap[1];
header.left.action = location.origin + '/me/return'
header.title.des = '退货状态';;
return yoho.goNewPage({
header: header,
url: location.origin + `/me/return/refund/detail/${result.data.applyId}`
});
} else {
modal.alert(result.message);
...
...
public/vue/me/refund/status.vue
View file @
2988e57
...
...
@@ -109,6 +109,7 @@
const $ = require('jquery');
const util = require('common/util');
const tip = require('common/tip');
const interceptClick = require('common/intercept-click');
const yoho = require('yoho');
module.exports = {
...
...
@@ -141,25 +142,7 @@
}
}).then(function(data) {
if (data.code === 200) {
const pageurl = '/me/return';
if (yoho.isApp) {
yoho.goNewPage({
header: {
headerid: '1',
left: {
action: ''
},
title: {
des: '退/换货',
action: ''
}
},
url: location.origin + pageurl
});
} else {
location.href = pageurl;
}
interceptClick.intercept('/me/return');
} else if (data.code === 400) {
tip(data.message);
} else {
...
...
Please
register
or
login
to post a comment