Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-school-app
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
wx-school-app
Commits
45adba11
Commit
45adba11
authored
Jul 02, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into test
parents
35c29a83
006468e4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
281 additions
and
133 deletions
+281
-133
OrderList.scss
src/pages/Order/OrderList/OrderList.scss
+12
-3
OrderList.tsx
src/pages/Order/OrderList/OrderList.tsx
+198
-102
store.ts
src/pages/Order/OrderList/store.ts
+71
-8
useConsumeOrders.ts
src/pages/Order/OrderList/useConsumeOrders.ts
+0
-10
useRechargeOrders.ts
src/pages/Order/OrderList/useRechargeOrders.ts
+0
-10
No files found.
src/pages/Order/OrderList/OrderList.scss
View file @
45adba11
page
{
padding-top
:
80px
;
background-color
:
#eee
;
}
.OrderList
{
display
:
flex
;
flex-direction
:
column
;
width
:
100%
;
height
:
100%
;
overflow
:
hidden
;
//
height: 100%;
//
overflow: hidden;
.Tab
{
position
:
absolute
;
position
:
fixed
;
top
:
0
;
display
:
flex
;
background-color
:
#fff
;
...
...
@@ -14,6 +18,7 @@
line-height
:
80px
;
text-align
:
center
;
font-size
:
30px
;
z-index
:
1
;
.Tab-item
{
width
:
50%
;
color
:
#999
;
...
...
@@ -28,6 +33,10 @@
margin-top
:
80px
;
background-color
:
#eee
;
}
.OrderList-Wrap
{
padding-top
:
22px
;
background-color
:
#eee
;
}
.OrderList-Group
{
margin-bottom
:
22px
;
.OrderList-GroupTitle
{
...
...
src/pages/Order/OrderList/OrderList.tsx
View file @
45adba11
This diff is collapsed.
Click to expand it.
src/pages/Order/OrderList/store.ts
View file @
45adba11
...
...
@@ -11,16 +11,20 @@ import {
}
from
'./actions'
;
import
{
RechargeOrderItem
}
from
'@/api/order'
;
export
type
ConsumeOrderInfo
=
{
consumeOrders
:
AllOrderItem
[];
lastOrderId
:
number
;
};
export
type
RechargeOrderInfo
=
{
rechargeOrders
:
RechargeOrderItem
[];
lastOrderId
:
number
;
};
export
interface
OrderStoreState
{
selectedOrder
:
Order
;
consume
:
{
consumeOrders
:
AllOrderItem
[];
lastOrderId
:
number
;
};
recharge
:
{
rechargeOrders
:
RechargeOrderItem
[];
lastOrderId
:
number
;
};
consume
:
ConsumeOrderInfo
;
recharge
:
RechargeOrderInfo
;
}
const
initOrder
=
()
=>
({
actualMoney
:
0
,
...
...
@@ -64,6 +68,18 @@ const INITIAL_STATE = {
},
};
const
getLastId
=
(
arr
):
number
=>
{
const
itemIdx
=
arr
.
length
-
1
;
if
(
itemIdx
>=
0
)
{
const
orderIdx
=
arr
[
itemIdx
].
data
.
length
-
1
;
if
(
orderIdx
>=
0
)
{
let
lastOrderId
=
arr
[
itemIdx
].
data
[
orderIdx
].
id
;
return
lastOrderId
;
}
}
return
0
;
};
export
default
function
OrderList
(
state
:
OrderStoreState
=
INITIAL_STATE
,
actions
:
Actions
,
...
...
@@ -75,6 +91,17 @@ export default function OrderList(
selectedOrder
:
actions
.
payload
,
};
case
UPDATE_CONSUME_ORDERS
:
if
(
actions
.
payload
.
length
)
{
let
arr
=
actions
.
payload
;
let
lastOrderId
=
getLastId
(
arr
);
return
{
...
state
,
consume
:
{
lastOrderId
:
lastOrderId
,
consumeOrders
:
actions
.
payload
,
},
};
}
return
{
...
state
,
consume
:
{
...
...
@@ -83,6 +110,17 @@ export default function OrderList(
},
};
case
APPEND_CONSUME_ORDERS
:
if
(
actions
.
payload
.
length
)
{
let
arr
=
actions
.
payload
;
let
lastOrderId
=
getLastId
(
arr
);
return
{
...
state
,
consume
:
{
lastOrderId
:
lastOrderId
,
consumeOrders
:
[...
state
.
consume
.
consumeOrders
,
...
actions
.
payload
],
},
};
}
return
{
...
state
,
consume
:
{
...
...
@@ -99,6 +137,17 @@ export default function OrderList(
},
};
case
UPDATE_RECHARGE_ORDERS
:
if
(
actions
.
payload
.
length
)
{
let
arr
=
actions
.
payload
;
let
lastOrderId
=
getLastId
(
arr
);
return
{
...
state
,
recharge
:
{
lastOrderId
:
lastOrderId
,
rechargeOrders
:
actions
.
payload
,
},
};
}
return
{
...
state
,
recharge
:
{
...
...
@@ -107,6 +156,20 @@ export default function OrderList(
},
};
case
APPEND_RECHARGE_ORDERS
:
if
(
actions
.
payload
.
length
)
{
let
arr
=
actions
.
payload
;
let
lastOrderId
=
getLastId
(
arr
);
return
{
...
state
,
recharge
:
{
lastOrderId
:
lastOrderId
,
rechargeOrders
:
[
...
state
.
recharge
.
rechargeOrders
,
...
actions
.
payload
,
],
},
};
}
return
{
...
state
,
recharge
:
{
...
...
src/pages/Order/OrderList/useConsumeOrders.ts
View file @
45adba11
...
...
@@ -34,16 +34,6 @@ const useConsumeOrders = (
console
.
log
(
err
);
});
const
fetchMore
=
()
=>
{
let
arr
=
state
.
consumeOrders
;
const
itemIdx
=
arr
.
length
-
1
;
if
(
itemIdx
>=
0
)
{
const
orderIdx
=
arr
[
itemIdx
].
data
.
length
-
1
;
if
(
orderIdx
>=
0
)
{
dispatch
(
updateConsumeLastId
(
arr
[
itemIdx
].
data
[
orderIdx
].
id
));
return
fetchData
(
customerId
,
pageSize
);
}
}
dispatch
(
updateConsumeLastId
(
0
));
return
fetchData
(
customerId
,
pageSize
);
};
const
resetOrders
=
()
=>
{
...
...
src/pages/Order/OrderList/useRechargeOrders.ts
View file @
45adba11
...
...
@@ -32,16 +32,6 @@ const useRechargeOrders = (
console
.
log
(
err
);
});
const
fetchMore
=
()
=>
{
let
arr
=
state
.
rechargeOrders
;
const
itemIdx
=
arr
.
length
-
1
;
if
(
itemIdx
>=
0
)
{
const
orderIdx
=
arr
[
itemIdx
].
data
.
length
-
1
;
if
(
orderIdx
>=
0
)
{
dispatch
(
updateRechargeLastId
(
arr
[
itemIdx
].
data
[
orderIdx
].
id
));
return
fetchData
(
customerId
,
pageSize
);
}
}
dispatch
(
updateRechargeLastId
(
0
));
return
fetchData
(
customerId
,
pageSize
);
};
const
resetOrders
=
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment