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
37e50b9c
Commit
37e50b9c
authored
Jun 19, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into test
parents
f7cb14e0
155d8039
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
364 additions
and
26 deletions
+364
-26
app.scss
src/app.scss
+13
-0
checkOrderHOC.js
src/common/checkOrderHOC.js
+121
-0
BarCode.scss
src/pages/BarCode/BarCode.scss
+0
-12
BarCode.tsx
src/pages/BarCode/BarCode.tsx
+9
-13
Shower.tsx
src/pages/Shower/Shower.tsx
+111
-1
WaterDispenser.tsx
src/pages/WaterDispenser/WaterDispenser.tsx
+110
-0
No files found.
src/app.scss
View file @
37e50b9c
...
@@ -100,3 +100,16 @@ button[disabled]:not([type]) {
...
@@ -100,3 +100,16 @@ button[disabled]:not([type]) {
background-color
:
rgba
(
25
,
25
,
25
,
0
.2
);
background-color
:
rgba
(
25
,
25
,
25
,
0
.2
);
z-index
:
99
;
z-index
:
99
;
}
}
.blur
{
filter
:
blur
(
10px
);
}
.OrderBox
{
box-sizing
:
border-box
;
position
:
absolute
;
top
:
0
;
width
:
100%
;
height
:
100%
;
padding
:
0
32px
;
z-index
:
100
;
background-color
:
rgba
(
255
,
255
,
255
,
0
.5
);
}
src/common/checkOrderHOC.js
0 → 100644
View file @
37e50b9c
import
{
fetchPayOrder
,
fetchOrderDetailAndPay
}
from
'@/api/order'
;
import
{
View
}
from
'@tarojs/components'
;
import
{
connect
}
from
'@tarojs/redux'
;
import
{
ComponentClass
}
from
'react'
;
function
wrapCheckOrder
()
{
return
function
wrapComponent
(
Component
:
ComponentClass
<
T
>
,
):
ComponentClass
<
T
>
{
return
class
CheckOrder
extends
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{
showPayOrder
:
false
,
accounts
:
[],
orderInfo
:
{
actualMoney
:
0
,
areaId
:
0
,
areaName
:
''
,
consumeType
:
''
,
createAt
:
''
,
customerCellphone
:
''
,
customerId
:
0
,
customerName
:
''
,
deductionBean
:
0
,
deductionMoney
:
0
,
equipmentNum
:
''
,
equipmentPosition
:
''
,
id
:
0
,
operateId
:
0
,
operateName
:
''
,
operationMode
:
''
,
orderName
:
''
,
orderNumber
:
''
,
orderState
:
''
,
outTradeNo
:
''
,
payType
:
''
,
payableMoney
:
0
,
serviceId
:
0
,
serviceName
:
''
,
thirdDiscountMoney
:
0
,
thirdTradeNumber
:
''
,
updateDate
:
''
,
},
payInfos
:
{
paymentAndActiveInfos
:
[],
paymentConfId
:
0
,
},
};
}
componentWillMount
()
{
this
.
getPayState
();
if
(
super
.
componentWillMount
)
{
super
.
componentWillMount
();
}
}
getPayState
()
{
const
{
userinfo
}
=
this
.
props
;
fetchPayOrder
({
customerId
:
userinfo
.
customerId
,
})
.
then
(
res
=>
{
if
(
res
.
data
.
length
)
{
this
.
fetchOrder
(
res
.
data
[
0
].
id
);
this
.
setState
({
showPayOrder
:
true
});
}
else
{
this
.
drawBarCode
();
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
fetchOrder
(
id
:
number
)
{
return
fetchOrderDetailAndPay
({
id
,
})
.
then
(
res
=>
{
const
{
accounts
,
orderInfo
,
payInfos
}
=
res
;
this
.
setState
({
accounts
:
accounts
,
orderInfo
:
orderInfo
,
payInfos
:
payInfos
,
});
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
render
()
{
const
{
showPayOrder
,
orderInfo
,
payInfos
,
accounts
}
=
this
.
state
;
console
.
log
(
showPayOrder
);
return
(
<
View
className
=
''
>
{
showPayOrder
?
(
<
View
className
=
'OrderBox'
>
<
OrderTitle
price
=
{
orderInfo
.
payableMoney
}
/
>
<
OrderInfo
orderInfo
=
{
orderInfo
}
/
>
<
OrderPayway
onPayDoneCallback
=
{
this
.
payDoneHandle
}
userinfo
=
{
userinfo
}
accounts
=
{
accounts
}
orderInfo
=
{
orderInfo
}
payInfos
=
{
payInfos
}
/
>
<
/View
>
)
:
(
super
.
render
()
)}
<
/View
>
);
}
};
};
}
export
default
wrapCheckOrder
;
src/pages/BarCode/BarCode.scss
View file @
37e50b9c
...
@@ -27,18 +27,6 @@ page {
...
@@ -27,18 +27,6 @@ page {
color
:
#fff
;
color
:
#fff
;
}
}
}
}
.OrderBox
{
box-sizing
:
border-box
;
position
:
absolute
;
width
:
100%
;
height
:
100%
;
padding
:
0
32px
;
z-index
:
100
;
background-color
:
rgba
(
255
,
255
,
255
,
0
.5
);
}
.blur
{
filter
:
blur
(
10px
);
}
.BarCodeBox
{
.BarCodeBox
{
position
:
relative
;
position
:
relative
;
background-color
:
#fff
;
background-color
:
#fff
;
...
...
src/pages/BarCode/BarCode.tsx
View file @
37e50b9c
...
@@ -279,13 +279,6 @@ class BarCode extends Component {
...
@@ -279,13 +279,6 @@ class BarCode extends Component {
}
=
this
.
state
;
}
=
this
.
state
;
return
(
return
(
<
View
className=
'BarCode'
>
<
View
className=
'BarCode'
>
{
showBackTag
&&
(
<
View
className=
'BackTag'
onClick=
{
this
.
goBackPage
}
>
<
Image
className=
'icon'
src=
{
CodeIcon
}
/>
<
Text
className=
'text'
>
隐藏条码
</
Text
>
</
View
>
)
}
{
showPayOrder
&&
(
{
showPayOrder
&&
(
<
View
className=
'OrderBox'
>
<
View
className=
'OrderBox'
>
<
OrderTitle
price=
{
orderInfo
.
payableMoney
}
/>
<
OrderTitle
price=
{
orderInfo
.
payableMoney
}
/>
...
@@ -299,11 +292,14 @@ class BarCode extends Component {
...
@@ -299,11 +292,14 @@ class BarCode extends Component {
/>
/>
</
View
>
</
View
>
)
}
)
}
<
View
className=
{
showPayOrder
?
'blur'
:
''
}
>
<
View
{
showBackTag
&&
(
className=
{
`BarCodeBox ${showPayOrder ? 'blur' : ''} ${
<
View
className=
'BackTag'
onClick=
{
this
.
goBackPage
}
>
showBig ? 'BarCodeBoxBig' : ''
<
Image
className=
'icon'
src=
{
CodeIcon
}
/>
}`
}
>
<
Text
className=
'text'
>
隐藏条码
</
Text
>
</
View
>
)
}
<
View
className=
{
`BarCodeBox ${showBig ? 'BarCodeBoxBig' : ''}`
}
>
<
Image
<
Image
className=
'BarCodeBox-refresh'
className=
'BarCodeBox-refresh'
src=
{
RefreshIcon
}
src=
{
RefreshIcon
}
...
@@ -328,11 +324,11 @@ class BarCode extends Component {
...
@@ -328,11 +324,11 @@ class BarCode extends Component {
/>
/>
</
View
>
</
View
>
</
View
>
</
View
>
<
View
className=
'warnning'
>
<
View
className=
'warnning'
>
如扫描条码终端无响应,请刷新条码后重试!
如扫描条码终端无响应,请刷新条码后重试!
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
);
);
}
}
}
}
...
...
src/pages/Shower/Shower.tsx
View file @
37e50b9c
...
@@ -22,6 +22,12 @@ import { SOCKET_URL } from '@/constants';
...
@@ -22,6 +22,12 @@ import { SOCKET_URL } from '@/constants';
import
{
BluetoothDevice
}
from
'@/types/Shower/Shower'
;
import
{
BluetoothDevice
}
from
'@/types/Shower/Shower'
;
import
{
updateBluetoothDevice
}
from
'./actions'
;
import
{
updateBluetoothDevice
}
from
'./actions'
;
import
{
ab2str
,
str2ab
}
from
'@/utils/arrayBuffer'
;
import
{
ab2str
,
str2ab
}
from
'@/utils/arrayBuffer'
;
import
{
CustomerBeanAccountVo
,
PaymentAndActiveInfo
}
from
'@/api/baseClass'
;
import
Order
from
'@/types/Order/Order'
;
import
{
fetchPayOrder
,
fetchOrderDetailAndPay
}
from
'@/api/order'
;
import
OrderTitle
from
'../Order/components/OrderTitle/OrderTitle'
;
import
OrderInfo
from
'../Order/components/OrderInfo/OrderInfo'
;
import
OrderPayway
from
'../Order/components/OrderPayway/OrderPayway'
;
type
DeviceInfo
=
{
type
DeviceInfo
=
{
deviceId
:
string
;
deviceId
:
string
;
...
@@ -48,6 +54,14 @@ type PageState = {
...
@@ -48,6 +54,14 @@ type PageState = {
sockedDone
:
boolean
;
sockedDone
:
boolean
;
deviceDone
:
boolean
;
deviceDone
:
boolean
;
showerState
:
boolean
;
showerState
:
boolean
;
showPayOrder
:
boolean
;
accounts
:
CustomerBeanAccountVo
[];
orderInfo
:
Order
;
payInfos
:
{
paymentAndActiveInfos
:
PaymentAndActiveInfo
[];
paymentConfId
:
number
;
};
};
};
const
StopCode
=
1000
;
const
StopCode
=
1000
;
...
@@ -91,12 +105,49 @@ class Shower extends Component {
...
@@ -91,12 +105,49 @@ class Shower extends Component {
writeId
:
''
,
writeId
:
''
,
readId
:
''
,
readId
:
''
,
},
},
showPayOrder
:
false
,
accounts
:
[],
orderInfo
:
{
actualMoney
:
0
,
areaId
:
0
,
areaName
:
''
,
consumeType
:
''
,
createAt
:
''
,
customerCellphone
:
''
,
customerId
:
0
,
customerName
:
''
,
deductionBean
:
0
,
deductionMoney
:
0
,
equipmentNum
:
''
,
equipmentPosition
:
''
,
id
:
0
,
operateId
:
0
,
operateName
:
''
,
operationMode
:
''
,
orderName
:
''
,
orderNumber
:
''
,
orderState
:
''
,
outTradeNo
:
''
,
payType
:
''
,
payableMoney
:
0
,
serviceId
:
0
,
serviceName
:
''
,
thirdDiscountMoney
:
0
,
thirdTradeNumber
:
''
,
updateDate
:
''
,
},
payInfos
:
{
paymentAndActiveInfos
:
[],
paymentConfId
:
0
,
},
};
};
}
}
onShareAppMessage
=
shareHandle
;
onShareAppMessage
=
shareHandle
;
componentWillMount
()
{
componentWillMount
()
{
this
.
getPayState
();
this
.
openBluetooth
();
this
.
openBluetooth
();
this
.
connectDeviceSocket
();
this
.
connectDeviceSocket
();
this
.
checkUsingDevice
();
this
.
checkUsingDevice
();
...
@@ -110,6 +161,43 @@ class Shower extends Component {
...
@@ -110,6 +161,43 @@ class Shower extends Component {
reConnectting
=
false
;
reConnectting
=
false
;
}
}
getPayState
()
{
const
{
userinfo
}
=
this
.
props
;
fetchPayOrder
({
customerId
:
userinfo
.
customerId
,
})
.
then
(
res
=>
{
if
(
res
.
data
.
length
)
{
this
.
fetchOrder
(
res
.
data
[
0
].
id
);
this
.
setState
({
showPayOrder
:
true
});
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
fetchOrder
(
id
:
number
)
{
return
fetchOrderDetailAndPay
({
id
,
})
.
then
(
res
=>
{
const
{
accounts
,
orderInfo
,
payInfos
}
=
res
;
this
.
setState
({
accounts
:
accounts
,
orderInfo
:
orderInfo
,
payInfos
:
payInfos
,
});
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
payDoneHandle
()
{
this
.
setState
({
showPayOrder
:
false
,
});
}
connectDeviceSocket
()
{
connectDeviceSocket
()
{
connectSocket
(
SOCKET_URL
).
then
(
task
=>
{
connectSocket
(
SOCKET_URL
).
then
(
task
=>
{
socketTask
=
task
;
socketTask
=
task
;
...
@@ -702,10 +790,31 @@ class Shower extends Component {
...
@@ -702,10 +790,31 @@ class Shower extends Component {
render
()
{
render
()
{
const
{
const
{
bluetoothDevice
:
{
code
,
position
},
bluetoothDevice
:
{
code
,
position
},
userinfo
,
}
=
this
.
props
;
}
=
this
.
props
;
const
{
showerState
}
=
this
.
state
;
const
{
showerState
,
showPayOrder
,
orderInfo
,
accounts
,
payInfos
,
}
=
this
.
state
;
return
(
return
(
<
View
className=
'Shower'
>
<
View
className=
'Shower'
>
{
showPayOrder
&&
(
<
View
className=
'OrderBox'
>
<
OrderTitle
price=
{
orderInfo
.
payableMoney
}
/>
<
OrderInfo
orderInfo=
{
orderInfo
}
/>
<
OrderPayway
onPayDoneCallback=
{
this
.
payDoneHandle
}
userinfo=
{
userinfo
}
accounts=
{
accounts
}
orderInfo=
{
orderInfo
}
payInfos=
{
payInfos
}
/>
</
View
>
)
}
<
View
className=
{
showPayOrder
?
'blur'
:
''
}
>
<
View
className=
'equipment-info-box'
>
<
View
className=
'equipment-info-box'
>
<
View
className=
'equipment-info'
>
<
View
className=
'equipment-info'
>
{
code
?
(
{
code
?
(
...
@@ -750,6 +859,7 @@ class Shower extends Component {
...
@@ -750,6 +859,7 @@ class Shower extends Component {
)
}
)
}
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
);
);
}
}
}
}
...
...
src/pages/WaterDispenser/WaterDispenser.tsx
View file @
37e50b9c
...
@@ -21,6 +21,12 @@ import { Customer } from '@/types/Customer/Customer';
...
@@ -21,6 +21,12 @@ import { Customer } from '@/types/Customer/Customer';
import
{
connect
}
from
'@tarojs/redux'
;
import
{
connect
}
from
'@tarojs/redux'
;
import
{
ComponentClass
}
from
'react'
;
import
{
ComponentClass
}
from
'react'
;
import
{
ResponseDataEntity
}
from
'@/api'
;
import
{
ResponseDataEntity
}
from
'@/api'
;
import
{
CustomerBeanAccountVo
,
PaymentAndActiveInfo
}
from
'@/api/baseClass'
;
import
Order
from
'@/types/Order/Order'
;
import
{
fetchOrderDetailAndPay
,
fetchPayOrder
}
from
'@/api/order'
;
import
OrderTitle
from
'../Order/components/OrderTitle/OrderTitle'
;
import
OrderInfo
from
'../Order/components/OrderInfo/OrderInfo'
;
import
OrderPayway
from
'../Order/components/OrderPayway/OrderPayway'
;
export
type
DeviceInfo
=
{
export
type
DeviceInfo
=
{
code
:
string
;
code
:
string
;
...
@@ -36,6 +42,14 @@ type PageState = {
...
@@ -36,6 +42,14 @@ type PageState = {
useList
:
DeviceInfo
[];
useList
:
DeviceInfo
[];
timer
:
number
|
null
;
timer
:
number
|
null
;
showToggleTag
:
boolean
;
showToggleTag
:
boolean
;
showPayOrder
:
boolean
;
accounts
:
CustomerBeanAccountVo
[];
orderInfo
:
Order
;
payInfos
:
{
paymentAndActiveInfos
:
PaymentAndActiveInfo
[];
paymentConfId
:
number
;
};
};
};
type
IProps
=
PageStateProps
;
type
IProps
=
PageStateProps
;
...
@@ -44,6 +58,7 @@ interface WaterDispenser {
...
@@ -44,6 +58,7 @@ interface WaterDispenser {
props
:
IProps
;
props
:
IProps
;
state
:
PageState
;
state
:
PageState
;
}
}
@
connect
(({
userinfo
})
=>
({
@
connect
(({
userinfo
})
=>
({
userinfo
,
userinfo
,
}))
}))
...
@@ -59,10 +74,47 @@ class WaterDispenser extends Component {
...
@@ -59,10 +74,47 @@ class WaterDispenser extends Component {
useList
:
[],
useList
:
[],
timer
:
null
,
timer
:
null
,
showToggleTag
:
false
,
showToggleTag
:
false
,
showPayOrder
:
false
,
accounts
:
[],
orderInfo
:
{
actualMoney
:
0
,
areaId
:
0
,
areaName
:
''
,
consumeType
:
''
,
createAt
:
''
,
customerCellphone
:
''
,
customerId
:
0
,
customerName
:
''
,
deductionBean
:
0
,
deductionMoney
:
0
,
equipmentNum
:
''
,
equipmentPosition
:
''
,
id
:
0
,
operateId
:
0
,
operateName
:
''
,
operationMode
:
''
,
orderName
:
''
,
orderNumber
:
''
,
orderState
:
''
,
outTradeNo
:
''
,
payType
:
''
,
payableMoney
:
0
,
serviceId
:
0
,
serviceName
:
''
,
thirdDiscountMoney
:
0
,
thirdTradeNumber
:
''
,
updateDate
:
''
,
},
payInfos
:
{
paymentAndActiveInfos
:
[],
paymentConfId
:
0
,
},
};
};
}
}
componentWillMount
()
{
componentWillMount
()
{
this
.
getPayState
();
this
.
getUsedEquipment
();
this
.
getUsedEquipment
();
this
.
fetchPageConfig
();
this
.
fetchPageConfig
();
}
}
...
@@ -71,6 +123,43 @@ class WaterDispenser extends Component {
...
@@ -71,6 +123,43 @@ class WaterDispenser extends Component {
this
.
clearTimer
();
this
.
clearTimer
();
}
}
getPayState
()
{
const
{
userinfo
}
=
this
.
props
;
fetchPayOrder
({
customerId
:
userinfo
.
customerId
,
})
.
then
(
res
=>
{
if
(
res
.
data
.
length
)
{
this
.
fetchOrder
(
res
.
data
[
0
].
id
);
this
.
setState
({
showPayOrder
:
true
});
}
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
fetchOrder
(
id
:
number
)
{
return
fetchOrderDetailAndPay
({
id
,
})
.
then
(
res
=>
{
const
{
accounts
,
orderInfo
,
payInfos
}
=
res
;
this
.
setState
({
accounts
:
accounts
,
orderInfo
:
orderInfo
,
payInfos
:
payInfos
,
});
})
.
catch
(
err
=>
{
console
.
log
(
err
);
});
}
payDoneHandle
()
{
this
.
setState
({
showPayOrder
:
false
,
});
}
fetchPageConfig
()
{
fetchPageConfig
()
{
const
{
userinfo
}
=
this
.
props
;
const
{
userinfo
}
=
this
.
props
;
fetchPageConfig
({
fetchPageConfig
({
...
@@ -250,9 +339,29 @@ class WaterDispenser extends Component {
...
@@ -250,9 +339,29 @@ class WaterDispenser extends Component {
deviceInfo
:
{
code
,
position
},
deviceInfo
:
{
code
,
position
},
useList
,
useList
,
showToggleTag
,
showToggleTag
,
showPayOrder
,
orderInfo
,
accounts
,
payInfos
,
}
=
this
.
state
;
}
=
this
.
state
;
const
{
userinfo
}
=
this
.
props
;
return
(
return
(
<
View
className=
'WaterDispenser'
>
<
View
className=
'WaterDispenser'
>
{
showPayOrder
&&
(
<
View
className=
'OrderBox'
>
<
OrderTitle
price=
{
orderInfo
.
payableMoney
}
/>
<
OrderInfo
orderInfo=
{
orderInfo
}
/>
<
OrderPayway
onPayDoneCallback=
{
this
.
payDoneHandle
}
userinfo=
{
userinfo
}
accounts=
{
accounts
}
orderInfo=
{
orderInfo
}
payInfos=
{
payInfos
}
/>
</
View
>
)
}
<
View
className=
{
showPayOrder
?
'blur'
:
''
}
>
{
showToggleTag
&&
(
{
showToggleTag
&&
(
<
View
className=
'WaterDispenser-tg'
onClick=
{
this
.
toggleCodeState
}
>
<
View
className=
'WaterDispenser-tg'
onClick=
{
this
.
toggleCodeState
}
>
<
Image
className=
'icon'
src=
{
CodeIcon
}
/>
<
Image
className=
'icon'
src=
{
CodeIcon
}
/>
...
@@ -291,6 +400,7 @@ class WaterDispenser extends Component {
...
@@ -291,6 +400,7 @@ class WaterDispenser extends Component {
))
}
))
}
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
);
);
}
}
}
}
...
...
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