Commit 027cbb65 authored by 朱璇's avatar 朱璇

商议低价接口调试“

parent 2dde0e2f
/*
* @Author: zx
* @Date: 2020-07-03 20:54:59
* @Last Modified by: zx
* @Last Modified time: 2020-07-03 20:54:59
* @Last Modified by: zx
* @Last Modified time: 2020-07-04 10:36:22
*/
import 'package:flutter_common/commonModel/live/BaseModel.dart';
import 'package:flutter_common/commonModel/live/LiveData.dart';
......@@ -12,3 +12,37 @@ 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';
import 'package:gm_flutter/ClueModel/server/entity/DiscussLowPriceModelBean.dart';
class DiscussLowPriceModel extends BaseModel {
LiveData<Pair<int, DiscussLowPriceModelBean>> popViewLive = LiveData();
RxDispose rxDispose = RxDispose();
fetchPopviewData(String plan_id, String hospital_id, String doctor_id) {
ClueApiImpl.getInstance()
.getPopviewData(
DioUtil.getInstance().getDio(), plan_id, hospital_id, doctor_id)
.listen((event) {
if (event.error == 0) {
if (event.data == null) {
popViewLive.notifyView(Pair(ENDLOADING, null));
} else {
popViewLive.notifyView(Pair(ENDLOADING, event.data));
}
} else {
NativeToast.showNativeToast(event.message);
popViewLive.notifyView(Pair(FAIL, null));
}
})
.addToDispose(rxDispose)
.onError((err) {
popViewLive.notifyView(Pair(FAIL, null));
NativeToast.showNativeToast(err.message);
});
}
@override
void dispose() {
popViewLive.dispost();
}
}
......@@ -2,12 +2,13 @@
* @Author: zx
* @Date: 2020-07-03 13:53:16
* @Last Modified by: zx
* @Last Modified time: 2020-07-04 09:30:57
* @Last Modified time: 2020-07-04 11:31:00
*/
import 'package:flutter/material.dart';
import 'package:flutter_common/commonModel/picker/base/BaseCenterPicker.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/ClueModel/page/DiscussLowPrice/DiscussLowPriceModel.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
class DiscussLowPricePopView {
static void showPopView(BuildContext content) {
......@@ -20,55 +21,69 @@ class DiscussLowPricePopView {
class _PopView implements ICenterPicker {
VoidCallback dismissCallback;
double contentWidth;
DiscussLowPriceModel _model = new DiscussLowPriceModel();
@override
Widget build(BuildContext context, int alp) {
contentWidth = MediaQuery.of(context).size.width - 72;
return Container(
width: contentWidth,
alignment: AlignmentDirectional.center,
child: Container(
child: Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
child: Stack(
alignment: AlignmentDirectional.topCenter,
children: <Widget>[
Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
return StreamBuilder(
stream: _model.popViewLive.stream,
initialData: _model.popViewLive ?? Pair(LOADING, null),
builder: (c, data) {
if (data.data.second == null || data.data.first == FAIL) {
return Container(
height: 0,
width: 0,
);
}
return Container(
width: contentWidth,
alignment: AlignmentDirectional.center,
child: Container(
child: Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
child: Stack(
alignment: AlignmentDirectional.topCenter,
children: <Widget>[
Container(
height: 42.5,
width: contentWidth,
),
Container(
margin: EdgeInsets.only(bottom: 0),
child: Stack(children: <Widget>[
Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
child: setupBodyView(),
height: 42.5,
width: contentWidth,
),
Positioned(
top: 20,
right: 20,
width: 16,
height: 16,
child: GestureDetector(
onTap: () {},
child: Image.asset(
'assets/discuss_loe_price_cancel.png',
fit: BoxFit.cover),
))
]))
Container(
margin: EdgeInsets.only(bottom: 0),
child: Stack(children: <Widget>[
Container(
child: setupBodyView(),
),
Positioned(
top: 20,
right: 20,
width: 16,
height: 16,
child: GestureDetector(
onTap: () {
dismissCallback();
},
child: Image.asset(
'assets/discuss_loe_price_cancel.png',
fit: BoxFit.cover),
))
]))
]),
Container(
margin: EdgeInsets.only(top: 0),
width: 85,
height: 85,
child: Image.network(
_model.popViewLive.data.second.icon,
fit: BoxFit.cover),
)
]),
Container(
margin: EdgeInsets.only(top: 0),
width: 85,
height: 85,
child: Image.asset('assets/discuss_loe_price_like.png',
fit: BoxFit.cover),
)
]),
)));
)));
});
}
setupBodyView() {
......@@ -105,7 +120,8 @@ class _PopView implements ICenterPicker {
)),
Container(
margin: EdgeInsets.only(left: 4),
child: baseText('对当前商品感兴趣?', 14, Color(0xff848484)),
child: baseText(_model.popViewLive.data.second.tip, 14,
Color(0xff848484)),
)
]),
),
......@@ -113,7 +129,8 @@ class _PopView implements ICenterPicker {
alignment: AlignmentDirectional.center,
width: contentWidth - 70,
margin: EdgeInsets.only(bottom: 25),
child: baseText('机构可免费为您提供咨询服务', 18, Color(0xff464646),
child: baseText(
_model.popViewLive.data.second.title, 18, Color(0xff464646),
bold: true)),
Container(
decoration: BoxDecoration(
......@@ -124,7 +141,8 @@ class _PopView implements ICenterPicker {
margin: EdgeInsets.only(bottom: 12),
width: contentWidth - 70,
height: 37,
child: baseText('13800138000', 16, Color(0xff484848))),
child: baseText(_model.popViewLive.data.second.authorizePhone,
16, Color(0xff484848))),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7),
......@@ -155,5 +173,6 @@ class _PopView implements ICenterPicker {
@override
void initState(VoidCallback dismissCall, BuildContext context) {
this.dismissCallback = dismissCall;
_model.fetchPopviewData('1', '2', '3');
}
}
......@@ -53,5 +53,6 @@ class PlanCompareDetailModel extends BaseModel {
void dispose() {
stateLive.dispost();
detailLive.dispost();
headerLive.dispost();
}
}
......@@ -47,13 +47,7 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
Navigator.pop(context);
}),
body: Container(
child:
// head(),
// planPopularityView()
// planNormalEffectiveAttrsView()
// setupHome([], []),
reloadPage(),
child: reloadPage(),
));
}
......
......@@ -47,7 +47,7 @@ abstract class ClueApi {
@Get("api/janus/plans/rank")
PlanBarBean getPlanBar(@Query("rank_type") String rank_type);
@Get("api/janus/plans/compare")
@Get("api/janus/plans/plan_phone_authorize")
DiscussLowPriceModelBean getPopviewData(
@Query("plan_id") String plan_id,
@Query("hospital_id") String hospital_id,
......
......@@ -156,7 +156,8 @@ 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: {
return Stream.fromFuture(
get(_dio, 'api/janus/plans/plan_phone_authorize', data: {
'plan_id': plan_id,
'hospital_id': hospital_id,
'doctor_id': doctor_id,
......
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