|
|
@@ -3,6 +3,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
import 'dart:async';
|
|
|
import 'order_management_page/order_detail_page.dart';
|
|
|
import 'order_detail/order_detail.dart';
|
|
|
+import '../util/bluetooth_utils.dart';
|
|
|
+import '../util/session.dart';
|
|
|
import '../showDialog.dart';
|
|
|
import '../util/models.dart';
|
|
|
import '../util/api.dart';
|
|
|
@@ -71,6 +73,7 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
int orderStatus = 1; //0:代收单,1:待取件,2:运途中:已完成
|
|
|
int page = 1;
|
|
|
bool hasNextPage = true;
|
|
|
+ BluetoothUtils bluetooth = BluetoothUtils();
|
|
|
List < FromStatusGetOrderList > orderList = [];
|
|
|
List likeOrderNoList = [];
|
|
|
var timer;
|
|
|
@@ -143,7 +146,7 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
timer = Timer(Duration(milliseconds: 500), () {
|
|
|
if (_orderNo.length >= 6) {
|
|
|
orderNoLike(_orderNo, orderStatus).then((resp) {
|
|
|
- if (isNotError(context, resp)) {
|
|
|
+ if (isNotError(context, resp) && this.mounted) {
|
|
|
LikeOrderNo tempObj = LikeOrderNo.fromJson(resp.data);
|
|
|
if (tempObj.data.length > 0) {
|
|
|
setState(() {
|
|
|
@@ -335,7 +338,7 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
_orderNo = likeOrderNoList[index];
|
|
|
});
|
|
|
fromStatusGetOrderList(orderStatus, page, likeOrderNoList[index]).then((resp) {
|
|
|
- if (isNotError(context, resp)) {
|
|
|
+ if (isNotError(context, resp) && this.mounted) {
|
|
|
FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
|
|
|
setState(() {
|
|
|
orderList = tempObj.data.items;
|
|
|
@@ -669,7 +672,51 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
return new LoadingDialog( //调用对话框
|
|
|
text: '是否确认打印', childCallback: (val) {
|
|
|
if (val) {
|
|
|
- //widget.callback(widget.index);
|
|
|
+ getOrderDetail(obj.orderNo).then((resp){
|
|
|
+ if(isNotError(context, resp) && this.mounted){
|
|
|
+ OrderDetailData data = OrderDetailObj.fromJson(resp.data).data;
|
|
|
+ getKey('printType').then((printType){
|
|
|
+ getKey('stationName').then((stationName){
|
|
|
+ getKey('nickName').then((nickName){
|
|
|
+ double goodsYs = (obj.goodsFreight/100)+(obj.goodsAgencyFund/100);
|
|
|
+ String nowDate = fromatDate( DateTime.now().millisecondsSinceEpoch);//打印时间
|
|
|
+ double goodsAgencyFunds = double.parse(resp.goodsAgencyFunds/100);
|
|
|
+ double goodsDFreight = 0;
|
|
|
+ double goodsXFreight = 0;
|
|
|
+
|
|
|
+ // Map<String, String> pum = {
|
|
|
+ // "[logisticsNo]": "${data.orderNo ?? ''}",
|
|
|
+ // "[createTime]": "",
|
|
|
+ // "[sendStationName]": "$stationName",
|
|
|
+ // "[dealerCode]": "${data.sendCompanyCode ?? ''}",
|
|
|
+ // "[dealerName]": "${data.sendCompanyName}",
|
|
|
+ // "[dealerTel]": "${data.sendCompanyPhone ?? ''}",
|
|
|
+ // "[repairName]": "${data.receiptCompanyName ?? ''}",
|
|
|
+ // "[repairTel]": "${data.receiptCompanyPhone ?? ''}",
|
|
|
+ // "[endStationName]": "",
|
|
|
+ // "[goodsLineCode]": "${data.goodsLineCode ?? ''}",
|
|
|
+ // "[goodsLine]": "${data.goodsLine ?? ''}",
|
|
|
+ // "[repairAddress]": "${data.receiptCompanyAddress ?? ''}",
|
|
|
+ // "[goodsQuantity]": "${data.goodsQuantity ?? ''}",
|
|
|
+ // "[goodsInsurance]": "${data.goodsInsurance ?? ''}",
|
|
|
+ // "[goodsFlatCost]": "${data.goodsFlatCost ?? ''}",
|
|
|
+ // // 到付 现付 金额
|
|
|
+ // "[goodsDFreight]": "$goodsDFreight",
|
|
|
+ // "[goodsXFreight]": "$goodsXFreight",
|
|
|
+ // "[goodsAgencyFund]": "$goodsAgencyFunds",
|
|
|
+ // "[goodsYs]": "$goodsYs",
|
|
|
+ // "[dealerBankAccount]": "${data.sendCompanyBankCard ?? ''}",
|
|
|
+ // "[goodsRemark]": "${data.goodsRemark ?? ''}",
|
|
|
+ // "[realName]": "${nickName?? ''}",
|
|
|
+ // "[currentTime]": "$nowDate",
|
|
|
+ // "[currentGoodNumber]": "1/1",
|
|
|
+ // };
|
|
|
+ // bluetooth.printOrder(pum, int.parse(printType);
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
@@ -762,7 +809,7 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
});
|
|
|
page = 1;
|
|
|
fromStatusGetOrderList(orderStatus, page, _orderNo).then((resp) {
|
|
|
- if (isNotError(context, resp)) {
|
|
|
+ if (isNotError(context, resp) && this.mounted) {
|
|
|
FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
|
|
|
setState(() {
|
|
|
orderList = tempObj.data.items;
|
|
|
@@ -777,7 +824,7 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
}
|
|
|
loadMoreStatus = false;
|
|
|
fromStatusGetOrderList(orderStatus, page, _orderNo).then((resp) {
|
|
|
- if (isNotError(context, resp)) {
|
|
|
+ if (isNotError(context, resp) && this.mounted) {
|
|
|
FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
|
|
|
setState(() {
|
|
|
orderList.addAll(tempObj.data.items);
|
|
|
@@ -805,7 +852,7 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
}
|
|
|
myUpdataOrder(String myOrderNo, int myOrderStatus, int index) {
|
|
|
updataOrderStatus(myOrderNo, myOrderStatus).then((resp) {
|
|
|
- if (isNotError(context, resp)) {
|
|
|
+ if (isNotError(context, resp) && this.mounted) {
|
|
|
deleteOrder(index);
|
|
|
}
|
|
|
});
|
|
|
@@ -813,7 +860,7 @@ class _QueryWidgetState extends State < QueryWidget > {
|
|
|
Future refreshOrder() async {
|
|
|
page = 1;
|
|
|
await fromStatusGetOrderList(orderStatus, page, _orderNo).then((resp) {
|
|
|
- if (isNotError(context, resp)) {
|
|
|
+ if (isNotError(context, resp) && this.mounted) {
|
|
|
FromStatusGetOrderObj tempObj = FromStatusGetOrderObj.fromJson(resp.data);
|
|
|
setState(() {
|
|
|
orderList = tempObj.data.items;
|