diff --git a/src/api/member.js b/src/api/member.js index d251ef899..a47140556 100644 --- a/src/api/member.js +++ b/src/api/member.js @@ -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') +} diff --git a/src/assets/imgs/pay_fail.png b/src/assets/imgs/pay_fail.png index 4348d9de5..2cfea4424 100644 Binary files a/src/assets/imgs/pay_fail.png and b/src/assets/imgs/pay_fail.png differ diff --git a/src/assets/imgs/pay_success.png b/src/assets/imgs/pay_success.png index de000df52..cdb797c87 100644 Binary files a/src/assets/imgs/pay_success.png and b/src/assets/imgs/pay_success.png differ diff --git a/src/assets/imgs/sign_in_bg.png b/src/assets/imgs/sign_in_bg.png new file mode 100644 index 000000000..bfbccd606 Binary files /dev/null and b/src/assets/imgs/sign_in_bg.png differ diff --git a/src/assets/imgs/sign_in_modal.png b/src/assets/imgs/sign_in_modal.png new file mode 100644 index 000000000..487df49fa Binary files /dev/null and b/src/assets/imgs/sign_in_modal.png differ diff --git a/src/pages/cashier/cashier-result.js b/src/pages/cashier/cashier-result.js index df63be54b..6a99b4b26 100644 --- a/src/pages/cashier/cashier-result.js +++ b/src/pages/cashier/cashier-result.js @@ -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 ( @@ -26,36 +60,43 @@ export default class CashierResult extends Component { - {/*订单支付成功*/} - 订单支付失败 - 订单号:B2C123102831 - 创建时间:2016-06-16 16:54:09 - 支付时间:2016-06-16 16:54:09 + 订单支付{info.payStatus === 'fail' ? '失败' : '成功'} + 订单号:{info.order_id} + 支付单号:{info.tradeId} + 创建时间:{info.create_time} + { + info.payStatus === 'success' ? 支付时间:{info.payDate} : null + } - {/**/} - {/*继续购物*/} - {/*订单详情*/} - {/**/} - - - + { + info.payStatus === 'fail' + ? + + + : + + + + } + + ) diff --git a/src/pages/cashier/index.js b/src/pages/cashier/index.js index ec006d79b..4cce93411 100644 --- a/src/pages/cashier/index.js +++ b/src/pages/cashier/index.js @@ -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 diff --git a/src/pages/index/index.js b/src/pages/index/index.js index 8a09afbb3..53a5dc746 100644 --- a/src/pages/index/index.js +++ b/src/pages/index/index.js @@ -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' }) } } diff --git a/src/pages/member/recharge.js b/src/pages/member/recharge.js index f8f076f0f..755a74910 100644 --- a/src/pages/member/recharge.js +++ b/src/pages/member/recharge.js @@ -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 ( - 图标1888 + 图标{totalDeposit} 账户可用余额 - 喇叭 + + + 充值可获取积分呦,赶紧行动吧~ @@ -128,14 +139,10 @@ export default class Recharge extends Component { - 支付 - { - testIncome - ? +1000 - : -100 - } + {item.detail} + {item.tradeType === 'recharge' ? '+' : '-'}{item.money} - 2018.11.11 12:00 + {item.timeStart} ) diff --git a/src/pages/member/recharge.scss b/src/pages/member/recharge.scss index b779eeaa4..4985941dc 100644 --- a/src/pages/member/recharge.scss +++ b/src/pages/member/recharge.scss @@ -1,2 +1,11 @@ @import '../../style/imports'; @import './point'; +.integral-item__title { + &-recharge { + color: $color-brand-primary; + } + &-consume { + color: $color-green; + } +} + diff --git a/src/pages/member/recommend.js b/src/pages/member/recommend.js index a9bf41d66..0360b7d36 100644 --- a/src/pages/member/recommend.js +++ b/src/pages/member/recommend.js @@ -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 ( - - - - - 图标1888 - 我推荐的会员 + + + + + + 推荐人: + 18855555555 - - 图标1888 - 推广二维码 - - - - - - - 喇叭 - 充值可获取积分呦,赶紧行动吧~ - - - - - { - tabList.map((panes, pIdx) => - ( - - ) - ) - } - - - - { - list.map((item, idx) => { - return ( - - - - 支付 - { - testIncome - ? +1000 - : -100 - } - - 2018.11.11 12:00 - - - ) - }) - } - { - page.isLoading && 正在加载... - } - { - !page.isLoading && !page.hasNext && !list.length - && (赶快去充值吧~) - } - - { - isOpened ? : null - } + + + + + 666 + 营业额 + + + 666 + 可提现 + + + + + + 我的会员 + 查看全部订单 + + + + + + + + + + + + + + + + + + + + + + + 必备工具 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ) } diff --git a/src/pages/member/recommend.scss b/src/pages/member/recommend.scss index 73757ed71..5b3f56da5 100644 --- a/src/pages/member/recommend.scss +++ b/src/pages/member/recommend.scss @@ -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;