提交 dcb636c6 authored 作者: yueweilu's avatar yueweilu

1、获取积分 传优惠前id

上级 4898a2c6
...@@ -58,11 +58,13 @@ abstract class ShopAPI { ...@@ -58,11 +58,13 @@ abstract class ShopAPI {
/// ///
static Future <CreditPointModel> creditPoints({ static Future <CreditPointModel> creditPoints({
required String price, required String price,
required String couponRecId,
}) async { }) async {
final result = await HttpService.to.post( final result = await HttpService.to.post(
'/v1/coupon/Coupon/getIntegral', '/v1/coupon/Coupon/getIntegral',
params: { params: {
'price': price, 'price': price,
'coupon_rec_id': couponRecId
}, },
); );
if (result.data is! Map ) return CreditPointModel(); if (result.data is! Map ) return CreditPointModel();
......
...@@ -44,7 +44,7 @@ class BookPayController extends GetxController { ...@@ -44,7 +44,7 @@ class BookPayController extends GetxController {
@override @override
void onReady() { void onReady() {
_getCreditPoints(price: originalPrice.toString()); _getCreditPoints(price: originalPrice.toString(),couponRecId: useCouponModel.couponRecId.toString());
_getShow(); _getShow();
computeFinalPrice(); computeFinalPrice();
_getCouponNumber(); _getCouponNumber();
...@@ -56,6 +56,8 @@ class BookPayController extends GetxController { ...@@ -56,6 +56,8 @@ class BookPayController extends GetxController {
useCouponModel = model; useCouponModel = model;
print('使用优惠券。。。。。。。。。。。。。。。。${model.couponRecId}'); print('使用优惠券。。。。。。。。。。。。。。。。${model.couponRecId}');
computeFinalPrice(); computeFinalPrice();
// 使用优惠券后重新获取积分
_getCreditPoints(price: finalPrice.toString(), couponRecId: useCouponModel.couponRecId.toString());
} }
/// 支付方式 默认第一个 /// 支付方式 默认第一个
...@@ -96,9 +98,10 @@ class BookPayController extends GetxController { ...@@ -96,9 +98,10 @@ class BookPayController extends GetxController {
/// 获取积分 /// 获取积分
void _getCreditPoints({ void _getCreditPoints({
required String price required String price,
required String couponRecId
}) async { }) async {
creditPointModel = await ShopAPI.creditPoints(price: price); creditPointModel = await ShopAPI.creditPoints(price: price,couponRecId: useCouponModel.couponRecId.toString());
update(); update();
} }
/// 是否展示优惠券 和积分使用 模型 /// 是否展示优惠券 和积分使用 模型
......
part of credit_points; // part of credit_points;
//
class CreditPointController extends GetxController { // class CreditPointController extends GetxController {
final String price; // final String price;
CreditPointController(this.price); // CreditPointController(this.price);
CreditPointModel creditPointModel = CreditPointModel(); // CreditPointModel creditPointModel = CreditPointModel();
//
bool use = false; // bool use = false;
//
//
//
//
//
@override // @override
void onReady() { // void onReady() {
_getCreditPoints(price: price); // _getCreditPoints(price: price);
super.onReady(); // super.onReady();
} // }
//
void setUse(){ // void setUse(){
use = !use; // use = !use;
update(); // update();
} // }
//
//
void _getCreditPoints({ // void _getCreditPoints({
required String price // required String price
}) async { // }) async {
creditPointModel = await ShopAPI.creditPoints(price: price); // creditPointModel = await ShopAPI.creditPoints(price: price);
update(); // update();
} // }
//
} // }
//
//
//
...@@ -14,4 +14,4 @@ import '../../models/index.dart'; ...@@ -14,4 +14,4 @@ import '../../models/index.dart';
import '../book_pay/index.dart'; import '../book_pay/index.dart';
part 'view.dart'; part 'view.dart';
part 'controller.dart'; // part 'controller.dart';
\ No newline at end of file \ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论