Showing
16 changed files
with
2769 additions
and
338 deletions
lib/models/mark_data_model.dart
0 → 100644
| 1 | +import 'package:flutter/material.dart'; | ||
| 2 | +import 'dart:convert' as convert; | ||
| 3 | + | ||
| 4 | +import 'package:one_key/models/set_xuan_tai_model.dart'; | ||
| 5 | + | ||
| 6 | +class MarkDataModel extends Object { | ||
| 7 | + String id; | ||
| 8 | + | ||
| 9 | + String sid; | ||
| 10 | + | ||
| 11 | + MarkHomeModel home; | ||
| 12 | + | ||
| 13 | + MarkReserveModel reserve; | ||
| 14 | + | ||
| 15 | + MarkStoreModel store; | ||
| 16 | + | ||
| 17 | + MarkChefModel chef; | ||
| 18 | + | ||
| 19 | + MarkSignboardModel signboard; | ||
| 20 | + | ||
| 21 | + MarkMarketingModel marketing; | ||
| 22 | + | ||
| 23 | + MarkDataModel( | ||
| 24 | + this.id, | ||
| 25 | + this.sid, | ||
| 26 | + this.home, | ||
| 27 | + this.reserve, | ||
| 28 | + this.store, | ||
| 29 | + this.chef, | ||
| 30 | + this.signboard, | ||
| 31 | + this.marketing, | ||
| 32 | + ); | ||
| 33 | + | ||
| 34 | + MarkDataModel.fromJson(Map<String, dynamic> json) { | ||
| 35 | + id = json['id']; | ||
| 36 | + sid = json['sid']; | ||
| 37 | + | ||
| 38 | + home = json['home'] != null | ||
| 39 | + ? new MarkHomeModel.fromJson(convert.jsonDecode(json['home'])) | ||
| 40 | + : null; //首图形象 | ||
| 41 | + reserve = json['reserve'] != null | ||
| 42 | + ? new MarkReserveModel.fromJson(convert.jsonDecode(json['reserve'])) | ||
| 43 | + : null; // | ||
| 44 | + | ||
| 45 | + store = json['store'] != null | ||
| 46 | + ? new MarkStoreModel.fromJson(convert.jsonDecode(json['store'])) | ||
| 47 | + : null; // | ||
| 48 | + | ||
| 49 | + chef = json['chef'] != null | ||
| 50 | + ? new MarkChefModel.fromJson(convert.jsonDecode(json['chef'])) | ||
| 51 | + : null; // | ||
| 52 | + | ||
| 53 | + signboard = json['signboard'] != null | ||
| 54 | + ? new MarkSignboardModel.fromJson(convert.jsonDecode(json['signboard'])) | ||
| 55 | + : null; // | ||
| 56 | + | ||
| 57 | + marketing = json['marketing'] != null | ||
| 58 | + ? new MarkMarketingModel.fromJson(convert.jsonDecode(json['marketing'])) | ||
| 59 | + : null; // | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + Map<String, dynamic> toJson() { | ||
| 63 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 64 | + data['id'] = this.id; | ||
| 65 | + data['sid'] = this.sid; | ||
| 66 | + | ||
| 67 | + data['home'] = this.home; | ||
| 68 | + data['reserve'] = this.reserve; | ||
| 69 | + data['store'] = this.store; | ||
| 70 | + data['chef'] = this.chef; | ||
| 71 | + data['signboard'] = this.signboard; | ||
| 72 | + data['marketing'] = this.marketing; | ||
| 73 | + return data; | ||
| 74 | + } | ||
| 75 | +} | ||
| 76 | + | ||
| 77 | +class MarkHomeModel { | ||
| 78 | + String themeColor; // | ||
| 79 | + String title; // | ||
| 80 | + String slogan; // | ||
| 81 | + String image; // | ||
| 82 | + | ||
| 83 | + MarkHomeModel({ | ||
| 84 | + this.themeColor, | ||
| 85 | + this.title, | ||
| 86 | + this.slogan, | ||
| 87 | + this.image, | ||
| 88 | + }); | ||
| 89 | + | ||
| 90 | + MarkHomeModel.fromJson(Map<String, dynamic> json) { | ||
| 91 | + themeColor = json['theme_color']; | ||
| 92 | + title = json['title']; | ||
| 93 | + slogan = json['slogan']; | ||
| 94 | + image = json['image']; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + Map<String, dynamic> toJson() { | ||
| 98 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 99 | + data['theme_color'] = this.themeColor; | ||
| 100 | + data['title'] = this.title; | ||
| 101 | + data['slogan'] = this.slogan; | ||
| 102 | + data['image'] = this.image; | ||
| 103 | + return data; | ||
| 104 | + } | ||
| 105 | +} | ||
| 106 | + | ||
| 107 | +class MarkReserveModel { | ||
| 108 | + String swichManager; // | ||
| 109 | + String swichPark; // | ||
| 110 | + String parkInfo; // | ||
| 111 | + String sellerName; // | ||
| 112 | + | ||
| 113 | + String date; // | ||
| 114 | + String dsolt; // | ||
| 115 | + String room; // | ||
| 116 | + String pnum; // | ||
| 117 | + | ||
| 118 | + String address; // | ||
| 119 | + String sellerPhone; // | ||
| 120 | + String managerImage; // | ||
| 121 | + String managerName; // | ||
| 122 | + | ||
| 123 | + String managerPhone; // | ||
| 124 | + String managerWechat; // | ||
| 125 | + String long; // | ||
| 126 | + String lat; // | ||
| 127 | + | ||
| 128 | + MarkReserveModel( | ||
| 129 | + {this.swichManager, | ||
| 130 | + this.swichPark, | ||
| 131 | + this.parkInfo, | ||
| 132 | + this.sellerName, | ||
| 133 | + this.date, | ||
| 134 | + this.dsolt, | ||
| 135 | + this.room, | ||
| 136 | + this.pnum, | ||
| 137 | + this.address, | ||
| 138 | + this.lat, | ||
| 139 | + this.long, | ||
| 140 | + this.managerImage, | ||
| 141 | + this.managerName, | ||
| 142 | + this.managerPhone, | ||
| 143 | + this.managerWechat, | ||
| 144 | + this.sellerPhone}); | ||
| 145 | + | ||
| 146 | + MarkReserveModel.fromJson(Map<String, dynamic> json) { | ||
| 147 | + swichManager = json['swich_manager']; | ||
| 148 | + swichPark = json['swich_park']; | ||
| 149 | + | ||
| 150 | + parkInfo = json['park_info']; | ||
| 151 | + sellerName = json['seller_name']; | ||
| 152 | + | ||
| 153 | + date = json['date']; | ||
| 154 | + dsolt = json['dsolt']; | ||
| 155 | + | ||
| 156 | + room = json['room']; | ||
| 157 | + pnum = json['pnum']; | ||
| 158 | + | ||
| 159 | + address = json['address']; | ||
| 160 | + sellerPhone = json['seller_phone']; | ||
| 161 | + | ||
| 162 | + managerImage = json['manager_image']; | ||
| 163 | + managerName = json['manager_name']; | ||
| 164 | + | ||
| 165 | + managerPhone = json['manager_phone']; | ||
| 166 | + managerWechat = json['manager_wechat']; | ||
| 167 | + | ||
| 168 | + long = json['long']; | ||
| 169 | + lat = json['lat']; | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + Map<String, dynamic> toJson() { | ||
| 173 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 174 | + data['swich_manager'] = this.swichManager; | ||
| 175 | + data['swich_park'] = this.swichPark; | ||
| 176 | + data['park_info'] = this.parkInfo; | ||
| 177 | + data['seller_name'] = this.sellerName; | ||
| 178 | + data['date'] = this.date; | ||
| 179 | + data['dsolt'] = this.dsolt; | ||
| 180 | + data['room'] = this.room; | ||
| 181 | + data['pnum'] = this.pnum; | ||
| 182 | + data['address'] = this.address; | ||
| 183 | + data['seller_phone'] = this.sellerPhone; | ||
| 184 | + data['manager_image'] = this.managerImage; | ||
| 185 | + data['manager_name'] = this.managerName; | ||
| 186 | + | ||
| 187 | + data['manager_phone'] = this.managerPhone; | ||
| 188 | + data['manager_wechat'] = this.managerWechat; | ||
| 189 | + data['long'] = this.long; | ||
| 190 | + data['lat'] = this.lat; | ||
| 191 | + | ||
| 192 | + return data; | ||
| 193 | + } | ||
| 194 | +} | ||
| 195 | + | ||
| 196 | +class MarkStoreModel { | ||
| 197 | + String style; // | ||
| 198 | + String sellerName; // | ||
| 199 | + String introduce; | ||
| 200 | + List<Images> images; | ||
| 201 | + | ||
| 202 | + MarkStoreModel({ | ||
| 203 | + this.style, | ||
| 204 | + this.sellerName, | ||
| 205 | + this.introduce, | ||
| 206 | + this.images, | ||
| 207 | + }); | ||
| 208 | + | ||
| 209 | + MarkStoreModel.fromJson(Map<String, dynamic> json) { | ||
| 210 | + style = json['style']; | ||
| 211 | + sellerName = json['seller_name']; | ||
| 212 | + introduce = json['introduce']; | ||
| 213 | + | ||
| 214 | + if (json['images'] != null) { | ||
| 215 | + images = <Images>[]; | ||
| 216 | + if (json['images'] is List) { | ||
| 217 | + json['images'].forEach((v) { | ||
| 218 | + images.add(new Images.fromJson(v)); | ||
| 219 | + }); | ||
| 220 | + } else { | ||
| 221 | + convert.jsonDecode(json['images']).forEach((v) { | ||
| 222 | + images.add(new Images.fromJson(v)); | ||
| 223 | + }); | ||
| 224 | + } | ||
| 225 | + } | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + Map<String, dynamic> toJson() { | ||
| 229 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 230 | + data['style'] = this.style; | ||
| 231 | + data['seller_name'] = this.sellerName; | ||
| 232 | + data['introduce'] = this.introduce; | ||
| 233 | + data['images'] = this.images; | ||
| 234 | + return data; | ||
| 235 | + } | ||
| 236 | +} | ||
| 237 | + | ||
| 238 | +class MarkChefModel { | ||
| 239 | + String style; // | ||
| 240 | + String sellerName; // | ||
| 241 | + String introduce; | ||
| 242 | + String chefName; | ||
| 243 | + String image; | ||
| 244 | + | ||
| 245 | + MarkChefModel({ | ||
| 246 | + this.style, | ||
| 247 | + this.sellerName, | ||
| 248 | + this.introduce, | ||
| 249 | + this.chefName, | ||
| 250 | + this.image, | ||
| 251 | + }); | ||
| 252 | + | ||
| 253 | + MarkChefModel.fromJson(Map<String, dynamic> json) { | ||
| 254 | + style = json['style']; | ||
| 255 | + sellerName = json['seller_name']; | ||
| 256 | + chefName = json['chef_name']; | ||
| 257 | + introduce = json['introduce']; | ||
| 258 | + image = json['image']; | ||
| 259 | + } | ||
| 260 | + | ||
| 261 | + Map<String, dynamic> toJson() { | ||
| 262 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 263 | + data['style'] = this.style; | ||
| 264 | + data['seller_name'] = this.sellerName; | ||
| 265 | + data['chef_name'] = this.chefName; | ||
| 266 | + data['introduce'] = this.introduce; | ||
| 267 | + data['image'] = this.image; | ||
| 268 | + return data; | ||
| 269 | + } | ||
| 270 | +} | ||
| 271 | + | ||
| 272 | +class MarkSignboardModel { | ||
| 273 | + String swich; // | ||
| 274 | + | ||
| 275 | + List<Images> images; | ||
| 276 | + | ||
| 277 | + MarkSignboardModel({ | ||
| 278 | + this.swich, | ||
| 279 | + this.images, | ||
| 280 | + }); | ||
| 281 | + | ||
| 282 | + MarkSignboardModel.fromJson(Map<String, dynamic> json) { | ||
| 283 | + swich = json['swich']; | ||
| 284 | + if (json['images'] != null) { | ||
| 285 | + images = <Images>[]; | ||
| 286 | + if (json['images'] is List) { | ||
| 287 | + json['images'].forEach((v) { | ||
| 288 | + images.add(new Images.fromJson(v)); | ||
| 289 | + }); | ||
| 290 | + } else { | ||
| 291 | + convert.jsonDecode(json['images']).forEach((v) { | ||
| 292 | + images.add(new Images.fromJson(v)); | ||
| 293 | + }); | ||
| 294 | + } | ||
| 295 | + } | ||
| 296 | + } | ||
| 297 | + | ||
| 298 | + Map<String, dynamic> toJson() { | ||
| 299 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 300 | + data['swich'] = this.swich; | ||
| 301 | + | ||
| 302 | + data['images'] = this.images; | ||
| 303 | + return data; | ||
| 304 | + } | ||
| 305 | +} | ||
| 306 | + | ||
| 307 | +class MarkMarketingModel { | ||
| 308 | + String isTranspond; // | ||
| 309 | + String isArrival; // | ||
| 310 | + String isOnlineBook; // | ||
| 311 | + String isOrder; // | ||
| 312 | + String isLink; // | ||
| 313 | + String wecomle; // | ||
| 314 | + String logo; // | ||
| 315 | + | ||
| 316 | + MarkMarketingModel( | ||
| 317 | + {this.isArrival, | ||
| 318 | + this.isLink, | ||
| 319 | + this.isOnlineBook, | ||
| 320 | + this.isOrder, | ||
| 321 | + this.isTranspond, | ||
| 322 | + this.logo, | ||
| 323 | + this.wecomle}); | ||
| 324 | + | ||
| 325 | + MarkMarketingModel.fromJson(Map<String, dynamic> json) { | ||
| 326 | + isTranspond = json['is_transpond']; | ||
| 327 | + isArrival = json['is_arrival']; | ||
| 328 | + isOnlineBook = json['is_online_book']; | ||
| 329 | + isOrder = json['is_order']; | ||
| 330 | + isLink = json['is_link']; | ||
| 331 | + wecomle = json['wecomle']; | ||
| 332 | + logo = json['logo']; | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + Map<String, dynamic> toJson() { | ||
| 336 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 337 | + data['is_transpond'] = this.isTranspond; | ||
| 338 | + data['is_arrival'] = this.isArrival; | ||
| 339 | + data['is_online_book'] = this.isOnlineBook; | ||
| 340 | + data['is_order'] = this.isOrder; | ||
| 341 | + data['is_link'] = this.isLink; | ||
| 342 | + data['wecomle'] = this.wecomle; | ||
| 343 | + data['logo'] = this.logo; | ||
| 344 | + return data; | ||
| 345 | + } | ||
| 346 | +} |
| @@ -72,7 +72,9 @@ class _CouponSelectPageState extends State<CouponSelectPage> { | @@ -72,7 +72,9 @@ class _CouponSelectPageState extends State<CouponSelectPage> { | ||
| 72 | Widget build(BuildContext context) { | 72 | Widget build(BuildContext context) { |
| 73 | couponProvider = Provider.of<CouponProvider>(context, listen: true); | 73 | couponProvider = Provider.of<CouponProvider>(context, listen: true); |
| 74 | return Scaffold( | 74 | return Scaffold( |
| 75 | + backgroundColor: MyColours.color_ffffff, | ||
| 75 | appBar: AppBar( | 76 | appBar: AppBar( |
| 77 | + backgroundColor: Colors.transparent, | ||
| 76 | elevation: 0, | 78 | elevation: 0, |
| 77 | leading: InkWell( | 79 | leading: InkWell( |
| 78 | onTap: () { | 80 | onTap: () { |
| @@ -50,7 +50,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -50,7 +50,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 50 | bool addManager = false; | 50 | bool addManager = false; |
| 51 | bool addParking = false; | 51 | bool addParking = false; |
| 52 | 52 | ||
| 53 | - double dateValue; | 53 | + String dateValue; |
| 54 | BaseIndoProvider _baseIndoProvider; | 54 | BaseIndoProvider _baseIndoProvider; |
| 55 | String lat; | 55 | String lat; |
| 56 | String long; | 56 | String long; |
| @@ -143,7 +143,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -143,7 +143,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 143 | 143 | ||
| 144 | DateTime dateTime = DateTime.now(); | 144 | DateTime dateTime = DateTime.now(); |
| 145 | 145 | ||
| 146 | - dateValue = (dateTime.millisecondsSinceEpoch) / 1000; | 146 | + dateValue = ((dateTime.millisecondsSinceEpoch) / 1000).floor().toString(); |
| 147 | 147 | ||
| 148 | date = Utils.returnYMDandLunarCalendar(DateTime.now(), context); | 148 | date = Utils.returnYMDandLunarCalendar(DateTime.now(), context); |
| 149 | 149 | ||
| @@ -206,7 +206,10 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -206,7 +206,10 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 206 | dateTime.add(Duration(days: 1)), context); | 206 | dateTime.add(Duration(days: 1)), context); |
| 207 | 207 | ||
| 208 | dateValue = | 208 | dateValue = |
| 209 | - (dateTime.add(Duration(days: 1)).millisecondsSinceEpoch) / 1000; | 209 | + ((dateTime.add(Duration(days: 1)).millisecondsSinceEpoch) / 1000) |
| 210 | + .floor() | ||
| 211 | + .toString(); | ||
| 212 | + ; | ||
| 210 | } else { | 213 | } else { |
| 211 | //过了晚市 | 214 | //过了晚市 |
| 212 | dsolt = '早餐'; | 215 | dsolt = '早餐'; |
| @@ -401,7 +404,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -401,7 +404,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 401 | .tableOuterList[0].list.length > | 404 | .tableOuterList[0].list.length > |
| 402 | 0 | 405 | 0 |
| 403 | ? _itemTitleAndSubTtile('包间', | 406 | ? _itemTitleAndSubTtile('包间', |
| 404 | - '${marketingCenterProvider.tableOuterList[0].name}${marketingCenterProvider.tableOuterList[0].list[0].name}}') | 407 | + '${marketingCenterProvider.tableOuterList[0].name}${marketingCenterProvider.tableOuterList[0].list[0].name}') |
| 405 | : SizedBox(), | 408 | : SizedBox(), |
| 406 | VEmptyView(10), | 409 | VEmptyView(10), |
| 407 | marketingCenterProvider.tableOuterList.length > 0 && | 410 | marketingCenterProvider.tableOuterList.length > 0 && |
| @@ -576,7 +579,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | @@ -576,7 +579,7 @@ class _BookInfoPageState extends State<BookInfoPage> { | ||
| 576 | marketingCenterProvider | 579 | marketingCenterProvider |
| 577 | .tableOuterList[0].list.length > | 580 | .tableOuterList[0].list.length > |
| 578 | 0 | 581 | 0 |
| 579 | - ? '${marketingCenterProvider.tableOuterList[0].name}${marketingCenterProvider.tableOuterList[0].list[0].name}}' | 582 | + ? '${marketingCenterProvider.tableOuterList[0].name}${marketingCenterProvider.tableOuterList[0].list[0].name}' |
| 580 | : '', | 583 | : '', |
| 581 | 'pnum': | 584 | 'pnum': |
| 582 | '${marketingCenterProvider.tableOuterList[0].list[0].tableNum}', | 585 | '${marketingCenterProvider.tableOuterList[0].list[0].tableNum}', |
| 1 | +import 'dart:convert'; | ||
| 2 | +import 'dart:io'; | ||
| 3 | + | ||
| 1 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 6 | +import 'package:image_picker/image_picker.dart'; | ||
| 3 | import 'package:one_key/widgets/v_empty_view.dart'; | 7 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 8 | +import 'package:permission_handler/permission_handler.dart'; | ||
| 4 | import 'package:provider/provider.dart'; | 9 | import 'package:provider/provider.dart'; |
| 5 | 10 | ||
| 6 | import '../../../../app.dart'; | 11 | import '../../../../app.dart'; |
| 12 | +import '../../../../models/upload_img_model.dart'; | ||
| 13 | +import '../../../../provider/marketing_center_provider.dart'; | ||
| 14 | +import '../../../../provider/upload_img_provider.dart'; | ||
| 7 | import '../../../../provider/user_model.dart'; | 15 | import '../../../../provider/user_model.dart'; |
| 8 | import '../../../../res/colors.dart'; | 16 | import '../../../../res/colors.dart'; |
| 9 | import '../../../../utils/screen_util.dart'; | 17 | import '../../../../utils/screen_util.dart'; |
| 18 | +import '../../../../utils/upload_image_util.dart'; | ||
| 10 | import '../../../../utils/utils.dart'; | 19 | import '../../../../utils/utils.dart'; |
| 11 | import '../../../../widgets/MyDivider.dart'; | 20 | import '../../../../widgets/MyDivider.dart'; |
| 12 | import '../../../../widgets/common_button_flat.dart'; | 21 | import '../../../../widgets/common_button_flat.dart'; |
| @@ -37,6 +46,11 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | @@ -37,6 +46,11 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | ||
| 37 | TextEditingController chefNameC = TextEditingController(); | 46 | TextEditingController chefNameC = TextEditingController(); |
| 38 | FocusNode chefNameNode = FocusNode(); | 47 | FocusNode chefNameNode = FocusNode(); |
| 39 | 48 | ||
| 49 | + final picker = ImagePicker(); | ||
| 50 | + | ||
| 51 | + UploadImageProvider _uploadImageProvider; | ||
| 52 | + MarketingCenterProvider _marketingCenterProvider; | ||
| 53 | + | ||
| 40 | @override | 54 | @override |
| 41 | void initState() { | 55 | void initState() { |
| 42 | super.initState(); | 56 | super.initState(); |
| @@ -48,6 +62,148 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | @@ -48,6 +62,148 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | ||
| 48 | }); | 62 | }); |
| 49 | } | 63 | } |
| 50 | 64 | ||
| 65 | + @override | ||
| 66 | + void dispose() { | ||
| 67 | + _uploadImageProvider.firstImage = UploadImgModel(); | ||
| 68 | + super.dispose(); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + ///#相机拍照,单图选择 | ||
| 72 | + Future _getFromPictureOrCamera(UploadImgModel imgModel, imageSource) async { | ||
| 73 | + final pickedFile = await picker.getImage(source: imageSource); | ||
| 74 | + setState(() { | ||
| 75 | + if (pickedFile != null) { | ||
| 76 | + imgModel.file = File(pickedFile.path); | ||
| 77 | + imgModel.process = 0.01; | ||
| 78 | + } else { | ||
| 79 | + print('No image selected.'); | ||
| 80 | + } | ||
| 81 | + }); | ||
| 82 | + if (pickedFile != null) { | ||
| 83 | + // if (title == '头像') { | ||
| 84 | + // _uploadImageProvider.imgSizeTouxiang = 76; | ||
| 85 | + // _uploadImageProvider.touxiang.qiniuUrl = null; | ||
| 86 | + // } else { | ||
| 87 | + // _uploadImageProvider.imgSizeErweima = 76; | ||
| 88 | + _uploadImageProvider.firstImage.qiniuUrl = null; | ||
| 89 | + // } | ||
| 90 | + UploadImageUtil().startUploadOnly( | ||
| 91 | + context, File(pickedFile.path), 4, true, _uploadImageProvider); | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + ///添加图片UI弹出 | ||
| 96 | + Future _openModalBottomSheet(context) async { | ||
| 97 | + final option = await showModalBottomSheet( | ||
| 98 | + context: context, | ||
| 99 | + backgroundColor: Colors.transparent, | ||
| 100 | + isDismissible: false, | ||
| 101 | + builder: (BuildContext context) { | ||
| 102 | + return Container( | ||
| 103 | + // height: ScreenUtil().setWidth(180 * 2), | ||
| 104 | + decoration: BoxDecoration( | ||
| 105 | + color: MyColours.color_ffffff, | ||
| 106 | + borderRadius: BorderRadius.only( | ||
| 107 | + topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 108 | + topRight: Radius.circular(ScreenUtil().setWidth(24)))), | ||
| 109 | + child: Column( | ||
| 110 | + mainAxisSize: MainAxisSize.min, | ||
| 111 | + children: <Widget>[ | ||
| 112 | + InkWell( | ||
| 113 | + onTap: () { | ||
| 114 | + // Utils.getPickPermission(context, () { | ||
| 115 | + // _getFromPictureOrCamera( | ||
| 116 | + // _uploadImageProvider.firstImage, ImageSource.camera); | ||
| 117 | + | ||
| 118 | + // Navigator.pop(context); | ||
| 119 | + // }, Permission.camera); | ||
| 120 | + Utils.getPickPermission(context, () { | ||
| 121 | + _getFromPictureOrCamera( | ||
| 122 | + _uploadImageProvider.firstImage, ImageSource.camera); | ||
| 123 | + Navigator.pop(context); | ||
| 124 | + }, | ||
| 125 | + Platform.isAndroid | ||
| 126 | + ? Permission.storage | ||
| 127 | + : Permission.photos); | ||
| 128 | + }, | ||
| 129 | + child: Container( | ||
| 130 | + width: double.infinity, | ||
| 131 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 132 | + child: Center( | ||
| 133 | + child: Text( | ||
| 134 | + '拍摄', | ||
| 135 | + style: TextStyle( | ||
| 136 | + fontSize: ScreenUtil().setSp(32), | ||
| 137 | + color: MyColours.color_353535, | ||
| 138 | + fontWeight: FontWeight.bold), | ||
| 139 | + ), | ||
| 140 | + )), | ||
| 141 | + ), | ||
| 142 | + MyDivider( | ||
| 143 | + double.infinity, | ||
| 144 | + ScreenUtil().setWidth(2), | ||
| 145 | + color: MyColours.color_EEEEEE, | ||
| 146 | + ), | ||
| 147 | + InkWell( | ||
| 148 | + onTap: () { | ||
| 149 | + // Utils.getPickPermission(context, () { | ||
| 150 | + // // pickAsset(RequestType.image); | ||
| 151 | + // _getFromPictureOrCamera( | ||
| 152 | + // _uploadImageProvider.firstImage, ImageSource.gallery); | ||
| 153 | + // Navigator.pop(context); | ||
| 154 | + // }, | ||
| 155 | + // Platform.isAndroid | ||
| 156 | + // ? Permission.storage | ||
| 157 | + // : Permission.photos); | ||
| 158 | + Utils.getPickPermission(context, () { | ||
| 159 | + _getFromPictureOrCamera( | ||
| 160 | + _uploadImageProvider.firstImage, ImageSource.gallery); | ||
| 161 | + Navigator.pop(context); | ||
| 162 | + }, | ||
| 163 | + Platform.isAndroid | ||
| 164 | + ? Permission.storage | ||
| 165 | + : Permission.photos); | ||
| 166 | + }, | ||
| 167 | + child: Container( | ||
| 168 | + width: double.infinity, | ||
| 169 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 170 | + child: Center( | ||
| 171 | + child: Text( | ||
| 172 | + '从相册选择', | ||
| 173 | + style: TextStyle( | ||
| 174 | + fontSize: ScreenUtil().setSp(32), | ||
| 175 | + color: MyColours.color_353535, | ||
| 176 | + fontWeight: FontWeight.bold), | ||
| 177 | + ), | ||
| 178 | + )), | ||
| 179 | + ), | ||
| 180 | + MyDivider( | ||
| 181 | + double.infinity, | ||
| 182 | + ScreenUtil().setWidth(10), | ||
| 183 | + color: MyColours.color_EEEEEE, | ||
| 184 | + ), | ||
| 185 | + InkWell( | ||
| 186 | + onTap: () { | ||
| 187 | + Navigator.pop(context, '取消'); | ||
| 188 | + }, | ||
| 189 | + child: Container( | ||
| 190 | + width: double.infinity, | ||
| 191 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 192 | + child: Center( | ||
| 193 | + child: Text( | ||
| 194 | + '取消', | ||
| 195 | + style: TextStyle( | ||
| 196 | + fontSize: ScreenUtil().setSp(32), | ||
| 197 | + color: MyColours.color_353535, | ||
| 198 | + fontWeight: FontWeight.bold), | ||
| 199 | + ), | ||
| 200 | + ))) | ||
| 201 | + ], | ||
| 202 | + ), | ||
| 203 | + ); | ||
| 204 | + }); | ||
| 205 | + } | ||
| 206 | + | ||
| 51 | ///图文合并,图文分开,无文字 | 207 | ///图文合并,图文分开,无文字 |
| 52 | Widget _selectBtnWidget() { | 208 | Widget _selectBtnWidget() { |
| 53 | return Container( | 209 | return Container( |
| @@ -244,72 +400,167 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | @@ -244,72 +400,167 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | ||
| 244 | ); | 400 | ); |
| 245 | } | 401 | } |
| 246 | 402 | ||
| 247 | - Widget _uploadImage(bool hasupload, {EdgeInsets padding = EdgeInsets.zero}) { | ||
| 248 | - return InkWell( | ||
| 249 | - onTap: () {}, | ||
| 250 | - child: hasupload | ||
| 251 | - ? InkWell( | ||
| 252 | - onTap: () { | ||
| 253 | - print('object'); | ||
| 254 | - }, | ||
| 255 | - child: Stack(alignment: Alignment.bottomCenter, children: [ | ||
| 256 | - Image.network( | ||
| 257 | - 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg', | ||
| 258 | - fit: BoxFit.cover, | ||
| 259 | - height: w(280), | ||
| 260 | - ), | ||
| 261 | - Container( | 403 | + Widget _uploadImage({EdgeInsets padding = EdgeInsets.zero}) { |
| 404 | + return _uploadImageProvider.firstImage.file != null || | ||
| 405 | + (_uploadImageProvider.firstImage.qiniuUrl != null && | ||
| 406 | + _uploadImageProvider.firstImage.qiniuUrl != '') | ||
| 407 | + ? InkWell( | ||
| 408 | + onTap: () { | ||
| 409 | + double process; | ||
| 410 | + String qiniuUrl; | ||
| 411 | + List<String> tempList = []; | ||
| 412 | + // if (title == '头像') { | ||
| 413 | + process = _uploadImageProvider.firstImage.process; | ||
| 414 | + qiniuUrl = _uploadImageProvider.firstImage.qiniuUrl; | ||
| 415 | + // } else { | ||
| 416 | + // process = _uploadImageProvider.erweima.process; | ||
| 417 | + // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl; | ||
| 418 | + // } | ||
| 419 | + | ||
| 420 | + if (qiniuUrl != null && qiniuUrl != '') { | ||
| 421 | + // tempList.add(qiniuUrl); | ||
| 422 | + | ||
| 423 | + // ///没有上传完成的不可以点击 | ||
| 424 | + // _showPhotoView(context, 0, tempList); | ||
| 425 | + | ||
| 426 | + _uploadImageProvider.firstImage.qiniuUrl = null; | ||
| 427 | + _uploadImageProvider.firstImage.process = 0; | ||
| 428 | + setState(() {}); | ||
| 429 | + FocusScope.of(context).requestFocus(FocusNode()); | ||
| 430 | + _openModalBottomSheet(context); | ||
| 431 | + // Utils.getPickPermission(context, () { | ||
| 432 | + // _getFromPictureOrCamera( | ||
| 433 | + // _uploadImageProvider.firstImage, | ||
| 434 | + // ImageSource.gallery); | ||
| 435 | + // }, | ||
| 436 | + // Platform.isAndroid | ||
| 437 | + // ? Permission.storage | ||
| 438 | + // : Permission.photos); | ||
| 439 | + } | ||
| 440 | + }, | ||
| 441 | + child: Stack(alignment: Alignment.bottomCenter, children: [ | ||
| 442 | + Stack(clipBehavior: Clip.none, children: [ | ||
| 443 | + _uploadImageProvider.firstImage.qiniuUrl != null && | ||
| 444 | + _uploadImageProvider.firstImage.qiniuUrl != '' | ||
| 445 | + ? Image.network( | ||
| 446 | + _uploadImageProvider.firstImage.qiniuUrl, | ||
| 447 | + fit: BoxFit.cover, | ||
| 448 | + width: double.infinity, | ||
| 449 | + // width: ScreenUtil() | ||
| 450 | + // .setWidth(imgSize * 2), | ||
| 451 | + height: ScreenUtil().setWidth( | ||
| 452 | + _uploadImageProvider.imgSizefirstImage * 2), | ||
| 453 | + ) | ||
| 454 | + : Image.file( | ||
| 455 | + _uploadImageProvider.firstImage.file, | ||
| 456 | + fit: BoxFit.cover, | ||
| 457 | + width: double.infinity, | ||
| 458 | + // width: ScreenUtil() | ||
| 459 | + // .setWidth(imgSize * 2), | ||
| 460 | + height: ScreenUtil().setWidth( | ||
| 461 | + _uploadImageProvider.imgSizefirstImage * 2), | ||
| 462 | + ), | ||
| 463 | + Positioned( | ||
| 464 | + left: 0, | ||
| 465 | + top: 0, | ||
| 466 | + right: padding.right, | ||
| 467 | + child: (_uploadImageProvider.firstImage.file != null) && | ||
| 468 | + _uploadImageProvider.firstImage.process != 1 && | ||
| 469 | + _uploadImageProvider.firstImage.process != 0.01 | ||
| 470 | + ? Container( | ||
| 471 | + width: ScreenUtil().screenWidth, | ||
| 472 | + height: w(_uploadImageProvider.imgSizefirstImage), | ||
| 473 | + color: MyColours.color_4D000000, | ||
| 474 | + child: Center( | ||
| 475 | + child: Text('上传中', | ||
| 476 | + style: | ||
| 477 | + TextStyle(color: MyColours.color_F8F9FD)), | ||
| 478 | + ), | ||
| 479 | + ) | ||
| 480 | + : Container()), | ||
| 481 | + ]), | ||
| 482 | + _uploadImageProvider.firstImage.process == 1 | ||
| 483 | + ? Container( | ||
| 262 | width: w(150), | 484 | width: w(150), |
| 263 | height: w(30), | 485 | height: w(30), |
| 264 | color: MyColours.color_4D000000, | 486 | color: MyColours.color_4D000000, |
| 265 | - margin: padding, | ||
| 266 | alignment: Alignment.center, | 487 | alignment: Alignment.center, |
| 488 | + margin: padding, | ||
| 267 | child: Text( | 489 | child: Text( |
| 268 | '点击图片可以更换', | 490 | '点击图片可以更换', |
| 269 | style: TextStyle( | 491 | style: TextStyle( |
| 270 | color: MyColours.color_F8F9FD, | 492 | color: MyColours.color_F8F9FD, |
| 271 | fontSize: font(14), | 493 | fontSize: font(14), |
| 272 | fontWeight: FontWeight.bold), | 494 | fontWeight: FontWeight.bold), |
| 273 | - )), | ||
| 274 | - ])) | ||
| 275 | - : Container( | ||
| 276 | - color: MyColours.color_d9d9d9, | ||
| 277 | - width: double.infinity, | ||
| 278 | - height: w(280), | ||
| 279 | - padding: padding, | ||
| 280 | - child: Column( | ||
| 281 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 282 | - children: [ | ||
| 283 | - Image.asset( | ||
| 284 | - Utils.getImgPath('add_img'), | ||
| 285 | - width: w(63), | ||
| 286 | - ), | ||
| 287 | - VEmptyView(28), | ||
| 288 | - Container( | ||
| 289 | - width: w(139), | ||
| 290 | - height: w(60), | ||
| 291 | - child: Text( | ||
| 292 | - '点击上传照片\n为了更好的效果\n建议上传4:3照片', | ||
| 293 | - textAlign: TextAlign.center, | ||
| 294 | - style: TextStyle( | ||
| 295 | - height: 1.4, | ||
| 296 | - color: MyColours.color_ffffff, | ||
| 297 | - fontSize: font(14), | ||
| 298 | - fontWeight: FontWeight.bold), | ||
| 299 | - )) | ||
| 300 | - ], | ||
| 301 | - ), | ||
| 302 | - )); | 495 | + )) |
| 496 | + : SizedBox(), | ||
| 497 | + ])) | ||
| 498 | + : InkWell( | ||
| 499 | + onTap: () { | ||
| 500 | + // double process; | ||
| 501 | + // String qiniuUrl; | ||
| 502 | + // List<String> tempList = []; | ||
| 503 | + // if (title == '头像') { | ||
| 504 | + // process = _uploadImageProvider.touxiang.process; | ||
| 505 | + // qiniuUrl = _uploadImageProvider.touxiang.qiniuUrl; | ||
| 506 | + // } else { | ||
| 507 | + // process = _uploadImageProvider.erweima.process; | ||
| 508 | + // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl; | ||
| 509 | + // } | ||
| 510 | + | ||
| 511 | + // if (qiniuUrl != null && qiniuUrl != '') { | ||
| 512 | + // tempList.add(qiniuUrl); | ||
| 513 | + | ||
| 514 | + // ///没有上传完成的不可以点击 | ||
| 515 | + // _showPhotoView(context, 0, tempList); | ||
| 516 | + // } else { | ||
| 517 | + // Utils.getPickPermission(context, () { | ||
| 518 | + // _getFromPictureOrCamera( | ||
| 519 | + // _uploadImageProvider.firstImage, ImageSource.gallery); | ||
| 520 | + // }, Platform.isAndroid ? Permission.storage : Permission.photos); | ||
| 521 | + FocusScope.of(context).requestFocus(FocusNode()); | ||
| 522 | + _openModalBottomSheet(context); | ||
| 523 | + }, | ||
| 524 | + child: Container( | ||
| 525 | + color: MyColours.color_d9d9d9, | ||
| 526 | + width: double.infinity, | ||
| 527 | + height: w(_uploadImageProvider.imgSizefirstImage), | ||
| 528 | + margin: padding, | ||
| 529 | + child: Column( | ||
| 530 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 531 | + children: [ | ||
| 532 | + // VEmptyView(80), | ||
| 533 | + Image.asset( | ||
| 534 | + Utils.getImgPath('add_img'), | ||
| 535 | + width: w(63), | ||
| 536 | + ), | ||
| 537 | + VEmptyView(28), | ||
| 538 | + Container( | ||
| 539 | + width: w(139), | ||
| 540 | + height: w(60), | ||
| 541 | + child: Text( | ||
| 542 | + '点击上传照片\n为了更好的效果\n建议上传4:3照片', | ||
| 543 | + textAlign: TextAlign.center, | ||
| 544 | + style: TextStyle( | ||
| 545 | + height: 1.4, | ||
| 546 | + color: MyColours.color_ffffff, | ||
| 547 | + fontSize: font(14), | ||
| 548 | + fontWeight: FontWeight.bold), | ||
| 549 | + )) | ||
| 550 | + ], | ||
| 551 | + ), | ||
| 552 | + )); | ||
| 303 | } | 553 | } |
| 304 | 554 | ||
| 305 | - ///无文字 | 555 | + ///无介绍 |
| 306 | Widget _noTextWidget() { | 556 | Widget _noTextWidget() { |
| 307 | - return Column( | ||
| 308 | - children: [ | ||
| 309 | - _uploadImage(false), | ||
| 310 | - VEmptyView(18), | ||
| 311 | - ], | ||
| 312 | - ); | 557 | + return SizedBox(); |
| 558 | + // return Column( | ||
| 559 | + // children: [ | ||
| 560 | + // _uploadImage(), | ||
| 561 | + // VEmptyView(18), | ||
| 562 | + // ], | ||
| 563 | + // ); | ||
| 313 | } | 564 | } |
| 314 | 565 | ||
| 315 | ///图文合并 | 566 | ///图文合并 |
| @@ -322,15 +573,15 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | @@ -322,15 +573,15 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | ||
| 322 | return Column( | 573 | return Column( |
| 323 | children: [ | 574 | children: [ |
| 324 | Stack( | 575 | Stack( |
| 576 | + alignment: Alignment.centerRight, | ||
| 325 | children: [ | 577 | children: [ |
| 326 | _uploadImage( | 578 | _uploadImage( |
| 327 | - true, | ||
| 328 | - padding: EdgeInsets.only(left: w(160)), | 579 | + padding: EdgeInsets.only(right: w(160)), |
| 329 | ), | 580 | ), |
| 330 | Positioned( | 581 | Positioned( |
| 331 | child: _introduceWidget( | 582 | child: _introduceWidget( |
| 332 | EdgeInsets.only( | 583 | EdgeInsets.only( |
| 333 | - left: w(15), top: w(23), right: w(7), bottom: w(42)), | 584 | + right: w(15), top: w(23), left: w(7), bottom: w(42)), |
| 334 | textColor: MyColours.color_ffffff, | 585 | textColor: MyColours.color_ffffff, |
| 335 | hintColor: MyColours.color_ffffff, | 586 | hintColor: MyColours.color_ffffff, |
| 336 | boxDecoration: BoxDecoration( | 587 | boxDecoration: BoxDecoration( |
| @@ -358,12 +609,17 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | @@ -358,12 +609,17 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | ||
| 358 | _introduceWidget(EdgeInsets.all(w(15)), | 609 | _introduceWidget(EdgeInsets.all(w(15)), |
| 359 | boxDecoration: BoxDecoration(color: MyColours.color_ffffff)), | 610 | boxDecoration: BoxDecoration(color: MyColours.color_ffffff)), |
| 360 | VEmptyView(18), | 611 | VEmptyView(18), |
| 361 | - _uploadImage(false), | 612 | + _uploadImage(), |
| 362 | ]); | 613 | ]); |
| 363 | } | 614 | } |
| 364 | 615 | ||
| 365 | @override | 616 | @override |
| 366 | Widget build(BuildContext context) { | 617 | Widget build(BuildContext context) { |
| 618 | + _uploadImageProvider = | ||
| 619 | + Provider.of<UploadImageProvider>(context, listen: true); | ||
| 620 | + | ||
| 621 | + _marketingCenterProvider = | ||
| 622 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 367 | return Scaffold( | 623 | return Scaffold( |
| 368 | backgroundColor: MyColours.color_ffffff, | 624 | backgroundColor: MyColours.color_ffffff, |
| 369 | appBar: SystemAppBar( | 625 | appBar: SystemAppBar( |
| @@ -413,7 +669,75 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | @@ -413,7 +669,75 @@ class _ChefIntroducePageState extends State<ChefIntroducePage> { | ||
| 413 | fontSize: 34, | 669 | fontSize: 34, |
| 414 | height: w(40), | 670 | height: w(40), |
| 415 | isBold: true, | 671 | isBold: true, |
| 416 | - onPressed: () {}, | 672 | + onPressed: () async { |
| 673 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 674 | + | ||
| 675 | + if ((currIndex == 1 || currIndex == 2)) { | ||
| 676 | + if (chefNameC.text.trim().length == 0) { | ||
| 677 | + Utils.showToast('请输入主厨姓名!'); | ||
| 678 | + return false; | ||
| 679 | + } | ||
| 680 | + if (chefIntroduceC.text.trim().length == 0) { | ||
| 681 | + Utils.showToast('请输入主厨介绍文字!'); | ||
| 682 | + return false; | ||
| 683 | + } | ||
| 684 | + if (_uploadImageProvider.firstImage.qiniuUrl == null) { | ||
| 685 | + Utils.showToast('请上传图片!'); | ||
| 686 | + return false; | ||
| 687 | + } | ||
| 688 | + | ||
| 689 | + if (_uploadImageProvider.firstImage.process < 1) { | ||
| 690 | + Utils.showToast('正在上传图片,请稍等'); | ||
| 691 | + return false; | ||
| 692 | + } | ||
| 693 | + } | ||
| 694 | + | ||
| 695 | + // List<String> images = []; | ||
| 696 | + // if (_uploadImageProvider.storeImage1.qiniuUrl != null && | ||
| 697 | + // _uploadImageProvider.storeImage1.qiniuUrl != '') { | ||
| 698 | + // images.add(_uploadImageProvider.storeImage1.qiniuUrl); | ||
| 699 | + // } | ||
| 700 | + // if (_uploadImageProvider.storeImage2.qiniuUrl != null && | ||
| 701 | + // _uploadImageProvider.storeImage2.qiniuUrl != '') { | ||
| 702 | + // images.add(_uploadImageProvider.storeImage2.qiniuUrl); | ||
| 703 | + // } | ||
| 704 | + // if (_uploadImageProvider.storeImage3.qiniuUrl != null && | ||
| 705 | + // _uploadImageProvider.storeImage3.qiniuUrl != '') { | ||
| 706 | + // images.add(_uploadImageProvider.storeImage3.qiniuUrl); | ||
| 707 | + // } | ||
| 708 | + // if (_uploadImageProvider.storeImage3.qiniuUrl != null && | ||
| 709 | + // _uploadImageProvider.storeImage3.qiniuUrl != '') { | ||
| 710 | + // images.add(_uploadImageProvider.storeImage3.qiniuUrl); | ||
| 711 | + // } | ||
| 712 | + // if (images.length == 0) { | ||
| 713 | + // Utils.showToast('请至少上传一张图片!'); | ||
| 714 | + // return false; | ||
| 715 | + // } | ||
| 716 | + | ||
| 717 | + //接口 | ||
| 718 | + Map chefData = { | ||
| 719 | + 'style': currIndex.toString(), | ||
| 720 | + 'seller_name': sellername, | ||
| 721 | + 'chef_name': chefNameC.text, | ||
| 722 | + 'introduce': chefIntroduceC.text, | ||
| 723 | + 'image': _uploadImageProvider.firstImage.qiniuUrl | ||
| 724 | + }; | ||
| 725 | + | ||
| 726 | + Map<String, String> params = { | ||
| 727 | + 'sid': Provider.of<UserModel>(context, listen: false) | ||
| 728 | + .user | ||
| 729 | + .sellerid, | ||
| 730 | + 'chef': json.encode(chefData) | ||
| 731 | + }; | ||
| 732 | + | ||
| 733 | + bool success = await _marketingCenterProvider | ||
| 734 | + .setSellerTemplateConf(context, params, | ||
| 735 | + showLoading: true); | ||
| 736 | + if (success) { | ||
| 737 | + Utils.showToast('保存成功'); | ||
| 738 | + Navigator.pop(context); | ||
| 739 | + } | ||
| 740 | + }, | ||
| 417 | ), | 741 | ), |
| 418 | ) | 742 | ) |
| 419 | ], | 743 | ], |
| 1 | +import 'dart:convert'; | ||
| 2 | + | ||
| 1 | import 'package:flutter/material.dart'; | 3 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:provider/provider.dart'; | 5 | import 'package:provider/provider.dart'; |
| 4 | 6 | ||
| 7 | +import '../../../../app.dart'; | ||
| 8 | +import '../../../../models/upload_img_model.dart'; | ||
| 5 | import '../../../../provider/marketing_center_provider.dart'; | 9 | import '../../../../provider/marketing_center_provider.dart'; |
| 10 | +import '../../../../provider/upload_img_provider.dart'; | ||
| 11 | +import '../../../../provider/user_model.dart'; | ||
| 6 | import '../../../../res/colors.dart'; | 12 | import '../../../../res/colors.dart'; |
| 7 | import '../../../../utils/screen_util.dart'; | 13 | import '../../../../utils/screen_util.dart'; |
| 14 | +import '../../../../utils/upload_image_util.dart'; | ||
| 8 | import '../../../../utils/utils.dart'; | 15 | import '../../../../utils/utils.dart'; |
| 9 | import '../../../../widgets/round_button.dart'; | 16 | import '../../../../widgets/round_button.dart'; |
| 10 | import '../../../../widgets/system_app_bar.dart'; | 17 | import '../../../../widgets/system_app_bar.dart'; |
| 11 | import '../../../../widgets/v_empty_view.dart'; | 18 | import '../../../../widgets/v_empty_view.dart'; |
| 19 | +import 'img_picker_invitation_widget.dart'; | ||
| 12 | 20 | ||
| 13 | /*** | 21 | /*** |
| 14 | * 菜品展示 | 22 | * 菜品展示 |
| @@ -25,6 +33,18 @@ class _DishShowPageState extends State<DishShowPage> { | @@ -25,6 +33,18 @@ class _DishShowPageState extends State<DishShowPage> { | ||
| 25 | MarketingCenterProvider marketingCenterProvider; | 33 | MarketingCenterProvider marketingCenterProvider; |
| 26 | bool addDish = false; | 34 | bool addDish = false; |
| 27 | 35 | ||
| 36 | + UploadImageProvider _uploadImageProvider; | ||
| 37 | + ScrollController controller = ScrollController(); | ||
| 38 | + | ||
| 39 | + @override | ||
| 40 | + void dispose() { | ||
| 41 | + _uploadImageProvider.storeImage1 = UploadImgModel(); | ||
| 42 | + _uploadImageProvider.storeImage2 = UploadImgModel(); | ||
| 43 | + _uploadImageProvider.storeImage3 = UploadImgModel(); | ||
| 44 | + _uploadImageProvider.storeImage4 = UploadImgModel(); | ||
| 45 | + super.dispose(); | ||
| 46 | + } | ||
| 47 | + | ||
| 28 | Widget _item(String title, {bool select, GestureTapCallback onTap}) { | 48 | Widget _item(String title, {bool select, GestureTapCallback onTap}) { |
| 29 | return InkWell( | 49 | return InkWell( |
| 30 | onTap: onTap, | 50 | onTap: onTap, |
| @@ -56,69 +76,76 @@ class _DishShowPageState extends State<DishShowPage> { | @@ -56,69 +76,76 @@ class _DishShowPageState extends State<DishShowPage> { | ||
| 56 | ))); | 76 | ))); |
| 57 | } | 77 | } |
| 58 | 78 | ||
| 59 | - Widget _uploadImage(bool hasupload, {EdgeInsets padding = EdgeInsets.zero}) { | ||
| 60 | - return InkWell( | ||
| 61 | - onTap: () {}, | ||
| 62 | - child: hasupload | ||
| 63 | - ? InkWell( | ||
| 64 | - onTap: () { | ||
| 65 | - print('object'); | ||
| 66 | - }, | ||
| 67 | - child: Stack(alignment: Alignment.bottomCenter, children: [ | ||
| 68 | - Image.network( | ||
| 69 | - 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg', | ||
| 70 | - fit: BoxFit.cover, | ||
| 71 | - height: w(280), | ||
| 72 | - ), | ||
| 73 | - Container( | ||
| 74 | - width: w(150), | ||
| 75 | - height: w(30), | ||
| 76 | - color: MyColours.color_4D000000, | ||
| 77 | - margin: padding, | ||
| 78 | - alignment: Alignment.center, | ||
| 79 | - child: Text( | ||
| 80 | - '点击图片可以更换', | ||
| 81 | - style: TextStyle( | ||
| 82 | - color: MyColours.color_F8F9FD, | ||
| 83 | - fontSize: font(14), | ||
| 84 | - fontWeight: FontWeight.bold), | ||
| 85 | - )), | ||
| 86 | - ])) | ||
| 87 | - : Container( | ||
| 88 | - color: MyColours.color_d9d9d9, | ||
| 89 | - width: double.infinity, | ||
| 90 | - height: w(280), | ||
| 91 | - padding: padding, | ||
| 92 | - child: Column( | ||
| 93 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 94 | - children: [ | ||
| 95 | - Image.asset( | ||
| 96 | - Utils.getImgPath('add_img'), | ||
| 97 | - width: w(63), | ||
| 98 | - ), | ||
| 99 | - VEmptyView(28), | ||
| 100 | - Container( | ||
| 101 | - width: w(139), | ||
| 102 | - height: w(60), | ||
| 103 | - child: Text( | ||
| 104 | - '点击上传照片\n为了更好的效果\n建议上传4:3照片', | ||
| 105 | - textAlign: TextAlign.center, | ||
| 106 | - style: TextStyle( | ||
| 107 | - height: 1.4, | ||
| 108 | - color: MyColours.color_ffffff, | ||
| 109 | - fontSize: font(14), | ||
| 110 | - fontWeight: FontWeight.bold), | ||
| 111 | - )) | ||
| 112 | - ], | ||
| 113 | - ), | ||
| 114 | - )); | ||
| 115 | - } | 79 | + // Widget _uploadImage(bool hasupload, {EdgeInsets padding = EdgeInsets.zero}) { |
| 80 | + // return InkWell( | ||
| 81 | + // onTap: () {}, | ||
| 82 | + // child: hasupload | ||
| 83 | + // ? InkWell( | ||
| 84 | + // onTap: () { | ||
| 85 | + // print('object'); | ||
| 86 | + // }, | ||
| 87 | + // child: Stack(alignment: Alignment.bottomCenter, children: [ | ||
| 88 | + // Image.network( | ||
| 89 | + // 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg', | ||
| 90 | + // fit: BoxFit.cover, | ||
| 91 | + // height: w(280), | ||
| 92 | + // ), | ||
| 93 | + // Container( | ||
| 94 | + // width: w(150), | ||
| 95 | + // height: w(30), | ||
| 96 | + // color: MyColours.color_4D000000, | ||
| 97 | + // margin: padding, | ||
| 98 | + // alignment: Alignment.center, | ||
| 99 | + // child: Text( | ||
| 100 | + // '点击图片可以更换', | ||
| 101 | + // style: TextStyle( | ||
| 102 | + // color: MyColours.color_F8F9FD, | ||
| 103 | + // fontSize: font(14), | ||
| 104 | + // fontWeight: FontWeight.bold), | ||
| 105 | + // )), | ||
| 106 | + // ])) | ||
| 107 | + // : Container( | ||
| 108 | + // color: MyColours.color_d9d9d9, | ||
| 109 | + // width: double.infinity, | ||
| 110 | + // height: w(280), | ||
| 111 | + // padding: padding, | ||
| 112 | + // child: Column( | ||
| 113 | + // mainAxisAlignment: MainAxisAlignment.center, | ||
| 114 | + // children: [ | ||
| 115 | + // Image.asset( | ||
| 116 | + // Utils.getImgPath('add_img'), | ||
| 117 | + // width: w(63), | ||
| 118 | + // ), | ||
| 119 | + // VEmptyView(28), | ||
| 120 | + // Container( | ||
| 121 | + // width: w(139), | ||
| 122 | + // height: w(60), | ||
| 123 | + // child: Text( | ||
| 124 | + // '点击上传照片\n为了更好的效果\n建议上传4:3照片', | ||
| 125 | + // textAlign: TextAlign.center, | ||
| 126 | + // style: TextStyle( | ||
| 127 | + // height: 1.4, | ||
| 128 | + // color: MyColours.color_ffffff, | ||
| 129 | + // fontSize: font(14), | ||
| 130 | + // fontWeight: FontWeight.bold), | ||
| 131 | + // )) | ||
| 132 | + // ], | ||
| 133 | + // ), | ||
| 134 | + // )); | ||
| 135 | + // } | ||
| 116 | 136 | ||
| 117 | @override | 137 | @override |
| 118 | Widget build(BuildContext context) { | 138 | Widget build(BuildContext context) { |
| 119 | marketingCenterProvider = | 139 | marketingCenterProvider = |
| 120 | Provider.of<MarketingCenterProvider>(context, listen: true); | 140 | Provider.of<MarketingCenterProvider>(context, listen: true); |
| 141 | + _uploadImageProvider = | ||
| 142 | + Provider.of<UploadImageProvider>(context, listen: true); | ||
| 143 | + int colorValue = App.sp.get("themeColor"); | ||
| 144 | + Color themColor = MyColours.color_0C0F0E; | ||
| 121 | 145 | ||
| 146 | + if (colorValue != null) { | ||
| 147 | + themColor = Color(colorValue); | ||
| 148 | + } | ||
| 122 | return Scaffold( | 149 | return Scaffold( |
| 123 | backgroundColor: MyColours.color_ffffff, | 150 | backgroundColor: MyColours.color_ffffff, |
| 124 | appBar: SystemAppBar( | 151 | appBar: SystemAppBar( |
| @@ -130,37 +157,86 @@ class _DishShowPageState extends State<DishShowPage> { | @@ -130,37 +157,86 @@ class _DishShowPageState extends State<DishShowPage> { | ||
| 130 | body: Column(children: [ | 157 | body: Column(children: [ |
| 131 | Expanded( | 158 | Expanded( |
| 132 | child: SingleChildScrollView( | 159 | child: SingleChildScrollView( |
| 160 | + controller: controller, | ||
| 133 | child: Column(children: [ | 161 | child: Column(children: [ |
| 134 | - _item('附加招牌菜展示', select: addDish, onTap: () { | ||
| 135 | - setState(() { | ||
| 136 | - addDish = !addDish; | ||
| 137 | - }); | ||
| 138 | - }), | ||
| 139 | - VEmptyView(24), | ||
| 140 | - Container( | ||
| 141 | - alignment: Alignment.centerLeft, | ||
| 142 | - padding: EdgeInsets.only(left: w(16)), | ||
| 143 | - height: w(48), | ||
| 144 | - child: Text( | ||
| 145 | - '效果预览', | ||
| 146 | - style: TextStyle( | ||
| 147 | - fontSize: font(16), color: MyColours.color_515151), | ||
| 148 | - ), | ||
| 149 | - ), | ||
| 150 | - addDish | ||
| 151 | - ? Column( | ||
| 152 | - children: [ | ||
| 153 | - VEmptyView(24), | ||
| 154 | - _uploadImage(false), | ||
| 155 | - VEmptyView(18), | ||
| 156 | - _uploadImage(true), | ||
| 157 | - VEmptyView(18), | ||
| 158 | - _uploadImage(true), | ||
| 159 | - VEmptyView(18), | ||
| 160 | - ], | ||
| 161 | - ) | ||
| 162 | - : SizedBox() | ||
| 163 | - ]))), | 162 | + _item('附加招牌菜展示', select: addDish, onTap: () { |
| 163 | + setState(() { | ||
| 164 | + addDish = !addDish; | ||
| 165 | + }); | ||
| 166 | + }), | ||
| 167 | + VEmptyView(24), | ||
| 168 | + Container( | ||
| 169 | + alignment: Alignment.centerLeft, | ||
| 170 | + padding: EdgeInsets.only(left: w(16)), | ||
| 171 | + height: w(48), | ||
| 172 | + child: Text( | ||
| 173 | + '效果预览', | ||
| 174 | + style: TextStyle( | ||
| 175 | + fontSize: font(16), color: MyColours.color_515151), | ||
| 176 | + ), | ||
| 177 | + ), | ||
| 178 | + addDish | ||
| 179 | + ? Column( | ||
| 180 | + children: [ | ||
| 181 | + VEmptyView(24), | ||
| 182 | + Stack( | ||
| 183 | + alignment: Alignment.topCenter, | ||
| 184 | + children: [ | ||
| 185 | + ImgPickerInvitationWidget( | ||
| 186 | + scrollController: controller, | ||
| 187 | + model: _uploadImageProvider, | ||
| 188 | + index: 5, | ||
| 189 | + imageModel: | ||
| 190 | + _uploadImageProvider.storeImage1), | ||
| 191 | + Container( | ||
| 192 | + width: double.infinity, | ||
| 193 | + padding: EdgeInsets.only( | ||
| 194 | + left: w(26), top: w(16), bottom: w(16)), | ||
| 195 | + decoration: BoxDecoration( | ||
| 196 | + gradient: LinearGradient( | ||
| 197 | + stops: [0, 1], | ||
| 198 | + begin: Alignment.topCenter, | ||
| 199 | + end: Alignment.bottomCenter, | ||
| 200 | + colors: [ | ||
| 201 | + themColor, | ||
| 202 | + MyColours.color_4D0C0F0E, | ||
| 203 | + ], | ||
| 204 | + ), | ||
| 205 | + ), | ||
| 206 | + child: Column( | ||
| 207 | + crossAxisAlignment: | ||
| 208 | + CrossAxisAlignment.start, | ||
| 209 | + children: [ | ||
| 210 | + Text('Favorites', | ||
| 211 | + style: TextStyle( | ||
| 212 | + color: MyColours.color_B39437, | ||
| 213 | + fontSize: font(14))), | ||
| 214 | + Text('菜品展示', | ||
| 215 | + style: TextStyle( | ||
| 216 | + color: MyColours.color_B39437, | ||
| 217 | + fontSize: font(14))) | ||
| 218 | + ], | ||
| 219 | + ), | ||
| 220 | + ) | ||
| 221 | + ], | ||
| 222 | + ), | ||
| 223 | + VEmptyView(18), | ||
| 224 | + ImgPickerInvitationWidget( | ||
| 225 | + scrollController: controller, | ||
| 226 | + model: _uploadImageProvider, | ||
| 227 | + index: 6, | ||
| 228 | + imageModel: _uploadImageProvider.storeImage2), | ||
| 229 | + VEmptyView(18), | ||
| 230 | + ImgPickerInvitationWidget( | ||
| 231 | + scrollController: controller, | ||
| 232 | + model: _uploadImageProvider, | ||
| 233 | + index: 7, | ||
| 234 | + imageModel: _uploadImageProvider.storeImage3), | ||
| 235 | + VEmptyView(18), | ||
| 236 | + ], | ||
| 237 | + ) | ||
| 238 | + : SizedBox() | ||
| 239 | + ]))), | ||
| 164 | Container( | 240 | Container( |
| 165 | color: MyColours.color_ffffff, | 241 | color: MyColours.color_ffffff, |
| 166 | padding: EdgeInsets.only( | 242 | padding: EdgeInsets.only( |
| @@ -174,7 +250,48 @@ class _DishShowPageState extends State<DishShowPage> { | @@ -174,7 +250,48 @@ class _DishShowPageState extends State<DishShowPage> { | ||
| 174 | fontSize: 34, | 250 | fontSize: 34, |
| 175 | height: w(40), | 251 | height: w(40), |
| 176 | isBold: true, | 252 | isBold: true, |
| 177 | - onPressed: () {}, | 253 | + onPressed: () async { |
| 254 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 255 | + | ||
| 256 | + List<String> images = []; | ||
| 257 | + if (_uploadImageProvider.storeImage1.qiniuUrl != null && | ||
| 258 | + _uploadImageProvider.storeImage1.qiniuUrl != '') { | ||
| 259 | + images.add(_uploadImageProvider.storeImage1.qiniuUrl); | ||
| 260 | + } | ||
| 261 | + if (_uploadImageProvider.storeImage2.qiniuUrl != null && | ||
| 262 | + _uploadImageProvider.storeImage2.qiniuUrl != '') { | ||
| 263 | + images.add(_uploadImageProvider.storeImage2.qiniuUrl); | ||
| 264 | + } | ||
| 265 | + if (_uploadImageProvider.storeImage3.qiniuUrl != null && | ||
| 266 | + _uploadImageProvider.storeImage3.qiniuUrl != '') { | ||
| 267 | + images.add(_uploadImageProvider.storeImage3.qiniuUrl); | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + if (addDish && images.length == 0) { | ||
| 271 | + Utils.showToast('请至少上传一张图片!'); | ||
| 272 | + return false; | ||
| 273 | + } | ||
| 274 | + | ||
| 275 | + //接口 | ||
| 276 | + Map signboardData = { | ||
| 277 | + 'swich': addDish ? '1' : '0', | ||
| 278 | + 'images': json.encode(images) | ||
| 279 | + }; | ||
| 280 | + | ||
| 281 | + Map<String, String> params = { | ||
| 282 | + 'sid': Provider.of<UserModel>(context, listen: false) | ||
| 283 | + .user | ||
| 284 | + .sellerid, | ||
| 285 | + 'signboard': json.encode(signboardData) | ||
| 286 | + }; | ||
| 287 | + | ||
| 288 | + bool success = await marketingCenterProvider | ||
| 289 | + .setSellerTemplateConf(context, params, showLoading: true); | ||
| 290 | + if (success) { | ||
| 291 | + Utils.showToast('保存成功'); | ||
| 292 | + Navigator.pop(context); | ||
| 293 | + } | ||
| 294 | + }, | ||
| 178 | ), | 295 | ), |
| 179 | ) | 296 | ) |
| 180 | ])); | 297 | ])); |
| @@ -20,6 +20,7 @@ import '../../../../provider/user_model.dart'; | @@ -20,6 +20,7 @@ import '../../../../provider/user_model.dart'; | ||
| 20 | import '../../../../res/colors.dart'; | 20 | import '../../../../res/colors.dart'; |
| 21 | import '../../../../utils/screen_util.dart'; | 21 | import '../../../../utils/screen_util.dart'; |
| 22 | import '../../../../utils/upload_image_util.dart'; | 22 | import '../../../../utils/upload_image_util.dart'; |
| 23 | +import '../../../../widgets/MyDivider.dart'; | ||
| 23 | import '../../../../widgets/round_button.dart'; | 24 | import '../../../../widgets/round_button.dart'; |
| 24 | import '../../../online_check/photo_view_wiget.dart'; | 25 | import '../../../online_check/photo_view_wiget.dart'; |
| 25 | 26 | ||
| @@ -57,6 +58,12 @@ class _FirstImagePageState extends State<FirstImagePage> { | @@ -57,6 +58,12 @@ class _FirstImagePageState extends State<FirstImagePage> { | ||
| 57 | _initThemeColor(); | 58 | _initThemeColor(); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 61 | + @override | ||
| 62 | + void dispose() { | ||
| 63 | + _uploadImageProvider.firstImage = UploadImgModel(); | ||
| 64 | + super.dispose(); | ||
| 65 | + } | ||
| 66 | + | ||
| 60 | ///初始化主题颜色 | 67 | ///初始化主题颜色 |
| 61 | _initThemeColor() { | 68 | _initThemeColor() { |
| 62 | int colorValue = App.sp.get("themeColor"); | 69 | int colorValue = App.sp.get("themeColor"); |
| @@ -253,6 +260,118 @@ class _FirstImagePageState extends State<FirstImagePage> { | @@ -253,6 +260,118 @@ class _FirstImagePageState extends State<FirstImagePage> { | ||
| 253 | } | 260 | } |
| 254 | } | 261 | } |
| 255 | 262 | ||
| 263 | + ///添加图片UI弹出 | ||
| 264 | + Future _openModalBottomSheet(context) async { | ||
| 265 | + final option = await showModalBottomSheet( | ||
| 266 | + context: context, | ||
| 267 | + backgroundColor: Colors.transparent, | ||
| 268 | + isDismissible: false, | ||
| 269 | + builder: (BuildContext context) { | ||
| 270 | + return Container( | ||
| 271 | + // height: ScreenUtil().setWidth(180 * 2), | ||
| 272 | + decoration: BoxDecoration( | ||
| 273 | + color: MyColours.color_ffffff, | ||
| 274 | + borderRadius: BorderRadius.only( | ||
| 275 | + topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 276 | + topRight: Radius.circular(ScreenUtil().setWidth(24)))), | ||
| 277 | + child: Column( | ||
| 278 | + mainAxisSize: MainAxisSize.min, | ||
| 279 | + children: <Widget>[ | ||
| 280 | + InkWell( | ||
| 281 | + onTap: () { | ||
| 282 | + // Utils.getPickPermission(context, () { | ||
| 283 | + // _getFromPictureOrCamera( | ||
| 284 | + // _uploadImageProvider.firstImage, ImageSource.camera); | ||
| 285 | + | ||
| 286 | + // Navigator.pop(context); | ||
| 287 | + // }, Permission.camera); | ||
| 288 | + Utils.getPickPermission(context, () { | ||
| 289 | + _getFromPictureOrCamera( | ||
| 290 | + _uploadImageProvider.firstImage, ImageSource.camera); | ||
| 291 | + Navigator.pop(context); | ||
| 292 | + }, | ||
| 293 | + Platform.isAndroid | ||
| 294 | + ? Permission.storage | ||
| 295 | + : Permission.photos); | ||
| 296 | + }, | ||
| 297 | + child: Container( | ||
| 298 | + width: double.infinity, | ||
| 299 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 300 | + child: Center( | ||
| 301 | + child: Text( | ||
| 302 | + '拍摄', | ||
| 303 | + style: TextStyle( | ||
| 304 | + fontSize: ScreenUtil().setSp(32), | ||
| 305 | + color: MyColours.color_353535, | ||
| 306 | + fontWeight: FontWeight.bold), | ||
| 307 | + ), | ||
| 308 | + )), | ||
| 309 | + ), | ||
| 310 | + MyDivider( | ||
| 311 | + double.infinity, | ||
| 312 | + ScreenUtil().setWidth(2), | ||
| 313 | + color: MyColours.color_EEEEEE, | ||
| 314 | + ), | ||
| 315 | + InkWell( | ||
| 316 | + onTap: () { | ||
| 317 | + // Utils.getPickPermission(context, () { | ||
| 318 | + // // pickAsset(RequestType.image); | ||
| 319 | + // _getFromPictureOrCamera( | ||
| 320 | + // _uploadImageProvider.firstImage, ImageSource.gallery); | ||
| 321 | + // Navigator.pop(context); | ||
| 322 | + // }, | ||
| 323 | + // Platform.isAndroid | ||
| 324 | + // ? Permission.storage | ||
| 325 | + // : Permission.photos); | ||
| 326 | + Utils.getPickPermission(context, () { | ||
| 327 | + _getFromPictureOrCamera( | ||
| 328 | + _uploadImageProvider.firstImage, ImageSource.gallery); | ||
| 329 | + Navigator.pop(context); | ||
| 330 | + }, | ||
| 331 | + Platform.isAndroid | ||
| 332 | + ? Permission.storage | ||
| 333 | + : Permission.photos); | ||
| 334 | + }, | ||
| 335 | + child: Container( | ||
| 336 | + width: double.infinity, | ||
| 337 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 338 | + child: Center( | ||
| 339 | + child: Text( | ||
| 340 | + '从相册选择', | ||
| 341 | + style: TextStyle( | ||
| 342 | + fontSize: ScreenUtil().setSp(32), | ||
| 343 | + color: MyColours.color_353535, | ||
| 344 | + fontWeight: FontWeight.bold), | ||
| 345 | + ), | ||
| 346 | + )), | ||
| 347 | + ), | ||
| 348 | + MyDivider( | ||
| 349 | + double.infinity, | ||
| 350 | + ScreenUtil().setWidth(10), | ||
| 351 | + color: MyColours.color_EEEEEE, | ||
| 352 | + ), | ||
| 353 | + InkWell( | ||
| 354 | + onTap: () { | ||
| 355 | + Navigator.pop(context, '取消'); | ||
| 356 | + }, | ||
| 357 | + child: Container( | ||
| 358 | + width: double.infinity, | ||
| 359 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 360 | + child: Center( | ||
| 361 | + child: Text( | ||
| 362 | + '取消', | ||
| 363 | + style: TextStyle( | ||
| 364 | + fontSize: ScreenUtil().setSp(32), | ||
| 365 | + color: MyColours.color_353535, | ||
| 366 | + fontWeight: FontWeight.bold), | ||
| 367 | + ), | ||
| 368 | + ))) | ||
| 369 | + ], | ||
| 370 | + ), | ||
| 371 | + ); | ||
| 372 | + }); | ||
| 373 | + } | ||
| 374 | + | ||
| 256 | @override | 375 | @override |
| 257 | Widget build(BuildContext context) { | 376 | Widget build(BuildContext context) { |
| 258 | ThemeColorModel themeColerModel = themeColorData[themeColorIndex]; | 377 | ThemeColorModel themeColerModel = themeColorData[themeColorIndex]; |
| @@ -444,14 +563,15 @@ class _FirstImagePageState extends State<FirstImagePage> { | @@ -444,14 +563,15 @@ class _FirstImagePageState extends State<FirstImagePage> { | ||
| 444 | _uploadImageProvider.firstImage.qiniuUrl = null; | 563 | _uploadImageProvider.firstImage.qiniuUrl = null; |
| 445 | _uploadImageProvider.firstImage.process = 0; | 564 | _uploadImageProvider.firstImage.process = 0; |
| 446 | setState(() {}); | 565 | setState(() {}); |
| 447 | - Utils.getPickPermission(context, () { | ||
| 448 | - _getFromPictureOrCamera( | ||
| 449 | - _uploadImageProvider.firstImage, | ||
| 450 | - ImageSource.gallery); | ||
| 451 | - }, | ||
| 452 | - Platform.isAndroid | ||
| 453 | - ? Permission.storage | ||
| 454 | - : Permission.photos); | 566 | + _openModalBottomSheet(context); |
| 567 | + // Utils.getPickPermission(context, () { | ||
| 568 | + // _getFromPictureOrCamera( | ||
| 569 | + // _uploadImageProvider.firstImage, | ||
| 570 | + // ImageSource.gallery); | ||
| 571 | + // }, | ||
| 572 | + // Platform.isAndroid | ||
| 573 | + // ? Permission.storage | ||
| 574 | + // : Permission.photos); | ||
| 455 | } | 575 | } |
| 456 | }, | 576 | }, |
| 457 | child: | 577 | child: |
| @@ -539,14 +659,15 @@ class _FirstImagePageState extends State<FirstImagePage> { | @@ -539,14 +659,15 @@ class _FirstImagePageState extends State<FirstImagePage> { | ||
| 539 | // ///没有上传完成的不可以点击 | 659 | // ///没有上传完成的不可以点击 |
| 540 | // _showPhotoView(context, 0, tempList); | 660 | // _showPhotoView(context, 0, tempList); |
| 541 | // } else { | 661 | // } else { |
| 542 | - Utils.getPickPermission(context, () { | ||
| 543 | - _getFromPictureOrCamera( | ||
| 544 | - _uploadImageProvider.firstImage, | ||
| 545 | - ImageSource.gallery); | ||
| 546 | - }, | ||
| 547 | - Platform.isAndroid | ||
| 548 | - ? Permission.storage | ||
| 549 | - : Permission.photos); | 662 | + // Utils.getPickPermission(context, () { |
| 663 | + // _getFromPictureOrCamera( | ||
| 664 | + // _uploadImageProvider.firstImage, | ||
| 665 | + // ImageSource.gallery); | ||
| 666 | + // }, | ||
| 667 | + // Platform.isAndroid | ||
| 668 | + // ? Permission.storage | ||
| 669 | + // : Permission.photos); | ||
| 670 | + _openModalBottomSheet(context); | ||
| 550 | }, | 671 | }, |
| 551 | child: Container( | 672 | child: Container( |
| 552 | color: MyColours.color_d9d9d9, | 673 | color: MyColours.color_d9d9d9, |
| @@ -602,21 +723,13 @@ class _FirstImagePageState extends State<FirstImagePage> { | @@ -602,21 +723,13 @@ class _FirstImagePageState extends State<FirstImagePage> { | ||
| 602 | Utils.showToast('请输入店铺slogan!'); | 723 | Utils.showToast('请输入店铺slogan!'); |
| 603 | return false; | 724 | return false; |
| 604 | } | 725 | } |
| 605 | - if (_uploadImageProvider.firstImage.qiniuUrl == null) { | ||
| 606 | - Utils.showToast('请上传图片!'); | ||
| 607 | - return false; | ||
| 608 | - } | ||
| 609 | - | ||
| 610 | - if (_uploadImageProvider.firstImage.process < 1) { | ||
| 611 | - Utils.showToast('正在上传图片,请稍等'); | ||
| 612 | - return false; | ||
| 613 | - } | ||
| 614 | 726 | ||
| 615 | App.sp.setInt( | 727 | App.sp.setInt( |
| 616 | "themeColor", themeColorData[themeColorIndex].color.value); | 728 | "themeColor", themeColorData[themeColorIndex].color.value); |
| 617 | //接口 | 729 | //接口 |
| 618 | Map homeData = { | 730 | Map homeData = { |
| 619 | - 'theme_color': themeColorData[themeColorIndex].color.value, | 731 | + 'theme_color': |
| 732 | + themeColorData[themeColorIndex].color.value.toString(), | ||
| 620 | 'title': titleC.text, | 733 | 'title': titleC.text, |
| 621 | 'slogan': sloganC.text, | 734 | 'slogan': sloganC.text, |
| 622 | 'image': _uploadImageProvider.firstImage.qiniuUrl | 735 | 'image': _uploadImageProvider.firstImage.qiniuUrl |
| 1 | +import 'dart:convert'; | ||
| 2 | + | ||
| 3 | +import 'dart:io'; | ||
| 4 | +import 'dart:async'; | ||
| 5 | + | ||
| 6 | +import 'package:cached_network_image/cached_network_image.dart'; | ||
| 7 | +import 'package:flutter/material.dart'; | ||
| 8 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 9 | +import 'package:one_key/models/upload_img_model.dart'; | ||
| 10 | +import 'package:one_key/pages/online_check/photo_view_wiget.dart'; | ||
| 11 | +import 'package:one_key/pages/online_check/progress.dart'; | ||
| 12 | + | ||
| 13 | +import 'package:one_key/provider/online_check_edit_provider.dart'; | ||
| 14 | +import 'package:one_key/provider/upload_img_provider.dart'; | ||
| 15 | +import 'package:one_key/res/colors.dart'; | ||
| 16 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 17 | +import 'package:one_key/utils/misc.dart'; | ||
| 18 | +import 'package:one_key/utils/upload_image_util.dart'; | ||
| 19 | +import 'package:one_key/utils/utils.dart'; | ||
| 20 | +import 'package:one_key/widgets/MyDivider.dart'; | ||
| 21 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 22 | +import 'package:permission_handler/permission_handler.dart'; | ||
| 23 | +// import 'package:photo/photo.dart'; | ||
| 24 | +import 'package:provider/provider.dart'; | ||
| 25 | + | ||
| 26 | +import 'package:image_picker/image_picker.dart'; | ||
| 27 | +// import 'package:qiniu_flutter_sdk/qiniu_flutter_sdk.dart'; | ||
| 28 | +import 'package:qiniu_flutter_sdk_diox/qiniu_flutter_sdk_diox.dart'; | ||
| 29 | +import 'package:wechat_assets_picker/wechat_assets_picker.dart'; | ||
| 30 | +import '../../../../utils/screen_util.dart'; | ||
| 31 | +import '../../../online_check/dispose.dart'; | ||
| 32 | +import 'package:photo_manager/photo_manager.dart'; | ||
| 33 | +import 'package:flutter_native_image/flutter_native_image.dart'; | ||
| 34 | + | ||
| 35 | +typedef void OnPickImageCallback( | ||
| 36 | + double maxWidth, double maxHeight, int quality); | ||
| 37 | +typedef void DeleteCallback(int index); | ||
| 38 | + | ||
| 39 | +class ImgPickerInvitationWidget extends StatefulWidget { | ||
| 40 | + final ScrollController scrollController; | ||
| 41 | + final Color borderColor; | ||
| 42 | + final VoidCallback callback; | ||
| 43 | + final int maxImageNumber; | ||
| 44 | + final UploadImageProvider model; | ||
| 45 | + final UploadType uploadType; | ||
| 46 | + final DeleteCallback deleteCallback; | ||
| 47 | + final double size; | ||
| 48 | + final Color bgColor; | ||
| 49 | + final UploadImgModel imageModel; | ||
| 50 | + final int index; | ||
| 51 | + | ||
| 52 | + final EdgeInsets padding; | ||
| 53 | + ImgPickerInvitationWidget( | ||
| 54 | + {Key key, | ||
| 55 | + this.scrollController, | ||
| 56 | + this.borderColor = Colors.blue, | ||
| 57 | + this.callback, | ||
| 58 | + this.model, | ||
| 59 | + this.uploadType, | ||
| 60 | + this.deleteCallback, | ||
| 61 | + this.size = 100, | ||
| 62 | + this.bgColor = MyColours.color_f3f3f3, | ||
| 63 | + this.imageModel, | ||
| 64 | + this.padding = EdgeInsets.zero, | ||
| 65 | + this.maxImageNumber, | ||
| 66 | + this.index}) | ||
| 67 | + : super(key: key); | ||
| 68 | + | ||
| 69 | + @override | ||
| 70 | + _ImgPickerInvitationWidgetState createState() => | ||
| 71 | + _ImgPickerInvitationWidgetState(); | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +class _ImgPickerInvitationWidgetState | ||
| 75 | + extends DisposableState<ImgPickerInvitationWidget> { | ||
| 76 | + final picker = ImagePicker(); | ||
| 77 | + // OnlineCheckEditProvider _onlineCheckEditProvider; | ||
| 78 | + // UploadImageProvider _uploadImageProvider; | ||
| 79 | + | ||
| 80 | + // 用户输入的文件名 | ||
| 81 | + String key; | ||
| 82 | + // 用户输入的 partSize | ||
| 83 | + int partSize = 4; | ||
| 84 | + // 用户输入的 token | ||
| 85 | + String token; | ||
| 86 | + | ||
| 87 | + /// storage 实例 | ||
| 88 | + final Storage storage = Storage(); | ||
| 89 | + // 控制器,可以用于取消任务、获取上述的状态,进度等信息 | ||
| 90 | + // PutController putController = PutController(); | ||
| 91 | + // 当前的任务状态 | ||
| 92 | + | ||
| 93 | + @override | ||
| 94 | + void initState() { | ||
| 95 | + // storage = Storage(); | ||
| 96 | + // putController = PutController(); | ||
| 97 | + super.initState(); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @override | ||
| 101 | + void dispose() { | ||
| 102 | + super.dispose(); | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + ///#相机拍照,单图选择 | ||
| 106 | + Future _getFromPictureOrCamera(imageSource) async { | ||
| 107 | + final pickedFile = await picker.getImage(source: imageSource); | ||
| 108 | + setState(() { | ||
| 109 | + if (pickedFile != null) { | ||
| 110 | + widget.imageModel.file = File(pickedFile.path); | ||
| 111 | + widget.imageModel.process = 0.01; | ||
| 112 | + } else { | ||
| 113 | + print('No image selected.'); | ||
| 114 | + } | ||
| 115 | + }); | ||
| 116 | + if (pickedFile != null) { | ||
| 117 | + // if (title == '头像') { | ||
| 118 | + // _uploadImageProvider.imgSizeTouxiang = 76; | ||
| 119 | + // _uploadImageProvider.touxiang.qiniuUrl = null; | ||
| 120 | + // } else { | ||
| 121 | + // _uploadImageProvider.imgSizeErweima = 76; | ||
| 122 | + widget.imageModel.qiniuUrl = null; | ||
| 123 | + // } | ||
| 124 | + UploadImageUtil().startUploadOnly( | ||
| 125 | + context, File(pickedFile.path), widget.index, true, widget.model); | ||
| 126 | + } | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + // ///多图片选择 | ||
| 130 | + // void pickAsset(RequestType type, {List<AssetPathEntity> pathList}) async { | ||
| 131 | + // List<UploadImgModel> temp = []; | ||
| 132 | + // if (widget.uploadType == UploadType.InvitationStoreType) { | ||
| 133 | + // temp = widget.model.storeImageList; | ||
| 134 | + // } | ||
| 135 | + | ||
| 136 | + // List<AssetEntity> imgList = await AssetPicker.pickAssets(context, | ||
| 137 | + // pickerConfig: AssetPickerConfig( | ||
| 138 | + // maxAssets: widget.maxImageNumber - temp.length, | ||
| 139 | + // // selectedAssets: assets, | ||
| 140 | + // requestType: type, | ||
| 141 | + // themeColor: MyColours.color_199095)); | ||
| 142 | + | ||
| 143 | + // /// context is required, other params is optional. | ||
| 144 | + // // List<AssetEntity> imgList = await PhotoPicker.pickAsset( | ||
| 145 | + // // // BuildContext required | ||
| 146 | + // // context: context, | ||
| 147 | + | ||
| 148 | + // // /// The following are optional parameters. | ||
| 149 | + // // themeColor: MyColours.color_199095, | ||
| 150 | + // // // the title color and bottom color | ||
| 151 | + // // textColor: Colors.white, | ||
| 152 | + // // // text color | ||
| 153 | + // // padding: 1.0, | ||
| 154 | + // // // item padding | ||
| 155 | + // // dividerColor: Colors.grey, | ||
| 156 | + // // // divider color | ||
| 157 | + // // disableColor: Colors.grey.shade300, | ||
| 158 | + // // // the check box disable color | ||
| 159 | + // // itemRadio: 0.88, | ||
| 160 | + // // // the content item radio | ||
| 161 | + // // maxSelected: widget.maxImageNumber - temp.length, | ||
| 162 | + // // // max picker image count | ||
| 163 | + // // // provider: I18nProvider.english, | ||
| 164 | + // // provider: I18nProvider.chinese, | ||
| 165 | + // // // i18n provider ,default is chinese. , you can custom I18nProvider or use ENProvider() | ||
| 166 | + // // rowCount: 3, | ||
| 167 | + // // // item row count | ||
| 168 | + // // thumbSize: 150, | ||
| 169 | + // // // preview thumb size , default is 64 | ||
| 170 | + // // sortDelegate: SortDelegate.common, | ||
| 171 | + // // // default is common ,or you make custom delegate to sort your gallery | ||
| 172 | + // // checkBoxBuilderDelegate: DefaultCheckBoxBuilderDelegate( | ||
| 173 | + // // activeColor: MyColours.color_353535, | ||
| 174 | + // // unselectedColor: Colors.white, | ||
| 175 | + // // checkColor: MyColours.color_199095, | ||
| 176 | + // // ), | ||
| 177 | + // // // default is DefaultCheckBoxBuilderDelegate ,or you make custom delegate to create checkbox | ||
| 178 | + // // // loadingDelegate: this, | ||
| 179 | + // // // if you want to build custom loading widget,extends LoadingDelegate, [see example/lib/main.dart] | ||
| 180 | + // // badgeDelegate: const DurationBadgeDelegate(), | ||
| 181 | + // // // badgeDelegate to show badge widget | ||
| 182 | + // // pickType: type, | ||
| 183 | + // // photoPathList: pathList, | ||
| 184 | + // // ); | ||
| 185 | + // if (imgList == null || imgList.isEmpty) { | ||
| 186 | + // print("No pick item."); | ||
| 187 | + // return; | ||
| 188 | + // } else { | ||
| 189 | + // for (int i = 0; i < imgList.length; i++) { | ||
| 190 | + // var file = await imgList[i].file; | ||
| 191 | + // File compressedFile = await FlutterNativeImage.compressImage( | ||
| 192 | + // file.absolute.path, | ||
| 193 | + // quality: 50, | ||
| 194 | + // percentage: 50); | ||
| 195 | + // setState(() { | ||
| 196 | + // UploadImgModel imgModel = UploadImgModel(); | ||
| 197 | + // imgModel.file = compressedFile; | ||
| 198 | + // imgModel.process = 0.01; | ||
| 199 | + | ||
| 200 | + // temp.add(imgModel); | ||
| 201 | + // }); | ||
| 202 | + // UploadImageUtil().startUpload(context, File(file.absolute.path), | ||
| 203 | + // temp.length - 1, false, widget.model, widget.uploadType, | ||
| 204 | + // countAll: imgList.length, | ||
| 205 | + // callback: widget.callback, | ||
| 206 | + // feastRemarkXtImageList: temp); | ||
| 207 | + // // startUpload(File(file.absolute.path), | ||
| 208 | + // // _uploadImageProvider.imageList.length - 1, false); | ||
| 209 | + // } | ||
| 210 | + // } | ||
| 211 | + // } | ||
| 212 | + | ||
| 213 | + // ///上传到七牛云 | ||
| 214 | + // void startUpload(File selectedFile, int index, bool needInit) async { | ||
| 215 | + // final PutController putController = PutController(); | ||
| 216 | + // print(index); | ||
| 217 | + | ||
| 218 | + // // 添加状态监听 | ||
| 219 | + // putController.addStatusListener((StorageStatus status) { | ||
| 220 | + // print('状态变化: 当前任务状态:${status.toString()}'); | ||
| 221 | + // }); | ||
| 222 | + // // 添加整体进度监听 | ||
| 223 | + // putController.addProgressListener((percent) { | ||
| 224 | + // print('${index}任务进度变化:进度:${percent.toStringAsFixed(4)}'); | ||
| 225 | + // _uploadImageProvider.imageList[index].process = percent; | ||
| 226 | + // _uploadImageProvider.notifyListeners(); | ||
| 227 | + // }); | ||
| 228 | + // // 添加实际发送进度订阅 | ||
| 229 | + // putController.addSendProgressListener((percent) { | ||
| 230 | + // // _onlineCheckEditProvider.imageList[index].process = percent; | ||
| 231 | + // // setState(() {}); | ||
| 232 | + // print('${index}实际发送变化:进度:${percent.toStringAsFixed(4)}'); | ||
| 233 | + // }); | ||
| 234 | + // if (token == null || token == '') { | ||
| 235 | + // await _uploadImageProvider.getQiniuInfo(context, {}); | ||
| 236 | + // } | ||
| 237 | + // var usedToken = _uploadImageProvider.qiniuInfoSunModel.token; | ||
| 238 | + // if (usedToken == null || usedToken == '') { | ||
| 239 | + // print('token 不能为空'); | ||
| 240 | + // return; | ||
| 241 | + // } | ||
| 242 | + // print('开始上传文件'); | ||
| 243 | + // storage.putFile( | ||
| 244 | + // selectedFile, | ||
| 245 | + // usedToken, | ||
| 246 | + // options: PutOptions( | ||
| 247 | + // key: key, | ||
| 248 | + // partSize: partSize, | ||
| 249 | + // controller: putController, | ||
| 250 | + // ), | ||
| 251 | + // ) | ||
| 252 | + // ..then((PutResponse response) { | ||
| 253 | + // print('${index}上传已完成: 原始响应数据: ${jsonEncode(response.rawData)}'); | ||
| 254 | + // print('------------------------'); | ||
| 255 | + // String imgUrl = _uploadImageProvider.qiniuInfoSunModel.domain + | ||
| 256 | + // '/' + | ||
| 257 | + // response.rawData['key']; | ||
| 258 | + // _uploadImageProvider.imageList[index].process = 1; | ||
| 259 | + // _uploadImageProvider.imageList[index].qiniuUrl = imgUrl; | ||
| 260 | + // // 取消当前任务 | ||
| 261 | + // putController.cancel(); | ||
| 262 | + // // _image | ||
| 263 | + // _uploadImageProvider.notifyListeners(); | ||
| 264 | + // }) | ||
| 265 | + // ..catchError((dynamic error) { | ||
| 266 | + // if (error is StorageError) { | ||
| 267 | + // switch (error.type) { | ||
| 268 | + // case StorageErrorType.CONNECT_TIMEOUT: | ||
| 269 | + // print('发生错误: 连接超时'); | ||
| 270 | + // break; | ||
| 271 | + // case StorageErrorType.SEND_TIMEOUT: | ||
| 272 | + // print('发生错误: 发送数据超时'); | ||
| 273 | + // break; | ||
| 274 | + // case StorageErrorType.RECEIVE_TIMEOUT: | ||
| 275 | + // print('发生错误: 响应数据超时'); | ||
| 276 | + // break; | ||
| 277 | + // case StorageErrorType.RESPONSE: | ||
| 278 | + // print('发生错误: ${error.message}'); | ||
| 279 | + // break; | ||
| 280 | + // case StorageErrorType.CANCEL: | ||
| 281 | + // print('发生错误: 请求取消'); | ||
| 282 | + // break; | ||
| 283 | + // case StorageErrorType.UNKNOWN: | ||
| 284 | + // print('发生错误: 未知错误'); | ||
| 285 | + // break; | ||
| 286 | + // case StorageErrorType.NO_AVAILABLE_HOST: | ||
| 287 | + // print('发生错误: 无可用 Host'); | ||
| 288 | + // break; | ||
| 289 | + // case StorageErrorType.IN_PROGRESS: | ||
| 290 | + // print('发生错误: 已在队列中'); | ||
| 291 | + // break; | ||
| 292 | + // } | ||
| 293 | + // } else { | ||
| 294 | + // print('发生错误: ${error.toString()}'); | ||
| 295 | + // } | ||
| 296 | + | ||
| 297 | + // print('------------------------'); | ||
| 298 | + // }); | ||
| 299 | + // } | ||
| 300 | + | ||
| 301 | + ///添加图片UI弹出 | ||
| 302 | + Future _openModalBottomSheet(context) async { | ||
| 303 | + final option = await showModalBottomSheet( | ||
| 304 | + context: context, | ||
| 305 | + backgroundColor: Colors.transparent, | ||
| 306 | + isDismissible: false, | ||
| 307 | + builder: (BuildContext context) { | ||
| 308 | + return Container( | ||
| 309 | + // height: ScreenUtil().setWidth(180 * 2), | ||
| 310 | + decoration: BoxDecoration( | ||
| 311 | + color: MyColours.color_ffffff, | ||
| 312 | + borderRadius: BorderRadius.only( | ||
| 313 | + topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 314 | + topRight: Radius.circular(ScreenUtil().setWidth(24)))), | ||
| 315 | + child: Column( | ||
| 316 | + mainAxisSize: MainAxisSize.min, | ||
| 317 | + children: <Widget>[ | ||
| 318 | + InkWell( | ||
| 319 | + onTap: () { | ||
| 320 | + Utils.getPickPermission(context, () { | ||
| 321 | + _getFromPictureOrCamera(ImageSource.camera); | ||
| 322 | + Navigator.pop(context); | ||
| 323 | + }, Permission.camera); | ||
| 324 | + }, | ||
| 325 | + child: Container( | ||
| 326 | + width: double.infinity, | ||
| 327 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 328 | + child: Center( | ||
| 329 | + child: Text( | ||
| 330 | + '拍摄', | ||
| 331 | + style: TextStyle( | ||
| 332 | + fontSize: ScreenUtil().setSp(32), | ||
| 333 | + color: MyColours.color_353535, | ||
| 334 | + fontWeight: FontWeight.bold), | ||
| 335 | + ), | ||
| 336 | + )), | ||
| 337 | + ), | ||
| 338 | + MyDivider( | ||
| 339 | + double.infinity, | ||
| 340 | + ScreenUtil().setWidth(2), | ||
| 341 | + color: MyColours.color_EEEEEE, | ||
| 342 | + ), | ||
| 343 | + InkWell( | ||
| 344 | + onTap: () { | ||
| 345 | + Utils.getPickPermission(context, () { | ||
| 346 | + // pickAsset(RequestType.image); | ||
| 347 | + _getFromPictureOrCamera(ImageSource.gallery); | ||
| 348 | + Navigator.pop(context); | ||
| 349 | + }, | ||
| 350 | + Platform.isAndroid | ||
| 351 | + ? Permission.storage | ||
| 352 | + : Permission.photos); | ||
| 353 | + }, | ||
| 354 | + child: Container( | ||
| 355 | + width: double.infinity, | ||
| 356 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 357 | + child: Center( | ||
| 358 | + child: Text( | ||
| 359 | + '从相册选择', | ||
| 360 | + style: TextStyle( | ||
| 361 | + fontSize: ScreenUtil().setSp(32), | ||
| 362 | + color: MyColours.color_353535, | ||
| 363 | + fontWeight: FontWeight.bold), | ||
| 364 | + ), | ||
| 365 | + )), | ||
| 366 | + ), | ||
| 367 | + MyDivider( | ||
| 368 | + double.infinity, | ||
| 369 | + ScreenUtil().setWidth(10), | ||
| 370 | + color: MyColours.color_EEEEEE, | ||
| 371 | + ), | ||
| 372 | + InkWell( | ||
| 373 | + onTap: () { | ||
| 374 | + Navigator.pop(context, '取消'); | ||
| 375 | + }, | ||
| 376 | + child: Container( | ||
| 377 | + width: double.infinity, | ||
| 378 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 379 | + child: Center( | ||
| 380 | + child: Text( | ||
| 381 | + '取消', | ||
| 382 | + style: TextStyle( | ||
| 383 | + fontSize: ScreenUtil().setSp(32), | ||
| 384 | + color: MyColours.color_353535, | ||
| 385 | + fontWeight: FontWeight.bold), | ||
| 386 | + ), | ||
| 387 | + ))) | ||
| 388 | + ], | ||
| 389 | + ), | ||
| 390 | + ); | ||
| 391 | + }); | ||
| 392 | + } | ||
| 393 | + | ||
| 394 | + //查看大图 | ||
| 395 | + _showPhotoView(BuildContext context, int index, List<String> imgs, | ||
| 396 | + {isShow = false, List dashName}) async { | ||
| 397 | + // if (imgs.length == 1 && | ||
| 398 | + // imgs[0] == | ||
| 399 | + // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') { | ||
| 400 | + // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png'; | ||
| 401 | + // } | ||
| 402 | + Utils.setBarStatus(false, color: Colors.black); | ||
| 403 | + dynamic result = await showGeneralDialog( | ||
| 404 | + context: context, | ||
| 405 | + barrierDismissible: false, | ||
| 406 | + // barrierColor: Colors.red, | ||
| 407 | + barrierLabel: | ||
| 408 | + MaterialLocalizations.of(context).modalBarrierDismissLabel, | ||
| 409 | + transitionDuration: const Duration(milliseconds: 150), | ||
| 410 | + pageBuilder: (BuildContext context, Animation animation, | ||
| 411 | + Animation secondaryAnimation) { | ||
| 412 | + Widget child = Stack( | ||
| 413 | + children: <Widget>[ | ||
| 414 | + PhotoPreview( | ||
| 415 | + initialIndex: index, | ||
| 416 | + photoList: imgs, | ||
| 417 | + isShow: isShow, | ||
| 418 | + dashName: dashName) | ||
| 419 | + ], | ||
| 420 | + ); | ||
| 421 | + return child; | ||
| 422 | + }); | ||
| 423 | + Utils.setBarStatus(true, color: Colors.white); | ||
| 424 | + } | ||
| 425 | + | ||
| 426 | + @override | ||
| 427 | + Widget build(BuildContext context) { | ||
| 428 | + // _uploadImageProvider = | ||
| 429 | + // Provider.of<UploadImageProvider>(context, listen: true); | ||
| 430 | + // List<UploadImgModel> temp = []; | ||
| 431 | + // if (widget.uploadType == UploadType.InvitationStoreType) { | ||
| 432 | + // temp = widget.model.storeImageList; | ||
| 433 | + // } | ||
| 434 | + | ||
| 435 | + return _getGridImg( | ||
| 436 | + // temp.length < widget.maxImageNumber ? temp.length + 1 : temp.length, | ||
| 437 | + context, | ||
| 438 | + | ||
| 439 | + // temp.length == widget.maxImageNumber ? true : false, | ||
| 440 | + widget.imageModel); | ||
| 441 | + } | ||
| 442 | + | ||
| 443 | + /// 九宫格 | ||
| 444 | + Widget _getGridImg(context, UploadImgModel imageModel) { | ||
| 445 | + return imageModel.file != null || | ||
| 446 | + (imageModel.qiniuUrl != null && imageModel.qiniuUrl != '') | ||
| 447 | + ? InkWell( | ||
| 448 | + onTap: () { | ||
| 449 | + double process; | ||
| 450 | + String qiniuUrl; | ||
| 451 | + | ||
| 452 | + // if (title == '头像') { | ||
| 453 | + process = widget.imageModel.process; | ||
| 454 | + qiniuUrl = widget.imageModel.qiniuUrl; | ||
| 455 | + // } else { | ||
| 456 | + // process = _uploadImageProvider.erweima.process; | ||
| 457 | + // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl; | ||
| 458 | + // } | ||
| 459 | + | ||
| 460 | + if (qiniuUrl != null && qiniuUrl != '') { | ||
| 461 | + FocusScope.of(context).requestFocus(FocusNode()); | ||
| 462 | + _openModalBottomSheet(context); | ||
| 463 | + } | ||
| 464 | + | ||
| 465 | + ///没有上传完成的不可以点击 | ||
| 466 | + // _showPhotoView( | ||
| 467 | + // context, index, widget.model.storeImageList); | ||
| 468 | + // } | ||
| 469 | + // } | ||
| 470 | + }, | ||
| 471 | + child: Stack(alignment: Alignment.bottomCenter, children: [ | ||
| 472 | + Stack(clipBehavior: Clip.none, children: [ | ||
| 473 | + imageModel.qiniuUrl != null && imageModel.qiniuUrl != '' | ||
| 474 | + ? Image.network( | ||
| 475 | + imageModel.qiniuUrl, | ||
| 476 | + fit: BoxFit.cover, | ||
| 477 | + width: double.infinity, | ||
| 478 | + // width: ScreenUtil() | ||
| 479 | + // .setWidth(imgSize * 2), | ||
| 480 | + height: ScreenUtil().setWidth(281 * 2), | ||
| 481 | + ) | ||
| 482 | + : Image.file( | ||
| 483 | + imageModel.file, | ||
| 484 | + fit: BoxFit.cover, | ||
| 485 | + width: double.infinity, | ||
| 486 | + // width: ScreenUtil() | ||
| 487 | + // .setWidth(imgSize * 2), | ||
| 488 | + height: ScreenUtil().setWidth(281 * 2), | ||
| 489 | + ), | ||
| 490 | + Positioned( | ||
| 491 | + left: 0, | ||
| 492 | + top: 0, | ||
| 493 | + child: (imageModel.file != null) && | ||
| 494 | + imageModel.process != 1 && | ||
| 495 | + imageModel.process != 0.01 | ||
| 496 | + ? Container( | ||
| 497 | + width: ScreenUtil().screenWidth, | ||
| 498 | + height: w(281), | ||
| 499 | + color: MyColours.color_4D000000, | ||
| 500 | + child: Center( | ||
| 501 | + child: Text('上传中', | ||
| 502 | + style: | ||
| 503 | + TextStyle(color: MyColours.color_F8F9FD)), | ||
| 504 | + ), | ||
| 505 | + ) | ||
| 506 | + : Container()), | ||
| 507 | + // Offstage( | ||
| 508 | + // offstage: imageModel.process < 1, | ||
| 509 | + // child: Align( | ||
| 510 | + // alignment: Alignment.topRight, | ||
| 511 | + // child: GestureDetector( | ||
| 512 | + // child: Image.asset( | ||
| 513 | + // Utils.getImgPath("f_delete"), | ||
| 514 | + // width: ScreenUtil().setWidth(40), | ||
| 515 | + // height: ScreenUtil().setWidth(40), | ||
| 516 | + // ), | ||
| 517 | + // onTap: () { | ||
| 518 | + // // if (widget.uploadType == | ||
| 519 | + // // UploadType.TableManagerType) { | ||
| 520 | + // // if (imageModel.isUpload) { | ||
| 521 | + // // //已经传到服务器,弹提醒窗口,是否删除 | ||
| 522 | + // // //修改之前有内容,则弹框 | ||
| 523 | + // // DialogUtil.cupertinoAlertDialog(context, | ||
| 524 | + // // title: "确认删除", | ||
| 525 | + // // content: "是否确定删除该照片,删除操作不可逆转,请谨慎操作", | ||
| 526 | + // // lCallback: () { | ||
| 527 | + // // print("取消"); | ||
| 528 | + // // }, rCallback: () { | ||
| 529 | + // // print("确定"); | ||
| 530 | + // // widget.deleteCallback(index); | ||
| 531 | + // // }); | ||
| 532 | + // // } else { | ||
| 533 | + // // //直接删除 | ||
| 534 | + // // setState(() { | ||
| 535 | + // // temp.removeWhere((element) => | ||
| 536 | + // // element == imageModel); | ||
| 537 | + // // }); | ||
| 538 | + // // } | ||
| 539 | + // // } else { | ||
| 540 | + // // //点击删除按钮 | ||
| 541 | + // // setState(() { | ||
| 542 | + // // temp.removeWhere((element) => | ||
| 543 | + // // element == imageModel); | ||
| 544 | + // // widget.model.storeImageList.removeWhere( | ||
| 545 | + // // (element) => | ||
| 546 | + // // element == | ||
| 547 | + // // widget.model.storeImageList[index]); | ||
| 548 | + // // }); | ||
| 549 | + // // } | ||
| 550 | + // }, | ||
| 551 | + // )), | ||
| 552 | + // ), | ||
| 553 | + ]), | ||
| 554 | + imageModel.process == 1 | ||
| 555 | + ? Container( | ||
| 556 | + width: w(150), | ||
| 557 | + height: w(30), | ||
| 558 | + color: MyColours.color_4D000000, | ||
| 559 | + alignment: Alignment.center, | ||
| 560 | + child: Text( | ||
| 561 | + '点击图片可以更换', | ||
| 562 | + style: TextStyle( | ||
| 563 | + color: MyColours.color_F8F9FD, | ||
| 564 | + fontSize: font(14), | ||
| 565 | + fontWeight: FontWeight.bold), | ||
| 566 | + )) | ||
| 567 | + : SizedBox(), | ||
| 568 | + ])) | ||
| 569 | + : InkWell( | ||
| 570 | + onTap: () { | ||
| 571 | + // if (imageModel.process == 1) { | ||
| 572 | + // widget.model.storeImageList = []; | ||
| 573 | + // if (imageModel.qiniuUrl != null) { | ||
| 574 | + // for (int i = 0; i < temp.length; i++) { | ||
| 575 | + // widget.model.storeImageList.add(temp[i].qiniuUrl); | ||
| 576 | + // } | ||
| 577 | + FocusScope.of(context).requestFocus(FocusNode()); | ||
| 578 | + _openModalBottomSheet(context); | ||
| 579 | + | ||
| 580 | + ///没有上传完成的不可以点击 | ||
| 581 | + // _showPhotoView( | ||
| 582 | + // // context, index, widget.model.storeImageList); | ||
| 583 | + // } | ||
| 584 | + // } | ||
| 585 | + }, | ||
| 586 | + child: Container( | ||
| 587 | + color: MyColours.color_d9d9d9, | ||
| 588 | + width: double.infinity, | ||
| 589 | + height: w(281), | ||
| 590 | + child: Column( | ||
| 591 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 592 | + children: [ | ||
| 593 | + // VEmptyView(80), | ||
| 594 | + Image.asset( | ||
| 595 | + Utils.getImgPath('add_img'), | ||
| 596 | + width: w(63), | ||
| 597 | + ), | ||
| 598 | + VEmptyView(28), | ||
| 599 | + Container( | ||
| 600 | + width: w(139), | ||
| 601 | + height: w(60), | ||
| 602 | + child: Text( | ||
| 603 | + '点击上传照片\n为了更好的效果\n建议上传4:3照片', | ||
| 604 | + textAlign: TextAlign.center, | ||
| 605 | + style: TextStyle( | ||
| 606 | + height: 1.4, | ||
| 607 | + color: MyColours.color_ffffff, | ||
| 608 | + fontSize: font(14), | ||
| 609 | + fontWeight: FontWeight.bold), | ||
| 610 | + )) | ||
| 611 | + ], | ||
| 612 | + ), | ||
| 613 | + )); | ||
| 614 | + | ||
| 615 | + // //Widget Function(BuildContext context, int index) | ||
| 616 | + // var linjie = widget.maxImageNumber; | ||
| 617 | + // if (isLinjie) { | ||
| 618 | + // linjie = widget.maxImageNumber - 1; | ||
| 619 | + // } | ||
| 620 | + // if (index == count - 1 && index < linjie) { | ||
| 621 | + // return InkWell( | ||
| 622 | + // onTap: () { | ||
| 623 | + | ||
| 624 | + // }, | ||
| 625 | + // child: Container( | ||
| 626 | + // width: ScreenUtil().setWidth((widget.size - 20) * 2), | ||
| 627 | + // height: ScreenUtil().setWidth((widget.size - 20) * 2), | ||
| 628 | + // decoration: BoxDecoration( | ||
| 629 | + // color: widget.bgColor, | ||
| 630 | + // borderRadius: BorderRadius.circular(r(5)) | ||
| 631 | + // // border: Border.all( | ||
| 632 | + // // color: MyColours.color_E0E0E0, | ||
| 633 | + // // width: ScreenUtil().setWidth(2)), | ||
| 634 | + // ), | ||
| 635 | + // child: Column( | ||
| 636 | + // mainAxisAlignment: MainAxisAlignment.center, | ||
| 637 | + // children: [ | ||
| 638 | + // // VEmptyView(46), | ||
| 639 | + // Image.asset( | ||
| 640 | + // Utils.getImgPath('f_add_image'), | ||
| 641 | + // width: ScreenUtil().setWidth(64), | ||
| 642 | + // height: ScreenUtil().setWidth(64), | ||
| 643 | + // ), | ||
| 644 | + // // VEmptyView(10), | ||
| 645 | + // // Text( | ||
| 646 | + // // '上传照片', | ||
| 647 | + // // style: TextStyle( | ||
| 648 | + // // fontSize: ScreenUtil().setSp(24), | ||
| 649 | + // // color: MyColours.color_999999), | ||
| 650 | + // // ) | ||
| 651 | + // ], | ||
| 652 | + // )), | ||
| 653 | + // ); | ||
| 654 | + // } | ||
| 655 | + // return temp.length < 1 | ||
| 656 | + // ? Text('') | ||
| 657 | + // : InkWell( | ||
| 658 | + // onTap: () { | ||
| 659 | + // if ( imageModel.process == 1) { | ||
| 660 | + // widget.model.storeImageList = []; | ||
| 661 | + // if ( imageModel.qiniuUrl != null) { | ||
| 662 | + // for (int i = 0; i < temp.length; i++) { | ||
| 663 | + // widget.model.storeImageList.add(temp[i].qiniuUrl); | ||
| 664 | + // } | ||
| 665 | + | ||
| 666 | + // ///没有上传完成的不可以点击 | ||
| 667 | + // _showPhotoView( | ||
| 668 | + // context, index, widget.model.storeImageList); | ||
| 669 | + // } | ||
| 670 | + // } | ||
| 671 | + // }, | ||
| 672 | + // child: Stack( | ||
| 673 | + // children: [ | ||
| 674 | + // Stack( | ||
| 675 | + // // alignment: Alignment.topRight, | ||
| 676 | + // children: [ | ||
| 677 | + // imageModel.file != null | ||
| 678 | + // ? Container( | ||
| 679 | + // child: ClipRRect( | ||
| 680 | + // borderRadius: BorderRadius.circular(r(5)), | ||
| 681 | + // child: Image.file( | ||
| 682 | + // imageModel.file, | ||
| 683 | + // fit: BoxFit.cover, | ||
| 684 | + // width: | ||
| 685 | + // ScreenUtil().setWidth(widget.size * 2), | ||
| 686 | + // height: | ||
| 687 | + // ScreenUtil().setWidth(widget.size * 2), | ||
| 688 | + // ), | ||
| 689 | + // )) | ||
| 690 | + // : ClipRRect( | ||
| 691 | + // borderRadius: BorderRadius.circular(r(5)), | ||
| 692 | + // child: CachedNetworkImage( | ||
| 693 | + // imageUrl: imageModel.qiniuUrl, | ||
| 694 | + // fit: BoxFit.cover, | ||
| 695 | + // width: | ||
| 696 | + // ScreenUtil().setWidth(widget.size * 2), | ||
| 697 | + // height: | ||
| 698 | + // ScreenUtil().setWidth(widget.size * 2), | ||
| 699 | + // ), | ||
| 700 | + // ), | ||
| 701 | + | ||
| 702 | + // ], | ||
| 703 | + // ), | ||
| 704 | + // Offstage( | ||
| 705 | + // offstage: imageModel.process == 1, | ||
| 706 | + // child: Progress( | ||
| 707 | + // imageModel.process, | ||
| 708 | + // size: widget.size, | ||
| 709 | + // ), | ||
| 710 | + // ) | ||
| 711 | + // ], | ||
| 712 | + // )); | ||
| 713 | + // }); | ||
| 714 | + // } | ||
| 715 | +// } | ||
| 716 | + } | ||
| 717 | +} |
| 1 | +import 'dart:io'; | ||
| 2 | + | ||
| 3 | +import 'package:flutter/material.dart'; | ||
| 4 | +import 'package:flutter_easyrefresh/easy_refresh.dart'; | ||
| 5 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
| 6 | +import 'package:one_key/constant/state.dart'; | ||
| 7 | +import 'package:one_key/pages/coupon/coupon_item.dart'; | ||
| 8 | +import 'package:one_key/provider/SmsModel.dart'; | ||
| 9 | +import 'package:one_key/provider/coupon_provider.dart'; | ||
| 10 | +import 'package:one_key/provider/user_model.dart'; | ||
| 11 | +import 'package:one_key/res/colors.dart'; | ||
| 12 | +import 'package:one_key/utils/dialog_util.dart'; | ||
| 13 | +import 'package:one_key/utils/event_bus.dart'; | ||
| 14 | +import 'package:one_key/route/navigator_util.dart'; | ||
| 15 | +import 'package:one_key/utils/utils.dart'; | ||
| 16 | +import 'package:one_key/widgets/h_empty_view.dart'; | ||
| 17 | +import 'package:one_key/widgets/page_exception.dart'; | ||
| 18 | +import 'package:one_key/widgets/round_button.dart'; | ||
| 19 | +import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 20 | +import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 21 | +import 'package:provider/provider.dart'; | ||
| 22 | +import 'package:sendsms/sendsms.dart'; | ||
| 23 | +// import 'package:sendsms/sendsms.dart'; | ||
| 24 | +import 'package:flutter_sms/flutter_sms.dart'; | ||
| 25 | + | ||
| 26 | +/** | ||
| 27 | + * 优惠券单选页面 | ||
| 28 | + */ | ||
| 29 | +class MarkingCouponSelectPage extends StatefulWidget { | ||
| 30 | + MarkingCouponSelectPage({Key key}) : super(key: key); | ||
| 31 | + | ||
| 32 | + @override | ||
| 33 | + _MarkingCouponSelectPageState createState() => | ||
| 34 | + _MarkingCouponSelectPageState(); | ||
| 35 | +} | ||
| 36 | + | ||
| 37 | +class _MarkingCouponSelectPageState extends State<MarkingCouponSelectPage> { | ||
| 38 | + EasyRefreshController _controller = EasyRefreshController(); | ||
| 39 | + CouponProvider couponProvider; | ||
| 40 | + | ||
| 41 | + ///获取优惠券列表数据(status == 1) | ||
| 42 | + | ||
| 43 | + _couponNetworkData({bool isShowLoading = true}) async { | ||
| 44 | + Map<String, String> params = { | ||
| 45 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 46 | + }; | ||
| 47 | + params['status'] = '1'; | ||
| 48 | + | ||
| 49 | + await couponProvider.getCustomerSelectActivityMarking(context, params, | ||
| 50 | + isShowLoading: isShowLoading); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @override | ||
| 54 | + void initState() { | ||
| 55 | + // TODO: implement initState | ||
| 56 | + super.initState(); | ||
| 57 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 58 | + // if (!couponProvider.hasModify) { | ||
| 59 | + _couponNetworkData(); | ||
| 60 | + // } else { | ||
| 61 | + // couponProvider.pageStateSelect = PageState.Success; | ||
| 62 | + // // couponProvider.notifyListeners(); | ||
| 63 | + // } | ||
| 64 | + }); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @override | ||
| 68 | + void dispose() { | ||
| 69 | + super.dispose(); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @override | ||
| 73 | + Widget build(BuildContext context) { | ||
| 74 | + couponProvider = Provider.of<CouponProvider>(context, listen: true); | ||
| 75 | + return Scaffold( | ||
| 76 | + backgroundColor: MyColours.color_ffffff, | ||
| 77 | + appBar: SystemAppBar( | ||
| 78 | + '优惠券', | ||
| 79 | + onTap: () { | ||
| 80 | + Navigator.pop(context); | ||
| 81 | + }, | ||
| 82 | + ), | ||
| 83 | + body: WillPopScope( | ||
| 84 | + child: Column( | ||
| 85 | + children: [ | ||
| 86 | + Expanded(child: Consumer<CouponProvider>( | ||
| 87 | + builder: (context, model, _) { | ||
| 88 | + if (model.pageStateSelect != PageState.Success) { | ||
| 89 | + return ExceptionPage( | ||
| 90 | + pageState: model.pageStateSelect, | ||
| 91 | + callback: () { | ||
| 92 | + _couponNetworkData(); | ||
| 93 | + // offset = 0; | ||
| 94 | + // getMessage(showLoading: true); | ||
| 95 | + }, | ||
| 96 | + emptyMsg: "暂时没有列表信息哦", | ||
| 97 | + emptyImg: "empty_search", | ||
| 98 | + showMsg: "加载中,请稍后...", | ||
| 99 | + ); | ||
| 100 | + } else { | ||
| 101 | + return EasyRefresh.custom( | ||
| 102 | + controller: _controller, | ||
| 103 | + shrinkWrap: true, | ||
| 104 | + slivers: [ | ||
| 105 | + SliverList( | ||
| 106 | + delegate: SliverChildBuilderDelegate( | ||
| 107 | + (BuildContext context, int index) { | ||
| 108 | + return VEmptyView(40); | ||
| 109 | + }, childCount: 1), | ||
| 110 | + ), | ||
| 111 | + SliverList( | ||
| 112 | + delegate: SliverChildBuilderDelegate( | ||
| 113 | + (BuildContext context, int index) { | ||
| 114 | + return InkWell( | ||
| 115 | + onTap: () { | ||
| 116 | + //改这里 ******8 | ||
| 117 | + couponProvider.couponListSelect | ||
| 118 | + .forEach((element) { | ||
| 119 | + element.isCheck = false; | ||
| 120 | + }); | ||
| 121 | + | ||
| 122 | + couponProvider.couponListSelect[index].isCheck = | ||
| 123 | + true; | ||
| 124 | + }, | ||
| 125 | + // child: Row( | ||
| 126 | + // children: [ | ||
| 127 | + // HEmptyView(30), | ||
| 128 | + // !widget.hasModify | ||
| 129 | + // ? Checkbox( | ||
| 130 | + // value: couponProvider | ||
| 131 | + // .couponListSelect[index].isCheck, | ||
| 132 | + // checkColor: MyColours.color_ffffff, | ||
| 133 | + // activeColor: MyColours.app_main, | ||
| 134 | + // onChanged: (bool value) {}, | ||
| 135 | + // ) | ||
| 136 | + // : Container(), | ||
| 137 | + // Image.asset( | ||
| 138 | + // couponProvider.listData[index]['checked'] | ||
| 139 | + // ? 'assets/select.png' | ||
| 140 | + // : 'assets/unselect.png', | ||
| 141 | + // width: ScreenUtil().setWidth(44)), | ||
| 142 | + child: CouponItem( | ||
| 143 | + from: 'select', | ||
| 144 | + showCheck: true, | ||
| 145 | + couponSonModel: | ||
| 146 | + couponProvider.couponListSelect[index], | ||
| 147 | + onPressed: () { | ||
| 148 | + // bool old = couponProvider | ||
| 149 | + // .couponListSelect[index].isCheck; | ||
| 150 | + //改这里 ******8 | ||
| 151 | + couponProvider.couponListSelect | ||
| 152 | + .forEach((element) { | ||
| 153 | + element.isCheck = false; | ||
| 154 | + }); | ||
| 155 | + | ||
| 156 | + couponProvider | ||
| 157 | + .couponListSelect[index].isCheck = true; | ||
| 158 | + | ||
| 159 | + // couponProvider | ||
| 160 | + // .couponListSelect[index].isCheck = !old; | ||
| 161 | + setState(() {}); | ||
| 162 | + })); | ||
| 163 | + }, childCount: couponProvider.couponListSelect.length), | ||
| 164 | + ) | ||
| 165 | + ], | ||
| 166 | + // onRefresh: () async { | ||
| 167 | + // // offset = 0; | ||
| 168 | + // // getMessage(showLoading: false); | ||
| 169 | + // }, | ||
| 170 | + // onLoad: () async { | ||
| 171 | + // // offset++; | ||
| 172 | + // // getMessage(showLoading: false); | ||
| 173 | + // }, | ||
| 174 | + ); | ||
| 175 | + } | ||
| 176 | + }, | ||
| 177 | + )), | ||
| 178 | + VEmptyView(20), | ||
| 179 | + couponProvider.pageStateSelect == PageState.Success | ||
| 180 | + ? Padding( | ||
| 181 | + padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0, | ||
| 182 | + ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)), | ||
| 183 | + child: RoundButton( | ||
| 184 | + onPressed: () async { | ||
| 185 | + Navigator.pop(context); | ||
| 186 | + }, | ||
| 187 | + text: '确定', | ||
| 188 | + fontSize: 34, | ||
| 189 | + isBold: false, | ||
| 190 | + height: ScreenUtil().setWidth(80), | ||
| 191 | + width: double.infinity, | ||
| 192 | + radius: ScreenUtil().setWidth(10), | ||
| 193 | + )) | ||
| 194 | + : Container() | ||
| 195 | + ], | ||
| 196 | + ), | ||
| 197 | + onWillPop: () async { | ||
| 198 | + Utils.changeStatusColor(color: Colors.transparent); | ||
| 199 | + Navigator.of(context).pop(); | ||
| 200 | + return true; | ||
| 201 | + }, | ||
| 202 | + ), | ||
| 203 | + ); | ||
| 204 | + } | ||
| 205 | +} |
| 1 | +import 'dart:convert'; | ||
| 2 | +import 'dart:io'; | ||
| 3 | + | ||
| 1 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 6 | +import 'package:image_picker/image_picker.dart'; | ||
| 3 | import 'package:one_key/utils/utils.dart'; | 7 | import 'package:one_key/utils/utils.dart'; |
| 4 | import 'package:one_key/widgets/h_empty_view.dart'; | 8 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 5 | import 'package:one_key/widgets/v_empty_view.dart'; | 9 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 10 | +import 'package:permission_handler/permission_handler.dart'; | ||
| 6 | import 'package:provider/provider.dart'; | 11 | import 'package:provider/provider.dart'; |
| 7 | 12 | ||
| 13 | +import '../../../../models/upload_img_model.dart'; | ||
| 14 | +import '../../../../provider/coupon_provider.dart'; | ||
| 15 | +import '../../../../provider/marketing_center_provider.dart'; | ||
| 16 | +import '../../../../provider/upload_img_provider.dart'; | ||
| 8 | import '../../../../provider/user_model.dart'; | 17 | import '../../../../provider/user_model.dart'; |
| 9 | import '../../../../res/colors.dart'; | 18 | import '../../../../res/colors.dart'; |
| 19 | +import '../../../../route/navigator_util.dart'; | ||
| 10 | import '../../../../utils/screen_util.dart'; | 20 | import '../../../../utils/screen_util.dart'; |
| 21 | +import '../../../../utils/upload_image_util.dart'; | ||
| 22 | +import '../../../../widgets/MyDivider.dart'; | ||
| 11 | import '../../../../widgets/round_button.dart'; | 23 | import '../../../../widgets/round_button.dart'; |
| 12 | import '../../../../widgets/system_app_bar.dart'; | 24 | import '../../../../widgets/system_app_bar.dart'; |
| 13 | 25 | ||
| @@ -25,50 +37,221 @@ class MarkingInteractionPage extends StatefulWidget { | @@ -25,50 +37,221 @@ class MarkingInteractionPage extends StatefulWidget { | ||
| 25 | class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | 37 | class _MarkingInteractionPageState extends State<MarkingInteractionPage> { |
| 26 | TextEditingController welcomeTextC = TextEditingController(); //欢迎语 | 38 | TextEditingController welcomeTextC = TextEditingController(); //欢迎语 |
| 27 | FocusNode welcomeTextNode = FocusNode(); // | 39 | FocusNode welcomeTextNode = FocusNode(); // |
| 40 | + CouponProvider couponProvider; | ||
| 41 | + final picker = ImagePicker(); | ||
| 42 | + | ||
| 43 | + UploadImageProvider _uploadImageProvider; | ||
| 44 | + MarketingCenterProvider marketingCenterProvider; | ||
| 45 | + bool is_transpond = false; //转发邀请函 | ||
| 46 | + bool is_arrival = false; //确认到店 | ||
| 47 | + bool is_online_book = false; //在线预订 | ||
| 48 | + bool is_order = false; //提前点餐 | ||
| 49 | + bool is_link = false; //充值优惠活动链接 | ||
| 50 | + | ||
| 28 | @override | 51 | @override |
| 29 | void initState() { | 52 | void initState() { |
| 30 | super.initState(); | 53 | super.initState(); |
| 54 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 55 | + // _couponNetworkData(); | ||
| 56 | + }); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @override | ||
| 60 | + void dispose() { | ||
| 61 | + _uploadImageProvider.firstImage = UploadImgModel(); | ||
| 62 | + super.dispose(); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + ///获取优惠券列表数据(status == 1) | ||
| 66 | + | ||
| 67 | + _couponNetworkData({bool isShowLoading = true}) async { | ||
| 68 | + Map<String, String> params = { | ||
| 69 | + "uid": Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 70 | + }; | ||
| 71 | + params['status'] = '1'; | ||
| 72 | + | ||
| 73 | + await couponProvider.getCustomerSelectActivityMarking(context, params, | ||
| 74 | + isShowLoading: isShowLoading); | ||
| 31 | } | 75 | } |
| 32 | 76 | ||
| 33 | ///客户互动及店铺推广 | 77 | ///客户互动及店铺推广 |
| 34 | - Widget _storeItemWidget(String title, String content, {bool select = false}) { | ||
| 35 | - return Container( | ||
| 36 | - margin: EdgeInsets.only(top: w(12), left: w(32)), | ||
| 37 | - padding: EdgeInsets.only(bottom: w(16)), | ||
| 38 | - decoration: BoxDecoration( | ||
| 39 | - border: Border( | ||
| 40 | - bottom: | ||
| 41 | - BorderSide(width: w(0.5), color: MyColours.color_E7E7E7))), | ||
| 42 | - child: Column( | ||
| 43 | - children: [ | ||
| 44 | - Row( | 78 | + Widget _storeItemWidget(String title, String content, |
| 79 | + {bool select = false, GestureTapCallback onTap}) { | ||
| 80 | + return InkWell( | ||
| 81 | + onTap: onTap, | ||
| 82 | + child: Container( | ||
| 83 | + margin: EdgeInsets.only(top: w(12), left: w(32)), | ||
| 84 | + padding: EdgeInsets.only(bottom: w(16)), | ||
| 85 | + decoration: BoxDecoration( | ||
| 86 | + border: Border( | ||
| 87 | + bottom: BorderSide( | ||
| 88 | + width: w(0.5), color: MyColours.color_E7E7E7))), | ||
| 89 | + child: Column( | ||
| 45 | children: [ | 90 | children: [ |
| 46 | - Image.asset( | ||
| 47 | - Utils.getImgPath(select ? 'f_select' : 'f_select_not'), | ||
| 48 | - width: w(20), | 91 | + Row( |
| 92 | + children: [ | ||
| 93 | + Image.asset( | ||
| 94 | + Utils.getImgPath(select ? 'f_select' : 'f_select_not'), | ||
| 95 | + width: w(20), | ||
| 96 | + ), | ||
| 97 | + HEmptyView(20), | ||
| 98 | + Text( | ||
| 99 | + title, | ||
| 100 | + style: TextStyle( | ||
| 101 | + fontSize: font(14), color: MyColours.color_515151), | ||
| 102 | + ) | ||
| 103 | + ], | ||
| 49 | ), | 104 | ), |
| 50 | - HEmptyView(20), | ||
| 51 | - Text( | ||
| 52 | - title, | ||
| 53 | - style: TextStyle( | ||
| 54 | - fontSize: font(14), color: MyColours.color_515151), | 105 | + VEmptyView(20), |
| 106 | + Padding( | ||
| 107 | + padding: EdgeInsets.symmetric(horizontal: w(16)), | ||
| 108 | + child: Text( | ||
| 109 | + content, | ||
| 110 | + style: TextStyle( | ||
| 111 | + height: 1.5, | ||
| 112 | + fontSize: font(14), | ||
| 113 | + color: MyColours.color_515151), | ||
| 114 | + ), | ||
| 55 | ) | 115 | ) |
| 56 | ], | 116 | ], |
| 57 | ), | 117 | ), |
| 58 | - VEmptyView(20), | ||
| 59 | - Padding( | ||
| 60 | - padding: EdgeInsets.symmetric(horizontal: w(16)), | ||
| 61 | - child: Text( | ||
| 62 | - content, | ||
| 63 | - style: TextStyle( | ||
| 64 | - height: 1.5, | ||
| 65 | - fontSize: font(14), | ||
| 66 | - color: MyColours.color_515151), | 118 | + )); |
| 119 | + } | ||
| 120 | + | ||
| 121 | + ///#相机拍照,单图选择 | ||
| 122 | + Future _getFromPictureOrCamera(UploadImgModel imgModel, imageSource) async { | ||
| 123 | + final pickedFile = await picker.getImage(source: imageSource); | ||
| 124 | + setState(() { | ||
| 125 | + if (pickedFile != null) { | ||
| 126 | + imgModel.file = File(pickedFile.path); | ||
| 127 | + imgModel.process = 0.01; | ||
| 128 | + } else { | ||
| 129 | + print('No image selected.'); | ||
| 130 | + } | ||
| 131 | + }); | ||
| 132 | + if (pickedFile != null) { | ||
| 133 | + // if (title == '头像') { | ||
| 134 | + // _uploadImageProvider.imgSizeTouxiang = 76; | ||
| 135 | + // _uploadImageProvider.touxiang.qiniuUrl = null; | ||
| 136 | + // } else { | ||
| 137 | + // _uploadImageProvider.imgSizeErweima = 76; | ||
| 138 | + _uploadImageProvider.firstImage.qiniuUrl = null; | ||
| 139 | + // } | ||
| 140 | + UploadImageUtil().startUploadOnly( | ||
| 141 | + context, File(pickedFile.path), 4, true, _uploadImageProvider); | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + ///添加图片UI弹出 | ||
| 146 | + Future _openModalBottomSheet(context) async { | ||
| 147 | + final option = await showModalBottomSheet( | ||
| 148 | + context: context, | ||
| 149 | + backgroundColor: Colors.transparent, | ||
| 150 | + isDismissible: false, | ||
| 151 | + builder: (BuildContext context) { | ||
| 152 | + return Container( | ||
| 153 | + // height: ScreenUtil().setWidth(180 * 2), | ||
| 154 | + decoration: BoxDecoration( | ||
| 155 | + color: MyColours.color_ffffff, | ||
| 156 | + borderRadius: BorderRadius.only( | ||
| 157 | + topLeft: Radius.circular(ScreenUtil().setWidth(24)), | ||
| 158 | + topRight: Radius.circular(ScreenUtil().setWidth(24)))), | ||
| 159 | + child: Column( | ||
| 160 | + mainAxisSize: MainAxisSize.min, | ||
| 161 | + children: <Widget>[ | ||
| 162 | + InkWell( | ||
| 163 | + onTap: () { | ||
| 164 | + // Utils.getPickPermission(context, () { | ||
| 165 | + // _getFromPictureOrCamera( | ||
| 166 | + // _uploadImageProvider.firstImage, ImageSource.camera); | ||
| 167 | + | ||
| 168 | + // Navigator.pop(context); | ||
| 169 | + // }, Permission.camera); | ||
| 170 | + Utils.getPickPermission(context, () { | ||
| 171 | + _getFromPictureOrCamera( | ||
| 172 | + _uploadImageProvider.firstImage, ImageSource.camera); | ||
| 173 | + Navigator.pop(context); | ||
| 174 | + }, | ||
| 175 | + Platform.isAndroid | ||
| 176 | + ? Permission.storage | ||
| 177 | + : Permission.photos); | ||
| 178 | + }, | ||
| 179 | + child: Container( | ||
| 180 | + width: double.infinity, | ||
| 181 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 182 | + child: Center( | ||
| 183 | + child: Text( | ||
| 184 | + '拍摄', | ||
| 185 | + style: TextStyle( | ||
| 186 | + fontSize: ScreenUtil().setSp(32), | ||
| 187 | + color: MyColours.color_353535, | ||
| 188 | + fontWeight: FontWeight.bold), | ||
| 189 | + ), | ||
| 190 | + )), | ||
| 191 | + ), | ||
| 192 | + MyDivider( | ||
| 193 | + double.infinity, | ||
| 194 | + ScreenUtil().setWidth(2), | ||
| 195 | + color: MyColours.color_EEEEEE, | ||
| 196 | + ), | ||
| 197 | + InkWell( | ||
| 198 | + onTap: () { | ||
| 199 | + // Utils.getPickPermission(context, () { | ||
| 200 | + // // pickAsset(RequestType.image); | ||
| 201 | + // _getFromPictureOrCamera( | ||
| 202 | + // _uploadImageProvider.firstImage, ImageSource.gallery); | ||
| 203 | + // Navigator.pop(context); | ||
| 204 | + // }, | ||
| 205 | + // Platform.isAndroid | ||
| 206 | + // ? Permission.storage | ||
| 207 | + // : Permission.photos); | ||
| 208 | + Utils.getPickPermission(context, () { | ||
| 209 | + _getFromPictureOrCamera( | ||
| 210 | + _uploadImageProvider.firstImage, ImageSource.gallery); | ||
| 211 | + Navigator.pop(context); | ||
| 212 | + }, | ||
| 213 | + Platform.isAndroid | ||
| 214 | + ? Permission.storage | ||
| 215 | + : Permission.photos); | ||
| 216 | + }, | ||
| 217 | + child: Container( | ||
| 218 | + width: double.infinity, | ||
| 219 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 220 | + child: Center( | ||
| 221 | + child: Text( | ||
| 222 | + '从相册选择', | ||
| 223 | + style: TextStyle( | ||
| 224 | + fontSize: ScreenUtil().setSp(32), | ||
| 225 | + color: MyColours.color_353535, | ||
| 226 | + fontWeight: FontWeight.bold), | ||
| 227 | + ), | ||
| 228 | + )), | ||
| 229 | + ), | ||
| 230 | + MyDivider( | ||
| 231 | + double.infinity, | ||
| 232 | + ScreenUtil().setWidth(10), | ||
| 233 | + color: MyColours.color_EEEEEE, | ||
| 234 | + ), | ||
| 235 | + InkWell( | ||
| 236 | + onTap: () { | ||
| 237 | + Navigator.pop(context, '取消'); | ||
| 238 | + }, | ||
| 239 | + child: Container( | ||
| 240 | + width: double.infinity, | ||
| 241 | + height: ScreenUtil().setWidth(58 * 2), | ||
| 242 | + child: Center( | ||
| 243 | + child: Text( | ||
| 244 | + '取消', | ||
| 245 | + style: TextStyle( | ||
| 246 | + fontSize: ScreenUtil().setSp(32), | ||
| 247 | + color: MyColours.color_353535, | ||
| 248 | + fontWeight: FontWeight.bold), | ||
| 249 | + ), | ||
| 250 | + ))) | ||
| 251 | + ], | ||
| 67 | ), | 252 | ), |
| 68 | - ) | ||
| 69 | - ], | ||
| 70 | - ), | ||
| 71 | - ); | 253 | + ); |
| 254 | + }); | ||
| 72 | } | 255 | } |
| 73 | 256 | ||
| 74 | ///标题 | 257 | ///标题 |
| @@ -197,52 +380,182 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -197,52 +380,182 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 197 | ///营销推广 | 380 | ///营销推广 |
| 198 | Widget _markingOtherItem({VoidCallback onPressed, bool select = false}) { | 381 | Widget _markingOtherItem({VoidCallback onPressed, bool select = false}) { |
| 199 | return Container( | 382 | return Container( |
| 383 | + color: MyColours.color_ffffff, | ||
| 200 | margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)), | 384 | margin: EdgeInsets.only(left: w(21), top: w(12), right: w(21)), |
| 201 | child: Column(children: [ | 385 | child: Column(children: [ |
| 202 | - Row( | ||
| 203 | - children: [ | ||
| 204 | - Image.asset( | ||
| 205 | - Utils.getImgPath(select ? 'f_select' : 'f_select_not'), | ||
| 206 | - width: w(20), | ||
| 207 | - ), | ||
| 208 | - HEmptyView(20), | ||
| 209 | - Text( | ||
| 210 | - '推荐店内充值优惠活动链接', | ||
| 211 | - style: TextStyle( | ||
| 212 | - fontSize: font(14), color: MyColours.color_515151), | ||
| 213 | - ) | ||
| 214 | - ], | ||
| 215 | - ), | 386 | + InkWell( |
| 387 | + onTap: () { | ||
| 388 | + setState(() { | ||
| 389 | + is_link = !is_link; | ||
| 390 | + }); | ||
| 391 | + }, | ||
| 392 | + child: Row( | ||
| 393 | + children: [ | ||
| 394 | + Image.asset( | ||
| 395 | + Utils.getImgPath(is_link ? 'f_select' : 'f_select_not'), | ||
| 396 | + width: w(20), | ||
| 397 | + ), | ||
| 398 | + HEmptyView(20), | ||
| 399 | + Text( | ||
| 400 | + '推荐店内充值优惠活动链接', | ||
| 401 | + style: TextStyle( | ||
| 402 | + fontSize: font(14), color: MyColours.color_515151), | ||
| 403 | + ) | ||
| 404 | + ], | ||
| 405 | + )), | ||
| 216 | VEmptyView(24), | 406 | VEmptyView(24), |
| 217 | Container( | 407 | Container( |
| 218 | - height: w(180), | ||
| 219 | - child: true | ||
| 220 | - ? Image.network( | ||
| 221 | - 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg', | ||
| 222 | - fit: BoxFit.contain, | ||
| 223 | - ) | ||
| 224 | - : Column( | ||
| 225 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 226 | - children: [ | ||
| 227 | - Image.asset( | ||
| 228 | - Utils.getImgPath('add_img_grey'), | ||
| 229 | - width: w(63), | ||
| 230 | - ), | ||
| 231 | - VEmptyView(28), | ||
| 232 | - Padding( | ||
| 233 | - padding: EdgeInsets.symmetric( | ||
| 234 | - vertical: w(10), | ||
| 235 | - ), | ||
| 236 | - child: Text( | ||
| 237 | - '点击上传餐厅logo', | ||
| 238 | - style: TextStyle( | ||
| 239 | - color: MyColours.color_999999, | ||
| 240 | - fontSize: font(14), | ||
| 241 | - fontWeight: FontWeight.bold), | 408 | + height: w(180), |
| 409 | + child: _uploadImageProvider.firstImage.file != null || | ||
| 410 | + (_uploadImageProvider.firstImage.qiniuUrl != null && | ||
| 411 | + _uploadImageProvider.firstImage.qiniuUrl != '') | ||
| 412 | + ? InkWell( | ||
| 413 | + onTap: () { | ||
| 414 | + double process; | ||
| 415 | + String qiniuUrl; | ||
| 416 | + List<String> tempList = []; | ||
| 417 | + // if (title == '头像') { | ||
| 418 | + process = _uploadImageProvider.firstImage.process; | ||
| 419 | + qiniuUrl = _uploadImageProvider.firstImage.qiniuUrl; | ||
| 420 | + // } else { | ||
| 421 | + // process = _uploadImageProvider.erweima.process; | ||
| 422 | + // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl; | ||
| 423 | + // } | ||
| 424 | + | ||
| 425 | + if (qiniuUrl != null && qiniuUrl != '') { | ||
| 426 | + // tempList.add(qiniuUrl); | ||
| 427 | + | ||
| 428 | + // ///没有上传完成的不可以点击 | ||
| 429 | + // _showPhotoView(context, 0, tempList); | ||
| 430 | + | ||
| 431 | + _uploadImageProvider.firstImage.qiniuUrl = null; | ||
| 432 | + _uploadImageProvider.firstImage.process = 0; | ||
| 433 | + setState(() {}); | ||
| 434 | + _openModalBottomSheet(context); | ||
| 435 | + // Utils.getPickPermission(context, () { | ||
| 436 | + // _getFromPictureOrCamera( | ||
| 437 | + // _uploadImageProvider.firstImage, | ||
| 438 | + // ImageSource.gallery); | ||
| 439 | + // }, | ||
| 440 | + // Platform.isAndroid | ||
| 441 | + // ? Permission.storage | ||
| 442 | + // : Permission.photos); | ||
| 443 | + } | ||
| 444 | + }, | ||
| 445 | + child: Stack(alignment: Alignment.bottomCenter, children: [ | ||
| 446 | + Stack(clipBehavior: Clip.none, children: [ | ||
| 447 | + _uploadImageProvider.firstImage.qiniuUrl != null && | ||
| 448 | + _uploadImageProvider.firstImage.qiniuUrl != '' | ||
| 449 | + ? Image.network( | ||
| 450 | + _uploadImageProvider.firstImage.qiniuUrl, | ||
| 451 | + fit: BoxFit.cover, | ||
| 452 | + width: double.infinity, | ||
| 453 | + // width: ScreenUtil() | ||
| 454 | + // .setWidth(imgSize * 2), | ||
| 455 | + height: w(180), | ||
| 456 | + ) | ||
| 457 | + : Image.file( | ||
| 458 | + _uploadImageProvider.firstImage.file, | ||
| 459 | + fit: BoxFit.cover, | ||
| 460 | + width: double.infinity, | ||
| 461 | + // width: ScreenUtil() | ||
| 462 | + // .setWidth(imgSize * 2), | ||
| 463 | + height: w(180), | ||
| 464 | + ), | ||
| 465 | + Positioned( | ||
| 466 | + left: 0, | ||
| 467 | + top: 0, | ||
| 468 | + right: 0, | ||
| 469 | + child: (_uploadImageProvider.firstImage.file != | ||
| 470 | + null) && | ||
| 471 | + _uploadImageProvider.firstImage.process != | ||
| 472 | + 1 && | ||
| 473 | + _uploadImageProvider.firstImage.process != | ||
| 474 | + 0.01 | ||
| 475 | + ? Container( | ||
| 476 | + width: ScreenUtil().screenWidth, | ||
| 477 | + height: w(180), | ||
| 478 | + color: MyColours.color_4D000000, | ||
| 479 | + child: Center( | ||
| 480 | + child: Text('上传中', | ||
| 481 | + style: TextStyle( | ||
| 482 | + color: MyColours.color_F8F9FD)), | ||
| 483 | + ), | ||
| 484 | + ) | ||
| 485 | + : Container()), | ||
| 486 | + ]), | ||
| 487 | + _uploadImageProvider.firstImage.process == 1 | ||
| 488 | + ? Container( | ||
| 489 | + width: w(150), | ||
| 490 | + height: w(30), | ||
| 491 | + color: MyColours.color_4D000000, | ||
| 492 | + alignment: Alignment.center, | ||
| 493 | + child: Text( | ||
| 494 | + '点击图片可以更换', | ||
| 495 | + style: TextStyle( | ||
| 496 | + color: MyColours.color_F8F9FD, | ||
| 497 | + fontSize: font(14), | ||
| 498 | + fontWeight: FontWeight.bold), | ||
| 499 | + )) | ||
| 500 | + : SizedBox(), | ||
| 501 | + ])) | ||
| 502 | + : InkWell( | ||
| 503 | + onTap: () { | ||
| 504 | + // double process; | ||
| 505 | + // String qiniuUrl; | ||
| 506 | + // List<String> tempList = []; | ||
| 507 | + // if (title == '头像') { | ||
| 508 | + // process = _uploadImageProvider.touxiang.process; | ||
| 509 | + // qiniuUrl = _uploadImageProvider.touxiang.qiniuUrl; | ||
| 510 | + // } else { | ||
| 511 | + // process = _uploadImageProvider.erweima.process; | ||
| 512 | + // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl; | ||
| 513 | + // } | ||
| 514 | + | ||
| 515 | + // if (qiniuUrl != null && qiniuUrl != '') { | ||
| 516 | + // tempList.add(qiniuUrl); | ||
| 517 | + | ||
| 518 | + // ///没有上传完成的不可以点击 | ||
| 519 | + // _showPhotoView(context, 0, tempList); | ||
| 520 | + // } else { | ||
| 521 | + // Utils.getPickPermission(context, () { | ||
| 522 | + // _getFromPictureOrCamera( | ||
| 523 | + // _uploadImageProvider.firstImage, | ||
| 524 | + // ImageSource.gallery); | ||
| 525 | + // }, | ||
| 526 | + // Platform.isAndroid | ||
| 527 | + // ? Permission.storage | ||
| 528 | + // : Permission.photos); | ||
| 529 | + _openModalBottomSheet(context); | ||
| 530 | + }, | ||
| 531 | + child: Container( | ||
| 532 | + // color: MyColours.color_d9d9d9, | ||
| 533 | + width: double.infinity, | ||
| 534 | + height: w(180), | ||
| 535 | + child: Column( | ||
| 536 | + mainAxisAlignment: MainAxisAlignment.center, | ||
| 537 | + children: [ | ||
| 538 | + Image.asset( | ||
| 539 | + Utils.getImgPath('add_img_grey'), | ||
| 540 | + width: w(63), | ||
| 242 | ), | 541 | ), |
| 243 | - ) | ||
| 244 | - ], | 542 | + VEmptyView(28), |
| 543 | + Padding( | ||
| 544 | + padding: EdgeInsets.symmetric( | ||
| 545 | + vertical: w(10), | ||
| 546 | + ), | ||
| 547 | + child: Text( | ||
| 548 | + '点击上传餐厅logo', | ||
| 549 | + style: TextStyle( | ||
| 550 | + color: MyColours.color_999999, | ||
| 551 | + fontSize: font(14), | ||
| 552 | + fontWeight: FontWeight.bold), | ||
| 553 | + ), | ||
| 554 | + ) | ||
| 555 | + ], | ||
| 556 | + ), | ||
| 245 | )), | 557 | )), |
| 558 | + ), | ||
| 246 | Container( | 559 | Container( |
| 247 | width: double.infinity, | 560 | width: double.infinity, |
| 248 | alignment: Alignment.center, | 561 | alignment: Alignment.center, |
| @@ -322,6 +635,12 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -322,6 +635,12 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 322 | 635 | ||
| 323 | @override | 636 | @override |
| 324 | Widget build(BuildContext context) { | 637 | Widget build(BuildContext context) { |
| 638 | + couponProvider = Provider.of<CouponProvider>(context, listen: true); | ||
| 639 | + _uploadImageProvider = | ||
| 640 | + Provider.of<UploadImageProvider>(context, listen: true); | ||
| 641 | + marketingCenterProvider = | ||
| 642 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 643 | + | ||
| 325 | return Scaffold( | 644 | return Scaffold( |
| 326 | backgroundColor: MyColours.color_ffffff, | 645 | backgroundColor: MyColours.color_ffffff, |
| 327 | appBar: SystemAppBar( | 646 | appBar: SystemAppBar( |
| @@ -338,24 +657,50 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -338,24 +657,50 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 338 | children: [ | 657 | children: [ |
| 339 | _headItem('客户互动及店铺推广'), | 658 | _headItem('客户互动及店铺推广'), |
| 340 | _storeItemWidget('允许顾客转发邀请函给同行客人。', | 659 | _storeItemWidget('允许顾客转发邀请函给同行客人。', |
| 341 | - '同行客人可以从电子邀请函了解预订信息、一键导航到店,快速联系餐厅服务人员。还可以了解更多餐厅介绍、各种活动。'), | 660 | + '同行客人可以从电子邀请函了解预订信息、一键导航到店,快速联系餐厅服务人员。还可以了解更多餐厅介绍、各种活动。', |
| 661 | + onTap: () { | ||
| 662 | + setState(() { | ||
| 663 | + is_transpond = !is_transpond; | ||
| 664 | + }); | ||
| 665 | + }, select: is_transpond), | ||
| 342 | _storeItemWidget('向被邀请客人开放“确认到店”功能。', | 666 | _storeItemWidget('向被邀请客人开放“确认到店”功能。', |
| 343 | - '被邀客人点击确认到店后,方便请客人了解被邀客人是否确认,同时,被邀客人的信息会加入到餐厅客户池中,方便餐厅维护客户。'), | 667 | + '被邀客人点击确认到店后,方便请客人了解被邀客人是否确认,同时,被邀客人的信息会加入到餐厅客户池中,方便餐厅维护客户。', |
| 668 | + onTap: () { | ||
| 669 | + setState(() { | ||
| 670 | + is_arrival = !is_arrival; | ||
| 671 | + }); | ||
| 672 | + }, select: is_arrival), | ||
| 344 | _storeItemWidget('向客人开放“在线预订”功能。', | 673 | _storeItemWidget('向客人开放“在线预订”功能。', |
| 345 | - '客人和被邀客人可以通过邀请函,直接点击在线预订,向商家提交预订需求,无需通过电话,经理可以详细了解客户需求并安排预订。'), | 674 | + '客人和被邀客人可以通过邀请函,直接点击在线预订,向商家提交预订需求,无需通过电话,经理可以详细了解客户需求并安排预订。', |
| 675 | + onTap: () { | ||
| 676 | + setState(() { | ||
| 677 | + is_online_book = !is_online_book; | ||
| 678 | + }); | ||
| 679 | + }, select: is_online_book), | ||
| 346 | _storeItemWidget('向被邀请客人开放“提前点餐”功能。', | 680 | _storeItemWidget('向被邀请客人开放“提前点餐”功能。', |
| 347 | - '请客人从预定安排直接预先选菜,到店后确认下单,无需服务员花费时间给客户点餐,可以为餐厅节源提效。'), | 681 | + '请客人从预定安排直接预先选菜,到店后确认下单,无需服务员花费时间给客户点餐,可以为餐厅节源提效。', |
| 682 | + onTap: () { | ||
| 683 | + setState(() { | ||
| 684 | + is_order = !is_order; | ||
| 685 | + }); | ||
| 686 | + }, select: is_order), | ||
| 348 | VEmptyView(24), | 687 | VEmptyView(24), |
| 349 | _headItem('预订安排中附带的营销推广'), | 688 | _headItem('预订安排中附带的营销推广'), |
| 350 | VEmptyView(24), | 689 | VEmptyView(24), |
| 351 | - _markingItem('推荐店内代金券优惠', '200元代金券', '周一到周五可用,消费满600元可用一张。', | ||
| 352 | - '100', '5折'), | ||
| 353 | - _markingItem( | ||
| 354 | - '推荐店内充值单一优惠活动', | ||
| 355 | - '充1000赠300', | ||
| 356 | - '会员充值满1000元赠余额200元;\n会员充值满1000元赠余额200元;\n会员充值满1000元赠余额200元;', | ||
| 357 | - '', | ||
| 358 | - ''), | 690 | + // couponProvider.couponListSelect.length > 0 |
| 691 | + // ? _markingItem('推荐店内代金券优惠', couponProvider.couponListSelect[0].aname, | ||
| 692 | + // couponProvider.couponListSelect[0].desc, '100', '5折', onPressed: () { | ||
| 693 | + // NavigatorUtil.goMarkingCouponSelectPage( | ||
| 694 | + // context, | ||
| 695 | + // ); | ||
| 696 | + // }) | ||
| 697 | + // : SizedBox(), | ||
| 698 | + // _markingItem( | ||
| 699 | + // '推荐店内充值单一优惠活动', | ||
| 700 | + // '充1000赠300', | ||
| 701 | + // '会员充值满1000元赠余额200元;\n会员充值满1000元赠余额200元;\n会员充值满1000元赠余额200元;', | ||
| 702 | + // '', | ||
| 703 | + // ''), | ||
| 359 | _markingOtherItem() | 704 | _markingOtherItem() |
| 360 | ], | 705 | ], |
| 361 | ), | 706 | ), |
| @@ -373,7 +718,47 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | @@ -373,7 +718,47 @@ class _MarkingInteractionPageState extends State<MarkingInteractionPage> { | ||
| 373 | fontSize: 34, | 718 | fontSize: 34, |
| 374 | height: w(40), | 719 | height: w(40), |
| 375 | isBold: true, | 720 | isBold: true, |
| 376 | - onPressed: () {}, | 721 | + onPressed: () async { |
| 722 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 723 | + if (_uploadImageProvider.firstImage.qiniuUrl == null) { | ||
| 724 | + Utils.showToast('请上传餐厅logo!'); | ||
| 725 | + return false; | ||
| 726 | + } | ||
| 727 | + | ||
| 728 | + if (_uploadImageProvider.firstImage.process < 1) { | ||
| 729 | + Utils.showToast('正在上传餐厅logo!,请稍等'); | ||
| 730 | + return false; | ||
| 731 | + } | ||
| 732 | + if (welcomeTextC.text.trim().length == 0) { | ||
| 733 | + Utils.showToast('请输入输入餐厅欢迎语!'); | ||
| 734 | + return false; | ||
| 735 | + } | ||
| 736 | + | ||
| 737 | + //接口 | ||
| 738 | + Map marketingData = { | ||
| 739 | + 'is_transpond': is_transpond ? '1' : '0', | ||
| 740 | + 'is_arrival': is_arrival ? '1' : '0', | ||
| 741 | + 'is_online_book': is_online_book ? '1' : '0', | ||
| 742 | + 'is_order': is_order ? '1' : '0', | ||
| 743 | + 'is_link': is_link ? '1' : '0', | ||
| 744 | + 'wecomle': welcomeTextC.text, | ||
| 745 | + 'logo': _uploadImageProvider.firstImage.qiniuUrl, | ||
| 746 | + }; | ||
| 747 | + Map<String, String> params = { | ||
| 748 | + 'sid': Provider.of<UserModel>(context, listen: false) | ||
| 749 | + .user | ||
| 750 | + .sellerid, | ||
| 751 | + 'marketing': json.encode(marketingData) | ||
| 752 | + }; | ||
| 753 | + | ||
| 754 | + bool success = await marketingCenterProvider | ||
| 755 | + .setSellerTemplateConf(context, params, | ||
| 756 | + showLoading: true); | ||
| 757 | + if (success) { | ||
| 758 | + Utils.showToast('保存成功'); | ||
| 759 | + Navigator.pop(context); | ||
| 760 | + } | ||
| 761 | + }, | ||
| 377 | ), | 762 | ), |
| 378 | ) | 763 | ) |
| 379 | ], | 764 | ], |
| 1 | +import 'dart:convert'; | ||
| 2 | +import 'dart:io'; | ||
| 3 | + | ||
| 1 | import 'package:flutter/material.dart'; | 4 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:one_key/widgets/v_empty_view.dart'; | 6 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 4 | import 'package:provider/provider.dart'; | 7 | import 'package:provider/provider.dart'; |
| 5 | 8 | ||
| 6 | import '../../../../app.dart'; | 9 | import '../../../../app.dart'; |
| 10 | +import '../../../../models/upload_img_model.dart'; | ||
| 11 | +import '../../../../provider/marketing_center_provider.dart'; | ||
| 12 | +import '../../../../provider/upload_img_provider.dart'; | ||
| 7 | import '../../../../provider/user_model.dart'; | 13 | import '../../../../provider/user_model.dart'; |
| 8 | import '../../../../res/colors.dart'; | 14 | import '../../../../res/colors.dart'; |
| 9 | import '../../../../utils/screen_util.dart'; | 15 | import '../../../../utils/screen_util.dart'; |
| 16 | +import '../../../../utils/upload_image_util.dart'; | ||
| 10 | import '../../../../utils/utils.dart'; | 17 | import '../../../../utils/utils.dart'; |
| 11 | import '../../../../widgets/MyDivider.dart'; | 18 | import '../../../../widgets/MyDivider.dart'; |
| 12 | import '../../../../widgets/common_button_flat.dart'; | 19 | import '../../../../widgets/common_button_flat.dart'; |
| 13 | import '../../../../widgets/round_button.dart'; | 20 | import '../../../../widgets/round_button.dart'; |
| 14 | import '../../../../widgets/system_app_bar.dart'; | 21 | import '../../../../widgets/system_app_bar.dart'; |
| 22 | +import 'img_picker_invitation_widget.dart'; | ||
| 15 | 23 | ||
| 16 | /*** | 24 | /*** |
| 17 | * | 25 | * |
| @@ -34,6 +42,11 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | @@ -34,6 +42,11 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | ||
| 34 | TextEditingController storeIntroduceC = TextEditingController(); | 42 | TextEditingController storeIntroduceC = TextEditingController(); |
| 35 | FocusNode storeIntroduceNode = FocusNode(); | 43 | FocusNode storeIntroduceNode = FocusNode(); |
| 36 | 44 | ||
| 45 | + MarketingCenterProvider marketingCenterProvider; | ||
| 46 | + | ||
| 47 | + UploadImageProvider _uploadImageProvider; | ||
| 48 | + ScrollController controller = ScrollController(); | ||
| 49 | + | ||
| 37 | @override | 50 | @override |
| 38 | void initState() { | 51 | void initState() { |
| 39 | super.initState(); | 52 | super.initState(); |
| @@ -45,6 +58,15 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | @@ -45,6 +58,15 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | ||
| 45 | }); | 58 | }); |
| 46 | } | 59 | } |
| 47 | 60 | ||
| 61 | + @override | ||
| 62 | + void dispose() { | ||
| 63 | + _uploadImageProvider.storeImage1 = UploadImgModel(); | ||
| 64 | + _uploadImageProvider.storeImage2 = UploadImgModel(); | ||
| 65 | + _uploadImageProvider.storeImage3 = UploadImgModel(); | ||
| 66 | + _uploadImageProvider.storeImage4 = UploadImgModel(); | ||
| 67 | + super.dispose(); | ||
| 68 | + } | ||
| 69 | + | ||
| 48 | ///图文合并,图文分开,无文字 | 70 | ///图文合并,图文分开,无文字 |
| 49 | Widget _selectBtnWidget() { | 71 | Widget _selectBtnWidget() { |
| 50 | return Container( | 72 | return Container( |
| @@ -212,75 +234,41 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | @@ -212,75 +234,41 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | ||
| 212 | ); | 234 | ); |
| 213 | } | 235 | } |
| 214 | 236 | ||
| 215 | - Widget _uploadImage(bool hasupload, {EdgeInsets padding = EdgeInsets.zero}) { | ||
| 216 | - return InkWell( | ||
| 217 | - onTap: () {}, | ||
| 218 | - child: hasupload | ||
| 219 | - ? InkWell( | ||
| 220 | - onTap: () { | ||
| 221 | - print('object'); | ||
| 222 | - }, | ||
| 223 | - child: Stack(alignment: Alignment.bottomCenter, children: [ | ||
| 224 | - Image.network( | ||
| 225 | - 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg', | ||
| 226 | - fit: BoxFit.cover, | ||
| 227 | - height: w(280), | ||
| 228 | - ), | ||
| 229 | - Container( | ||
| 230 | - width: w(150), | ||
| 231 | - height: w(30), | ||
| 232 | - color: MyColours.color_4D000000, | ||
| 233 | - margin: padding, | ||
| 234 | - alignment: Alignment.center, | ||
| 235 | - child: Text( | ||
| 236 | - '点击图片可以更换', | ||
| 237 | - style: TextStyle( | ||
| 238 | - color: MyColours.color_F8F9FD, | ||
| 239 | - fontSize: font(14), | ||
| 240 | - fontWeight: FontWeight.bold), | ||
| 241 | - )), | ||
| 242 | - ])) | ||
| 243 | - : Container( | ||
| 244 | - color: MyColours.color_d9d9d9, | ||
| 245 | - width: double.infinity, | ||
| 246 | - height: w(280), | ||
| 247 | - padding: padding, | ||
| 248 | - child: Column( | ||
| 249 | - mainAxisAlignment: MainAxisAlignment.center, | ||
| 250 | - children: [ | ||
| 251 | - Image.asset( | ||
| 252 | - Utils.getImgPath('add_img'), | ||
| 253 | - width: w(63), | ||
| 254 | - ), | ||
| 255 | - VEmptyView(28), | ||
| 256 | - Container( | ||
| 257 | - width: w(139), | ||
| 258 | - height: w(60), | ||
| 259 | - child: Text( | ||
| 260 | - '点击上传照片\n为了更好的效果\n建议上传4:3照片', | ||
| 261 | - textAlign: TextAlign.center, | ||
| 262 | - style: TextStyle( | ||
| 263 | - height: 1.4, | ||
| 264 | - color: MyColours.color_ffffff, | ||
| 265 | - fontSize: font(14), | ||
| 266 | - fontWeight: FontWeight.bold), | ||
| 267 | - )) | ||
| 268 | - ], | ||
| 269 | - ), | ||
| 270 | - )); | ||
| 271 | - } | 237 | + |
| 272 | 238 | ||
| 273 | ///无文字 | 239 | ///无文字 |
| 274 | Widget _noTextWidget() { | 240 | Widget _noTextWidget() { |
| 275 | return Column( | 241 | return Column( |
| 276 | children: [ | 242 | children: [ |
| 277 | - _uploadImage(false), | 243 | + ImgPickerInvitationWidget( |
| 244 | + scrollController: controller, | ||
| 245 | + uploadType: UploadType.InvitationStoreType, | ||
| 246 | + model: _uploadImageProvider, | ||
| 247 | + index: 5, | ||
| 248 | + imageModel: _uploadImageProvider.storeImage1), | ||
| 278 | VEmptyView(18), | 249 | VEmptyView(18), |
| 279 | - _uploadImage(true), | 250 | + ImgPickerInvitationWidget( |
| 251 | + scrollController: controller, | ||
| 252 | + uploadType: UploadType.InvitationStoreType, | ||
| 253 | + model: _uploadImageProvider, | ||
| 254 | + index: 6, | ||
| 255 | + imageModel: _uploadImageProvider.storeImage2, | ||
| 256 | + ), | ||
| 280 | VEmptyView(18), | 257 | VEmptyView(18), |
| 281 | - _uploadImage(false), | 258 | + ImgPickerInvitationWidget( |
| 259 | + scrollController: controller, | ||
| 260 | + uploadType: UploadType.InvitationStoreType, | ||
| 261 | + model: _uploadImageProvider, | ||
| 262 | + index: 7, | ||
| 263 | + imageModel: _uploadImageProvider.storeImage3), | ||
| 282 | VEmptyView(18), | 264 | VEmptyView(18), |
| 283 | - _uploadImage(true), | 265 | + ImgPickerInvitationWidget( |
| 266 | + scrollController: controller, | ||
| 267 | + model: _uploadImageProvider, | ||
| 268 | + index: 8, | ||
| 269 | + uploadType: UploadType.InvitationStoreType, | ||
| 270 | + imageModel: _uploadImageProvider.storeImage4, | ||
| 271 | + ), | ||
| 284 | ], | 272 | ], |
| 285 | ); | 273 | ); |
| 286 | } | 274 | } |
| @@ -296,10 +284,13 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | @@ -296,10 +284,13 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | ||
| 296 | children: [ | 284 | children: [ |
| 297 | Stack( | 285 | Stack( |
| 298 | children: [ | 286 | children: [ |
| 299 | - _uploadImage( | ||
| 300 | - false, | ||
| 301 | - padding: EdgeInsets.only(left: w(160)), | ||
| 302 | - ), | 287 | + ImgPickerInvitationWidget( |
| 288 | + scrollController: controller, | ||
| 289 | + uploadType: UploadType.InvitationStoreType, | ||
| 290 | + model: _uploadImageProvider, | ||
| 291 | + index: 5, | ||
| 292 | + padding: EdgeInsets.only(left: w(160)), | ||
| 293 | + imageModel: _uploadImageProvider.storeImage1), | ||
| 303 | Positioned( | 294 | Positioned( |
| 304 | child: _introduceWidget( | 295 | child: _introduceWidget( |
| 305 | EdgeInsets.only( | 296 | EdgeInsets.only( |
| @@ -322,11 +313,26 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | @@ -322,11 +313,26 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | ||
| 322 | ], | 313 | ], |
| 323 | ), | 314 | ), |
| 324 | VEmptyView(18), | 315 | VEmptyView(18), |
| 325 | - _uploadImage(true), | 316 | + ImgPickerInvitationWidget( |
| 317 | + scrollController: controller, | ||
| 318 | + uploadType: UploadType.InvitationStoreType, | ||
| 319 | + model: _uploadImageProvider, | ||
| 320 | + index: 6, | ||
| 321 | + imageModel: _uploadImageProvider.storeImage2), | ||
| 326 | VEmptyView(18), | 322 | VEmptyView(18), |
| 327 | - _uploadImage(false), | 323 | + ImgPickerInvitationWidget( |
| 324 | + scrollController: controller, | ||
| 325 | + uploadType: UploadType.InvitationStoreType, | ||
| 326 | + model: _uploadImageProvider, | ||
| 327 | + index: 7, | ||
| 328 | + imageModel: _uploadImageProvider.storeImage3), | ||
| 328 | VEmptyView(18), | 329 | VEmptyView(18), |
| 329 | - _uploadImage(true), | 330 | + ImgPickerInvitationWidget( |
| 331 | + scrollController: controller, | ||
| 332 | + uploadType: UploadType.InvitationStoreType, | ||
| 333 | + model: _uploadImageProvider, | ||
| 334 | + index: 8, | ||
| 335 | + imageModel: _uploadImageProvider.storeImage4), | ||
| 330 | ], | 336 | ], |
| 331 | ); | 337 | ); |
| 332 | } | 338 | } |
| @@ -339,19 +345,43 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | @@ -339,19 +345,43 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | ||
| 339 | _introduceWidget(EdgeInsets.all(w(15)), | 345 | _introduceWidget(EdgeInsets.all(w(15)), |
| 340 | boxDecoration: BoxDecoration(color: MyColours.color_ffffff)), | 346 | boxDecoration: BoxDecoration(color: MyColours.color_ffffff)), |
| 341 | VEmptyView(18), | 347 | VEmptyView(18), |
| 342 | - _uploadImage(false), | 348 | + ImgPickerInvitationWidget( |
| 349 | + scrollController: controller, | ||
| 350 | + uploadType: UploadType.InvitationStoreType, | ||
| 351 | + model: _uploadImageProvider, | ||
| 352 | + index: 5, | ||
| 353 | + imageModel: _uploadImageProvider.storeImage1), | ||
| 343 | VEmptyView(18), | 354 | VEmptyView(18), |
| 344 | - _uploadImage(true), | 355 | + ImgPickerInvitationWidget( |
| 356 | + scrollController: controller, | ||
| 357 | + uploadType: UploadType.InvitationStoreType, | ||
| 358 | + model: _uploadImageProvider, | ||
| 359 | + index: 6, | ||
| 360 | + imageModel: _uploadImageProvider.storeImage2), | ||
| 345 | VEmptyView(18), | 361 | VEmptyView(18), |
| 346 | - _uploadImage(false), | 362 | + ImgPickerInvitationWidget( |
| 363 | + scrollController: controller, | ||
| 364 | + uploadType: UploadType.InvitationStoreType, | ||
| 365 | + model: _uploadImageProvider, | ||
| 366 | + index: 7, | ||
| 367 | + imageModel: _uploadImageProvider.storeImage3), | ||
| 347 | VEmptyView(18), | 368 | VEmptyView(18), |
| 348 | - _uploadImage(true), | 369 | + ImgPickerInvitationWidget( |
| 370 | + scrollController: controller, | ||
| 371 | + uploadType: UploadType.InvitationStoreType, | ||
| 372 | + model: _uploadImageProvider, | ||
| 373 | + index: 8, | ||
| 374 | + imageModel: _uploadImageProvider.storeImage4), | ||
| 349 | ], | 375 | ], |
| 350 | ); | 376 | ); |
| 351 | } | 377 | } |
| 352 | 378 | ||
| 353 | @override | 379 | @override |
| 354 | Widget build(BuildContext context) { | 380 | Widget build(BuildContext context) { |
| 381 | + _uploadImageProvider = | ||
| 382 | + Provider.of<UploadImageProvider>(context, listen: true); | ||
| 383 | + marketingCenterProvider = | ||
| 384 | + Provider.of<MarketingCenterProvider>(context, listen: true); | ||
| 355 | return Scaffold( | 385 | return Scaffold( |
| 356 | backgroundColor: MyColours.color_ffffff, | 386 | backgroundColor: MyColours.color_ffffff, |
| 357 | appBar: SystemAppBar( | 387 | appBar: SystemAppBar( |
| @@ -364,6 +394,7 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | @@ -364,6 +394,7 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | ||
| 364 | children: [ | 394 | children: [ |
| 365 | Expanded( | 395 | Expanded( |
| 366 | child: SingleChildScrollView( | 396 | child: SingleChildScrollView( |
| 397 | + controller: controller, | ||
| 367 | child: Column( | 398 | child: Column( |
| 368 | children: [ | 399 | children: [ |
| 369 | _selectBtnWidget(), | 400 | _selectBtnWidget(), |
| @@ -401,7 +432,60 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | @@ -401,7 +432,60 @@ class _StoreIntroducePageState extends State<StoreIntroducePage> { | ||
| 401 | fontSize: 34, | 432 | fontSize: 34, |
| 402 | height: w(40), | 433 | height: w(40), |
| 403 | isBold: true, | 434 | isBold: true, |
| 404 | - onPressed: () {}, | 435 | + onPressed: () async { |
| 436 | + FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘 | ||
| 437 | + | ||
| 438 | + if ((currIndex == 1 || currIndex == 2) && | ||
| 439 | + storeIntroduceC.text.trim().length == 0) { | ||
| 440 | + Utils.showToast('请输入餐厅介绍文字!'); | ||
| 441 | + return false; | ||
| 442 | + } | ||
| 443 | + | ||
| 444 | + List<String> images = []; | ||
| 445 | + if (_uploadImageProvider.storeImage1.qiniuUrl != null && | ||
| 446 | + _uploadImageProvider.storeImage1.qiniuUrl != '') { | ||
| 447 | + images.add(_uploadImageProvider.storeImage1.qiniuUrl); | ||
| 448 | + } | ||
| 449 | + if (_uploadImageProvider.storeImage2.qiniuUrl != null && | ||
| 450 | + _uploadImageProvider.storeImage2.qiniuUrl != '') { | ||
| 451 | + images.add(_uploadImageProvider.storeImage2.qiniuUrl); | ||
| 452 | + } | ||
| 453 | + if (_uploadImageProvider.storeImage3.qiniuUrl != null && | ||
| 454 | + _uploadImageProvider.storeImage3.qiniuUrl != '') { | ||
| 455 | + images.add(_uploadImageProvider.storeImage3.qiniuUrl); | ||
| 456 | + } | ||
| 457 | + if (_uploadImageProvider.storeImage3.qiniuUrl != null && | ||
| 458 | + _uploadImageProvider.storeImage3.qiniuUrl != '') { | ||
| 459 | + images.add(_uploadImageProvider.storeImage3.qiniuUrl); | ||
| 460 | + } | ||
| 461 | + if (images.length == 0) { | ||
| 462 | + Utils.showToast('请至少上传一张图片!'); | ||
| 463 | + return false; | ||
| 464 | + } | ||
| 465 | + | ||
| 466 | + //接口 | ||
| 467 | + Map storeData = { | ||
| 468 | + 'style': currIndex.toString(), | ||
| 469 | + 'seller_name': sellername, | ||
| 470 | + 'introduce': storeIntroduceC.text, | ||
| 471 | + 'images': json.encode(images) | ||
| 472 | + }; | ||
| 473 | + | ||
| 474 | + Map<String, String> params = { | ||
| 475 | + 'sid': Provider.of<UserModel>(context, listen: false) | ||
| 476 | + .user | ||
| 477 | + .sellerid, | ||
| 478 | + 'store': json.encode(storeData) | ||
| 479 | + }; | ||
| 480 | + | ||
| 481 | + bool success = await marketingCenterProvider | ||
| 482 | + .setSellerTemplateConf(context, params, | ||
| 483 | + showLoading: true); | ||
| 484 | + if (success) { | ||
| 485 | + Utils.showToast('保存成功'); | ||
| 486 | + Navigator.pop(context); | ||
| 487 | + } | ||
| 488 | + }, | ||
| 405 | ), | 489 | ), |
| 406 | ) | 490 | ) |
| 407 | ], | 491 | ], |
| @@ -338,6 +338,62 @@ class CouponProvider with ChangeNotifier { | @@ -338,6 +338,62 @@ class CouponProvider with ChangeNotifier { | ||
| 338 | } | 338 | } |
| 339 | 339 | ||
| 340 | ///客户经理获取所创建活动列表(选择优惠券) | 340 | ///客户经理获取所创建活动列表(选择优惠券) |
| 341 | + Future<List<CouponSunModel>> getCustomerSelectActivityMarking( | ||
| 342 | + BuildContext context, Map<String, String> params, | ||
| 343 | + {isShowLoading = true}) async { | ||
| 344 | + if (isShowLoading) { | ||
| 345 | + pageStateSelect = PageState.Loading; | ||
| 346 | + notifyListeners(); | ||
| 347 | + } | ||
| 348 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 349 | + .request<dynamic>(context, Method.get, HttpUrl.get_customer_activity, | ||
| 350 | + data: params, showLoading: false) | ||
| 351 | + .catchError((error) { | ||
| 352 | + print(error.toString()); | ||
| 353 | + if (error is MyError) { | ||
| 354 | + switch (error.type) { | ||
| 355 | + case 1: | ||
| 356 | + pageStateSelect = PageState.ConnectivityError; | ||
| 357 | + break; | ||
| 358 | + case 2: | ||
| 359 | + pageStateSelect = PageState.ConnectivityTimeOut; | ||
| 360 | + break; | ||
| 361 | + default: | ||
| 362 | + pageStateSelect = PageState.ConnectivityError; | ||
| 363 | + break; | ||
| 364 | + } | ||
| 365 | + } | ||
| 366 | + notifyListeners(); | ||
| 367 | + }); | ||
| 368 | + if (baseResp.code == Constant.status_success) { | ||
| 369 | + if (baseResp.data.isEmpty) { | ||
| 370 | + pageStateSelect = PageState.Empty; | ||
| 371 | + } else { | ||
| 372 | + pageStateSelect = PageState.Success; | ||
| 373 | + } | ||
| 374 | + couponListSelect = CouponModel.fromJson(baseResp.responseData).data; | ||
| 375 | + | ||
| 376 | + List<CouponSunModel> temp = []; | ||
| 377 | + for (int i = 0; i < couponListSelect.length; i++) { | ||
| 378 | + if (couponListSelect[i].isType == '1' && | ||
| 379 | + couponListSelect[i].isExamine == '1') { | ||
| 380 | + //店铺优惠券 && 可核销 && dang | ||
| 381 | + temp.add(couponListSelect[i]); | ||
| 382 | + } | ||
| 383 | + } | ||
| 384 | + couponListSelect = temp; | ||
| 385 | + | ||
| 386 | + notifyListeners(); | ||
| 387 | + } else { | ||
| 388 | + pageStateSelect = PageState.ConnectivityError; | ||
| 389 | + if (baseResp != null) { | ||
| 390 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 391 | + } | ||
| 392 | + } | ||
| 393 | + return couponListSelect; | ||
| 394 | + } | ||
| 395 | + | ||
| 396 | + ///客户经理获取所创建活动列表(选择优惠券) | ||
| 341 | Future<List<CouponSunModel>> getCustomerSelectActivity( | 397 | Future<List<CouponSunModel>> getCustomerSelectActivity( |
| 342 | BuildContext context, Map<String, String> params, | 398 | BuildContext context, Map<String, String> params, |
| 343 | {isShowLoading = true}) async { | 399 | {isShowLoading = true}) async { |
| @@ -20,6 +20,7 @@ class UploadImageProvider extends ChangeNotifier { | @@ -20,6 +20,7 @@ class UploadImageProvider extends ChangeNotifier { | ||
| 20 | UploadImgModel mentou = UploadImgModel(); //店铺信息----门头照片 | 20 | UploadImgModel mentou = UploadImgModel(); //店铺信息----门头照片 |
| 21 | UploadImgModel dish = UploadImgModel(); //菜品 | 21 | UploadImgModel dish = UploadImgModel(); //菜品 |
| 22 | UploadImgModel firstImage = UploadImgModel(); //预订安排首图 | 22 | UploadImgModel firstImage = UploadImgModel(); //预订安排首图 |
| 23 | + | ||
| 23 | double imgSizefirstImage = 282; | 24 | double imgSizefirstImage = 282; |
| 24 | double imgSizeTouxiang = 76; | 25 | double imgSizeTouxiang = 76; |
| 25 | double imgSizeErweima = 22; | 26 | double imgSizeErweima = 22; |
| @@ -32,6 +33,10 @@ class UploadImageProvider extends ChangeNotifier { | @@ -32,6 +33,10 @@ class UploadImageProvider extends ChangeNotifier { | ||
| 32 | List<UploadImgModel> feastRemarkDjImageList = []; //宴会备注图片信息列表----定金 | 33 | List<UploadImgModel> feastRemarkDjImageList = []; //宴会备注图片信息列表----定金 |
| 33 | List<UploadImgModel> feastRemarkContractImageList = []; //宴会备注图片信息列表----合同 | 34 | List<UploadImgModel> feastRemarkContractImageList = []; //宴会备注图片信息列表----合同 |
| 34 | List<UploadImgModel> feastRemarkInvoiceImageList = []; //宴会备注图片信息列表----发票 | 35 | List<UploadImgModel> feastRemarkInvoiceImageList = []; //宴会备注图片信息列表----发票 |
| 36 | + UploadImgModel storeImage1 = UploadImgModel(); //预订安排介绍 | ||
| 37 | + UploadImgModel storeImage2 = UploadImgModel(); //预订安排介绍 | ||
| 38 | + UploadImgModel storeImage3 = UploadImgModel(); //预订安排介绍 | ||
| 39 | + UploadImgModel storeImage4 = UploadImgModel(); //预订安排介绍 | ||
| 35 | 40 | ||
| 36 | int countUpload = 0; | 41 | int countUpload = 0; |
| 37 | UploadImageProvider() { | 42 | UploadImageProvider() { |
| @@ -1445,4 +1445,13 @@ class NavigatorUtil { | @@ -1445,4 +1445,13 @@ class NavigatorUtil { | ||
| 1445 | return _navigateTo(context, "${Routes.marking_interaction_page}", | 1445 | return _navigateTo(context, "${Routes.marking_interaction_page}", |
| 1446 | replace: replace); | 1446 | replace: replace); |
| 1447 | } | 1447 | } |
| 1448 | + | ||
| 1449 | + ///预订安排通知定制------优惠券选择 | ||
| 1450 | + static Future<dynamic> goMarkingCouponSelectPage( | ||
| 1451 | + BuildContext context, { | ||
| 1452 | + replace = false, | ||
| 1453 | + }) { | ||
| 1454 | + return _navigateTo(context, "${Routes.marking_coupon_select_page}", | ||
| 1455 | + replace: replace); | ||
| 1456 | + } | ||
| 1448 | } | 1457 | } |
| @@ -182,6 +182,7 @@ import '../pages/my/marketing_center/book_notification/book_info_page.dart'; | @@ -182,6 +182,7 @@ import '../pages/my/marketing_center/book_notification/book_info_page.dart'; | ||
| 182 | import '../pages/my/marketing_center/book_notification/chef_introduce_page.dart'; | 182 | import '../pages/my/marketing_center/book_notification/chef_introduce_page.dart'; |
| 183 | import '../pages/my/marketing_center/book_notification/dish_show_page.dart'; | 183 | import '../pages/my/marketing_center/book_notification/dish_show_page.dart'; |
| 184 | import '../pages/my/marketing_center/book_notification/first_image_page.dart'; | 184 | import '../pages/my/marketing_center/book_notification/first_image_page.dart'; |
| 185 | +import '../pages/my/marketing_center/book_notification/marking_coupon_select_page.dart'; | ||
| 185 | import '../pages/my/marketing_center/book_notification/store_introduce_page.dart'; | 186 | import '../pages/my/marketing_center/book_notification/store_introduce_page.dart'; |
| 186 | import '../pages/my/marketing_center/marketing_center_home_page.dart'; | 187 | import '../pages/my/marketing_center/marketing_center_home_page.dart'; |
| 187 | import '../pages/my/plan_dish/final_plan_dish_page.dart'; | 188 | import '../pages/my/plan_dish/final_plan_dish_page.dart'; |
| @@ -2315,12 +2316,15 @@ var bookInfoPageHandle = new Handler( | @@ -2315,12 +2316,15 @@ var bookInfoPageHandle = new Handler( | ||
| 2315 | // String idstr = params["idstr"].first; | 2316 | // String idstr = params["idstr"].first; |
| 2316 | // NotebookDetail detailEntity = NotebookDetail.fromJson(json | 2317 | // NotebookDetail detailEntity = NotebookDetail.fromJson(json |
| 2317 | // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | 2318 | // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); |
| 2319 | + | ||
| 2318 | return ChangeNotifierProvider<MarketingCenterProvider>( | 2320 | return ChangeNotifierProvider<MarketingCenterProvider>( |
| 2319 | create: (_) => MarketingCenterProvider(), | 2321 | create: (_) => MarketingCenterProvider(), |
| 2320 | child: ChangeNotifierProvider<ChooseTableModel>( | 2322 | child: ChangeNotifierProvider<ChooseTableModel>( |
| 2321 | create: (_) => ChooseTableModel(), | 2323 | create: (_) => ChooseTableModel(), |
| 2322 | child: ChangeNotifierProvider<StoreBaseIndoProvider>( | 2324 | child: ChangeNotifierProvider<StoreBaseIndoProvider>( |
| 2323 | - create: (_) => StoreBaseIndoProvider(), child: BookInfoPage()))); | 2325 | + create: (_) => StoreBaseIndoProvider(), |
| 2326 | + child: ChangeNotifierProvider<BaseIndoProvider>( | ||
| 2327 | + create: (_) => BaseIndoProvider(), child: BookInfoPage())))); | ||
| 2324 | }); | 2328 | }); |
| 2325 | 2329 | ||
| 2326 | //我的----营销中心-店铺介绍 | 2330 | //我的----营销中心-店铺介绍 |
| @@ -2363,3 +2367,14 @@ var markingInteractionPageHandle = new Handler( | @@ -2363,3 +2367,14 @@ var markingInteractionPageHandle = new Handler( | ||
| 2363 | create: (_) => MarketingCenterProvider(), | 2367 | create: (_) => MarketingCenterProvider(), |
| 2364 | child: MarkingInteractionPage()); | 2368 | child: MarkingInteractionPage()); |
| 2365 | }); | 2369 | }); |
| 2370 | + | ||
| 2371 | +//我的----营销中心-优惠券选择 | ||
| 2372 | +var markingCouponSelectPageHandle = new Handler( | ||
| 2373 | + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { | ||
| 2374 | + // String idstr = params["idstr"].first; | ||
| 2375 | + // NotebookDetail detailEntity = NotebookDetail.fromJson(json | ||
| 2376 | + // .decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first))); | ||
| 2377 | + return ChangeNotifierProvider<MarketingCenterProvider>( | ||
| 2378 | + create: (_) => MarketingCenterProvider(), | ||
| 2379 | + child: MarkingCouponSelectPage()); | ||
| 2380 | +}); |
| @@ -202,6 +202,9 @@ class Routes { | @@ -202,6 +202,9 @@ class Routes { | ||
| 202 | static String marking_interaction_page = | 202 | static String marking_interaction_page = |
| 203 | "/marking_interaction_page"; //预订安排通知定制------客户互动及店铺推广 | 203 | "/marking_interaction_page"; //预订安排通知定制------客户互动及店铺推广 |
| 204 | 204 | ||
| 205 | + static String marking_coupon_select_page = | ||
| 206 | + "/marking_coupon_select_page"; //预订安排通知定制------优惠券选择 | ||
| 207 | + | ||
| 205 | static void configureRoutes(FluroRouter router) { | 208 | static void configureRoutes(FluroRouter router) { |
| 206 | router.notFoundHandler = new Handler( | 209 | router.notFoundHandler = new Handler( |
| 207 | handlerFunc: (BuildContext context, Map<String, List<String>> params) { | 210 | handlerFunc: (BuildContext context, Map<String, List<String>> params) { |
| @@ -395,5 +398,10 @@ class Routes { | @@ -395,5 +398,10 @@ class Routes { | ||
| 395 | router.define(dish_show_page, handler: dishShowPageHandle); | 398 | router.define(dish_show_page, handler: dishShowPageHandle); |
| 396 | router.define(marking_interaction_page, | 399 | router.define(marking_interaction_page, |
| 397 | handler: markingInteractionPageHandle); | 400 | handler: markingInteractionPageHandle); |
| 401 | + router.define(marking_coupon_select_page, | ||
| 402 | + handler: markingCouponSelectPageHandle); | ||
| 403 | + | ||
| 404 | + | ||
| 405 | + | ||
| 398 | } | 406 | } |
| 399 | } | 407 | } |
| @@ -22,7 +22,8 @@ enum UploadType { | @@ -22,7 +22,8 @@ enum UploadType { | ||
| 22 | FeastRemarkXtType, //宴会备注--选台 | 22 | FeastRemarkXtType, //宴会备注--选台 |
| 23 | FeastRemarkDjType, //宴会备注--定金 | 23 | FeastRemarkDjType, //宴会备注--定金 |
| 24 | FeastRemarkContractType, //宴会备注--合同 | 24 | FeastRemarkContractType, //宴会备注--合同 |
| 25 | - FeastRemarkInvoiceType //宴会备注--发票 | 25 | + FeastRemarkInvoiceType, //宴会备注--发票 |
| 26 | + InvitationStoreType //预订安排定制----店铺图片 | ||
| 26 | 27 | ||
| 27 | } | 28 | } |
| 28 | 29 | ||
| @@ -91,6 +92,10 @@ class UploadImageUtil { | @@ -91,6 +92,10 @@ class UploadImageUtil { | ||
| 91 | //宴会备注 ---发票 | 92 | //宴会备注 ---发票 |
| 92 | uploadImageProvider.feastRemarkInvoiceImageList[index].process = | 93 | uploadImageProvider.feastRemarkInvoiceImageList[index].process = |
| 93 | percent; | 94 | percent; |
| 95 | + } else if (uploadType == UploadType.InvitationStoreType) { | ||
| 96 | + //宴会备注 ---发票 | ||
| 97 | + uploadImageProvider.feastRemarkInvoiceImageList[index].process = | ||
| 98 | + percent; | ||
| 94 | } | 99 | } |
| 95 | 100 | ||
| 96 | uploadImageProvider.notifyListeners(); | 101 | uploadImageProvider.notifyListeners(); |
| @@ -169,6 +174,11 @@ class UploadImageUtil { | @@ -169,6 +174,11 @@ class UploadImageUtil { | ||
| 169 | uploadImageProvider.feastRemarkInvoiceImageList[index].process = 1; | 174 | uploadImageProvider.feastRemarkInvoiceImageList[index].process = 1; |
| 170 | uploadImageProvider.feastRemarkInvoiceImageList[index].qiniuUrl = | 175 | uploadImageProvider.feastRemarkInvoiceImageList[index].qiniuUrl = |
| 171 | imgUrl; | 176 | imgUrl; |
| 177 | + } else if (uploadType == UploadType.InvitationStoreType) { | ||
| 178 | + //宴会备注 ---发票 | ||
| 179 | + uploadImageProvider.feastRemarkInvoiceImageList[index].process = 1; | ||
| 180 | + uploadImageProvider.feastRemarkInvoiceImageList[index].qiniuUrl = | ||
| 181 | + imgUrl; | ||
| 172 | } | 182 | } |
| 173 | 183 | ||
| 174 | // 取消当前任务 | 184 | // 取消当前任务 |
| @@ -237,6 +247,18 @@ class UploadImageUtil { | @@ -237,6 +247,18 @@ class UploadImageUtil { | ||
| 237 | } else if (index == 4) { | 247 | } else if (index == 4) { |
| 238 | //4 预订安排首图 | 248 | //4 预订安排首图 |
| 239 | uploadImageProvider.firstImage.process = percent; | 249 | uploadImageProvider.firstImage.process = percent; |
| 250 | + } else if (index == 5) { | ||
| 251 | + //4 预订安排首图 | ||
| 252 | + uploadImageProvider.storeImage1.process = percent; | ||
| 253 | + } else if (index == 6) { | ||
| 254 | + //4 预订安排首图 | ||
| 255 | + uploadImageProvider.storeImage2.process = percent; | ||
| 256 | + } else if (index == 7) { | ||
| 257 | + //4 预订安排首图 | ||
| 258 | + uploadImageProvider.storeImage3.process = percent; | ||
| 259 | + } else if (index == 8) { | ||
| 260 | + //4 预订安排首图 | ||
| 261 | + uploadImageProvider.storeImage4.process = percent; | ||
| 240 | } else { | 262 | } else { |
| 241 | //1 二维码 | 263 | //1 二维码 |
| 242 | uploadImageProvider.erweima.process = percent; | 264 | uploadImageProvider.erweima.process = percent; |
| @@ -296,11 +318,31 @@ class UploadImageUtil { | @@ -296,11 +318,31 @@ class UploadImageUtil { | ||
| 296 | uploadImageProvider.dish.qiniuUrl = imgUrl; | 318 | uploadImageProvider.dish.qiniuUrl = imgUrl; |
| 297 | uploadImageProvider.dish.file = null; | 319 | uploadImageProvider.dish.file = null; |
| 298 | uploadImageProvider.notifyListeners(); | 320 | uploadImageProvider.notifyListeners(); |
| 299 | - }else if (index == 4) { | 321 | + } else if (index == 4) { |
| 300 | uploadImageProvider.firstImage.process = 1; | 322 | uploadImageProvider.firstImage.process = 1; |
| 301 | uploadImageProvider.firstImage.qiniuUrl = imgUrl; | 323 | uploadImageProvider.firstImage.qiniuUrl = imgUrl; |
| 302 | uploadImageProvider.firstImage.file = null; | 324 | uploadImageProvider.firstImage.file = null; |
| 303 | uploadImageProvider.notifyListeners(); | 325 | uploadImageProvider.notifyListeners(); |
| 326 | + } else if (index == 5) { | ||
| 327 | + uploadImageProvider.storeImage1.process = 1; | ||
| 328 | + uploadImageProvider.storeImage1.qiniuUrl = imgUrl; | ||
| 329 | + uploadImageProvider.storeImage1.file = null; | ||
| 330 | + uploadImageProvider.notifyListeners(); | ||
| 331 | + } else if (index == 6) { | ||
| 332 | + uploadImageProvider.storeImage2.process = 1; | ||
| 333 | + uploadImageProvider.storeImage2.qiniuUrl = imgUrl; | ||
| 334 | + uploadImageProvider.storeImage2.file = null; | ||
| 335 | + uploadImageProvider.notifyListeners(); | ||
| 336 | + } else if (index == 7) { | ||
| 337 | + uploadImageProvider.storeImage3.process = 1; | ||
| 338 | + uploadImageProvider.storeImage3.qiniuUrl = imgUrl; | ||
| 339 | + uploadImageProvider.storeImage3.file = null; | ||
| 340 | + uploadImageProvider.notifyListeners(); | ||
| 341 | + } else if (index == 8) { | ||
| 342 | + uploadImageProvider.storeImage4.process = 1; | ||
| 343 | + uploadImageProvider.storeImage4.qiniuUrl = imgUrl; | ||
| 344 | + uploadImageProvider.storeImage4.file = null; | ||
| 345 | + uploadImageProvider.notifyListeners(); | ||
| 304 | } | 346 | } |
| 305 | }) | 347 | }) |
| 306 | ..catchError((dynamic error) { | 348 | ..catchError((dynamic error) { |
-
Please register or login to post a comment