Commit 8818fab1398baef61699735a6c5580e10f5d5ef9

Authored by wdn127929
1 parent 04ee3843

更换微信

@@ -2567,97 +2567,97 @@ class InvicationPageState extends State<InvicationPage> @@ -2567,97 +2567,97 @@ class InvicationPageState extends State<InvicationPage>
2567 ) 2567 )
2568 ], 2568 ],
2569 )), 2569 )),
2570 - InkWell(  
2571 - onTap: () {  
2572 - FocusScope.of(context)  
2573 - .requestFocus(FocusNode()); //隐藏键盘  
2574 -  
2575 - //跳转到新页面  
2576 -  
2577 - NavigatorUtil.goInvicationAdditionPage(context);  
2578 -  
2579 - },  
2580 - child: Container(  
2581 - margin: EdgeInsets.only(  
2582 - // top: ScreenUtil().setWidth(40),  
2583 - bottom: ScreenUtil().setWidth(40)),  
2584 - height: ScreenUtil().setWidth(68),  
2585 - padding: EdgeInsets.symmetric(  
2586 - horizontal: ScreenUtil().setWidth(16)),  
2587 - decoration: BoxDecoration(  
2588 - borderRadius: BorderRadius.circular(  
2589 - ScreenUtil().setWidth(12)),  
2590 - // color: Colors.red,  
2591 - border: Border.all(  
2592 - width: ScreenUtil().setWidth(2),  
2593 - color: MyColours.color_DBDBDB)),  
2594 - child: Row(  
2595 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
2596 - crossAxisAlignment: CrossAxisAlignment.center,  
2597 - children: [  
2598 - Text(  
2599 - '自定义图文:',  
2600 - style: TextStyle(  
2601 - fontSize: ScreenUtil().setSp(28),  
2602 - color: MyColours.color_515151),  
2603 - ),  
2604 -  
2605 - Expanded(  
2606 - child: Text(  
2607 - '点击设置本单追加的自定义图文',  
2608 - textAlign: TextAlign.right,  
2609 - style: TextStyle(  
2610 - fontSize: ScreenUtil().setSp(28),  
2611 - color: MyColours.color_999999),  
2612 - ),  
2613 - ),  
2614 -  
2615 - // InkWell(  
2616 - // onTap: () {  
2617 - // FocusScope.of(context)  
2618 - // .requestFocus(FocusNode()); //隐藏键盘  
2619 - // // 存储  
2620 -  
2621 - // DialogUtil.openDishTypeSelectModalBottomSheet(  
2622 - // context,  
2623 - // detailModel.reserveTypes,  
2624 - // reserveType, rCallback: (value) async {  
2625 - // if (value != null) {  
2626 - // reserveType = value;  
2627 - // setState(() {});  
2628 - // bool sucess = await detailModel  
2629 - // .upReserveInfo(context, widget.rid,  
2630 - // reserveType: reserveType,  
2631 - // needToast: false);  
2632 - // if (sucess) {  
2633 - // EventBus()  
2634 - // .emit("refresh_tablemanager"); //刷新桌位  
2635 - // bus.emit("refresh_book_list"); //刷新已预订列表  
2636 - // bus.emit("refresh_detail");  
2637 - // // await _getReserveDetail(  
2638 - // // showCicle: false);  
2639 - // }  
2640 - // }  
2641 - // });  
2642 - // },  
2643 - // child: Row(children: [  
2644 - // Text(  
2645 - // reserveType,  
2646 - // style: TextStyle(  
2647 - // color: reserveType == '请选择'  
2648 - // ? MyColours.color_999999  
2649 - // : MyColours.color_515151,  
2650 - // fontSize: ScreenUtil().setSp(28),  
2651 - // ),  
2652 - // ),  
2653 - // HEmptyView(4),  
2654 - // Image.asset(Utils.getImgPath('quan_down_f'),  
2655 - // width: ScreenUtil().setWidth(28),  
2656 - // height: ScreenUtil().setWidth(28)),  
2657 - // ]),  
2658 - // )  
2659 - ],  
2660 - ))), 2570 + // InkWell(
  2571 + // onTap: () {
  2572 + // FocusScope.of(context)
  2573 + // .requestFocus(FocusNode()); //隐藏键盘
  2574 +
  2575 + // //跳转到新页面
  2576 +
  2577 + // NavigatorUtil.goInvicationAdditionPage(context);
  2578 +
  2579 + // },
  2580 + // child: Container(
  2581 + // margin: EdgeInsets.only(
  2582 + // // top: ScreenUtil().setWidth(40),
  2583 + // bottom: ScreenUtil().setWidth(40)),
  2584 + // height: ScreenUtil().setWidth(68),
  2585 + // padding: EdgeInsets.symmetric(
  2586 + // horizontal: ScreenUtil().setWidth(16)),
  2587 + // decoration: BoxDecoration(
  2588 + // borderRadius: BorderRadius.circular(
  2589 + // ScreenUtil().setWidth(12)),
  2590 + // // color: Colors.red,
  2591 + // border: Border.all(
  2592 + // width: ScreenUtil().setWidth(2),
  2593 + // color: MyColours.color_DBDBDB)),
  2594 + // child: Row(
  2595 + // mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2596 + // crossAxisAlignment: CrossAxisAlignment.center,
  2597 + // children: [
  2598 + // Text(
  2599 + // '自定义图文:',
  2600 + // style: TextStyle(
  2601 + // fontSize: ScreenUtil().setSp(28),
  2602 + // color: MyColours.color_515151),
  2603 + // ),
  2604 +
  2605 + // Expanded(
  2606 + // child: Text(
  2607 + // '点击设置本单追加的自定义图文',
  2608 + // textAlign: TextAlign.right,
  2609 + // style: TextStyle(
  2610 + // fontSize: ScreenUtil().setSp(28),
  2611 + // color: MyColours.color_999999),
  2612 + // ),
  2613 + // ),
  2614 +
  2615 + // // InkWell(
  2616 + // // onTap: () {
  2617 + // // FocusScope.of(context)
  2618 + // // .requestFocus(FocusNode()); //隐藏键盘
  2619 + // // // 存储
  2620 +
  2621 + // // DialogUtil.openDishTypeSelectModalBottomSheet(
  2622 + // // context,
  2623 + // // detailModel.reserveTypes,
  2624 + // // reserveType, rCallback: (value) async {
  2625 + // // if (value != null) {
  2626 + // // reserveType = value;
  2627 + // // setState(() {});
  2628 + // // bool sucess = await detailModel
  2629 + // // .upReserveInfo(context, widget.rid,
  2630 + // // reserveType: reserveType,
  2631 + // // needToast: false);
  2632 + // // if (sucess) {
  2633 + // // EventBus()
  2634 + // // .emit("refresh_tablemanager"); //刷新桌位
  2635 + // // bus.emit("refresh_book_list"); //刷新已预订列表
  2636 + // // bus.emit("refresh_detail");
  2637 + // // // await _getReserveDetail(
  2638 + // // // showCicle: false);
  2639 + // // }
  2640 + // // }
  2641 + // // });
  2642 + // // },
  2643 + // // child: Row(children: [
  2644 + // // Text(
  2645 + // // reserveType,
  2646 + // // style: TextStyle(
  2647 + // // color: reserveType == '请选择'
  2648 + // // ? MyColours.color_999999
  2649 + // // : MyColours.color_515151,
  2650 + // // fontSize: ScreenUtil().setSp(28),
  2651 + // // ),
  2652 + // // ),
  2653 + // // HEmptyView(4),
  2654 + // // Image.asset(Utils.getImgPath('quan_down_f'),
  2655 + // // width: ScreenUtil().setWidth(28),
  2656 + // // height: ScreenUtil().setWidth(28)),
  2657 + // // ]),
  2658 + // // )
  2659 + // ],
  2660 + // ))),
2661 //输入框 2661 //输入框
2662 Container( 2662 Container(
2663 width: double.infinity, 2663 width: double.infinity,
@@ -171,6 +171,8 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -171,6 +171,8 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
171 if (data.openid == null || data.openid == 'null') { 171 if (data.openid == null || data.openid == 'null') {
172 // _getStoreBaseinfo(); 172 // _getStoreBaseinfo();
173 _getWechatQrcode(); 173 _getWechatQrcode();
  174 + }else{
  175 +_getReplaceWechatQrcode();
174 } 176 }
175 uid = data.id; 177 uid = data.id;
176 isStoreWine = data.isStoreWine ?? '0'; 178 isStoreWine = data.isStoreWine ?? '0';
@@ -282,6 +284,44 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -282,6 +284,44 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
282 // }); 284 // });
283 // return list; 285 // return list;
284 // } 286 // }
  287 + ///获取二维码
  288 + _getReplaceWechatQrcode({bool need = false}) async {
  289 + if (timer != null && timer.isActive) {
  290 + timer.cancel();
  291 + }
  292 +
  293 + String sid = Provider.of<UserModel>(context, listen: false).user.sellerid;
  294 + // String id = Provider.of<UserModel>(context, listen: false).user.openid;
  295 + // https: //xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode/sellerid/商家ID/uid/当前账号ID
  296 + // https://xt.colorcun.com/WechatApi/WechatApi/CreateReplaceUserOpenid?sellerid=26&uid=21635
  297 + Response response = await DioUtil.getInstance().getDio().get(
  298 + "https://xt.colorcun.com/WechatApi/WechatApi/CreateReplaceUserOpenid?sellerid=$sid&uid=${data.id}");
  299 + // Response response = await DioUtil.getInstance().getDio().get(
  300 + // "https://xt.colorcun.com/WechatApi/WechatApi/CreateDcSubQrcode?sellerid=$sid&uid=$uid");
  301 + // Response response = await DioUtil.getInstance().getDio().get(
  302 + // "https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx85aa3cdd0f791e65&secret=90ba794b30d2fe388309149174874603&code=$code&grant_type=authorization_code");
  303 + LogUtil.v("access_token:${response.toString()}");
  304 + Map<String, dynamic> responseData = json.decode(response.toString());
  305 + print(responseData);
  306 + timer = Timer.periodic(Duration(seconds: 60), (_) {
  307 + _getReplaceWechatQrcode();
  308 + });
  309 + dcAdduserCode = responseData["data"];
  310 + if (need) {
  311 + if (dcAdduserCode == null || dcAdduserCode == '') {
  312 + Utils.showToast('二维码获取失败');
  313 + } else {
  314 + DialogUtil.openAlertDialogImage(
  315 + context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
  316 + }
  317 + }
  318 +
  319 + print(dcAdduserCode);
  320 + // if (responseData["data"] != null) {
  321 + // // Utils.showToast(responseData["errmsg"] ?? "登录失败,请稍后重试");
  322 + // // Loading.hideLoading(context);
  323 + // } else {}
  324 + }
285 325
286 ///获取二维码 326 ///获取二维码
287 _getWechatQrcode({bool need = false}) async { 327 _getWechatQrcode({bool need = false}) async {
@@ -476,46 +516,46 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -476,46 +516,46 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
476 ), 516 ),
477 VEmptyView(114), 517 VEmptyView(114),
478 518
479 - if (data?.openid == null || data?.openid == 'null')  
480 - RoundButton(  
481 - text: '绑定微信',  
482 - gradientStart: wechatColor,  
483 - gradientEnd: wechatColor,  
484 - borderColor: wechatColor,  
485 - width: ScreenUtil().setWidth(80 * 2),  
486 - height: ScreenUtil().setWidth(30 * 2),  
487 - fontSize: 32,  
488 - isBold: true,  
489 - textColor: MyColours.color_ffffff,  
490 - radius: ScreenUtil().setWidth(12),  
491 - onPressed: () {  
492 - if (dcAdduserCode != '' && dcAdduserCode != null) {  
493 - DialogUtil.openAlertDialogImage(  
494 - context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);  
495 - } else {  
496 - _getWechatQrcode(need: true);  
497 - }  
498 - }),  
499 - // : RoundButton(  
500 - // text: '更换微信',  
501 - // gradientStart: wechatColor,  
502 - // gradientEnd: wechatColor,  
503 - // borderColor: wechatColor,  
504 - // width: ScreenUtil().setWidth(80 * 2),  
505 - // height: ScreenUtil().setWidth(30 * 2),  
506 - // fontSize: 32,  
507 - // isBold: true,  
508 - // textColor: MyColours.color_ffffff,  
509 - // radius: ScreenUtil().setWidth(12),  
510 - // onPressed: () {  
511 - // if (dcAdduserCode != '' && dcAdduserCode != null) {  
512 - // DialogUtil.openAlertDialogImage(  
513 - // context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);  
514 - // } else {  
515 - // _getWechatQrcode(need: true);  
516 - // }  
517 - // }),  
518 - if (data?.openid == null || data?.openid == 'null') 519 + (data?.openid == null || data?.openid == 'null')
  520 + ? RoundButton(
  521 + text: '绑定微信',
  522 + gradientStart: wechatColor,
  523 + gradientEnd: wechatColor,
  524 + borderColor: wechatColor,
  525 + width: ScreenUtil().setWidth(80 * 2),
  526 + height: ScreenUtil().setWidth(30 * 2),
  527 + fontSize: 32,
  528 + isBold: true,
  529 + textColor: MyColours.color_ffffff,
  530 + radius: ScreenUtil().setWidth(12),
  531 + onPressed: () {
  532 + if (dcAdduserCode != '' && dcAdduserCode != null) {
  533 + DialogUtil.openAlertDialogImage(
  534 + context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
  535 + } else {
  536 + _getWechatQrcode(need: true);
  537 + }
  538 + })
  539 + : RoundButton(
  540 + text: '更换微信',
  541 + gradientStart: wechatColor,
  542 + gradientEnd: wechatColor,
  543 + borderColor: wechatColor,
  544 + width: ScreenUtil().setWidth(80 * 2),
  545 + height: ScreenUtil().setWidth(30 * 2),
  546 + fontSize: 32,
  547 + isBold: true,
  548 + textColor: MyColours.color_ffffff,
  549 + radius: ScreenUtil().setWidth(12),
  550 + onPressed: () {
  551 + if (dcAdduserCode != '' && dcAdduserCode != null) {
  552 + DialogUtil.openAlertDialogImage(
  553 + context, '请员工使用微信扫一扫添加店员', dcAdduserCode, 660);
  554 + } else {
  555 + _getReplaceWechatQrcode(need: true);
  556 + }
  557 + }),
  558 + // if (data?.openid == null || data?.openid == 'null')
519 VEmptyView(48), 559 VEmptyView(48),
520 InkWell( 560 InkWell(
521 onTap: () { 561 onTap: () {