Authored by 陈峰

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-app-web into release/1.0

... ... @@ -212,17 +212,9 @@ const yoho = {
* @param success 调用成功的回调方法
* @param fail 调用失败的回调方法
*/
goNewPage(args, success, fail) {
if (this.isApp && window.yohoInterface) {
if (args.header && args.header.headerid === '-1') {
args.showScrollbar = 'no';
}
goNewPage(args) {
if (this.isYohoBuy) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.newPage',
arguments: args
});
} else if (this.isYohoBuy) {
let url = args.url;
if (url.indexOf('openby:') < 0) {
... ... @@ -561,6 +553,32 @@ const yoho = {
// tip(tipInfo);
}
},
goPage: function(action, params) {
var url = window.location.protocol + '//m.yohobuy.com/';
if (this.isYohoBuy && window.yohoInterface) {
url = url + '?openby:yohobuy=' + JSON.stringify({
action,
params
});
}
$appLink.href = url;
$appLink.click();
},
finishPage(args, success, fail) {
if (this.isYohoBuy && window.yohoInterface) {
window.yohoInterface.triggerEvent(success || nullFun, fail || nullFun, {
method: 'go.finish',
arguments: args
});
} else {
// tip(tipInfo);
}
}
};
... ...
... ... @@ -14,10 +14,10 @@
<p class="time">{{item.coupon_validity}}</p>
<p class="use-intro" v-if="item.notes" @click="onClickTip">
<div class="use-intro" v-if="item.notes" @click="onClickTip">
<span class="show-intro-btn">使用说明</span>
<span :class="introClass"></span>
</p>
</div>
<span class="tip"></span>
</div>
... ... @@ -63,7 +63,7 @@ export default {
this.show = !this.show;
},
onUseClick() {
this.$yoho.goCouponProductList({
this.$yoho.goPage('go.couponProductList', {
coupon_code: this.item.coupon_code,
coupon_id: this.item.coupon_id,
title: '优惠活动商品',
... ...
... ... @@ -19,7 +19,6 @@
</template>
<script>
export default {
name: 'Headers',
props: {
... ... @@ -81,7 +80,7 @@ export default {
];
},
onBackClick() {
this.$yoho.goNewBack({});
this.$yoho.finishPage({});
},
onHelpClick() {
this.$yoho.goNewPage({
... ...
<template>
<div :class="classes">
<div class="yoho-coupon-filter-bar">
<div
:class="tabCls(item)"
v-for="(item, index) in navList"
@click="handleChange(index)"
:key="index"
>{{item.label}}
<span v-if="getNum[index]">({{getNum[index]}})</span>
<span :class="filterClass" v-if="item.filter"></span>
<div>
<div :class="classes">
<div class="yoho-coupon-filter-bar">
<div
:class="tabCls(item)"
v-for="(item, index) in navList"
@click="handleChange(index)"
:key="index"
>{{item.label}}
<span v-if="getNum[index]">({{getNum[index]}})</span>
<span :class="filterClass" v-if="item.filter"></span>
</div>
</div>
</div>
<div class="filter-wrapper" v-if="showFilter">
<div class="filter-mask" @click="onMaskClick"></div>
<FilterBar :list="filterList" v-model="selectFilterId" class="filter"></FilterBar>
</div>
</div>
</template>
<script>
import {createNamespacedHelpers} from 'vuex';
const {mapGetters} = createNamespacedHelpers('coupon/yoho');
import FilterBar from '../filter-bar';
const {mapGetters, mapState} = createNamespacedHelpers('coupon/yoho');
export default {
name: 'ClassicTabs',
... ... @@ -30,6 +37,12 @@ export default {
default() {
return [];
}
},
filterId: {
type: [String, Number],
default() {
return 0;
}
}
},
data() {
... ... @@ -37,13 +50,15 @@ export default {
prefixCls: 'yoho-tabs',
navList: this.data,
activeKey: this.value,
showFilter: false
showFilter: false,
selectFilterId: this.filterId,
};
},
computed: {
classes() {
return [`${this.prefixCls}`];
},
...mapState(['filterList']),
filterClass() {
if (this.showFilter) {
return ['iconfont', 'icon-up'];
... ... @@ -57,7 +72,8 @@ export default {
handleChange(index) {
const nav = this.navList[index];
if (this.activeKey === nav.label) {
// 第二次点击
if (this.activeKey === nav.label && index === 0) {
this.showFilter = !this.showFilter;
this.$emit('on-filter-change', this.showFilter);
return;
... ... @@ -74,11 +90,21 @@ export default {
}
];
},
onMaskClick() {
this.showFilter = false;
},
},
watch: {
value(val) {
this.activeKey = val;
},
selectFilterId(newVal) {
this.$emit('update:filterId', newVal);
this.onMaskClick();
}
},
components: {
FilterBar
}
};
</script>
... ... @@ -88,6 +114,7 @@ $yoho-tab: yoho-tab;
.#{$yoho-tab}s {
width: 100%;
position: relative;
}
.yoho-coupon-filter-bar {
... ... @@ -121,5 +148,26 @@ $yoho-tab: yoho-tab;
color: #444;
}
}
.filter-wrapper {
width: 100%;
height: 100%;
position: absolute;
top: 180px;
z-index: 4;
}
.filter {
position: absolute;
top: 0;
}
.filter-mask {
position: absolute;
width: 100%;
top: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
}
</style>
... ...
<template>
<div :class="prefixCls" v-show="show"><slot></slot></div>
<div :class="prefixCls" v-if="show">
<slot></slot>
</div>
</template>
<script>
const prefixCls = 'yoho-tabs-tabpane';
const prefixCls = 'yoho-tabs-tabpane';
export default {
name: 'TabPane',
props: {
index: {
type: String
},
label: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
}
},
data () {
return {
prefixCls: prefixCls,
show: true
};
},
methods: {
updateNav () {
this.$parent.updateNav();
}
},
watch: {
label () {
this.updateNav();
},
disabled () {
this.updateNav();
}
},
created () {
this.updateNav();
}
export default {
name: 'TabPane',
props: {
label: {
type: String,
default: ''
},
disabled: {
type: Boolean,
default: false
}
},
data() {
return {
prefixCls: prefixCls,
show: this.disabled
};
},
methods: {
updateNav() {
this.$parent.updateNav();
}
},
created() {
this.updateNav();
}
};
</script>
<style lang="scss" scoped>
.yoho-tabs-tabpane {
background: #F0F0F0;
width: 100%;
height: 100%;
}
.yoho-tabs-tabpane {
background: #f0f0f0;
width: 100%;
height: 100%;
}
</style>
... ...
... ... @@ -2,10 +2,10 @@
<div :class="classes">
<slot name="tabs" v-bind:navList="navList">
<div :class="[prefixCls + '-bar']">
<span class="back">
<span class="back" @click="onBackClick">
<i class="iconfont fontcls">&#xe763;</i>
</span>
<span class="help">
<span class="help" @click="onHelpClick">
<i class="iconfont fontcls">&#xe630;</i>
</span>
<div>
... ... @@ -26,7 +26,7 @@
<script>
export default {
name: "Tabs",
name: 'Tabs',
props: {
value: {
type: [String, Number]
... ... @@ -34,7 +34,7 @@ export default {
},
data() {
return {
prefixCls: "yoho-tabs",
prefixCls: 'yoho-tabs',
navList: [],
activeKey: this.value
};
... ... @@ -44,7 +44,7 @@ export default {
return [`${this.prefixCls}`];
},
contentClasses() {
return [`yoho-tabs-pane`];
return ['yoho-tabs-pane'];
},
contentStyle() {
return [];
... ... @@ -60,7 +60,9 @@ export default {
disabled: pane.disabled
});
if (!pane.currentName) pane.currentName = index;
if (!pane.currentName) {
pane.currentName = index;
}
if (index === 0) {
if (!this.activeKey) {
... ... @@ -72,7 +74,7 @@ export default {
this.updateStatus();
},
getTabs() {
return this.$children.filter(item => item.$options.name === "TabPane");
return this.$children.filter(item => item.$options.name === 'TabPane');
},
updateStatus() {
const tabs = this.getTabs();
... ... @@ -83,19 +85,27 @@ export default {
const nav = this.navList[index];
this.activeKey = nav.name;
this.$emit("input", nav.name);
this.$emit('input', nav.name);
},
tabCls(item) {
return [
"yoho-tab",
'yoho-tab',
{
[`yoho-tab-active`]: item.name === this.activeKey
['yoho-tab-active']: item.name === this.activeKey
}
];
},
onBackClick() {
this.$yoho.finishPage({});
},
onHelpClick() {
this.$yoho.goNewPage({
url: window.location.protocol + '//m.yohobuy.com/service/qaDetail?keyword=%E4%BC%98%E6%83%A0%E5%88%B8&sonId=181'
});
}
},
watch: {
activeKey(val) {
activeKey() {
this.updateStatus();
},
value(val) {
... ... @@ -103,7 +113,7 @@ export default {
}
},
created() {
// this.updateNav();
this.updateNav();
}
};
</script>
... ... @@ -120,7 +130,7 @@ $yoho-tab: yoho-tab;
display: inline-block;
width: 200px;
height: 56px;
font-size: 12px;
font-size: 24px;
color: white;
border: 1px solid white;
box-sizing: border-box;
... ... @@ -129,6 +139,10 @@ $yoho-tab: yoho-tab;
line-height: 56px;
}
.#{$yoho-tab} + .#{$yoho-tab} {
border-left: none;
}
.#{$yoho-tab}s-bar {
width: 100%;
height: 90px;
... ... @@ -136,12 +150,11 @@ $yoho-tab: yoho-tab;
background: #3a3a3a;
justify-content: center;
align-items: center;
position: fixed;
z-index: 4;
}
.#{$yoho-tab}-active {
color: #444444;
color: #444;
background-color: white;
}
... ... @@ -156,13 +169,23 @@ $yoho-tab: yoho-tab;
}
.back {
display: inline-block;
width: 90px;
height: 90px;
line-height: 90px;
position: absolute;
left: 20px;
left: 0;
text-align: center;
}
.help {
display: inline-block;
width: 90px;
height: 90px;
line-height: 90px;
position: absolute;
right: 20px;
right: 0;
text-align: center;
}
</style>
... ...
import Ufo from './ufo';
import Yoho from './yoho';
import Header from './components/header';
import YohoPage from './list';
export default [{
path: '/mapp/coupon',
component: Header,
children: [Ufo, Yoho]
path: '/mapp/coupon/yoho.html',
component: YohoPage,
}];
... ...
<template>
<LayoutApp>
<Tabs>
<template slot="panes">
<TabPane label="有货优惠券" :disable="true">
<YohoPage></YohoPage>
</TabPane>
<TabPane label="UFO优惠券" :disable="true">
<UfoPage></UfoPage>
</TabPane>
</template>
</Tabs>
</LayoutApp>
</template>
<script>
import Tabs from './components/tabs';
import YohoPage from './yoho';
import UfoPage from './ufo';
const TYPE = {notuse: 'notuse', use: 'use', overtime: 'overtime'};
export default {
name: 'ListPage',
asyncData({store}) {
return Promise.all([
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.notuse,
refresh: true
})
]);
},
components: {
Tabs,
TabPane: Tabs.Pane,
YohoPage,
UfoPage
}
};
</script>
<style lang="scss" scoped>
</style>
... ...
export default {
path: 'ufo.html',
name: 'couponUfo',
component: () => import(/* webpackChunkName: "coupon" */ './list')
};
// export default {
// path: 'ufo.html',
// name: 'couponUfo',
// component: () => import(/* webpackChunkName: "coupon" */ './list')
// };
import UfoList from './list';
export default UfoList;
... ...
... ... @@ -21,12 +21,6 @@ export default {
computed: {
...mapState(['ufoList']),
},
asyncData({store}) {
return store.dispatch('coupon/yoho/fetchUfoList', {
limit: 100,
page: 1
});
},
data() {
return {
scrollOptions: {
... ... @@ -38,8 +32,15 @@ export default {
created() {
},
mounted() {
this.getList();
},
methods: {
getList() {
return this.$store.dispatch('coupon/yoho/fetchUfoList', {
limit: 100,
page: 1
});
}
},
components: {
ScrollView,
... ...
export default {
path: 'yoho.html',
name: 'couponYoho',
component: () => import(/* webpackChunkName: "coupon" */ './list')
};
// export default {
// path: 'yoho.html',
// name: 'couponYoho',
// component: () => import(/* webpackChunkName: "coupon" */ './list')
// };
import YohoList from './list';
export default YohoList;
... ...
<template>
<div style="height: 100%;">
<ClassicTabs ref="tabs" v-model="selectLabel" :data="tabLabels" @on-filter-change="onFilterChange"></ClassicTabs>
<ClassicTabs ref="tabs" v-model="selectLabel" :data="tabLabels" :filterId.sync="selectFilterId"></ClassicTabs>
<div class="tab-slide-container">
<Slide
... ... @@ -14,11 +14,6 @@
@change="changePage"
>
<SlideItem style="background-color: #f0f0f0;">
<div class="filter-wrapper" v-if="showFilter">
<div class="filter-mask" @click="onMaskClick"></div>
<FilterBar :list="filterList" v-model="selectFilterId" class="filter"></FilterBar>
</div>
<ExchangeBox v-model="inputCouponCode" @click="onSubmitCode"></ExchangeBox>
<ScrollView class="scroll-view1" ref="notuse" :data="getNotUseList" :options="scrollOptions" v-if="getNotUseList.length" :reach-bottom="reachBottom">
... ... @@ -63,28 +58,11 @@ const TYPE = {notuse: 'notuse', use: 'use', overtime: 'overtime'};
export default {
name: 'YohoCouponListPage',
asyncData({store}) {
return Promise.all([
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.notuse,
refresh: true
}),
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.use,
refresh: true
}),
store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.overtime,
refresh: true
})
]);
},
data() {
return {
selectIndex: 0,
selectLabel: '未使用',
selectType: TYPE.notuse,
showFilter: false,
selectFilterId: 0,
inputCouponCode: '',
tabLabels: [
... ... @@ -118,8 +96,8 @@ export default {
},
slideOptions: {
listenScroll: true,
click: false,
probeType: 3,
click: false,
directionLockThreshold: 0
},
};
... ... @@ -134,10 +112,18 @@ export default {
return index;
}
},
created() {
},
mounted() {
this.fetchYohoNum();
this.$store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.use,
refresh: true
});
this.$store.dispatch('coupon/yoho/fetchYohoList', {
type: TYPE.overtime,
refresh: true
});
},
methods: {
...mapActions(['getCouponCode', 'fetchYohoList', 'fetchYohoNum']),
... ... @@ -149,25 +135,22 @@ export default {
scroll() {
},
onFilterChange(show) {
this.showFilter = show;
},
onMaskClick() {
this.showFilter = false;
this.$refs.tabs.showFilter = false;
},
onSubmitCode() {
this.getCouponCode({code: this.inputCouponCode}).then(result => {
if (result.code === 200) {
this.inputCouponCode = '';
this.$createToast({
txt: result.message,
type: 'correct'
type: 'txt',
mask: true,
time: 1000
}).show();
} else {
this.$createToast({
txt: result.message,
type: 'error'
type: 'txt',
mask: true,
time: 1000
}).show();
}
});
... ... @@ -178,7 +161,7 @@ export default {
filter: this.tabLabels[this.selectIndex].selectFilterId,
refresh
}).then(() => {
this.$refs[this.selectType].forceUpdate();
this.$refs[this.selectType] && this.$refs[this.selectType].forceUpdate();
});
}
},
... ... @@ -186,7 +169,6 @@ export default {
selectFilterId(val) {
this.tabLabels[0].selectFilterId = val;
this.$refs.notuse && this.$refs.notuse.scrollTo(0, 0);
this.onMaskClick();
this.reachBottom(true);
}
},
... ... @@ -213,24 +195,6 @@ export default {
height: 100%;
}
.filter-wrapper {
width: calc(100% / 3);
height: 100%;
position: absolute;
top: 0;
z-index: 4;
}
.filter {
position: absolute;
top: 0;
}
.filter-mask {
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
}
.scroll-view1 {
height: calc(100% - 270px);
}
... ...
... ... @@ -51,7 +51,7 @@ export default {
if (result && result.code === 200) {
const data = {
type,
couponList: result.data.couponList.map((i) => _handleCoupon(i, type)),
couponList: result.data.couponList ? result.data.couponList.map((i) => _handleCoupon(i, type)) : [],
pageNum: result.data.pageNum,
pageSize: result.data.pageSize,
total: result.data.total,
... ...