Commit 896d3592ea7fb4ecb4ba61f4808c4667cf7d1e98

Authored by wdn127929
1 parent d0615a49

桌位选择,上锁

@@ -78,25 +78,25 @@ class NotebookDetail { @@ -78,25 +78,25 @@ class NotebookDetail {
78 String id; 78 String id;
79 String uid; 79 String uid;
80 String abolition; 80 String abolition;
81 - String tableinfo; 81 + // String tableinfo;
82 String pnum; 82 String pnum;
83 String actual_pum; 83 String actual_pum;
84 String rname; 84 String rname;
85 String sex; 85 String sex;
86 String phone; 86 String phone;
87 String cusdem; 87 String cusdem;
88 - String cusman; //客户经理 88 + // String cusman; //客户经理
89 String ddate; 89 String ddate;
90 String is_set_ddate; 90 String is_set_ddate;
91 String ddate_solt; 91 String ddate_solt;
92 String status = "0"; //订单状态 0:待确认,1:已订座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单 92 String status = "0"; //订单状态 0:待确认,1:已订座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
93 - String action; 93 + // String action;
94 String type; //0 内部订单 1 在线预订 94 String type; //0 内部订单 1 在线预订
95 - String note_name; 95 + // String note_name;
96 String nick_name; 96 String nick_name;
97 String role_name; 97 String role_name;
98 String seller_user_phone; 98 String seller_user_phone;
99 - String channel; 99 + // String channel;
100 String cdate; 100 String cdate;
101 List<t.Table> demands; //需求桌位 101 List<t.Table> demands; //需求桌位
102 List<t.Table> tables; //预订桌位 102 List<t.Table> tables; //预订桌位
@@ -111,7 +111,7 @@ class NotebookDetail { @@ -111,7 +111,7 @@ class NotebookDetail {
111 111
112 dynamic is_user_comments; //是否评价过 112 dynamic is_user_comments; //是否评价过
113 113
114 - String up_date; //订单修改时间 114 + // String up_date; //订单修改时间
115 String deposit_cancel; //订金走向 115 String deposit_cancel; //订金走向
116 116
117 String log_photo; //下单照片 117 String log_photo; //下单照片
@@ -315,7 +315,7 @@ class NotebookDetail { @@ -315,7 +315,7 @@ class NotebookDetail {
315 315
316 @override 316 @override
317 String toString() { 317 String toString() {
318 - return 'NotebookDetail{id: $id, uid: $uid ,con_amount:$con_amount,abolition: $abolition, tableinfo: $tableinfo,actual_pum:$actual_pum, pnum: $pnum, rname: $rname, sex: $sex, phone: $phone, cusdem: $cusdem, cusman: $cusman, ddate: $ddate, is_set_ddate: $is_set_ddate, ddate_solt: $ddate_solt, status: $status, action: $action, type: $type, note_name: $note_name, seller_user_phone:$seller_user_phone, nick_name: $nick_name,channel: $channel, cdate: $cdate, demands: $demands, tables: $tables, cancel: $cancel, gid: $gid,guest_uid:$guest_uid,reserve_type:$reserve_type,place_order_name:$place_order_name,is_user_comments:$is_user_comments,deposit_cancel:$deposit_cancel,up_date:$up_date,log_photo:$log_photo,photo_note:$photo_note,serve_name:$serve_name,serve_uid:$serve_uid}'; 318 + return 'NotebookDetail{id: $id, uid: $uid ,con_amount:$con_amount,abolition: $abolition,actual_pum:$actual_pum, pnum: $pnum, rname: $rname, sex: $sex, phone: $phone, cusdem: $cusdem, ddate: $ddate, is_set_ddate: $is_set_ddate, ddate_solt: $ddate_solt, status: $status, type: $type, seller_user_phone:$seller_user_phone, nick_name: $nick_name, cdate: $cdate, demands: $demands, tables: $tables, cancel: $cancel, gid: $gid,guest_uid:$guest_uid,reserve_type:$reserve_type,place_order_name:$place_order_name,is_user_comments:$is_user_comments,deposit_cancel:$deposit_cancel,log_photo:$log_photo,photo_note:$photo_note,serve_name:$serve_name,serve_uid:$serve_uid}';
319 } 319 }
320 } 320 }
321 321
@@ -44,7 +44,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) { @@ -44,7 +44,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) {
44 return NotebookDetail() 44 return NotebookDetail()
45 ..id = json['id'] as String 45 ..id = json['id'] as String
46 ..uid = json['uid'] as String 46 ..uid = json['uid'] as String
47 - ..tableinfo = json['tableinfo'] as String 47 + // ..tableinfo = json['tableinfo'] as String
48 ..abolition = json['abolition'] as String 48 ..abolition = json['abolition'] as String
49 ..pnum = json['pnum'] as String 49 ..pnum = json['pnum'] as String
50 ..actual_pum = json['actual_pum'] as String 50 ..actual_pum = json['actual_pum'] as String
@@ -53,18 +53,18 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) { @@ -53,18 +53,18 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) {
53 ..sex = json['sex'] as String 53 ..sex = json['sex'] as String
54 ..phone = json['phone'] as String 54 ..phone = json['phone'] as String
55 ..cusdem = json['cusdem'] as String 55 ..cusdem = json['cusdem'] as String
56 - ..cusman = json['cusman'] as String 56 + // ..cusman = json['cusman'] as String
57 ..ddate = json['ddate'] as String 57 ..ddate = json['ddate'] as String
58 ..is_set_ddate = json['is_set_ddate'] as String 58 ..is_set_ddate = json['is_set_ddate'] as String
59 ..ddate_solt = json['ddate_solt'] as String 59 ..ddate_solt = json['ddate_solt'] as String
60 ..status = json['status'] as String 60 ..status = json['status'] as String
61 - ..action = json['action'] as String 61 + // ..action = json['action'] as String
62 ..type = json['type'] as String 62 ..type = json['type'] as String
63 - ..note_name = json['note_name'] as String 63 + // ..note_name = json['note_name'] as String
64 ..nick_name = json['nick_name'] as String 64 ..nick_name = json['nick_name'] as String
65 ..role_name = json['role_name'] as String 65 ..role_name = json['role_name'] as String
66 ..seller_user_phone = json['seller_user_phone'] as String 66 ..seller_user_phone = json['seller_user_phone'] as String
67 - ..channel = json['channel'] as String 67 + // ..channel = json['channel'] as String
68 ..cdate = json['cdate'] as String 68 ..cdate = json['cdate'] as String
69 ..demands = (json['demands'] as List) 69 ..demands = (json['demands'] as List)
70 ?.map((e) => 70 ?.map((e) =>
@@ -88,7 +88,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) { @@ -88,7 +88,7 @@ NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) {
88 ..reserve_type = json['reserve_type'] as String 88 ..reserve_type = json['reserve_type'] as String
89 ..place_order_name = json['place_order_name'] as String 89 ..place_order_name = json['place_order_name'] as String
90 ..is_user_comments = json['is_user_comments'] as dynamic 90 ..is_user_comments = json['is_user_comments'] as dynamic
91 - ..up_date = json['up_date'] as String 91 + // ..up_date = json['up_date'] as String
92 ..deposit_cancel = json['deposit_cancel'] as String 92 ..deposit_cancel = json['deposit_cancel'] as String
93 ..log_photo = json['log_photo'] as String 93 ..log_photo = json['log_photo'] as String
94 ..photo_note = images 94 ..photo_note = images
@@ -100,7 +100,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => @@ -100,7 +100,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) =>
100 <String, dynamic>{ 100 <String, dynamic>{
101 'uid': instance.uid, 101 'uid': instance.uid,
102 'id': instance.id, 102 'id': instance.id,
103 - 'tableinfo': instance.tableinfo, 103 + // 'tableinfo': instance.tableinfo,
104 'abolition': instance.abolition, 104 'abolition': instance.abolition,
105 'pnum': instance.pnum, 105 'pnum': instance.pnum,
106 'con_amount': instance.con_amount, 106 'con_amount': instance.con_amount,
@@ -109,18 +109,18 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => @@ -109,18 +109,18 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) =>
109 'sex': instance.sex, 109 'sex': instance.sex,
110 'phone': instance.phone, 110 'phone': instance.phone,
111 'cusdem': instance.cusdem, 111 'cusdem': instance.cusdem,
112 - 'cusman': instance.cusman, 112 + // 'cusman': instance.cusman,
113 'ddate': instance.ddate, 113 'ddate': instance.ddate,
114 'is_set_ddate': instance.is_set_ddate, 114 'is_set_ddate': instance.is_set_ddate,
115 'ddate_solt': instance.ddate_solt, 115 'ddate_solt': instance.ddate_solt,
116 'status': instance.status, 116 'status': instance.status,
117 - 'action': instance.action, 117 + // 'action': instance.action,
118 'type': instance.type, 118 'type': instance.type,
119 - 'note_name': instance.note_name, 119 + // 'note_name': instance.note_name,
120 'nick_name': instance.nick_name, 120 'nick_name': instance.nick_name,
121 'role_name': instance.role_name, 121 'role_name': instance.role_name,
122 'seller_user_phone': instance.seller_user_phone, 122 'seller_user_phone': instance.seller_user_phone,
123 - 'channel': instance.channel, 123 + // 'channel': instance.channel,
124 'cdate': instance.cdate, 124 'cdate': instance.cdate,
125 'demands': instance.demands, 125 'demands': instance.demands,
126 'tables': instance.tables, 126 'tables': instance.tables,
@@ -132,7 +132,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) => @@ -132,7 +132,7 @@ Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) =>
132 'reserve_type': instance.reserve_type, 132 'reserve_type': instance.reserve_type,
133 'place_order_name': instance.place_order_name, 133 'place_order_name': instance.place_order_name,
134 'is_user_comments': instance.is_user_comments, 134 'is_user_comments': instance.is_user_comments,
135 - 'up_date': instance.up_date, 135 + // 'up_date': instance.up_date,
136 'deposit_cancel': instance.deposit_cancel, 136 'deposit_cancel': instance.deposit_cancel,
137 'log_photo': instance.log_photo, 137 'log_photo': instance.log_photo,
138 'photo_note': instance.photo_note, 138 'photo_note': instance.photo_note,
@@ -48,7 +48,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -48,7 +48,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
48 48
49 NotebookDetail detailEntity; 49 NotebookDetail detailEntity;
50 50
51 - String cusmanText = ""; 51 + // String cusmanText = "";
52 52
53 List<Manager> managers = []; //客户经理 53 List<Manager> managers = []; //客户经理
54 54
@@ -79,7 +79,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -79,7 +79,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
79 }); 79 });
80 setState(() { 80 setState(() {
81 //未处理 81 //未处理
82 - cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; 82 + // cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
83 formatPhone = detailEntity.phone; 83 formatPhone = detailEntity.phone;
84 if (App.sp.getString("is_call_tel") != null && 84 if (App.sp.getString("is_call_tel") != null &&
85 App.sp.getString("is_call_tel") == "1") { 85 App.sp.getString("is_call_tel") == "1") {
@@ -116,17 +116,17 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { @@ -116,17 +116,17 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
116 } 116 }
117 117
118 //设置当前客户经理 118 //设置当前客户经理
119 - _setCurrManager() {  
120 - manager = managers.firstWhere((manager) => manager.userName == cusmanText,  
121 - orElse: () => Manager());  
122 - if (manager.id == null || manager.id.toString().isEmpty) return;  
123 - Map<String, String> params = {  
124 - "rid": detailEntity.id,  
125 - "cusman_id": manager.id.toString(),  
126 - "cusman": manager.userName  
127 - };  
128 - detailModel.setReserveCusmnan(context, params);  
129 - } 119 + // _setCurrManager() {
  120 + // manager = managers.firstWhere((manager) => manager.userName == cusmanText,
  121 + // orElse: () => Manager());
  122 + // if (manager.id == null || manager.id.toString().isEmpty) return;
  123 + // Map<String, String> params = {
  124 + // "rid": detailEntity.id,
  125 + // "cusman_id": manager.id.toString(),
  126 + // "cusman": manager.userName
  127 + // };
  128 + // detailModel.setReserveCusmnan(context, params);
  129 + // }
130 130
131 _goReserve() async { 131 _goReserve() async {
132 Navigator.of(context).pop(); 132 Navigator.of(context).pop();
@@ -88,7 +88,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -88,7 +88,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
88 88
89 NotebookDetail detailEntity; 89 NotebookDetail detailEntity;
90 90
91 - String cusmanText = ""; 91 + // String cusmanText = "";
92 92
93 // List<Manager> managers = []; //客户经理 93 // List<Manager> managers = []; //客户经理
94 94
@@ -563,7 +563,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { @@ -563,7 +563,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
563 detailModel.numController.text = detailEntity.con_amount; 563 detailModel.numController.text = detailEntity.con_amount;
564 } 564 }
565 565
566 - cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; 566 + // cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
567 formatPhone = detailEntity.phone; 567 formatPhone = detailEntity.phone;
568 if (App.sp.getString("is_call_tel") != null && 568 if (App.sp.getString("is_call_tel") != null &&
569 App.sp.getString("is_call_tel") == "1") { 569 App.sp.getString("is_call_tel") == "1") {
@@ -147,7 +147,14 @@ class TableItemOrReserveState extends State<TableItemOrReserve> { @@ -147,7 +147,14 @@ class TableItemOrReserveState extends State<TableItemOrReserve> {
147 // selectTids, 147 // selectTids,
148 // table.tids.split( 148 // table.tids.split(
149 // ','))); //真正上锁*******被合并桌子上锁:合并的桌子被预订&&islock == '1' || 合并桌子上锁:被合并的桌子被预订&&ismerge == '1' 149 // ','))); //真正上锁*******被合并桌子上锁:合并的桌子被预订&&islock == '1' || 合并桌子上锁:被合并的桌子被预订&&ismerge == '1'
150 - bool islock = table.reserveLock == '1'; 150 + // bool islock = table.reserveLock == '1';
  151 + bool islock = table.reserveLock == '1' ||
  152 + (table.isLock == '1' && selectTids.contains(table.lockTid)) ||
  153 + (table.isMerge == '1' &&
  154 + haveSame(
  155 + selectTids,
  156 + table.tids.split(
  157 + ','))); //真正上锁*******被合并桌子上锁:合并的桌子被预订&&islock == '1' || 合并桌子上锁:被合并的桌子被预订&&ismerge == '1'
151 return GestureDetector( 158 return GestureDetector(
152 onTap: () { 159 onTap: () {
153 if (widget.canSelected && widget.fromPage == 'change') { 160 if (widget.canSelected && widget.fromPage == 'change') {
@@ -79,7 +79,7 @@ class HandleOnlinePageSimState extends State<HandleOnlinePageSim> { @@ -79,7 +79,7 @@ class HandleOnlinePageSimState extends State<HandleOnlinePageSim> {
79 }); 79 });
80 setState(() { 80 setState(() {
81 //未处理 81 //未处理
82 - cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; 82 + // cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
83 formatPhone = detailEntity.phone; 83 formatPhone = detailEntity.phone;
84 if (App.sp.getString("is_call_tel") != null && 84 if (App.sp.getString("is_call_tel") != null &&
85 App.sp.getString("is_call_tel") == "1") { 85 App.sp.getString("is_call_tel") == "1") {
@@ -540,7 +540,7 @@ class NotebookDetailPageSimState extends State<NotebookDetailPageSim> { @@ -540,7 +540,7 @@ class NotebookDetailPageSimState extends State<NotebookDetailPageSim> {
540 detailModel.numController.text = detailEntity.con_amount; 540 detailModel.numController.text = detailEntity.con_amount;
541 } 541 }
542 542
543 - cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman; 543 + // cusmanText = detailEntity.cusman.isEmpty ? "请选择" : detailEntity.cusman;
544 formatPhone = detailEntity.phone; 544 formatPhone = detailEntity.phone;
545 if (App.sp.getString("is_call_tel") != null && 545 if (App.sp.getString("is_call_tel") != null &&
546 App.sp.getString("is_call_tel") == "1") { 546 App.sp.getString("is_call_tel") == "1") {
1 -import 'dart:convert'; 1 +import 'dart:async';
  2 +import 'dart:convert' as Convert;
2 import 'dart:io'; 3 import 'dart:io';
3 import 'dart:math'; 4 import 'dart:math';
4 import 'dart:typed_data'; 5 import 'dart:typed_data';
  6 +import 'dart:ui';
5 7
6 import 'package:call_log/call_log.dart'; 8 import 'package:call_log/call_log.dart';
7 import 'package:common_utils/common_utils.dart'; 9 import 'package:common_utils/common_utils.dart';
@@ -197,9 +199,9 @@ class Utils { @@ -197,9 +199,9 @@ class Utils {
197 String stringSignTemp = 199 String stringSignTemp =
198 str + "&key=3F59D13EB7681868B96A50902296BCE6"; //注:key为商户平台设置的密钥key 200 str + "&key=3F59D13EB7681868B96A50902296BCE6"; //注:key为商户平台设置的密钥key
199 201
200 - var key = utf8.encode('3F59D13EB7681868B96A50902296BCE6'); 202 + var key = Convert.utf8.encode('3F59D13EB7681868B96A50902296BCE6');
201 var hmacSha256 = Hmac(sha256, key); // HMAC-SHA256 203 var hmacSha256 = Hmac(sha256, key); // HMAC-SHA256
202 - var bytes = utf8.encode(stringSignTemp); 204 + var bytes = Convert.utf8.encode(stringSignTemp);
203 var digest = hmacSha256.convert(bytes); 205 var digest = hmacSha256.convert(bytes);
204 206
205 print("HMAC digest as bytes: ${digest.bytes}"); 207 print("HMAC digest as bytes: ${digest.bytes}");
@@ -1066,7 +1068,7 @@ class Utils { @@ -1066,7 +1068,7 @@ class Utils {
1066 // for (var value in JsonDecoder().convert(str)) { 1068 // for (var value in JsonDecoder().convert(str)) {
1067 // list.add(value); 1069 // list.add(value);
1068 // } 1070 // }
1069 - list = jsonDecode(str); 1071 + list = Convert.jsonDecode(str);
1070 return list; 1072 return list;
1071 } 1073 }
1072 1074
@@ -1394,7 +1396,7 @@ class Utils { @@ -1394,7 +1396,7 @@ class Utils {
1394 // "pack-cookbook/pages/success?rid=$rid&identity=2&hasOnlyShow=1"; 1396 // "pack-cookbook/pages/success?rid=$rid&identity=2&hasOnlyShow=1";
1395 print(data); 1397 print(data);
1396 String _path = 1398 String _path =
1397 - "pack-cookbook/pages/success_new?cookbooklist=${json.encode(data)}&hasSuccess=1&oid=$oid&rid=$rid&identity=1&hasOnlyShow=1&sellerName=${Provider.of<UserModel>(context, listen: false).user.sellername}&sid=${Provider.of<UserModel>(context, listen: false).user.sellerid}&type=2&priceSum=${priceSum}&memberPriceSum=${memberPriceSum}&planPriceSum=${planPriceSum}&remark=${remark}&name=${name}&address=${address}&service=${service}"; 1399 + "pack-cookbook/pages/success_new?cookbooklist=${Convert.json.encode(data)}&hasSuccess=1&oid=$oid&rid=$rid&identity=1&hasOnlyShow=1&sellerName=${Provider.of<UserModel>(context, listen: false).user.sellername}&sid=${Provider.of<UserModel>(context, listen: false).user.sellerid}&type=2&priceSum=${priceSum}&memberPriceSum=${memberPriceSum}&planPriceSum=${planPriceSum}&remark=${remark}&name=${name}&address=${address}&service=${service}";
1398 String _description = "OneKey"; 1400 String _description = "OneKey";
1399 // Uint8List source = await testComporessList(context, _thumbnail); 1401 // Uint8List source = await testComporessList(context, _thumbnail);
1400 print(_path); 1402 print(_path);
@@ -2078,6 +2080,85 @@ class Utils { @@ -2078,6 +2080,85 @@ class Utils {
2078 bool isSuccess = await shareToWeChat(model); 2080 bool isSuccess = await shareToWeChat(model);
2079 return isSuccess; 2081 return isSuccess;
2080 } 2082 }
  2083 + static Future<ui.Image> loadImage(var path, bool isUrl) async {
  2084 + ImageStream stream;
  2085 + if (isUrl) {
  2086 + stream = NetworkImage(path).resolve(ImageConfiguration.empty);
  2087 + } else {
  2088 + stream = AssetImage(path, bundle: rootBundle)
  2089 + .resolve(ImageConfiguration.empty);
  2090 + }
  2091 + Completer<ui.Image> completer = Completer<ui.Image>();
  2092 + void listener(ImageInfo frame, bool synchronousCall) {
  2093 + final ui.Image image = frame.image;
  2094 + completer.complete(image);
  2095 + stream.removeListener(ImageStreamListener(listener));
  2096 + }
  2097 +
  2098 + stream.addListener(ImageStreamListener(listener));
  2099 + return completer.future;
  2100 + }
  2101 +// static Future<ui.Image> getImage(String asset) async {
  2102 +// ByteData data = await rootBundle.load(asset);
  2103 +// Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List());
  2104 +// FrameInfo fi = await codec.getNextFrame();
  2105 +// return fi.image;
  2106 +// }
  2107 +
  2108 +
  2109 + static Future< Uint8List> canvas(_thumbnail)async{
  2110 + var pictureRecorder = new ui.PictureRecorder(); // 图片记录仪
  2111 + var canvas = new Canvas(pictureRecorder); //canvas接受一个图片记录仪
  2112 + var images = await loadImage(_thumbnail,true); // 使用方法获取Unit8List格式的图片
  2113 + print(images);
  2114 + Paint _linePaint = new Paint()
  2115 + ..color = Colors.blue
  2116 + ..style = PaintingStyle.fill
  2117 + ..isAntiAlias = true
  2118 + ..strokeCap = StrokeCap.round
  2119 + ..strokeWidth = 500;
  2120 +
  2121 + // 绘制图片
  2122 + canvas.drawImage(images, Offset(0, 0), _linePaint); // 直接画图
  2123 +
  2124 + // 绘制圆圈
  2125 + // canvas.drawCircle(
  2126 + // new Offset(
  2127 + // 60,
  2128 + // images.height.toDouble() + 60,
  2129 + // ),
  2130 + // 40.0,
  2131 + // _linePaint);
  2132 +
  2133 + // 绘制文字
  2134 + ui.ParagraphBuilder pb = ui.ParagraphBuilder(ui.ParagraphStyle(
  2135 + textAlign: TextAlign.left,
  2136 + fontWeight: FontWeight.w400,
  2137 + fontStyle: FontStyle.normal,
  2138 +
  2139 + // :MyColours.color_000000,
  2140 + fontSize: 25.0));
  2141 + pb.pushStyle(ui.TextStyle(color: Colors.black));
  2142 + pb.addText('有一种感动就做只有你懂');
  2143 + pb.addText('一个可以钻钱的app');
  2144 + // 设置文本的宽度约束
  2145 + ParagraphConstraints pc = ui.ParagraphConstraints(width: 500);
  2146 + ui.Paragraph paragraph = pb.build()..layout(pc);
  2147 + canvas.drawParagraph(
  2148 + paragraph, Offset(0, images.height.toDouble() + 20));
  2149 +
  2150 +
  2151 + //下面的代码是生成图片的关键代码,以上绘制文字和圆圈的代码可以忽略不计
  2152 + var picture = await pictureRecorder.endRecording().toImage(500, 400);//设置生成图片的宽和高
  2153 + var pngImageBytes = await picture.toByteData(format: ui.ImageByteFormat.png);
  2154 + // var imgBytes = Uint8List.view(pngImageBytes.buffer); //这一行和下面这一行都是生成Uint8List格式的图片(原理还不知道)
  2155 + Uint8List pngBytes = pngImageBytes.buffer.asUint8List();
  2156 + print(pngBytes);//pngBytes可以放在Image.memory()中预览
  2157 + // setState(() {
  2158 + // imageMemory = pngBytes;
  2159 + // });
  2160 + return pngBytes;
  2161 + }
2081 2162
2082 //分享邀请函 2163 //分享邀请函
2083 static goShareInvicationToWeChat(BuildContext context, String rid, String uid, 2164 static goShareInvicationToWeChat(BuildContext context, String rid, String uid,
@@ -2089,9 +2170,12 @@ class Utils { @@ -2089,9 +2170,12 @@ class Utils {
2089 // "https://qn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148572.jpg"; 2170 // "https://qn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148572.jpg";
2090 String sellerImage = 2171 String sellerImage =
2091 Provider.of<UserModel>(context, listen: false).user.sellerimage; 2172 Provider.of<UserModel>(context, listen: false).user.sellerimage;
2092 - String _thumbnail = sellerImage == null || sellerImage == '' 2173 + // String _thumbnail = sellerImage == null || sellerImage == ''
  2174 + // ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
  2175 + // : sellerImage;
  2176 + Uint8List _thumbnail =await canvas(sellerImage == null || sellerImage == ''
2093 ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png' 2177 ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
2094 - : sellerImage; 2178 + : sellerImage);
2095 String _title = 2179 String _title =
2096 "您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情"; 2180 "您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情";
2097 2181
@@ -2125,46 +2209,46 @@ class Utils { @@ -2125,46 +2209,46 @@ class Utils {
2125 // miniProgramType: WXMiniProgramType.RELEASE, //正式版 2209 // miniProgramType: WXMiniProgramType.RELEASE, //正式版
2126 // miniProgramType: //开发版 2210 // miniProgramType: //开发版
2127 // thumbnail: WeChatImage.binary(source) 2211 // thumbnail: WeChatImage.binary(source)
2128 - thumbnail: WeChatImage.network(_thumbnail)  
2129 - // thumbnail: WeChatImage.binary(image) 2212 + // thumbnail: WeChatImage.network(_thumbnail)
  2213 + thumbnail: WeChatImage.binary(_thumbnail)
2130 ); 2214 );
2131 2215
2132 isSuccess = await shareToWeChat(model); 2216 isSuccess = await shareToWeChat(model);
2133 } else { 2217 } else {
2134 - Loading.showLoading(context); 2218 + // Loading.showLoading(context);
2135 2219
  2220 + // // String _path =
  2221 + // // "pages/customer/index.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
2136 // String _path = 2222 // String _path =
2137 - // "pages/customer/index.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";  
2138 - String _path =  
2139 - "pages/customer/detail_owner_invitation_new.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";  
2140 - if(depositId != null){  
2141 - _path =  
2142 - "pages/customer/detail_owner_invitation_new.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId";  
2143 - }  
2144 - FlutterWxwork flutterWxwork = FlutterWxwork();  
2145 - bool isAppInstalled = await flutterWxwork.isAppInstalled();  
2146 - print(isAppInstalled);  
2147 - if (isAppInstalled) {  
2148 - bool registerResult = await flutterWxwork.registerApp(  
2149 - 'wwauthbdca186ec4257973000003', 'wwbdca186ec4257973', '1000003');  
2150 - print(registerResult);  
2151 -  
2152 - // isSuccess = await flutterWxwork.shareText(text: "dddddddd");  
2153 - dynamic isSuccess = await flutterWxwork.shareMiniProgram(  
2154 - userName: 'gh_487873d353b3@app',  
2155 - path: _path,  
2156 - hdImageData: _thumbnail,  
2157 - title: _title,  
2158 - description: _description,  
2159 - );  
2160 - Loading.hideLoading(context);  
2161 -  
2162 - // var isSuccess = await flutterWxwork.shareImage();  
2163 - print(isSuccess);  
2164 - } else {  
2165 - Loading.hideLoading(context);  
2166 - Utils.showToast('未安装企业微信');  
2167 - } 2223 + // "pages/customer/detail_owner_invitation_new.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
  2224 + // if(depositId != null){
  2225 + // _path =
  2226 + // "pages/customer/detail_owner_invitation_new.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId";
  2227 + // }
  2228 + // FlutterWxwork flutterWxwork = FlutterWxwork();
  2229 + // bool isAppInstalled = await flutterWxwork.isAppInstalled();
  2230 + // print(isAppInstalled);
  2231 + // if (isAppInstalled) {
  2232 + // bool registerResult = await flutterWxwork.registerApp(
  2233 + // 'wwauthbdca186ec4257973000003', 'wwbdca186ec4257973', '1000003');
  2234 + // print(registerResult);
  2235 +
  2236 + // // isSuccess = await flutterWxwork.shareText(text: "dddddddd");
  2237 + // dynamic isSuccess = await flutterWxwork.shareMiniProgram(
  2238 + // userName: 'gh_487873d353b3@app',
  2239 + // path: _path,
  2240 + // hdImageData: _thumbnail,
  2241 + // title: _title,
  2242 + // description: _description,
  2243 + // );
  2244 + // Loading.hideLoading(context);
  2245 +
  2246 + // // var isSuccess = await flutterWxwork.shareImage();
  2247 + // print(isSuccess);
  2248 + // } else {
  2249 + // Loading.hideLoading(context);
  2250 + // Utils.showToast('未安装企业微信');
  2251 + // }
2168 } 2252 }
2169 2253
2170 return isSuccess; 2254 return isSuccess;