提交 517b3728 authored 作者: yueweilu's avatar yueweilu

二次支付

上级 38d60d25
...@@ -4,5 +4,5 @@ keyPassword=123456 ...@@ -4,5 +4,5 @@ keyPassword=123456
keyAlias=zijing keyAlias=zijing
#storeFile=/Users/apple/zijiing_key.jks storeFile=/Users/apple/zijiing_key.jks
storeFile=zijiing_key.jks #storeFile=zijiing_key.jks
\ No newline at end of file \ No newline at end of file
...@@ -222,6 +222,7 @@ abstract class LibraryAPI { ...@@ -222,6 +222,7 @@ abstract class LibraryAPI {
'title':title, 'title':title,
'content':content 'content':content
}, },
showLoading: true
); );
if (result.data is Map && result.data['is_success'] == 1){ if (result.data is Map && result.data['is_success'] == 1){
return true; return true;
...@@ -293,8 +294,9 @@ abstract class LibraryAPI { ...@@ -293,8 +294,9 @@ abstract class LibraryAPI {
'note_content':noteContent 'note_content':noteContent
}, },
showLoading: true
); );
if (result.data is Map && result.data['is_success'] == 1){ if (result.data is Map && result.data['id']!= ''){
return true; return true;
} }
return false; return false;
......
...@@ -470,7 +470,7 @@ abstract class MineAPI { ...@@ -470,7 +470,7 @@ abstract class MineAPI {
params: { params: {
'ordersNum':ordersNum, 'ordersNum':ordersNum,
}, },
showLoading: true // showLoading: true
); );
if (result.data is! Map) return PayOrderModel(); if (result.data is! Map) return PayOrderModel();
return PayOrderModel.fromJson(result.data); return PayOrderModel.fromJson(result.data);
...@@ -485,7 +485,7 @@ abstract class MineAPI { ...@@ -485,7 +485,7 @@ abstract class MineAPI {
params: { params: {
'ordersNum':ordersNum, 'ordersNum':ordersNum,
}, },
showLoading: true // showLoading: true
); );
if (result.data is Map && result.data['is_success'] == 1) { if (result.data is Map && result.data['is_success'] == 1) {
return true; return true;
......
...@@ -51,6 +51,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -51,6 +51,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
final FlutterSoundRecorder _mRecorder = FlutterSoundRecorder(); final FlutterSoundRecorder _mRecorder = FlutterSoundRecorder();
// 录音开始 // 录音开始
bool startRecording = false; bool startRecording = false;
// 是否存在离线文件
bool isExistFile = false;
///------------------------------------------ 页面 生命周期-------------------------------------------------------- ///------------------------------------------ 页面 生命周期--------------------------------------------------------
...@@ -194,6 +196,13 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -194,6 +196,13 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
} }
// 重置所有信息
void reset(){
clearAllDiscussInput();
clearDiscussInputImages();
clearDiscussAudios();
}
// 添加讨论图片 // 添加讨论图片
void addDiscussInputImages(String path){ void addDiscussInputImages(String path){
discussInputImages.add(path); discussInputImages.add(path);
...@@ -224,6 +233,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -224,6 +233,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
discussInputAudios.clear(); discussInputAudios.clear();
titleInput.text = ''; titleInput.text = '';
contentInput.text = ''; contentInput.text = '';
isPublic = false;
Console.log('clearAllDiscussInput--------------------------------'); Console.log('clearAllDiscussInput--------------------------------');
update(); update();
} }
...@@ -290,10 +300,17 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -290,10 +300,17 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
positioning: notePosition, positioning: notePosition,
noteContent: jsonEncode(contentMap) noteContent: jsonEncode(contentMap)
); );
if(result){
Toast.show('笔记发表成功');
}
else{
Toast.show('笔记发表失败');
}
titleInput.text = ''; // 重置所有信息
contentInput.text = ''; reset();
setShowChat(false); setShowChat(false);
return result; return result;
} }
...@@ -317,8 +334,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -317,8 +334,8 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
Toast.show('话题发表失败'); Toast.show('话题发表失败');
} }
titleInput.text = ''; // 重置所有信息
contentInput.text = ''; reset();
setShowChat(false); setShowChat(false);
return result; return result;
...@@ -446,6 +463,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide ...@@ -446,6 +463,7 @@ class ReadController extends FullLifeCycleController with GetSingleTickerProvide
return await Directory('${directory.path}/$bookId').exists(); return await Directory('${directory.path}/$bookId').exists();
} }
isExistFile = directoryExists;
print('不存在名为 "$bookId" 的文件夹'); print('不存在名为 "$bookId" 的文件夹');
return false; return false;
......
...@@ -42,7 +42,7 @@ class _ReadPageState extends State<ReadPage> { ...@@ -42,7 +42,7 @@ class _ReadPageState extends State<ReadPage> {
readController.getBookDown(); readController.getBookDown();
}, },
child: Text( child: Text(
'离线阅读', readController.isExistFile?'':'离线阅读',
style: TextStyle( style: TextStyle(
fontSize: 14.w, color: Colours.c3), fontSize: 14.w, color: Colours.c3),
)) ))
...@@ -62,11 +62,6 @@ class _ReadPageState extends State<ReadPage> { ...@@ -62,11 +62,6 @@ class _ReadPageState extends State<ReadPage> {
color: Colors.white, color: Colors.white,
child: Stack( child: Stack(
children: [ children: [
// Container(
// height: 40,
// width: double.infinity,
// color: Colors.lightBlue,
// ),
InAppWebView( InAppWebView(
initialUrlRequest: URLRequest( initialUrlRequest: URLRequest(
url: Uri.parse('http://150.158.138.40:9200/read.html'), url: Uri.parse('http://150.158.138.40:9200/read.html'),
...@@ -106,18 +101,22 @@ class _ReadPageState extends State<ReadPage> { ...@@ -106,18 +101,22 @@ class _ReadPageState extends State<ReadPage> {
// 监听笔记回调 // 监听笔记回调
controller.addJavaScriptHandler(handlerName: 'noteCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'noteCallBack', callback: (args){
readController.noteTitle = args.first;
readController.setShowChat(true);
readController.setChatType(1);
// readController.titleInput.text = args.toString();
}); });
// 监听百科回调 // 监听百科回调
controller.addJavaScriptHandler(handlerName: 'baikeCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'baikeCallBack', callback: (args){
context.pushNamed(Routes.baiKe,queryParameters: {'keyword':args}); context.pushNamed(Routes.baiKe,queryParameters: {'keyword':args.first});
}); });
// 监听讨论回调 // 监听讨论回调
controller.addJavaScriptHandler(handlerName: 'discussCallBack', callback: (args){ controller.addJavaScriptHandler(handlerName: 'discussCallBack', callback: (args){
readController.setShowChat(true); readController.setShowChat(true);
readController.setChatType(0); readController.setChatType(0);
readController.titleInput.text = args.toString(); readController.titleInput.text = args.first.toString();
}); });
}, },
......
...@@ -18,6 +18,7 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> { ...@@ -18,6 +18,7 @@ class _ReadInputDiscussState extends State<ReadInputDiscuss> {
color: Colors.white, color: Colors.white,
margin: EdgeInsets.symmetric(horizontal: 15.w), margin: EdgeInsets.symmetric(horizontal: 15.w),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Container(
margin: EdgeInsets.symmetric(vertical: 10.w), margin: EdgeInsets.symmetric(vertical: 10.w),
......
...@@ -63,6 +63,9 @@ class _ReadNotePageState extends State<ReadNotePage> { ...@@ -63,6 +63,9 @@ class _ReadNotePageState extends State<ReadNotePage> {
), ),
BuildBook(bookDetailModel: widget.bookDetailModel,), BuildBook(bookDetailModel: widget.bookDetailModel,),
Expanded( Expanded(
child: MediaQuery.removePadding(
context: context,
removeTop: true,
child: ListView.builder( child: ListView.builder(
itemBuilder: (BuildContext context,int index){ itemBuilder: (BuildContext context,int index){
NoteModel model = controller.notes[index]; NoteModel model = controller.notes[index];
...@@ -82,6 +85,7 @@ class _ReadNotePageState extends State<ReadNotePage> { ...@@ -82,6 +85,7 @@ class _ReadNotePageState extends State<ReadNotePage> {
itemCount: controller.notes.length, itemCount: controller.notes.length,
), ),
), ),
),
], ],
), ),
); );
......
...@@ -62,7 +62,7 @@ class BuildNote extends StatelessWidget { ...@@ -62,7 +62,7 @@ class BuildNote extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(model.noteContent?.text?.content??'',style: TextStyle( Text(model.noteContent?.text?.privacyStatus == 0?'审核中': model.noteContent?.text?.content??'',style: TextStyle(
fontSize: 14.w, fontSize: 14.w,
height: 1.5, height: 1.5,
// color: Colors.red, // color: Colors.red,
...@@ -105,7 +105,32 @@ class BuildNote extends StatelessWidget { ...@@ -105,7 +105,32 @@ class BuildNote extends StatelessWidget {
childAspectRatio: 1 childAspectRatio: 1
), ),
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return CustomImage.network(url: model.noteContent?.image?[index].content??'',fit: BoxFit.cover,); MediaModel? mediaModel = model.noteContent?.image?[index];
return Stack(
children: [
Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: CustomImage.network(url: mediaModel?.content??'',fit: BoxFit.cover,)
),
Visibility(
visible: mediaModel?.privacyStatus == 0?true:false,
child: Positioned(
left: 0,
right:0,
top:0,
bottom: 0,
child: Container(
alignment: Alignment.center,
color: Colours.c9,
child: Text('审核中',style: TextStyle(fontSize: 14.w,height: 1.5,color: Colours.c3),),
)
),
),
],
);
}, },
itemCount: model.noteContent?.image?.length, itemCount: model.noteContent?.image?.length,
); );
......
...@@ -3,8 +3,9 @@ part of user_order_awaiting; ...@@ -3,8 +3,9 @@ part of user_order_awaiting;
/// 等待付款订单 /// 等待付款订单
class UserOrderAwaitingController extends GetxController { class UserOrderAwaitingController extends GetxController {
final String orderNum; final String orderNum;
final BuildContext context;
UserOrderAwaitingController(this.orderNum); // 订单编号 UserOrderAwaitingController(this.orderNum,this.context); // 订单编号
late OrderInfoModel model; late OrderInfoModel model;
// 应付款、订单编号等 // 应付款、订单编号等
...@@ -57,14 +58,6 @@ class UserOrderAwaitingController extends GetxController { ...@@ -57,14 +58,6 @@ class UserOrderAwaitingController extends GetxController {
} }
Future<void> payOrder() async { Future<void> payOrder() async {
if (model.payType == 3){
final result = await MineAPI.coinPay(ordersNum: orderNum);
if (result){
Toast.show('订单支付完成');
getOrderInfo();
}
}
else{
payOrderModel = await MineAPI.getPayInfo(ordersNum: orderNum); payOrderModel = await MineAPI.getPayInfo(ordersNum: orderNum);
// 支付宝 // 支付宝
if (model.payType == 2){ if (model.payType == 2){
...@@ -86,7 +79,16 @@ class UserOrderAwaitingController extends GetxController { ...@@ -86,7 +79,16 @@ class UserOrderAwaitingController extends GetxController {
requestWechat(); requestWechat();
} }
} }
} // if (model.payType == 3){
// final result = await MineAPI.coinPay(ordersNum: orderNum);
// if (result){
// Toast.show('订单支付完成');
// getOrderInfo();
// }
// }
// else{
//
// }
} }
// 支付宝支付 // 支付宝支付
...@@ -128,7 +130,7 @@ class UserOrderAwaitingController extends GetxController { ...@@ -128,7 +130,7 @@ class UserOrderAwaitingController extends GetxController {
final result = await ShopAPI.orderStatus(orderNumber: payOrderModel.ordersnum??'',receipt: ''); final result = await ShopAPI.orderStatus(orderNumber: payOrderModel.ordersnum??'',receipt: '');
if (result.paySuccess == 1){ if (result.paySuccess == 1){
Toast.show('订单支付完成'); Toast.show('订单支付完成');
getOrderInfo(); context.pop();
} }
} }
......
...@@ -13,7 +13,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> { ...@@ -13,7 +13,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
@override @override
void initState() { void initState() {
myController = Get.put(UserOrderAwaitingController(widget.orderNum)); myController = Get.put(UserOrderAwaitingController(widget.orderNum,context));
super.initState(); super.initState();
} }
...@@ -34,7 +34,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> { ...@@ -34,7 +34,7 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
return false; return false;
}, },
child: GetBuilder<UserOrderAwaitingController>( child: GetBuilder<UserOrderAwaitingController>(
init: UserOrderAwaitingController(widget.orderNum), init: UserOrderAwaitingController(widget.orderNum,context),
builder: (controller) => Scaffold( builder: (controller) => Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(
title: const Text('等待付款'), title: const Text('等待付款'),
...@@ -166,7 +166,11 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> { ...@@ -166,7 +166,11 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
SizedBox( SizedBox(
height: 39.w, height: 39.w,
), ),
Container( GestureDetector(
onTap: (){
controller.payOrder();
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 15.w), margin: EdgeInsets.symmetric(horizontal: 15.w),
height: 40.w, height: 40.w,
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -175,18 +179,14 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> { ...@@ -175,18 +179,14 @@ class _UserOrderAwaitingState extends State<UserOrderAwaitingPage> {
border: border:
Border.all(color: Colours.cC31F4C, width: 0.5.w)), Border.all(color: Colours.cC31F4C, width: 0.5.w)),
child: Center( child: Center(
child: GestureDetector(
onTap: () {
// print("保存昵称");
// context.pushNamed(Routes.orderEvaluate);
},
child: Text( child: Text(
'立即支付 ¥${controller.model.finalTotalPrice}', '立即支付 ¥${controller.model.finalTotalPrice}',
style: TextStyle( style: TextStyle(
fontWeight: Fonts.medium, fontWeight: Fonts.medium,
fontSize: 14.w, fontSize: 14.w,
color: Colours.cFF), color: Colours.cFF),
)), ),
),
), ),
), ),
SizedBox( SizedBox(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论