Commit 0ccb66e1 authored by 朱璇's avatar 朱璇

商议低价 bean

parent 925063f7
/*
* @Author: zx
* @Date: 2020-07-03 20:54:59
* @Last Modified by: zx
* @Last Modified time: 2020-07-03 20:54:59
*/
import 'package:flutter_common/commonModel/live/BaseModel.dart';
import 'package:flutter_common/commonModel/live/LiveData.dart';
import 'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanCompareDetail.dart';
import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:gm_flutter/commonModel/rx/RxDispose.dart';
import 'package:flutter_common/commonModel/toast/NativeToast.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
......@@ -12,6 +12,7 @@ import 'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart';
import 'package:gm_flutter/ClueModel/server/entity/ProjectDetailsItem.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanBean.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart';
import 'package:gm_flutter/ClueModel/server/entity/DiscussLowPriceModelBean.dart';
@ServiceCenter()
abstract class ClueApi {
......@@ -45,4 +46,11 @@ abstract class ClueApi {
@Get("api/janus/plans/rank")
PlanBarBean getPlanBar(@Query("rank_type") String rank_type);
@Get("api/janus/plans/compare")
DiscussLowPriceModelBean getPopviewData(
@Query("plan_id") String plan_id,
@Query("hospital_id") String hospital_id,
@Query("doctor_id") String doctor_id,
);
}
......@@ -21,6 +21,7 @@ import 'package:gm_flutter/ClueModel/server/entity/PlanCompareDetail.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanBean.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanBarBean.dart';
import 'package:gm_flutter/ClueModel/server/entity/DiscussLowPriceModelBean.dart';
const bool inProduction = const bool.fromEnvironment("dart.vm.product");
......@@ -153,6 +154,23 @@ class ClueApiImpl {
});
}
Stream<DiscussLowPriceModelBean> getPopviewData(
Dio _dio, String plan_id, String hospital_id, String doctor_id) {
return Stream.fromFuture(get(_dio, 'api/janus/plans/compare', data: {
'plan_id': plan_id,
'hospital_id': hospital_id,
'doctor_id': doctor_id,
})).flatMap((value) {
if (value != null &&
(value.statusCode >= 200 && value.statusCode < 300)) {
return Stream.fromFuture(
compute(parseDiscussLowPriceModelBean, value.toString()));
} else {
throw Exception("--未知网络错误--");
}
});
}
///==================base method==================
Future<Response> get(Dio _dio, url, {data, options, cancelToken}) async {
......@@ -317,3 +335,7 @@ PlanFeedBean parsePlanFeedBean(String value) {
PlanBarBean parsePlanBarBean(String value) {
return PlanBarBean.fromJson(json.decode(value));
}
DiscussLowPriceModelBean parseDiscussLowPriceModelBean(String value) {
return DiscussLowPriceModelBean.fromJson(json.decode(value));
}
/*
* @Author: zx
* @Date: 2020-07-03 20:56:15
* @Last Modified by: zx
* @Last Modified time: 2020-07-03 20:57:44
*/
class DiscussLowPriceModelBean {
int error;
String message;
Null extra;
Null errorExtra;
UserType userType;
Data data;
DiscussLowPriceModelBean(
{this.error,
this.message,
this.extra,
this.errorExtra,
this.userType,
this.data});
DiscussLowPriceModelBean.fromJson(Map<String, dynamic> json) {
error = json['error'];
message = json['message'];
extra = json['extra'];
errorExtra = json['error_extra'];
userType = json['user_type'] != null
? new UserType.fromJson(json['user_type'])
: null;
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['message'] = this.message;
data['extra'] = this.extra;
data['error_extra'] = this.errorExtra;
if (this.userType != null) {
data['user_type'] = this.userType.toJson();
}
if (this.data != null) {
data['data'] = this.data.toJson();
}
return data;
}
}
class UserType {
UserType();
UserType.fromJson(Map<String, dynamic> json) {}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
return data;
}
}
class Data {
int leadPhoneRequestId;
int authorizeType;
String icon;
String tip;
String title;
String authorizePhone;
Data(
{this.leadPhoneRequestId,
this.authorizeType,
this.icon,
this.tip,
this.title,
this.authorizePhone});
Data.fromJson(Map<String, dynamic> json) {
leadPhoneRequestId = json['lead_phone_request_id'];
authorizeType = json['authorize_type'];
icon = json['icon'];
tip = json['tip'];
title = json['title'];
authorizePhone = json['authorize_phone'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['lead_phone_request_id'] = this.leadPhoneRequestId;
data['authorize_type'] = this.authorizeType;
data['icon'] = this.icon;
data['tip'] = this.tip;
data['title'] = this.title;
data['authorize_phone'] = this.authorizePhone;
return data;
}
}
......@@ -9,8 +9,7 @@ import 'package:gm_flutter/MainRouter/page/proxy/NetProxyPage.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/commonModel/base/BaseState.dart';
import 'package:gm_flutter/main.mark.dart';
import 'package:gm_flutter/ClueModel/view/DiscussLowPricePopView.dart';
import 'package:gm_flutter/ClueModel/page/DiscussLowPrice/DiscussLowPricePopView.dart';
import 'TP.dart';
class TestPage extends StatefulWidget {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment