Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
book-app
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
book-app
Commits
16bfa2c9
提交
16bfa2c9
authored
2月 27, 2024
作者:
yueweilu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
紫金币不足提示
上级
dbf88eac
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
27 行增加
和
9 行删除
+27
-9
controller.dart
lib/pages/book_detail/controller.dart
+2
-2
controller.dart
lib/pages/book_pay/controller.dart
+14
-4
view.dart
lib/pages/book_pay/view.dart
+1
-1
pay_way.dart
lib/pages/book_pay/widgets/pay_way.dart
+9
-1
tools.dart
lib/utils/tools.dart
+1
-1
没有找到文件。
lib/pages/book_detail/controller.dart
浏览文件 @
16bfa2c9
...
@@ -43,7 +43,7 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
...
@@ -43,7 +43,7 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
void
addCart
(
String
bookId
)
async
{
void
addCart
(
String
bookId
)
async
{
final
result
=
await
ShopAPI
.
addCart
(
bookId:
bookId
);
final
result
=
await
ShopAPI
.
addCart
(
bookId:
bookId
);
if
(
result
){
if
(
result
){
Toast
.
show
(
'
添加购物车
成功'
);
Toast
.
show
(
'
加入书架
成功'
);
}
}
}
}
...
@@ -73,7 +73,7 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
...
@@ -73,7 +73,7 @@ class BookDetailController extends GetxController with GetSingleTickerProviderSt
}
}
bool
result
=
await
CommonAPI
.
love
(
bool
result
=
await
CommonAPI
.
love
(
bookId:
bookId
,
love:
isCollection
.
toString
());
bookId:
bookId
,
love:
isCollection
.
toString
());
print
(
'================================
$result
'
);
Console
.
log
(
'================================
$result
'
);
if
(
result
)
{
if
(
result
)
{
getBookDetails
();
getBookDetails
();
}
}
...
...
lib/pages/book_pay/controller.dart
浏览文件 @
16bfa2c9
...
@@ -41,12 +41,13 @@ class BookPayController extends GetxController {
...
@@ -41,12 +41,13 @@ class BookPayController extends GetxController {
// late double finalPrice = 0.00;
// late double finalPrice = 0.00;
Decimal
finalPrice
=
Decimal
.
zero
;
Decimal
finalPrice
=
Decimal
.
zero
;
String
noticeText
=
''
;
@override
@override
void
onReady
()
{
void
onReady
()
{
_getCreditPoints
(
price:
originalPrice
.
toString
(),
couponRecId:
useCouponModel
.
couponRecId
.
toString
());
_getCreditPoints
(
price:
originalPrice
.
toString
(),
couponRecId:
useCouponModel
.
couponRecId
.
toString
());
_getShow
();
_getShow
();
computeFinalPrice
();
_getCouponNumber
();
_getCouponNumber
();
super
.
onReady
();
super
.
onReady
();
}
}
...
@@ -54,7 +55,7 @@ class BookPayController extends GetxController {
...
@@ -54,7 +55,7 @@ class BookPayController extends GetxController {
/// 使用优惠券
/// 使用优惠券
void
setUseCoupon
(
CouponModel
model
){
void
setUseCoupon
(
CouponModel
model
){
useCouponModel
=
model
;
useCouponModel
=
model
;
print
(
'使用优惠券。。。。。。。。。。。。。。。。
${model.couponRecId}
'
);
Console
.
log
(
'使用优惠券。。。。。。。。。。。。。。。。
${model.couponRecId}
'
);
// 使用优惠券后重新获取积分
// 使用优惠券后重新获取积分
_getCreditPoints
(
price:
originalPrice
.
toString
(),
couponRecId:
useCouponModel
.
couponRecId
.
toString
());
_getCreditPoints
(
price:
originalPrice
.
toString
(),
couponRecId:
useCouponModel
.
couponRecId
.
toString
());
}
}
...
@@ -83,6 +84,7 @@ class BookPayController extends GetxController {
...
@@ -83,6 +84,7 @@ class BookPayController extends GetxController {
model
.
selected
=
false
;
model
.
selected
=
false
;
}
}
}
}
// computeFinalPrice();
update
();
update
();
}
}
...
@@ -107,6 +109,7 @@ class BookPayController extends GetxController {
...
@@ -107,6 +109,7 @@ class BookPayController extends GetxController {
/// 是否展示优惠券 和积分使用 模型
/// 是否展示优惠券 和积分使用 模型
void
_getShow
()
async
{
void
_getShow
()
async
{
showModel
=
await
ShopAPI
.
show
();
showModel
=
await
ShopAPI
.
show
();
computeFinalPrice
();
update
();
update
();
}
}
...
@@ -125,11 +128,11 @@ class BookPayController extends GetxController {
...
@@ -125,11 +128,11 @@ class BookPayController extends GetxController {
if
(
model
.
status
==
1
){
if
(
model
.
status
==
1
){
if
(
model
.
selected
==
true
){
if
(
model
.
selected
==
true
){
price
=
price
+
Decimal
.
parse
(
model
.
vipPrice
??
'0.00'
);
price
=
price
+
Decimal
.
parse
(
model
.
vipPrice
??
'0.00'
);
print
(
'==============11111111111==================
$price
'
);
Console
.
log
(
'==============11111111111==================
$price
'
);
}
}
}
}
}
}
print
(
'================================
$price
'
);
Console
.
log
(
'================================
$price
'
);
return
price
.
toDouble
();
return
price
.
toDouble
();
}
}
...
@@ -146,6 +149,13 @@ class BookPayController extends GetxController {
...
@@ -146,6 +149,13 @@ class BookPayController extends GetxController {
if
(
finalPrice
.
toDouble
()
<
0
){
if
(
finalPrice
.
toDouble
()
<
0
){
finalPrice
=
Decimal
.
zero
;
finalPrice
=
Decimal
.
zero
;
}
}
if
(
finalPrice
.
toDouble
()*
100
-
double
.
parse
(
showModel
.
membersBean
.
toString
())
>
0
){
noticeText
=
'紫荆币不足,需至少充值
${finalPrice.toDouble()* 100 - double.parse(showModel.membersBean.toString())}
'
;
}
else
{
noticeText
=
''
;
}
update
();
update
();
}
}
...
...
lib/pages/book_pay/view.dart
浏览文件 @
16bfa2c9
...
@@ -100,7 +100,7 @@ class _BookPayPageState extends State<BookPayPage> {
...
@@ -100,7 +100,7 @@ class _BookPayPageState extends State<BookPayPage> {
onTap:
(){
onTap:
(){
controller
.
setPayModel
(
model
);
controller
.
setPayModel
(
model
);
},
},
child:
BuildPayWay
(
model:
model
,));
child:
BuildPayWay
(
model:
model
,
controller:
controller
,
));
},
},
itemCount:
controller
.
pays
.
length
,
itemCount:
controller
.
pays
.
length
,
),
),
...
...
lib/pages/book_pay/widgets/pay_way.dart
浏览文件 @
16bfa2c9
...
@@ -2,9 +2,11 @@ part of book_pay;
...
@@ -2,9 +2,11 @@ part of book_pay;
class
BuildPayWay
extends
StatelessWidget
{
class
BuildPayWay
extends
StatelessWidget
{
final
PayModel
model
;
final
PayModel
model
;
final
BookPayController
?
controller
;
const
BuildPayWay
({
const
BuildPayWay
({
Key
?
key
,
Key
?
key
,
required
this
.
model
required
this
.
model
,
this
.
controller
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
@override
@override
...
@@ -30,6 +32,10 @@ class BuildPayWay extends StatelessWidget {
...
@@ -30,6 +32,10 @@ class BuildPayWay extends StatelessWidget {
Text
(
model
.
name
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
Colours
.
c3
,
height:
1.1
)),
Text
(
model
.
name
,
style:
TextStyle
(
fontSize:
14
.
w
,
color:
Colours
.
c3
,
height:
1.1
)),
],
],
),
),
Row
(
children:
[
model
.
type
==
3
&&
model
.
selected
?
Text
(
controller
!=
null
?
controller
!.
noticeText
:
''
,
style:
TextStyle
(
fontSize:
11
.
w
,
color:
AppTheme
.
primary
,
height:
1.1
)):
const
SizedBox
(),
model
.
type
==
3
&&
model
.
selected
?
Gaps
.
hGaps10
:
const
SizedBox
(),
SizedBox
(
SizedBox
(
// color: Colors.cyan,
// color: Colors.cyan,
width:
15
.
w
,
width:
15
.
w
,
...
@@ -37,6 +43,8 @@ class BuildPayWay extends StatelessWidget {
...
@@ -37,6 +43,8 @@ class BuildPayWay extends StatelessWidget {
child:
Image
.
asset
(
model
.
selected
?
'assets/images/pay_check.png'
:
'assets/images/pay_uncheck.png'
),
child:
Image
.
asset
(
model
.
selected
?
'assets/images/pay_check.png'
:
'assets/images/pay_uncheck.png'
),
)
)
],
],
)
],
),
),
),
),
Container
(
Container
(
...
...
lib/utils/tools.dart
浏览文件 @
16bfa2c9
...
@@ -38,7 +38,7 @@ abstract class Tools {
...
@@ -38,7 +38,7 @@ abstract class Tools {
static
Future
<
String
>
getDirectory
()
async
{
static
Future
<
String
>
getDirectory
()
async
{
// getTemporaryDirectory
// getTemporaryDirectory
final
directory
=
await
get
ExternalStorage
Directory
();
final
directory
=
await
get
Temporary
Directory
();
return
directory
!.
path
;
return
directory
!.
path
;
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论