Commit 7de21c524d9fd76bc4e7ea178bddb7af6bcad1e4

Authored by wdn127929
1 parent a0fd2265

核销记录

import 'dart:convert';
import 'package:common_utils/common_utils.dart';
import 'package:one_key/models/coupon_model.dart';
class IsExamineModel {
int ret;
List<IsExamineSunModel> data;
String msg;
IsExamineModel({this.ret, this.data, this.msg});
IsExamineModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
if (json['data'] != null) {
data = [];
json['data'].forEach((v) {
data.add(new IsExamineSunModel.fromJson(v));
});
}
msg = json['msg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ret'] = this.ret;
if (this.data != null) {
data['data'] = this.data.map((v) => v.toJson()).toList();
}
data['msg'] = this.msg;
return data;
}
}
class IsExamineSunModel {
String id;
String status;
String rechargeId;
String rechargeName;
String price;
String sellerid;
String sellername;
String openid;
String orderNo;
String combineOutTradeNo;
String outTradeNo;
dynamic outRefundNo;
ExpDate expDate;
String stime;
String etime;
String transactionId;
dynamic refundId;
dynamic reOutTradeNo;
String tradeState;
dynamic tradeStateDesc;
String qrcode;
String isExamine;
dynamic examineName;
dynamic examineTime;
String isComment;
String type;
String cdate;
String desc;
String explain;
String get examineTimeStr {
if (examineTime == null) {
return '';
}
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
int.parse(examineTime.toString()) * 1000);
return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
}
IsExamineSunModel(
{this.id,
this.status,
this.rechargeId,
this.rechargeName,
this.price,
this.sellerid,
this.sellername,
this.openid,
this.orderNo,
this.combineOutTradeNo,
this.outTradeNo,
this.outRefundNo,
this.expDate,
this.stime,
this.etime,
this.transactionId,
this.refundId,
this.reOutTradeNo,
this.tradeState,
this.tradeStateDesc,
this.qrcode,
this.isExamine,
this.examineName,
this.examineTime,
this.isComment,
this.type,
this.cdate,
this.desc,
this.explain});
IsExamineSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
status = json['status'];
rechargeId = json['recharge_id'];
rechargeName = json['recharge_name'];
price = json['price'];
sellerid = json['sellerid'];
sellername = json['sellername'];
openid = json['openid'];
orderNo = json['order_no'];
combineOutTradeNo = json['combine_out_trade_no'];
outTradeNo = json['out_trade_no'];
outRefundNo = json['out_refund_no'];
expDate = json['exp_date'] == null
? null
: (json['exp_date'] is String)
? ExpDate.fromJson(jsonDecode(json['exp_date']))
: (json['exp_date'] is Map)
? ExpDate.fromJson(json['exp_date'])
: null;
stime = json['stime'];
etime = json['etime'];
transactionId = json['transaction_id'];
refundId = json['refund_id'];
reOutTradeNo = json['re_out_trade_no'];
tradeState = json['trade_state'];
tradeStateDesc = json['trade_state_desc'];
qrcode = json['qrcode'];
isExamine = json['is_examine'];
examineName = json['examine_name'];
examineTime = json['examine_time'];
isComment = json['is_comment'];
type = json['type'];
cdate = json['cdate'];
desc = json['desc'];
explain = json['explain'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['status'] = this.status;
data['recharge_id'] = this.rechargeId;
data['recharge_name'] = this.rechargeName;
data['price'] = this.price;
data['sellerid'] = this.sellerid;
data['sellername'] = this.sellername;
data['openid'] = this.openid;
data['order_no'] = this.orderNo;
data['combine_out_trade_no'] = this.combineOutTradeNo;
data['out_trade_no'] = this.outTradeNo;
data['out_refund_no'] = this.outRefundNo;
data['exp_date'] = this.expDate;
data['stime'] = this.stime;
data['etime'] = this.etime;
data['transaction_id'] = this.transactionId;
data['refund_id'] = this.refundId;
data['re_out_trade_no'] = this.reOutTradeNo;
data['trade_state'] = this.tradeState;
data['trade_state_desc'] = this.tradeStateDesc;
data['qrcode'] = this.qrcode;
data['is_examine'] = this.isExamine;
data['examine_name'] = this.examineName;
data['examine_time'] = this.examineTime;
data['is_comment'] = this.isComment;
data['type'] = this.type;
data['cdate'] = this.cdate;
data['desc'] = this.desc;
data['explain'] = this.explain;
return data;
}
}
... ...
... ... @@ -91,6 +91,10 @@ class CouponSunModel extends Object {
@JsonKey(name: 'nick_name')
String nickNameShow;
@JsonKey(name: 'grant_num')
String grantNum;
bool isCheck = false;
bool showText = false;
... ... @@ -115,7 +119,7 @@ class CouponSunModel extends Object {
this.price,
this.use,
this.expDate,
this.nickNameShow);
this.nickNameShow,this.grantNum);
factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$CouponSunModelFromJson(srcJson);
... ...
... ... @@ -59,6 +59,7 @@ CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) {
? ExpDate.fromJson(json['exp_date'])
: null,
json['nick_name'] as String,
json['grant_num'] as String,
);
}
... ... @@ -84,7 +85,8 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) =>
'price': instance.price,
'use': instance.use,
'exp_date': instance.expDate,
'nick_name':instance.nickNameShow
'nick_name': instance.nickNameShow,
'grant_num': instance.grantNum
};
CouponUse _$CouponUseFromJson(Map<String, dynamic> json) {
... ...
... ... @@ -433,4 +433,7 @@ class HttpUrl {
static const String get_dz_seller_conf =
"?service=App.Seller.GetDzSellerConf"; // 获取商家订座配置
static const String get_is_examine_list =
"?service=App.Activity.GetIsExamineList"; // 商家券核销列表
}
... ...
... ... @@ -227,7 +227,10 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
couponProvider.couponSunModel.status == '1') {
//店铺可核销券
Utils.goShareBuyCouponToWeChat(
context, widget.idstr, couponProvider.couponSunModel.use,couponProvider.couponSunModel);
context,
widget.idstr,
couponProvider.couponSunModel.use,
couponProvider.couponSunModel);
}
},
),
... ... @@ -431,6 +434,15 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
'谁可以发放',
couponProvider
.couponSunModel.nickNameShow),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'发放总量限制',
couponProvider
.couponSunModel.grantNum??''),
// _select(
// '谁可以发放',
// '查看',
... ...
... ... @@ -39,6 +39,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
TextEditingController _couponNameEditControl = TextEditingController();
TextEditingController _couponRequireEditControl = TextEditingController();
TextEditingController _couponExplainEditControl = TextEditingController();
TextEditingController _limitNumControl = TextEditingController();
FocusNode _limitNumFocusNode = FocusNode();
final heightCell = ScreenUtil().setWidth(48 * 2);
bool swichState = true; //默认启用 开关状态
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
... ... @@ -239,6 +241,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
'week_data': weekData
};
params['exp_date'] = jsonEncode(expDate);
if (_limitNumControl.text.trim().length == 0) {
params['grant_num'] = '1000';
} else {
params['grant_num'] = _limitNumControl.text;
}
}
bool isSuccess =
await couponProvider.createCustomerActivity(context, params);
... ... @@ -271,8 +279,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
),
),
HEmptyView(80),
Container(
width: ScreenUtil().setWidth(231 * 2),
Expanded(
// width: ScreenUtil().setWidth(231 * 2),
child: TextField(
controller: controller,
textAlign: TextAlign.right,
... ... @@ -999,6 +1007,18 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
widget.isMine
? SizedBox()
: _textfield('发放总量限制', '点击输入总数量限制',
_limitNumControl, _limitNumFocusNode,
textInputType: TextInputType.number),
widget.isMine
? SizedBox()
: Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
_explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'),
VEmptyView(20),
_canUse('立即启用', swichState, () {
... ... @@ -1039,6 +1059,14 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
Utils.showToast('请设置发放人!');
return;
}
bool isNumber = Utils.isInteger(
_limitNumControl.text.trim()); //判断输入的内容是否是数字
if (!isNumber) {
Utils.showToast('发放总量限制请输入数字');
_limitNumControl.text = '';
return;
}
}
if (_couponRequireEditControl.text.trim().length == 0) {
Utils.showToast('请填写券要求');
... ...
... ... @@ -30,8 +30,6 @@ class CouponHasVerificationPage extends StatefulWidget {
class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
CouponProvider couponProvider;
EasyRefreshController _controller = EasyRefreshController();
PersonnelProvider personnelProvider;
List<PersonnelManageSunModel> authUserLists = [];
@override
void initState() {
... ... @@ -39,12 +37,12 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
couponProvider.pageStateVerification = PageState.Success;
couponProvider.pageStateVerification = PageState.Loading;
couponProvider.notifyListeners();
// _couponNetworkData(widget.index, isShowLoading: false);
_getIsExamineList();
bus.on("refresh_coupon_verification_list", (arg) {
// _couponNetworkData(widget.index);
_getIsExamineList();
});
});
}
... ... @@ -56,40 +54,19 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
}
///获取优惠券列表数据
_couponNetworkData(int index, {bool isShowLoading = true}) async {
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
// 'is_time': '0'
"is_type": index.toString()
};
await couponProvider.getCustomerActivity(context, params, index,
isShowLoading: isShowLoading);
}
///修改活动信息
_setCustomerActivity(int index) async {
_getIsExamineList() async {
Map<String, String> params = {
"id": couponProvider.couponList[index].id,
"status": couponProvider.couponList[index].isOpenBool ? '1' : '0',
'is_open': couponProvider.couponList[index].isOpenBool ? '1' : '0',
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid
};
bool isSuccess = await couponProvider.setCustomerActivity(context, params,
await couponProvider.getIsExamineList(context, params,
isShowLoading: false);
print(isSuccess);
// _couponNetworkData(widget.index, isShowLoading: false);
// if (isSuccess) {
// couponProvider.notifyListeners();
// } else {
// couponProvider.couponList[index].isOpenBool =
// !couponProvider.couponList[index].isOpenBool;
// couponProvider.notifyListeners();
// }
}
@override
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
personnelProvider = Provider.of<PersonnelProvider>(context, listen: true);
return Container(
color: MyColours.color_f3f3f3,
... ... @@ -107,7 +84,7 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
// // _couponNetworkData(widget.index);
// }
},
emptyMsg: "暂时没有列表信息哦,",
emptyMsg: "暂时没有列表信息哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
... ... @@ -121,7 +98,7 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
(BuildContext context, int index) {
return CouponVerificationItemF(
// from: 'quan',
// couponSonModel: couponProvider.couponList[index],
isExamineSunModel: couponProvider.isExamineList[index],
// showBtn: true,
// onPressedSwich: () {
// couponProvider.couponList[index].isOpenBool =
... ... @@ -129,12 +106,13 @@ class _CouponHasVerificationPageState extends State<CouponHasVerificationPage> {
// _setCustomerActivity(index);
// },
onPressed: () {
NavigatorUtil.goCouponVerificationDetailPage(
context, couponProvider.couponList[index],
idStr: couponProvider.couponList[index].id);
NavigatorUtil.goCouponVerificationDetailPage(context,
couponProvider.isExamineList[index],
idStr:
couponProvider.isExamineList[index].rechargeId);
},
);
}, childCount: couponProvider.couponList.length),
}, childCount: couponProvider.isExamineList.length),
),
// SliverList(
// delegate: SliverChildBuilderDelegate(
... ...
... ... @@ -204,9 +204,9 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
Tab(
text: "我的优惠券",
),
// Tab(
// text: "核销记录",
// )
Tab(
text: "核销记录",
)
],
indicatorColor: MyColours.color_438E93,
indicatorSize: TabBarIndicatorSize.label,
... ... @@ -236,9 +236,9 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
ChangeNotifierProvider<PersonnelProvider>(
create: (_) => PersonnelProvider(),
child: CouponSunPage(index: 2)),
// ChangeNotifierProvider<PersonnelProvider>(
// create: (_) => PersonnelProvider(),
// child: CouponHasVerificationPage()),
ChangeNotifierProvider<PersonnelProvider>(
create: (_) => PersonnelProvider(),
child: CouponHasVerificationPage()),
],
),
),
... ...
... ... @@ -18,6 +18,7 @@ import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../models/IsExamineModel.dart';
import '../../utils/screen_util.dart';
import '../../widgets/page_exception.dart';
... ... @@ -26,10 +27,12 @@ import '../../widgets/page_exception.dart';
*/
class CouponVerificationDetailPage extends StatefulWidget {
final CouponSunModel couponSunModel;
final String idstr;
CouponVerificationDetailPage({Key key, this.couponSunModel, this.idstr})
: super(key: key);
final IsExamineSunModel isExamineSunModel;
CouponVerificationDetailPage({
Key key,
this.isExamineSunModel,
}) : super(key: key);
@override
_CouponVerificationDetailPageState createState() =>
... ... @@ -49,27 +52,15 @@ class _CouponVerificationDetailPageState
WidgetsBinding.instance.addPostFrameCallback((_) {
// if (widget.idstr != null && widget.idstr != 'null') {
_getActivityById();
// _getActivityById();
// } else {
// couponProvider.couponSunModel = widget.couponSunModel;
// pageState = PageState.Success;
// setState(() {});
// ;
// pageState = PageState.Success;
// setState(() {});
// }
});
}
_getActivityById() async {
pageState = PageState.Loading;
bool success = await couponProvider
.getActivityById(context, {'id': widget.idstr}, isShowLoading: false);
if (success) {
pageState = PageState.Success;
} else {
pageState = PageState.ConnectivityError;
}
setState(() {});
}
///时间选择
Widget _select(String title, String hintText, GestureTapCallback onTap) {
return InkWell(
... ... @@ -216,277 +207,215 @@ class _CouponVerificationDetailPageState
onTap: () {
Navigator.pop(context);
},
rightImgName: couponProvider.couponSunModel.isType == '1' &&
couponProvider.couponSunModel.isExamine == '1' &&
couponProvider.couponSunModel.status == '1'
? 'share.png'
: null,
onTapRight: () {
if (couponProvider.couponSunModel.isType == '1' &&
couponProvider.couponSunModel.isExamine == '1' &&
couponProvider.couponSunModel.status == '1') {
//店铺可核销券
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
couponProvider.couponSunModel.use,
couponProvider.couponSunModel);
}
},
),
body: Consumer<CouponProvider>(builder: (context, model, _) {
if (pageState != PageState.Success) {
return ExceptionPage(
pageState: pageState,
callback: () {
_getActivityById();
},
emptyMsg: "暂时没有数据哦,",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Column(children: [
Expanded(
child: SingleChildScrollView(
controller: controller,
physics: BouncingScrollPhysics(),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32)),
child: Column(
children: [
VEmptyView(56),
_item(
'券类型',
couponProvider.couponSunModel.isType == '1'
? '店铺优惠券'
: '我的优惠券'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('券编码', 'NO.01774420230223150306'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('券名称', couponProvider.couponSunModel.aname),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
body:
// Consumer<CouponProvider>(builder: (context, model, _) {
// if (pageState != PageState.Success) {
// return ExceptionPage(
// pageState: pageState,
// callback: () {
// // _getActivityById();
// },
// emptyMsg: "暂时没有数据哦,",
// emptyImg: "empty_search",
// showMsg: "加载中,请稍后...",
// );
// } else {
// return
Column(children: [
Expanded(
child: SingleChildScrollView(
controller: controller,
physics: BouncingScrollPhysics(),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32)),
child: Column(
children: [
VEmptyView(56),
_item(
'券类型',
widget.isExamineSunModel.type == '1'
? '店铺优惠券'
: '我的优惠券'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('券编码', widget.isExamineSunModel.orderNo ?? ''),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'券名称', widget.isExamineSunModel.rechargeName ?? ""),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (couponProvider.couponSunModel.use != null)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// _item(
// '券用途',
// couponProvider.couponSunModel.use.isCash
// ? '代金券'
// : couponProvider
// .couponSunModel.use.isDiscount
// ? '折扣券'
// : couponProvider
// .couponSunModel.use.isDish
// ? '菜品券'
// : ''),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
// _item(
// couponProvider.couponSunModel.use.isCash
// ? '金额'
// : couponProvider
// .couponSunModel.use.isDiscount
// ? '折扣率'
// : couponProvider
// .couponSunModel.use.isDish
// ? '菜品'
// : '',
// couponProvider.couponSunModel.use.isCash
// ? '${couponProvider.couponSunModel.use.cash}元'
// : couponProvider
// .couponSunModel.use.isDiscount
// ? '${couponProvider.couponSunModel.use.discount}折'
// : couponProvider
// .couponSunModel.use.isDish
// ? couponProvider
// .couponSunModel.use.dish
// : ''),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
_item(
'销售价',
'${couponProvider.couponSunModel.price}元' ??
''),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
VEmptyView(24),
_item(
'销售价', '${widget.isExamineSunModel.price ?? ''}元'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('券要求', widget.isExamineSunModel.desc ?? ''),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'有效期从',
Utils.getDateStrFromJiekou(
widget.isExamineSunModel.stime)),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'有效期至',
Utils.getDateStrFromJiekou(
widget.isExamineSunModel.etime)),
Column(children: [
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'使用限制',
widget.isExamineSunModel.expDate.isNone
? '无'
: widget.isExamineSunModel.expDate.isBirthday
? '会员生日当天'
: widget.isExamineSunModel.expDate.isWeek
? '每周指定日期餐段可用'
: ''),
if (widget.isExamineSunModel.expDate.isWeek)
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(left: w(16)),
child: Text(
widget.isExamineSunModel.expDate.weekShow,
textAlign: TextAlign.left,
style: TextStyle(
height: 1.5,
fontSize: font(16),
color: MyColours.color_999999),
),
VEmptyView(24),
],
),
_item('券要求', couponProvider.couponSunModel.desc),
)),
if (widget.isExamineSunModel.expDate.isWeek)
VEmptyView(24),
]),
// widget.isExamineSunModel.isType == '1'
// ? Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
// _item('创建人',
// widget.isExamineSunModel.uid),
// ],
// )
// : SizedBox(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'有效期从',
Utils.getDateStrFromJiekou(
couponProvider.couponSunModel.stime)),
_item('核销日期',
widget.isExamineSunModel.examineTimeStr),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'有效期至',
Utils.getDateStrFromJiekou(
couponProvider.couponSunModel.etime)),
Column(children: [
Container(
_item('核销人',
widget.isExamineSunModel.examineName ?? ''),
// _select(
// '谁可以发放',
// '查看',
// () async {
// await NavigatorUtil
// .goCouponToPersonnalPage(
// context,
// couponProvider
// .couponSunModel.uidList,
// onlyShow: true);
// },
// )
],
),
widget.isExamineSunModel.explain != null &&
widget.isExamineSunModel.explain != ''
? Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item(
'使用限制',
couponProvider.couponSunModel.expDate.isNone
? '无'
: couponProvider
.couponSunModel.expDate.isBirthday
? '会员生日当天'
: couponProvider
.couponSunModel.expDate.isWeek
? '每周指定日期餐段可用'
: ''),
if (couponProvider.couponSunModel.expDate.isWeek)
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: EdgeInsets.only(left: w(16)),
child: Text(
couponProvider
.couponSunModel.expDate.weekShow,
textAlign: TextAlign.left,
style: TextStyle(
height: 1.5,
fontSize: font(16),
color: MyColours.color_999999),
),
)),
if (couponProvider.couponSunModel.expDate.isWeek)
VEmptyView(24),
]),
// couponProvider.couponSunModel.isType == '1'
// ? Column(
// crossAxisAlignment:
// CrossAxisAlignment.start,
// children: [
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
// _item('创建人',
// couponProvider.couponSunModel.uid),
// ],
// )
// : SizedBox(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('核销日期', '2023-05-05'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('核销人', '核销人'),
// _select(
// '谁可以发放',
// '查看',
// () async {
// await NavigatorUtil
// .goCouponToPersonnalPage(
// context,
// couponProvider
// .couponSunModel.uidList,
// onlyShow: true);
// },
// )
],
)
: SizedBox(),
widget.isExamineSunModel.explain != null &&
widget.isExamineSunModel.explain != ''
? VEmptyView(24)
: SizedBox(),
widget.isExamineSunModel.explain != null &&
widget.isExamineSunModel.explain != ''
? _item('券说明', '')
: SizedBox(),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (widget.isExamineSunModel.explain != null &&
widget.isExamineSunModel.explain != '')
Align(
alignment: Alignment.centerLeft,
child: Text(
widget.isExamineSunModel.explain,
textAlign: TextAlign.left,
style: TextStyle(
// height: 1.5,
fontSize: font(16),
color: MyColours.color_999999),
),
couponProvider.couponSunModel.explain != null &&
couponProvider.couponSunModel.explain != ''
? Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
)
: SizedBox(),
couponProvider.couponSunModel.explain != null &&
couponProvider.couponSunModel.explain != ''
? VEmptyView(24)
: SizedBox(),
couponProvider.couponSunModel.explain != null &&
couponProvider.couponSunModel.explain != ''
? _item('券说明', '')
: SizedBox(),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (couponProvider.couponSunModel.explain != null &&
couponProvider.couponSunModel.explain != '')
Align(
alignment: Alignment.centerLeft,
child: Text(
couponProvider.couponSunModel.explain,
textAlign: TextAlign.left,
style: TextStyle(
// height: 1.5,
fontSize: font(16),
color: MyColours.color_999999),
),
),
if (couponProvider.couponSunModel.explain != null &&
couponProvider.couponSunModel.explain != '')
VEmptyView(24),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
VEmptyView(24),
_canUse(
'立即启用',
couponProvider.couponSunModel.status == '1'
? true
: false)
],
))),
)
]);
}
}));
),
if (widget.isExamineSunModel.explain != null &&
widget.isExamineSunModel.explain != '')
VEmptyView(24),
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
// _canUse(
// '立即启用',
// widget.isExamineSunModel.status == '1'
// ? true
// : false)
],
))),
)
])
// ;
// }
// })
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:one_key/models/IsExamineModel.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/v_empty_view.dart';
... ... @@ -7,7 +8,9 @@ import '../../utils/screen_util.dart';
class CouponVerificationItemF extends StatefulWidget {
final VoidCallback onPressed;
CouponVerificationItemF({Key key, this.onPressed}) : super(key: key);
final IsExamineSunModel isExamineSunModel;
CouponVerificationItemF({Key key, this.onPressed, this.isExamineSunModel})
: super(key: key);
@override
_CouponVerificationItemFState createState() =>
... ... @@ -44,7 +47,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
Expanded(
flex: 1,
child: Text(
'200元代金券',
widget.isExamineSunModel.rechargeName,
style: TextStyle(
color: MyColours.color_999999,
fontSize: font(16),
... ... @@ -54,7 +57,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
Expanded(
flex: 2,
child: Text(
'NO.01774420230223150306',
widget.isExamineSunModel.orderNo,
textAlign: TextAlign.right,
style: TextStyle(
color: MyColours.color_999999,
... ... @@ -69,7 +72,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
Padding(
padding: EdgeInsets.symmetric(horizontal: w(20)),
child: Text(
'核销:张阿生',
'核销:${widget.isExamineSunModel.examineName ?? ''}',
style: TextStyle(
color: MyColours.color_999999,
fontSize: font(12),
... ... @@ -81,7 +84,7 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
Padding(
padding: EdgeInsets.symmetric(horizontal: w(20)),
child: Text(
'日期:2023-05-05',
'日期:${widget.isExamineSunModel.examineTimeStr ?? ''}',
style: TextStyle(
color: MyColours.color_999999,
fontSize: font(12),
... ... @@ -92,6 +95,6 @@ class _CouponVerificationItemFState extends State<CouponVerificationItemF> {
VEmptyView(24),
],
),
)) ;
));
}
}
... ...
... ... @@ -17,6 +17,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../constant/state.dart';
import '../../utils/event_bus.dart';
import '../../utils/screen_util.dart';
import '../../widgets/page_exception.dart';
... ... @@ -168,8 +169,6 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> {
setState(() {});
}
///输入框
Widget _item(String title, String subTitle,
{Color textColor = MyColours.color_40000000, int fontSize = 16}) {
... ... @@ -464,11 +463,20 @@ class _VerificationCouponPageState extends State<VerificationCouponPage> {
content: '${limitStr}确定要核销当前优惠券吗?核销使用后,该券不能再次使用。',
rCallback: () async {
//确定核销
Map<String, String> pramas = {
'id': widget.idstr,
'examine_name': Provider.of<UserModel>(context,
listen: false)
.user
.nickName ??
Provider.of<UserModel>(context, listen: false)
.user
.account
};
bool success = await couponProvider
.setNewRechargeWriteOff(
context, {'id': widget.idstr});
.setNewRechargeWriteOff(context, pramas);
if (success) {
bus.emit('refresh_coupon_verification_list');
//核销成功,刷新当前页面
_getOrderRechargeByid(
pageS: PageState.Success,
... ...
... ... @@ -307,15 +307,17 @@ class _MessageHasOrderFoodPageState extends State<MessageHasOrderFoodPage> {
Spacer(),
Text(
'¥' +
_orderFoodProvider
.orderList[i][_orderFoodProvider
.orderList[i].keys.first][index]
.price +
(_orderFoodProvider
.orderList[i][_orderFoodProvider
.orderList[i].keys.first][index]
.price ??
'') +
'/' +
_orderFoodProvider
.orderList[i][_orderFoodProvider
.orderList[i].keys.first][index]
.cookunit,
(_orderFoodProvider
.orderList[i][_orderFoodProvider
.orderList[i].keys.first][index]
.cookunit ??
"份"),
style: TextStyle(
color: MyColours.color_333333,
fontSize: ScreenUtil().setWidth(30)),
... ...
... ... @@ -12,6 +12,7 @@ import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import '../models/IsExamineModel.dart';
import '../models/order_recharge_by_id_model.dart';
class CouponProvider with ChangeNotifier {
... ... @@ -37,6 +38,8 @@ class CouponProvider with ChangeNotifier {
CouponSunModel couponSunModel; //优惠券详情
OrderRechargeByidSunModel orderRechargeByidSunModel; //核销详情页
List<IsExamineSunModel> isExamineList = []; //商家券核销列表
IsExamineSunModel isExamineDetail;
CouponProvider() {
// for (int i = 0; i < 20; i++) {
// swichStateData.add(true);
... ... @@ -230,6 +233,51 @@ class CouponProvider with ChangeNotifier {
return couponList;
}
///商家券核销列表
Future<List<IsExamineSunModel>> getIsExamineList(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
if (isShowLoading) {
pageStateVerification = PageState.Loading;
notifyListeners();
}
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_is_examine_list,
data: params, showLoading: false)
.catchError((error) {
print(error.toString());
if (error is MyError) {
switch (error.type) {
case 1:
pageStateVerification = PageState.ConnectivityError;
break;
case 2:
pageStateVerification = PageState.ConnectivityTimeOut;
break;
default:
pageStateVerification = PageState.ConnectivityError;
break;
}
}
notifyListeners();
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data.isEmpty) {
pageStateVerification = PageState.Empty;
} else {
pageStateVerification = PageState.Success;
}
isExamineList = IsExamineModel.fromJson(baseResp.responseData).data;
notifyListeners();
} else {
pageStateVerification = PageState.ConnectivityError;
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
}
return isExamineList;
}
///客户经理获取所创建活动列表
Future<List<CouponSunModel>> getCustomerHistoryActivity(
BuildContext context, Map<String, String> params,
... ...
... ... @@ -26,6 +26,7 @@ import 'package:one_key/utils/utils.dart';
import 'package:sqflite/sqlite_api.dart';
import '../app.dart';
import '../models/IsExamineModel.dart';
import '../models/get_banquet_by_id_new_model.dart';
import '../models/get_banquet_deposit_model.dart';
import '../models/menu_unit_model.dart';
... ... @@ -1717,10 +1718,10 @@ class NavigatorUtil {
/// 优惠券核销详情页
static Future<dynamic> goCouponVerificationDetailPage(
BuildContext context, CouponSunModel couponSunModel,
BuildContext context, IsExamineSunModel isExamineSunModel,
{replace = false, String idStr}) {
return _navigateTo(context,
"${Routes.coupon_verification_detail_page}?couponSunModel=${FluroConvertUtils.object2string(couponSunModel)}&idStr=$idStr",
"${Routes.coupon_verification_detail_page}?isExamineSunModel=${FluroConvertUtils.object2string(isExamineSunModel)}&idStr=$idStr",
replace: replace);
}
}
... ...
... ... @@ -153,6 +153,7 @@ import 'package:one_key/utils/fluro_convert_utils.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import '../models/IsExamineModel.dart';
import '../models/get_banquet_by_id_new_model.dart';
import '../models/menu_unit_model.dart';
import '../models/out_wine_record_model.dart';
... ... @@ -2773,7 +2774,6 @@ var messageRechargeInfoPageHandle = new Handler(
var feastDishSharePageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
SetMealSunModel setmealDetail = SetMealSunModel.fromJson(json
.decode(FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
return ChangeNotifierProvider<FeastModel>(
... ... @@ -2784,13 +2784,12 @@ var feastDishSharePageHandle = new Handler(
///优惠券核销详情页
var couponVerificationDetailPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String idStr = params["idStr"].first;
CouponSunModel couponSunModel;
if (idStr == null || idStr == 'null') {
couponSunModel = CouponSunModel.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
}
// String idStr = params["idStr"].first;
IsExamineSunModel isExamineSunModel = IsExamineSunModel.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(
params["isExamineSunModel"].first)));
// }
return CouponVerificationDetailPage(
couponSunModel: couponSunModel, idstr: idStr);
isExamineSunModel: isExamineSunModel);
});
... ...
... ... @@ -1091,6 +1091,9 @@ class Utils {
}
static getDateStrFromJiekou(String ms) {
if (ms == null || ms == '') {
return '';
}
return DateUtil.formatDate(
DateTime.fromMillisecondsSinceEpoch(int.parse(ms) * 1000),
format: DateFormats.y_mo_d);
... ... @@ -1234,6 +1237,7 @@ class Utils {
path: _path,
// thumbnail: WeChatImage.asset(Utils.getImgPath('mini_image')),
description: _description,
// thumbnail: WeChatImage.binary(source)
thumbnail: WeChatImage.network(_thumbnail));
... ...