Commit 17b358df2027fca0fe154ae1c6651fbaa1e091dd

Authored by wdn127929
2 parents 06c09d4f e1157063

存酒接口部分

Too many changes to show.

To preserve performance only 27 of 27+ files are displayed.

@@ -13,19 +13,21 @@ if (flutterRoot == null) { @@ -13,19 +13,21 @@ if (flutterRoot == null) {
13 13
14 14
15 15
  16 +
16 def flutterVersionCode = "460" 17 def flutterVersionCode = "460"
17 if (flutterVersionCode == null) { 18 if (flutterVersionCode == null) {
18 flutterVersionCode = '460' 19 flutterVersionCode = '460'
19 -  
20 } 20 }
21 21
22 22
  23 +
23 def flutterVersionName = "4.6.0" 24 def flutterVersionName = "4.6.0"
24 if (flutterVersionName == null) { 25 if (flutterVersionName == null) {
25 flutterVersionName = '4.6.0' 26 flutterVersionName = '4.6.0'
26 -  
27 } 27 }
28 28
  29 +
  30 +
29 apply plugin: 'com.android.application' 31 apply plugin: 'com.android.application'
30 apply plugin: 'kotlin-android' 32 apply plugin: 'kotlin-android'
31 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 33 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:one_key/models/wine_manage_model.dart';
  3 +
  4 +import 'dart:convert' as convert;
  5 +
  6 +class OutWineRecordModel {
  7 + int ret;
  8 + List<OutWineRecordSunModel> data;
  9 + String msg;
  10 +
  11 + OutWineRecordModel({this.ret, this.data, this.msg});
  12 +
  13 + OutWineRecordModel.fromJson(Map<String, dynamic> json) {
  14 + ret = json['ret'];
  15 + if (json['data'] != null) {
  16 + data = new List<OutWineRecordSunModel>();
  17 + json['data'].forEach((v) {
  18 + data.add(new OutWineRecordSunModel.fromJson(v));
  19 + });
  20 + }
  21 + msg = json['msg'];
  22 + }
  23 +
  24 + Map<String, dynamic> toJson() {
  25 + final Map<String, dynamic> data = new Map<String, dynamic>();
  26 + data['ret'] = this.ret;
  27 + if (this.data != null) {
  28 + data['data'] = this.data.map((v) => v.toJson()).toList();
  29 + }
  30 + data['msg'] = this.msg;
  31 + return data;
  32 + }
  33 +}
  34 +
  35 +class OutWineRecordSunModel {
  36 + String id;
  37 + List<WineCheckModel> wineCheck;
  38 + String cdate;
  39 + String rname;
  40 + String sex;
  41 + String phone;
  42 + String nickName;
  43 + String isMember;
  44 +
  45 + String get sexStr {
  46 + if (sex == null || sex == '') return "";
  47 + switch (sex.toString()) {
  48 + case "1": //先生
  49 + case "男":
  50 + case "先生":
  51 + return "先生";
  52 + case "2": //女士
  53 + case "女":
  54 + case "女士":
  55 + return "女士";
  56 + case "3": //公司
  57 + case "公司":
  58 + return "公司";
  59 + }
  60 + }
  61 +
  62 + String get cdateStr {
  63 + DateTime dateTime =
  64 + DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000);
  65 + return DateUtil.formatDate(dateTime, format: DateFormats.full);
  66 + }
  67 +
  68 + OutWineRecordSunModel(
  69 + {this.id,
  70 + this.wineCheck,
  71 + this.cdate,
  72 + this.rname,
  73 + this.sex,
  74 + this.phone,
  75 + this.nickName});
  76 +
  77 + OutWineRecordSunModel.fromJson(Map<String, dynamic> json) {
  78 + id = json['id'];
  79 + wineCheck = [];
  80 + if (json['wine_check'] != null && json['wine_check'] != '[]') {
  81 + if (json['wine_check'] is List) {
  82 + json['wine_check'].forEach((v) {
  83 + wineCheck.add(new WineCheckModel.fromJson(v));
  84 + });
  85 + } else {
  86 + convert.jsonDecode(json['wine_check']).forEach((v) {
  87 + wineCheck.add(new WineCheckModel.fromJson(v));
  88 + });
  89 + }
  90 + }
  91 +
  92 + cdate = json['cdate'];
  93 + rname = json['rname'];
  94 + sex = json['sex'];
  95 + phone = json['phone'];
  96 + nickName = json['nick_name'];
  97 + isMember = json['is_member'];
  98 + }
  99 +
  100 + Map<String, dynamic> toJson() {
  101 + final Map<String, dynamic> data = new Map<String, dynamic>();
  102 + data['id'] = this.id;
  103 + data['wine_check'] = this.wineCheck;
  104 + data['cdate'] = this.cdate;
  105 + data['rname'] = this.rname;
  106 + data['sex'] = this.sex;
  107 + data['phone'] = this.phone;
  108 + data['nick_name'] = this.nickName;
  109 + data['is_member'] = this.isMember;
  110 + return data;
  111 + }
  112 +}
@@ -112,6 +112,10 @@ class PersonnelManageSunModel extends Object { @@ -112,6 +112,10 @@ class PersonnelManageSunModel extends Object {
112 112
113 @JsonKey(name: 'headimgurl') 113 @JsonKey(name: 'headimgurl')
114 String headimgurl; 114 String headimgurl;
  115 +
  116 + @JsonKey(name: 'is_store_wine')
  117 + String isStoreWine;
  118 +
115 bool select = false; 119 bool select = false;
116 120
117 PersonnelManageSunModel( 121 PersonnelManageSunModel(
@@ -126,6 +130,7 @@ class PersonnelManageSunModel extends Object { @@ -126,6 +130,7 @@ class PersonnelManageSunModel extends Object {
126 this.account, 130 this.account,
127 this.isOnCall, 131 this.isOnCall,
128 this.headimgurl, 132 this.headimgurl,
  133 + this.isStoreWine
129 ); 134 );
130 135
131 factory PersonnelManageSunModel.fromJson(Map<String, dynamic> srcJson) => 136 factory PersonnelManageSunModel.fromJson(Map<String, dynamic> srcJson) =>
@@ -86,6 +86,7 @@ PersonnelManageSunModel _$PersonnelManageSunModelFromJson( @@ -86,6 +86,7 @@ PersonnelManageSunModel _$PersonnelManageSunModelFromJson(
86 json['account'] as String, 86 json['account'] as String,
87 json['is_on_call'] as String, 87 json['is_on_call'] as String,
88 json['headimgurl'] as String, 88 json['headimgurl'] as String,
  89 + json['is_store_wine'] as String,
89 ); 90 );
90 } 91 }
91 92
@@ -95,7 +96,7 @@ Map<String, dynamic> _$PersonnelManageSunModelToJson( @@ -95,7 +96,7 @@ Map<String, dynamic> _$PersonnelManageSunModelToJson(
95 'id': instance.id, 96 'id': instance.id,
96 'openid': instance.openid, 97 'openid': instance.openid,
97 'user_name': instance.userName, 98 'user_name': instance.userName,
98 - 'nick_name':instance.nickName, 99 + 'nick_name': instance.nickName,
99 'is_first': instance.isFirst, 100 'is_first': instance.isFirst,
100 'role_id': instance.roleId, 101 'role_id': instance.roleId,
101 'phone': instance.phone, 102 'phone': instance.phone,
@@ -103,6 +104,7 @@ Map<String, dynamic> _$PersonnelManageSunModelToJson( @@ -103,6 +104,7 @@ Map<String, dynamic> _$PersonnelManageSunModelToJson(
103 'account': instance.account, 104 'account': instance.account,
104 'is_on_call': instance.isOnCall, 105 'is_on_call': instance.isOnCall,
105 'headimgurl': instance.headimgurl, 106 'headimgurl': instance.headimgurl,
  107 + 'is_store_wine': instance.isStoreWine
106 }; 108 };
107 109
108 Shopowner _$ShopownerFromJson(Map<String, dynamic> json) { 110 Shopowner _$ShopownerFromJson(Map<String, dynamic> json) {
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/models/upload_img_model.dart';
  3 +import 'dart:convert' as convert;
  4 +
  5 +class WineManageFaModel {
  6 + int ret;
  7 + List<WineManageModel> data;
  8 + String msg;
  9 +
  10 + WineManageFaModel({this.ret, this.data, this.msg});
  11 +
  12 + WineManageFaModel.fromJson(Map<String, dynamic> json) {
  13 + ret = json['ret'];
  14 + if (json['data'] != null) {
  15 + data = [];
  16 + json['data'].forEach((v) {
  17 + data.add(new WineManageModel.fromJson(v));
  18 + });
  19 + }
  20 + msg = json['msg'];
  21 + }
  22 +
  23 + Map<String, dynamic> toJson() {
  24 + final Map<String, dynamic> data = new Map<String, dynamic>();
  25 + data['ret'] = this.ret;
  26 + if (this.data != null) {
  27 + data['data'] = this.data.map((v) => v.toJson()).toList();
  28 + }
  29 + data['msg'] = this.msg;
  30 + return data;
  31 + }
  32 +}
  33 +
  34 +class WineManageModel {
  35 + String id;
  36 + String sid;
  37 + String uid;
  38 + String rname;
  39 + String sex;
  40 + String phone;
  41 + String isMember;
  42 + List<WineManageSunModel> wineData;
  43 + String cdate;
  44 + String nickName;
  45 +
  46 + List<WineManageSunMoveModel> wineDataMove;
  47 +
  48 + String get sexStr {
  49 + if (sex == null || sex == '') return "";
  50 + switch (sex.toString()) {
  51 + case "1": //先生
  52 + case "男":
  53 + case "先生":
  54 + return "先生";
  55 + case "2": //女士
  56 + case "女":
  57 + case "女士":
  58 + return "女士";
  59 + case "3": //公司
  60 + case "公司":
  61 + return "公司";
  62 + }
  63 + }
  64 +
  65 + WineManageModel(
  66 + {this.id,
  67 + this.sid,
  68 + this.uid,
  69 + this.rname,
  70 + this.sex,
  71 + this.phone,
  72 + this.isMember,
  73 + this.wineData,
  74 + this.cdate,
  75 + this.nickName});
  76 +
  77 + WineManageModel.fromJson(Map<String, dynamic> json) {
  78 + id = json['id'];
  79 + sid = json['sid'];
  80 + uid = json['uid'];
  81 + rname = json['rname'];
  82 + sex = json['sex'];
  83 + phone = json['phone'];
  84 + isMember = json['is_member'];
  85 + wineData = [];
  86 + wineDataMove = [];
  87 + if (json['wine'] != null) {
  88 + wineData = [];
  89 + if (json['wine'] is List) {
  90 + json['wine'].forEach((v) {
  91 + wineData.add(new WineManageSunModel.fromJson(v));
  92 + wineDataMove.add(new WineManageSunMoveModel.fromJson(v));
  93 + });
  94 + } else {
  95 + convert.jsonDecode(json['wine']).forEach((v) {
  96 + wineData.add(new WineManageSunModel.fromJson(v));
  97 + wineDataMove.add(new WineManageSunMoveModel.fromJson(v));
  98 + });
  99 + }
  100 + }
  101 + cdate = json['cdate'];
  102 + nickName = json['nick_name'];
  103 + }
  104 +
  105 + WineManageModel.fromJson2(Map<String, dynamic> json) {
  106 + id = json['id'];
  107 + sid = json['sid'];
  108 + uid = json['uid'];
  109 + rname = json['rname'];
  110 + sex = json['sex'];
  111 + phone = json['phone'];
  112 + isMember = json['is_member'];
  113 + wineData = [];
  114 + wineDataMove = [];
  115 + if (json['wine'] != null) {
  116 + wineData = [];
  117 + if (json['wine'] is List) {
  118 + json['wine'].forEach((v) {
  119 + // wineData.add(new WineManageSunModel.fromJson(v));
  120 + wineDataMove.add(v);
  121 + });
  122 + } else {
  123 + convert.jsonDecode(json['wine']).forEach((v) {
  124 + // wineData.add(new WineManageSunModel.fromJson(v));
  125 + wineDataMove.add(new WineManageSunMoveModel.fromJson(v));
  126 + });
  127 + }
  128 + }
  129 + cdate = json['cdate'];
  130 + nickName = json['nick_name'];
  131 + }
  132 +
  133 + Map<String, dynamic> toJson() {
  134 + final Map<String, dynamic> data = new Map<String, dynamic>();
  135 + data['id'] = this.id;
  136 + data['sid'] = this.sid;
  137 + data['uid'] = this.uid;
  138 + data['rname'] = this.rname;
  139 + data['sex'] = this.sex;
  140 + data['phone'] = this.phone;
  141 + data['is_member'] = this.isMember;
  142 + // data['wine'] = this.wineData;
  143 + data['cdate'] = this.cdate;
  144 + data['nick_name'] = this.nickName;
  145 + data['wine'] = this.wineDataMove;
  146 + return data;
  147 + }
  148 +}
  149 +
  150 +class WineManageSunModel {
  151 + String wineName;
  152 + String wineAmount;
  153 + String unit;
  154 + String wineNumber;
  155 + List<UploadImgModel> img = [];
  156 + TextEditingController wineNameC = TextEditingController(); //酒品名称
  157 + TextEditingController wineNumC = TextEditingController(); //存酒数量
  158 + TextEditingController wineUnitC = TextEditingController(); //计量单位
  159 + TextEditingController wineSerialC = TextEditingController(); //存酒编号
  160 +
  161 + // List<String> imageData = [
  162 + // 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg',
  163 + // 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg'
  164 + // ];
  165 +
  166 + WineManageSunModel({
  167 + this.wineName,
  168 + this.wineAmount,
  169 + this.unit,
  170 + this.wineNumber,
  171 + this.img,
  172 + });
  173 +
  174 + WineManageSunModel.fromJson(Map<String, dynamic> json) {
  175 + wineName = json['wine_name'];
  176 + wineAmount = json['wine_amount'];
  177 + unit = json['unit'];
  178 + wineNumber = json['wine_number'] ?? "";
  179 + img = <UploadImgModel>[];
  180 + if (json['img'] != null) {
  181 + img = <UploadImgModel>[];
  182 + if (json['img'] is List) {
  183 + json['img'].forEach((v) {
  184 + UploadImgModel uploadImgModel = UploadImgModel();
  185 + uploadImgModel.qiniuUrl = v;
  186 + uploadImgModel.process = 1;
  187 + img.add(uploadImgModel);
  188 + });
  189 + } else {
  190 + convert.jsonDecode(json['img']).forEach((v) {
  191 + UploadImgModel uploadImgModel = UploadImgModel();
  192 + uploadImgModel.qiniuUrl = v;
  193 + uploadImgModel.process = 1;
  194 + img.add(uploadImgModel);
  195 + });
  196 + }
  197 + }
  198 + }
  199 +
  200 + Map<String, dynamic> toJson() {
  201 + final Map<String, dynamic> data = new Map<String, dynamic>();
  202 + data['wine_name'] = this.wineName;
  203 + data['wine_amount'] = this.wineAmount;
  204 + data['unit'] = this.unit;
  205 + data['wine_number'] = this.wineNumber;
  206 + data['img'] = this.img;
  207 +
  208 + return data;
  209 + }
  210 +}
  211 +
  212 +class WineManageSunMoveModel {
  213 + String wineName;
  214 + String wineAmount;
  215 + String unit;
  216 + String wineNumber;
  217 + List<String> img;
  218 + String checkAmount;
  219 + // TextEditingController wineNameC = TextEditingController(); //酒品名称
  220 + TextEditingController wineNumC = TextEditingController(); //存酒数量
  221 + // TextEditingController wineUnitC = TextEditingController(); //计量单位
  222 + // TextEditingController wineSerialC = TextEditingController(); //存酒编号
  223 +
  224 + // List<String> imageData = [
  225 + // 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg',
  226 + // 'https://www.ssfiction.com/wp-content/uploads/2020/08/20200805_5f2b1669e9a24.jpg'
  227 + // ];
  228 +
  229 + WineManageSunMoveModel({
  230 + this.wineName,
  231 + this.wineAmount,
  232 + this.unit,
  233 + this.wineNumber,
  234 + this.checkAmount,
  235 + this.img,
  236 + });
  237 +
  238 + WineManageSunMoveModel.fromJson(Map<String, dynamic> json) {
  239 + wineName = json['wine_name'];
  240 + wineAmount = json['wine_amount'];
  241 + // wineNumC.text = wineAmount ?? '';
  242 + unit = json['unit'];
  243 + wineNumber = json['wine_number'] ?? "";
  244 + checkAmount = json['check_amount'] ?? '';
  245 +
  246 + // wineNumC.text = wineNumber;
  247 +
  248 + if (json['img'] != null) {
  249 + img = <String>[];
  250 + if (json['img'] is List) {
  251 + json['img'].forEach((v) {
  252 + img.add(v);
  253 + });
  254 + } else {
  255 + convert.jsonDecode(json['img']).forEach((v) {
  256 + img.add(v);
  257 + });
  258 + }
  259 + }
  260 + }
  261 +
  262 + Map<String, dynamic> toJson() {
  263 + final Map<String, dynamic> data = new Map<String, dynamic>();
  264 + data['wine_name'] = this.wineName;
  265 + data['wine_amount'] = this.wineAmount;
  266 + data['unit'] = this.unit;
  267 + data['wine_number'] = this.wineNumber;
  268 + data['check_amount'] = this.checkAmount;
  269 + data['img'] = this.img;
  270 + return data;
  271 + }
  272 +}
  273 +
  274 +class WineCheckModel {
  275 + String wineName;
  276 + String unit;
  277 + String wineNumber;
  278 + List<String> img;
  279 + String checkAmount;
  280 + WineCheckModel({
  281 + this.wineName,
  282 + this.unit,
  283 + this.wineNumber,
  284 + this.checkAmount,
  285 + this.img,
  286 + });
  287 +
  288 + WineCheckModel.fromJson(Map<String, dynamic> json) {
  289 + wineName = json['wine_name'];
  290 + unit = json['unit'];
  291 + wineNumber = json['wine_number'] ?? "";
  292 + checkAmount = json['check_amount'] ?? "";
  293 +
  294 + // wineNumC.text = wineNumber;
  295 +
  296 + if (json['img'] != null) {
  297 + img = <String>[];
  298 + if (json['img'] is List) {
  299 + json['img'].forEach((v) {
  300 + img.add(v);
  301 + });
  302 + } else {
  303 + convert.jsonDecode(json['img']).forEach((v) {
  304 + img.add(v);
  305 + });
  306 + }
  307 + }
  308 + }
  309 +
  310 + Map<String, dynamic> toJson() {
  311 + final Map<String, dynamic> data = new Map<String, dynamic>();
  312 + data['wine_name'] = this.wineName;
  313 + data['unit'] = this.unit;
  314 + data['wine_number'] = this.wineNumber;
  315 + data['check_amount'] = this.checkAmount;
  316 + data['img'] = this.img;
  317 + return data;
  318 + }
  319 +}
@@ -367,4 +367,29 @@ class HttpUrl { @@ -367,4 +367,29 @@ class HttpUrl {
367 static const String get_seller_template_conf = 367 static const String get_seller_template_conf =
368 "?service=App.Seller.GetSellerTemplateConf"; // 获取商家设置预订安排模板页面 368 "?service=App.Seller.GetSellerTemplateConf"; // 获取商家设置预订安排模板页面
369 369
  370 + static const String set_store_wine_by_seller_user =
  371 + "?service=App.Reserve.SetStoreWineBySellerUser"; // 设置商家存酒管理员
  372 +
  373 + static const String set_store_wine_by_seller =
  374 + "?service=App.Reserve.SetStoreWineBySeller"; // 商家新建存酒
  375 +
  376 + static const String get_store_wine_by_seller =
  377 + "?service=App.Reserve.GetStoreWineBySeller"; // 获取存酒列表
  378 +
  379 + static const String get_store_wine_by_id =
  380 + "?service=App.Reserve.GetStoreWineById"; // 获取存酒详情
  381 +
  382 + static const String set_store_wine_by_seller_check =
  383 + "?service=App.Reserve.SetStoreWineBySellerCheck"; // 取酒出库提交
  384 +
  385 + static const String get_store_wine_check_by_wid =
  386 + "?service=App.Reserve.GetStoreWineCheckByWid"; // 根据存酒ID获取取酒记录
  387 +
  388 + static const String get_store_wine_check_list =
  389 + "?service=App.Reserve.GetStoreWineCheckList"; // 获取取酒记录
  390 +
  391 +
  392 + // static const String send_vc_code =
  393 + // "?service=App.SendSMS.SendVcCode"; // 向指定手机号码发送验证码
  394 +
370 } 395 }
@@ -767,6 +767,10 @@ class _FirstImagePageState extends State<FirstImagePage> { @@ -767,6 +767,10 @@ class _FirstImagePageState extends State<FirstImagePage> {
767 Map homeData = { 767 Map homeData = {
768 'theme_color': 768 'theme_color':
769 themeColorData[themeColorIndex].color.value.toString(), 769 themeColorData[themeColorIndex].color.value.toString(),
  770 + 'red': themeColorData[themeColorIndex].color.red,
  771 + 'green': themeColorData[themeColorIndex].color.green,
  772 + 'blue': themeColorData[themeColorIndex].color.blue,
  773 + 'alpha': themeColorData[themeColorIndex].color.opacity,
770 'title': titleC.text, 774 'title': titleC.text,
771 'slogan': sloganC.text, 775 'slogan': sloganC.text,
772 'image': _uploadImageProvider.firstImage.qiniuUrl 776 'image': _uploadImageProvider.firstImage.qiniuUrl
@@ -665,7 +665,12 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver { @@ -665,7 +665,12 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
665 child: _item( 665 child: _item(
666 Utils.getImgPath('cdgl'), '套餐排菜')), 666 Utils.getImgPath('cdgl'), '套餐排菜')),
667 InkWell( 667 InkWell(
668 - onTap: () {}, child: _item('', '空空空空')), 668 + onTap: () {
  669 + NavigatorUtil.goStoreWineManageHomePage(
  670 + context);
  671 + },
  672 + child: _item(
  673 + Utils.getImgPath('khcj'), '客户存酒')),
669 InkWell( 674 InkWell(
670 onTap: () {}, child: _item('', '空空空空')), 675 onTap: () {}, child: _item('', '空空空空')),
671 InkWell( 676 InkWell(
@@ -10,6 +10,7 @@ import 'package:one_key/models/get_seller_info_model.dart'; @@ -10,6 +10,7 @@ import 'package:one_key/models/get_seller_info_model.dart';
10 import 'package:one_key/models/personnel_manage_model.dart'; 10 import 'package:one_key/models/personnel_manage_model.dart';
11 import 'package:one_key/net/dio_util.dart'; 11 import 'package:one_key/net/dio_util.dart';
12 import 'package:one_key/provider/personnel_provider.dart'; 12 import 'package:one_key/provider/personnel_provider.dart';
  13 +import 'package:one_key/provider/store_wine_provider.dart';
13 import 'package:one_key/provider/user_model.dart'; 14 import 'package:one_key/provider/user_model.dart';
14 import 'package:one_key/res/colors.dart'; 15 import 'package:one_key/res/colors.dart';
15 import 'package:one_key/route/navigator_util.dart'; 16 import 'package:one_key/route/navigator_util.dart';
@@ -45,6 +46,9 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -45,6 +46,9 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
45 String manageShow = '全店未分配客户资源'; 46 String manageShow = '全店未分配客户资源';
46 PersonnelManageSunModel data; 47 PersonnelManageSunModel data;
47 48
  49 + String uid = '';
  50 + String isStoreWine = '0';
  51 +
48 @override 52 @override
49 void initState() { 53 void initState() {
50 super.initState(); 54 super.initState();
@@ -157,6 +161,8 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -157,6 +161,8 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
157 // _getStoreBaseinfo(); 161 // _getStoreBaseinfo();
158 _getWechatQrcode(); 162 _getWechatQrcode();
159 } 163 }
  164 + uid = data.id;
  165 + isStoreWine = data.isStoreWine ?? '0';
160 } 166 }
161 } 167 }
162 168
@@ -300,6 +306,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -300,6 +306,7 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
300 @override 306 @override
301 Widget build(BuildContext context) { 307 Widget build(BuildContext context) {
302 userModel = Provider.of<UserModel>(context, listen: false); 308 userModel = Provider.of<UserModel>(context, listen: false);
  309 +
303 personnelProvider = Provider.of<PersonnelProvider>(context, listen: true); 310 personnelProvider = Provider.of<PersonnelProvider>(context, listen: true);
304 return Scaffold( 311 return Scaffold(
305 backgroundColor: MyColours.color_ffffff, 312 backgroundColor: MyColours.color_ffffff,
@@ -481,6 +488,39 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> { @@ -481,6 +488,39 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
481 color: MyColours.color_438E93, 488 color: MyColours.color_438E93,
482 fontSize: ScreenUtil().setSp(28)), 489 fontSize: ScreenUtil().setSp(28)),
483 )), 490 )),
  491 + VEmptyView(40),
  492 +
  493 + (userModel.user.role_name == '管理员' ||
  494 + userModel.user.role_name == '店长')
  495 + ? InkWell(
  496 + onTap: () async {
  497 + Map<String, String> pramams = {
  498 + 'sid': Provider.of<UserModel>(context, listen: false)
  499 + .user
  500 + .sellerid,
  501 + 'uid': uid,
  502 + 'is_store_wine': isStoreWine == '1' ? '0' : '1'
  503 + };
  504 + StoreWineProvider storeWineProvider =
  505 + Provider.of<StoreWineProvider>(context,
  506 + listen: false);
  507 + bool success = await storeWineProvider
  508 + .setStoreWineBySellerUser(context, pramams,
  509 + showLoading: true);
  510 + if (success) {
  511 + setState(() {
  512 + isStoreWine = isStoreWine == '1' ? '0' : '1';
  513 + });
  514 + }
  515 + },
  516 + child: Text(
  517 + isStoreWine == '1' ? '解除指派存酒管理员' : '指派为存酒管理员',
  518 + style: TextStyle(
  519 + decoration: TextDecoration.underline,
  520 + color: MyColours.color_438E93,
  521 + fontSize: ScreenUtil().setSp(28)),
  522 + ))
  523 + : SizedBox(),
484 // Container( 524 // Container(
485 // margin: EdgeInsets.all(ScreenUtil().setWidth(40)), 525 // margin: EdgeInsets.all(ScreenUtil().setWidth(40)),
486 // child: Column( 526 // child: Column(
  1 +import 'package:cached_network_image/cached_network_image.dart';
  2 +import 'package:common_utils/common_utils.dart';
  3 +import 'package:flutter/material.dart';
  4 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:provider/provider.dart';
  6 +
  7 +import '../../../models/wine_manage_model.dart';
  8 +import '../../../provider/upload_img_provider.dart';
  9 +import '../../../res/colors.dart';
  10 +import '../../../utils/screen_util.dart';
  11 +import '../../../utils/upload_image_util.dart';
  12 +import '../../../utils/utils.dart';
  13 +import '../../../widgets/MyDivider.dart';
  14 +import '../../../widgets/v_empty_view.dart';
  15 +import '../../online_check/img_picker_widget.dart';
  16 +import '../../online_check/photo_view_wiget.dart';
  17 +
  18 +//出库申请item
  19 +
  20 +class ApplyOutStoreItemPage extends StatefulWidget {
  21 + final WineManageSunMoveModel wineManageSunModel;
  22 + final ScrollController controller;
  23 + final int index;
  24 + final String cdate;
  25 +
  26 + ApplyOutStoreItemPage(
  27 + {Key key,
  28 + this.wineManageSunModel,
  29 + this.controller,
  30 + this.index,
  31 + this.cdate})
  32 + : super(key: key);
  33 +
  34 + @override
  35 + _ApplyOutStoreItemPageState createState() => _ApplyOutStoreItemPageState();
  36 +}
  37 +
  38 +class _ApplyOutStoreItemPageState extends State<ApplyOutStoreItemPage> {
  39 + String cdateStr = '';
  40 + // List<String> images = [];
  41 + @override
  42 + void initState() {
  43 + super.initState();
  44 +
  45 + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
  46 + int.parse(widget.cdate.toString()) * 1000);
  47 + cdateStr = DateUtil.formatDate(dateTime, format: DateFormats.full);
  48 +
  49 + // if (widget.wineManageSunModel.img != null) {
  50 + // widget.wineManageSunModel.img.forEach((element) {
  51 + // images.add(element.qiniuUrl);
  52 + // });
  53 + // }
  54 +
  55 + // widget.wineManageSunModel.wineNumC.text =
  56 + // widget.wineManageSunModel.wineAmount;
  57 + }
  58 +
  59 + Widget _textFieldWidget(
  60 + String title, String hintText, TextEditingController controller) {
  61 + return Column(children: [
  62 + Container(
  63 + height: ScreenUtil().setWidth(48 * 2),
  64 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  65 + child: Row(
  66 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  67 + crossAxisAlignment: CrossAxisAlignment.center,
  68 + children: [
  69 + Text(
  70 + title,
  71 + style: TextStyle(
  72 + color: MyColours.color_515151, fontSize: font(16)),
  73 + ),
  74 + Expanded(
  75 + child: Container(
  76 + height: ScreenUtil().setWidth(16 * 2),
  77 + alignment: Alignment.centerRight,
  78 + child: TextField(
  79 + maxLines: 1,
  80 + //输入文本的样式
  81 + style: TextStyle(
  82 + fontSize: ScreenUtil().setSp(32),
  83 + color: MyColours.color_515151),
  84 + controller: controller,
  85 + // focusNode: _phoneNode,
  86 + textAlign: TextAlign.right,
  87 + textAlignVertical: TextAlignVertical.center,
  88 +
  89 + // textAlignVertical:
  90 + // TextAlignVertical.center,
  91 + decoration: InputDecoration(
  92 + hintText: hintText,
  93 + hintStyle: TextStyle(
  94 + color: MyColours.color_999999,
  95 + fontSize: ScreenUtil().setSp(32),
  96 + ),
  97 + contentPadding: EdgeInsets.zero,
  98 + // contentPadding:
  99 + // EdgeInsets.symmetric(
  100 + // vertical: w(12)),
  101 + border:
  102 + OutlineInputBorder(borderSide: BorderSide.none),
  103 + ),
  104 + onChanged: (value) {
  105 + // print(value);
  106 + if (value != null && value.trim().length > 0) {
  107 + bool isNumber =
  108 + Utils.isInteger(value); //判断输入的内容是否是数字
  109 + if (!isNumber) {
  110 + Utils.showToast('请输入数字');
  111 + controller.text = '';
  112 + return;
  113 + }
  114 + if (int.parse(value) >
  115 + int.parse(
  116 + widget.wineManageSunModel.wineAmount)) {
  117 + Utils.showToast('出库数量大于库存数量,请重新输入!');
  118 + controller.text = '';
  119 + return;
  120 + }
  121 + widget.wineManageSunModel.checkAmount = value;
  122 + controller.text = value;
  123 + }
  124 +
  125 + // if (value.trim().isEmpty || value.trim().length > 11) {
  126 + // //内容为空,或 超过11位
  127 + // setState(() {
  128 + // _baseIndoProvider.userHistorys.clear();
  129 + // });
  130 + // return;
  131 + // }
  132 + // Map<String, String> params = {
  133 + // "keywords": value.trim(),
  134 + // "sid": Provider.of<UserModel>(context, listen: false)
  135 + // .user
  136 + // .sellerid,
  137 + // };
  138 + // _baseIndoProvider.getUserHistorys(context, params);
  139 + },
  140 + onEditingComplete: () {
  141 + FocusScope.of(context).requestFocus(FocusNode());
  142 + },
  143 + onTap: () {
  144 + // setState(() {
  145 + // showPhoneHistory = true;
  146 + // });
  147 + // Future.delayed(Duration(milliseconds: 300), () {
  148 + // _controller.jumpTo(_controller.position.maxScrollExtent);
  149 + // });
  150 + },
  151 + keyboardType: TextInputType.number,
  152 + ))),
  153 + // InkWell(
  154 + // onTap: () {
  155 + // // _openAddressBook();
  156 + // },
  157 + // child: Container(
  158 + // width: ScreenUtil().setWidth(74) * 2,
  159 + // height: ScreenUtil().setWidth(48),
  160 + // alignment: Alignment.centerRight,
  161 + // child: Text('一键录入',
  162 + // style: TextStyle(
  163 + // color: MyColours.color_515151,
  164 + // fontSize: ScreenUtil().setSp(28),
  165 + // )),
  166 + // ),
  167 + // ),
  168 + ],
  169 + )),
  170 + MyDivider(
  171 + double.infinity,
  172 + h(0.5),
  173 + color: MyColours.color_E7E7E7,
  174 + ),
  175 + ]);
  176 + }
  177 +
  178 + Widget _textWidget(String title, String subTitle) {
  179 + return Column(children: [
  180 + Container(
  181 + height: ScreenUtil().setWidth(48 * 2),
  182 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  183 + child: Row(
  184 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  185 + crossAxisAlignment: CrossAxisAlignment.center,
  186 + children: [
  187 + Text(
  188 + title,
  189 + style: TextStyle(
  190 + color: MyColours.color_515151, fontSize: font(16)),
  191 + ),
  192 + Expanded(
  193 + child: Container(
  194 + height: ScreenUtil().setWidth(16 * 2),
  195 + alignment: Alignment.centerRight,
  196 + child: Text(
  197 + subTitle,
  198 + //输入文本的样式
  199 + style: TextStyle(
  200 + fontSize: ScreenUtil().setSp(32),
  201 + color: MyColours.color_999999),
  202 + )),
  203 + )
  204 + ],
  205 + )),
  206 + MyDivider(
  207 + double.infinity,
  208 + h(0.5),
  209 + color: MyColours.color_E7E7E7,
  210 + ),
  211 + ]);
  212 + }
  213 +
  214 + //查看大图
  215 + _showPhotoView(BuildContext context, int index, List<String> imgs,
  216 + {isShow = false, List dashName}) async {
  217 + // if (imgs.length == 1 &&
  218 + // imgs[0] ==
  219 + // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
  220 + // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
  221 + // }
  222 + Utils.setBarStatus(false, color: Colors.black);
  223 + dynamic result = await showGeneralDialog(
  224 + context: context,
  225 + barrierDismissible: false,
  226 + // barrierColor: Colors.red,
  227 + barrierLabel:
  228 + MaterialLocalizations.of(context).modalBarrierDismissLabel,
  229 + transitionDuration: const Duration(milliseconds: 150),
  230 + pageBuilder: (BuildContext context, Animation animation,
  231 + Animation secondaryAnimation) {
  232 + Widget child = Stack(
  233 + children: <Widget>[
  234 + PhotoPreview(
  235 + initialIndex: index,
  236 + photoList: imgs,
  237 + isShow: isShow,
  238 + dashName: dashName)
  239 + ],
  240 + );
  241 + return child;
  242 + });
  243 + Utils.setBarStatus(true, color: Colors.white);
  244 + }
  245 +
  246 + /// 九宫格
  247 + Widget _getGridImg(context, List<String> temp) {
  248 + return GridView.builder(
  249 + controller: widget.controller,
  250 + // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
  251 + shrinkWrap: true,
  252 + itemCount: temp.length,
  253 +
  254 + //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
  255 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  256 + //横轴元素个数
  257 + crossAxisCount: 3,
  258 + //纵轴间距
  259 + mainAxisSpacing: ScreenUtil().setWidth(40),
  260 + //横轴间距
  261 + crossAxisSpacing: ScreenUtil().setWidth(36),
  262 + //子组件宽高长度比例
  263 + childAspectRatio: 1.0),
  264 + itemBuilder: (BuildContext context, int index) {
  265 + //Widget Function(BuildContext context, int index)
  266 +
  267 + return temp.length < 1
  268 + ? Text('')
  269 + : InkWell(
  270 + onTap: () {
  271 + ///没有上传完成的不可以点击
  272 + _showPhotoView(context, index, temp);
  273 + },
  274 + child: CachedNetworkImage(
  275 + imageUrl: temp[index],
  276 + fit: BoxFit.cover,
  277 + width: ScreenUtil().setWidth(100 * 2),
  278 + height: ScreenUtil().setWidth(100 * 2),
  279 + ));
  280 + });
  281 + }
  282 +
  283 + @override
  284 + Widget build(BuildContext context) {
  285 + return Container(
  286 + color: Colors.white,
  287 + padding: EdgeInsets.only(left: w(16)),
  288 + margin:
  289 + EdgeInsets.only(top: w(16), bottom: w(10), left: w(20), right: w(20)),
  290 + child: Column(
  291 + children: [
  292 + _textWidget(
  293 + '酒品名称',
  294 + widget.wineManageSunModel.wineName,
  295 + ),
  296 + VEmptyView(16),
  297 + _textFieldWidget(
  298 + '出库数量', '请输入出库数量', widget.wineManageSunModel.wineNumC),
  299 + VEmptyView(16),
  300 + _textWidget('计量单位', widget.wineManageSunModel.unit),
  301 + VEmptyView(16),
  302 + _textWidget('存酒编号', widget.wineManageSunModel.wineNumber),
  303 + VEmptyView(16),
  304 + _textWidget('存酒日期', cdateStr),
  305 + VEmptyView(16),
  306 + widget.wineManageSunModel.img == null
  307 + ? SizedBox()
  308 + : _getGridImg(context, widget.wineManageSunModel.img),
  309 + widget.wineManageSunModel.img == null ? SizedBox() : VEmptyView(16),
  310 + ],
  311 + ),
  312 + );
  313 + }
  314 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:provider/provider.dart';
  5 +
  6 +import '../../../models/wine_manage_model.dart';
  7 +import '../../../provider/store_wine_provider.dart';
  8 +import '../../../res/colors.dart';
  9 +import '../../../route/navigator_util.dart';
  10 +import '../../../utils/screen_util.dart';
  11 +import '../../../utils/utils.dart';
  12 +import '../../../widgets/MyDivider.dart';
  13 +import '../../../widgets/h_empty_view.dart';
  14 +import '../../../widgets/round_button.dart';
  15 +import '../../../widgets/system_app_bar.dart';
  16 +import '../../../widgets/v_empty_view.dart';
  17 +import 'apply_out_store_item_page.dart';
  18 +
  19 +/**
  20 + * 申请出库页面
  21 + */
  22 +
  23 +class ApplyOutStorePage extends StatefulWidget {
  24 + final WineManageModel wineManageDetail;
  25 + ApplyOutStorePage({Key key, this.wineManageDetail}) : super(key: key);
  26 +
  27 + @override
  28 + _ApplyOutStorePageState createState() => _ApplyOutStorePageState();
  29 +}
  30 +
  31 +class _ApplyOutStorePageState extends State<ApplyOutStorePage> {
  32 + StoreWineProvider storeWineProvider;
  33 +
  34 + ScrollController _controller = ScrollController();
  35 +
  36 + @override
  37 + void initState() {
  38 + // TODO: implement initState
  39 + super.initState();
  40 + }
  41 +
  42 + Widget _textItemWidget(
  43 + String title,
  44 + String subTitle,
  45 + ) {
  46 + return Column(children: [
  47 + Container(
  48 + height: ScreenUtil().setWidth(48 * 2),
  49 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  50 + child: Row(
  51 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  52 + crossAxisAlignment: CrossAxisAlignment.center,
  53 + children: [
  54 + Text(
  55 + title,
  56 + style: TextStyle(
  57 + color: MyColours.color_515151, fontSize: font(16)),
  58 + ),
  59 + Text(subTitle,
  60 + //输入文本的样式
  61 + style: TextStyle(
  62 + fontSize: ScreenUtil().setSp(32),
  63 + color: MyColours.color_999999)),
  64 + // ),
  65 + ],
  66 + )),
  67 + MyDivider(
  68 + double.infinity,
  69 + h(0.5),
  70 + color: MyColours.color_E7E7E7,
  71 + ),
  72 + ]);
  73 + }
  74 +
  75 + @override
  76 + Widget build(BuildContext context) {
  77 + storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true);
  78 + return KeyboardDismissOnTap(
  79 + child: Scaffold(
  80 + appBar: SystemAppBar(
  81 + '存酒出库',
  82 + onTap: () {
  83 + Navigator.pop(context);
  84 + },
  85 + ),
  86 + body: Container(
  87 + child: Column(
  88 + children: [
  89 + Expanded(
  90 + child: SingleChildScrollView(
  91 + controller: _controller,
  92 + child: Column(
  93 + children: [
  94 + Container(
  95 + color: Colors.white,
  96 + padding: EdgeInsets.only(
  97 + left: ScreenUtil().setWidth(16 * 2)),
  98 + child: Column(
  99 + crossAxisAlignment: CrossAxisAlignment.center,
  100 + mainAxisAlignment: MainAxisAlignment.start,
  101 + children: [
  102 + VEmptyView(32),
  103 + _textItemWidget(
  104 + '联系电话',
  105 + Utils.starPhone(
  106 + widget.wineManageDetail.phone)),
  107 + Container(
  108 + height: ScreenUtil().setWidth(48 * 2),
  109 + padding: EdgeInsets.only(
  110 + top: ScreenUtil().setWidth(16 * 2),
  111 + right: ScreenUtil().setWidth(16 * 2)),
  112 + child: Row(
  113 + mainAxisAlignment:
  114 + MainAxisAlignment.spaceBetween,
  115 + crossAxisAlignment:
  116 + CrossAxisAlignment.center,
  117 + children: [
  118 + Text(
  119 + '客人姓名',
  120 + style: TextStyle(
  121 + color: MyColours.color_515151,
  122 + fontSize: font(16)),
  123 + ),
  124 + Expanded(
  125 + child: Container(
  126 + height: ScreenUtil().setWidth(16 * 2),
  127 + alignment: Alignment.centerRight,
  128 + child: Text(
  129 + widget.wineManageDetail.rname +
  130 + widget
  131 + .wineManageDetail.sexStr,
  132 + style: TextStyle(
  133 + fontSize:
  134 + ScreenUtil().setSp(32),
  135 + color:
  136 + MyColours.color_999999)),
  137 + )),
  138 + HEmptyView(40),
  139 + Container(
  140 + width: w(100),
  141 + alignment: Alignment.centerRight,
  142 + child: Text(
  143 + // '会员状态未知',
  144 + widget.wineManageDetail.isMember ==
  145 + '1'
  146 + ? '会员'
  147 + : '会员状态未知',
  148 + style: TextStyle(
  149 + color: widget.wineManageDetail
  150 + .isMember !=
  151 + '1'
  152 + ? MyColours.color_999999
  153 + : MyColours.color_515151,
  154 + fontSize: ScreenUtil().setSp(32),
  155 + ),
  156 + ),
  157 + ),
  158 + ],
  159 + )),
  160 + ],
  161 + )),
  162 + ListView.builder(
  163 + shrinkWrap: true,
  164 + controller: _controller,
  165 + itemCount:
  166 + widget.wineManageDetail.wineDataMove.length,
  167 + itemBuilder: (context, index) {
  168 + WineManageSunMoveModel wineManageModel =
  169 + widget.wineManageDetail.wineDataMove[index];
  170 + return ApplyOutStoreItemPage(
  171 + wineManageSunModel: wineManageModel,
  172 + controller: _controller,
  173 + index: index,
  174 + cdate: widget.wineManageDetail.cdate);
  175 + }),
  176 + ],
  177 + ),
  178 + )),
  179 + Container(
  180 + alignment: Alignment.centerLeft,
  181 + margin: EdgeInsets.only(
  182 + left: w(20), right: w(20), top: w(10), bottom: w(16)),
  183 + child: Text(
  184 + '注:为保障酒品安排,只有存酒管理员才可以进行存酒操作!',
  185 + style: TextStyle(
  186 + color: MyColours.color_999999, fontSize: font(10)),
  187 + )),
  188 + Container(
  189 + color: MyColours.color_ffffff,
  190 + padding: EdgeInsets.only(
  191 + top: ScreenUtil().setWidth(16 * 2),
  192 + bottom: ScreenUtil().setWidth(35 * 2),
  193 + left: ScreenUtil().setWidth(45 * 2),
  194 + right: ScreenUtil().setWidth(45 * 2),
  195 + ),
  196 + child: RoundButton(
  197 + text: '提交出库申请',
  198 + width: double.infinity,
  199 + height: ScreenUtil().setWidth(80),
  200 + radius: ScreenUtil().setWidth(10),
  201 + isBold: true,
  202 + fontSize: 32,
  203 + onPressed: () async {
  204 + // Utils.showToast('您不是店铺的存酒管理员,无权进行相关操作。');
  205 + // UserModel userModel =
  206 + // Provider.of<UserModel>(context, listen: false);
  207 + // if (userModel.user.role_name == '管理员' ||
  208 + // userModel.user.role_name == '店长') {
  209 + bool can = false;
  210 +
  211 + outerloop:
  212 + for (int i = 0;
  213 + i < widget.wineManageDetail.wineDataMove.length;
  214 + i++) {
  215 + WineManageSunMoveModel element =
  216 + widget.wineManageDetail.wineDataMove[i];
  217 + // if (element.wineNameC.text.trim().length == 0) {
  218 + // Utils.showToast('请输入酒品名称!');
  219 + // // return false;
  220 + // can = false;
  221 + // break outerloop;
  222 + // }
  223 +
  224 + if (element.wineNumC.text != null &&
  225 + element.wineNumC.text.trim().length > 0) {
  226 + //有一个输入数量即可提交出库申请
  227 + can = true;
  228 + break outerloop;
  229 + }
  230 + // if (element.wineUnitC.text.trim().length == 0) {
  231 + // Utils.showToast('请输入计量单位!');
  232 + // can = false;
  233 + // break outerloop;
  234 + // }
  235 + // if (element.wineSerialC.text.trim().length == 0) {
  236 + // Utils.showToast('请输入存酒编号!');
  237 + // can = false;
  238 + // break outerloop;
  239 + // }
  240 + // innerloop:
  241 + // for (UploadImgModel item in element.img) {
  242 + // if (item.process < 1) {
  243 + // Utils.showToast('正在上传图片,请稍等');
  244 + // // return false;
  245 + // can = false;
  246 + // break outerloop;
  247 + // }
  248 + // }
  249 + }
  250 + if (can) {
  251 + WineManageModel modelTemp =
  252 + WineManageModel.fromJson2(
  253 + widget.wineManageDetail.toJson());
  254 +
  255 + modelTemp.wineData = [];
  256 +
  257 + NavigatorUtil.goSmsCodeInputPage(
  258 + context, modelTemp);
  259 + } else {
  260 + Utils.showToast('请输入出库数量!');
  261 + }
  262 + // } else {
  263 + // bool needRefresh =
  264 + // await NavigatorUtil.goCouponEditPage(context);
  265 + // print(needRefresh);
  266 + // if (needRefresh != null && needRefresh) {
  267 + // bus.emit('refresh_coupon_list_f');
  268 + // //刷新页面数据
  269 + // // _controller.callRefresh();
  270 + // // _couponNetworkData(tabController.index);
  271 + // }
  272 + // }
  273 + },
  274 + ))
  275 + ],
  276 + ),
  277 + )));
  278 + }
  279 +}
  1 +import 'dart:convert';
  2 +
  3 +import 'package:flutter/material.dart';
  4 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:one_key/pages/my/store_wine_manage/create_wine_item_page.dart';
  6 +import 'package:one_key/widgets/MyDivider.dart';
  7 +import 'package:one_key/widgets/v_empty_view.dart';
  8 +import 'package:provider/provider.dart';
  9 +
  10 +import '../../../app.dart';
  11 +import '../../../models/upload_img_model.dart';
  12 +import '../../../models/wine_manage_model.dart';
  13 +import '../../../provider/store_wine_provider.dart';
  14 +import '../../../provider/user_model.dart';
  15 +import '../../../res/colors.dart';
  16 +import '../../../utils/dialog_util.dart';
  17 +import '../../../utils/event_bus.dart';
  18 +import '../../../utils/screen_util.dart';
  19 +import '../../../utils/utils.dart';
  20 +import '../../../widgets/h_empty_view.dart';
  21 +import '../../../widgets/round_button.dart';
  22 +import '../../../widgets/system_app_bar.dart';
  23 +
  24 +/**
  25 + * 新建存酒
  26 + */
  27 +
  28 +class CreateStoreWinePage extends StatefulWidget {
  29 + CreateStoreWinePage({Key key}) : super(key: key);
  30 +
  31 + @override
  32 + _CreateStoreWinePageState createState() => _CreateStoreWinePageState();
  33 +}
  34 +
  35 +class _CreateStoreWinePageState extends State<CreateStoreWinePage> {
  36 + StoreWineProvider storeWineProvider;
  37 + int sexSelectIndex = 0;
  38 + String sexStr = '先生';
  39 + List sexList = [];
  40 +
  41 + ScrollController _controller = ScrollController();
  42 + TextEditingController phoneC = TextEditingController(); //电话
  43 + TextEditingController nameC = TextEditingController(); //客人姓名
  44 + List<WineManageSunModel> dataWine = [];
  45 +
  46 + String wineSerial = '';
  47 + int wineSerialSub = 1;
  48 +
  49 + @override
  50 + void initState() {
  51 + // TODO: implement initState
  52 +
  53 + super.initState();
  54 +
  55 + wineSerialSub = App.sp.getInt("wineSerialSub") ?? 1;
  56 + sexList = ['先生', '女士', '公司'];
  57 + _initWineSerial();
  58 + WineManageSunModel wineManageModel = WineManageSunModel();
  59 + wineManageModel.wineSerialC.text =
  60 + wineSerial + Utils.addZeroNumberWithDouble(wineSerialSub);
  61 + wineManageModel.img = [];
  62 + dataWine.add(wineManageModel);
  63 + }
  64 +
  65 + ///初始化存酒编号
  66 + _initWineSerial() {
  67 + DateTime dateTime = DateTime.now();
  68 + String year = dateTime.year.toString();
  69 + wineSerial = year.substring(year.length - 2, year.length) +
  70 + Utils.addZeroNumber(dateTime.month) +
  71 + Utils.addZeroNumber(dateTime.day);
  72 + }
  73 +
  74 + Widget _textFieldWidget(
  75 + String title, String hintText, TextEditingController controller) {
  76 + return Column(children: [
  77 + Container(
  78 + height: ScreenUtil().setWidth(48 * 2),
  79 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  80 + child: Row(
  81 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  82 + crossAxisAlignment: CrossAxisAlignment.center,
  83 + children: [
  84 + Text(
  85 + title,
  86 + style: TextStyle(
  87 + color: MyColours.color_515151, fontSize: font(16)),
  88 + ),
  89 + Expanded(
  90 + child: Container(
  91 + height: ScreenUtil().setWidth(16 * 2),
  92 + alignment: Alignment.centerRight,
  93 + child: TextField(
  94 + maxLines: 1,
  95 + //输入文本的样式
  96 + style: TextStyle(
  97 + fontSize: ScreenUtil().setSp(32),
  98 + color: MyColours.color_515151),
  99 + controller: controller,
  100 + // focusNode: _phoneNode,
  101 + textAlign: TextAlign.right,
  102 + textAlignVertical: TextAlignVertical.center,
  103 +
  104 + // textAlignVertical:
  105 + // TextAlignVertical.center,
  106 + decoration: InputDecoration(
  107 + hintText: hintText,
  108 + hintStyle: TextStyle(
  109 + color: MyColours.color_999999,
  110 + fontSize: ScreenUtil().setSp(32),
  111 + ),
  112 + contentPadding: EdgeInsets.zero,
  113 + // contentPadding:
  114 + // EdgeInsets.symmetric(
  115 + // vertical: w(12)),
  116 + border:
  117 + OutlineInputBorder(borderSide: BorderSide.none),
  118 + ),
  119 + onChanged: (value) {
  120 + print(value);
  121 + // if (value.trim().isEmpty || value.trim().length > 11) {
  122 + // //内容为空,或 超过11位
  123 + // setState(() {
  124 + // _baseIndoProvider.userHistorys.clear();
  125 + // });
  126 + // return;
  127 + // }
  128 + // Map<String, String> params = {
  129 + // "keywords": value.trim(),
  130 + // "sid": Provider.of<UserModel>(context, listen: false)
  131 + // .user
  132 + // .sellerid,
  133 + // };
  134 + // _baseIndoProvider.getUserHistorys(context, params);
  135 + },
  136 + onEditingComplete: () {
  137 + // _phoneNode.unfocus();
  138 + FocusScope.of(context).requestFocus(FocusNode());
  139 + },
  140 + onTap: () {
  141 + // setState(() {
  142 + // showPhoneHistory = true;
  143 + // });
  144 + // Future.delayed(Duration(milliseconds: 300), () {
  145 + // _controller.jumpTo(_controller.position.maxScrollExtent);
  146 + // });
  147 + },
  148 + keyboardType: TextInputType.number,
  149 + ))),
  150 + // InkWell(
  151 + // onTap: () {
  152 + // // _openAddressBook();
  153 + // },
  154 + // child: Container(
  155 + // width: ScreenUtil().setWidth(74) * 2,
  156 + // height: ScreenUtil().setWidth(48),
  157 + // alignment: Alignment.centerRight,
  158 + // child: Text('一键录入',
  159 + // style: TextStyle(
  160 + // color: MyColours.color_515151,
  161 + // fontSize: ScreenUtil().setSp(28),
  162 + // )),
  163 + // ),
  164 + // ),
  165 + ],
  166 + )),
  167 + MyDivider(
  168 + double.infinity,
  169 + h(0.5),
  170 + color: MyColours.color_E7E7E7,
  171 + ),
  172 + ]);
  173 + }
  174 +
  175 + @override
  176 + Widget build(BuildContext context) {
  177 + storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true);
  178 + return Scaffold(
  179 + appBar: SystemAppBar(
  180 + '新建存酒',
  181 + onTap: () {
  182 + Navigator.pop(context);
  183 + },
  184 + ),
  185 + body: Container(
  186 + child: Column(
  187 + children: [
  188 + Expanded(
  189 + child: SingleChildScrollView(
  190 + controller: _controller,
  191 + child: Column(
  192 + children: [
  193 + Container(
  194 + color: Colors.white,
  195 + padding: EdgeInsets.only(
  196 + left: ScreenUtil().setWidth(16 * 2)),
  197 + child: Column(
  198 + crossAxisAlignment: CrossAxisAlignment.center,
  199 + mainAxisAlignment: MainAxisAlignment.start,
  200 + children: [
  201 + VEmptyView(32),
  202 + _textFieldWidget('联系电话', "点击输入客人电话", phoneC),
  203 + Container(
  204 + height: ScreenUtil().setWidth(48 * 2),
  205 + padding: EdgeInsets.only(
  206 + top: ScreenUtil().setWidth(16 * 2),
  207 + right: ScreenUtil().setWidth(16 * 2)),
  208 + child: Row(
  209 + mainAxisAlignment:
  210 + MainAxisAlignment.spaceBetween,
  211 + crossAxisAlignment: CrossAxisAlignment.center,
  212 + children: [
  213 + Text(
  214 + '客人姓名',
  215 + style: TextStyle(
  216 + color: MyColours.color_515151,
  217 + fontSize: font(16)),
  218 + ),
  219 + Expanded(
  220 + child: Container(
  221 + height:
  222 + ScreenUtil().setWidth(16 * 2),
  223 + alignment: Alignment.centerRight,
  224 + child: TextField(
  225 + maxLines: 1,
  226 + //输入文本的样式
  227 + style: TextStyle(
  228 + fontSize:
  229 + ScreenUtil().setSp(32),
  230 + color:
  231 + MyColours.color_515151),
  232 + controller: nameC,
  233 + // focusNode: _phoneNode,
  234 + textAlign: TextAlign.right,
  235 + textAlignVertical:
  236 + TextAlignVertical.center,
  237 +
  238 + // textAlignVertical:
  239 + // TextAlignVertical.center,
  240 + decoration: InputDecoration(
  241 + hintText: "点击输入",
  242 + hintStyle: TextStyle(
  243 + color: MyColours.color_999999,
  244 + fontSize:
  245 + ScreenUtil().setSp(32),
  246 + ),
  247 + contentPadding: EdgeInsets.zero,
  248 + // contentPadding:
  249 + // EdgeInsets.symmetric(
  250 + // vertical: w(12)),
  251 + border: OutlineInputBorder(
  252 + borderSide:
  253 + BorderSide.none),
  254 + ),
  255 + onChanged: (value) {
  256 + print(value);
  257 + // if (value.trim().isEmpty || value.trim().length > 11) {
  258 + // //内容为空,或 超过11位
  259 + // setState(() {
  260 + // _baseIndoProvider.userHistorys.clear();
  261 + // });
  262 + // return;
  263 + // }
  264 + // Map<String, String> params = {
  265 + // "keywords": value.trim(),
  266 + // "sid": Provider.of<UserModel>(context, listen: false)
  267 + // .user
  268 + // .sellerid,
  269 + // };
  270 + // _baseIndoProvider.getUserHistorys(context, params);
  271 + },
  272 + onEditingComplete: () {
  273 + // _phoneNode.unfocus();
  274 + FocusScope.of(context)
  275 + .requestFocus(FocusNode());
  276 + },
  277 + onTap: () {
  278 + // setState(() {
  279 + // showPhoneHistory = true;
  280 + // });
  281 + // Future.delayed(Duration(milliseconds: 300), () {
  282 + // _controller.jumpTo(_controller.position.maxScrollExtent);
  283 + // });
  284 + },
  285 + keyboardType: TextInputType.text,
  286 + ))),
  287 + HEmptyView(10),
  288 + InkWell(
  289 + onTap: () {
  290 + FocusScope.of(context)
  291 + .requestFocus(FocusNode()); //隐藏键盘
  292 +
  293 + DialogUtil.showSelectCusmanDialog(
  294 + context, sexList, (value) async {
  295 + if (value != null) {
  296 + sexSelectIndex = value.first;
  297 + sexStr = sexList[sexSelectIndex];
  298 +
  299 + setState(() {});
  300 + }
  301 + }, selecteds: [sexSelectIndex]).then(
  302 + (value) {});
  303 + },
  304 + child: Row(children: [
  305 + Text(
  306 + sexStr,
  307 + style: TextStyle(
  308 + color: MyColours.color_515151,
  309 + fontSize: ScreenUtil().setSp(32),
  310 + ),
  311 + ),
  312 + Image.asset(
  313 + Utils.getImgPath('quan_down_f'),
  314 + width: ScreenUtil().setWidth(28),
  315 + height: ScreenUtil().setWidth(28)),
  316 + ]),
  317 + ),
  318 + HEmptyView(40),
  319 + Container(
  320 + width: w(100),
  321 + alignment: Alignment.centerRight,
  322 + child: Text(
  323 + '会员状态未知',
  324 + // '会员',
  325 + style: TextStyle(
  326 + color: true
  327 + ? MyColours.color_999999
  328 + : MyColours.color_515151,
  329 + fontSize: ScreenUtil().setSp(32),
  330 + ),
  331 + ),
  332 + ),
  333 + ],
  334 + )),
  335 + ],
  336 + )),
  337 + ListView.builder(
  338 + shrinkWrap: true,
  339 + controller: _controller,
  340 + itemCount: dataWine.length,
  341 + itemBuilder: (context, index) {
  342 + WineManageSunModel wineManageModel = dataWine[index];
  343 + return CreateWineItemPage(
  344 + wineManageSunModel: wineManageModel,
  345 + controller: _controller,
  346 + index: index,
  347 + onDel: () {
  348 + dataWine.removeAt(index);
  349 + setState(() {});
  350 + },
  351 + );
  352 + }),
  353 + InkWell(
  354 + onTap: () {
  355 + WineManageSunModel model = WineManageSunModel();
  356 + wineSerialSub++;
  357 + model.wineSerialC.text = wineSerial +
  358 + Utils.addZeroNumberWithDouble(wineSerialSub);
  359 + model.img = [];
  360 + dataWine.add(model);
  361 + setState(() {});
  362 + },
  363 + child: Container(
  364 + color: Colors.white,
  365 + width: double.infinity,
  366 + height: w(48),
  367 + alignment: Alignment.center,
  368 + margin: EdgeInsets.symmetric(horizontal: w(20)),
  369 + child: Text(
  370 + '再加一项',
  371 + style: TextStyle(
  372 + color: MyColours.color_438E93,
  373 + fontSize: font(16)),
  374 + ),
  375 + ))
  376 + ],
  377 + ),
  378 + )),
  379 + Container(
  380 + height: ScreenUtil().setWidth(91 * 2),
  381 + width: double.infinity,
  382 + padding: EdgeInsets.only(
  383 + top: ScreenUtil().setWidth(16 * 2),
  384 + bottom: ScreenUtil().setWidth(35 * 2),
  385 + left: ScreenUtil().setWidth(45 * 2),
  386 + right: ScreenUtil().setWidth(45 * 2),
  387 + ),
  388 + decoration: BoxDecoration(
  389 + color: MyColours.color_ffffff,
  390 + boxShadow: [
  391 + BoxShadow(
  392 + spreadRadius: ScreenUtil().setWidth(2),
  393 + color: Color.fromRGBO(0, 0, 0, 0.1),
  394 + offset: Offset(0, ScreenUtil().setWidth(-2)),
  395 + blurRadius: ScreenUtil().setWidth(8))
  396 + ],
  397 + borderRadius: BorderRadius.all(
  398 + Radius.circular(ScreenUtil().setWidth(16)),
  399 + ),
  400 + ),
  401 + child: RoundButton(
  402 + text: '保存',
  403 + height: ScreenUtil().setWidth(80),
  404 + radius: ScreenUtil().setWidth(10),
  405 + isBold: true,
  406 + fontSize: 32,
  407 + onPressed: () async {
  408 + // outerloop:
  409 + // for (int i = 1; i <= 3; i++) {
  410 + // innerloop:
  411 + // for (int j = 1; j <= 3; j++) {
  412 + // if (i == 2 && j == 2) {
  413 + // break outerloop;
  414 + // }
  415 + // print('$i $j');
  416 + // }
  417 + // }
  418 +
  419 + //判读非空
  420 +
  421 + if (phoneC.text.trim().length == 0) {
  422 + Utils.showToast('请输入联系电话!');
  423 + return false;
  424 + }
  425 + if (nameC.text.trim().length == 0) {
  426 + Utils.showToast('请输入客人姓名!');
  427 + return false;
  428 + }
  429 + if (dataWine.length == 0) {
  430 + Utils.showToast('请输入酒品信息!');
  431 + return false;
  432 + }
  433 +
  434 + bool can = true;
  435 +
  436 + outerloop:
  437 + for (int i = 0; i < dataWine.length; i++) {
  438 + WineManageSunModel element = dataWine[i];
  439 + if (element.wineNameC.text.trim().length == 0) {
  440 + Utils.showToast('请输入酒品名称!');
  441 + // return false;
  442 + can = false;
  443 + break outerloop;
  444 + }
  445 +
  446 + if (element.wineNumC.text.trim().length == 0) {
  447 + Utils.showToast('请输入酒品数量!');
  448 + can = false;
  449 + break outerloop;
  450 + }
  451 + if (element.wineUnitC.text.trim().length == 0) {
  452 + Utils.showToast('请输入计量单位!');
  453 + can = false;
  454 + break outerloop;
  455 + }
  456 + if (element.wineSerialC.text.trim().length == 0) {
  457 + Utils.showToast('请输入存酒编号!');
  458 + can = false;
  459 + break outerloop;
  460 + }
  461 + innerloop:
  462 + for (UploadImgModel item in element.img) {
  463 + if (item.process < 1) {
  464 + Utils.showToast('正在上传图片,请稍等');
  465 + // return false;
  466 + can = false;
  467 + break outerloop;
  468 + }
  469 + }
  470 + }
  471 + if (can) {
  472 + List<Map<String, String>> data = [];
  473 + dataWine.forEach((element) {
  474 + List<String> images = [];
  475 + element.img.forEach((value) {
  476 + images.add(value.qiniuUrl);
  477 + });
  478 + Map<String, String> map = {
  479 + 'wine_name': element.wineNameC.text,
  480 + 'wine_amount': element.wineNumC.text,
  481 + 'unit': element.wineUnitC.text,
  482 + 'wine_number': element.wineSerialC.text,
  483 + 'img':
  484 + images.length == 0 ? null : json.encode(images),
  485 + };
  486 + data.add(map);
  487 + });
  488 +
  489 + Map<String, String> pramas = {
  490 + 'sid': Provider.of<UserModel>(context, listen: false)
  491 + .user
  492 + .sellerid,
  493 + 'uid': Provider.of<UserModel>(context, listen: false)
  494 + .user
  495 + .openid,
  496 + 'rname': nameC.text,
  497 + 'sex': '${sexSelectIndex + 1}', //性别 1 男 2 女 3 公司
  498 + 'is_member': '1', //会员状态
  499 + 'phone': phoneC.text,
  500 + 'wine': json.encode(data)
  501 + };
  502 + // if (widget.id != null) {
  503 + //修改存酒信息
  504 + // pramas['id'] = widget.id;
  505 + // }
  506 + bool success = await storeWineProvider
  507 + .setStoreWineBySeller(context, pramas,
  508 + showLoading: true);
  509 + if (success) {
  510 + App.sp.setInt("wineSerialSub", wineSerialSub + 1);
  511 + //存酒成功,返回列表,并刷新
  512 + bus.emit('refresh_wine_home_all_list');
  513 + Navigator.pop(context);
  514 + }
  515 + }
  516 +
  517 + // UserModel userModel =
  518 + // Provider.of<UserModel>(context, listen: false);
  519 + // if (userModel.user.role_name == '管理员' ||
  520 + // userModel.user.role_name == '店长') {
  521 + // NavigatorUtil.goCouponCreateSelectTypePage(context);
  522 + // } else {
  523 + // bool needRefresh =
  524 + // await NavigatorUtil.goCouponEditPage(context);
  525 + // print(needRefresh);
  526 + // if (needRefresh != null && needRefresh) {
  527 + // bus.emit('refresh_coupon_list_f');
  528 + // //刷新页面数据
  529 + // // _controller.callRefresh();
  530 + // // _couponNetworkData(tabController.index);
  531 + // }
  532 + // }
  533 + },
  534 + ),
  535 + )
  536 + ],
  537 + ),
  538 + ));
  539 + }
  540 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter/services.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:one_key/models/upload_img_model.dart';
  5 +import 'package:provider/provider.dart';
  6 +
  7 +import '../../../models/wine_manage_model.dart';
  8 +import '../../../provider/upload_img_provider.dart';
  9 +import '../../../res/colors.dart';
  10 +import '../../../utils/screen_util.dart';
  11 +import '../../../utils/upload_image_util.dart';
  12 +import '../../../widgets/MyDivider.dart';
  13 +import '../../../widgets/v_empty_view.dart';
  14 +import '../../online_check/img_picker_widget.dart';
  15 +
  16 +class CreateWineItemPage extends StatefulWidget {
  17 + final WineManageSunModel wineManageSunModel;
  18 + final ScrollController controller;
  19 + final int index;
  20 + final GestureTapCallback onDel;
  21 +
  22 + CreateWineItemPage(
  23 + {Key key,
  24 + this.wineManageSunModel,
  25 + this.controller,
  26 + this.index,
  27 + this.onDel})
  28 + : super(key: key);
  29 +
  30 + @override
  31 + _CreateWineItemPageState createState() => _CreateWineItemPageState();
  32 +}
  33 +
  34 +class _CreateWineItemPageState extends State<CreateWineItemPage> {
  35 + Widget _textFieldWidget(
  36 + String title, String hintText, TextEditingController controller,
  37 + {TextInputType keyboardType = TextInputType.text}) {
  38 + return Column(children: [
  39 + Container(
  40 + height: ScreenUtil().setWidth(48 * 2),
  41 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  42 + child: Row(
  43 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  44 + crossAxisAlignment: CrossAxisAlignment.center,
  45 + children: [
  46 + Text(
  47 + title,
  48 + style: TextStyle(
  49 + color: MyColours.color_515151, fontSize: font(16)),
  50 + ),
  51 + Expanded(
  52 + child: Container(
  53 + height: ScreenUtil().setWidth(16 * 2),
  54 + alignment: Alignment.centerRight,
  55 + child: TextField(
  56 + maxLines: 1,
  57 + //输入文本的样式
  58 + style: TextStyle(
  59 + fontSize: ScreenUtil().setSp(32),
  60 + color: MyColours.color_515151),
  61 + controller: controller,
  62 + // focusNode: _phoneNode,
  63 + textAlign: TextAlign.right,
  64 + textAlignVertical: TextAlignVertical.center,
  65 +
  66 + // textAlignVertical:
  67 + // TextAlignVertical.center,
  68 + decoration: InputDecoration(
  69 + hintText: hintText,
  70 + hintStyle: TextStyle(
  71 + color: MyColours.color_999999,
  72 + fontSize: ScreenUtil().setSp(32),
  73 + ),
  74 + contentPadding: EdgeInsets.zero,
  75 + // contentPadding:
  76 + // EdgeInsets.symmetric(
  77 + // vertical: w(12)),
  78 + border:
  79 + OutlineInputBorder(borderSide: BorderSide.none),
  80 + ),
  81 + onChanged: (value) {
  82 + print(value);
  83 + // if (value.trim().isEmpty || value.trim().length > 11) {
  84 + // //内容为空,或 超过11位
  85 + // setState(() {
  86 + // _baseIndoProvider.userHistorys.clear();
  87 + // });
  88 + // return;
  89 + // }
  90 + // Map<String, String> params = {
  91 + // "keywords": value.trim(),
  92 + // "sid": Provider.of<UserModel>(context, listen: false)
  93 + // .user
  94 + // .sellerid,
  95 + // };
  96 + // _baseIndoProvider.getUserHistorys(context, params);
  97 + },
  98 + onEditingComplete: () {
  99 + // _phoneNode.unfocus();
  100 + FocusScope.of(context).requestFocus(FocusNode());
  101 + },
  102 + onTap: () {
  103 + // setState(() {
  104 + // showPhoneHistory = true;
  105 + // });
  106 + // Future.delayed(Duration(milliseconds: 300), () {
  107 + // _controller.jumpTo(_controller.position.maxScrollExtent);
  108 + // });
  109 + },
  110 + keyboardType: keyboardType,
  111 + ))),
  112 + // InkWell(
  113 + // onTap: () {
  114 + // // _openAddressBook();
  115 + // },
  116 + // child: Container(
  117 + // width: ScreenUtil().setWidth(74) * 2,
  118 + // height: ScreenUtil().setWidth(48),
  119 + // alignment: Alignment.centerRight,
  120 + // child: Text('一键录入',
  121 + // style: TextStyle(
  122 + // color: MyColours.color_515151,
  123 + // fontSize: ScreenUtil().setSp(28),
  124 + // )),
  125 + // ),
  126 + // ),
  127 + ],
  128 + )),
  129 + MyDivider(
  130 + double.infinity,
  131 + h(0.5),
  132 + color: MyColours.color_E7E7E7,
  133 + ),
  134 + ]);
  135 + }
  136 +
  137 + @override
  138 + Widget build(BuildContext context) {
  139 + return Container(
  140 + color: Colors.white,
  141 + padding: EdgeInsets.only(left: w(16)),
  142 + margin:
  143 + EdgeInsets.only(top: w(16), bottom: w(10), left: w(20), right: w(20)),
  144 + child: Column(
  145 + children: [
  146 + _textFieldWidget(
  147 + '酒品名称',
  148 + "点击输入酒名",
  149 + widget.wineManageSunModel.wineNameC,
  150 + ),
  151 + VEmptyView(16),
  152 + _textFieldWidget('存酒数量', '点击输入数量', widget.wineManageSunModel.wineNumC,
  153 + keyboardType: TextInputType.number),
  154 + VEmptyView(16),
  155 + _textFieldWidget(
  156 + '计量单位', '点击输入计量单位', widget.wineManageSunModel.wineUnitC),
  157 + VEmptyView(16),
  158 + _textFieldWidget(
  159 + '存酒编号', '点击输入存酒编号', widget.wineManageSunModel.wineSerialC),
  160 + VEmptyView(16),
  161 + Consumer<UploadImageProvider>(builder: (context, model, _) {
  162 + return ImgPickerWidget(
  163 + scrollController: widget.controller,
  164 + model: model,
  165 + maxImageNumber: 3,
  166 + maxRemind: '三',
  167 + imageList: widget.wineManageSunModel.img,
  168 + uploadType: UploadType.WineManageType,
  169 + deleteCallback: (int index) {
  170 + widget.wineManageSunModel.img.removeWhere((element) =>
  171 + element == widget.wineManageSunModel.img[index]);
  172 + setState(() {});
  173 + },
  174 + callback: () {
  175 + // for (UploadImgModel item
  176 + // in _uploadImageProvider
  177 + // .tableImageList) {
  178 + // if (item.process < 1) {
  179 + // Utils.showToast('正在上传图片,请稍等');
  180 + // return;
  181 + // }
  182 + // }
  183 + // //接口,和桌子绑定
  184 + // List imageQiniuUrlList = [];
  185 + // for (int i = 0;
  186 + // i <
  187 + // _uploadImageProvider
  188 + // .tableImageList.length;
  189 + // i++) {
  190 + // if (!_uploadImageProvider
  191 + // .tableImageList[i].isUpload) {
  192 + // imageQiniuUrlList.add({
  193 + // "url": _uploadImageProvider
  194 + // .tableImageList[i].qiniuUrl
  195 + // });
  196 + // }
  197 + // }
  198 + // _setTablePhoto(
  199 + // context, imageQiniuUrlList);
  200 + },
  201 + );
  202 + }),
  203 + VEmptyView(16),
  204 + widget.index != 0
  205 + ? MyDivider(
  206 + double.infinity,
  207 + h(0.5),
  208 + color: MyColours.color_E7E7E7,
  209 + )
  210 + : SizedBox(),
  211 + widget.index != 0
  212 + ? InkWell(
  213 + onTap: widget.onDel,
  214 + child: Container(
  215 + width: double.infinity,
  216 + height: w(48),
  217 + alignment: Alignment.center,
  218 + child: Text(
  219 + '删除该项',
  220 + style: TextStyle(
  221 + color: MyColours.color_438E93, fontSize: font(16)),
  222 + ),
  223 + ))
  224 + : SizedBox()
  225 + ],
  226 + ),
  227 + );
  228 + }
  229 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/models/out_wine_record_model.dart';
  4 +import 'package:one_key/pages/my/store_wine_manage/wine_detail_item_page.dart';
  5 +import 'package:one_key/utils/utils.dart';
  6 +import 'package:one_key/widgets/system_app_bar.dart';
  7 +import 'package:provider/provider.dart';
  8 +
  9 +import '../../../constant/state.dart';
  10 +import '../../../models/wine_manage_model.dart';
  11 +import '../../../provider/store_wine_provider.dart';
  12 +import '../../../res/colors.dart';
  13 +import '../../../utils/screen_util.dart';
  14 +import '../../../widgets/MyDivider.dart';
  15 +import '../../../widgets/h_empty_view.dart';
  16 +import '../../../widgets/page_exception.dart';
  17 +import '../../../widgets/v_empty_view.dart';
  18 +import 'out_store_record_item_page.dart';
  19 +
  20 +/***
  21 + * 出库记录列表详情
  22 + */
  23 +
  24 +class OutStoreRecordDetailPage extends StatefulWidget {
  25 + final OutWineRecordSunModel outWineRecordSunModel;
  26 + OutStoreRecordDetailPage({Key key, this.outWineRecordSunModel})
  27 + : super(key: key);
  28 +
  29 + @override
  30 + _OutStoreRecordDetailPageState createState() =>
  31 + _OutStoreRecordDetailPageState();
  32 +}
  33 +
  34 +class _OutStoreRecordDetailPageState extends State<OutStoreRecordDetailPage> {
  35 + StoreWineProvider storeWineProvider;
  36 +
  37 + ScrollController _controller = ScrollController();
  38 +
  39 + // List dataWine = [];
  40 +
  41 + @override
  42 + void initState() {
  43 + // TODO: implement initState
  44 + super.initState();
  45 + // WineManageModel wineManageModel = WineManageModel();
  46 + // dataWine.add(wineManageModel);
  47 + // dataWine.add(wineManageModel);
  48 + WidgetsBinding.instance.addPostFrameCallback((_) {
  49 + // _getStoreWineCheckByWid();
  50 + });
  51 + }
  52 +
  53 + ///根据存酒ID获取取酒记录
  54 +
  55 + // _getStoreWineCheckByWid() async {
  56 + // Map<String, String> pramas = {'wid': widget.wid};
  57 + // await storeWineProvider.getStoreWineCheckByWid(context, pramas,
  58 + // showLoading: true);
  59 + // }
  60 +
  61 + Widget _textItemWidget(String title, String subTitle,
  62 + {bool needBottom = true}) {
  63 + return Column(children: [
  64 + Container(
  65 + height: ScreenUtil().setWidth(48 * 2),
  66 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  67 + child: Row(
  68 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  69 + crossAxisAlignment: CrossAxisAlignment.center,
  70 + children: [
  71 + Text(
  72 + title,
  73 + style: TextStyle(
  74 + color: MyColours.color_515151, fontSize: font(16)),
  75 + ),
  76 + Text(subTitle,
  77 + //输入文本的样式
  78 + style: TextStyle(
  79 + fontSize: ScreenUtil().setSp(32),
  80 + color: MyColours.color_999999)),
  81 + // ),
  82 + ],
  83 + )),
  84 + needBottom
  85 + ? MyDivider(
  86 + double.infinity,
  87 + h(0.5),
  88 + color: MyColours.color_E7E7E7,
  89 + )
  90 + : SizedBox(),
  91 + ]);
  92 + }
  93 +
  94 + @override
  95 + Widget build(BuildContext context) {
  96 + storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true);
  97 + return Scaffold(
  98 + appBar: SystemAppBar(
  99 + '存酒出库详情',
  100 + onTap: () {
  101 + Navigator.pop(context);
  102 + },
  103 + ),
  104 + body: Container(
  105 + child: Consumer<StoreWineProvider>(builder: (context, model, _) {
  106 + if (model.pageStateDetailRecord != PageState.Success) {
  107 + return ExceptionPage(
  108 + pageState: model.pageStateDetailRecord,
  109 + callback: () {
  110 + // _getStoreWineCheckByWid();
  111 + // offset = 0;
  112 + // getMessage(showLoading: true);
  113 +
  114 + // if (pageState == PageState.Empty) {
  115 + // NavigatorUtil.goCouponHistoryPage(context);
  116 + // } else {
  117 + // _couponNetworkData(widget.index);
  118 + // }
  119 + },
  120 + emptyMsg: "暂时没有出库记录哦",
  121 + emptyImg: "empty_search",
  122 + showMsg: "加载中,请稍后...",
  123 + );
  124 + } else {
  125 + return Container(
  126 + child: Column(
  127 + children: [
  128 + Expanded(
  129 + child: SingleChildScrollView(
  130 + controller: _controller,
  131 + child: Column(
  132 + children: [
  133 + Container(
  134 + color: Colors.white,
  135 + padding: EdgeInsets.only(
  136 + left: ScreenUtil().setWidth(16 * 2)),
  137 + child: Column(
  138 + crossAxisAlignment: CrossAxisAlignment.center,
  139 + mainAxisAlignment: MainAxisAlignment.start,
  140 + children: [
  141 + VEmptyView(32),
  142 + _textItemWidget(
  143 + '联系电话',
  144 + Utils.starPhone(
  145 + widget.outWineRecordSunModel.phone)),
  146 + Container(
  147 + height: ScreenUtil().setWidth(48 * 2),
  148 + padding: EdgeInsets.only(
  149 + top: ScreenUtil().setWidth(16 * 2),
  150 + right: ScreenUtil().setWidth(16 * 2)),
  151 + child: Row(
  152 + mainAxisAlignment:
  153 + MainAxisAlignment.spaceBetween,
  154 + crossAxisAlignment:
  155 + CrossAxisAlignment.center,
  156 + children: [
  157 + Text(
  158 + '客人姓名',
  159 + style: TextStyle(
  160 + color: MyColours.color_515151,
  161 + fontSize: font(16)),
  162 + ),
  163 + Expanded(
  164 + child: Container(
  165 + height: ScreenUtil().setWidth(16 * 2),
  166 + alignment: Alignment.centerRight,
  167 + child: Text(
  168 + '${widget.outWineRecordSunModel.rname}${widget.outWineRecordSunModel.sexStr}',
  169 + style: TextStyle(
  170 + fontSize:
  171 + ScreenUtil().setSp(32),
  172 + color:
  173 + MyColours.color_999999)),
  174 + )),
  175 + HEmptyView(40),
  176 + Container(
  177 + width: w(100),
  178 + alignment: Alignment.centerRight,
  179 + child: Text(
  180 + // '会员状态未知',
  181 + widget.outWineRecordSunModel
  182 + .isMember ==
  183 + '1'
  184 + ? '会员'
  185 + : '会员状态未知',
  186 + style: TextStyle(
  187 + color: widget
  188 + .outWineRecordSunModel
  189 + .isMember !=
  190 + '1'
  191 + ? MyColours.color_999999
  192 + : MyColours.color_515151,
  193 + fontSize: ScreenUtil().setSp(32),
  194 + ),
  195 + ),
  196 + ),
  197 + ],
  198 + )),
  199 + VEmptyView(12),
  200 + MyDivider(
  201 + double.infinity,
  202 + h(0.5),
  203 + color: MyColours.color_E7E7E7,
  204 + ),
  205 + VEmptyView(16),
  206 + _textItemWidget('出库记录人',
  207 + widget.outWineRecordSunModel.nickName,
  208 + needBottom: false),
  209 + ],
  210 + )),
  211 + ListView.builder(
  212 + shrinkWrap: true,
  213 + controller: _controller,
  214 + itemCount:
  215 + widget.outWineRecordSunModel.wineCheck.length,
  216 + itemBuilder: (context, index) {
  217 + WineCheckModel wineCheckModel =
  218 + widget.outWineRecordSunModel.wineCheck[index];
  219 + return OutStoreRecordItemPage(
  220 + wineCheckModel: wineCheckModel,
  221 + controller: _controller,
  222 + index: index,
  223 + cdate: widget.outWineRecordSunModel.cdateStr,
  224 + );
  225 + })
  226 + ],
  227 + ),
  228 + )),
  229 + // Container(
  230 + // alignment: Alignment.centerLeft,
  231 + // margin: EdgeInsets.only(
  232 + // left: w(20), right: w(20), top: w(10), bottom: w(16)),
  233 + // child: Text(
  234 + // '注:为保障酒品安排,只有存酒管理员才可以进行存酒操作!',
  235 + // style: TextStyle(
  236 + // color: MyColours.color_999999, fontSize: font(10)),
  237 + // )),
  238 + // Container(
  239 + // color: MyColours.color_ffffff,
  240 + // padding: EdgeInsets.only(
  241 + // top: ScreenUtil().setWidth(16 * 2),
  242 + // bottom: ScreenUtil().setWidth(35 * 2),
  243 + // left: ScreenUtil().setWidth(45 * 2),
  244 + // right: ScreenUtil().setWidth(45 * 2),
  245 + // ),
  246 + // child: Row(
  247 + // children: [
  248 + // RoundButton(
  249 + // text: '出库记录',
  250 + // width: w(100),
  251 + // height: ScreenUtil().setWidth(80),
  252 + // radius: ScreenUtil().setWidth(10),
  253 + // isBold: true,
  254 + // borderColor: MyColours.color_438E93,
  255 + // gradientStart: MyColours.color_ffffff,
  256 + // gradientEnd: MyColours.color_ffffff,
  257 + // textColor: MyColours.color_438E93,
  258 + // fontSize: 32,
  259 + // onPressed: () async {
  260 + // // UserModel userModel =
  261 + // // Provider.of<UserModel>(context, listen: false);
  262 + // // if (userModel.user.role_name == '管理员' ||
  263 + // // userModel.user.role_name == '店长') {
  264 + // // NavigatorUtil.goCouponCreateSelectTypePage(context);
  265 + // // } else {
  266 + // // bool needRefresh =
  267 + // // await NavigatorUtil.goCouponEditPage(context);
  268 + // // print(needRefresh);
  269 + // // if (needRefresh != null && needRefresh) {
  270 + // // bus.emit('refresh_coupon_list_f');
  271 + // // //刷新页面数据
  272 + // // // _controller.callRefresh();
  273 + // // // _couponNetworkData(tabController.index);
  274 + // // }
  275 + // // }
  276 + // },
  277 + // ),
  278 + // HEmptyView(30),
  279 + // Expanded(
  280 + // child: RoundButton(
  281 + // text: '存酒出库',
  282 + // // width: w(218),
  283 + // height: ScreenUtil().setWidth(80),
  284 + // radius: ScreenUtil().setWidth(10),
  285 + // isBold: true,
  286 + // gradientStart: true
  287 + // ? MyColours.color_BFC4D4
  288 + // : MyColours.color_438E93,
  289 + // gradientEnd: true
  290 + // ? MyColours.color_BFC4D4
  291 + // : MyColours.color_438E93,
  292 + // fontSize: 32,
  293 + // onPressed: () async {
  294 + // Utils.showToast('您不是店铺的存酒管理员,无权进行相关操作。');
  295 + // // UserModel userModel =
  296 + // // Provider.of<UserModel>(context, listen: false);
  297 + // // if (userModel.user.role_name == '管理员' ||
  298 + // // userModel.user.role_name == '店长') {
  299 + // // NavigatorUtil.goCouponCreateSelectTypePage(context);
  300 + // // } else {
  301 + // // bool needRefresh =
  302 + // // await NavigatorUtil.goCouponEditPage(context);
  303 + // // print(needRefresh);
  304 + // // if (needRefresh != null && needRefresh) {
  305 + // // bus.emit('refresh_coupon_list_f');
  306 + // // //刷新页面数据
  307 + // // // _controller.callRefresh();
  308 + // // // _couponNetworkData(tabController.index);
  309 + // // }
  310 + // // }
  311 + // },
  312 + // )),
  313 + // ],
  314 + // ))
  315 + ],
  316 + ),
  317 + );
  318 + }
  319 + })));
  320 + }
  321 +}
  1 +import 'package:cached_network_image/cached_network_image.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:provider/provider.dart';
  5 +
  6 +import '../../../models/out_wine_record_model.dart';
  7 +import '../../../models/wine_manage_model.dart';
  8 +import '../../../provider/upload_img_provider.dart';
  9 +import '../../../res/colors.dart';
  10 +import '../../../utils/screen_util.dart';
  11 +import '../../../utils/upload_image_util.dart';
  12 +import '../../../utils/utils.dart';
  13 +import '../../../widgets/MyDivider.dart';
  14 +import '../../../widgets/v_empty_view.dart';
  15 +import '../../online_check/img_picker_widget.dart';
  16 +import '../../online_check/photo_view_wiget.dart';
  17 +
  18 +//出库记录酒品item
  19 +
  20 +class OutStoreRecordItemPage extends StatefulWidget {
  21 + final String cdate;
  22 + final WineCheckModel wineCheckModel;
  23 + final ScrollController controller;
  24 + final int index;
  25 +
  26 + OutStoreRecordItemPage(
  27 + {Key key, this.wineCheckModel, this.controller, this.index, this.cdate})
  28 + : super(key: key);
  29 +
  30 + @override
  31 + _OutStoreRecordItemPageState createState() => _OutStoreRecordItemPageState();
  32 +}
  33 +
  34 +class _OutStoreRecordItemPageState extends State<OutStoreRecordItemPage> {
  35 + Widget _textWidget(String title, String subTitle) {
  36 + return Column(children: [
  37 + Container(
  38 + height: ScreenUtil().setWidth(48 * 2),
  39 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  40 + child: Row(
  41 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  42 + crossAxisAlignment: CrossAxisAlignment.center,
  43 + children: [
  44 + Text(
  45 + title,
  46 + style: TextStyle(
  47 + color: MyColours.color_515151, fontSize: font(16)),
  48 + ),
  49 + Expanded(
  50 + child: Container(
  51 + height: ScreenUtil().setWidth(16 * 2),
  52 + alignment: Alignment.centerRight,
  53 + child: Text(
  54 + subTitle,
  55 + //输入文本的样式
  56 + style: TextStyle(
  57 + fontSize: ScreenUtil().setSp(32),
  58 + color: MyColours.color_999999),
  59 + )),
  60 + )
  61 + ],
  62 + )),
  63 + MyDivider(
  64 + double.infinity,
  65 + h(0.5),
  66 + color: MyColours.color_E7E7E7,
  67 + ),
  68 + ]);
  69 + }
  70 +
  71 + //查看大图
  72 + _showPhotoView(BuildContext context, int index, List<String> imgs,
  73 + {isShow = false, List dashName}) async {
  74 + // if (imgs.length == 1 &&
  75 + // imgs[0] ==
  76 + // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
  77 + // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
  78 + // }
  79 + Utils.setBarStatus(false, color: Colors.black);
  80 + dynamic result = await showGeneralDialog(
  81 + context: context,
  82 + barrierDismissible: false,
  83 + // barrierColor: Colors.red,
  84 + barrierLabel:
  85 + MaterialLocalizations.of(context).modalBarrierDismissLabel,
  86 + transitionDuration: const Duration(milliseconds: 150),
  87 + pageBuilder: (BuildContext context, Animation animation,
  88 + Animation secondaryAnimation) {
  89 + Widget child = Stack(
  90 + children: <Widget>[
  91 + PhotoPreview(
  92 + initialIndex: index,
  93 + photoList: imgs,
  94 + isShow: isShow,
  95 + dashName: dashName)
  96 + ],
  97 + );
  98 + return child;
  99 + });
  100 + Utils.setBarStatus(true, color: Colors.white);
  101 + }
  102 +
  103 + /// 九宫格
  104 + Widget _getGridImg(context, List<String> temp) {
  105 + return GridView.builder(
  106 + controller: widget.controller,
  107 + // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
  108 + shrinkWrap: true,
  109 + itemCount: temp.length,
  110 +
  111 + //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
  112 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  113 + //横轴元素个数
  114 + crossAxisCount: 3,
  115 + //纵轴间距
  116 + mainAxisSpacing: ScreenUtil().setWidth(40),
  117 + //横轴间距
  118 + crossAxisSpacing: ScreenUtil().setWidth(36),
  119 + //子组件宽高长度比例
  120 + childAspectRatio: 1.0),
  121 + itemBuilder: (BuildContext context, int index) {
  122 + //Widget Function(BuildContext context, int index)
  123 +
  124 + return temp.length < 1
  125 + ? Text('')
  126 + : InkWell(
  127 + onTap: () {
  128 + ///没有上传完成的不可以点击
  129 + _showPhotoView(context, index, temp);
  130 + },
  131 + child: CachedNetworkImage(
  132 + imageUrl: temp[index],
  133 + fit: BoxFit.cover,
  134 + width: ScreenUtil().setWidth(100 * 2),
  135 + height: ScreenUtil().setWidth(100 * 2),
  136 + ));
  137 + });
  138 + }
  139 +
  140 + @override
  141 + Widget build(BuildContext context) {
  142 + return Container(
  143 + color: Colors.white,
  144 + padding: EdgeInsets.only(left: w(16)),
  145 + margin:
  146 + EdgeInsets.only(top: w(16), bottom: w(10), left: w(20), right: w(20)),
  147 + child: Column(
  148 + children: [
  149 + _textWidget(
  150 + '酒品名称',
  151 + widget.wineCheckModel.wineName,
  152 + ),
  153 + VEmptyView(16),
  154 + _textWidget('出库数量', widget.wineCheckModel.checkAmount),
  155 + VEmptyView(16),
  156 + _textWidget('计量单位', widget.wineCheckModel.unit),
  157 + VEmptyView(16),
  158 + _textWidget('存酒编号', widget.wineCheckModel.wineNumber),
  159 + VEmptyView(16),
  160 + _textWidget('出库日期', widget.cdate),
  161 + VEmptyView(16),
  162 + widget.wineCheckModel.img != null &&
  163 + widget.wineCheckModel.img.length > 0
  164 + ? _getGridImg(context, widget.wineCheckModel.img)
  165 + : SizedBox(),
  166 + widget.wineCheckModel.img != null &&
  167 + widget.wineCheckModel.img.length > 0
  168 + ? VEmptyView(16)
  169 + : SizedBox(),
  170 + ],
  171 + ),
  172 + );
  173 + }
  174 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/models/out_wine_record_model.dart';
  4 +import 'package:one_key/pages/my/store_wine_manage/wine_detail_item_page.dart';
  5 +import 'package:one_key/utils/utils.dart';
  6 +import 'package:one_key/widgets/system_app_bar.dart';
  7 +import 'package:provider/provider.dart';
  8 +
  9 +import '../../../constant/state.dart';
  10 +import '../../../models/wine_manage_model.dart';
  11 +import '../../../provider/store_wine_provider.dart';
  12 +import '../../../res/colors.dart';
  13 +import '../../../utils/screen_util.dart';
  14 +import '../../../widgets/MyDivider.dart';
  15 +import '../../../widgets/h_empty_view.dart';
  16 +import '../../../widgets/page_exception.dart';
  17 +import '../../../widgets/v_empty_view.dart';
  18 +import 'out_store_record_item_page.dart';
  19 +
  20 +/***
  21 + * 出库记录
  22 + */
  23 +
  24 +class OutStoreRecordPage extends StatefulWidget {
  25 + final String wid;
  26 + OutStoreRecordPage({Key key, this.wid}) : super(key: key);
  27 +
  28 + @override
  29 + _OutStoreRecordPageState createState() => _OutStoreRecordPageState();
  30 +}
  31 +
  32 +class _OutStoreRecordPageState extends State<OutStoreRecordPage> {
  33 + StoreWineProvider storeWineProvider;
  34 +
  35 + ScrollController _controller = ScrollController();
  36 +
  37 + // List dataWine = [];
  38 +
  39 + @override
  40 + void initState() {
  41 + // TODO: implement initState
  42 + super.initState();
  43 + // WineManageModel wineManageModel = WineManageModel();
  44 + // dataWine.add(wineManageModel);
  45 + // dataWine.add(wineManageModel);
  46 + WidgetsBinding.instance.addPostFrameCallback((_) {
  47 + _getStoreWineCheckByWid();
  48 + });
  49 + }
  50 +
  51 + ///根据存酒ID获取取酒记录
  52 +
  53 + _getStoreWineCheckByWid() async {
  54 + Map<String, String> pramas = {'wid': widget.wid};
  55 + await storeWineProvider.getStoreWineCheckByWid(context, pramas,
  56 + showLoading: true);
  57 + }
  58 +
  59 + Widget _textItemWidget(String title, String subTitle,
  60 + {bool needBottom = true}) {
  61 + return Column(children: [
  62 + Container(
  63 + height: ScreenUtil().setWidth(48 * 2),
  64 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  65 + child: Row(
  66 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  67 + crossAxisAlignment: CrossAxisAlignment.center,
  68 + children: [
  69 + Text(
  70 + title,
  71 + style: TextStyle(
  72 + color: MyColours.color_515151, fontSize: font(16)),
  73 + ),
  74 + Text(subTitle,
  75 + //输入文本的样式
  76 + style: TextStyle(
  77 + fontSize: ScreenUtil().setSp(32),
  78 + color: MyColours.color_999999)),
  79 + // ),
  80 + ],
  81 + )),
  82 + needBottom
  83 + ? MyDivider(
  84 + double.infinity,
  85 + h(0.5),
  86 + color: MyColours.color_E7E7E7,
  87 + )
  88 + : SizedBox(),
  89 + ]);
  90 + }
  91 +
  92 + @override
  93 + Widget build(BuildContext context) {
  94 + storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true);
  95 + return Scaffold(
  96 + appBar: SystemAppBar(
  97 + '存酒出库详情',
  98 + onTap: () {
  99 + Navigator.pop(context);
  100 + },
  101 + ),
  102 + body: Container(
  103 + child: Consumer<StoreWineProvider>(builder: (context, model, _) {
  104 + if (model.pageStateRecord != PageState.Success) {
  105 + return ExceptionPage(
  106 + pageState: model.pageStateRecord,
  107 + callback: () {
  108 + _getStoreWineCheckByWid();
  109 + // offset = 0;
  110 + // getMessage(showLoading: true);
  111 +
  112 + // if (pageState == PageState.Empty) {
  113 + // NavigatorUtil.goCouponHistoryPage(context);
  114 + // } else {
  115 + // _couponNetworkData(widget.index);
  116 + // }
  117 + },
  118 + emptyMsg: "暂时没有出库记录哦",
  119 + emptyImg: "empty_search",
  120 + showMsg: "加载中,请稍后...",
  121 + );
  122 + } else {
  123 + return Container(
  124 + child: Column(
  125 + children: [
  126 + Expanded(
  127 + child: SingleChildScrollView(
  128 + controller: _controller,
  129 + child: Column(
  130 + children: [
  131 + Container(
  132 + color: Colors.white,
  133 + padding: EdgeInsets.only(
  134 + left: ScreenUtil().setWidth(16 * 2)),
  135 + child: Column(
  136 + crossAxisAlignment: CrossAxisAlignment.center,
  137 + mainAxisAlignment: MainAxisAlignment.start,
  138 + children: [
  139 + VEmptyView(32),
  140 + _textItemWidget(
  141 + '联系电话',
  142 + Utils.starPhone(storeWineProvider
  143 + .outWineRecordData[0].phone)),
  144 + Container(
  145 + height: ScreenUtil().setWidth(48 * 2),
  146 + padding: EdgeInsets.only(
  147 + top: ScreenUtil().setWidth(16 * 2),
  148 + right: ScreenUtil().setWidth(16 * 2)),
  149 + child: Row(
  150 + mainAxisAlignment:
  151 + MainAxisAlignment.spaceBetween,
  152 + crossAxisAlignment:
  153 + CrossAxisAlignment.center,
  154 + children: [
  155 + Text(
  156 + '客人姓名',
  157 + style: TextStyle(
  158 + color: MyColours.color_515151,
  159 + fontSize: font(16)),
  160 + ),
  161 + Expanded(
  162 + child: Container(
  163 + height: ScreenUtil().setWidth(16 * 2),
  164 + alignment: Alignment.centerRight,
  165 + child: Text(
  166 + '${storeWineProvider.outWineRecordData[0].rname}${storeWineProvider.outWineRecordData[0].sexStr}',
  167 + style: TextStyle(
  168 + fontSize:
  169 + ScreenUtil().setSp(32),
  170 + color:
  171 + MyColours.color_999999)),
  172 + )),
  173 + HEmptyView(40),
  174 + Container(
  175 + width: w(100),
  176 + alignment: Alignment.centerRight,
  177 + child: Text(
  178 + // '会员状态未知',
  179 + storeWineProvider
  180 + .outWineRecordData[0]
  181 + .isMember ==
  182 + '1'
  183 + ? '会员'
  184 + : '会员状态未知',
  185 + style: TextStyle(
  186 + color: storeWineProvider
  187 + .outWineRecordData[0]
  188 + .isMember !=
  189 + '1'
  190 + ? MyColours.color_999999
  191 + : MyColours.color_515151,
  192 + fontSize: ScreenUtil().setSp(32),
  193 + ),
  194 + ),
  195 + ),
  196 + ],
  197 + )),
  198 + VEmptyView(12),
  199 + MyDivider(
  200 + double.infinity,
  201 + h(0.5),
  202 + color: MyColours.color_E7E7E7,
  203 + ),
  204 + VEmptyView(16),
  205 + _textItemWidget(
  206 + '出库记录人',
  207 + storeWineProvider
  208 + .outWineRecordData[0].nickName,
  209 + needBottom: false),
  210 + ],
  211 + )),
  212 + ListView.builder(
  213 + shrinkWrap: true,
  214 + controller: _controller,
  215 + itemCount:
  216 + storeWineProvider.outWineRecordData.length,
  217 + itemBuilder: (context, index) {
  218 + OutWineRecordSunModel outWineRecordSunModel =
  219 + storeWineProvider.outWineRecordData[index];
  220 + return ListView.builder(
  221 + shrinkWrap: true,
  222 + controller: _controller,
  223 + itemCount:
  224 + outWineRecordSunModel.wineCheck.length,
  225 + itemBuilder: (context, index1) {
  226 + WineCheckModel wineCheckModel =
  227 + outWineRecordSunModel.wineCheck[index1];
  228 + return OutStoreRecordItemPage(
  229 + wineCheckModel: wineCheckModel,
  230 + controller: _controller,
  231 + index: index1,
  232 + cdate: outWineRecordSunModel.cdateStr,
  233 + );
  234 + });
  235 + // OutWineRecordSunModel outWineRecordSunModel =
  236 + // storeWineProvider.outWineRecordData[index];
  237 + // return OutStoreRecordItemPage(
  238 + // outWineRecordSunModel: outWineRecordSunModel,
  239 + // controller: _controller,
  240 + // index: index,
  241 + // );
  242 + }),
  243 + ],
  244 + ),
  245 + )),
  246 + // Container(
  247 + // alignment: Alignment.centerLeft,
  248 + // margin: EdgeInsets.only(
  249 + // left: w(20), right: w(20), top: w(10), bottom: w(16)),
  250 + // child: Text(
  251 + // '注:为保障酒品安排,只有存酒管理员才可以进行存酒操作!',
  252 + // style: TextStyle(
  253 + // color: MyColours.color_999999, fontSize: font(10)),
  254 + // )),
  255 + // Container(
  256 + // color: MyColours.color_ffffff,
  257 + // padding: EdgeInsets.only(
  258 + // top: ScreenUtil().setWidth(16 * 2),
  259 + // bottom: ScreenUtil().setWidth(35 * 2),
  260 + // left: ScreenUtil().setWidth(45 * 2),
  261 + // right: ScreenUtil().setWidth(45 * 2),
  262 + // ),
  263 + // child: Row(
  264 + // children: [
  265 + // RoundButton(
  266 + // text: '出库记录',
  267 + // width: w(100),
  268 + // height: ScreenUtil().setWidth(80),
  269 + // radius: ScreenUtil().setWidth(10),
  270 + // isBold: true,
  271 + // borderColor: MyColours.color_438E93,
  272 + // gradientStart: MyColours.color_ffffff,
  273 + // gradientEnd: MyColours.color_ffffff,
  274 + // textColor: MyColours.color_438E93,
  275 + // fontSize: 32,
  276 + // onPressed: () async {
  277 + // // UserModel userModel =
  278 + // // Provider.of<UserModel>(context, listen: false);
  279 + // // if (userModel.user.role_name == '管理员' ||
  280 + // // userModel.user.role_name == '店长') {
  281 + // // NavigatorUtil.goCouponCreateSelectTypePage(context);
  282 + // // } else {
  283 + // // bool needRefresh =
  284 + // // await NavigatorUtil.goCouponEditPage(context);
  285 + // // print(needRefresh);
  286 + // // if (needRefresh != null && needRefresh) {
  287 + // // bus.emit('refresh_coupon_list_f');
  288 + // // //刷新页面数据
  289 + // // // _controller.callRefresh();
  290 + // // // _couponNetworkData(tabController.index);
  291 + // // }
  292 + // // }
  293 + // },
  294 + // ),
  295 + // HEmptyView(30),
  296 + // Expanded(
  297 + // child: RoundButton(
  298 + // text: '存酒出库',
  299 + // // width: w(218),
  300 + // height: ScreenUtil().setWidth(80),
  301 + // radius: ScreenUtil().setWidth(10),
  302 + // isBold: true,
  303 + // gradientStart: true
  304 + // ? MyColours.color_BFC4D4
  305 + // : MyColours.color_438E93,
  306 + // gradientEnd: true
  307 + // ? MyColours.color_BFC4D4
  308 + // : MyColours.color_438E93,
  309 + // fontSize: 32,
  310 + // onPressed: () async {
  311 + // Utils.showToast('您不是店铺的存酒管理员,无权进行相关操作。');
  312 + // // UserModel userModel =
  313 + // // Provider.of<UserModel>(context, listen: false);
  314 + // // if (userModel.user.role_name == '管理员' ||
  315 + // // userModel.user.role_name == '店长') {
  316 + // // NavigatorUtil.goCouponCreateSelectTypePage(context);
  317 + // // } else {
  318 + // // bool needRefresh =
  319 + // // await NavigatorUtil.goCouponEditPage(context);
  320 + // // print(needRefresh);
  321 + // // if (needRefresh != null && needRefresh) {
  322 + // // bus.emit('refresh_coupon_list_f');
  323 + // // //刷新页面数据
  324 + // // // _controller.callRefresh();
  325 + // // // _couponNetworkData(tabController.index);
  326 + // // }
  327 + // // }
  328 + // },
  329 + // )),
  330 + // ],
  331 + // ))
  332 + ],
  333 + ),
  334 + );
  335 + }
  336 + })));
  337 + }
  338 +}
  1 +import 'dart:convert';
  2 +
  3 +import 'package:flutter/material.dart';
  4 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:one_key/res/colors.dart';
  6 +import 'package:one_key/utils/dialog_util.dart';
  7 +import 'package:one_key/widgets/MyDivider.dart';
  8 +import 'package:one_key/widgets/system_app_bar.dart';
  9 +
  10 +import 'package:pin_code_fields/pin_code_fields.dart';
  11 +import 'package:provider/provider.dart';
  12 +
  13 +import '../../../models/wine_manage_model.dart';
  14 +import '../../../provider/store_wine_provider.dart';
  15 +import '../../../provider/user_model.dart';
  16 +import '../../../utils/event_bus.dart';
  17 +import '../../../utils/screen_util.dart';
  18 +import '../../../utils/utils.dart';
  19 +import '../../../widgets/round_button.dart';
  20 +
  21 +/**
  22 + * 短信验证码输入,酒品出库申请
  23 + */
  24 +
  25 +class SmsCodeInputPage extends StatefulWidget {
  26 + final WineManageModel wineManageDetail;
  27 +
  28 + SmsCodeInputPage({Key key, this.wineManageDetail}) : super(key: key);
  29 +
  30 + @override
  31 + _SmsCodeInputPageState createState() => _SmsCodeInputPageState();
  32 +}
  33 +
  34 +class _SmsCodeInputPageState extends State<SmsCodeInputPage> {
  35 + StoreWineProvider storeWineProvider;
  36 + String code = '';
  37 + bool codeEnabled = false; //验证码是否可用
  38 + @override
  39 + void initState() {
  40 + // TODO: implement initState
  41 + super.initState();
  42 + WidgetsBinding.instance.addPostFrameCallback((_) {
  43 + _getPhoneCode();
  44 + });
  45 + }
  46 +
  47 + ///获取手机验证码
  48 + _getPhoneCode() async {
  49 + if (widget.wineManageDetail.phone == null ||
  50 + widget.wineManageDetail.phone.trim().length == 0) {
  51 + Utils.showToast('手机号码为空,无法发送验证码!');
  52 + return;
  53 + }
  54 + storeWineProvider.code = Utils.randomBit(6);
  55 + Map<String, String> params = {
  56 + "phone": widget.wineManageDetail.phone.replaceAll(' ', ''),
  57 + "code": storeWineProvider.code,
  58 + };
  59 + // startCountdown(model);
  60 + bool success = await storeWineProvider.getPhoneCode(context, params);
  61 + if (!success) {
  62 + // _timer.cancel();
  63 + } else {
  64 + Utils.showToast('短信验证码已发送,请注意查收');
  65 + }
  66 + }
  67 +
  68 + @override
  69 + Widget build(BuildContext context) {
  70 + storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true);
  71 + return Scaffold(
  72 + backgroundColor: MyColours.color_ffffff,
  73 + appBar: SystemAppBar(
  74 + '存酒出库确认',
  75 + onTap: () {
  76 + Navigator.pop(context);
  77 + },
  78 + ),
  79 + body: Column(
  80 + children: [
  81 + Expanded(
  82 + child: SingleChildScrollView(
  83 + child: Column(
  84 + children: [
  85 + Container(
  86 + height: w(48),
  87 + padding: EdgeInsets.symmetric(horizontal: w(16)),
  88 + alignment: Alignment.centerLeft,
  89 + child: Text(
  90 + '请输入客户手机收到的短信验证码:',
  91 + style: TextStyle(
  92 + color: MyColours.color_515151, fontSize: font(16)),
  93 + ),
  94 + ),
  95 + Padding(
  96 + padding: EdgeInsets.only(left: w(16)),
  97 + child: MyDivider(
  98 + double.infinity,
  99 + w(0.5),
  100 + color: MyColours.color_E7E7E7,
  101 + )),
  102 + Padding(
  103 + padding:
  104 + EdgeInsets.symmetric(vertical: w(23), horizontal: w(32)),
  105 + child: PinCodeTextField(
  106 + autoFocus: true,
  107 + appContext: context,
  108 + pastedTextStyle: TextStyle(
  109 + color: MyColours.color_438E93,
  110 + fontWeight: FontWeight.bold,
  111 + ),
  112 + length: 6,
  113 + obscureText: false,
  114 +
  115 + dialogConfig: DialogConfig(
  116 + dialogTitle: '确认',
  117 + dialogContent: '是否粘贴',
  118 + negativeText: '取消',
  119 + affirmativeText: '粘贴',
  120 + ),
  121 + obscuringCharacter: '*',
  122 + // obscuringWidget: const FlutterLogo(
  123 + // size: 24,
  124 + // ),
  125 + blinkWhenObscuring: true,
  126 + animationType: AnimationType.fade,
  127 + validator: (v) {
  128 + if (v.length < 6) {
  129 + return null;
  130 + return "请输入6位";
  131 + } else {
  132 + return null;
  133 + }
  134 + },
  135 + pinTheme: PinTheme(
  136 + shape: PinCodeFieldShape.box,
  137 + borderRadius: BorderRadius.circular(r(5)),
  138 + fieldHeight: w(50),
  139 + fieldWidth: w(35),
  140 + activeFillColor: Colors.white,
  141 + activeColor: Colors.white,
  142 + selectedFillColor: Colors.white,
  143 + inactiveFillColor: Colors.white,
  144 + disabledColor: Colors.white,
  145 + borderWidth: w(1),
  146 + inactiveColor: MyColours.color_999999,
  147 + selectedColor: MyColours.color_438E93),
  148 + cursorColor: MyColours.color_515151,
  149 +
  150 + animationDuration: const Duration(milliseconds: 300),
  151 + enableActiveFill: true,
  152 + // errorAnimationController: errorController,
  153 + // controller: textEditingController,
  154 + keyboardType: TextInputType.number,
  155 + boxShadows: [
  156 + BoxShadow(
  157 + offset: Offset(0, 1),
  158 + color: Colors.black12,
  159 + blurRadius: r(5),
  160 + )
  161 + ],
  162 + onCompleted: (v) {
  163 + debugPrint("Completed");
  164 + },
  165 + // onTap: () {
  166 + // print("Pressed");
  167 + // },
  168 + onChanged: (value) {
  169 + code = value;
  170 + debugPrint(value);
  171 + setState(() {
  172 + // currentText = value;
  173 + });
  174 + },
  175 + ))
  176 + ],
  177 + ))),
  178 + Container(
  179 + color: MyColours.color_ffffff,
  180 + padding: EdgeInsets.only(
  181 + top: ScreenUtil().setWidth(16 * 2),
  182 + bottom: ScreenUtil().setWidth(35 * 2),
  183 + left: ScreenUtil().setWidth(45 * 2),
  184 + right: ScreenUtil().setWidth(45 * 2),
  185 + ),
  186 + child: RoundButton(
  187 + text: '确认出库',
  188 + width: double.infinity,
  189 + height: ScreenUtil().setWidth(80),
  190 + radius: ScreenUtil().setWidth(10),
  191 + isBold: true,
  192 + fontSize: 32,
  193 + onPressed: () async {
  194 + if (code == null || code.trim().length == 0) {
  195 + Utils.showToast('请输入验证码');
  196 + return;
  197 + }
  198 + // if (storeWineProvider.code != null && !codeEnabled) {
  199 + // Utils.showToast('验证码已失效,请重新获取');
  200 + // return;
  201 + // }
  202 + if (storeWineProvider.code == null) {
  203 + Utils.showToast('请获取验证码');
  204 + return;
  205 + }
  206 + if (storeWineProvider.code != code) {
  207 + Utils.showToast('您输入的验证码不正确,请重新输入');
  208 + return;
  209 + }
  210 +
  211 + //出库申请提交接口
  212 +
  213 + List<WineCheckModel> outWineData = [];
  214 +
  215 + for (int i = 0;
  216 + i < widget.wineManageDetail.wineDataMove.length;
  217 + i++) {
  218 + WineManageSunMoveModel element =
  219 + widget.wineManageDetail.wineDataMove[i];
  220 + // if (element.wineNameC.text.trim().length == 0) {
  221 + // Utils.showToast('请输入酒品名称!');
  222 + // // return false;
  223 + // can = false;
  224 + // break outerloop;
  225 + // }
  226 +
  227 + if (element.checkAmount != null &&
  228 + element.checkAmount != '' &&
  229 + int.parse(element.checkAmount) > 0) {
  230 + //有输入数量
  231 + WineCheckModel sunMoveModel = WineCheckModel();
  232 + sunMoveModel.wineName = element.wineName;
  233 + sunMoveModel.checkAmount = element.checkAmount;
  234 + sunMoveModel.wineNumber = element.wineNumber;
  235 + sunMoveModel.unit = element.unit;
  236 +
  237 + sunMoveModel.img = element.img;
  238 +
  239 + outWineData.add(sunMoveModel);
  240 + }
  241 + }
  242 +
  243 + Map<String, String> pramas = {
  244 + 'sid': Provider.of<UserModel>(context, listen: false)
  245 + .user
  246 + .sellerid,
  247 + 'uid': Provider.of<UserModel>(context, listen: false)
  248 + .user
  249 + .openid,
  250 + 'wid': widget.wineManageDetail.id,
  251 + 'wine_check': jsonEncode(outWineData)
  252 + };
  253 +
  254 + bool success = await storeWineProvider
  255 + .setStoreWineBySellerCheck(context, pramas,
  256 + showLoading: true);
  257 + if (success) {
  258 + //
  259 + Navigator.pop(context);
  260 + Navigator.pop(context);
  261 + Navigator.pop(context);
  262 + //刷新首页数据
  263 + bus.emit('refresh_wine_home_list',{
  264 + 'index':1
  265 + });
  266 +
  267 + DialogUtil.cupertinoAlertDialogOnly(context,
  268 + content:
  269 + '客户${widget.wineManageDetail.rname + widget.wineManageDetail.sexStr}的酒品已经出库。\n您可以在存酒管理-出库记录中查看详细信息。',
  270 + rTitle: '我知道了');
  271 + }
  272 + },
  273 + ))
  274 + ],
  275 + ),
  276 + );
  277 + }
  278 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_easyrefresh/easy_refresh.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:one_key/models/out_wine_record_model.dart';
  5 +import 'package:one_key/models/wine_manage_model.dart';
  6 +import 'package:one_key/pages/my/store_wine_manage/wine_in_store_item.dart';
  7 +import 'package:one_key/pages/my/store_wine_manage/wine_out_store_item.dart';
  8 +import 'package:one_key/widgets/system_app_bar.dart';
  9 +import 'package:provider/provider.dart';
  10 +
  11 +import '../../../constant/state.dart';
  12 +import '../../../models/personnel_manage_model.dart';
  13 +import '../../../provider/personnel_provider.dart';
  14 +import '../../../provider/store_wine_provider.dart';
  15 +import '../../../provider/user_model.dart';
  16 +import '../../../res/colors.dart';
  17 +import '../../../route/navigator_util.dart';
  18 +import '../../../utils/event_bus.dart';
  19 +import '../../../utils/utils.dart';
  20 +import '../../../widgets/custom_tab_indicator.dart';
  21 +import '../../../widgets/page_exception.dart';
  22 +import '../../../widgets/round_button.dart';
  23 +
  24 +/**
  25 + *
  26 + * 存酒首页
  27 + */
  28 +
  29 +class StoreWineManageHomePage extends StatefulWidget {
  30 + StoreWineManageHomePage({Key key}) : super(key: key);
  31 +
  32 + @override
  33 + _StoreWineManageHomePageState createState() =>
  34 + _StoreWineManageHomePageState();
  35 +}
  36 +
  37 +class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
  38 + with TickerProviderStateMixin {
  39 + StoreWineProvider storeWineProvider;
  40 +
  41 + TextEditingController searchC = TextEditingController(); //搜索框控制器
  42 + List _tabBarTitle;
  43 + TabController tabController;
  44 + int index = 0;
  45 + ScrollController listInStoreC = ScrollController();
  46 +
  47 + bool isStoreWine = false;
  48 + EasyRefreshController _controller;
  49 +
  50 + @override
  51 + void initState() {
  52 + _tabBarTitle = ['全部在店', '取酒记录'];
  53 + _controller = EasyRefreshController();
  54 +
  55 + super.initState();
  56 + tabController = TabController(length: 2, vsync: this);
  57 + tabController.index = 0;
  58 +
  59 + tabController.addListener(() async {
  60 + if (tabController.index == tabController.animation.value) {
  61 + if (index == tabController.index) {
  62 + return;
  63 + }
  64 + print(tabController.index);
  65 + index = tabController.index;
  66 +
  67 + if (index == 0) {
  68 + await storeWineProvider.getStoreWineBySeller(context,
  69 + showLoading: false);
  70 + } else if (index == 1) {
  71 + await storeWineProvider.getStoreWineCheckList(context,
  72 + showLoading: false);
  73 + }
  74 +
  75 + // _getContantData(first: true);
  76 + }
  77 + });
  78 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  79 + index = tabController.index;
  80 +
  81 + // _getContantData(first: first);
  82 + await _getAuthUserLists(showLoading: true);
  83 +
  84 + await storeWineProvider.getStoreWineBySeller(context, showLoading: true);
  85 +
  86 + await storeWineProvider.getStoreWineCheckList(context, showLoading: true);
  87 + });
  88 + bus.on("refresh_wine_home_all_list", (arg) async {
  89 + await storeWineProvider.getStoreWineBySeller(context, showLoading: true);
  90 + });
  91 + bus.on("refresh_wine_home_list", (arg) async {
  92 + print(arg['index']);
  93 + tabController.index = arg['index'];
  94 + index = arg['index'];
  95 + await storeWineProvider.getStoreWineBySeller(context, showLoading: true);
  96 + await storeWineProvider.getStoreWineCheckList(context, showLoading: true);
  97 + });
  98 + }
  99 +
  100 + @override
  101 + void dispose() {
  102 + super.dispose();
  103 + bus.off('refresh_wine_home_all_list');
  104 + bus.off('refresh_wine_home_list');
  105 + }
  106 +
  107 + //获取员工信息列表
  108 + _getAuthUserLists({bool showLoading = true}) async {
  109 + Map<String, String> params = {
  110 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
  111 + };
  112 + PersonnelProvider personnelProvider =
  113 + Provider.of<PersonnelProvider>(context, listen: false);
  114 + PersonnelManageSunModel data;
  115 + await personnelProvider.getAuthUserLists(context, params,
  116 + showLoading: showLoading);
  117 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  118 +
  119 + if (personnelProvider.dataMap != null) {
  120 + if (userModel.user.role_name == '管理员') {
  121 + personnelProvider.dataMap.admin.listdata.forEach((element) {
  122 + if (element.id == userModel.user.openid) {
  123 + //找到自己
  124 + data = element;
  125 + }
  126 + });
  127 + } else if (userModel.user.role_name == '店长') {
  128 + personnelProvider.dataMap.shopowner.listdata.forEach((element) {
  129 + if (element.id == userModel.user.openid) {
  130 + //找到自己
  131 + data = element;
  132 + }
  133 + });
  134 + } else if (userModel.user.role_name == '客户经理') {
  135 + personnelProvider.dataMap.manager.listdata.forEach((element) {
  136 + if (element.id == userModel.user.openid) {
  137 + //找到自己
  138 + data = element;
  139 + }
  140 + });
  141 + } else if (userModel.user.role_name == '收银员') {
  142 + personnelProvider.dataMap.cashier.listdata.forEach((element) {
  143 + if (element.id == userModel.user.openid) {
  144 + //找到自己
  145 + data = element;
  146 + }
  147 + });
  148 + } else if (userModel.user.role_name == '服务员') {
  149 + personnelProvider.dataMap.waiter.listdata.forEach((element) {
  150 + if (element.id == userModel.user.openid) {
  151 + //找到自己
  152 + data = element;
  153 + }
  154 + });
  155 + }
  156 +
  157 + isStoreWine = data.isStoreWine == '1' ? true : false;
  158 + setState(() {});
  159 + }
  160 + }
  161 +
  162 + /// 搜索框
  163 + Widget _searchWidget() {
  164 + return Container(
  165 + color: MyColours.color_ffffff,
  166 + padding: EdgeInsets.symmetric(
  167 + horizontal: ScreenUtil().setWidth(40),
  168 + ),
  169 + height: ScreenUtil().setWidth(45 * 2),
  170 + // alignment: Alignment.center,
  171 +
  172 + child: Container(
  173 + alignment: Alignment.center,
  174 + padding: EdgeInsets.only(
  175 + left: ScreenUtil().setWidth(20 * 2),
  176 + ),
  177 + decoration: BoxDecoration(
  178 + color: MyColours.color_ffffff,
  179 + borderRadius:
  180 + BorderRadius.circular(ScreenUtil().setWidth(24 * 2)),
  181 + border: Border.all(color: Color.fromRGBO(228, 228, 228, 1)),
  182 + boxShadow: [
  183 + BoxShadow(
  184 + color: Color.fromRGBO(220, 220, 220, 1), //投影颜色
  185 + offset: Offset(2, 3), //x,y轴
  186 + blurRadius: ScreenUtil().setWidth(6) //投影距离
  187 + )
  188 + ]),
  189 + child: Row(children: [
  190 + Expanded(
  191 + child: TextField(
  192 + maxLines: 1,
  193 + controller: searchC,
  194 + // focusNode: _focusNode,
  195 + // autofocus: true,
  196 +
  197 + style: TextStyle(
  198 + color: MyColours.color_333333,
  199 + fontSize: ScreenUtil().setSp(26)),
  200 + // textAlignVertical: TextAlignVertical.center,
  201 + decoration: InputDecoration(
  202 + hintText: "输入手机号或姓名",
  203 + hintStyle: TextStyle(
  204 + color: MyColours.color_999999,
  205 + fontSize: ScreenUtil().setSp(26),
  206 + ),
  207 + // isCollapsed:
  208 + // true, //重点,相当于高度包裹的意思,必须设置为true,不然有默认奇妙的最小高度
  209 + border: OutlineInputBorder(borderSide: BorderSide.none),
  210 + contentPadding: EdgeInsets.zero,
  211 + // 左边图标设置
  212 + icon: Image.asset(
  213 + Utils.getImgPath('search'),
  214 + width: ScreenUtil().setWidth(30),
  215 + ),
  216 + //右边图标设置
  217 + // suffixIcon:
  218 + ),
  219 + keyboardType: TextInputType.text,
  220 + textInputAction: TextInputAction.done,
  221 +
  222 + onChanged: (value) {
  223 + // _getContantData(showLoading: false);
  224 + },
  225 + onEditingComplete: () {
  226 + FocusScope.of(context)
  227 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  228 + // _getContantData(showLoading: false);
  229 + },
  230 + ),
  231 + ),
  232 + Offstage(
  233 + offstage: searchC.text == '',
  234 + child: GestureDetector(
  235 + child: Container(
  236 + padding: EdgeInsets.symmetric(
  237 + horizontal: ScreenUtil().setWidth(40),
  238 + vertical: ScreenUtil().setWidth(20),
  239 + ),
  240 + // color: Colors.orange,
  241 + alignment: Alignment.centerRight,
  242 + child: Image.asset(
  243 + Utils.getImgPath('clear'),
  244 + width: ScreenUtil().setWidth(30),
  245 + height: ScreenUtil().setWidth(30),
  246 + ),
  247 + ),
  248 + onTap: () {
  249 + WidgetsBinding.instance.addPostFrameCallback(((_) {
  250 + searchC.clear();
  251 + FocusScope.of(context)
  252 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  253 + // _getContantData(showLoading: false);
  254 + }));
  255 + },
  256 + )),
  257 + // Offstage(
  258 + // offstage: false,
  259 + // child: GestureDetector(
  260 + // child: Container(
  261 + // padding: EdgeInsets.only(
  262 + // right: ScreenUtil().setWidth(30),
  263 + // bottom: ScreenUtil().setWidth(20),
  264 + // top: ScreenUtil().setWidth(20),
  265 + // ),
  266 + // child: Text(
  267 + // '搜索',
  268 + // style: TextStyle(
  269 + // color: MyColours.color_199095,
  270 + // fontSize: ScreenUtil().setSp(28)),
  271 + // ),
  272 + // ),
  273 + // onTap: () {
  274 + // customerProvider.searchData(
  275 + // customerProvider.controller.text);
  276 + // },
  277 + // ))
  278 + ])));
  279 + }
  280 +
  281 + Widget _menuWidget() {
  282 + return Container(
  283 + margin: EdgeInsets.symmetric(
  284 + horizontal: ScreenUtil().setWidth(40),
  285 + vertical: ScreenUtil().setWidth(20)),
  286 + decoration: BoxDecoration(color: MyColours.color_ffffff, boxShadow: [
  287 + BoxShadow(
  288 + // color: Colors.red,
  289 + color: Color.fromRGBO(220, 220, 220, 1), //投影颜色
  290 + offset: Offset(2, 2), //x,y轴
  291 + blurRadius: ScreenUtil().setWidth(6) //投影距离
  292 + )
  293 + ]),
  294 + child: Row(
  295 + children: [
  296 + Expanded(
  297 + child: Container(
  298 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(10)),
  299 + margin:
  300 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(30)),
  301 + child: TabBar(
  302 + controller: tabController,
  303 + // isScrollable: true,
  304 + indicator: CustomTabIndicator(
  305 + radius: 0,
  306 + ),
  307 + indicatorColor: MyColours.color_199095,
  308 + indicatorSize: TabBarIndicatorSize.tab,
  309 + // indicatorPadding: EdgeInsets.symmetric(
  310 + // horizontal: ScreenUtil().setWidth(12)),
  311 + labelColor: MyColours.color_199095,
  312 + labelStyle: TextStyle(
  313 + fontSize: ScreenUtil().setSp(32),
  314 + fontWeight: FontWeight.bold),
  315 + labelPadding: EdgeInsets.zero,
  316 + unselectedLabelStyle: TextStyle(
  317 + fontWeight: FontWeight.normal,
  318 + fontSize: ScreenUtil().setSp(28),
  319 + ),
  320 + unselectedLabelColor: MyColours.color_999999,
  321 + tabs: _tabBarTitle.map((value) {
  322 + return Tab(
  323 + child: Text(value),
  324 + );
  325 + }).toList()),
  326 + )),
  327 + ],
  328 + ));
  329 + }
  330 +
  331 + @override
  332 + Widget build(BuildContext context) {
  333 + storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true);
  334 + return Scaffold(
  335 + appBar: SystemAppBar(
  336 + '存酒管理',
  337 + onTap: () {
  338 + EventBus().emit('changeStatusColor');
  339 + Navigator.pop(context);
  340 + },
  341 + ),
  342 + body: WillPopScope(
  343 + onWillPop: () async {
  344 + EventBus().emit('changeStatusColor');
  345 + return true;
  346 + },
  347 + child: SafeArea(
  348 + child: Column(children: [
  349 + _searchWidget(), _menuWidget(),
  350 + Expanded(
  351 + child: TabBarView(controller: tabController,
  352 + // physics: NeverScrollableScrollPhysics(),
  353 + children: [
  354 + Container(child:
  355 + Consumer<StoreWineProvider>(builder: (context, model, _) {
  356 + if (model.pageStateAll != PageState.Success) {
  357 + return ExceptionPage(
  358 + pageState: model.pageStateAll,
  359 + callback: () {
  360 + // offset = 0;
  361 + // getMessage(showLoading: true);
  362 +
  363 + // if (pageState == PageState.Empty) {
  364 + // NavigatorUtil.goCouponHistoryPage(context);
  365 + // } else {
  366 + // _couponNetworkData(widget.index);
  367 + // }
  368 + },
  369 + emptyMsg: "暂时没有存酒信息哦",
  370 + emptyImg: "empty_search",
  371 + showMsg: "加载中,请稍后...",
  372 + );
  373 + } else {
  374 + return EasyRefresh.custom(
  375 + controller: _controller,
  376 + slivers: [
  377 + SliverList(
  378 + delegate: SliverChildBuilderDelegate(
  379 + (BuildContext context, int index) {
  380 + WineManageModel wineManageModel =
  381 + storeWineProvider.wineManageList[index];
  382 + return WineInStoreItem(
  383 + controller: listInStoreC,
  384 + wineManageModel: wineManageModel,
  385 + isStoreWine: isStoreWine);
  386 + },
  387 + childCount:
  388 + storeWineProvider.wineManageList.length),
  389 + )
  390 + ],
  391 + onRefresh: () async {
  392 + await storeWineProvider.getStoreWineBySeller(context,
  393 + showLoading: false);
  394 + // offset = 0;
  395 + // getMessage(typeid, showLoading: false);
  396 + },
  397 + onLoad: () async {
  398 + _controller.finishLoad();
  399 + _controller.finishLoadCallBack();
  400 + // offset++;
  401 + // getMessage(typeid, showLoading: false);
  402 + },
  403 + );
  404 +
  405 + // return ListView.builder(
  406 + // itemCount: storeWineProvider.wineManageList.length,
  407 + // controller: listInStoreC,
  408 + // itemBuilder: (context, index) {
  409 + // WineManageModel wineManageModel =
  410 + // storeWineProvider.wineManageList[index];
  411 + // return WineInStoreItem(
  412 + // controller: listInStoreC,
  413 + // wineManageModel: wineManageModel,
  414 + // isStoreWine: isStoreWine);
  415 + // });
  416 + }
  417 + })),
  418 + Container(child:
  419 + Consumer<StoreWineProvider>(builder: (context, model, _) {
  420 + if (model.pageStateRecordHome != PageState.Success) {
  421 + return ExceptionPage(
  422 + pageState: model.pageStateRecordHome,
  423 + callback: () async {
  424 + await storeWineProvider.getStoreWineCheckList(context,
  425 + showLoading: true);
  426 + // offset = 0;
  427 + // getMessage(showLoading: true);
  428 +
  429 + // if (pageState == PageState.Empty) {
  430 + // NavigatorUtil.goCouponHistoryPage(context);
  431 + // } else {
  432 + // _couponNetworkData(widget.index);
  433 + // }
  434 + },
  435 + emptyMsg: "暂时没有取酒记录哦",
  436 + emptyImg: "empty_search",
  437 + showMsg: "加载中,请稍后...",
  438 + );
  439 + } else {
  440 + return EasyRefresh.custom(
  441 + controller: _controller,
  442 + slivers: [
  443 + SliverList(
  444 + delegate: SliverChildBuilderDelegate(
  445 + (BuildContext context, int index) {
  446 + OutWineRecordSunModel outWineRecordSunModel =
  447 + model.outWineRecordHomeData[index];
  448 + return WineOutStoreItem(
  449 + controller: listInStoreC,
  450 + outWineRecordSunModel: outWineRecordSunModel,
  451 + );
  452 + },
  453 + childCount: storeWineProvider
  454 + .outWineRecordHomeData.length),
  455 + )
  456 + ],
  457 + onRefresh: () async {
  458 + await storeWineProvider.getStoreWineCheckList(context,
  459 + showLoading: false);
  460 + // offset = 0;
  461 + // getMessage(typeid, showLoading: false);
  462 + },
  463 + onLoad: () async {
  464 + _controller.finishLoad();
  465 + _controller.finishLoadCallBack();
  466 + // offset++;
  467 + // getMessage(typeid, showLoading: false);
  468 + },
  469 + );
  470 + // return ListView.builder(
  471 + // itemCount: model.outWineRecordHomeData.length,
  472 + // controller: listInStoreC,
  473 + // itemBuilder: (context, index) {
  474 + // OutWineRecordSunModel outWineRecordSunModel =
  475 + // model.outWineRecordHomeData[index];
  476 + // return WineOutStoreItem(
  477 + // controller: listInStoreC,
  478 + // outWineRecordSunModel: outWineRecordSunModel,
  479 + // );
  480 + // });
  481 + }
  482 + }))
  483 + ])),
  484 +
  485 + Container(
  486 + height: ScreenUtil().setWidth(91 * 2),
  487 + width: double.infinity,
  488 + padding: EdgeInsets.only(
  489 + top: ScreenUtil().setWidth(12 * 2),
  490 + bottom: ScreenUtil().setWidth(25 * 2),
  491 + left: ScreenUtil().setWidth(45 * 2),
  492 + right: ScreenUtil().setWidth(45 * 2),
  493 + ),
  494 + decoration: BoxDecoration(
  495 + color: MyColours.color_ffffff,
  496 + boxShadow: [
  497 + BoxShadow(
  498 + spreadRadius: ScreenUtil().setWidth(2),
  499 + color: Color.fromRGBO(0, 0, 0, 0.1),
  500 + offset: Offset(0, ScreenUtil().setWidth(-2)),
  501 + blurRadius: ScreenUtil().setWidth(8))
  502 + ],
  503 + borderRadius: BorderRadius.all(
  504 + Radius.circular(ScreenUtil().setWidth(16)),
  505 + ),
  506 + ),
  507 + child: RoundButton(
  508 + text: '新建存酒',
  509 + height: ScreenUtil().setWidth(80),
  510 + radius: ScreenUtil().setWidth(10),
  511 + isBold: true,
  512 + fontSize: 32,
  513 + textColor: MyColours.color_F8F9FD,
  514 + gradientStart: !isStoreWine
  515 + ? MyColours.color_BFC4D4
  516 + : MyColours.color_438E93,
  517 + gradientEnd: !isStoreWine
  518 + ? MyColours.color_BFC4D4
  519 + : MyColours.color_438E93,
  520 + onPressed: () async {
  521 + if (!isStoreWine) {
  522 + Utils.showToast('您不是店铺的存酒管理员,无权进行相关操作。');
  523 + return false;
  524 + }
  525 +
  526 + // UserModel userModel =
  527 + // Provider.of<UserModel>(context, listen: false);
  528 + // if (userModel.user.role_name == '管理员' ||
  529 + // userModel.user.role_name == '店长') {
  530 + NavigatorUtil.goCreateStoreWinePage(context);
  531 + // } else {
  532 + // bool needRefresh =
  533 + // await NavigatorUtil.goCouponEditPage(context);
  534 + // print(needRefresh);
  535 + // if (needRefresh != null && needRefresh) {
  536 + // bus.emit('refresh_coupon_list_f');
  537 + // //刷新页面数据
  538 + // // _controller.callRefresh();
  539 + // // _couponNetworkData(tabController.index);
  540 + // }
  541 + // }
  542 + },
  543 + ),
  544 + )
  545 +
  546 + // _searchWidget(),
  547 + // Positioned(
  548 + // top: 0,
  549 + // left: ScreenUtil().setWidth(40),
  550 + // right: ScreenUtil().setWidth(40),
  551 + // child: _filterWidget())
  552 + // ],
  553 + ])),
  554 + ),
  555 + );
  556 + }
  557 +}
  1 +import 'package:cached_network_image/cached_network_image.dart';
  2 +import 'package:flutter/material.dart';
  3 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  4 +import 'package:provider/provider.dart';
  5 +
  6 +import '../../../models/wine_manage_model.dart';
  7 +import '../../../provider/upload_img_provider.dart';
  8 +import '../../../res/colors.dart';
  9 +import '../../../utils/screen_util.dart';
  10 +import '../../../utils/upload_image_util.dart';
  11 +import '../../../utils/utils.dart';
  12 +import '../../../widgets/MyDivider.dart';
  13 +import '../../../widgets/v_empty_view.dart';
  14 +import '../../online_check/img_picker_widget.dart';
  15 +import '../../online_check/photo_view_wiget.dart';
  16 +
  17 +//只查看
  18 +
  19 +class WineDetailItemPage extends StatefulWidget {
  20 + final WineManageSunModel wineManageSunModel;
  21 + final ScrollController controller;
  22 + final int index;
  23 +
  24 + WineDetailItemPage(
  25 + {Key key, this.wineManageSunModel, this.controller, this.index})
  26 + : super(key: key);
  27 +
  28 + @override
  29 + _WineDetailItemPageState createState() => _WineDetailItemPageState();
  30 +}
  31 +
  32 +class _WineDetailItemPageState extends State<WineDetailItemPage> {
  33 + Widget _textWidget(String title, String subTitle) {
  34 + return Column(children: [
  35 + Container(
  36 + height: ScreenUtil().setWidth(48 * 2),
  37 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  38 + child: Row(
  39 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  40 + crossAxisAlignment: CrossAxisAlignment.center,
  41 + children: [
  42 + Text(
  43 + title,
  44 + style: TextStyle(
  45 + color: MyColours.color_515151, fontSize: font(16)),
  46 + ),
  47 + Expanded(
  48 + child: Container(
  49 + height: ScreenUtil().setWidth(16 * 2),
  50 + alignment: Alignment.centerRight,
  51 + child: Text(
  52 + subTitle,
  53 + //输入文本的样式
  54 + style: TextStyle(
  55 + fontSize: ScreenUtil().setSp(32),
  56 + color: MyColours.color_999999),
  57 + )),
  58 + )
  59 + ],
  60 + )),
  61 + MyDivider(
  62 + double.infinity,
  63 + h(0.5),
  64 + color: MyColours.color_E7E7E7,
  65 + ),
  66 + ]);
  67 + }
  68 +
  69 + //查看大图
  70 + _showPhotoView(BuildContext context, int index, List<String> imgs,
  71 + {isShow = false, List dashName}) async {
  72 + // if (imgs.length == 1 &&
  73 + // imgs[0] ==
  74 + // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
  75 + // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
  76 + // }
  77 + Utils.setBarStatus(false, color: Colors.black);
  78 + dynamic result = await showGeneralDialog(
  79 + context: context,
  80 + barrierDismissible: false,
  81 + // barrierColor: Colors.red,
  82 + barrierLabel:
  83 + MaterialLocalizations.of(context).modalBarrierDismissLabel,
  84 + transitionDuration: const Duration(milliseconds: 150),
  85 + pageBuilder: (BuildContext context, Animation animation,
  86 + Animation secondaryAnimation) {
  87 + Widget child = Stack(
  88 + children: <Widget>[
  89 + PhotoPreview(
  90 + initialIndex: index,
  91 + photoList: imgs,
  92 + isShow: isShow,
  93 + dashName: dashName)
  94 + ],
  95 + );
  96 + return child;
  97 + });
  98 + Utils.setBarStatus(true, color: Colors.white);
  99 + }
  100 +
  101 + /// 九宫格
  102 + Widget _getGridImg(context, List<String> temp) {
  103 + return GridView.builder(
  104 + controller: widget.controller,
  105 + // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
  106 + shrinkWrap: true,
  107 + itemCount: temp.length,
  108 +
  109 + //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
  110 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  111 + //横轴元素个数
  112 + crossAxisCount: 3,
  113 + //纵轴间距
  114 + mainAxisSpacing: ScreenUtil().setWidth(40),
  115 + //横轴间距
  116 + crossAxisSpacing: ScreenUtil().setWidth(36),
  117 + //子组件宽高长度比例
  118 + childAspectRatio: 1.0),
  119 + itemBuilder: (BuildContext context, int index) {
  120 + //Widget Function(BuildContext context, int index)
  121 +
  122 + return temp.length < 1
  123 + ? Text('')
  124 + : InkWell(
  125 + onTap: () {
  126 + ///没有上传完成的不可以点击
  127 + _showPhotoView(context, index, temp);
  128 + },
  129 + child: CachedNetworkImage(
  130 + imageUrl: temp[index],
  131 + fit: BoxFit.cover,
  132 + width: ScreenUtil().setWidth(100 * 2),
  133 + height: ScreenUtil().setWidth(100 * 2),
  134 + ));
  135 + });
  136 + }
  137 +
  138 + @override
  139 + Widget build(BuildContext context) {
  140 + List<String> images = [];
  141 + if (widget.wineManageSunModel.img != null) {
  142 + widget.wineManageSunModel.img.forEach((element) {
  143 + images.add(element.qiniuUrl);
  144 + });
  145 + }
  146 +
  147 + return Container(
  148 + color: Colors.white,
  149 + padding: EdgeInsets.only(left: w(16)),
  150 + margin:
  151 + EdgeInsets.only(top: w(16), bottom: w(10), left: w(20), right: w(20)),
  152 + child: Column(
  153 + children: [
  154 + _textWidget(
  155 + '酒品名称',
  156 + widget.wineManageSunModel.wineName,
  157 + ),
  158 + VEmptyView(16),
  159 + _textWidget('存酒数量', widget.wineManageSunModel.wineAmount),
  160 + VEmptyView(16),
  161 + _textWidget('计量单位', widget.wineManageSunModel.unit),
  162 + VEmptyView(16),
  163 + _textWidget('存酒编号', widget.wineManageSunModel.wineNumber),
  164 + VEmptyView(16),
  165 + images.length > 0 ? _getGridImg(context, images) : SizedBox(),
  166 + images.length > 0 ? VEmptyView(16) : SizedBox(),
  167 + ],
  168 + ),
  169 + );
  170 + }
  171 +}
  1 +import 'dart:convert';
  2 +
  3 +import 'package:flutter/material.dart';
  4 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  5 +import 'package:one_key/pages/my/store_wine_manage/wine_detail_item_page.dart';
  6 +import 'package:one_key/utils/utils.dart';
  7 +import 'package:one_key/widgets/system_app_bar.dart';
  8 +import 'package:provider/provider.dart';
  9 +
  10 +import '../../../constant/state.dart';
  11 +import '../../../models/wine_manage_model.dart';
  12 +import '../../../provider/store_wine_provider.dart';
  13 +import '../../../res/colors.dart';
  14 +import '../../../route/navigator_util.dart';
  15 +import '../../../utils/screen_util.dart';
  16 +import '../../../widgets/MyDivider.dart';
  17 +import '../../../widgets/h_empty_view.dart';
  18 +import '../../../widgets/page_exception.dart';
  19 +import '../../../widgets/round_button.dart';
  20 +import '../../../widgets/v_empty_view.dart';
  21 +
  22 +/**
  23 + *
  24 + * 存酒详情页,只查看
  25 + */
  26 +class WineDetailPage extends StatefulWidget {
  27 + final String idstr;
  28 + final bool isStoreWine;
  29 + WineDetailPage({Key key, this.idstr, this.isStoreWine}) : super(key: key);
  30 +
  31 + @override
  32 + _WineDetailPageState createState() => _WineDetailPageState();
  33 +}
  34 +
  35 +class _WineDetailPageState extends State<WineDetailPage> {
  36 + StoreWineProvider storeWineProvider;
  37 +
  38 + ScrollController _controller = ScrollController();
  39 +
  40 + // List dataWine = [];
  41 +
  42 + @override
  43 + void initState() {
  44 + // TODO: implement initState
  45 + super.initState();
  46 + // WineManageModel wineManageModel = WineManageModel();
  47 + // dataWine.add(wineManageModel);
  48 + // dataWine.add(wineManageModel);
  49 +
  50 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  51 + _getStoreWineById();
  52 + });
  53 + }
  54 +
  55 + _getStoreWineById() async {
  56 + Map<String, String> params = {"id": widget.idstr};
  57 + bool success = await storeWineProvider.getStoreWineById(context, params);
  58 + }
  59 +
  60 + Widget _textItemWidget(
  61 + String title,
  62 + String subTitle,
  63 + ) {
  64 + return Column(children: [
  65 + Container(
  66 + height: ScreenUtil().setWidth(48 * 2),
  67 + padding: EdgeInsets.only(right: ScreenUtil().setWidth(16 * 2)),
  68 + child: Row(
  69 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  70 + crossAxisAlignment: CrossAxisAlignment.center,
  71 + children: [
  72 + Text(
  73 + title,
  74 + style: TextStyle(
  75 + color: MyColours.color_515151, fontSize: font(16)),
  76 + ),
  77 + Text(subTitle,
  78 + //输入文本的样式
  79 + style: TextStyle(
  80 + fontSize: ScreenUtil().setSp(32),
  81 + color: MyColours.color_999999)),
  82 + // ),
  83 + ],
  84 + )),
  85 + MyDivider(
  86 + double.infinity,
  87 + h(0.5),
  88 + color: MyColours.color_E7E7E7,
  89 + ),
  90 + ]);
  91 + }
  92 +
  93 + @override
  94 + Widget build(BuildContext context) {
  95 + storeWineProvider = Provider.of<StoreWineProvider>(context, listen: true);
  96 + return Scaffold(
  97 + appBar: SystemAppBar(
  98 + '存酒详情',
  99 + onTap: () {
  100 + Navigator.pop(context);
  101 + },
  102 + ),
  103 + body: Container(
  104 + child: Consumer<StoreWineProvider>(builder: (context, model, _) {
  105 + if (model.pageStateDetail != PageState.Success) {
  106 + return ExceptionPage(
  107 + pageState: model.pageStateDetail,
  108 + callback: () {
  109 + // offset = 0;
  110 + // getMessage(showLoading: true);
  111 +
  112 + // if (pageState == PageState.Empty) {
  113 + // NavigatorUtil.goCouponHistoryPage(context);
  114 + // } else {
  115 + // _couponNetworkData(widget.index);
  116 + // }
  117 + },
  118 + emptyMsg: "暂时没有存酒信息哦",
  119 + emptyImg: "empty_search",
  120 + showMsg: "加载中,请稍后...",
  121 + );
  122 + } else {
  123 + return Column(
  124 + children: [
  125 + Expanded(
  126 + child: SingleChildScrollView(
  127 + controller: _controller,
  128 + child: Column(
  129 + children: [
  130 + Container(
  131 + color: Colors.white,
  132 + padding: EdgeInsets.only(
  133 + left: ScreenUtil().setWidth(16 * 2)),
  134 + child: Column(
  135 + crossAxisAlignment: CrossAxisAlignment.center,
  136 + mainAxisAlignment: MainAxisAlignment.start,
  137 + children: [
  138 + VEmptyView(32),
  139 + _textItemWidget(
  140 + '联系电话',
  141 + Utils.starPhone(
  142 + model.wineManageDetail.phone)),
  143 + Container(
  144 + height: ScreenUtil().setWidth(48 * 2),
  145 + padding: EdgeInsets.only(
  146 + top: ScreenUtil().setWidth(16 * 2),
  147 + right: ScreenUtil().setWidth(16 * 2)),
  148 + child: Row(
  149 + mainAxisAlignment:
  150 + MainAxisAlignment.spaceBetween,
  151 + crossAxisAlignment:
  152 + CrossAxisAlignment.center,
  153 + children: [
  154 + Text(
  155 + '客人姓名',
  156 + style: TextStyle(
  157 + color: MyColours.color_515151,
  158 + fontSize: font(16)),
  159 + ),
  160 + Expanded(
  161 + child: Container(
  162 + height: ScreenUtil().setWidth(16 * 2),
  163 + alignment: Alignment.centerRight,
  164 + child: Text(
  165 + '${model.wineManageDetail.rname}${model.wineManageDetail.sexStr}',
  166 + style: TextStyle(
  167 + fontSize:
  168 + ScreenUtil().setSp(32),
  169 + color: MyColours.color_999999)),
  170 + )),
  171 + HEmptyView(40),
  172 + Container(
  173 + width: w(100),
  174 + alignment: Alignment.centerRight,
  175 + child: Text(
  176 + // ,
  177 + model.wineManageDetail.isMember == '1'
  178 + ? '会员'
  179 + : '会员状态未知',
  180 + style: TextStyle(
  181 + color: model.wineManageDetail
  182 + .isMember !=
  183 + '1'
  184 + ? MyColours.color_999999
  185 + : MyColours.color_515151,
  186 + fontSize: ScreenUtil().setSp(32),
  187 + ),
  188 + ),
  189 + ),
  190 + ],
  191 + )),
  192 + ],
  193 + )),
  194 + ListView.builder(
  195 + shrinkWrap: true,
  196 + controller: _controller,
  197 + itemCount: model.wineManageDetail.wineData.length,
  198 + itemBuilder: (context, index) {
  199 + WineManageSunModel wineManageSunModel =
  200 + model.wineManageDetail.wineData[index];
  201 + return WineDetailItemPage(
  202 + wineManageSunModel: wineManageSunModel,
  203 + controller: _controller,
  204 + index: index,
  205 + );
  206 + }),
  207 + ],
  208 + ),
  209 + )),
  210 + Container(
  211 + alignment: Alignment.centerLeft,
  212 + margin: EdgeInsets.only(
  213 + left: w(20), right: w(20), top: w(10), bottom: w(16)),
  214 + child: Text(
  215 + '注:为保障酒品安排,只有存酒管理员才可以进行存酒操作!',
  216 + style: TextStyle(
  217 + color: MyColours.color_999999, fontSize: font(10)),
  218 + )),
  219 + Container(
  220 + color: MyColours.color_ffffff,
  221 + padding: EdgeInsets.only(
  222 + top: ScreenUtil().setWidth(16 * 2),
  223 + bottom: ScreenUtil().setWidth(35 * 2),
  224 + left: ScreenUtil().setWidth(45 * 2),
  225 + right: ScreenUtil().setWidth(45 * 2),
  226 + ),
  227 + child: Row(
  228 + children: [
  229 + RoundButton(
  230 + text: '出库记录',
  231 + width: w(100),
  232 + height: ScreenUtil().setWidth(80),
  233 + radius: ScreenUtil().setWidth(10),
  234 + isBold: true,
  235 + borderColor: MyColours.color_438E93,
  236 + gradientStart: MyColours.color_ffffff,
  237 + gradientEnd: MyColours.color_ffffff,
  238 + textColor: MyColours.color_438E93,
  239 + fontSize: 32,
  240 + onPressed: () async {
  241 + // UserModel userModel =
  242 + // Provider.of<UserModel>(context, listen: false);
  243 + // if (userModel.user.role_name == '管理员' ||
  244 + // userModel.user.role_name == '店长') {
  245 + NavigatorUtil.goOutStoreRecordPage(
  246 + context, widget.idstr);
  247 + // } else {
  248 + // bool needRefresh =
  249 + // await NavigatorUtil.goCouponEditPage(context);
  250 + // print(needRefresh);
  251 + // if (needRefresh != null && needRefresh) {
  252 + // bus.emit('refresh_coupon_list_f');
  253 + // //刷新页面数据
  254 + // // _controller.callRefresh();
  255 + // // _couponNetworkData(tabController.index);
  256 + // }
  257 + // }
  258 + },
  259 + ),
  260 + HEmptyView(30),
  261 + Expanded(
  262 + child: RoundButton(
  263 + text: '存酒出库',
  264 + // width: w(218),
  265 + height: ScreenUtil().setWidth(80),
  266 + radius: ScreenUtil().setWidth(10),
  267 + isBold: true,
  268 + gradientStart: !widget.isStoreWine
  269 + ? MyColours.color_BFC4D4
  270 + : MyColours.color_438E93,
  271 + gradientEnd: !widget.isStoreWine
  272 + ? MyColours.color_BFC4D4
  273 + : MyColours.color_438E93,
  274 + fontSize: 32,
  275 + onPressed: () async {
  276 + if (!widget.isStoreWine) {
  277 + Utils.showToast('您不是店铺的存酒管理员,无权进行相关操作。');
  278 + return false;
  279 + }
  280 +
  281 + // UserModel userModel =
  282 + // Provider.of<UserModel>(context, listen: false);
  283 + // if (userModel.user.role_name == '管理员' ||
  284 + // userModel.user.role_name == '店长') {
  285 +
  286 + WineManageModel modelTemp =
  287 + WineManageModel.fromJson2(storeWineProvider
  288 + .wineManageDetail
  289 + .toJson());
  290 + modelTemp.wineData = [];
  291 +
  292 + // modelTemp.cdate =
  293 + // storeWineProvider.wineManageDetail.cdate;
  294 + // modelTemp.id =
  295 + // storeWineProvider.wineManageDetail.id;
  296 + // modelTemp.isMember =
  297 + // storeWineProvider.wineManageDetail.isMember;
  298 + // modelTemp.nickName =
  299 + // storeWineProvider.wineManageDetail.nickName;
  300 + // modelTemp.phone =
  301 + // storeWineProvider.wineManageDetail.phone;
  302 + // modelTemp.rname =
  303 + // storeWineProvider.wineManageDetail.rname;
  304 + // modelTemp.sex =
  305 + // storeWineProvider.wineManageDetail.sex;
  306 + // modelTemp.sexStr =
  307 + // storeWineProvider.wineManageDetail.sexStr;
  308 +
  309 + NavigatorUtil.goApplyOutStorePage(
  310 + context,
  311 + modelTemp,
  312 + );
  313 + // } else {
  314 + // bool needRefresh =
  315 + // await NavigatorUtil.goCouponEditPage(context);
  316 + // print(needRefresh);
  317 + // if (needRefresh != null && needRefresh) {
  318 + // bus.emit('refresh_coupon_list_f');
  319 + // //刷新页面数据
  320 + // // _controller.callRefresh();
  321 + // // _couponNetworkData(tabController.index);
  322 + // }
  323 + // }
  324 + },
  325 + )),
  326 + ],
  327 + ))
  328 + ],
  329 + );
  330 + }
  331 + })));
  332 + }
  333 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/route/navigator_util.dart';
  4 +import 'package:one_key/utils/utils.dart';
  5 +import 'package:one_key/widgets/h_empty_view.dart';
  6 +
  7 +import '../../../models/wine_manage_model.dart';
  8 +import '../../../res/colors.dart';
  9 +import '../../../utils/screen_util.dart';
  10 +import '../../../widgets/v_empty_view.dart';
  11 +
  12 +class WineInStoreItem extends StatefulWidget {
  13 + // final VoidCallback onPressed;
  14 +
  15 + final ScrollController controller;
  16 +
  17 + final WineManageModel wineManageModel;
  18 + final bool isStoreWine;
  19 +
  20 + WineInStoreItem(
  21 + {Key key, this.controller, this.wineManageModel, this.isStoreWine})
  22 + : super(key: key);
  23 +
  24 + @override
  25 + _WineInStoreItemState createState() => _WineInStoreItemState();
  26 +}
  27 +
  28 +class _WineInStoreItemState extends State<WineInStoreItem> {
  29 + @override
  30 + Widget build(BuildContext context) {
  31 + return InkWell(
  32 + onTap: () {
  33 + NavigatorUtil.goWineDetailPage(
  34 + context, widget.wineManageModel.id, widget.isStoreWine);
  35 + },
  36 + child: Container(
  37 + // width: ScreenUtil().setWidth(610),
  38 + margin: EdgeInsets.fromLTRB(
  39 + ScreenUtil().setWidth(40),
  40 + ScreenUtil().setWidth(0),
  41 + ScreenUtil().setWidth(40),
  42 + ScreenUtil().setWidth(32)),
  43 + decoration: BoxDecoration(
  44 + color: MyColours.color_ffffff,
  45 + boxShadow: [
  46 + BoxShadow(
  47 + spreadRadius: ScreenUtil().setWidth(2),
  48 + color: Color.fromRGBO(0, 0, 0, 0.25),
  49 + offset: Offset(0, ScreenUtil().setWidth(8)),
  50 + blurRadius: ScreenUtil().setWidth(8))
  51 + ],
  52 + borderRadius: BorderRadius.all(
  53 + Radius.circular(ScreenUtil().setWidth(16)),
  54 + ),
  55 + ),
  56 + child: Column(
  57 + // mainAxisSize: MainAxisSize.min,
  58 + crossAxisAlignment: CrossAxisAlignment.start,
  59 + children: [
  60 + Container(
  61 + height: ScreenUtil().setWidth(70),
  62 + padding:
  63 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(30)),
  64 + decoration: BoxDecoration(
  65 + color: MyColours.color_438E93,
  66 + borderRadius: BorderRadius.only(
  67 + topLeft: Radius.circular(ScreenUtil().setWidth(16)),
  68 + topRight: Radius.circular(ScreenUtil().setWidth(16)))),
  69 + child: Row(
  70 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  71 + children: [
  72 + Text(
  73 + widget.wineManageModel.rname +
  74 + widget.wineManageModel.sexStr,
  75 + style: TextStyle(
  76 + color: MyColours.color_F8F9FD,
  77 + fontWeight: FontWeight.bold,
  78 + fontSize: ScreenUtil().setSp(36)),
  79 + ),
  80 + Text(Utils.starPhone(widget.wineManageModel.phone),
  81 + maxLines: 1,
  82 + overflow: TextOverflow.ellipsis,
  83 + style: TextStyle(
  84 + color: MyColours.color_F8F9FD,
  85 + fontSize: ScreenUtil().setSp(20))),
  86 + ],
  87 + ),
  88 + ),
  89 + Container(
  90 + padding: EdgeInsets.fromLTRB(
  91 + ScreenUtil().setWidth(20 * 2),
  92 + ScreenUtil().setWidth(9 * 2),
  93 + ScreenUtil().setWidth(20 * 2),
  94 + ScreenUtil().setWidth(4 * 2)),
  95 + child: ListView.builder(
  96 + itemCount: widget.wineManageModel.wineData.length,
  97 + shrinkWrap: true,
  98 + controller: widget.controller,
  99 + itemBuilder: (context, index) {
  100 + WineManageSunModel wineManageSunModel =
  101 + widget.wineManageModel.wineData[index];
  102 + return Container(
  103 + height: ScreenUtil().setWidth(14 * 2),
  104 + margin: EdgeInsets.only(bottom: w(5)),
  105 + child: Row(
  106 + // crossAxisAlignment: CrossAxisAlignment.start,
  107 + children: [
  108 + Container(
  109 + constraints: BoxConstraints(
  110 + maxWidth: ScreenUtil().setWidth(150 * 2)),
  111 + // width:,
  112 + child: Text(
  113 + wineManageSunModel.wineName,
  114 + maxLines: 1,
  115 + overflow: TextOverflow.ellipsis,
  116 + style: TextStyle(
  117 + color: MyColours.color_515151,
  118 + fontSize: ScreenUtil().setSp(20),
  119 + ),
  120 + ),
  121 + ),
  122 + Spacer(),
  123 + Container(
  124 + // width: ScreenUtil().setWidth(60 * 2),
  125 + child: Text(
  126 + '${wineManageSunModel.wineAmount}${wineManageSunModel.unit}',
  127 + maxLines: 1,
  128 + overflow: TextOverflow.ellipsis,
  129 + style: TextStyle(
  130 + color: MyColours.color_515151,
  131 + fontSize: ScreenUtil().setSp(20),
  132 + )),
  133 + ),
  134 + HEmptyView(40),
  135 + Container(
  136 + child: Text(
  137 + '存酒号${wineManageSunModel.wineNumber}',
  138 + style: TextStyle(
  139 + color: MyColours.color_515151,
  140 + fontSize: ScreenUtil().setSp(20),
  141 + )),
  142 + ),
  143 + ],
  144 + ));
  145 + }))
  146 + ],
  147 + ),
  148 + ));
  149 + }
  150 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/models/wine_manage_model.dart';
  4 +import 'package:one_key/utils/utils.dart';
  5 +import 'package:one_key/widgets/h_empty_view.dart';
  6 +
  7 +import '../../../models/out_wine_record_model.dart';
  8 +import '../../../res/colors.dart';
  9 +import '../../../route/navigator_util.dart';
  10 +import '../../../utils/screen_util.dart';
  11 +import '../../../widgets/v_empty_view.dart';
  12 +
  13 +class WineOutStoreItem extends StatefulWidget {
  14 + // final VoidCallback onPressed;
  15 + final OutWineRecordSunModel outWineRecordSunModel;
  16 +
  17 + final ScrollController controller;
  18 +
  19 + // final CouponSunModel couponSonModel;
  20 +
  21 + WineOutStoreItem({Key key, this.controller, this.outWineRecordSunModel})
  22 + : super(key: key);
  23 +
  24 + @override
  25 + _WineOutStoreItemState createState() => _WineOutStoreItemState();
  26 +}
  27 +
  28 +class _WineOutStoreItemState extends State<WineOutStoreItem> {
  29 + @override
  30 + Widget build(BuildContext context) {
  31 + return InkWell(
  32 + onTap: () {
  33 + // WineManageModel modelTemp =
  34 + // WineManageModel.fromJson2(widget.outWineRecordSunModel.toJson());
  35 +
  36 + // modelTemp.wineData = [];
  37 +
  38 + NavigatorUtil.goOutStoreRecordDetailPage(context, widget.outWineRecordSunModel);
  39 + // NavigatorUtil.goOutStoreRecordPage(
  40 + // context, widget.outWineRecordSunModel.id);
  41 + },
  42 + child: Container(
  43 + // width: ScreenUtil().setWidth(610),
  44 + margin: EdgeInsets.fromLTRB(
  45 + ScreenUtil().setWidth(40),
  46 + ScreenUtil().setWidth(0),
  47 + ScreenUtil().setWidth(40),
  48 + ScreenUtil().setWidth(32)),
  49 + decoration: BoxDecoration(
  50 + color: MyColours.color_ffffff,
  51 + boxShadow: [
  52 + BoxShadow(
  53 + spreadRadius: ScreenUtil().setWidth(2),
  54 + color: Color.fromRGBO(0, 0, 0, 0.25),
  55 + offset: Offset(0, ScreenUtil().setWidth(8)),
  56 + blurRadius: ScreenUtil().setWidth(8))
  57 + ],
  58 + borderRadius: BorderRadius.all(
  59 + Radius.circular(ScreenUtil().setWidth(16)),
  60 + ),
  61 + ),
  62 + child: Column(
  63 + // mainAxisSize: MainAxisSize.min,
  64 + crossAxisAlignment: CrossAxisAlignment.start,
  65 + children: [
  66 + Container(
  67 + height: ScreenUtil().setWidth(70),
  68 + padding:
  69 + EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(30)),
  70 + decoration: BoxDecoration(
  71 + color: MyColours.color_999999,
  72 + borderRadius: BorderRadius.only(
  73 + topLeft: Radius.circular(ScreenUtil().setWidth(16)),
  74 + topRight: Radius.circular(ScreenUtil().setWidth(16)))),
  75 + child: Row(
  76 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  77 + children: [
  78 + Text(
  79 + widget.outWineRecordSunModel.rname +
  80 + widget.outWineRecordSunModel.sexStr,
  81 + style: TextStyle(
  82 + color: MyColours.color_F8F9FD,
  83 + fontWeight: FontWeight.bold,
  84 + fontSize: ScreenUtil().setSp(36)),
  85 + ),
  86 + Text(Utils.starPhone(widget.outWineRecordSunModel.phone),
  87 + maxLines: 1,
  88 + overflow: TextOverflow.ellipsis,
  89 + style: TextStyle(
  90 + color: MyColours.color_F8F9FD,
  91 + fontSize: ScreenUtil().setSp(20))),
  92 + Text('接待:${widget.outWineRecordSunModel.nickName}',
  93 + maxLines: 1,
  94 + overflow: TextOverflow.ellipsis,
  95 + style: TextStyle(
  96 + color: MyColours.color_F8F9FD,
  97 + fontSize: ScreenUtil().setSp(20))),
  98 + ],
  99 + ),
  100 + ),
  101 + Container(
  102 + padding: EdgeInsets.fromLTRB(
  103 + ScreenUtil().setWidth(20 * 2),
  104 + ScreenUtil().setWidth(9 * 2),
  105 + ScreenUtil().setWidth(20 * 2),
  106 + ScreenUtil().setWidth(4 * 2)),
  107 + child: ListView.builder(
  108 + itemCount: widget.outWineRecordSunModel.wineCheck.length,
  109 + shrinkWrap: true,
  110 + controller: widget.controller,
  111 + itemBuilder: (context, index) {
  112 + WineCheckModel wineCheckModel =
  113 + widget.outWineRecordSunModel.wineCheck[index];
  114 + return Container(
  115 + height: ScreenUtil().setWidth(14 * 2),
  116 + margin: EdgeInsets.only(bottom: w(5)),
  117 + child: Row(
  118 + // crossAxisAlignment: CrossAxisAlignment.start,
  119 + children: [
  120 + Container(
  121 + constraints: BoxConstraints(
  122 + maxWidth: ScreenUtil().setWidth(150 * 2)),
  123 + // width:,
  124 + child: Text(
  125 + wineCheckModel.wineName,
  126 + maxLines: 1,
  127 + overflow: TextOverflow.ellipsis,
  128 + style: TextStyle(
  129 + color: MyColours.color_515151,
  130 + fontSize: ScreenUtil().setSp(20),
  131 + ),
  132 + ),
  133 + ),
  134 + Spacer(),
  135 + Container(
  136 + // width: ScreenUtil().setWidth(60 * 2),
  137 + child: Text(
  138 + '${widget.outWineRecordSunModel.cdateStr} 取出',
  139 + maxLines: 1,
  140 + overflow: TextOverflow.ellipsis,
  141 + style: TextStyle(
  142 + color: MyColours.color_515151,
  143 + fontSize: ScreenUtil().setSp(20),
  144 + )),
  145 + ),
  146 + HEmptyView(40),
  147 + Container(
  148 + child: Text(
  149 + '${wineCheckModel.checkAmount}${wineCheckModel.unit}',
  150 + style: TextStyle(
  151 + color: MyColours.color_515151,
  152 + fontSize: ScreenUtil().setSp(20),
  153 + )),
  154 + ),
  155 + ],
  156 + ));
  157 + }))
  158 + ],
  159 + ),
  160 + ));
  161 + }
  162 +}
@@ -43,6 +43,8 @@ class ImgPickerWidget extends StatefulWidget { @@ -43,6 +43,8 @@ class ImgPickerWidget extends StatefulWidget {
43 final UploadImageProvider model; 43 final UploadImageProvider model;
44 final UploadType uploadType; 44 final UploadType uploadType;
45 final DeleteCallback deleteCallback; 45 final DeleteCallback deleteCallback;
  46 + final String maxRemind;
  47 + final List<UploadImgModel> imageList;
46 ImgPickerWidget( 48 ImgPickerWidget(
47 {Key key, 49 {Key key,
48 this.scrollController, 50 this.scrollController,
@@ -51,7 +53,9 @@ class ImgPickerWidget extends StatefulWidget { @@ -51,7 +53,9 @@ class ImgPickerWidget extends StatefulWidget {
51 this.maxImageNumber = 5, 53 this.maxImageNumber = 5,
52 this.model, 54 this.model,
53 this.uploadType, 55 this.uploadType,
54 - this.deleteCallback}) 56 + this.deleteCallback,
  57 + this.maxRemind,
  58 + this.imageList})
55 : super(key: key); 59 : super(key: key);
56 60
57 @override 61 @override
@@ -108,6 +112,8 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> { @@ -108,6 +112,8 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
108 widget.model.imageListDenvironment.add(imgModel); 112 widget.model.imageListDenvironment.add(imgModel);
109 } else if (widget.uploadType == UploadType.TableManagerType) { 113 } else if (widget.uploadType == UploadType.TableManagerType) {
110 widget.model.tableImageList.add(imgModel); 114 widget.model.tableImageList.add(imgModel);
  115 + } else if (widget.uploadType == UploadType.WineManageType) {
  116 + widget.imageList.add(imgModel);
111 } 117 }
112 } else { 118 } else {
113 print('No image selected.'); 119 print('No image selected.');
@@ -124,10 +130,13 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> { @@ -124,10 +130,13 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
124 temp = widget.model.imageListDenvironment; 130 temp = widget.model.imageListDenvironment;
125 } else if (widget.uploadType == UploadType.TableManagerType) { 131 } else if (widget.uploadType == UploadType.TableManagerType) {
126 temp = widget.model.tableImageList; 132 temp = widget.model.tableImageList;
  133 + } else if (widget.uploadType == UploadType.WineManageType) {
  134 + temp = widget.imageList;
127 } 135 }
  136 +
128 UploadImageUtil().startUpload(context, File(pickedFile.path), 137 UploadImageUtil().startUpload(context, File(pickedFile.path),
129 temp.length - 1, true, widget.model, widget.uploadType, 138 temp.length - 1, true, widget.model, widget.uploadType,
130 - callback: widget.callback, countAll: 1); 139 + callback: widget.callback, countAll: 1, imageList: widget.imageList);
131 } 140 }
132 } 141 }
133 142
@@ -142,15 +151,15 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> { @@ -142,15 +151,15 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
142 temp = widget.model.imageListDenvironment; 151 temp = widget.model.imageListDenvironment;
143 } else if (widget.uploadType == UploadType.TableManagerType) { 152 } else if (widget.uploadType == UploadType.TableManagerType) {
144 temp = widget.model.tableImageList; 153 temp = widget.model.tableImageList;
  154 + } else if (widget.uploadType == UploadType.WineManageType) {
  155 + temp = widget.imageList;
145 } 156 }
146 - List<AssetEntity> imgList = await AssetPicker.pickAssets(context,  
147 - pickerConfig:AssetPickerConfig( 157 + List<AssetEntity> imgList = await AssetPicker.pickAssets(context,
  158 + pickerConfig: AssetPickerConfig(
148 maxAssets: widget.maxImageNumber - temp.length, 159 maxAssets: widget.maxImageNumber - temp.length,
149 - // selectedAssets: assets,  
150 - requestType: type,  
151 - themeColor: MyColours.color_199095  
152 - )  
153 - ); 160 + // selectedAssets: assets,
  161 + requestType: type,
  162 + themeColor: MyColours.color_199095));
154 163
155 /// context is required, other params is optional. 164 /// context is required, other params is optional.
156 // List<AssetEntity> imgList = await PhotoPicker.pickAsset( 165 // List<AssetEntity> imgList = await PhotoPicker.pickAsset(
@@ -213,7 +222,9 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> { @@ -213,7 +222,9 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
213 }); 222 });
214 UploadImageUtil().startUpload(context, File(file.absolute.path), 223 UploadImageUtil().startUpload(context, File(file.absolute.path),
215 temp.length - 1, false, widget.model, widget.uploadType, 224 temp.length - 1, false, widget.model, widget.uploadType,
216 - countAll: imgList.length, callback: widget.callback); 225 + countAll: imgList.length,
  226 + callback: widget.callback,
  227 + imageList: widget.imageList);
217 // startUpload(File(file.absolute.path), 228 // startUpload(File(file.absolute.path),
218 // _uploadImageProvider.imageList.length - 1, false); 229 // _uploadImageProvider.imageList.length - 1, false);
219 } 230 }
@@ -446,6 +457,8 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> { @@ -446,6 +457,8 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
446 temp = widget.model.imageListDenvironment; 457 temp = widget.model.imageListDenvironment;
447 } else if (widget.uploadType == UploadType.TableManagerType) { 458 } else if (widget.uploadType == UploadType.TableManagerType) {
448 temp = widget.model.tableImageList; 459 temp = widget.model.tableImageList;
  460 + } else if (widget.uploadType == UploadType.WineManageType) {
  461 + temp = widget.imageList;
449 } 462 }
450 return _getGridImg( 463 return _getGridImg(
451 temp.length < widget.maxImageNumber ? temp.length + 1 : temp.length, 464 temp.length < widget.maxImageNumber ? temp.length + 1 : temp.length,
@@ -507,7 +520,16 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> { @@ -507,7 +520,16 @@ class _ImgPickerWidgetState extends DisposableState<ImgPickerWidget> {
507 style: TextStyle( 520 style: TextStyle(
508 fontSize: ScreenUtil().setSp(24), 521 fontSize: ScreenUtil().setSp(24),
509 color: MyColours.color_999999), 522 color: MyColours.color_999999),
510 - ) 523 + ),
  524 + widget.maxRemind != null ? VEmptyView(10) : SizedBox(),
  525 + widget.maxRemind != null
  526 + ? Text(
  527 + '最多${widget.maxRemind}张照片',
  528 + style: TextStyle(
  529 + fontSize: ScreenUtil().setSp(18),
  530 + color: MyColours.color_999999),
  531 + )
  532 + : SizedBox()
511 ], 533 ],
512 )), 534 )),
513 ); 535 );
@@ -47,7 +47,7 @@ class MarketingCenterProvider extends ChangeNotifier { @@ -47,7 +47,7 @@ class MarketingCenterProvider extends ChangeNotifier {
47 Utils.showToast('商家设置预订安排模板页面失败,请重试'); 47 Utils.showToast('商家设置预订安排模板页面失败,请重试');
48 } 48 }
49 } else { 49 } else {
50 - Utils.showToast(baseResp.msg); 50 + Utils.showToast(baseResp.msg ?? '商家设置预订安排模板页面失败,请重试');
51 } 51 }
52 return false; 52 return false;
53 } 53 }
  1 +import 'package:flutter/material.dart';
  2 +import 'package:one_key/constant/state.dart';
  3 +import 'package:one_key/provider/user_model.dart';
  4 +import 'package:provider/provider.dart';
  5 +
  6 +import '../constant/constant.dart';
  7 +import '../models/out_wine_record_model.dart';
  8 +import '../models/phone_code_model.dart';
  9 +import '../models/wine_manage_model.dart';
  10 +import '../net/base_resp.dart';
  11 +import '../net/dio_util.dart';
  12 +import '../net/http_url.dart';
  13 +import '../utils/utils.dart';
  14 +
  15 +/**
  16 + * 餐厅详情
  17 + */
  18 +class StoreWineProvider with ChangeNotifier {
  19 + PageState pageStateAll = PageState.Loading; //全部在店
  20 + PageState pageStateRecord = PageState.Loading; //取酒记录单个存酒
  21 + PageState pageStateDetail = PageState.Loading; //存酒详情
  22 + PageState pageStateDetailRecord = PageState.Success; //出库记录列表详情
  23 + PageState pageStateRecordHome = PageState.Loading; //取酒记录首页
  24 + List<WineManageModel> wineManageList; //存酒列表数据
  25 +
  26 + WineManageModel wineManageDetail; //存酒详情数据
  27 +
  28 + List<OutWineRecordSunModel> outWineRecordData; //某个存酒详情的出库记录
  29 + List<OutWineRecordSunModel> outWineRecordHomeData; //存酒详情的出库记录
  30 + String code; //验证码
  31 + PhoneCodeSunModel phoneCodeSunModel;
  32 +
  33 + /// 给手机发送短信验证码
  34 + Future<bool> getPhoneCode(BuildContext context, Map<String, String> params,
  35 + {isShowLoading = true}) async {
  36 + BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
  37 + .request<Map<String, dynamic>>(
  38 + context, Method.get, HttpUrl.send_vc_code,
  39 + data: params, showLoading: false)
  40 + .catchError((error) {});
  41 + if (baseResp.code == Constant.status_success) {
  42 + if (baseResp.data.isEmpty) {
  43 + return false;
  44 + } else {
  45 + //解析解析
  46 + phoneCodeSunModel = PhoneCodeModel.fromJson(baseResp.responseData).data;
  47 + return true;
  48 + }
  49 + } else {
  50 + if (baseResp != null) {
  51 + Utils.showToast(baseResp.msg ?? "");
  52 + }
  53 + return false;
  54 + }
  55 + }
  56 +
  57 + // 设置商家存酒管理员
  58 + Future<bool> setStoreWineBySellerUser(
  59 + BuildContext context, Map<String, String> params,
  60 + {bool showLoading = true}) async {
  61 + BaseResp<dynamic> baseResp = await DioUtil()
  62 + .request<dynamic>(
  63 + context, Method.get, HttpUrl.set_store_wine_by_seller_user,
  64 + data: params, showLoading: showLoading)
  65 + .catchError((error) {
  66 + print(error.toString());
  67 + Utils.showToast('设置商家存酒管理员失败,请重试');
  68 + return false;
  69 + });
  70 + if (baseResp.code == Constant.status_success) {
  71 + if (baseResp.data == 0 || baseResp.data == 1) {
  72 + return true;
  73 + } else {
  74 + Utils.showToast('设置商家存酒管理员失败,请重试');
  75 + }
  76 + } else {
  77 + Utils.showToast(baseResp.msg ?? '设置商家存酒管理员失败');
  78 + }
  79 + return false;
  80 + }
  81 +
  82 + // 商家新建存酒
  83 + Future<bool> setStoreWineBySeller(
  84 + BuildContext context, Map<String, String> params,
  85 + {bool showLoading = true}) async {
  86 + BaseResp<dynamic> baseResp = await DioUtil()
  87 + .request<dynamic>(context, Method.get, HttpUrl.set_store_wine_by_seller,
  88 + data: params, showLoading: showLoading)
  89 + .catchError((error) {
  90 + print(error.toString());
  91 + Utils.showToast('新建存酒失败,请重试');
  92 + return false;
  93 + });
  94 + if (baseResp.code == Constant.status_success) {
  95 + if (baseResp.data is Map && baseResp.data['id'] is String) {
  96 + return true;
  97 + } else {
  98 + Utils.showToast('新建存酒失败,请重试');
  99 + }
  100 + } else {
  101 + Utils.showToast(baseResp.msg ?? '新建存酒失败,请重试');
  102 + }
  103 + return false;
  104 + }
  105 +
  106 + // 获取存酒列表
  107 + Future<bool> getStoreWineBySeller(BuildContext context,
  108 + {bool showLoading = true}) async {
  109 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  110 + Map<String, String> params = {"sid": userModel.user.sellerid};
  111 + BaseResp<dynamic> baseResp = await DioUtil()
  112 + .request<dynamic>(context, Method.get, HttpUrl.get_store_wine_by_seller,
  113 + data: params, showLoading: showLoading)
  114 + .catchError((error) {
  115 + pageStateAll = PageState.ConnectivityError;
  116 + print(error.toString());
  117 + Utils.showToast('获取存酒列表失败,请重试');
  118 + notifyListeners();
  119 + return false;
  120 + });
  121 + if (baseResp.code == Constant.status_success) {
  122 + if (baseResp.data == false) {
  123 + pageStateAll = PageState.Empty;
  124 + } else {
  125 + wineManageList = WineManageFaModel.fromJson(baseResp.responseData).data;
  126 + pageStateAll = PageState.Success;
  127 + }
  128 + notifyListeners();
  129 + return true;
  130 + } else {
  131 + Utils.showToast(baseResp.msg);
  132 + pageStateAll = PageState.ConnectivityError;
  133 + }
  134 + notifyListeners();
  135 + return false;
  136 + }
  137 +
  138 + // 取酒出库提交
  139 + Future<bool> setStoreWineBySellerCheck(
  140 + BuildContext context, Map<String, String> params,
  141 + {bool showLoading = true}) async {
  142 + BaseResp<dynamic> baseResp = await DioUtil()
  143 + .request<dynamic>(
  144 + context, Method.get, HttpUrl.set_store_wine_by_seller_check,
  145 + data: params, showLoading: showLoading)
  146 + .catchError((error) {
  147 + print(error.toString());
  148 + Utils.showToast('存酒出库失败,请重试');
  149 + return false;
  150 + });
  151 + if (baseResp.code == Constant.status_success) {
  152 + if (baseResp.data is Map && baseResp.data['id'] is String) {
  153 + return true;
  154 + } else {
  155 + Utils.showToast('存酒出库失败,请重试');
  156 + }
  157 + } else {
  158 + Utils.showToast(baseResp.msg ?? '存酒出库失败,请重试');
  159 + }
  160 + return false;
  161 + }
  162 +
  163 + // 获取存酒详情
  164 + Future<bool> getStoreWineById(
  165 + BuildContext context, Map<String, String> params,
  166 + {bool showLoading = true}) async {
  167 + BaseResp<dynamic> baseResp = await DioUtil()
  168 + .request<dynamic>(context, Method.get, HttpUrl.get_store_wine_by_id,
  169 + data: params, showLoading: showLoading)
  170 + .catchError((error) {
  171 + pageStateDetail = PageState.ConnectivityError;
  172 + print(error.toString());
  173 + Utils.showToast('获取存酒详情失败');
  174 + notifyListeners();
  175 + return false;
  176 + });
  177 + if (baseResp.code == Constant.status_success) {
  178 + if (baseResp.data is Map) {
  179 + wineManageDetail = WineManageModel.fromJson(baseResp.data);
  180 + pageStateDetail = PageState.Success;
  181 + } else {
  182 + pageStateDetail = PageState.Empty;
  183 + }
  184 + notifyListeners();
  185 + return true;
  186 + } else {
  187 + Utils.showToast(baseResp.msg ?? '获取存酒详情失败');
  188 + pageStateDetail = PageState.ConnectivityError;
  189 + }
  190 + notifyListeners();
  191 + return false;
  192 + }
  193 +
  194 + // 根据存酒ID获取取酒记录
  195 + Future<bool> getStoreWineCheckByWid(
  196 + BuildContext context, Map<String, String> params,
  197 + {bool showLoading = true}) async {
  198 + BaseResp<dynamic> baseResp = await DioUtil()
  199 + .request<dynamic>(
  200 + context, Method.get, HttpUrl.get_store_wine_check_by_wid,
  201 + data: params, showLoading: showLoading)
  202 + .catchError((error) {
  203 + pageStateRecord = PageState.ConnectivityError;
  204 + print(error.toString());
  205 + Utils.showToast('获取取酒记录失败');
  206 + notifyListeners();
  207 + return false;
  208 + });
  209 + if (baseResp.code == Constant.status_success) {
  210 + outWineRecordData =
  211 + OutWineRecordModel.fromJson(baseResp.responseData).data;
  212 + if (outWineRecordData.length == 0) {
  213 + pageStateRecord = PageState.Empty;
  214 + } else {
  215 + pageStateRecord = PageState.Success;
  216 + }
  217 +
  218 + notifyListeners();
  219 + return true;
  220 + } else {
  221 + Utils.showToast(baseResp.msg ?? '获取取酒记录失败');
  222 + pageStateRecord = PageState.ConnectivityError;
  223 + }
  224 + notifyListeners();
  225 + return false;
  226 + }
  227 +
  228 + // 获取取酒记录
  229 + Future<bool> getStoreWineCheckList(BuildContext context,
  230 + {bool showLoading = true}) async {
  231 + UserModel userModel = Provider.of<UserModel>(context, listen: false);
  232 + Map<String, String> params = {"sid": userModel.user.sellerid};
  233 + BaseResp<dynamic> baseResp = await DioUtil()
  234 + .request<dynamic>(
  235 + context, Method.get, HttpUrl.get_store_wine_check_list,
  236 + data: params, showLoading: showLoading)
  237 + .catchError((error) {
  238 + pageStateRecordHome = PageState.ConnectivityError;
  239 + print(error.toString());
  240 + Utils.showToast('获取取酒记录失败');
  241 + notifyListeners();
  242 + return false;
  243 + });
  244 + if (baseResp.code == Constant.status_success) {
  245 + outWineRecordHomeData =
  246 + OutWineRecordModel.fromJson(baseResp.responseData).data;
  247 + if (outWineRecordHomeData.length == 0) {
  248 + pageStateRecordHome = PageState.Empty;
  249 + } else {
  250 + pageStateRecordHome = PageState.Success;
  251 + }
  252 + notifyListeners();
  253 + return true;
  254 + } else {
  255 + Utils.showToast(baseResp.msg ?? '获取取酒记录失败');
  256 + pageStateRecordHome = PageState.ConnectivityError;
  257 + }
  258 + notifyListeners();
  259 + return false;
  260 + }
  261 +}
@@ -33,11 +33,14 @@ class UploadImageProvider extends ChangeNotifier { @@ -33,11 +33,14 @@ class UploadImageProvider extends ChangeNotifier {
33 List<UploadImgModel> feastRemarkDjImageList = []; //宴会备注图片信息列表----定金 33 List<UploadImgModel> feastRemarkDjImageList = []; //宴会备注图片信息列表----定金
34 List<UploadImgModel> feastRemarkContractImageList = []; //宴会备注图片信息列表----合同 34 List<UploadImgModel> feastRemarkContractImageList = []; //宴会备注图片信息列表----合同
35 List<UploadImgModel> feastRemarkInvoiceImageList = []; //宴会备注图片信息列表----发票 35 List<UploadImgModel> feastRemarkInvoiceImageList = []; //宴会备注图片信息列表----发票
  36 +
36 UploadImgModel storeImage1 = UploadImgModel(); //预订安排介绍 37 UploadImgModel storeImage1 = UploadImgModel(); //预订安排介绍
37 UploadImgModel storeImage2 = UploadImgModel(); //预订安排介绍 38 UploadImgModel storeImage2 = UploadImgModel(); //预订安排介绍
38 UploadImgModel storeImage3 = UploadImgModel(); //预订安排介绍 39 UploadImgModel storeImage3 = UploadImgModel(); //预订安排介绍
39 UploadImgModel storeImage4 = UploadImgModel(); //预订安排介绍 40 UploadImgModel storeImage4 = UploadImgModel(); //预订安排介绍
40 41
  42 + // List<UploadImgModel> wineImageList = []; //新建存酒
  43 +
41 int countUpload = 0; 44 int countUpload = 0;
42 UploadImageProvider() { 45 UploadImageProvider() {
43 touxiang.process = 0.01; 46 touxiang.process = 0.01;