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

商议低价接口调试“

parent 2dde0e2f
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: zx * @Author: zx
* @Date: 2020-07-03 20:54:59 * @Date: 2020-07-03 20:54:59
* @Last Modified by: zx * @Last Modified by: zx
* @Last Modified time: 2020-07-03 20:54:59 * @Last Modified time: 2020-07-04 10:36:22
*/ */
import 'package:flutter_common/commonModel/live/BaseModel.dart'; import 'package:flutter_common/commonModel/live/BaseModel.dart';
import 'package:flutter_common/commonModel/live/LiveData.dart'; import 'package:flutter_common/commonModel/live/LiveData.dart';
...@@ -12,3 +12,37 @@ import 'package:gm_flutter/commonModel/GMBase.dart'; ...@@ -12,3 +12,37 @@ import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:gm_flutter/commonModel/rx/RxDispose.dart'; import 'package:gm_flutter/commonModel/rx/RxDispose.dart';
import 'package:flutter_common/commonModel/toast/NativeToast.dart'; import 'package:flutter_common/commonModel/toast/NativeToast.dart';
import 'package:gm_flutter/commonModel/bean/Pair.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 @@ ...@@ -2,12 +2,13 @@
* @Author: zx * @Author: zx
* @Date: 2020-07-03 13:53:16 * @Date: 2020-07-03 13:53:16
* @Last Modified by: zx * @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/material.dart';
import 'package:flutter_common/commonModel/picker/base/BaseCenterPicker.dart'; import 'package:flutter_common/commonModel/picker/base/BaseCenterPicker.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart'; import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/ClueModel/page/DiscussLowPrice/DiscussLowPriceModel.dart'; import 'package:gm_flutter/ClueModel/page/DiscussLowPrice/DiscussLowPriceModel.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
class DiscussLowPricePopView { class DiscussLowPricePopView {
static void showPopView(BuildContext content) { static void showPopView(BuildContext content) {
...@@ -20,10 +21,20 @@ class DiscussLowPricePopView { ...@@ -20,10 +21,20 @@ class DiscussLowPricePopView {
class _PopView implements ICenterPicker { class _PopView implements ICenterPicker {
VoidCallback dismissCallback; VoidCallback dismissCallback;
double contentWidth; double contentWidth;
DiscussLowPriceModel _model = new DiscussLowPriceModel();
@override @override
Widget build(BuildContext context, int alp) { Widget build(BuildContext context, int alp) {
contentWidth = MediaQuery.of(context).size.width - 72; contentWidth = MediaQuery.of(context).size.width - 72;
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( return Container(
width: contentWidth, width: contentWidth,
alignment: AlignmentDirectional.center, alignment: AlignmentDirectional.center,
...@@ -53,7 +64,9 @@ class _PopView implements ICenterPicker { ...@@ -53,7 +64,9 @@ class _PopView implements ICenterPicker {
width: 16, width: 16,
height: 16, height: 16,
child: GestureDetector( child: GestureDetector(
onTap: () {}, onTap: () {
dismissCallback();
},
child: Image.asset( child: Image.asset(
'assets/discuss_loe_price_cancel.png', 'assets/discuss_loe_price_cancel.png',
fit: BoxFit.cover), fit: BoxFit.cover),
...@@ -64,11 +77,13 @@ class _PopView implements ICenterPicker { ...@@ -64,11 +77,13 @@ class _PopView implements ICenterPicker {
margin: EdgeInsets.only(top: 0), margin: EdgeInsets.only(top: 0),
width: 85, width: 85,
height: 85, height: 85,
child: Image.asset('assets/discuss_loe_price_like.png', child: Image.network(
_model.popViewLive.data.second.icon,
fit: BoxFit.cover), fit: BoxFit.cover),
) )
]), ]),
))); )));
});
} }
setupBodyView() { setupBodyView() {
...@@ -105,7 +120,8 @@ class _PopView implements ICenterPicker { ...@@ -105,7 +120,8 @@ class _PopView implements ICenterPicker {
)), )),
Container( Container(
margin: EdgeInsets.only(left: 4), 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 { ...@@ -113,7 +129,8 @@ class _PopView implements ICenterPicker {
alignment: AlignmentDirectional.center, alignment: AlignmentDirectional.center,
width: contentWidth - 70, width: contentWidth - 70,
margin: EdgeInsets.only(bottom: 25), margin: EdgeInsets.only(bottom: 25),
child: baseText('机构可免费为您提供咨询服务', 18, Color(0xff464646), child: baseText(
_model.popViewLive.data.second.title, 18, Color(0xff464646),
bold: true)), bold: true)),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
...@@ -124,7 +141,8 @@ class _PopView implements ICenterPicker { ...@@ -124,7 +141,8 @@ class _PopView implements ICenterPicker {
margin: EdgeInsets.only(bottom: 12), margin: EdgeInsets.only(bottom: 12),
width: contentWidth - 70, width: contentWidth - 70,
height: 37, height: 37,
child: baseText('13800138000', 16, Color(0xff484848))), child: baseText(_model.popViewLive.data.second.authorizePhone,
16, Color(0xff484848))),
Container( Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(7), borderRadius: BorderRadius.circular(7),
...@@ -155,5 +173,6 @@ class _PopView implements ICenterPicker { ...@@ -155,5 +173,6 @@ class _PopView implements ICenterPicker {
@override @override
void initState(VoidCallback dismissCall, BuildContext context) { void initState(VoidCallback dismissCall, BuildContext context) {
this.dismissCallback = dismissCall; this.dismissCallback = dismissCall;
_model.fetchPopviewData('1', '2', '3');
} }
} }
...@@ -53,5 +53,6 @@ class PlanCompareDetailModel extends BaseModel { ...@@ -53,5 +53,6 @@ class PlanCompareDetailModel extends BaseModel {
void dispose() { void dispose() {
stateLive.dispost(); stateLive.dispost();
detailLive.dispost(); detailLive.dispost();
headerLive.dispost();
} }
} }
...@@ -47,13 +47,7 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> { ...@@ -47,13 +47,7 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
Navigator.pop(context); Navigator.pop(context);
}), }),
body: Container( body: Container(
child: child: reloadPage(),
// head(),
// planPopularityView()
// planNormalEffectiveAttrsView()
// setupHome([], []),
reloadPage(),
)); ));
} }
......
...@@ -47,7 +47,7 @@ abstract class ClueApi { ...@@ -47,7 +47,7 @@ abstract class ClueApi {
@Get("api/janus/plans/rank") @Get("api/janus/plans/rank")
PlanBarBean getPlanBar(@Query("rank_type") String rank_type); PlanBarBean getPlanBar(@Query("rank_type") String rank_type);
@Get("api/janus/plans/compare") @Get("api/janus/plans/plan_phone_authorize")
DiscussLowPriceModelBean getPopviewData( DiscussLowPriceModelBean getPopviewData(
@Query("plan_id") String plan_id, @Query("plan_id") String plan_id,
@Query("hospital_id") String hospital_id, @Query("hospital_id") String hospital_id,
......
...@@ -156,7 +156,8 @@ class ClueApiImpl { ...@@ -156,7 +156,8 @@ class ClueApiImpl {
Stream<DiscussLowPriceModelBean> getPopviewData( Stream<DiscussLowPriceModelBean> getPopviewData(
Dio _dio, String plan_id, String hospital_id, String doctor_id) { 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, 'plan_id': plan_id,
'hospital_id': hospital_id, 'hospital_id': hospital_id,
'doctor_id': doctor_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