Authored by 邱骏

Merge branch 'develop' of http://git.yoho.cn/fe/xianyu-ufo-app-web into develop

<template>
<div class="layout">
<slot name="header">
<LayoutHeader
<LayoutHeader v-if="!hideHeader"
class="layout-header"
:title="title"
:opacity="opacity"
... ... @@ -17,7 +17,7 @@
<script>
export default {
name: "LayoutApp",
name: 'LayoutApp',
props: {
title: String,
opacity: {
... ... @@ -31,6 +31,10 @@ export default {
showBack: {
type: Boolean,
default: true
},
hideHeader: {
type: Boolean,
default: false
}
}
};
... ...
... ... @@ -45,6 +45,8 @@ Vue.use(OrderCouponList);
Vue.use(OrderPromotionList);
Vue.use(Bind);
initClient(store);
yoho.auth = async loginUrl => {
let user = await sdk.getUser();
... ...
<template>
<LayoutApp :show-back="true">
<LayoutApp :show-back="true" :hideHeader="hideHeader">
<div class="root-content">
<div class="left-content">
<Scroll>
<div class="category-left-item-root"
v-for="(item, index) in categoryParent"
:key="index"
:data-id="item"
@click="onClick(item)">
v-for="(item, index) in categoryParent"
:key="index"
:data-id="item"
@click="onClick(item)">
<div :class="{'category-left-item-select-flag' : item.isSelect }"></div>
<p
class="category-left-item-title"
:class="{'category-left-item-select' : item.isSelect }" >
<p
class="category-left-item-title"
:class="{'category-left-item-select' : item.isSelect }">
{{item.name}}
</p>
</div>
... ... @@ -24,16 +24,16 @@
<p class="sub-title">——— {{itemSub.name}} ———</p>
<div class="category-sub-root">
<div class="item-div"
v-for="(item, index) in itemSub.sub"
:key="index"
:data-id="item.id"
v-for="(item, index) in itemSub.sub"
:key="index"
:data-id="item.id"
>
<div class="item-imge-div" @click="goProductList(item)">
<ImgSize
class="item-imge"
:src="item.image"
:width="60"
:height="60"
class="item-imge"
:src="item.image"
:width="60"
:height="60"
/>
<p class="item-title">{{item.name}}</p>
</div>
... ... @@ -48,22 +48,21 @@
</LayoutApp>
</template>
<script>
import { Scroll }from 'cube-ui'
import {createNamespacedHelpers} from 'vuex';
import { Scroll } from 'cube-ui';
import { createNamespacedHelpers } from 'vuex';
import Vue from 'vue';
import ImgSize from '../../components/img-size';
const {mapState, mapActions} = createNamespacedHelpers('category');
const { mapState, mapActions } = createNamespacedHelpers('category');
export default {
name: 'category',
props: ['hideHeader'],
components: {
Scroll,
ImgSize
},
data() {
return {
};
return {};
},
mounted() {
this.fetchCategoryParentList();
... ... @@ -71,135 +70,150 @@ export default {
},
methods: {
...mapActions(['fetchCategoryParentList', 'selectCategoryParent', 'fetchBrandList', 'fetchCategorySubList']),
onClick(item){
if(!item.isSelect){
let id = item.id;
if(id === "-1"){
this.fetchBrandList({id});
}else {
this.fetchCategorySubList({id})
}
onClick(item) {
if (!item.isSelect) {
let id = item.id;
if (id === '-1') {
this.fetchBrandList({ id });
} else {
this.fetchCategorySubList({ id });
}
}
},
goProductList(item) {
let key = item.linkType;
let value = item.id;
this.$router.push({
name: "List",
let key = item.linkType;
let value = item.id;
this.$router.push({
name: 'List',
params: {
key : value
key: value
},
});
}
},
computed: {
...mapState(['categoryParent','categorySubList']),
...mapState(['categoryParent', 'categorySubList']),
},
};
</script>
<style>
.root-content{
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
background-color: #FFFFFF;
}
.left-right-split-line{
height: 100%;
width: 2px;
background-color: #EEEEEE;
}
.left-content{
width: 25%;
height: 100%;
}
.right-content{
display: flex;
flex-direction: column;
width: 75%;
height: 100%;
}
.category-left-item-root{
display: flex;
flex-direction: row;
width: 100%;
align-items: center;
margin-top: 28px;
margin-bottom: 28px;
}
.category-left-item-title{
color: #999999;
font-size: 30px;
width: 100%;
text-align: center;
}
.category-left-item-select{
font-size: 48px;
color: #000000;
.root-content {
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
background-color: #FFFFFF;
}
.left-right-split-line {
height: 100%;
width: 2px;
background-color: #EEEEEE;
}
.left-content {
width: 25%;
height: 100%;
}
.right-content {
display: flex;
flex-direction: column;
width: 75%;
height: 100%;
}
.category-left-item-root {
display: flex;
flex-direction: row;
width: 100%;
align-items: center;
margin-top: 28px;
margin-bottom: 28px;
}
.category-left-item-title {
color: #999999;
font-size: 30px;
width: 100%;
text-align: center;
}
.category-left-item-select {
font-size: 48px;
color: #000000;
}
.category-left-item-select-flag {
width: 9px;
height: 48px;
margin-bottom: 10px;
margin-top: 10px;
background-color: #000000;
align-self: flex-start;
justify-self: flex-start;
width: 9px;
height: 48px;
margin-bottom: 10px;
margin-top: 10px;
background-color: #000000;
align-self: flex-start;
justify-self: flex-start;
}
.category-sub-root {
display: flex;
flex-flow: row wrap;
align-content: flex-start;
display: flex;
flex-flow: row wrap;
align-content: flex-start;
}
.sub-title{
font-size: 24px;
color: #000;
text-align: center;
.sub-title {
font-size: 24px;
color: #000;
text-align: center;
}
.item-div {
position: relative;
display: flex;
flex: 0 0 33%;
height: 195px;
}
.item-imge-div {
position: relative;
display: flex;
flex: 0 0 33%;
height: 195px;
}
.item-imge-div {
height: 100%;
width: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
position:absolute;
position: absolute;
z-index: 1;
padding-top: 20px;
padding-bottom: 20px;
}
.item-imge {
object-fit: contain;
}
.item-title{
font-family: 'SFProText-Regular';
font-size: 22px;
color: #000000;
text-align: center;
text-overflow: ellipsis;
-webkit-line-clamp: 1;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
}
.item-a-div{
position:absolute;
}
.item-imge {
object-fit: contain;
}
.item-title {
font-family: 'SFProText-Regular';
font-size: 22px;
color: #000000;
text-align: center;
text-overflow: ellipsis;
-webkit-line-clamp: 1;
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden;
}
.item-a-div {
position: absolute;
width: 100%;
height: 100%;
z-index: 99;
}
}
</style>
\ No newline at end of file
</style>
... ...
export default [
{
name: 'category',
path: '/xianyu/category',
component: () => import(/* webpackChunkName: "notice" */ './category')
}
];
\ No newline at end of file
{
name: 'category',
path: '/xianyu/category',
component: () => import(/* webpackChunkName: "notice" */ './category')
}
];
... ...
<template>
<LayoutApp :show-back="true">
<div class="scroll-list-wrap">
<template v-if="isShow">
<div v-for="(item, index) in channelList.list" v-if="item.template_name == 'guessLike'">
<ScrollNav :list="item.data.list"></ScrollNav>
</div>
</template>
<Scroll
ref="scroll"
:scroll-events="scrollEvents"
@scroll="scrollHandler"
:options="options"
@pulling-up="onPullingUp"
:data="productList.list">
<div class="body" ref="body">
<div class="channel-top"></div>
<div class="marginTop">
<div v-for="(item, index) in channelList.list" :key="index" class="space-between">
<Swiper :list="item.data" v-if="item.template_name == 'threePicture'"/>
<Hot :list="item.data.list" v-if="item.template_name == 'image_list'" />
<Banner :list="item.data" v-if="item.template_name == 'single_image'" />
<TwoBanner :list="item.data" v-if="item.template_name == 'twoPicture'" />
<template v-if="!isShow">
<div ref="sss" v-if="item.template_name == 'guessLike'">
<ScrollNav :list="item.data.list"></ScrollNav>
</div>
</template>
</div>
</div>
<div :style="{minHeight: total + 'px'}">
<ProductList :list="productList.list" v-if="productList.list.length > 0" class="bgColor"></ProductList>
<UfoNoItem :tip="`暂无数据`" v-else></UfoNoItem>
<LayoutApp :show-back="true" :hide-header="hideHeader">
<div class="scroll-list-wrap">
<template v-if="!isShow">
<div v-for="(item, index) in channelList.list" v-if="item.template_name == 'guessLike'">
<ScrollNav :list="item.data.list" :cur="cur"></ScrollNav>
</div>
</template>
<Scroll
ref="scroll"
:scroll-events="scrollEvents"
@scroll="scrollHandler"
:options="options"
@pulling-up="onPullingUp"
:data="productList.list">
<div class="body" ref="body">
<div class="channel-top"></div>
<div class="marginTop">
<div v-for="(item, index) in channelList.list" :key="index" class="space-between">
<Swiper :list="item.data" v-if="item.template_name == 'threePicture'"/>
<Hot :list="item.data.list" v-if="item.template_name == 'image_list'"/>
<Banner :list="item.data" v-if="item.template_name == 'single_image'"/>
<TwoBanner :list="item.data" v-if="item.template_name == 'twoPicture'"/>
<template v-if="!isShow">
<div ref="sss" v-if="item.template_name == 'guessLike'">
<ScrollNav :list="item.data.list" :cur="cur" @transfer="getIndex"></ScrollNav>
</div>
</template>
</div>
</div>
</Scroll>
</div>
<div :style="{minHeight: total + 'px'}">
<ProductList :list="productList.list" v-if="productList.list.length > 0" class="bgColor"></ProductList>
<UfoNoItem :tip="`暂无数据`" v-else></UfoNoItem>
</div>
</div>
</Scroll>
</div>
</LayoutApp>
</template>
<script>
import { Style, Scroll, Sticky } from 'cube-ui'
import { Style, Scroll, Sticky } from 'cube-ui';
import { createNamespacedHelpers } from 'vuex';
import Swiper from './components/swiper';
import Banner from './components/banner';
... ... @@ -54,6 +54,7 @@ const { mapState, mapActions } = createNamespacedHelpers('home/channel');
const { mapState: mapStateList, mapActions: mapActionsList } = createNamespacedHelpers('list');
export default {
props: ['hideHeader'],
data() {
return {
options: {
... ... @@ -69,7 +70,8 @@ export default {
isShow: false,
total: 0,
marginTop: 0,
}
cur: 0,
};
},
computed: {
...mapState(['channelList']),
... ... @@ -80,28 +82,25 @@ export default {
isPage: true,
isHome: true,
}
this.fetchChannelList().then((res)=>{
this.fetchChannelList().then((res) => {
let windowH = document.documentElement.clientHeight || document.body.clientHeight;
this.navTop = this.$refs.sss[0].offsetTop;
this.navHeight = this.$refs.sss[0].offsetHeight;
let windowH = document.documentElement.clientHeight || document.body.clientHeight;
this.total = windowH - this.navHeight;
console.log(windowH);
console.log(this.navHeight);
console.log(this.total);
console.log("______");
});
this.fetchProductList(params);
},
created() {
},
methods: {
getIndex(index) {
this.cur = index;
console.log(this.cur);
},
scrollHandler({ y }) {
let scrollY = Math.abs(parseInt(y));
if(scrollY >= this.navTop) {
if (scrollY >= this.navTop) {
this.isShow = true;
this.marginTop = 0;
} else {
... ... @@ -116,9 +115,9 @@ export default {
const params = {
isReset: false,
isHome: true,
}
};
await this.fetchProductList(params);
this.$refs.scroll.forceUpdate()
this.$refs.scroll.forceUpdate();
}
},
components: {
... ... @@ -144,9 +143,11 @@ export default {
height: 310px;
background: #08304B;
}
.marginTop {
margin-top: -150px;
}
.scroll-app {
position: absolute;
top: 0;
... ... @@ -163,27 +164,33 @@ export default {
-webkit-flex-direction: column;
flex-direction: column;
}
.scroll-flex {
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
overflow: hidden;
position: relative;
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
overflow: hidden;
position: relative;
}
.scroll-list-wrap {
height: 100%;
width: 100%;
}
.body {
height: 100%;
overflow-y: auto;
}
.space-between {
padding: 0 20px;
}
.bgColor {
background: #f5f5f5;
}
.navFixed {
width: 100%;
position: fixed;
... ...
<template>
<div class="ScrollNav" ref="scrollNavtop" v-if="labels.length > 0">
<ScrollNavBar :current="current" :labels="labels" @change="changeHandler">
<div class="ScrollNav" v-if="labels.length > 0">
<ScrollNavBar :current="this.list[cur].tab_name" :labels="labels" @change="changeHandler">
<span slot-scope="props">
{{props.txt}}
<span :ref="`getindex${props.txt}`" v-show="false">{{props.index}}</span>
... ... @@ -23,6 +23,10 @@ export default {
type: Array,
default: true
},
cur: {
type: Number,
default: true
}
},
data() {
return {
... ... @@ -40,8 +44,6 @@ export default {
},
mounted() {
this.list.map((res) => { this.labels.push(res.tab_name) });
console.log(this.$refs.scrollNavtop);
console.log("this.$refs.xxx.offsetTop2");
},
created() {
... ... @@ -54,6 +56,8 @@ export default {
let params = Object.assign({},...query);
params.isReset = true; delete params.method;
this.fetchProductList(params);
console.log(index);
this.$emit('transfer',index);
}
}
};
... ...
<template>
<LayoutApp :show-back="true">
<LayoutApp :show-back="true" :title="title">
<Scroll :scrollEvents="['scroll']" :options="scrollOptions" @scroll="scroll"
v-show="!isShowEmpty"
@pulling-up="onPullingUp">
<ProductList :list="favoriteProductList.list"></ProductList>
</Scroll>
<empty-list v-show="isShowEmpty" />
</LayoutApp>
</template>
<script>
import ProductList from '../../list/components/productList';
import EmptyList from "../../order/order-list/components/empty";
import {Scroll} from 'cube-ui';
import {createNamespacedHelpers} from 'vuex';
... ... @@ -17,10 +20,12 @@ export default {
name: 'list',
components: {
ProductList,
Scroll
Scroll,
EmptyList
},
data() {
return {
title: '我的收藏',
scrollOptions: {
bounce: {
top: false
... ... @@ -34,7 +39,7 @@ export default {
this.fetchFavoriteList();
},
methods: {
...mapActions(['fetchFavoriteList']),
...mapActions(['fetchFavoriteList','isShowEmpty']),
async onPullingUp() {
await this.fetchFavoriteList();
... ...
... ... @@ -69,11 +69,11 @@ export default {
methods: {
...mapActions(['fetchWallet']),
onPullingDown() {
this.fetchWallet({isRefresh:true})
this.fetchWallet({isRefresh:true, tradeType: this.walletData.tradeType})
},
onPullingUp() {
if(!this.walletData.endReached) {
this.fetchWallet({isRefresh:false})
this.fetchWallet({isRefresh:false, tradeType: this.walletData.tradeType})
} else {
this.$refs.scroll.forceUpdate()
}
... ...
... ... @@ -3,8 +3,78 @@ import Trade from './tradeIncome';
import Favorite from './favorite';
import news from './news';
import Income from './income';
export default [
{
name: 'IndexPage',
path: '/xianyu/index',
component: () => import(/* webpackChunkName: "index" */ './indexPage/index-page'),
redirect: { name: 'ChannelPage' },
props: (route) => {
switch (route.name) {
case 'ChannelPage': {
return {
tabIndex: 0
};
}
case 'CategoryPage': {
return {
tabIndex: 1
};
}
case 'NewsPage': {
return {
tabIndex: 2
};
}
case 'MinePage': {
return {
tabIndex: 3
};
}
default: {
return {
tabIndex: 0
};
}
}
},
children: [
{
name: 'ChannelPage',
path: 'channel',
component: () => import(/* webpackChunkName: "index" */ './channel/channel'),
props: () => ({
hideHeader: true,
}),
},
{
name: 'CategoryPage',
path: 'category',
component: () => import(/* webpackChunkName: "index" */ '../category/category'),
props: () => ({
hideHeader: true,
}),
},
{
name: 'NewsPage',
path: 'news',
component: () => import(/* webpackChunkName: "index" */ './news/news'),
props: () => ({
hideHeader: true,
}),
},
{
name: 'MinePage',
path: 'mine',
component: () => import(/* webpackChunkName: "index" */ './mine/mine'),
props: () => ({
hideHeader: true,
}),
},
]
},
{
name: 'channel',
path: '/xianyu/channel',
component: () => import(/* webpackChunkName: "channel" */ './channel/channel')
... ...
<template>
<div class="tabs-wrapper">
<Widget classes="iconhome" :class="active(0)" :index="0" desc="首页" @click="onClick"></Widget>
<Widget classes="iconcategoary" :class="active(1)" :index="1" desc="分类" @click="onClick"></Widget>
<Widget classes="iconmessage" :class="active(2)" :index="2" desc="消息" @click="onClick"></Widget>
<Widget classes="iconuser" :class="active(3)" :index="3" desc="我的" @click="onClick"></Widget>
</div>
</template>
<script>
import Widget from './widget';
export default {
name: 'IndexTab',
props: {
value: {
type: Number,
default: 0
}
},
components: {
Widget
},
computed: {
active() {
return (i) => {
return {
active: this.value === i
};
};
}
},
methods: {
onClick(index) {
this.$emit('click', index);
}
}
};
</script>
<style lang="scss" scoped>
.tabs-wrapper {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 46px;
}
.active {
color: #08304b !important;
}
</style>
... ...
<template>
<div class="widget" @click="onClick">
<i class="iconfont icon-class" :class="classes"></i>
<div class="desc">{{desc}}</div>
</div>
</template>
<script>
export default {
name: 'Widget',
props: {
classes: {
type: [Object, String],
default() {
return {
iconhome: true
};
}
},
desc: {
type: String,
default: '首页'
},
index: {
type: Number,
default: 0
}
},
data() {
return {};
},
computed: {
},
methods: {
onClick() {
this.$emit('click', this.index);
}
}
};
</script>
<style lang="scss" scoped>
.widget {
width: 98px;
height: 98px;
display: flex;
font-size: 0;
flex-direction: column;
align-items: center;
color: #8c8c8c;
}
.icon-class {
font-size: 50px;
margin-top: 5px;
}
.desc {
font-size: 20px;
margin-top: -10px;
}
</style>
... ...
<template>
<LayoutApp :show-back="false" title="球鞋">
<div class="body">
<div class="content">
<router-view></router-view>
</div>
<div class="footer">
<Tabs :value="tabIndex" @click="onClick"></Tabs>
</div>
</div>
</LayoutApp>
</template>
<script>
import Tabs from './components/tabs';
export default {
name: 'IndexPage',
props: ['tabIndex'],
components: {
Tabs
},
methods: {
onClick(index) {
switch (index) {
case 0: {
this.go('ChannelPage');
break;
}
case 1: {
this.go('CategoryPage');
break;
}
case 2: {
this.go('NewsPage');
break;
}
case 3: {
this.go('MinePage');
break;
}
default: {
this.go('ChannelPage');
}
}
},
go(name) {
this.$router.replace({
name
});
}
}
};
</script>
<style lang="scss" scoped>
* {
transition: none !important;
transform: none !important;
}
.body {
display: flex;
flex-direction: column;
height: 100%;
}
.content {
flex: 1;
overflow: hidden;
background-color: white;
position: relative;
}
.footer {
border-top: 1px solid #eee;
height: 100px;
width: 100%;
background-color: white;
}
</style>
... ...
<template>
<div class="single-image">
<a :href="data.url" class="link">
<LayoutLink :href="data.url" class="link">
<img :src="data.src" :alt="data.title" class="img" :style="style">
</a>
</LayoutLink>
</div>
</template>
... ...
<template>
<LayoutApp :show-back="true" title="我的">
<LayoutApp :show-back="true" title="我的" :hideHeader="hideHeader">
<div class="body" ref="body">
<div v-for="(value, key) in getMineList" :key="key">
<tab-item v-if="key === 'board'" :data="value" noLine icon="cubeic-notification" small grey>
... ... @@ -7,14 +7,14 @@
</tab-item>
<template v-else-if="key === 'resource1' || key === 'resource2'">
<div v-if="value.data.template_name ==='single_image'">
<singleImage :data="value.data.data[0]"></singleImage>
<singleImage :data="value.data.data[0]"></singleImage>
</div>
</template>
<div v-else-if="key === 'order'" class="bg-bottom">
<order></order>
</div>
<div v-else-if="key === 'sale'" class="bg-top">
<tab-item :data="value" noLine titleBold titleSmall></tab-item>
<tab-item :data="value" noLine titleBold titleSmall></tab-item>
</div>
<tab-item v-else :data="value"></tab-item>
</div>
... ... @@ -29,34 +29,33 @@ import scroll from './components/scroll';
import singleImage from './components/singleImage';
import { createNamespacedHelpers } from 'vuex';
const {mapGetters, mapActions} = createNamespacedHelpers('home/mine');
const { mapGetters, mapActions } = createNamespacedHelpers('home/mine');
export default {
data() {
return {
}
},
computed:{
...mapGetters(['getMineList'])
},
created() {
this.fetchResource()
this.fetchFavoriteNum()
this.fetchOrderSummary()
this.fetchSellerOrder()
// this.fetchAssets(true)
this.fetchUserWalletInfo()
this.fetchCoupon()
},
methods: {
...mapActions(['fetchFavoriteNum','fetchResource','fetchSellerOrder','fetchOrderSummary', 'fetchAssets', 'fetchUserWalletInfo','fetchCoupon'])
},
components: {
tabItem,
order,
scroll,
singleImage
}
props: ['hideHeader'],
data() {
return {};
},
computed: {
...mapGetters(['getMineList'])
},
created() {
this.fetchResource();
this.fetchFavoriteNum();
this.fetchOrderSummary();
this.fetchSellerOrder();
// this.fetchAssets(true)
this.fetchUserWalletInfo();
this.fetchCoupon();
},
methods: {
...mapActions(['fetchFavoriteNum', 'fetchResource', 'fetchSellerOrder', 'fetchOrderSummary', 'fetchAssets', 'fetchUserWalletInfo', 'fetchCoupon'])
},
components: {
tabItem,
order,
scroll,
singleImage
}
};
</script>
... ... @@ -67,16 +66,19 @@ export default {
background-color: white;
padding: 0 40px;
}
.bg-top,
.bg-bottom {
background-color: #F2F2F2;
}
.bg-top {
border-top-left-radius: 32px;
border-top-right-radius: 32px;
margin-top: 30px;
padding: 0 30px;
}
.bg-bottom {
border-bottom-left-radius: 32px;
border-bottom-right-radius: 32px;
... ...
<template>
<LayoutApp :show-back="true">
<LayoutApp :show-back="true" :hideHeader="hideHeader">
<div class="scroll-list-wrap">
<Scroll
ref="scroll"
... ... @@ -17,14 +17,16 @@
</template>
<script>
import { Style, Scroll } from 'cube-ui'
import { Style, Scroll } from 'cube-ui';
import { createNamespacedHelpers } from 'vuex';
import Title from './components/title';
import List from './components/list';
import Tab from './components/tab';
const { mapState, mapActions } = createNamespacedHelpers('home/news');
export default {
props: ['hideHeader'],
data() {
return {
options: {
... ... @@ -34,7 +36,7 @@ export default {
pullUpLoad: true
},
msg: '消息',
}
};
},
computed: {
...mapState(['newsList']),
... ... @@ -43,15 +45,15 @@ export default {
let params = {
type: '',
isPage: true
}
};
this.fetchNewsList(params);
this.fetchNewsTabList();
},
created() {
},
methods: {
...mapActions(['fetchNewsList','fetchNewsTabList']),
...mapActions(['fetchNewsList', 'fetchNewsTabList']),
async onPullingUp() {
await this.fetchNewsList();
this.$refs.scroll.forceUpdate();
... ... @@ -72,6 +74,7 @@ export default {
height: 100%;
width: 100%;
}
.news-content {
padding: 0 40px;
}
... ...
<template>
<LayoutApp :show-back="true">
<LayoutApp :show-back="true" :title="title">
<Scroll
ref="scroll"
:scroll-events="['scroll-end','scroll']"
... ... @@ -30,6 +30,7 @@ export default {
},
data(){
return {
title: '公告',
data: {},
scrolling: false,
scrollOption: {
... ...
... ... @@ -95,13 +95,19 @@ export default {
const name = info.size_name.split(/\s+/);
// 区分交易(buy|sell),变现
const isTradable = info.storage_num > 0 && price !== '-';
const isMarketable = info.bid_moster_price > 0;
return {
size_id: info.size_id,
name: name[0],
subName: name[1],
price,
storage_id: info.storage_id,
available: info.storage_num > 0 && price !== '-',
available: isTradable || isMarketable,
isTradable,
isMarketable,
};
},
simplePriceMap(info) {
... ...
... ... @@ -18,9 +18,9 @@
@select="onSelectSize"
@add="onAdd" />
<transition name="slide-up">
<div class="footer" v-if="isTradable">
<div class="footer" v-if="isAvailable">
<cube-button v-if="config.type === 'sell'" @click="convertToCash" :class="{active: isMarketable}">变现<span> <i>¥</i>{{cashPrice}}</span></cube-button>
<cube-button @click="select" class="active">{{config.title}}</cube-button>
<cube-button @click="select" :class="{active: isTradable}">{{config.title}}</cube-button>
</div>
</transition>
</div>
... ... @@ -87,11 +87,15 @@ export default {
return get(this.product, 'goods_list[0].canAddSize', false);
},
isAvailable() {
return this.selectedSize && this.selectedSize.size_id > 0;
},
/**
* 可交易(购买|出售)
*/
isTradable() {
return this.selectedSize && this.selectedSize.size_id;
return this.isAvailable && this.selectedSize.storage_num > 0 && this.selectedSize.least_price !== '-';
},
/**
... ... @@ -106,10 +110,11 @@ export default {
},
/**
* 是否可变现
* 可变现
* 通过bid_moster_price或bid_skup判断
*/
isMarketable() {
return this.cashPrice !== '-' && this.cashPrice > 0;
return this.cashPrice > 0;
}
},
mounted() {
... ... @@ -140,6 +145,7 @@ export default {
productId: this.product.product_id,
storageId: this.selectedSize.storage_id,
skup: this.selectedSize.skup,
bid_skup: this.selectedSize.bid_skup,
});
},
convertToCash() {
... ...
... ... @@ -15,6 +15,7 @@ export default function() {
total: 0, // 总共多少条
scrollnavList: [], // 导航菜单
// scrollnavidList: [], // 导航菜单
current: 0,
},
},
mutations: {
... ...
... ... @@ -13,17 +13,25 @@ export default function() {
favoriteProductList: {
list:[]
},
isShowEmpty: false,
},
mutations: {
addList(state, { data }) {
console.log(data)
if(data && data.product_list){
// data.product_list.
let list = state.favoriteProductList.list.concat(data.product_list);
let { page, product_list = [] } = res;
state.isShowEmpty = page === 1 && product_list === 0;
let list = state.favoriteProductList.list.concat(product_list);
Vue.set(state.favoriteProductList, "list", list);
}else {
state.isShowEmpty = true;
}
},
errorData(state){
state.isShowEmpty = true;
}
},
actions: {
... ... @@ -32,6 +40,8 @@ export default function() {
if (result.code === 200) {
let data =result.data;
commit('addList', { data:data });
}else {
commit('error');
}
return result.data || [];
},
... ...
... ... @@ -141,15 +141,11 @@ export default function() {
return tabList;
},
getYearMonth(state) {
let beginTime = moment(
new Date(state.filterData.beginTime * 1000),
).format('YYYY-MM');
let endTime = moment(new Date(state.filterData.endTime * 1000)).format(
'YYYY-MM',
);
let beginTime = moment(new Date(state.filterData.beginTime * 1000)).format('YYYY-MM');
let endTime = moment(new Date(state.filterData.endTime * 1000)).format('YYYY-MM');
var a = moment(endTime.split('-'));
var b = moment(beginTime.split('-'));
let a = moment(endTime.split('-'));
let b = moment(beginTime.split('-'));
let yearNum = a.diff(b, 'years');
let monthNum = a.diff(b, 'months');
let beginYear = beginTime.split('-')[0];
... ... @@ -239,9 +235,7 @@ export default function() {
},
addWallet(state, walletData) {
walletData.list.map(item => {
item.time = moment(new Date(item.createTime * 1000)).format(
'YYYY.MM.DD HH:mm',
);
item.time = moment(new Date(item.createTime * 1000)).format('YYYY.MM.DD HH:mm');
item.amount = Number(Math.abs(item.amount)).toFixed(2);
return item;
});
... ... @@ -440,8 +434,7 @@ export default function() {
let newList = [...oldList, ...data.list];
walletData.currentPage = data.page;
walletData.endReached =
data.list.length === 0 || data.page === data.totalPage;
walletData.endReached = data.list.length === 0 || data.page === data.totalPage;
walletData.list = newList;
commit('addWallet', walletData);
}
... ...