|
...
|
...
|
@@ -6,6 +6,7 @@ import 'package:flutter/services.dart'; |
|
|
|
import 'package:flutter_picker/flutter_picker.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
|
|
import 'package:one_key/constant/constant.dart';
|
|
|
|
import 'package:one_key/provider/coupon_provider.dart';
|
|
|
|
import 'package:one_key/provider/user_model.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
...
|
...
|
@@ -89,6 +90,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
UploadImageProvider _uploadImageProvider;
|
|
|
|
List<UploadImgModel> img = [];
|
|
|
|
|
|
|
|
List<String> imgAll = [];
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
...
|
...
|
@@ -200,6 +203,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
uploadImgModel.qiniuUrl = element;
|
|
|
|
uploadImgModel.process = 1;
|
|
|
|
img.add(uploadImgModel);
|
|
|
|
imgAll.add(element); //初始化数据,同步数据库数据
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
...
|
...
|
@@ -293,17 +297,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
"status": swichState ? "1" : "0",
|
|
|
|
'is_type': widget.isMine ? "2" : "1"
|
|
|
|
};
|
|
|
|
List<String> images = [];
|
|
|
|
if (!widget.isMine) {
|
|
|
|
params['is_examine'] = swichHexiao ? "1" : "0";
|
|
|
|
params['uid_list'] = uids;
|
|
|
|
params['price'] =
|
|
|
|
_priceControl.text.trim().length == 0 ? '0' : _priceControl.text;
|
|
|
|
List<String> images = [];
|
|
|
|
|
|
|
|
if (img.length > 0) {
|
|
|
|
img.forEach((value) {
|
|
|
|
images.add(value.qiniuUrl);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
Map use = {
|
|
|
|
'is_cash': money ? '1' : '0',
|
|
|
|
'is_discount': discount ? '1' : '0',
|
|
...
|
...
|
@@ -333,6 +339,17 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
bool isSuccess =
|
|
|
|
await couponProvider.createCustomerActivity(context, params);
|
|
|
|
if (isSuccess) {
|
|
|
|
if (!widget.isMine) {
|
|
|
|
// imgAll和images 比较,挑出不一样的,删除七牛云
|
|
|
|
Set<String> difference = Set.from(imgAll)..removeAll(images);
|
|
|
|
List<String> differenceList = difference.toList(); //需要删除的图片
|
|
|
|
if (differenceList.length > 0) {
|
|
|
|
String delImgs = Utils.listToStringEnglish(differenceList);
|
|
|
|
delImgs = delImgs.replaceAll(Constant.qiniuUrl, '');
|
|
|
|
_uploadImageProvider.deleteImg(context, {'url': delImgs},
|
|
|
|
needToast: false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//成功之后跳回前一个页面
|
|
|
|
// bus.emit('refresh_coupon_list');
|
|
|
|
EventBus().emit('refresh_coupon_invitation');
|
|
...
|
...
|
@@ -340,7 +357,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
// bus.emit('refresh_marketting_page');
|
|
|
|
|
|
|
|
bus.emit('refresh_table_m_coupon');
|
|
|
|
bus.emit('refresh_wine_msg');
|
|
|
|
bus.emit('refresh_wine_msg');
|
|
|
|
Navigator.pop(context, true);
|
|
|
|
}
|
|
|
|
}
|
|
...
|
...
|
@@ -374,7 +391,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
// cursorColor:
|
|
|
|
// widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
|
|
inputFormatters:title== '券名称' ? [LengthLimitingTextInputFormatter(15)]:[],
|
|
|
|
inputFormatters: title == '券名称'
|
|
|
|
? [LengthLimitingTextInputFormatter(15)]
|
|
|
|
: [],
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
...
|
...
|
@@ -990,6 +1009,8 @@ class _CouponEidtPageState extends State<CouponEidtPage> { |
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
callback: () {
|
|
|
|
imgAll.add(img.last.qiniuUrl);
|
|
|
|
print('完成');
|
|
|
|
// for (UploadImgModel item
|
|
|
|
// in _uploadImageProvider
|
|
|
|
// .tableImageList) {
|
...
|
...
|
|