推荐重写

This commit is contained in:
chenhui0212
2019-03-11 21:23:27 +08:00
parent 656f7b1d66
commit e0a3bb4cc4
12 changed files with 288 additions and 219 deletions

View File

@@ -52,3 +52,11 @@ export function pointList (params = {}) {
export function pointTotal () {
return req.get('http://pjj.aixue7.com/index.php/api/h5app/wxapp/point/member/info')
}
export function depositList (params = {}) {
return req.get('http://pjj.aixue7.com/index.php/api/h5app/weapp/deposit/list', params)
}
export function depositTotal () {
return req.get('http://pjj.aixue7.com/index.php/api/h5app/weapp/deposit/info')
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

View File

@@ -1,6 +1,6 @@
import Taro, { Component } from '@tarojs/taro'
import {Button, Image, Text, View} from '@tarojs/components'
import {AtBadge, AtButton} from 'taro-ui'
import { pickBy, formatDataTime } from '@/utils'
import api from '@/api'
import './cashier-result.scss'
@@ -10,13 +10,47 @@ export default class CashierResult extends Component {
super(props)
this.state = {
info: {}
}
}
componentDidShow () {
this.fetch()
}
async fetch () {
const { order_id } = this.$router.params
const { orderInfo, tradeInfo } = await api.cashier.getOrderDetail(order_id)
const infoOrder = pickBy(orderInfo, {
create_time: ({ create_time }) => (formatDataTime(create_time * 1000)),
order_id: 'order_id',
})
const infoTrade = pickBy(tradeInfo, {
payDate: 'payDate',
tradeId: 'tradeId',
})
let info = Object.assign(infoOrder, infoTrade, this.$router.params)
// console.log(info, 33)
this.setState({
info: info
})
}
handleClickBack = (order_id) => {
Taro.navigateTo({
url: `/pages/trade/detail?id=${order_id}`
})
}
handleClickRoam = () => {
Taro.navigateTo({
url: '/pages/item/list'
})
}
render () {
// const { list, pluralType, imgType, currentIndex } = this.state
const { info } = this.state
return (
<View className='page-cashier-index'>
@@ -26,36 +60,43 @@ export default class CashierResult extends Component {
<Image
className='note__img'
mode='aspectFill'
src='/assets/imgs/pay_fail.png'
src={`/assets/imgs/pay_${info.payStatus}.png`}
/>
</View>
<View className='cashier-result__info'>
{/*<View className='cashier-result__info-title'>订单支付成功</View>*/}
<View className='cashier-result__info-title'>订单支付失败</View>
<View className='cashier-result__info-news'>单号B2C123102831</View>
<View className='cashier-result__info-news'>创建时间2016-06-16 16:54:09</View>
<View className='cashier-result__info-news'>支付时间2016-06-16 16:54:09</View>
<View className='cashier-result__info-title'>订单支付{info.payStatus === 'fail' ? '失败' : '成功'}</View>
<View className='cashier-result__info-news'>订单{info.order_id}</View>
<View className='cashier-result__info-news'>支付单号{info.tradeId}</View>
<View className='cashier-result__info-news'>创建时间{info.create_time}</View>
{
info.payStatus === 'success' ? <View className='cashier-result__info-news'>支付时间{info.payDate}</View> : null
}
</View>
</View>
</View>
<View className='goods-buy-toolbar'>
{/*<View className='goods-buy-toolbar__btns'>*/}
{/*<Button*/}
{/*className='goods-buy-toolbar__btn btn-add-cart'*/}
{/*// onClick={onClickAddCart}*/}
{/*>继续购物</Button>*/}
{/*<Button*/}
{/*className='goods-buy-toolbar__btn btn-fast-buy'*/}
{/*// onClick={onClickFastBuy}*/}
{/*>订单详情</Button>*/}
{/*</View>*/}
<View className='goods-buy-toolbar__btns'>
<Button
className='goods-buy-toolbar__btn btn-fast-buy'
// onClick={onClickFastBuy}
>返回订单详情</Button>
</View>
{
info.payStatus === 'fail'
? <View className='goods-buy-toolbar__btns'>
<Button
className='goods-buy-toolbar__btn btn-fast-buy'
onClick={this.handleClickBack.bind(this, info.order_id)}
>返回订单详情</Button>
</View>
: <View className='goods-buy-toolbar__btns'>
<Button
className='goods-buy-toolbar__btn btn-add-cart'
onClick={this.handleClickRoam}
>继续购物</Button>
<Button
className='goods-buy-toolbar__btn btn-fast-buy'
onClick={this.handleClickBack.bind(this, info.order_id)}
>订单详情</Button>
</View>
}
</View>
</View>
)

View File

@@ -59,8 +59,19 @@ export default class Cashier extends Component {
pay_type: pay_pay_type,
order_type: info.order_type,
}
let res = await api.cashier.getPayment(query)
console.log(res)
await api.cashier.getPayment(query)
.then(res=> {
Taro.redirectTo({
url: `/pages/cashier/cashier-result?payStatus=success&order_id=${info.order_id}`
})
console.log(res)
})
.catch(error => {
Taro.redirectTo({
url: `/pages/cashier/cashier-result?payStatus=fail&order_id=${info.order_id}`
})
console.log(error)
})
}
// handleClickPayment = async (val) => {
// const { info } = this.state

View File

@@ -10,7 +10,8 @@ export default class Index extends Component {
componentWillMount () {
if (process.env.NODE_ENV === 'development') {
Taro.redirectTo({
url: '/pages/item/point-list'
url: '/pages/member/recommend'
// url: '/pages/item/espier-detail?id=268'
})
}
}

View File

@@ -4,6 +4,7 @@ import {View, Text, ScrollView} from '@tarojs/components'
import { AtTabs, AtTabsPane} from 'taro-ui'
import { Loading, SpNote } from '@/components'
import { withPager } from '@/hocs'
import { pickBy, formatDataTime } from '@/utils'
import api from '@/api'
import './recharge.scss'
@@ -17,18 +18,18 @@ export default class Recharge extends Component {
...this.state,
curTabIdx: 0,
tabList: [
{title: '全部', status: 'All'},
{title: '收入', status: 'INCOME'},
{title: '支出', status: 'EXPEND'}
{title: '全部', status: ''},
{title: '收入', status: 'income'},
{title: '支出', status: 'outcome'}
],
list: [],
isLoading: false,
testIncome: false,
totalDeposit: 0,
}
}
componentDidMount () {
const status = 'All'
const status = ''
const tabIdx = this.state.tabList.findIndex(tab => tab.status === status)
if (tabIdx >= 0) {
@@ -48,21 +49,29 @@ export default class Recharge extends Component {
const { tabList, curTabIdx } = this.state
params = {
...params,
status: tabList[curTabIdx].status
outin_type: tabList[curTabIdx].status
}
const { list, total_count: total } = await api.trade.list(params)
const nList = this.state.list.concat(list)
const { deposit } = await api.member.depositTotal()
const { list, total_count: total } = await api.member.depositList(params)
const nList = pickBy(list, {
tradeType: 'tradeType',
detail: 'detail',
timeStart: ({ timeStart }) => (formatDataTime(timeStart * 1000)),
money: ({ money }) => (money/100).toFixed(2),
})
// console.log(point, 65)
this.setState({
list: nList,
isLoading: false
list: [...this.state.list, ...nList],
totalDeposit: deposit
})
return { total }
return {
total
}
}
handleClickTab = (idx) => {
if (this.state.isLoading || this.state.page.isLoading) return
if (this.state.page.isLoading) return
if (idx !== this.state.curTabIdx) {
this.resetPage()
@@ -79,20 +88,22 @@ export default class Recharge extends Component {
}
render () {
const { curTabIdx, tabList, list, page, testIncome } = this.state
const { curTabIdx, tabList, list, page, totalDeposit } = this.state
return (
<View className='page-member-integral'>
<View className='member-integral__hd'>
<View className='integral-info'>
<View className='integral-number'>图标<Text className='integral-number__text'>1888</Text></View>
<View className='integral-number'>图标<Text className='integral-number__text'>{totalDeposit}</Text></View>
<View className='integral-text'>账户可用余额</View>
</View>
</View>
<View className='member-integral__bd'>
<View className='integral-sec integral-info__status'>
<Text className='integral-sec__horn'>喇叭</Text>
<View className='integral-sec__horn'>
<Text className='sp-icon sp-icon-laba laba_horn'> </Text>
</View>
<Text className='integral-sec__share'>充值可获取积分呦赶紧行动吧~</Text>
</View>
@@ -128,14 +139,10 @@ export default class Recharge extends Component {
<View key={idx}>
<View className='integral-item'>
<View className='integral-item__title'>
<Text className='integral-item__title-name'>支付</Text>
{
testIncome
? <Text className='integral-item__title-income'>+1000</Text>
: <Text className='integral-item__title-pay'>-100</Text>
}
<Text className='integral-item__title-name'>{item.detail}</Text>
<Text className={`integral-item__title-${item.tradeType}`}>{item.tradeType === 'recharge' ? '+' : '-'}{item.money}</Text>
</View>
<View className='integral-item__data'>2018.11.11 12:00</View>
<View className='integral-item__data'>{item.timeStart}</View>
</View>
</View>
)

View File

@@ -1,2 +1,11 @@
@import '../../style/imports';
@import './point';
.integral-item__title {
&-recharge {
color: $color-brand-primary;
}
&-consume {
color: $color-green;
}
}

View File

@@ -1,185 +1,153 @@
import Taro, { Component } from '@tarojs/taro'
import {View, Text, ScrollView} from '@tarojs/components'
import { AtTabs, AtTabsPane, AtCurtain, Image} from 'taro-ui'
import { Loading, SpNote } from '@/components'
import { withPager } from '@/hocs'
import ShareQrcode from './comps/share-qrcode'
import api from '@/api'
import { View, Text } from '@tarojs/components'
import { AtBadge, AtIcon, AtAvatar } from 'taro-ui'
import { SpIconMenu, TabBar } from '@/components'
import { withLogin } from '@/hocs'
import './recommend.scss'
@withPager
@withLogin()
export default class Recommend extends Component {
constructor (props) {
super(props)
this.state = {
...this.state,
curTabIdx: 0,
tabList: [
{title: '全部', status: 'All'},
{title: '收入', status: 'INCOME'},
{title: '支出', status: 'EXPEND'}
],
list: [],
isLoading: false,
testIncome: false,
isOpened: false
}
navigateTo (url) {
Taro.navigateTo({ url })
}
componentDidMount () {
const status = 'All'
const tabIdx = this.state.tabList.findIndex(tab => tab.status === status)
if (tabIdx >= 0) {
this.setState({
curTabIdx: tabIdx
}, () => {
this.nextPage()
})
} else {
this.nextPage()
}
}
async fetch (params) {
this.setState({ isLoading: true })
const { tabList, curTabIdx } = this.state
params = {
...params,
status: tabList[curTabIdx].status
}
const { list, total_count: total } = await api.trade.list(params)
const nList = this.state.list.concat(list)
this.setState({
list: nList,
isLoading: false
})
return { total }
}
handleClickMember = () => {
Taro.navigateTo({
url: '/pages/member/recommend-member'
})
}
handleClickQrcode = () => {
this.setState({
isOpened: true
})
}
handleClickTab = (idx) => {
if (this.state.isLoading || this.state.page.isLoading) return
if (idx !== this.state.curTabIdx) {
this.resetPage()
this.setState({
list: []
})
}
this.setState({
curTabIdx: idx
}, () => {
this.nextPage()
})
componentDidShow () {
}
render () {
const { curTabIdx, tabList, list, page, testIncome, isOpened } = this.state
return (
<View className='page-member-integral'>
<View className='member-integral__hd'>
<View className='member-recommend'>
<View className='integral-info'>
<View className='integral-number'>图标<Text className='integral-number__text'>1888</Text></View>
<View
className='integral-text member-recommend__text'
onClick={this.handleClickMember}
>我推荐的会员</View>
<View className='page-member-index'>
<View className='member-index__hd'>
<View className='member-info_top'>
<AtAvatar
className='member-avatar'
title='鲜果优格果冻妹'
size='large'
circle
/>
<View className='member-info_name'>
<View className='member-name'>推荐人</View>
<View className='member-name'>18855555555</View>
</View>
<View className='integral-info'>
<View className='integral-number'>图标<Text className='integral-number__text'>1888</Text></View>
<View
className='integral-text member-recommend__text'
onClick={this.handleClickQrcode}
>推广二维码</View>
</View>
</View>
</View>
<View className='member-integral__bd'>
<View className='integral-sec integral-info__status'>
<Text className='integral-sec__horn'>喇叭</Text>
<Text className='integral-sec__share'>充值可获取积分呦赶紧行动吧~</Text>
</View>
<View className='integral-sec member-integral'>
<AtTabs
className='member-integral__tabs'
current={curTabIdx}
tabList={tabList}
onClick={this.handleClickTab}
>
{
tabList.map((panes, pIdx) =>
(<AtTabsPane
current={curTabIdx}
key={pIdx}
index={pIdx}
className='member-integral__panel'
>
</AtTabsPane>)
)
}
</AtTabs>
<ScrollView
scrollY
className='member-integral__scroll'
onScrollToLower={this.nextPage}
>
{
list.map((item, idx) => {
return (
<View key={idx}>
<View className='integral-item'>
<View className='integral-item__title'>
<Text className='integral-item__title-name'>支付</Text>
{
testIncome
? <Text className='integral-item__title-income'>+1000</Text>
: <Text className='integral-item__title-pay'>-100</Text>
}
</View>
<View className='integral-item__data'>2018.11.11 12:00</View>
</View>
</View>
)
})
}
{
page.isLoading && <Loading>正在加载...</Loading>
}
{
!page.isLoading && !page.hasNext && !list.length
&& (<SpNote className='integral_empty' img='trades_empty.png'>赶快去充值吧~</SpNote>)
}
</ScrollView>
</View>
</View>
{
isOpened ? <ShareQrcode Opened={isOpened} /> : null
}
<View className='member-index__bd'>
<View className='member-sec member-info__status'>
<View className='member-status__item'>
<View className='member-status__item-val'>666<Text></Text></View>
<Text className='member-status__item-title'>营业额</Text>
</View>
<View className='member-status__item'>
<View className='member-status__item-val'>666<Text></Text></View>
<Text className='member-status__item-title'>可提现</Text>
</View>
</View>
<View className='member-sec member-trades'>
<View className='sec-hd'>
<Text className='sec-title'>我的会员</Text>
<View
className='more'
onClick={this.navigateTo.bind(this, '/pages/trade/list')}
>查看全部订单<AtIcon value='chevron-right'></AtIcon></View>
</View>
<View className='sec-bd'>
<View className='member-trades__menus'>
<AtBadge value={3}>
<SpIconMenu
icon='pay'
title='待付款'
to='/pages/trade/list?status=WAIT_BUYER_PAY'
/>
</AtBadge>
<AtBadge value={13}>
<SpIconMenu
icon='clock'
title='待发货'
to='/pages/trade/list?status=WAIT_SELLER_SEND_GOODS'
/>
</AtBadge>
<AtBadge value={13}>
<SpIconMenu
icon='baoguo'
title='待收货'
to='/pages/trade/list?status=WAIT_BUYER_CONFIRM_GOODS'
/>
</AtBadge>
<AtBadge>
<SpIconMenu
icon='comment'
title='待评论'
to='/pages/trade/list?status=WAIT_RATE'
/>
</AtBadge>
</View>
</View>
</View>
</View>
<View className='member-sec member-tools'>
<View className='sec-hd'>
<Text className='sec-title'>必备工具 </Text>
</View>
<View className='sec-bd'>
<View className='member-tools__menus'>
<View class='member-tools__item'>
<SpIconMenu
icon='star'
title='我的收藏'
to='/pages/member/favorite'
/>
</View>
<View class='member-tools__item'>
<SpIconMenu
icon='thumb'
title='我的推荐'
/>
</View>
<View class='member-tools__item'>
<SpIconMenu
icon='hongbao'
title='我的红包'
/>
</View>
<View class='member-tools__item'>
<SpIconMenu
icon='money'
title='我的资金'
/>
</View>
<View class='member-tools__item'>
<SpIconMenu
icon='location'
title='收货地址'
to='/pages/member/address'
/>
</View>
<View class='member-tools__item'>
<SpIconMenu
icon='qrcode'
title='推广二维码'
/>
</View>
<View class='member-tools__item'>
<SpIconMenu
icon='setting'
title='设置'
/>
</View>
<View class='member-tools__item'>
<SpIconMenu
icon='help'
title='使用帮助'
/>
</View>
</View>
</View>
</View>
</View>
)
}

View File

@@ -1,6 +1,30 @@
@import '../../style/imports';
@import './point';
@import './index';
.member-info {
&_top {
display: flex;
justify-content: center;
align-items: center;
padding: 40px 0 0;
.member-avatar {
width: 140px;
height: 140px;
}
}
&_name {
margin-left: 20px;
height: 120px;
display: flex;
justify-content: flex-start;
flex-direction: column;
.member-name {
margin-top: 10px;
}
}
}
.member-recommend{
display: flex;
justify-content: space-around;