Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hoàng Văn Đạt
mypoint_flutter_app
Commits
fc2caf86
Commit
fc2caf86
authored
Oct 09, 2025
by
DatHV
Browse files
update ui, logic.
parent
0b973e61
Changes
35
Hide whitespace changes
Inline
Side-by-side
lib/screen/register_campaign/model/input_form_registration_model.dart
View file @
fc2caf86
import
'package:json_annotation/json_annotation.dart'
;
import
'package:json_annotation/json_annotation.dart'
;
import
'package:mypoint_flutter_app/screen/register_campaign/model/verify_register_model.dart'
;
import
'form_input_description_model.dart'
;
import
'form_input_description_model.dart'
;
import
'input_cell_model.dart'
;
import
'input_cell_model.dart'
;
...
@@ -17,6 +18,7 @@ class InputFormRegistrationModel {
...
@@ -17,6 +18,7 @@ class InputFormRegistrationModel {
@JsonKey
(
name:
'click_action_param'
)
@JsonKey
(
name:
'click_action_param'
)
final
String
?
clickActionParam
;
final
String
?
clickActionParam
;
final
bool
?
checked
;
final
bool
?
checked
;
final
VerifyFormRegisterModel
?
verify
;
InputFormRegistrationModel
({
InputFormRegistrationModel
({
this
.
title
,
this
.
title
,
...
@@ -26,6 +28,7 @@ class InputFormRegistrationModel {
...
@@ -26,6 +28,7 @@ class InputFormRegistrationModel {
this
.
clickActionType
,
this
.
clickActionType
,
this
.
clickActionParam
,
this
.
clickActionParam
,
this
.
checked
,
this
.
checked
,
this
.
verify
,
});
});
factory
InputFormRegistrationModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=>
factory
InputFormRegistrationModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=>
...
...
lib/screen/register_campaign/model/input_form_registration_model.g.dart
View file @
fc2caf86
...
@@ -29,6 +29,12 @@ InputFormRegistrationModel _$InputFormRegistrationModelFromJson(
...
@@ -29,6 +29,12 @@ InputFormRegistrationModel _$InputFormRegistrationModelFromJson(
clickActionType:
json
[
'click_action_type'
]
as
String
?,
clickActionType:
json
[
'click_action_type'
]
as
String
?,
clickActionParam:
json
[
'click_action_param'
]
as
String
?,
clickActionParam:
json
[
'click_action_param'
]
as
String
?,
checked:
json
[
'checked'
]
as
bool
?,
checked:
json
[
'checked'
]
as
bool
?,
verify:
json
[
'verify'
]
==
null
?
null
:
VerifyFormRegisterModel
.
fromJson
(
json
[
'verify'
]
as
Map
<
String
,
dynamic
>,
),
);
);
Map
<
String
,
dynamic
>
_$InputFormRegistrationModelToJson
(
Map
<
String
,
dynamic
>
_$InputFormRegistrationModelToJson
(
...
@@ -41,4 +47,5 @@ Map<String, dynamic> _$InputFormRegistrationModelToJson(
...
@@ -41,4 +47,5 @@ Map<String, dynamic> _$InputFormRegistrationModelToJson(
'click_action_type'
:
instance
.
clickActionType
,
'click_action_type'
:
instance
.
clickActionType
,
'click_action_param'
:
instance
.
clickActionParam
,
'click_action_param'
:
instance
.
clickActionParam
,
'checked'
:
instance
.
checked
,
'checked'
:
instance
.
checked
,
'verify'
:
instance
.
verify
,
};
};
lib/screen/register_campaign/model/registration_form_package_model.dart
View file @
fc2caf86
import
'dart:convert'
;
import
'package:json_annotation/json_annotation.dart'
;
import
'package:json_annotation/json_annotation.dart'
;
import
'package:mypoint_flutter_app/extensions/string_extension.dart'
;
import
'package:mypoint_flutter_app/screen/register_campaign/model/registration_form_package_verify_model.dart'
;
import
'package:mypoint_flutter_app/screen/register_campaign/model/registration_form_package_verify_model.dart'
;
import
'input_form_registration_model.dart'
;
import
'input_form_registration_model.dart'
;
...
@@ -38,4 +41,32 @@ class RegistrationFormPackageModel {
...
@@ -38,4 +41,32 @@ class RegistrationFormPackageModel {
_$RegistrationFormPackageModelFromJson
(
json
);
_$RegistrationFormPackageModelFromJson
(
json
);
Map
<
String
,
dynamic
>
toJson
()
=>
_$RegistrationFormPackageModelToJson
(
this
);
Map
<
String
,
dynamic
>
toJson
()
=>
_$RegistrationFormPackageModelToJson
(
this
);
Map
<
String
,
dynamic
>
get
submitParams
{
final
inputs
=
formRegistration
?.
inputRequired
;
if
(
inputs
==
null
||
inputs
.
isEmpty
)
return
{};
final
out
=
<
String
,
dynamic
>{};
for
(
final
item
in
inputs
)
{
// Ưu tiên code_default, nếu rỗng fallback content
final
value
=
[
item
.
codeDefault
,
item
.
content
,
item
.
defaultValue
]
.
firstWhere
((
s
)
=>
s
?.
trim
().
isNotEmpty
??
false
,
orElse:
()
=>
item
.
defaultValue
);
out
[
item
.
key
??
''
]
=
value
;
}
return
{
'form_card'
:
out
};
}
}
}
extension
JsonStringX
on
Map
<
String
,
dynamic
>
{
/// Convert Map -> JSON String
/// - [prettify]: thêm indent 2 spaces cho dễ đọc
String
?
toJsonString
({
bool
prettify
=
false
})
{
try
{
final
encoder
=
prettify
?
const
JsonEncoder
.
withIndent
(
' '
)
:
const
JsonEncoder
();
return
encoder
.
convert
(
this
);
}
catch
(
_
)
{
return
null
;
// Không encode được (có thể do giá trị không JSON-encodable)
}
}
}
\ No newline at end of file
lib/screen/register_campaign/model/verify_register_model.dart
0 → 100644
View file @
fc2caf86
import
'package:json_annotation/json_annotation.dart'
;
part
'verify_register_model.g.dart'
;
@JsonSerializable
()
class
VerifyRegisteredPackageModel
{
final
bool
?
registed
;
@JsonKey
(
name:
'create_time'
)
final
String
?
createTime
;
@JsonKey
(
name:
'expire_time'
)
final
String
?
expireTime
;
final
String
?
description
;
const
VerifyRegisteredPackageModel
({
this
.
registed
,
this
.
createTime
,
this
.
expireTime
,
this
.
description
,
});
factory
VerifyRegisteredPackageModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=>
_$VerifyRegisteredPackageModelFromJson
(
json
);
Map
<
String
,
dynamic
>
toJson
()
=>
_$VerifyRegisteredPackageModelToJson
(
this
);
}
@JsonSerializable
(
explicitToJson:
true
)
class
VerifyRegisterVnTraAlertModel
{
final
bool
?
alert
;
final
String
?
description
;
const
VerifyRegisterVnTraAlertModel
({
this
.
alert
,
this
.
description
});
factory
VerifyRegisterVnTraAlertModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=>
_$VerifyRegisterVnTraAlertModelFromJson
(
json
);
Map
<
String
,
dynamic
>
toJson
()
=>
_$VerifyRegisterVnTraAlertModelToJson
(
this
);
}
@JsonSerializable
(
explicitToJson:
true
)
class
VerifyRegisterCampaignModel
{
final
bool
?
valid
;
@JsonKey
(
name:
'full_name'
)
final
String
?
fullName
;
@JsonKey
(
name:
'phone_number'
)
final
String
?
phoneNumber
;
@JsonKey
(
name:
'license_plate'
)
final
String
?
licensePlate
;
@JsonKey
(
name:
'registed_package'
)
final
VerifyRegisteredPackageModel
?
registeredPackage
;
final
VerifyRegisterVnTraAlertModel
?
alert
;
const
VerifyRegisterCampaignModel
({
this
.
valid
,
this
.
fullName
,
this
.
phoneNumber
,
this
.
licensePlate
,
this
.
registeredPackage
,
this
.
alert
,
});
factory
VerifyRegisterCampaignModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
=>
_$VerifyRegisterVnTraModelFromJson
(
json
);
Map
<
String
,
dynamic
>
toJson
()
=>
_$VerifyRegisterVnTraModelToJson
(
this
);
}
class
VerifyFormRegisterModel
{
final
String
?
url
;
const
VerifyFormRegisterModel
({
this
.
url
});
factory
VerifyFormRegisterModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
return
VerifyFormRegisterModel
(
url:
json
[
'url'
]
as
String
?,
);
}
Map
<
String
,
dynamic
>
toJson
()
=>
{
'url'
:
url
,
};
}
\ No newline at end of file
lib/screen/register_campaign/model/verify_register_model.g.dart
0 → 100644
View file @
fc2caf86
// GENERATED CODE - DO NOT MODIFY BY HAND
part of
'verify_register_model.dart'
;
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
VerifyRegisteredPackageModel
_$VerifyRegisteredPackageModelFromJson
(
Map
<
String
,
dynamic
>
json
,
)
=>
VerifyRegisteredPackageModel
(
registed:
json
[
'registed'
]
as
bool
?,
createTime:
json
[
'create_time'
]
as
String
?,
expireTime:
json
[
'expire_time'
]
as
String
?,
description:
json
[
'description'
]
as
String
?,
);
Map
<
String
,
dynamic
>
_$VerifyRegisteredPackageModelToJson
(
VerifyRegisteredPackageModel
instance
,
)
=>
<
String
,
dynamic
>{
'registed'
:
instance
.
registed
,
'create_time'
:
instance
.
createTime
,
'expire_time'
:
instance
.
expireTime
,
'description'
:
instance
.
description
,
};
VerifyRegisterVnTraAlertModel
_$VerifyRegisterVnTraAlertModelFromJson
(
Map
<
String
,
dynamic
>
json
,
)
=>
VerifyRegisterVnTraAlertModel
(
alert:
json
[
'alert'
]
as
bool
?,
description:
json
[
'description'
]
as
String
?,
);
Map
<
String
,
dynamic
>
_$VerifyRegisterVnTraAlertModelToJson
(
VerifyRegisterVnTraAlertModel
instance
,
)
=>
<
String
,
dynamic
>{
'alert'
:
instance
.
alert
,
'description'
:
instance
.
description
,
};
VerifyRegisterCampaignModel
_$VerifyRegisterCampaignModelFromJson
(
Map
<
String
,
dynamic
>
json
,
)
=>
VerifyRegisterCampaignModel
(
valid:
json
[
'valid'
]
as
bool
?,
fullName:
json
[
'full_name'
]
as
String
?,
phoneNumber:
json
[
'phone_number'
]
as
String
?,
licensePlate:
json
[
'license_plate'
]
as
String
?,
registeredPackage:
json
[
'registed_package'
]
==
null
?
null
:
VerifyRegisteredPackageModel
.
fromJson
(
json
[
'registed_package'
]
as
Map
<
String
,
dynamic
>,
),
alert:
json
[
'alert'
]
==
null
?
null
:
VerifyRegisterVnTraAlertModel
.
fromJson
(
json
[
'alert'
]
as
Map
<
String
,
dynamic
>,
),
);
Map
<
String
,
dynamic
>
_$VerifyRegisterCampaignModelToJson
(
VerifyRegisterCampaignModel
instance
,
)
=>
<
String
,
dynamic
>{
'valid'
:
instance
.
valid
,
'full_name'
:
instance
.
fullName
,
'phone_number'
:
instance
.
phoneNumber
,
'license_plate'
:
instance
.
licensePlate
,
'registed_package'
:
instance
.
registeredPackage
?.
toJson
(),
'alert'
:
instance
.
alert
?.
toJson
(),
};
lib/screen/register_campaign/register_form_input_screen.dart
View file @
fc2caf86
...
@@ -21,6 +21,7 @@ class _RegisterFormInputScreenState extends State<RegisterFormInputScreen> {
...
@@ -21,6 +21,7 @@ class _RegisterFormInputScreenState extends State<RegisterFormInputScreen> {
String
_title
=
''
;
String
_title
=
''
;
final
_isFormValid
=
false
.
obs
;
final
_isFormValid
=
false
.
obs
;
late
var
_isConfirmScreen
=
false
;
late
var
_isConfirmScreen
=
false
;
ProductModel
?
_product
;
@override
@override
void
initState
()
{
void
initState
()
{
...
@@ -28,21 +29,22 @@ class _RegisterFormInputScreenState extends State<RegisterFormInputScreen> {
...
@@ -28,21 +29,22 @@ class _RegisterFormInputScreenState extends State<RegisterFormInputScreen> {
_viewModel
=
Get
.
put
(
RegisterFormInputViewModel
());
_viewModel
=
Get
.
put
(
RegisterFormInputViewModel
());
final
args
=
Get
.
arguments
as
Map
<
String
,
dynamic
>?;
final
args
=
Get
.
arguments
as
Map
<
String
,
dynamic
>?;
_product
=
args
?[
'product'
]
as
ProductModel
?;
if
(
args
?[
'formConfirm'
]
!=
null
)
{
if
(
args
?[
'formConfirm'
]
!=
null
)
{
_isConfirmScreen
=
true
;
_isConfirmScreen
=
true
;
final
data
=
args
![
'formConfirm'
]
as
RegistrationFormPackageModel
;
final
data
=
args
![
'formConfirm'
]
as
RegistrationFormPackageModel
;
_title
=
data
?.
formConfirm
?.
title
??
''
;
_title
=
data
?.
formConfirm
?.
title
??
''
;
_viewModel
.
form
.
value
=
data
;
_viewModel
.
form
.
value
=
data
;
}
else
{
}
else
{
final
id
=
(
args
?[
'product'
]
as
ProductModel
?)?.
id
;
_isConfirmScreen
=
false
;
if
(
id
!=
null
)
{
final
id
=
_product
?.
id
.
toString
()
??
''
;
_isConfirmScreen
=
false
;
if
(
id
.
isEmpty
)
return
;
_viewModel
.
fetchRegisterFormInput
(
id
.
toString
()).
then
((
_
)
{
_viewModel
.
fetchRegisterFormInput
(
id
).
then
((
_
)
{
setState
(()
{
setState
(()
{
_title
=
_viewModel
.
form
.
value
?.
title
??
''
;
_title
=
_viewModel
.
form
.
value
?.
title
??
''
;
});
});
});
}
}
);
}
}
}
}
...
@@ -176,12 +178,14 @@ class _RegisterFormInputScreenState extends State<RegisterFormInputScreen> {
...
@@ -176,12 +178,14 @@ class _RegisterFormInputScreenState extends State<RegisterFormInputScreen> {
}
}
void
_gotoPaymentScreen
()
{
void
_gotoPaymentScreen
()
{
print
(
"_gotoPaymentScreen"
);
final
metaData
=
(
_viewModel
.
form
.
value
?.
submitParams
??
{}).
toJsonString
();
print
(
"_gotoPaymentScreen metaData
$metaData
"
);
Get
.
toNamed
(
transactionDetailScreen
,
arguments:
{
"product"
:
_product
,
"quantity"
:
1
,
"metaData"
:
metaData
});
}
}
void
_onSubmit
()
{
void
_onSubmit
()
{
if
(
_viewModel
.
form
.
value
?.
formConfirm
?.
checked
==
true
)
{
if
(
_viewModel
.
form
.
value
?.
formConfirm
?.
checked
==
true
)
{
Get
.
toNamed
(
registerFormInputScreen
,
arguments:
{
"formConfirm"
:
_viewModel
.
form
.
value
},
preventDuplicates:
false
);
Get
.
toNamed
(
registerFormInputScreen
,
arguments:
{
"formConfirm"
:
_viewModel
.
form
.
value
,
"product"
:
_product
},
preventDuplicates:
false
);
}
else
{
}
else
{
_gotoPaymentScreen
();
_gotoPaymentScreen
();
}
}
...
@@ -190,9 +194,9 @@ class _RegisterFormInputScreenState extends State<RegisterFormInputScreen> {
...
@@ -190,9 +194,9 @@ class _RegisterFormInputScreenState extends State<RegisterFormInputScreen> {
void
_validateForm
()
{
void
_validateForm
()
{
final
form
=
_viewModel
.
form
.
value
?.
formRegistration
;
final
form
=
_viewModel
.
form
.
value
?.
formRegistration
;
final
inputs
=
form
?.
inputRequired
??
[];
final
inputs
=
form
?.
inputRequired
??
[];
inputs
.
forEach
((
input
)
{
for
(
var
input
in
input
s
)
{
print
(
"Input:
${input.title}
, Value:
${input.value}
"
);
print
(
"Input:
${input.title}
, Value:
${input.value}
"
);
}
);
}
final
isValid
=
inputs
.
every
((
input
)
{
final
isValid
=
inputs
.
every
((
input
)
{
if
(
input
.
require
==
true
)
{
if
(
input
.
require
==
true
)
{
return
input
.
value
.
trim
().
isNotEmpty
==
true
;
return
input
.
value
.
trim
().
isNotEmpty
==
true
;
...
...
lib/screen/register_campaign/register_form_input_viewmodel.dart
View file @
fc2caf86
...
@@ -2,9 +2,11 @@ import 'package:get/get_rx/src/rx_types/rx_types.dart';
...
@@ -2,9 +2,11 @@ import 'package:get/get_rx/src/rx_types/rx_types.dart';
import
'package:mypoint_flutter_app/networking/restful_api_client_all_request.dart'
;
import
'package:mypoint_flutter_app/networking/restful_api_client_all_request.dart'
;
import
'../../networking/restful_api_viewmodel.dart'
;
import
'../../networking/restful_api_viewmodel.dart'
;
import
'model/registration_form_package_model.dart'
;
import
'model/registration_form_package_model.dart'
;
import
'model/verify_register_model.dart'
;
class
RegisterFormInputViewModel
extends
RestfulApiViewModel
{
class
RegisterFormInputViewModel
extends
RestfulApiViewModel
{
var
form
=
Rxn
<
RegistrationFormPackageModel
>();
var
form
=
Rxn
<
RegistrationFormPackageModel
>();
var
verifyData
=
Rxn
<
VerifyRegisterCampaignModel
>();
var
isLoading
=
false
.
obs
;
var
isLoading
=
false
.
obs
;
var
isChecked
=
true
.
obs
;
var
isChecked
=
true
.
obs
;
...
@@ -20,4 +22,17 @@ class RegisterFormInputViewModel extends RestfulApiViewModel {
...
@@ -20,4 +22,17 @@ class RegisterFormInputViewModel extends RestfulApiViewModel {
isLoading
.
value
=
false
;
isLoading
.
value
=
false
;
}
}
}
}
Future
<
void
>
verifyRegisterForm
()
async
{
final
path
=
form
.
value
?.
formRegistration
?.
verify
?.
url
??
''
;
try
{
isLoading
.
value
=
true
;
final
response
=
await
client
.
verifyRegisterForm
(
path
);
verifyData
.
value
=
response
.
data
;
}
catch
(
error
)
{
print
(
"Error fetching product detail:
$error
"
);
}
finally
{
isLoading
.
value
=
false
;
}
}
}
}
\ No newline at end of file
lib/screen/transaction/history/transaction_history_detail_screen.dart
View file @
fc2caf86
...
@@ -48,7 +48,7 @@ class _TransactionHistoryDetailScreenState extends BaseState<TransactionHistoryD
...
@@ -48,7 +48,7 @@ class _TransactionHistoryDetailScreenState extends BaseState<TransactionHistoryD
leftButtons:
canBack
?
[
CustomBackButton
()]
:
[],
leftButtons:
canBack
?
[
CustomBackButton
()]
:
[],
rightButtons:
[
rightButtons:
[
IconButton
(
IconButton
(
icon:
const
Icon
(
Icons
.
headset_
mic
,
size:
24
,
color:
Colors
.
black54
),
icon:
const
Icon
(
Icons
.
headset_
rounded
,
size:
24
),
onPressed:
()
{
onPressed:
()
{
Get
.
toNamed
(
supportScreen
);
Get
.
toNamed
(
supportScreen
);
},
},
...
@@ -100,7 +100,7 @@ class _TransactionHistoryDetailScreenState extends BaseState<TransactionHistoryD
...
@@ -100,7 +100,7 @@ class _TransactionHistoryDetailScreenState extends BaseState<TransactionHistoryD
Widget
_buildMainInfoSection
(
TransactionHistoryModel
data
)
{
Widget
_buildMainInfoSection
(
TransactionHistoryModel
data
)
{
return
Center
(
return
Center
(
child:
Container
(
child:
Container
(
padding:
const
EdgeInsets
.
all
(
16
),
padding:
const
EdgeInsets
.
all
(
0
),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
12
)),
decoration:
BoxDecoration
(
color:
Colors
.
white
,
borderRadius:
BorderRadius
.
circular
(
12
)),
child:
Column
(
child:
Column
(
children:
[
children:
[
...
@@ -114,7 +114,7 @@ class _TransactionHistoryDetailScreenState extends BaseState<TransactionHistoryD
...
@@ -114,7 +114,7 @@ class _TransactionHistoryDetailScreenState extends BaseState<TransactionHistoryD
),
),
),
),
const
SizedBox
(
height:
8
),
const
SizedBox
(
height:
8
),
const
Text
(
"Thanh toán mua ưu đãi"
,
style:
TextStyle
(
fontSize:
20
,
fontWeight:
FontWeight
.
bold
)),
Text
(
data
.
name
??
"Thanh toán mua ưu đãi"
,
style:
const
TextStyle
(
fontSize:
20
,
fontWeight:
FontWeight
.
bold
)
,
textAlign:
TextAlign
.
center
),
const
SizedBox
(
height:
4
),
const
SizedBox
(
height:
4
),
Row
(
Row
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
...
...
lib/screen/transaction/transaction_detail_screen.dart
View file @
fc2caf86
...
@@ -24,6 +24,7 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
...
@@ -24,6 +24,7 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
late
final
TransactionDetailViewModel
_viewModel
;
late
final
TransactionDetailViewModel
_viewModel
;
final
currencyFormatter
=
NumberFormat
.
currency
(
locale:
'vi_VN'
,
symbol:
'đ'
,
decimalDigits:
0
);
final
currencyFormatter
=
NumberFormat
.
currency
(
locale:
'vi_VN'
,
symbol:
'đ'
,
decimalDigits:
0
);
ProductModel
?
_product
;
ProductModel
?
_product
;
String
?
_metaData
;
int
_quantity
=
1
;
int
_quantity
=
1
;
String
?
_targetPhoneNumber
;
String
?
_targetPhoneNumber
;
bool
_isPaymentMethodsExpanded
=
true
;
bool
_isPaymentMethodsExpanded
=
true
;
...
@@ -35,6 +36,7 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
...
@@ -35,6 +36,7 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
final
args
=
Get
.
arguments
;
final
args
=
Get
.
arguments
;
if
(
args
is
Map
)
{
if
(
args
is
Map
)
{
_product
=
args
[
'product'
];
_product
=
args
[
'product'
];
_metaData
=
args
[
'metaData'
];
_quantity
=
args
[
'quantity'
]
??
1
;
_quantity
=
args
[
'quantity'
]
??
1
;
_targetPhoneNumber
=
args
[
'targetPhoneNumber'
];
_targetPhoneNumber
=
args
[
'targetPhoneNumber'
];
}
}
...
@@ -45,7 +47,7 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
...
@@ -45,7 +47,7 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
return
;
return
;
}
}
_viewModel
=
Get
.
put
(
_viewModel
=
Get
.
put
(
TransactionDetailViewModel
(
product:
_product
!,
quantity:
_quantity
,
targetPhoneNumber:
_targetPhoneNumber
),
TransactionDetailViewModel
(
product:
_product
!,
quantity:
_quantity
,
targetPhoneNumber:
_targetPhoneNumber
,
metaData:
_metaData
),
);
);
_viewModel
.
refreshData
();
_viewModel
.
refreshData
();
...
@@ -202,7 +204,7 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
...
@@ -202,7 +204,7 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
children:
[
children:
[
_buildTotalRow
(
'Tổng số tiền'
,
totalPrice
,
false
),
_buildTotalRow
(
'Tổng số tiền'
,
totalPrice
,
false
),
_buildTotalRow
(
'Sử dụng điểm'
,
-
pointsUsed
,
false
),
_buildTotalRow
(
'Sử dụng điểm'
,
-
pointsUsed
,
false
),
_buildTotalRow
(
'Tổng tạm tính'
,
finalTotal
,
fals
e
),
_buildTotalRow
(
'Tổng tạm tính'
,
finalTotal
,
tru
e
),
],
],
),
),
);
);
...
@@ -217,13 +219,13 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
...
@@ -217,13 +219,13 @@ class _TransactionDetailScreenState extends BaseState<TransactionDetailScreen> w
child:
Row
(
child:
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
children:
[
Text
(
label
,
style:
TextStyle
(
fontSize:
16
,
color:
isHighlighted
?
Colors
.
black87
:
Colors
.
grey
.
shade700
)),
Text
(
label
,
style:
TextStyle
(
fontSize:
16
,
color:
Colors
.
grey
.
shade700
)),
Text
(
Text
(
displayAmount
,
displayAmount
,
style:
TextStyle
(
style:
TextStyle
(
fontSize:
16
,
fontSize:
16
,
fontWeight:
FontWeight
.
w500
,
fontWeight:
FontWeight
.
w500
,
color:
isHighlighted
&&
amount
==
0
?
Colors
.
red
:
Colors
.
black87
,
color:
isHighlighted
?
Colors
.
red
:
Colors
.
black87
,
),
),
),
),
],
],
...
...
lib/screen/transaction/transaction_detail_viewmodel.dart
View file @
fc2caf86
...
@@ -22,6 +22,7 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
...
@@ -22,6 +22,7 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
var
paymentBankAccounts
=
RxList
<
PaymentBankAccountInfoModel
>();
var
paymentBankAccounts
=
RxList
<
PaymentBankAccountInfoModel
>();
final
RxBool
isLoading
=
false
.
obs
;
final
RxBool
isLoading
=
false
.
obs
;
final
ProductModel
product
;
final
ProductModel
product
;
String
?
metaData
;
final
int
quantity
;
final
int
quantity
;
final
String
?
targetPhoneNumber
;
final
String
?
targetPhoneNumber
;
final
RxBool
usePoints
=
true
.
obs
;
final
RxBool
usePoints
=
true
.
obs
;
...
@@ -36,7 +37,7 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
...
@@ -36,7 +37,7 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
return
finalTotal
;
return
finalTotal
;
}
}
TransactionDetailViewModel
({
required
this
.
product
,
required
this
.
quantity
,
this
.
targetPhoneNumber
});
TransactionDetailViewModel
({
required
this
.
product
,
required
this
.
quantity
,
this
.
targetPhoneNumber
,
this
.
metaData
});
@override
@override
void
onInit
()
{
void
onInit
()
{
...
@@ -50,7 +51,7 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
...
@@ -50,7 +51,7 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
isLoading
.
value
=
false
;
isLoading
.
value
=
false
;
}
}
requestPaymentProduct
()
{
void
requestPaymentProduct
()
{
showLoading
();
showLoading
();
final
requestId
=
Uuid
().
v4
();
final
requestId
=
Uuid
().
v4
();
int
?
point
=
usePoints
.
value
?
previewData
.
value
?.
pointData
?.
point
:
0
;
int
?
point
=
usePoints
.
value
?
previewData
.
value
?.
pointData
?.
point
:
0
;
...
@@ -75,7 +76,7 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
...
@@ -75,7 +76,7 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
method:
selectedPaymentMethod
,
method:
selectedPaymentMethod
,
paymentTokenId:
selectedBankAccount
?.
id
,
paymentTokenId:
selectedBankAccount
?.
id
,
saveToken:
saveToken
,
saveToken:
saveToken
,
metadata:
""
,
metadata:
metaData
,
targetPhoneNumber:
targetPhoneNumber
,
targetPhoneNumber:
targetPhoneNumber
,
)
)
.
then
((
value
)
{
.
then
((
value
)
{
...
@@ -127,6 +128,9 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
...
@@ -127,6 +128,9 @@ class TransactionDetailViewModel extends RestfulApiViewModel {
if
(
product
.
previewFlashSale
?.
isFlashSalePrice
==
true
&&
product
.
previewFlashSale
?.
id
!=
null
)
{
if
(
product
.
previewFlashSale
?.
isFlashSalePrice
==
true
&&
product
.
previewFlashSale
?.
id
!=
null
)
{
body
[
"flash_sale_id"
]
=
product
.
previewFlashSale
!.
id
;
body
[
"flash_sale_id"
]
=
product
.
previewFlashSale
!.
id
;
}
}
if
((
metaData
??
''
).
isNotEmpty
)
{
body
[
"metadata"
]
=
metaData
;
}
final
response
=
await
client
.
getPreviewOrderInfo
(
body
);
final
response
=
await
client
.
getPreviewOrderInfo
(
body
);
previewData
.
value
=
response
.
data
;
previewData
.
value
=
response
.
data
;
}
catch
(
error
)
{
}
catch
(
error
)
{
...
...
lib/screen/voucher/detail/voucher_detail_screen.dart
View file @
fc2caf86
...
@@ -464,7 +464,7 @@ class _VoucherDetailScreenState extends BaseState<VoucherDetailScreen> with Basi
...
@@ -464,7 +464,7 @@ class _VoucherDetailScreenState extends BaseState<VoucherDetailScreen> with Basi
);
);
}
}
_handleContinueButtonAction
()
{
void
_handleContinueButtonAction
()
{
final
product
=
_viewModel
.
product
.
value
;
final
product
=
_viewModel
.
product
.
value
;
if
(
product
?.
requireFormRegis
==
true
)
{
if
(
product
?.
requireFormRegis
==
true
)
{
Get
.
toNamed
(
registerFormInputScreen
,
arguments:
{
"product"
:
product
});
Get
.
toNamed
(
registerFormInputScreen
,
arguments:
{
"product"
:
product
});
...
...
lib/screen/voucher/detail/voucher_detail_viewmodel.dart
View file @
fc2caf86
...
@@ -79,7 +79,7 @@ class VoucherDetailViewModel extends RestfulApiViewModel {
...
@@ -79,7 +79,7 @@ class VoucherDetailViewModel extends RestfulApiViewModel {
}
finally
{}
}
finally
{}
}
}
verifyOrderProduct
(
Function
verified
)
async
{
Future
<
void
>
verifyOrderProduct
(
Function
verified
)
async
{
final
value
=
product
.
value
;
final
value
=
product
.
value
;
var
body
=
{
"product_id"
:
productId
,
"price"
:
value
?.
amountToBePaid
,
"quantity"
:
quantity
.
value
};
var
body
=
{
"product_id"
:
productId
,
"price"
:
value
?.
amountToBePaid
,
"quantity"
:
quantity
.
value
};
if
(
value
?.
previewFlashSale
?.
isFlashSalePrice
==
true
)
{
if
(
value
?.
previewFlashSale
?.
isFlashSalePrice
==
true
)
{
...
...
lib/screen/webview/payment_web_view_screen.dart
View file @
fc2caf86
...
@@ -249,23 +249,23 @@ class _PaymentWebViewScreenState extends BaseState<PaymentWebViewScreen> with Ba
...
@@ -249,23 +249,23 @@ class _PaymentWebViewScreenState extends BaseState<PaymentWebViewScreen> with Ba
}
}
}
}
_onBackPressed
()
{
void
_onBackPressed
()
{
final
dataAlert
=
DataAlertModel
(
final
dataAlert
=
DataAlertModel
(
title:
"
Huỷ đơn hàng?
"
,
title:
"
Xác nhận huỷ thanh toán
"
,
description:
"Bạn có chắc muốn huỷ thanh toán đơn hàng này?"
,
description:
"Bạn có chắc muốn huỷ thanh toán đơn hàng này?"
,
localHeaderImage:
"assets/images/ic_pipi_03.png"
,
localHeaderImage:
"assets/images/ic_pipi_03.png"
,
buttons:
[
buttons:
[
AlertButton
(
AlertButton
(
text:
"Đồng ý"
,
text:
"Tiếp tục thanh toán"
,
onPressed:
()
{
onPressed:
()
=>
Navigator
.
pop
(
context
,
false
),
Get
.
offNamed
(
transactionHistoryDetailScreen
,
arguments:
{
"orderId"
:
input
.
orderId
??
""
,
"canBack"
:
false
});
},
bgColor:
BaseColor
.
primary500
,
bgColor:
BaseColor
.
primary500
,
textColor:
Colors
.
white
,
textColor:
Colors
.
white
,
),
),
AlertButton
(
AlertButton
(
text:
"Huỷ"
,
text:
"Dừng thanh toán"
,
onPressed:
()
=>
Navigator
.
pop
(
context
,
false
),
onPressed:
()
{
Get
.
offNamed
(
transactionHistoryDetailScreen
,
arguments:
{
"orderId"
:
input
.
orderId
??
""
,
"canBack"
:
false
});
},
bgColor:
Colors
.
white
,
bgColor:
Colors
.
white
,
textColor:
BaseColor
.
second500
,
textColor:
BaseColor
.
second500
,
),
),
...
...
lib/shared/router_gage.dart
View file @
fc2caf86
...
@@ -16,6 +16,7 @@ import '../screen/electric_payment/electric_payment_history_screen.dart';
...
@@ -16,6 +16,7 @@ import '../screen/electric_payment/electric_payment_history_screen.dart';
import
'../screen/electric_payment/electric_payment_screen.dart'
;
import
'../screen/electric_payment/electric_payment_screen.dart'
;
import
'../screen/game/game_cards/game_card_screen.dart'
;
import
'../screen/game/game_cards/game_card_screen.dart'
;
import
'../screen/game/game_tab_screen.dart'
;
import
'../screen/game/game_tab_screen.dart'
;
import
'../screen/health_book/health_book_screen.dart'
;
import
'../screen/history_point/history_point_screen.dart'
;
import
'../screen/history_point/history_point_screen.dart'
;
import
'../screen/history_point_cashback/history_point_cashback_screen.dart'
;
import
'../screen/history_point_cashback/history_point_cashback_screen.dart'
;
import
'../screen/interested_categories/interestied_categories_screen.dart'
;
import
'../screen/interested_categories/interestied_categories_screen.dart'
;
...
@@ -90,6 +91,7 @@ const electricPaymentScreen = '/electricPaymentScreen';
...
@@ -90,6 +91,7 @@ const electricPaymentScreen = '/electricPaymentScreen';
const
electricPaymentHistoryScreen
=
'/electricPaymentHistoryScreen'
;
const
electricPaymentHistoryScreen
=
'/electricPaymentHistoryScreen'
;
const
trafficServiceScreen
=
'/trafficServiceScreen'
;
const
trafficServiceScreen
=
'/trafficServiceScreen'
;
const
trafficServiceDetailScreen
=
'/trafficServiceDetailScreen'
;
const
trafficServiceDetailScreen
=
'/trafficServiceDetailScreen'
;
const
healthBookScreen
=
'/healthBookScreen'
;
const
campaignSevenDayScreen
=
'/campaignSevenDayScreen'
;
const
campaignSevenDayScreen
=
'/campaignSevenDayScreen'
;
const
surveyQuestionScreen
=
'/surveyQuestionScreen'
;
const
surveyQuestionScreen
=
'/surveyQuestionScreen'
;
const
deviceManagerScreen
=
'/deviceManagerScreen'
;
const
deviceManagerScreen
=
'/deviceManagerScreen'
;
...
@@ -165,6 +167,7 @@ class RouterPage {
...
@@ -165,6 +167,7 @@ class RouterPage {
GetPage
(
name:
historyPointScreen
,
page:
()
=>
HistoryPointScreen
()),
GetPage
(
name:
historyPointScreen
,
page:
()
=>
HistoryPointScreen
()),
GetPage
(
name:
qrCodeScreen
,
page:
()
=>
QRCodeScreen
()),
GetPage
(
name:
qrCodeScreen
,
page:
()
=>
QRCodeScreen
()),
GetPage
(
name:
myMobileCardDetailScreen
,
page:
()
=>
MyMobileCardDetailScreen
()),
GetPage
(
name:
myMobileCardDetailScreen
,
page:
()
=>
MyMobileCardDetailScreen
()),
GetPage
(
name:
healthBookScreen
,
page:
()
=>
HealthBookScreen
()),
];
];
}
}
}
}
\ No newline at end of file
lib/widgets/support_button.dart
View file @
fc2caf86
...
@@ -24,9 +24,8 @@ class SupportButton extends StatelessWidget {
...
@@ -24,9 +24,8 @@ class SupportButton extends StatelessWidget {
Get
.
to
(()
=>
const
SupportScreen
());
Get
.
to
(()
=>
const
SupportScreen
());
},
},
icon:
const
Icon
(
icon:
const
Icon
(
Icons
.
headset_
mic
,
Icons
.
headset_
rounded
,
size:
18
,
size:
18
,
color:
BaseColor
.
second600
,
),
),
label:
const
Text
(
"Hỗ trợ"
),
label:
const
Text
(
"Hỗ trợ"
),
style:
TextButton
.
styleFrom
(
style:
TextButton
.
styleFrom
(
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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