Authored by lea guo

物流信息

... ... @@ -88,13 +88,21 @@ export default {
this.hide();
this.$emit('closeAction');
},
pay() {
delay(ns) {
return new Promise(resolve => {
setTimeout(resolve, ns);
});
},
async pay() {
this.$emit('confirmAction');
const toast = this.$createToast({
txt: '正在调起支付宝'
txt: '正在调起支付宝',
mask: true
}).show();
await this.delay(1500);
this.payAction({
orderCode: this.orderCode
}).then((result) => {
... ...
... ... @@ -13,6 +13,8 @@ import OrderPromotionList from 'components/order-promotion-list';
import Bind from 'components/bind';
import sdk from 'yoho-activity-sdk';
import { initClient } from 'utils/init-client';
import 'statics/scss/common.scss';
import 'statics/font/iconfont.css';
import 'statics/font/ufofont.css';
... ...
<template>
<div class="income-filter">
<div class="month-filter" @click="showDate">{{monthPicker}}<i class="cubeic-select"></i></div>
<div class="month-filter" @click="showDate">{{currentYear}}年{{currentMonth}}月 <i class="cubeic-select"></i></div>
<div class="type-filter" @click="showPicker"><span class="filter-img"></span><span>{{typeFilter}}</span></div>
</div>
</template>
... ... @@ -14,7 +14,8 @@ export default {
name: 'income-filter',
data() {
return {
monthPicker: '2019年9月 ',
currentYear: '',
currentMonth: '',
typeFilter: '筛选',
}
},
... ... @@ -27,21 +28,35 @@ export default {
},
created() {
this.fetchWalletFilter()
this.setCurrentDate()
},
methods: {
...mapActions(['fetchWalletFilter','fetchWallet']),
setCurrentDate() {
let year = moment().year()
let month = moment().month() + 1
this.currentYear = ''+year
this.currentMonth = ''+month
},
showDate() {
// 计算picker当前选中索引值
let yearArr = this.getYearMonth[0].map((item) => item.value)
let monthArr = this.getYearMonth[1].map((item) => item.value)
let yearIndex = yearArr.indexOf(this.currentYear)
let monthIndex = monthArr.indexOf(this.currentMonth)
if (!this.datePicker) {
this.datePicker = this.$createPicker({
data: this.getYearMonth,
selectedIndex: [yearIndex, monthIndex],
onSelect: this.selectHandle
})
}
this.datePicker.show()
},
selectHandle(selectedVal, selectedIndex, selectedText) {
this.monthPicker = selectedText[0]+'年'+selectedText[1] + '月 ';
this.currentYear = selectedText[0];
this.currentMonth = selectedText[1];
let selected = selectedVal.join('-')
let days = moment(selected, "YYYY-MM").daysInMonth();
let startDay = selected+'-01';
... ... @@ -78,7 +93,7 @@ export default {
<style lang="scss" scoped>
.income-filter {
background-color: #F5F7F9;
background-color: #F0F0F0;
padding: 0 40px;
height: 90px;
line-height: 90px;
... ...
... ... @@ -48,8 +48,7 @@ export default {
margin: 0 40px;
justify-content: space-between;
align-items: center;
padding-top: 30px;
padding-bottom: 30px;
height: 140px;
border-bottom: solid 1px #E0E0E0;
}
... ... @@ -105,7 +104,7 @@ export default {
color: #D0021B;
}
.assets-record-income-desc {
color: #999;
color: #444;
margin-top: 5px;
}
</style>
... ...
<template>
<LayoutApp :show-back="true">
<LayoutApp :show-back="true" title="我的收入">
<div class="body" ref="body">
<incomeHeader></incomeHeader>
</div>
... ...
<template>
<LayoutApp :show-back="true">
<LayoutApp :show-back="true" title="收入明细">
<div class="body" ref="body">
<Scroll
... ... @@ -9,9 +9,12 @@
@pulling-down="onPullingDown"
@pulling-up="onPullingUp">
<incomeFilter></incomeFilter>
<template v-for="(item,index) in walletData.list">
<incomeItem :data="item" :key="index"></incomeItem>
</template>
<div v-if="walletData.list.length > 0">
<template v-for="(item,index) in walletData.list">
<incomeItem :data="item" :key="index"></incomeItem>
</template>
</div>
<UfoNoItem class="noData" :tip="`暂无明细数据`" v-else></UfoNoItem>
<template v-if="customPullDown" slot="pulldown" slot-scope="props">
<pullDown :propsData="props" :pullDownRefreshThreshold="pullDownRefreshThreshold"></pullDown>
</template>
... ... @@ -27,8 +30,9 @@ import pullDown from './components/pullDown';
import { createNamespacedHelpers } from 'vuex';
import {Style, Scroll} from 'cube-ui';
import scrollMixin from '../../../mixins/scroll';
import UfoNoItem from '../../../components/ufo-no-item'
const {mapState, mapActions} = createNamespacedHelpers('home/mine');
import moment from 'moment';
export default {
mixins: [scrollMixin],
data() {
... ... @@ -47,8 +51,20 @@ export default {
}),
},
watch: {
"walletData.list": function(val) {
if(val.length === 0) {
this.$refs.scroll.disable()
} else {
this.$refs.scroll.enable()
}
}
},
created() {
this.fetchWallet({isRefresh:true})
let startDay = moment().format('YYYY-MM') + '-01';
let startTime = moment(startDay).startOf('d').unix();
let endTime = moment(Date.now()).unix();
this.fetchWallet({isRefresh:true, startTime, endTime})
},
methods: {
...mapActions(['fetchWallet']),
... ... @@ -68,7 +84,8 @@ export default {
incomeFilter,
pullDown,
Style,
Scroll
Scroll,
UfoNoItem
}
};
</script>
... ... @@ -80,4 +97,7 @@ export default {
background-color: white;
color: #999;
}
.noData {
margin: 90px 0;
}
</style>
... ...
<template>
<LayoutApp :show-back="true">
<LayoutApp :show-back="true" title="我的">
<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>
... ...
... ... @@ -60,27 +60,34 @@ export default {
type: 6
};
},
deactivated: function() {
this.initData();
},
activated: function() {
this.changeArrow();
let params = this.$route.query;
if (Object.keys(params).length && params.listType) {
this.listType = params.listType;
delete params.listType;
}
if (Object.keys(params).length && params.type) {
this.type = params.type;
} else {
params.type = 6;
}
!params.order && (params.order = 'sale_desc');
params.listPage = true
this.fetchProductList({...params, isReset: true});
this.fetchFilterData(params);
},
methods: {
...mapActions(['fetchProductList', 'fetchFilterData']),
...mapActions(['fetchProductList', 'fetchFilterData', 'initData']),
// 上拉加载
async onPullingUp() {
await this.fetchProductList({listType: this.listType});
await this.fetchProductList();
},
// 点击tab type, 0: 推荐, 1: 价格, 2: 人气, 3: 新品
... ...
... ... @@ -11,7 +11,7 @@ const ALIPAY_DOMAIN = 'https://openapi.alipay.com/gateway.do';
export default {
name: 'PayPage',
props: ['orderCode', 'payParams', 'type'],
props: ['orderCode', 'payParams', 'extra'],
mounted() {
if (this.payParams) {
const url = ALIPAY_DOMAIN + '?' + this.payParams;
... ...
... ... @@ -17,10 +17,12 @@
<size-list class="select-content size-list" :list="list" :addSize="canAddSize" :selected="selectedSize"
@select="onSelectSize"
@add="onAdd" />
<div class="footer">
<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: isTradable }">{{config.title}}</cube-button>
</div>
<transition name="slide-up">
<div class="footer" v-if="isTradable">
<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>
</div>
</transition>
</div>
</div>
</action-sheet>
... ... @@ -275,6 +277,7 @@ export default {
justify-content: space-between;
@include cube-ufo-btn;
span {
font-size: 28px;
... ... @@ -284,4 +287,14 @@ export default {
}
}
}
.slide-up-enter,
.slide-up-leave-to {
transform: translateY(60%);
opacity: 0;
}
.slide-up-enter-active,
.slide-up-leave-active {
transition: all 0.3s ease-in;
}
</style>
... ...
... ... @@ -165,7 +165,7 @@ export default function() {
for (let i = 0; i <= monthNum; i++) {
let month = Number(beginMonth) + i;
month = month < 10 ? '0' + month : month;
month = month < 10 ? '0' + month : '' + month;
monthsData.push({ text: month, value: month });
}
... ... @@ -405,10 +405,8 @@ export default function() {
{ commit, state },
{ isRefresh, tradeType = 0, startTime = 0, endTime = 0 },
) {
if (isRefresh) {
commit('changeWalletType', tradeType);
commit('changeWalletTime', { startTime, endTime });
}
commit('changeWalletType', tradeType);
(startTime && endTime) && commit('changeWalletTime', { startTime, endTime });
let {
isFetching,
endReached,
... ... @@ -425,7 +423,6 @@ export default function() {
}
let oldList = isRefresh ? [] : list;
// commit('assetFetching', {isFetching: true});
let page = isRefresh ? 1 : currentPage + 1;
const result = await this.$api.get('/api/ufo/mine/wallet', {
page,
... ... @@ -436,7 +433,6 @@ export default function() {
endTime,
});
// commit('assetFetching', {isFetching: false});
if (result.code === 200) {
let data = result.data;
... ...
import {get} from 'lodash';
export default function() {
return {
namespaced: true,
... ... @@ -18,7 +16,7 @@ export default function() {
},
searchParams: {
type: 0, // type:0,推荐;1,热销;2,即将发售; 3,品类; 4,品牌;5,系列;6,搜索 7, 收藏
order: 'sale_desc', // 指定排序
order: '', // 指定排序
productPool: null, // 商品池id
sort: null, // 品类id
brand: null, // 品牌id
... ... @@ -59,7 +57,8 @@ export default function() {
}
},
setSearchParams(state, {params}) {
state.searchParams = Object.assign(state.searchParams, params);
console.log(params)
state.searchParams = params || {};
},
addFilterData(state, {filter}) {
state.filterData = filter;
... ... @@ -87,23 +86,74 @@ export default function() {
},
setDefaultSearchWords(state, {defaultSearchWord}) {
state.defaultSearchWord = defaultSearchWord;
},
initData(state) {
state = {
productList: {
showErrorPage: false,
isFetching: false,
error: null,
page: 0, // 当前页
page_size: 10, // 每页数量
page_total: 0, // 总共多少页
total: 0, // 总共多少条
endReached: false, // 到达底部
list: [], // 商品列表
isEmpty: false,
},
searchParams: {
type: 0, // type:0,推荐;1,热销;2,即将发售; 3,品类; 4,品牌;5,系列;6,搜索 7, 收藏
order: '', // 指定排序
productPool: null, // 商品池id
sort: null, // 品类id
brand: null, // 品牌id
series: null, // 系列id
gender: null, // 性别
size: null, // 尺码id
isSoonSale: null, // 是否是即将售卖
query: null, // 搜索词
limit: null, // 每页记录数
page: null, // 当前页号
coupon_token: null, // 优惠券token
},
filterParams: {
sort: [], // 品类id
brand: [], // 品牌id
gender: [], // 性别
size: [], // 尺码id
},
filterData: [],
filterVisible: false,
searchWord: [],
defaultSearchWord: [],
searchSuggestList: [],
};
}
},
actions: {
//查询商品列表
fetchProductList: async function({commit, state}, params) {
let searchParams = state.searchParams;
let list = state.productList;
let pageSize = list.page_size;
let isReset = false;
let isReset = false, isHome = false;
if (params && params.isReset) {
isReset = true;
delete params.isReset;
}
if (params && Object.keys(params).length) {
searchParams = Object.assign({...searchParams}, params);
if (params && params.isHome) {
isHome = true;
delete params.isHome;
}
if (!isHome && params && Object.keys(params).length) {
searchParams = Object.assign({...searchParams}, params)
commit('setSearchParams', {params: searchParams});
}
isHome && (searchParams = params || {});
if (!isReset && (list.endReached || (!list.endReached && list.page_total === 1))) {
return;
}
... ... @@ -129,6 +179,8 @@ export default function() {
return result.data ? result.data.length : 0;
},
//查询筛选列表
fetchFilterData: async function({commit, state}) {
let searchParams = state.searchParams;
... ... @@ -140,28 +192,42 @@ export default function() {
commit('addFilterData', {filter: data.filter});
}
},
// 设置筛选参数
setFilterParam: function({commit}, params) {
commit('setFilterParam', {filter: params});
},
// 设置查询参数
setSearchQuery: function({commit}, query) {
commit('setSearchQuery', {query});
},
// 请求查询关键词
fetchSearchWords: async function({commit}) {
let result = await this.$api.get('/api/ufo/list/searchWords', { word_type: 0});
commit('setSearchWords', {searchWord: result.data});
},
// 请求默认查询关键词
fetchDefaultSearchWords: async function({commit}) {
let result = await this.$api.get('/api/ufo/list/searchWords', { word_type: 1});
commit('setDefaultSearchWords', {defaultSearchWord: result.data});
},
// 联动查询输入关键词
fetchSearchSuggest: async function({commit}, query) {
let result = await this.$api.get('/api/ufo/list/searchSuggest', {query});
commit('setSearchSuggest', {searchSuggestList: result.data});
},
initData: function({commit}) {
commit('initData');
}
}
};
... ...
import Vue from 'vue';
const setWindowSize = (store) => {
const { clientWidth, clientHeight } = document.body;
store.commit('SET_WINDOW_SIZE', { clientWidth, clientHeight });
};
const initClient = (store) => {
setWindowSize(store);
window.onresize = () => {
setWindowSize(store);
};
let supportsPassive = false;
try {
const opts = Object.defineProperty({}, 'passive', {
get() {
supportsPassive = true;
return true;
}
});
window.addEventListener('test', null, opts);
} catch (e) { } //eslint-disable-line
store.commit('SET_SUPPORT_PASSIVE', { supportsPassive });
let img = new Image();
img.onload = () => {
if (img.width > 0 && img.height > 0) {
store.commit('SET_SUPPORT_WEBP', { supportWebp: true });
}
};
img.src = 'data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA';
Vue.$sdk.getUser().then(user => {
if (user && user.uid) {
store.commit('SET_LOGIN_INFO', user);
}
});
};
export {
initClient
};
... ...
... ... @@ -12,10 +12,10 @@ module.exports = {
// 查询是否收藏
'/api/ufo/product/fav': {
ufo: true,
auth: false,
auth: true,
api: 'ufo.user.isFavorite',
params: {
product_id: {type: Number}, // 商品id
productId: {type: Number}, // 商品id
},
},
... ...