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

1、获取积分 传优惠前id

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