Commit 8818fab1398baef61699735a6c5580e10f5d5ef9

Authored by wdn127929
1 parent 04ee3843

更换微信

... ... @@ -2567,97 +2567,97 @@ class InvicationPageState extends State<InvicationPage>
)
],
)),
InkWell(
onTap: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
//跳转到新页面
NavigatorUtil.goInvicationAdditionPage(context);
},
child: Container(
margin: EdgeInsets.only(
// top: ScreenUtil().setWidth(40),
bottom: ScreenUtil().setWidth(40)),
height: ScreenUtil().setWidth(68),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(16)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(12)),
// color: Colors.red,
border: Border.all(
width: ScreenUtil().setWidth(2),
color: MyColours.color_DBDBDB)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'自定义图文:',
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
),
Expanded(
child: Text(
'点击设置本单追加的自定义图文',
textAlign: TextAlign.right,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_999999),
),
),
// InkWell(
// onTap: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //隐藏键盘
// // 存储
// DialogUtil.openDishTypeSelectModalBottomSheet(
// context,
// detailModel.reserveTypes,
// reserveType, rCallback: (value) async {
// if (value != null) {
// reserveType = value;
// setState(() {});
// bool sucess = await detailModel
// .upReserveInfo(context, widget.rid,
// reserveType: reserveType,
// needToast: false);
// if (sucess) {
// EventBus()
// .emit("refresh_tablemanager"); //刷新桌位
// bus.emit("refresh_book_list"); //刷新已预订列表
// bus.emit("refresh_detail");
// // await _getReserveDetail(
// // showCicle: false);
// }
// }
// });
// },
// child: Row(children: [
// Text(
// reserveType,
// style: TextStyle(
// color: reserveType == '请选择'
// ? MyColours.color_999999
// : MyColours.color_515151,
// fontSize: ScreenUtil().setSp(28),
// ),
// ),
// HEmptyView(4),
// Image.asset(Utils.getImgPath('quan_down_f'),
// width: ScreenUtil().setWidth(28),
// height: ScreenUtil().setWidth(28)),
// ]),
// )
],
))),
// InkWell(
// onTap: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //隐藏键盘
// //跳转到新页面
// NavigatorUtil.goInvicationAdditionPage(context);
// },
// child: Container(
// margin: EdgeInsets.only(
// // top: ScreenUtil().setWidth(40),
// bottom: ScreenUtil().setWidth(40)),
// height: ScreenUtil().setWidth(68),
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(16)),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(12)),
// // color: Colors.red,
// border: Border.all(
// width: ScreenUtil().setWidth(2),
// color: MyColours.color_DBDBDB)),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// '自定义图文:',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(28),
// color: MyColours.color_515151),
// ),
// Expanded(
// child: Text(
// '点击设置本单追加的自定义图文',
// textAlign: TextAlign.right,
// style: TextStyle(
// fontSize: ScreenUtil().setSp(28),
// color: MyColours.color_999999),
// ),
// ),
// // InkWell(
// // onTap: () {
// // FocusScope.of(context)
// // .requestFocus(FocusNode()); //隐藏键盘
// // // 存储
// // DialogUtil.openDishTypeSelectModalBottomSheet(
// // context,
// // detailModel.reserveTypes,
// // reserveType, rCallback: (value) async {
// // if (value != null) {
// // reserveType = value;
// // setState(() {});
// // bool sucess = await detailModel
// // .upReserveInfo(context, widget.rid,
// // reserveType: reserveType,
// // needToast: false);
// // if (sucess) {
// // EventBus()
// // .emit("refresh_tablemanager"); //刷新桌位
// // bus.emit("refresh_book_list"); //刷新已预订列表
// // bus.emit("refresh_detail");
// // // await _getReserveDetail(
// // // showCicle: false);
// // }
// // }
// // });
// // },
// // child: Row(children: [
// // Text(
// // reserveType,
// // style: TextStyle(
// // color: reserveType == '请选择'
// // ? MyColours.color_999999
// // : MyColours.color_515151,
// // fontSize: ScreenUtil().setSp(28),
// // ),
// // ),
// // HEmptyView(4),
// // Image.asset(Utils.getImgPath('quan_down_f'),
// // width: ScreenUtil().setWidth(28),
// // height: ScreenUtil().setWidth(28)),
// // ]),
// // )
// ],
// ))),
//输入框
Container(
width: double.infinity,
... ...
... ... @@ -171,6 +171,8 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
if (data.openid == null || data.openid == 'null') {
// _getStoreBaseinfo();
_getWechatQrcode();
}else{
_getReplaceWechatQrcode();
}
uid = data.id;
isStoreWine = data.isStoreWine ?? '0';
... ... @@ -282,6 +284,44 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
// });
// return list;
// }
///获取二维码
_getReplaceWechatQrcode({bool need = false}) async {
if (timer != null && timer.isActive) {
timer.cancel();
}
String sid = Provider.of<UserModel>(context, listen: false).user.sellerid;
// String id = Provider.of<UserModel>(context, listen: false).user.openid;
// https: //xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode/sellerid/商家ID/uid/当前账号ID
// https://xt.colorcun.com/WechatApi/WechatApi/CreateReplaceUserOpenid?sellerid=26&uid=21635
Response response = await DioUtil.getInstance().getDio().get(
"https://xt.colorcun.com/WechatApi/WechatApi/CreateReplaceUserOpenid?sellerid=$sid&uid=${data.id}");
// Response response = await DioUtil.getInstance().getDio().get(
// "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=$uid");
// Response response = await DioUtil.getInstance().getDio().get(
// "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx85aa3cdd0f791e65&secret=90ba794b30d2fe388309149174874603&code=$code&grant_type=authorization_code");
LogUtil.v("access_token:${response.toString()}");
Map<String, dynamic> responseData = json.decode(response.toString());
print(responseData);
timer = Timer.periodic(Duration(seconds: 60), (_) {
_getReplaceWechatQrcode();
});
dcAdduserCode = responseData["data"];
if (need) {
if (dcAdduserCode == null || dcAdduserCode == '') {
Utils.showToast('二维码获取失败');
} else {
DialogUtil.openAlertDialogImage(
context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
}
}
print(dcAdduserCode);
// if (responseData["data"] != null) {
// // Utils.showToast(responseData["errmsg"] ?? "登录失败,请稍后重试");
// // Loading.hideLoading(context);
// } else {}
}
///获取二维码
_getWechatQrcode({bool need = false}) async {
... ... @@ -476,46 +516,46 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
),
VEmptyView(114),
if (data?.openid == null || data?.openid == 'null')
RoundButton(
text: '绑定微信',
gradientStart: wechatColor,
gradientEnd: wechatColor,
borderColor: wechatColor,
width: ScreenUtil().setWidth(80 * 2),
height: ScreenUtil().setWidth(30 * 2),
fontSize: 32,
isBold: true,
textColor: MyColours.color_ffffff,
radius: ScreenUtil().setWidth(12),
onPressed: () {
if (dcAdduserCode != '' && dcAdduserCode != null) {
DialogUtil.openAlertDialogImage(
context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
} else {
_getWechatQrcode(need: true);
}
}),
// : RoundButton(
// text: '更换微信',
// gradientStart: wechatColor,
// gradientEnd: wechatColor,
// borderColor: wechatColor,
// width: ScreenUtil().setWidth(80 * 2),
// height: ScreenUtil().setWidth(30 * 2),
// fontSize: 32,
// isBold: true,
// textColor: MyColours.color_ffffff,
// radius: ScreenUtil().setWidth(12),
// onPressed: () {
// if (dcAdduserCode != '' && dcAdduserCode != null) {
// DialogUtil.openAlertDialogImage(
// context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
// } else {
// _getWechatQrcode(need: true);
// }
// }),
if (data?.openid == null || data?.openid == 'null')
(data?.openid == null || data?.openid == 'null')
? RoundButton(
text: '绑定微信',
gradientStart: wechatColor,
gradientEnd: wechatColor,
borderColor: wechatColor,
width: ScreenUtil().setWidth(80 * 2),
height: ScreenUtil().setWidth(30 * 2),
fontSize: 32,
isBold: true,
textColor: MyColours.color_ffffff,
radius: ScreenUtil().setWidth(12),
onPressed: () {
if (dcAdduserCode != '' && dcAdduserCode != null) {
DialogUtil.openAlertDialogImage(
context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
} else {
_getWechatQrcode(need: true);
}
})
: RoundButton(
text: '更换微信',
gradientStart: wechatColor,
gradientEnd: wechatColor,
borderColor: wechatColor,
width: ScreenUtil().setWidth(80 * 2),
height: ScreenUtil().setWidth(30 * 2),
fontSize: 32,
isBold: true,
textColor: MyColours.color_ffffff,
radius: ScreenUtil().setWidth(12),
onPressed: () {
if (dcAdduserCode != '' && dcAdduserCode != null) {
DialogUtil.openAlertDialogImage(
context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
} else {
_getReplaceWechatQrcode(need: true);
}
}),
// if (data?.openid == null || data?.openid == 'null')
VEmptyView(48),
InkWell(
onTap: () {
... ...