|
@@ -23,6 +23,7 @@ import "./style.less";
|
23
|
23
|
export default withLayout((props) => {
|
24
|
24
|
const { router, person, location } = props;
|
25
|
25
|
const { id, subOrderId } = props.router.params;
|
|
26
|
+ const [submiting, setSubmiting] = useState(false)
|
26
|
27
|
const [showDialog, setShowDialog] = useState(false);
|
27
|
28
|
//核销
|
28
|
29
|
const [Consumption, setConsumption] = useState(false);
|
|
@@ -86,28 +87,39 @@ export default withLayout((props) => {
|
86
|
87
|
}
|
87
|
88
|
}
|
88
|
89
|
|
89
|
|
- const ShowMoldeOn = () => {
|
|
90
|
+ const handleVerifyClick = () => {
|
|
91
|
+ if (!checked || !checked.length) {
|
|
92
|
+ Taro.showToast({
|
|
93
|
+ title: '请选择待核销套餐',
|
|
94
|
+ icon: 'none',
|
|
95
|
+ })
|
|
96
|
+
|
|
97
|
+ return;
|
|
98
|
+ }
|
|
99
|
+
|
90
|
100
|
setShowDialog(true);
|
91
|
101
|
};
|
92
|
102
|
const ButtonCancel = () => {
|
93
|
103
|
setShowDialog(false);
|
94
|
104
|
};
|
95
|
105
|
const ButtonOK = (e) => {
|
96
|
|
- if (!checked || !checked.length) return
|
97
|
|
- if (showDialog === true) {
|
|
106
|
+ if (!submiting) {
|
98
|
107
|
Taro.showLoading({
|
99
|
108
|
title: '核销中'
|
100
|
109
|
})
|
101
|
110
|
|
|
111
|
+ setSubmiting(true);
|
102
|
112
|
Promise.all(checked.map(verifyNo => putVerifyTarget(verifyNo)))
|
103
|
113
|
.then(res => {
|
104
|
114
|
Taro.hideLoading()
|
|
115
|
+ setSubmiting(false);
|
105
|
116
|
setShowDialog(false);
|
106
|
117
|
setConsumption(true);
|
107
|
118
|
})
|
108
|
119
|
.catch(e => {
|
109
|
120
|
Taro.hideLoading()
|
110
|
121
|
setShowDialog(false);
|
|
122
|
+ setSubmiting(false);
|
111
|
123
|
getList(); // 刷新数据
|
112
|
124
|
Taro.showToast({
|
113
|
125
|
title: '核销失败',
|
|
@@ -142,7 +154,7 @@ export default withLayout((props) => {
|
142
|
154
|
<button className='button-Cancel' onClick={ButtonCancel}>
|
143
|
155
|
取消
|
144
|
156
|
</button>
|
145
|
|
- <button className='button-OK' onClick={ButtonOK}>
|
|
157
|
+ <button className='button-OK' onClick={ButtonOK} loading={submiting}>
|
146
|
158
|
确定
|
147
|
159
|
</button>
|
148
|
160
|
</view>
|
|
@@ -220,7 +232,7 @@ export default withLayout((props) => {
|
220
|
232
|
</SpinBox>
|
221
|
233
|
|
222
|
234
|
<view className='button-info'>
|
223
|
|
- <Button className='button-box' disabled={!checked.length} onClick={ShowMoldeOn}>
|
|
235
|
+ <Button className='button-box' onClick={handleVerifyClick}>
|
224
|
236
|
{btnText}
|
225
|
237
|
</Button>
|
226
|
238
|
</view>
|