Authored by 邱骏

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

... ... @@ -113,8 +113,10 @@ export default {
beforeRouteEnter(to, from, next) {
next(vm => {
// 通过 `vm` 访问组件实例
vm.query = from.query;
vm.pageName = from.name;
if (from.name !== "addressEdit") {
vm.query = from.query;
vm.pageName = from.name;
}
});
}
};
... ...
... ... @@ -3,7 +3,7 @@
<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" :current="active"></ScrollNav>
<ScrollNav :list="item.data" :current="active"></ScrollNav>
</div>
</template>
<Scroll
... ... @@ -18,12 +18,12 @@
<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'"/>
<Hot :list="item.data" 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" :current="active" @transfer="getIndex"></ScrollNav>
<ScrollNav :list="item.data" :current="active" @transfer="getIndex"></ScrollNav>
</div>
</template>
</div>
... ... @@ -41,6 +41,7 @@
<script>
import { Style, Scroll, Sticky } from 'cube-ui';
import { createNamespacedHelpers } from 'vuex';
import queryString from 'query-string';
import Swiper from './components/swiper';
import Banner from './components/banner';
import TwoBanner from './components/twoBanner';
... ... @@ -71,6 +72,9 @@ export default {
total: 0,
marginTop: 0,
active: 0,
params: {
isHome: true,
}
};
},
computed: {
... ... @@ -78,17 +82,22 @@ export default {
...mapStateList(['productList']),
},
mounted() {
const params = {
isPage: true,
isHome: true,
}
this.fetchChannelList().then((res) => {
console.log(res);
let windowH = document.documentElement.clientHeight || document.body.clientHeight;
this.navTop = this.$refs.sss[0].offsetTop;
this.navHeight = this.$refs.sss[0].offsetHeight;
this.total = windowH - this.navHeight;
res.forEach((item) => {
if (item.template_name == "guessLike") {
let url = item.data[0].url.split("?");
this.params = queryString.parse(url[1]);
}
})
this.fetchProductList(this.params);
});
this.fetchProductList(params);
},
created() {
... ... @@ -101,22 +110,15 @@ export default {
let scrollY = Math.abs(parseInt(y));
if (scrollY >= this.navTop) {
this.isShow = true;
this.marginTop = 0;
} else {
this.isShow = false;
this.marginTop = '30px';
}
// this.scrollY = -y
},
...mapActions(['fetchChannelList']),
...mapActionsList(['fetchProductList']),
async onPullingUp() {
const params = {
isReset: false,
isHome: true,
};
await this.fetchProductList(params);
this.$refs.scroll.forceUpdate();
this.params.isReset = false
await this.fetchProductList(this.params);
}
},
components: {
... ... @@ -198,6 +200,6 @@ export default {
z-index: 999;
}
.marginTop {
margin-top: 64px;
// margin-top: 64px;
}
</style>
... ...
<template>
<div class="banner" v-if="list.length > 0">
<ul>
<li v-for="(item, index) in list" :key="index" @click="jump(item)">
<ImageFormat :data-secc="item.src" :lazy="false" :src="item.src" :alt="item.alt" :width="item.width || 750" :height="item.height || 160" />
<li v-for="(item, index) in list" :key="index">
<LayoutLink :href="item.url">
<ImageFormat :data-secc="item.src" :lazy="false" :src="item.src" :alt="item.alt" :width="item.width || 750" :height="item.height || 160" />
</LayoutLink>
</li>
</ul>
</div>
... ... @@ -18,11 +20,7 @@ export default {
},
},
methods: {
jump(item) {
const { src, url } = item;
console.log(src);
console.log(url);
}
}
};
</script>
... ...
<template>
<div class="ScrollNav" v-if="labels.length > 0">
<ScrollNavBar :current="this.list[current].tab_name" :labels="labels" @change="changeHandler">
<ScrollNavBar :current="this.list[current].title" :labels="labels" @change="changeHandler">
<span slot-scope="props">
{{props.txt}}
<span :ref="`getindex${props.txt}`" v-show="false">{{props.index}}</span>
... ... @@ -13,6 +13,8 @@
import Vue from 'vue'
import { Style, ScrollNavBar } from 'cube-ui';
import { createNamespacedHelpers } from 'vuex';
import queryString from 'query-string';
// const { mapState, mapActions } = createNamespacedHelpers('list/channel');
const {mapState, mapActions} = createNamespacedHelpers('list');
... ... @@ -31,7 +33,7 @@ export default {
data() {
return {
index: 0,
// current: this.list[0].tab_name,
// current: this.list[0].title,
labels: [],
}
},
... ... @@ -43,7 +45,7 @@ export default {
...mapState(['productList']),
},
mounted() {
this.list.map((res) => { this.labels.push(res.tab_name) });
this.list.map((res) => { this.labels.push(res.title) });
},
created() {
... ... @@ -52,11 +54,13 @@ export default {
...mapActions(['fetchProductList']),
changeHandler(cur) {
let index = this.$refs[`getindex${cur}`].innerText;
let query = this.list[index].query
let params = Object.assign({},...query);
params.isReset = true; delete params.method;
let url = this.list[index].url.split("?");
let urlParams = queryString.parse(url[1]);
let params = urlParams;
params.isReset = true;
this.fetchProductList(params);
this.$emit('transfer',index);
console.log(params)
}
}
};
... ...
<template>
<div class="swiper">
<div class="swiper-item swiper-item-left">
<a :href="list[0].url">
<LayoutLink :href="list[0].url">
<ImageFormat @click="clickHandler(item, index)" :lazy="false" class="item-imge" :src="list[0].src" :width="310" :height="402"></ImageFormat>
</a>
</LayoutLink>
</div>
<div class="swiper-item swiper-item-right">
<a :href="list[1].url">
<LayoutLink :href="list[1].url">
<ImageFormat @click="clickHandler(item, index)" :lazy="false" class="item-imge" :src="list[1].src" :width="380" :height="196"></ImageFormat>
</a>
<a :href="list[2].url">
</LayoutLink>
<LayoutLink :href="list[2].url">
<ImageFormat style="margin-top: 4px" @click="clickHandler(item, index)" :lazy="false" class="item-imge" :src="list[2].src" :width="380" :height="196"></ImageFormat>
</a>
</LayoutLink>
</div>
</div>
</template>
... ...
... ... @@ -2,9 +2,9 @@
<div class="twoBanner" v-if="list.length > 0">
<ul>
<li v-for="(item, index) in list" :key="index">
<a :href="item.url">
<LayoutLink :href="item.url">
<ImageFormat :lazy="false" :src="item.src" :alt="item.alt" :width="344" :height="160" />
</a>
</LayoutLink>
</li>
</ul>
</div>
... ...
<template>
<LayoutApp>
<div class="tab">
<div class="item right-line" :class="type ==='unused' ? 'item-selected' : 'item-default'"
@click="onChangeList('unused')">未使用{{unused.length && '('+ unused.length + ')'}}
</div>
<div class="item right-line" :class="type ==='used' ? 'item-selected' : 'item-default'"
@click="onChangeList('used')">已使用{{used.length && '('+ used.length + ')'}}
</div>
<div class="item" :class="type ==='overtime' ? 'item-selected' : 'item-default'"
@click="onChangeList('overtime')">已失效{{overtime.length && '('+ overtime.length + ')'}}
</div>
</div>
<Scroll class="coupon-list"
:options="scrollOptions"
:data="list"
@pulling-up="onPullingUp">
<div class="item" v-for="(item,index) in list">
<div :class="type === 'unused' ? 'item-bg' : 'item-gray-bg'">
<div class="item-left">
<div class="item-price" :class="type !== 'unused' && 'gray'">{{item.coupon_value}}</div>
<div class="item-rule" v-if="item.use_rule" :class="type !== 'unused' && 'gray'">{{item.use_rule}}</div>
</div>
<div class="item-right">
<div class="item-name" :class="type !== 'unused' && 'gray'">
<span class="item-type" :class="type !== 'unused' && 'gray'">[{{item.coupon_type_name}}]</span>
{{item.coupon_name}}
</div>
<div class="item-time" :class="type !== 'unused' && 'gray'">{{item.coupon_validity}}</div>
<div class="item-desc-btn" :class="type !== 'unused' && 'gray'">使用说明</div>
<div class="time-up" v-if="item.is_expired_soon === 'Y'"></div>
<div class="item-used-flag" v-if="type === 'used'"></div>
<div class="item-overtime-flag" v-if="type === 'overtime'"></div>
</div>
</div>
</div>
</Scroll>
</LayoutApp>
</template>
<script>
export default {
name: "list"
}
import {Scroll} from 'cube-ui';
import {createNamespacedHelpers} from 'vuex';
const {mapState, mapActions} = createNamespacedHelpers('home/coupon');
export default {
name: 'Coupon',
components: {Scroll},
activated: function() {
this.fetchCouponList({type: 'unused', isReset: true}).then(r => {
this.list = r;
});
this.fetchCouponList({type: 'used', isReset: true});
this.fetchCouponList({type: 'overtime', isReset: true});
},
data() {
return {
scrollOptions: {
bounce: {
top: false
},
pullUpLoad: true
},
type: 'unused',
list: []
};
},
methods: {
...mapActions(['fetchCouponList']),
onChangeList(type) {
// 切换tab
this.type = type;
// 切换list
this.list = this[type].list;
},
async onPullingUp() {
this.list = await this.fetchCouponList({type: this.type});
},
},
computed: {
...mapState(['unused', 'used', 'overtime']),
},
};
</script>
<style scoped>
<style lang="scss" scoped>
.tab {
display: flex;
width: 100%;
height: 88px;
padding: 14px 0;
align-items: center;
.item {
font-size: 28px;
flex: 1;
height: 60px;
text-align: center;
line-height: 60px;
}
.right-line {
border-left: 1px solid #E0E0E0;
}
.item-default {
color: #B0B0B0;
}
.item-selected {
color: #444444;
}
}
.coupon-list {
background: #f5f5f5;
.item {
width: 100%;
margin-top: 20px;
}
.item-bg {
background: url(~statics/image/coupon/bg@3x.png) no-repeat;
width: 710px;
height: 200px;
background-size: cover;
margin: 0 auto;
display: flex;
position: relative;
}
.item-left {
width: 230px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.item-price {
font-size: 72px;
color: #002B47;
}
.item-rule {
font-size: 24px;
margin-top: 4px;
color: #002B47;
}
}
.item-right {
margin-left: 6px;
.item-name {
font-size: 24px;
color: #222;
margin-top: 22px;
}
.item-type {
color: #002B47;
}
.item-time {
margin-top: 36px;
font-size: 22px;
color: #999;
}
.item-desc-btn{
margin-top: 26px;
font-size: 22px;
color: #999;
}
.time-up {
background: url(~statics/image/coupon/time-up@3x.png) no-repeat;
background-size: cover;
position: absolute;
top: 0;
right: 0;
width: 80px;
height: 80px;
}
.item-used-flag {
background: url(~statics/image/coupon/used@3x.png) no-repeat;
background-size: cover;
position: absolute;
right: 30px;
width: 130px;
height: 130px;
top: 30px;
}
.item-overtime-flag {
background: url(~statics/image/coupon/overtime@3x.png) no-repeat;
background-size: cover;
position: absolute;
right: 30px;
width: 130px;
height: 130px;
top: 30px;
}
}
.gray {
color: #ccc;
}
.item-gray-bg {
background: url(~statics/image/coupon/bg-gray@3x.png) no-repeat;
width: 710px;
height: 200px;
background-size: cover;
margin: 0 auto;
display: flex;
position: relative;
}
}
</style>
... ...
... ... @@ -3,6 +3,7 @@ import Trade from './tradeIncome';
import Favorite from './favorite';
import news from './news';
import Income from './income';
import Coupon from './coupon';
export default [
{
... ... @@ -83,5 +84,6 @@ export default [
...Mine,
...Trade,
...Favorite,
...Income
...Income,
...Coupon
];
... ...
... ... @@ -33,11 +33,19 @@ export default {
break;
}
case 2: {
this.go('NewsPage');
this.$yoho.auth().then((res) => {
if(res) {
this.go('NewsPage');
}
})
break;
}
case 3: {
this.go('MinePage');
this.$yoho.auth().then((res) => {
if(res) {
this.go('MinePage');
}
})
break;
}
default: {
... ...
... ... @@ -11,7 +11,7 @@
</template>
<script>
export default {
export default {
name: 'news',
props: {
list: {
... ...
... ... @@ -33,12 +33,6 @@ export default {
},
title: '',
type: '',
list: [
{"name":"您的商品AIR JORDAN 4 RETRO PURE MONEY 2017已被用户下单,请及时发货","time":"2018.08.08 17:20"},
{"name":"您的商品AIR JORDAN 4 RETRO PURE MONEY 2017已被用户下单,请及时发货","time":"2018.08.08 17:20"},
{"name":"您的商品AIR JORDAN 4 RETRO PURE MONEY 2017已被用户下单,请及时发货","time":"2018.08.08 17:20"},
{"name":"您的商品AIR JORDAN 4 RETRO PURE MONEY 2017已被用户下单,请及时发货","time":"2018.08.08 17:20"}, {"name":"您的商品AIR JORDAN 4 RETRO PURE MONEY 2017已被用户下单,请及时发货","time":"2018.08.08 17:20"},
]
}
},
computed: {
... ... @@ -63,7 +57,6 @@ export default {
isPage: false
}
await this.fetchNewsList(params);
this.$refs.scroll.forceUpdate();
}
},
components: {
... ...
... ... @@ -69,9 +69,7 @@
<div v-if="actionList.length > 0" class="footer-wrapper">
<div v-if="statusDetail.status === 0">
<p class="real-pay-price">
¥{{ orderDetail.priceInfo.realPayPrice }}
</p>
<p class="real-pay-price">¥{{ priceInfo.realPayPrice }}</p>
<p>实付金额</p>
</div>
<order-actions
... ...
... ... @@ -48,11 +48,11 @@ export default {
}
},
methods: {
...mapMutations(["setOrderStatus", "resetOrderData"]),
...mapMutations(["setOrderStatus", "resetPartialData"]),
...mapActions(["fetchOrderList"]),
onHandleClick(status) {
this.setOrderStatus(status);
this.resetOrderData();
this.resetPartialData();
const { owner } = this.$route.params;
this.fetchOrderList({ owner, status });
}
... ...
... ... @@ -65,8 +65,6 @@ const { mapActions: orderListMapActions } = createNamespacedHelpers(
"order/orderList"
);
const { mapMutations: orderMapMutations } = createNamespacedHelpers("order");
export default {
components: {
Scroll,
... ... @@ -96,14 +94,13 @@ export default {
// store.dispatch("order/orderList/fetchOrderList", { owner, status });
},
activated() {
this.reset("inSaleOrderList");
this.resetData();
this.fetchData();
},
methods: {
...mapActions(["fetchEntryOrderList", "fetchNotEntryOrderList"]),
...orderListMapActions(["cancelTradeConfirmInfo", "cancelTrade"]),
...mapMutations(["filterOrderList"]),
...orderMapMutations(["reset"]),
...mapMutations(["filterOrderList", "resetData"]),
fetchData() {
if (this.isFetchEntryOrder) {
this.fetchEntryOrderList();
... ... @@ -172,7 +169,7 @@ export default {
</script>
<style lang="scss" scoped>
.content-wrapper {
height: calc(100vh - 200px);
height: calc(100vh - 100px);
overflow-x: hidden;
overflow-y: auto;
-webkit-box-orient: vertical;
... ...
... ... @@ -61,8 +61,6 @@ const { mapActions, mapState, mapMutations } = createNamespacedHelpers(
"order/orderList"
);
const { mapMutations: orderMapMutations } = createNamespacedHelpers("order");
export default {
components: {
Scroll,
... ... @@ -89,7 +87,7 @@ export default {
// store.dispatch("order/orderList/fetchOrderList", { owner, status });
},
activated() {
this.reset("orderList");
this.resetData();
this.fetchData();
},
methods: {
... ... @@ -99,8 +97,7 @@ export default {
"cancelTrade",
"deleteOrder"
]),
...mapMutations(["setOrderStatus", "filterOrderList"]),
...orderMapMutations(["reset"]),
...mapMutations(["setOrderStatus", "filterOrderList", "resetData"]),
fetchMore() {
this.fetchOrderList(this.$route.params);
},
... ... @@ -160,7 +157,7 @@ export default {
owner
});
if (isOk) {
this.reset("orderList");
this.resetData();
this.fetchData(this.$route.params);
}
const txt = isOk ? "取消成功" : "取消失败";
... ... @@ -187,7 +184,7 @@ export default {
</script>
<style lang="scss" scoped>
.content-wrapper {
height: calc(100vh - 200px);
height: calc(100vh - 100px);
overflow-x: hidden;
overflow-y: auto;
-webkit-box-orient: vertical;
... ...
... ... @@ -18,8 +18,7 @@
@select="onSelectSize"
@add="onAdd" />
<transition name="slide-up">
<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>
<div class="footer">
<cube-button @click="select" :class="{active: isTradable}">{{config.title}}</cube-button>
</div>
</transition>
... ... @@ -97,25 +96,6 @@ export default {
isTradable() {
return this.isAvailable && this.selectedSize.storage_num > 0 && this.selectedSize.least_price !== '-';
},
/**
* 变现价格,使用bid_moster_price
*/
cashPrice() {
if (this.selectedSize && this.selectedSize.hasOwnProperty('bid_moster_price')) {
return this.selectedSize.bid_moster_price;
}
return '-';
},
/**
* 可变现
* 通过bid_moster_price或bid_skup判断
*/
isMarketable() {
return this.cashPrice > 0;
}
},
mounted() {
this.$refs.popup.show();
... ... @@ -148,14 +128,6 @@ export default {
bid_skup: this.selectedSize.bid_skup,
});
},
convertToCash() {
if (!this.isMarketable) {
return;
}
this.hide();
// TODO: TBD
},
},
};
</script>
... ...
... ... @@ -51,12 +51,13 @@ export default function() {
},
async fetchChannelList({ commit }) {
const result = await this.$api.get('/api/ufo/channel/channelList', {
content_code: 'b4c2aa846b56ad7e51e7255c2ee4c1f9',
content_code: 'f788335b57b67c1711f255648c744dab',
// uid: '64668089',
uid: '500031170',
});
if (result.code === 200) {
commit(Types.FETCH_CHANNEL, { list: result.data });
return result.data;
}
}
},
... ...
... ... @@ -54,7 +54,7 @@ export default function() {
let params = {
page: couponData.page,
limit: couponData.limit,
type: couponData.limit,
type: couponData.type,
};
if (param.isReset) {
... ... @@ -63,7 +63,7 @@ export default function() {
params.page += 1;
}
params.uid = uid;
let result = await this.$api.get('api/ufo/coupon/list', {...params});
let result = await this.$api.get('/api/ufo/coupon/list', {...params});
if (result.code === 200) {
let data = result.data;
... ... @@ -82,7 +82,7 @@ export default function() {
commit('addList', { data: couponData });
}
}
return result.data || [];
return couponData.list || [];
},
},
};
... ...
... ... @@ -5,7 +5,7 @@ import moment from 'moment';
import { sellerOrderStatus, ownType } from '../../../constants/order-constants';
// const uid = '600046428';
const uid = '500031424';
// const uid = '500031424';
const MINE_RESOURCE_CODE1 = '11a73219a63b50067d88e75c0fe04d10';
const MINE_RESOURCE_CODE2 = 'dc2731fbbebcba6329c74a379e9c41ec';
... ... @@ -296,11 +296,9 @@ export default function() {
async fetchResource({ commit }) {
const result = await this.$api.get('/api/ufo/mine/resource', {
content_code: MINE_RESOURCE_CODE1,
uid,
});
const result1 = await this.$api.get('/api/ufo/mine/resource', {
content_code: MINE_RESOURCE_CODE2,
uid,
});
if (result.code === 200) {
... ... @@ -327,7 +325,6 @@ export default function() {
async fetchSellerOrder({ commit }) {
const result = await this.$api.get(
'/api/ufo/mine/seller/orderSummary',
{ uid },
);
if (result.code === 200) {
... ... @@ -335,9 +332,7 @@ export default function() {
}
},
async fetchFavoriteNum({ commit }) {
const result = await this.$api.get('/api/ufo/mine/favoriteNum', {
uid,
});
const result = await this.$api.get('/api/ufo/mine/favoriteNum');
if (result.code === 200) {
commit('addFavoriteNum', {
... ... @@ -346,16 +341,14 @@ export default function() {
}
},
async fetchOrderSummary({ commit }) {
const result = await this.$api.get('/api/ufo/mine/order/summary', {
uid,
});
const result = await this.$api.get('/api/ufo/mine/order/summary');
if (result.code === 200) {
commit('addOrderSummary', { data: result.data });
}
},
async fetchCoupon({commit}) {
const result = await this.$api.get('/api/ufo/mine/coupon', {uid});
const result = await this.$api.get('/api/ufo/mine/coupon');
if (result.code === 200) {
commit('addCouponSummary', { count: result.data});
... ... @@ -380,7 +373,6 @@ export default function() {
const result = await this.$api.get('/api/ufo/mine/assets', {
page,
limit: pageSize,
uid,
});
// commit('assetFetching', {isFetching: false});
... ... @@ -421,7 +413,6 @@ export default function() {
const result = await this.$api.get('/api/ufo/mine/wallet', {
page,
limit: pageSize,
uid,
tradeType,
startTime,
endTime,
... ... @@ -441,18 +432,14 @@ export default function() {
},
async fetchUserWalletInfo({ commit }) {
const result = await this.$api.get('/api/ufo/mine/userWalletInfo', {
uid,
});
const result = await this.$api.get('/api/ufo/mine/userWalletInfo');
if (result.code === 200) {
commit('addUserWalletInfo', result.data);
}
},
async fetchWalletFilter({ commit }) {
const result = await this.$api.get('/api/ufo/mine/walletFilter', {
uid,
});
const result = await this.$api.get('/api/ufo/mine/walletFilter');
if (result.code === 200) {
commit('addfilterData', result.data);
... ...
... ... @@ -33,8 +33,6 @@ export default function() {
let totalPage = state.newsList.totalPage;
let type = obj && obj.type;
let isPage = obj && obj.isPage;
console.log(state.newsList.totalPage);
console.log('页码2');
// 页面跳转重置page页码
isPage ? page = 1 : state.newsList.page + 1;
... ...
const initailData = () => ({
entryOrder: {
page: 1,
pageSize: 10,
pagetotal: 0,
list: [], // 订单列表
pullUpload: true,
},
notEntryOrder: {
page: 1,
pageSize: 10,
pagetotal: 0,
list: [], // 订单列表
pullUpload: true,
},
isShowEmpty: false,
});
export default function() {
return {
namespaced: true,
state: {
entryOrder: {
page: 1,
pageSize: 10,
pagetotal: 0,
list: [], // 订单列表
pullUpload: true,
},
notEntryOrder: {
page: 1,
pageSize: 10,
pagetotal: 0,
list: [], // 订单列表
pullUpload: true,
},
isShowEmpty: false,
},
state: initailData,
mutations: {
setEntryOrder(state, res) {
let { page, pagetotal, data = [] } = res;
... ... @@ -58,6 +60,13 @@ export default function() {
state.entryOrder.list.length === 0 &&
state.notEntryOrder.list.length === 0;
},
resetData(state) {
const s = initailData();
Object.keys(s).forEach(key => {
state[key] = s[key];
});
},
},
getters: {
// scroll 组件参数,是否触发上拉事件
... ...
... ... @@ -6,16 +6,6 @@ import orderLogistics from './order-logistics';
import orderDeliver from './order-deliver';
import inSaleOrderList from './in-sale-order-list';
const initialState = {
priceChange: priceChange().state,
orderList: orderList().state,
orderConfirm: orderConfirm().state,
orderDetail: orderDetail().state,
logisticsInfo: orderLogistics().state,
orderDeliver: orderDeliver().state,
inSaleOrderList: inSaleOrderList().state,
};
export default function() {
return {
namespaced: true,
... ... @@ -28,27 +18,5 @@ export default function() {
orderDeliver: orderDeliver(),
inSaleOrderList: inSaleOrderList(),
},
state: {
resetFlag: false,
},
mutations: {
/**
* reset module state
* @param {*} state
* @param { Array | String} moduleNames 模块名
*/
reset(state, moduleNames = []) {
if (typeof moduleNames === 'string') {
moduleNames = [moduleNames];
}
console.log('------reset module name------------', moduleNames);
// 修改flag,监听后reload
state.resetFlag = !state.resetFlag;
for (const name of moduleNames) {
Object.assign(state[name], initialState[name]);
}
},
},
};
}
... ...
const initailData = () => ({
page: 1,
pageSize: 10,
pagetotal: 0,
orderList: [], // 订单列表
// scroll 组件参数,是否触发上拉事件
pullUpLoad: true,
// 当前查询订单状态
currentStatus: 1,
isShowEmpty: false,
});
export default function() {
return {
namespaced: true,
modules: {},
state: {
page: 1,
pageSize: 10,
pagetotal: 0,
orderList: [], // 订单列表
// scroll 组件参数,是否触发上拉事件
pullUpLoad: true,
// 当前查询订单状态
currentStatus: 1,
routerParam: {},
isShowEmpty: false,
},
state: initailData,
mutations: {
setOrderList(state, res) {
let { page, pagetotal, data = [] } = res;
... ... @@ -39,12 +39,19 @@ export default function() {
setOrderStatus(state, currentStatus) {
state.currentStatus = +currentStatus;
},
resetOrderData(state) {
resetPartialData(state) {
state.page = 1;
state.orderList = [];
state.pagetotal = 0;
state.pullUpLoad = true;
},
resetData(state) {
const s = initailData();
Object.keys(s).forEach(key => {
state[key] = s[key];
});
},
},
actions: {
/**
... ...
module.exports = {
'/api/address/gethidden': {
auth: true,
api: 'app.address.gethidden',
params: {}
},
'/api/address/getTags': {
auth: true,
api: 'app.address.getTags',
params: {}
},
'/api/address/getProvinces': {
auth: true,
api: 'app.address.provinces',
params: {}
},
'/api/address/addAddress': {
auth: true,
api: 'app.address.add',
params: {}
},
'/api/address/updateAddress': {
auth: true,
api: 'app.address.update',
params: {}
},
'/api/address/delAddress': {
auth: true,
api: 'app.address.del',
params: {}
},
'/api/address/setDefaultAddress': {
auth: true,
api: 'app.address.setdefault',
params: {}
},
... ...
... ... @@ -107,16 +107,15 @@ module.exports = {
uid: { type: Number },
},
},
'api/ufo/coupon/list': {
'/api/ufo/coupon/list': {
ufo: true,
// auth: true,
path: '/ufo-gateway/coupon',
api: 'ufo.coupons.list',
param: {
uid: { type: Number },
page: {type: Number},
limit: {type: Number},
type: {type: Number}
type: {type: String},
uid: { type: Number },
}
},
};
... ...
... ... @@ -57,6 +57,7 @@
"passport": "^0.4.0",
"passport-oauth": "^1.0.0",
"qiniu": "^7.2.1",
"query-string": "^6.8.3",
"request": "^2.88.0",
"request-promise": "^4.2.2",
"serve-favicon": "^2.5.0",
... ...
... ... @@ -8318,6 +8318,15 @@ qs@^6.4.0:
resolved "http://npm.yohops.com/qs/-/qs-6.6.0.tgz#a99c0f69a8d26bf7ef012f871cdabb0aee4424c2"
integrity sha1-qZwPaajSa/fvAS+HHNq7Cu5EJMI=
query-string@^6.8.3:
version "6.8.3"
resolved "http://npm.yohops.com/query-string/-/query-string-6.8.3.tgz#fd9fb7ffb068b79062b43383685611ee47777d4b"
integrity sha1-/Z+3/7Bot5BitDODaFYR7kd3fUs=
dependencies:
decode-uri-component "^0.2.0"
split-on-first "^1.0.0"
strict-uri-encode "^2.0.0"
querystring-es3@^0.2.0:
version "0.2.1"
resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
... ... @@ -9499,6 +9508,11 @@ specificity@^0.4.1:
resolved "http://npm.yohops.com/specificity/-/specificity-0.4.1.tgz#aab5e645012db08ba182e151165738d00887b019"
integrity sha1-qrXmRQEtsIuhguFRFlc40AiHsBk=
split-on-first@^1.0.0:
version "1.1.0"
resolved "http://npm.yohops.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f"
integrity sha1-9hCv7uOxK84dDDBCXnY5i3gkml8=
split-string@^3.0.1, split-string@^3.0.2:
version "3.1.0"
resolved "http://npm.yohops.com/split-string/-/split-string-3.1.0.tgz#7cb09dda3a86585705c64b39a6466038682e8fe2"
... ... @@ -9632,6 +9646,11 @@ stream-shift@^1.0.0:
resolved "https://registry.yarnpkg.com/stream-shift/-/stream-shift-1.0.0.tgz#d5c752825e5367e786f78e18e445ea223a155952"
integrity sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=
strict-uri-encode@^2.0.0:
version "2.0.0"
resolved "http://npm.yohops.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546"
integrity sha1-ucczDHBChi9rFC3CdLvMWGbONUY=
string-length@^2.0.0:
version "2.0.0"
resolved "http://r.cnpmjs.org/string-length/download/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed"
... ...