|
|
@@ -61,18 +61,18 @@ class _CreateAGangPageState extends State<CreateAGangPage> {
|
|
|
@override
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
- types.forEach((element) {
|
|
|
- sortItems.add(DropdownMenuItem(
|
|
|
- child: Container(
|
|
|
- child: Text(
|
|
|
- element,
|
|
|
- style: TextStyle(color: MyColors.c666666, fontSize: 15),
|
|
|
- ),
|
|
|
- alignment: Alignment.center,
|
|
|
- ),
|
|
|
- value: element,
|
|
|
- ));
|
|
|
- });
|
|
|
+ // types.forEach((element) {
|
|
|
+ // sortItems.add(DropdownMenuItem(
|
|
|
+ // child: Container(
|
|
|
+ // child: Text(
|
|
|
+ // element,
|
|
|
+ // style: TextStyle(color: MyColors.c666666, fontSize: 15),
|
|
|
+ // ),
|
|
|
+ // alignment: Alignment.center,
|
|
|
+ // ),
|
|
|
+ // value: element,
|
|
|
+ // ));
|
|
|
+ // });
|
|
|
// _startingPoint.text = '20';
|
|
|
// _amountCharged.text = '1';
|
|
|
Future.delayed(Duration.zero, () {
|
|
|
@@ -85,33 +85,45 @@ class _CreateAGangPageState extends State<CreateAGangPage> {
|
|
|
Widget build(BuildContext context) {
|
|
|
if (fixedPrices.length > 0) {
|
|
|
sortItems.clear();
|
|
|
- if (private) {
|
|
|
- types3.forEach((element) {
|
|
|
- sortItems.add(DropdownMenuItem(
|
|
|
- child: Container(
|
|
|
- child: Text(
|
|
|
- element,
|
|
|
- style: TextStyle(color: MyColors.c666666, fontSize: 15),
|
|
|
- ),
|
|
|
- alignment: Alignment.center,
|
|
|
+ // if (private) {
|
|
|
+ // types3.forEach((element) {
|
|
|
+ // sortItems.add(DropdownMenuItem(
|
|
|
+ // child: Container(
|
|
|
+ // child: Text(
|
|
|
+ // element,
|
|
|
+ // style: TextStyle(color: MyColors.c666666, fontSize: 15),
|
|
|
+ // ),
|
|
|
+ // alignment: Alignment.center,
|
|
|
+ // ),
|
|
|
+ // value: element,
|
|
|
+ // ));
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // types2.forEach((element) {
|
|
|
+ // sortItems.add(DropdownMenuItem(
|
|
|
+ // child: Container(
|
|
|
+ // child: Text(
|
|
|
+ // element,
|
|
|
+ // style: TextStyle(color: MyColors.c666666, fontSize: 15),
|
|
|
+ // ),
|
|
|
+ // alignment: Alignment.center,
|
|
|
+ // ),
|
|
|
+ // value: element,
|
|
|
+ // ));
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+ fixedPrices.forEach((element) {
|
|
|
+ sortItems.add(DropdownMenuItem(
|
|
|
+ child: Container(
|
|
|
+ child: Text(
|
|
|
+ element.title,
|
|
|
+ style: TextStyle(color: MyColors.c666666, fontSize: 15),
|
|
|
),
|
|
|
- value: element,
|
|
|
- ));
|
|
|
- });
|
|
|
- } else {
|
|
|
- types2.forEach((element) {
|
|
|
- sortItems.add(DropdownMenuItem(
|
|
|
- child: Container(
|
|
|
- child: Text(
|
|
|
- element,
|
|
|
- style: TextStyle(color: MyColors.c666666, fontSize: 15),
|
|
|
- ),
|
|
|
- alignment: Alignment.center,
|
|
|
- ),
|
|
|
- value: element,
|
|
|
- ));
|
|
|
- });
|
|
|
- }
|
|
|
+ alignment: Alignment.center,
|
|
|
+ ),
|
|
|
+ value: '${element.title}',
|
|
|
+ ));
|
|
|
+ });
|
|
|
}
|
|
|
return GestureDetector(
|
|
|
onTap: () {
|
|
|
@@ -451,73 +463,43 @@ class _CreateAGangPageState extends State<CreateAGangPage> {
|
|
|
onChanged: (t) {},
|
|
|
),
|
|
|
),
|
|
|
- //是否私有店铺
|
|
|
- Container(
|
|
|
- height: 0.5,
|
|
|
- color: MyColors.cF7F7F7,
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- child: Container(
|
|
|
- child: Row(
|
|
|
- children: [
|
|
|
- MyViews()
|
|
|
- .myText('是否私有货帮', MyColors.c333333, 15),
|
|
|
- CupertinoSwitch(
|
|
|
- value: private,
|
|
|
- onChanged: (v) {
|
|
|
- setState(() {
|
|
|
- MyTools().hideKeyboard(context);
|
|
|
- private = v;
|
|
|
- shopCommissionType = v ? 1 : 0;
|
|
|
- typeIndex = v ? 2 : 0;
|
|
|
- print(
|
|
|
- '--------------\nprivate-----$private\nshopCommissionType-----$shopCommissionType\ntypeIndex-----$typeIndex\nprivate-----$private\n--------------');
|
|
|
- setFee();
|
|
|
- });
|
|
|
- },
|
|
|
- activeColor: MyColors.cFF4233,
|
|
|
- )
|
|
|
- ],
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- ),
|
|
|
- ),
|
|
|
- padding: EdgeInsets.fromLTRB(16, 0, 15, 0),
|
|
|
- height: 50,
|
|
|
- ),
|
|
|
+
|
|
|
//店铺收费
|
|
|
//付费方式
|
|
|
- Container(
|
|
|
- height: 10,
|
|
|
- color: MyColors.cF7F7F7,
|
|
|
- ),
|
|
|
- Container(
|
|
|
- child: Container(
|
|
|
- child: Row(
|
|
|
- children: [
|
|
|
- MyViews()
|
|
|
- .myText('货帮入驻付费方式', MyColors.c333333, 15),
|
|
|
- DropdownButtonHideUnderline(
|
|
|
- child: DropdownButton(
|
|
|
- isDense: true,
|
|
|
- items: sortItems,
|
|
|
- onChanged: (v) {
|
|
|
- MyTools().hideKeyboard(context);
|
|
|
- setState(() {
|
|
|
- typeIndex = types.indexOf(v);
|
|
|
- setFee();
|
|
|
- });
|
|
|
- },
|
|
|
- value: types[typeIndex],
|
|
|
+ if(fixedPrices.isNotEmpty)
|
|
|
+ Column(children: [
|
|
|
+ Container(
|
|
|
+ height: 10,
|
|
|
+ color: MyColors.cF7F7F7,
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ child: Container(
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ MyViews()
|
|
|
+ .myText('货帮入驻付费方式', MyColors.c333333, 15),
|
|
|
+ DropdownButtonHideUnderline(
|
|
|
+ child: DropdownButton(
|
|
|
+ isDense: true,
|
|
|
+ items: sortItems,
|
|
|
+ onChanged: (v) {
|
|
|
+ MyTools().hideKeyboard(context);
|
|
|
+ setState(() {
|
|
|
+ typeIndex = fixedPrices.indexWhere((element) => element.title==v);
|
|
|
+ setFee();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ value: fixedPrices[typeIndex].title,
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ ],
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ ),
|
|
|
),
|
|
|
+ padding: EdgeInsets.fromLTRB(16, 0, 15, 0),
|
|
|
+ height: 50,
|
|
|
),
|
|
|
- padding: EdgeInsets.fromLTRB(16, 0, 15, 0),
|
|
|
- height: 50,
|
|
|
- ),
|
|
|
+ ],),
|
|
|
//店铺佣金类型
|
|
|
Visibility(
|
|
|
child: Column(
|
|
|
@@ -560,14 +542,14 @@ class _CreateAGangPageState extends State<CreateAGangPage> {
|
|
|
Checkbox(
|
|
|
activeColor: MyColors.cFF4233,
|
|
|
checkColor: Colors.white,
|
|
|
- value:
|
|
|
- shopCommissionType == 1,
|
|
|
+ value:fixedPrices.isEmpty?false:
|
|
|
+ fixedPrices[typeIndex].percent,
|
|
|
onChanged: (v) {
|
|
|
- MyTools()
|
|
|
- .hideKeyboard(context);
|
|
|
- shopCommissionType = 1;
|
|
|
- setFee();
|
|
|
- setState(() {});
|
|
|
+ // MyTools()
|
|
|
+ // .hideKeyboard(context);
|
|
|
+ // shopCommissionType = 1;
|
|
|
+ // setFee();
|
|
|
+ // setState(() {});
|
|
|
},
|
|
|
),
|
|
|
MyViews().myText('按照比例',
|
|
|
@@ -589,25 +571,62 @@ class _CreateAGangPageState extends State<CreateAGangPage> {
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
- visible: typeIndex != 0,
|
|
|
+ visible: fixedPrices.isNotEmpty,
|
|
|
),
|
|
|
//支付价格
|
|
|
+ if(fixedPrices.isNotEmpty)
|
|
|
+ Column(children: [
|
|
|
+ Container(
|
|
|
+ height: 0.5,
|
|
|
+ color: MyColors.cF7F7F7,
|
|
|
+ margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ child: Container(
|
|
|
+ child: Row(
|
|
|
+ children: [
|
|
|
+ MyViews().myText('支付价格', MyColors.c333333, 15),
|
|
|
+ MyViews().myText(
|
|
|
+ fixedPrices.isEmpty?'0元':fixedPrices[typeIndex].percent
|
|
|
+ ? '${NumUtil.multiply(fixedPrices[typeIndex].pricing, 100)}%'
|
|
|
+ :'${fixedPrices[typeIndex].pricing}元',
|
|
|
+ MyColors.c333333,
|
|
|
+ 15),
|
|
|
+ ],
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ padding: EdgeInsets.fromLTRB(16, 0, 15, 0),
|
|
|
+ height: 50,
|
|
|
+ ),
|
|
|
+ ],),
|
|
|
+
|
|
|
+ //是否私有店铺
|
|
|
Container(
|
|
|
- height: 0.5,
|
|
|
+ height: 10,
|
|
|
color: MyColors.cF7F7F7,
|
|
|
- margin: EdgeInsets.symmetric(horizontal: 15),
|
|
|
),
|
|
|
Container(
|
|
|
child: Container(
|
|
|
child: Row(
|
|
|
children: [
|
|
|
- MyViews().myText('支付价格', MyColors.c333333, 15),
|
|
|
- MyViews().myText(
|
|
|
- shopCommissionType == 0
|
|
|
- ? '$feePricing元'
|
|
|
- : '${NumUtil.multiply(double.parse(feePricing), 100)}%',
|
|
|
- MyColors.c333333,
|
|
|
- 15),
|
|
|
+ MyViews()
|
|
|
+ .myText('是否私有货帮', MyColors.c333333, 15),
|
|
|
+ CupertinoSwitch(
|
|
|
+ value: private,
|
|
|
+ onChanged: (v) {
|
|
|
+ setState(() {
|
|
|
+ MyTools().hideKeyboard(context);
|
|
|
+ private = v;
|
|
|
+ // shopCommissionType = v ? 1 : 0;
|
|
|
+ // typeIndex = v ? 2 : 0;
|
|
|
+ // print(
|
|
|
+ // '--------------\nprivate-----$private\nshopCommissionType-----$shopCommissionType\ntypeIndex-----$typeIndex\nprivate-----$private\n--------------');
|
|
|
+ setFee();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ activeColor: MyColors.cFF4233,
|
|
|
+ )
|
|
|
],
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
),
|
|
|
@@ -615,6 +634,7 @@ class _CreateAGangPageState extends State<CreateAGangPage> {
|
|
|
padding: EdgeInsets.fromLTRB(16, 0, 15, 0),
|
|
|
height: 50,
|
|
|
),
|
|
|
+
|
|
|
//店铺佣金
|
|
|
|
|
|
Visibility(
|
|
|
@@ -1061,9 +1081,9 @@ class _CreateAGangPageState extends State<CreateAGangPage> {
|
|
|
'picture': data.data[0].path,
|
|
|
'private': private,
|
|
|
'owner_uid': MyCookie().getUID(),
|
|
|
- 'fee_type': feeType,
|
|
|
- 'fee_percent': shopCommissionType == 1,
|
|
|
- 'fee_pricing': feePricing,
|
|
|
+ 'fee_type': fixedPrices[typeIndex].type,
|
|
|
+ 'fee_percent': fixedPrices[typeIndex].percent,
|
|
|
+ 'fee_pricing': fixedPrices[typeIndex].pricing,
|
|
|
'inner_trade': innerTrade,
|
|
|
'category': shopTypeV,
|
|
|
'owner_pay_platform_fee': ownerPayPlatformCommission,
|
|
|
@@ -1104,10 +1124,26 @@ class _CreateAGangPageState extends State<CreateAGangPage> {
|
|
|
}, (error) {});
|
|
|
}
|
|
|
|
|
|
+ // getFixedPrice() {
|
|
|
+ // MyDio().query({
|
|
|
+ // "key": "shop_pricing",
|
|
|
+ // "dims": ["id", "type", "pricing", "title"],
|
|
|
+ // "filters": {}
|
|
|
+ // }, (response, hasError) {
|
|
|
+ // if (!hasError) {
|
|
|
+ // FixedPriceBeanEntity fixedPrice = FixedPriceBeanEntity()
|
|
|
+ // .fromJson(json.decode(response.data.toString()));
|
|
|
+ // fixedPrices = fixedPrice.data;
|
|
|
+ // setFee();
|
|
|
+ // setState(() {});
|
|
|
+ // }
|
|
|
+ // }, (error) {});
|
|
|
+ // }
|
|
|
getFixedPrice() {
|
|
|
MyDio().query({
|
|
|
- "key": "shop_pricing",
|
|
|
- "dims": ["id", "type", "pricing", "title"],
|
|
|
+ "key": "platform_pricing",
|
|
|
+ "dims": ["id", "type", "pricing", "title",
|
|
|
+ "percent"],
|
|
|
"filters": {}
|
|
|
}, (response, hasError) {
|
|
|
if (!hasError) {
|
|
|
@@ -1120,6 +1156,7 @@ class _CreateAGangPageState extends State<CreateAGangPage> {
|
|
|
}, (error) {});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
void setFee() {
|
|
|
print('==================================');
|
|
|
print(types[typeIndex]);
|