Commit a912a25eaebf7175e9580d2cc2b8c15f8180fc20

Authored by wdn127929
1 parent 0c64b88a

微信支付:监听取消&&微信未安装提示安装微信

... ... @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 50;
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
... ... @@ -659,7 +659,7 @@
CURRENT_PROJECT_VERSION = 490;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_MODE = release;
FLUTTER_BUILD_MODE = debug;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
... ...
... ... @@ -216,7 +216,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
GestureDetector(
onTap: () async {
Navigator.of(context).pop();
Map temp = await NavigatorUtil.goSelectTablePage(
Map temp = await NavigatorUtil.goSelectTableFPage(
context,
widget.rid,
int.parse(detailEntity.ddate) * 1000,
... ... @@ -424,257 +424,251 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
);
} else {
return DefaultTextStyle(
style: TextStyle(decoration: TextDecoration.none),
child: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
Expanded(
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(43)),
child: Column(
children: <Widget>[
RowMultiText(
"用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
children: <Widget>[
Column(
children: <Widget>[
RowMultiText("用餐时间",
detailEntity.ddateHm),
Offstage(
offstage:
detailEntity.type == "0"
? false
: true,
child: RowMultiText("用餐人数",
detailEntity.pnum),
)
],
),
Image.asset(
detailEntity.statuImgAssets,
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(30),
)
],
),
RowMultiText(
"包间需求",
(detailEntity.demands.length
.toString() +
"个") ??
""),
Align(
alignment: Alignment.centerRight,
child: Offstage(
offstage:
detailEntity.demands.length >
0
? false
: true,
child: Container(
height:
ScreenUtil().setHeight(210),
child: ListView.builder(
itemBuilder:
(BuildContext contxt,
int index) {
return NeedItem(detailEntity
.demands[index]);
},
itemCount: detailEntity
.demands.length,
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
),
),
)),
RowMultiText(
"客户姓名", detailEntity.rnameStr),
RowMultiText("客户电话", formatPhone),
RowMultiText(
"备注信息", detailEntity.cusdem ?? ""),
MyDivider(double.infinity,
ScreenUtil().setHeight(1)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
alignment: Alignment.center,
child: Stack(
alignment: Alignment.center,
style: TextStyle(decoration: TextDecoration.none),
child: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
Expanded(
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(43)),
child: Column(
children: <Widget>[
RowMultiText(
"用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
children: <Widget>[
Column(
children: <Widget>[
Positioned(
left: 0,
child: Text(
"客户经理",
style: TextStyle(
color: MyColours
.color_828282,
fontSize: ScreenUtil()
.setSp(30)),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list = [];
for (Manager manager
in managers) {
list.add(
manager.roleUserName);
}
DialogUtil
.showSelectCusmanDialog(
context, list,
(value) {
if (value != null) {
setState(() {
cusmanText = managers[
value.first]
.userName;
});
_setCurrManager();
}
}).then((value) {});
},
child: Text(
cusmanText,
style: TextStyle(
color: MyColours
.color_353535,
fontSize: ScreenUtil()
.setSp(30),
decoration: TextDecoration
.underline,
),
),
),
RowMultiText(
"用餐时间", detailEntity.ddateHm),
Offstage(
offstage:
detailEntity.type == "0"
? false
: true,
child: RowMultiText(
"用餐人数", detailEntity.pnum),
)
],
),
),
],
)),
),
),
Offstage(
offstage: detailEntity.status != "0",
child: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setHeight(30),
bottom: ScreenUtil().setHeight(30)),
child: Column(
children: <Widget>[
CommonButton(
content: "安排包间",
width: 669,
height: 84,
fontSize: 34,
onPress: () async {
Map map = await NavigatorUtil
.goSelectTablePage(
context,
widget.rid,
int.parse(detailEntity.ddate) *
1000,
detailEntity.ddate_solt);
if (map != null && map['tid'] != null) {
setReserveStatus("5",
tid: map['tid']);
}
},
),
VEmptyView(20),
Container(
width: ScreenUtil().setWidth(669),
height: ScreenUtil().setWidth(84),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
Image.asset(
detailEntity.statuImgAssets,
width: ScreenUtil().setWidth(100),
height: ScreenUtil().setWidth(30),
)
],
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: GestureDetector(
child: Center(
RowMultiText(
"包间需求",
(detailEntity.demands.length
.toString() +
"个") ??
""),
Align(
alignment: Alignment.centerRight,
child: Offstage(
offstage:
detailEntity.demands.length > 0
? false
: true,
child: Container(
height:
ScreenUtil().setHeight(210),
child: ListView.builder(
itemBuilder:
(BuildContext contxt,
int index) {
return NeedItem(detailEntity
.demands[index]);
},
itemCount:
detailEntity.demands.length,
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
),
),
)),
RowMultiText(
"客户姓名", detailEntity.rnameStr),
RowMultiText("客户电话", formatPhone),
RowMultiText(
"备注信息", detailEntity.cusdem ?? ""),
MyDivider(double.infinity,
ScreenUtil().setHeight(1)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
alignment: Alignment.center,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: Text(
"拒绝订单",
"客户经理",
style: TextStyle(
color:
MyColours.color_199095,
MyColours.color_828282,
fontSize:
ScreenUtil().setSp(34)),
ScreenUtil().setSp(30)),
),
),
onTap: () {
_showRefuseDialog2();
},
)),
Offstage(
offstage: !isCallTel,
child: SizedBox(
width: ScreenUtil().setWidth(335),
height: ScreenUtil().setWidth(84),
child: Row(
children: [
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setHeight(52),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list = [];
for (Manager manager
in managers) {
list.add(
manager.roleUserName);
}
DialogUtil
.showSelectCusmanDialog(
context, list,
(value) {
if (value != null) {
setState(() {
cusmanText = managers[
value.first]
.userName;
});
_setCurrManager();
}
}).then((value) {});
},
child: Text(
cusmanText,
style: TextStyle(
color:
MyColours.color_199095,
MyColours.color_353535,
fontSize:
ScreenUtil().setSp(30),
decoration: TextDecoration
.underline,
),
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"联系顾客",
style: TextStyle(
color: MyColours
.color_199095,
fontSize:
ScreenUtil()
.setSp(34)),
),
),
onTap: () {
if (detailEntity.phone !=
null &&
detailEntity.phone
.isNotEmpty) {
Utils.goPhone(
detailEntity.phone);
} else {
Utils.showToast(
"没有客户电话!");
}
},
)),
],
),
),
),
)
],
)
],
),
),
)
],
),
],
)),
),
),
Offstage(
offstage: detailEntity.status != "0",
child: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setHeight(30),
bottom: ScreenUtil().setHeight(30)),
child: Column(
children: <Widget>[
CommonButton(
content: "安排包间",
width: 669,
height: 84,
fontSize: 34,
onPress: () async {
Map map =
await NavigatorUtil.goSelectTableFPage(
context,
widget.rid,
int.parse(detailEntity.ddate) *
1000,
detailEntity.ddate_solt);
if (map != null && map['tid'] != null) {
setReserveStatus("5", tid: map['tid']);
}
},
),
VEmptyView(20),
Container(
width: ScreenUtil().setWidth(669),
height: ScreenUtil().setWidth(84),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"拒绝订单",
style: TextStyle(
color: MyColours.color_199095,
fontSize:
ScreenUtil().setSp(34)),
),
),
onTap: () {
_showRefuseDialog2();
},
)),
Offstage(
offstage: !isCallTel,
child: SizedBox(
width: ScreenUtil().setWidth(335),
height: ScreenUtil().setWidth(84),
child: Row(
children: [
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setHeight(52),
color: MyColours.color_199095,
),
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"联系顾客",
style: TextStyle(
color: MyColours
.color_199095,
fontSize: ScreenUtil()
.setSp(34)),
),
),
onTap: () {
if (detailEntity.phone !=
null &&
detailEntity
.phone.isNotEmpty) {
Utils.goPhone(
detailEntity.phone);
} else {
Utils.showToast(
"没有客户电话!");
}
},
)),
],
),
),
)
],
),
)
],
),
)
],
)))
;
),
)
],
)));
}
}),
onWillPop: () async {
... ...
... ... @@ -114,7 +114,7 @@ class _SmsManagerPageState extends State<SmsManagerPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
child: Text(
widget.infoData.lastNum,
style: TextStyle(
... ... @@ -123,7 +123,7 @@ class _SmsManagerPageState extends State<SmsManagerPage> {
fontSize: ScreenUtil().setSp(36)),
)),
Container(
height: ScreenUtil().setWidth(30),
// height: ScreenUtil().setWidth(40),
child: Text(
' 条',
style: TextStyle(
... ...
... ... @@ -62,8 +62,10 @@ class _SmsRechargeItemPageState extends State<SmsRechargeItemPage> {
: MyColours.color_333333)),
],
),
Container(
width: ScreenUtil().setWidth(150),
Expanded(
child: Container(
// width: ScreenUtil().setWidth(150),
alignment: Alignment.centerRight,
margin: EdgeInsets.only(top: ScreenUtil().setWidth(30)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
... ... @@ -89,7 +91,7 @@ class _SmsRechargeItemPageState extends State<SmsRechargeItemPage> {
: MyColours.color_999999)),
],
),
),
)),
],
)),
widget.meals.discount == '0'
... ...
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:fluwx/fluwx.dart';
import 'package:one_key/models/sms_info.dart';
import 'package:one_key/pages/my/sms_recharge_item_page.dart';
import 'package:one_key/provider/sms_recharge_provider.dart';
... ... @@ -29,10 +31,14 @@ class _SmsRechargePageState extends State<SmsRechargePage> {
ScrollController controller = ScrollController();
Meals mealsSelected;
SmsRechargeModel rechargeModel;
StreamSubscription _wxPay;
@override
void initState() {
super.initState();
fluwx.weChatResponseEventHandler.listen((res) {
_wxPay = fluwx.weChatResponseEventHandler.listen((res) {
_wxPay?.cancel();
if (res is fluwx.WeChatPaymentResponse) {
print("pay :${res.isSuccessful}");
if (res.errCode == 0) {
... ... @@ -49,6 +55,15 @@ class _SmsRechargePageState extends State<SmsRechargePage> {
});
}
void wxSubscriptionClose() => _wxPay?.cancel();
@override
void dispose() {
super.dispose();
wxSubscriptionClose();
}
@override
Widget build(BuildContext context) {
rechargeModel = Provider.of<SmsRechargeModel>(context, listen: true);
... ... @@ -153,6 +168,12 @@ class _SmsRechargePageState extends State<SmsRechargePage> {
height: ScreenUtil().setWidth(70),
textColor: MyColours.color_F0F0F0,
onPressed: () async {
//是否安装微信
bool isInstalled = await fluwx.isWeChatInstalled;
if (!isInstalled) {
Utils.showToast("请先安装微信");
return;
}
if (mealsSelected == null) {
Utils.showToast('请选择您要购买的短信套餐');
return;
... ... @@ -199,7 +220,7 @@ class _SmsRechargePageState extends State<SmsRechargePage> {
print('nonceStr${rechargeModel.sunModel.nonceStr}');
print('timeStamp${rechargeModel.sunModel.timeStamp}');
print('sign${sign}');
//掉起微信支付
fluwx
.payWithWeChat(
... ...