|
@@ -65,6 +65,8 @@ import '../../widgets/special_text/my_extended_text_selection_controls.dart'; |
|
@@ -65,6 +65,8 @@ import '../../widgets/special_text/my_extended_text_selection_controls.dart'; |
|
65
|
import '../online_check/img_picker_widget.dart';
|
65
|
import '../online_check/img_picker_widget.dart';
|
|
66
|
import '../online_check/photo_view_wiget.dart';
|
66
|
import '../online_check/photo_view_wiget.dart';
|
|
67
|
|
67
|
|
|
|
|
68
|
+typedef BoolCallback = void Function(bool value);
|
|
|
|
69
|
+
|
|
68
|
class NotebookDetailPage extends StatefulWidget {
|
70
|
class NotebookDetailPage extends StatefulWidget {
|
|
69
|
final String rid;
|
71
|
final String rid;
|
|
70
|
final String mid;
|
72
|
final String mid;
|
|
@@ -495,13 +497,26 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -495,13 +497,26 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
495
|
}
|
497
|
}
|
|
496
|
|
498
|
|
|
497
|
///订座详情
|
499
|
///订座详情
|
|
498
|
- _getReserveDetail({bool showCicle = false}) async {
|
500
|
+ _getReserveDetail({bool showCicle = false, bool isShowLoading = true}) async {
|
|
499
|
detailEntity = await detailModel.getReserveDetail(
|
501
|
detailEntity = await detailModel.getReserveDetail(
|
|
500
|
context,
|
502
|
context,
|
|
501
|
{
|
503
|
{
|
|
502
|
"rid": widget.rid,
|
504
|
"rid": widget.rid,
|
|
503
|
},
|
505
|
},
|
|
504
|
- showCircle: showCicle);
|
506
|
+ showCircle: showCicle,
|
|
|
|
507
|
+ isShowLoading: isShowLoading);
|
|
|
|
508
|
+
|
|
|
|
509
|
+ remarkImgs = [];
|
|
|
|
510
|
+
|
|
|
|
511
|
+ if (detailEntity.photo_note != null && detailEntity.photo_note.length > 0) {
|
|
|
|
512
|
+ detailEntity.photo_note.forEach((element) {
|
|
|
|
513
|
+ UploadImgModel imageModel = UploadImgModel();
|
|
|
|
514
|
+ imageModel.qiniuUrl = element;
|
|
|
|
515
|
+ imageModel.isUpload = true;
|
|
|
|
516
|
+ imageModel.process = 1;
|
|
|
|
517
|
+ remarkImgs.add(imageModel);
|
|
|
|
518
|
+ });
|
|
|
|
519
|
+ }
|
|
505
|
|
520
|
|
|
506
|
reserveType =
|
521
|
reserveType =
|
|
507
|
detailEntity.reserve_type == null || detailEntity.reserve_type == ''
|
522
|
detailEntity.reserve_type == null || detailEntity.reserve_type == ''
|
|
@@ -1871,96 +1886,120 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
@@ -1871,96 +1886,120 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { |
|
1871
|
]);
|
1886
|
]);
|
|
1872
|
}
|
1887
|
}
|
|
1873
|
|
1888
|
|
|
|
|
1889
|
+ _updatePhotoNote() async {
|
|
|
|
1890
|
+ List<String> imageQiniuUrlList = [];
|
|
|
|
1891
|
+ // if (isDelete) {
|
|
|
|
1892
|
+ for (int i = 0; i < remarkImgs.length; i++) {
|
|
|
|
1893
|
+ imageQiniuUrlList.add(remarkImgs[i].qiniuUrl);
|
|
|
|
1894
|
+ }
|
|
|
|
1895
|
+ // } else {
|
|
|
|
1896
|
+ // for (int i = 0; i < remarkImgs.length; i++) {
|
|
|
|
1897
|
+ // // if (!remarkImgs[i].isUpload) {
|
|
|
|
1898
|
+ // imageQiniuUrlList.add(remarkImgs[i].qiniuUrl);
|
|
|
|
1899
|
+ // // }
|
|
|
|
1900
|
+ // }
|
|
|
|
1901
|
+ // }
|
|
|
|
1902
|
+
|
|
|
|
1903
|
+ print(imageQiniuUrlList); //全部图片,详情接口请求后赋值,初始化数据
|
|
|
|
1904
|
+ //调用接口绑定数据
|
|
|
|
1905
|
+ // _setTablePhoto(
|
|
|
|
1906
|
+ // context, imageQiniuUrlList);
|
|
|
|
1907
|
+
|
|
|
|
1908
|
+ bool sucess = await detailModel.upReserveInfo(context, widget.rid,
|
|
|
|
1909
|
+ photoNote: json.encode(imageQiniuUrlList));
|
|
|
|
1910
|
+
|
|
|
|
1911
|
+ if (sucess) {
|
|
|
|
1912
|
+ // bus.emit("refresh_book_list"); //刷新已预订列表
|
|
|
|
1913
|
+
|
|
|
|
1914
|
+ // EventBus().emit("refresh_tablemanager"); //刷新桌位
|
|
|
|
1915
|
+ await _getReserveDetail(showCicle: false, isShowLoading: false);
|
|
|
|
1916
|
+ }
|
|
|
|
1917
|
+ }
|
|
|
|
1918
|
+
|
|
1874
|
///图片备注
|
1919
|
///图片备注
|
|
1875
|
Widget _imageRemark() {
|
1920
|
Widget _imageRemark() {
|
|
1876
|
bool show = Utils.getAuthority(context, '图片备注') ||
|
1921
|
bool show = Utils.getAuthority(context, '图片备注') ||
|
|
1877
|
widget.uid ==
|
1922
|
widget.uid ==
|
|
1878
|
Provider.of<UserModel>(context, listen: false).user.openid;
|
1923
|
Provider.of<UserModel>(context, listen: false).user.openid;
|
|
1879
|
- return (!show && remarkImgs.length == 0) ? SizedBox(): Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
1880
|
- VEmptyView(36),
|
|
|
|
1881
|
- Text(
|
|
|
|
1882
|
- '图片备注',
|
|
|
|
1883
|
- overflow: TextOverflow.ellipsis,
|
|
|
|
1884
|
- style: TextStyle(color: MyColours.color_515151, fontSize: font(15)),
|
|
|
|
1885
|
- ),
|
|
|
|
1886
|
- VEmptyView(30),
|
|
|
|
1887
|
- show
|
|
|
|
1888
|
- ? Padding(
|
|
|
|
1889
|
- padding: EdgeInsets.only(left: w(20), right: w(15)),
|
|
|
|
1890
|
- child:
|
|
|
|
1891
|
- Consumer<UploadImageProvider>(builder: (context, model, _) {
|
|
|
|
1892
|
- return ImgPickerWidget(
|
|
|
|
1893
|
- scrollController: controller,
|
|
|
|
1894
|
- model: _uploadImageProvider,
|
|
|
|
1895
|
- maxImageNumber: 3,
|
|
|
|
1896
|
- maxRemind: '三',
|
|
|
|
1897
|
- imageList: remarkImgs,
|
|
|
|
1898
|
- uploadType: UploadType.RemarkImagesType,
|
|
|
|
1899
|
- deleteCallback: (int index) {
|
|
|
|
1900
|
- remarkImgs
|
|
|
|
1901
|
- .removeWhere((element) => element == remarkImgs[index]);
|
|
|
|
1902
|
- setState(() {});
|
|
|
|
1903
|
- //删除图片接口??????
|
|
|
|
1904
|
- },
|
|
|
|
1905
|
- callback: () {
|
|
|
|
1906
|
- print(remarkImgs);
|
|
|
|
1907
|
- for (UploadImgModel item in remarkImgs) {
|
|
|
|
1908
|
- if (item.process < 1) {
|
|
|
|
1909
|
- Utils.showToast('正在上传图片,请稍等');
|
|
|
|
1910
|
- return;
|
|
|
|
1911
|
- }
|
|
|
|
1912
|
- }
|
|
|
|
1913
|
- //接口,和订单绑定
|
|
|
|
1914
|
- List imageQiniuUrlList = [];
|
|
|
|
1915
|
- for (int i = 0; i < remarkImgs.length; i++) {
|
|
|
|
1916
|
- if (!remarkImgs[i].isUpload) {
|
|
|
|
1917
|
- imageQiniuUrlList.add({"url": remarkImgs[i].qiniuUrl});
|
|
|
|
1918
|
- }
|
|
|
|
1919
|
- }
|
|
|
|
1920
|
-
|
|
|
|
1921
|
- print(imageQiniuUrlList); //全部图片,详情接口请求后赋值,初始化数据
|
|
|
|
1922
|
- //调用接口绑定数据
|
|
|
|
1923
|
- // _setTablePhoto(
|
|
|
|
1924
|
- // context, imageQiniuUrlList);
|
|
|
|
1925
|
- },
|
|
|
|
1926
|
- );
|
|
|
|
1927
|
- }))
|
|
|
|
1928
|
- : GridView.builder(
|
|
|
|
1929
|
- controller: controller,
|
|
|
|
1930
|
- // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
|
|
|
|
1931
|
- shrinkWrap: true,
|
|
|
|
1932
|
- itemCount: remarkImgs.length,
|
|
|
|
1933
|
-
|
|
|
|
1934
|
- //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
|
|
|
|
1935
|
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
1936
|
- //横轴元素个数
|
|
|
|
1937
|
- crossAxisCount: 3,
|
|
|
|
1938
|
- //纵轴间距
|
|
|
|
1939
|
- mainAxisSpacing: ScreenUtil().setWidth(40),
|
|
|
|
1940
|
- //横轴间距
|
|
|
|
1941
|
- crossAxisSpacing: ScreenUtil().setWidth(36),
|
|
|
|
1942
|
- //子组件宽高长度比例
|
|
|
|
1943
|
- childAspectRatio: 1.0),
|
|
|
|
1944
|
- itemBuilder: (BuildContext context, int index) {
|
|
|
|
1945
|
- return InkWell(
|
|
|
|
1946
|
- onTap: () {
|
|
|
|
1947
|
- ///没有上传完成的不可以点击
|
|
|
|
1948
|
- _showPhotoView(context, index,
|
|
|
|
1949
|
- remarkImgs.map((e) => e.qiniuUrl).toList());
|
|
|
|
1950
|
- },
|
|
|
|
1951
|
- child: CachedNetworkImage(
|
|
|
|
1952
|
- imageUrl: remarkImgs[index].qiniuUrl,
|
|
|
|
1953
|
- fit: BoxFit.cover,
|
|
|
|
1954
|
- width: ScreenUtil().setWidth(100 * 2),
|
|
|
|
1955
|
- height: ScreenUtil().setWidth(100 * 2),
|
|
|
|
1956
|
- ));
|
|
|
|
1957
|
- }),
|
|
|
|
1958
|
- VEmptyView(36),
|
|
|
|
1959
|
- Container(
|
|
|
|
1960
|
- height: ScreenUtil().setWidth(2),
|
|
|
|
1961
|
- color: MyColours.color_E7E7E7,
|
|
|
|
1962
|
- ),
|
|
|
|
1963
|
- ]);
|
1924
|
+ return (!show && remarkImgs.length == 0)
|
|
|
|
1925
|
+ ? SizedBox()
|
|
|
|
1926
|
+ : Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
|
|
1927
|
+ VEmptyView(36),
|
|
|
|
1928
|
+ Text(
|
|
|
|
1929
|
+ '图片备注',
|
|
|
|
1930
|
+ overflow: TextOverflow.ellipsis,
|
|
|
|
1931
|
+ style:
|
|
|
|
1932
|
+ TextStyle(color: MyColours.color_515151, fontSize: font(15)),
|
|
|
|
1933
|
+ ),
|
|
|
|
1934
|
+ VEmptyView(30),
|
|
|
|
1935
|
+ show
|
|
|
|
1936
|
+ ? Padding(
|
|
|
|
1937
|
+ padding: EdgeInsets.only(left: w(20), right: w(15)),
|
|
|
|
1938
|
+ child: Consumer<UploadImageProvider>(
|
|
|
|
1939
|
+ builder: (context, model, _) {
|
|
|
|
1940
|
+ return ImgPickerWidget(
|
|
|
|
1941
|
+ scrollController: controller,
|
|
|
|
1942
|
+ model: _uploadImageProvider,
|
|
|
|
1943
|
+ maxImageNumber: 3,
|
|
|
|
1944
|
+ maxRemind: '三',
|
|
|
|
1945
|
+ imageList: remarkImgs,
|
|
|
|
1946
|
+ uploadType: UploadType.RemarkImagesType,
|
|
|
|
1947
|
+ deleteCallback: (int index) {
|
|
|
|
1948
|
+ remarkImgs.removeWhere(
|
|
|
|
1949
|
+ (element) => element == remarkImgs[index]);
|
|
|
|
1950
|
+ setState(() {});
|
|
|
|
1951
|
+ //删除图片接口??????
|
|
|
|
1952
|
+ _updatePhotoNote();
|
|
|
|
1953
|
+ },
|
|
|
|
1954
|
+ callback: () async {
|
|
|
|
1955
|
+ print(remarkImgs);
|
|
|
|
1956
|
+ for (UploadImgModel item in remarkImgs) {
|
|
|
|
1957
|
+ if (item.process < 1) {
|
|
|
|
1958
|
+ Utils.showToast('正在上传图片,请稍等');
|
|
|
|
1959
|
+ return;
|
|
|
|
1960
|
+ }
|
|
|
|
1961
|
+ }
|
|
|
|
1962
|
+ //接口,和订单绑定
|
|
|
|
1963
|
+ _updatePhotoNote();
|
|
|
|
1964
|
+ },
|
|
|
|
1965
|
+ );
|
|
|
|
1966
|
+ }))
|
|
|
|
1967
|
+ : GridView.builder(
|
|
|
|
1968
|
+ controller: controller,
|
|
|
|
1969
|
+ // padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
|
|
|
|
1970
|
+ shrinkWrap: true,
|
|
|
|
1971
|
+ itemCount: remarkImgs.length,
|
|
|
|
1972
|
+
|
|
|
|
1973
|
+ //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
|
|
|
|
1974
|
+ gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
1975
|
+ //横轴元素个数
|
|
|
|
1976
|
+ crossAxisCount: 3,
|
|
|
|
1977
|
+ //纵轴间距
|
|
|
|
1978
|
+ mainAxisSpacing: ScreenUtil().setWidth(40),
|
|
|
|
1979
|
+ //横轴间距
|
|
|
|
1980
|
+ crossAxisSpacing: ScreenUtil().setWidth(36),
|
|
|
|
1981
|
+ //子组件宽高长度比例
|
|
|
|
1982
|
+ childAspectRatio: 1.0),
|
|
|
|
1983
|
+ itemBuilder: (BuildContext context, int index) {
|
|
|
|
1984
|
+ return InkWell(
|
|
|
|
1985
|
+ onTap: () {
|
|
|
|
1986
|
+ ///没有上传完成的不可以点击
|
|
|
|
1987
|
+ _showPhotoView(context, index,
|
|
|
|
1988
|
+ remarkImgs.map((e) => e.qiniuUrl).toList());
|
|
|
|
1989
|
+ },
|
|
|
|
1990
|
+ child: CachedNetworkImage(
|
|
|
|
1991
|
+ imageUrl: remarkImgs[index].qiniuUrl,
|
|
|
|
1992
|
+ fit: BoxFit.cover,
|
|
|
|
1993
|
+ width: ScreenUtil().setWidth(100 * 2),
|
|
|
|
1994
|
+ height: ScreenUtil().setWidth(100 * 2),
|
|
|
|
1995
|
+ ));
|
|
|
|
1996
|
+ }),
|
|
|
|
1997
|
+ VEmptyView(36),
|
|
|
|
1998
|
+ Container(
|
|
|
|
1999
|
+ height: ScreenUtil().setWidth(2),
|
|
|
|
2000
|
+ color: MyColours.color_E7E7E7,
|
|
|
|
2001
|
+ ),
|
|
|
|
2002
|
+ ]);
|
|
1964
|
}
|
2003
|
}
|
|
1965
|
|
2004
|
|
|
1966
|
//查看大图
|
2005
|
//查看大图
|