huxiaoqiang vor 4 Jahren
Ursprung
Commit
f23d9e200c

BIN
images/Alipay.png


BIN
images/WeChat.png


+ 49 - 46
lib/beans/store_bean_entity.dart

@@ -2,56 +2,59 @@ import 'package:bbyyy/generated/json/base/json_convert_content.dart';
 import 'package:bbyyy/generated/json/base/json_field.dart';
 
 class StoreBeanEntity with JsonConvert<StoreBeanEntity> {
-	StoreBeanData data;
-	String error;
+  StoreBeanData data;
+  String error;
 }
 
 class StoreBeanData with JsonConvert<StoreBeanData> {
-	int total;
-	List<StoreBeanDataData> data;
+  int total;
+  List<StoreBeanDataData> data;
 }
 
 class StoreBeanDataData with JsonConvert<StoreBeanDataData> {
-	@JSONField(name: "create_time")
-	String createTime;
-	@JSONField(name: "inner_trade")
-	bool innerTrade;
-	@JSONField(name: "shop_commission_threshold")
-	double shopCommissionThreshold;
-	String notice;
-	int state;
-	bool banned;
-	@JSONField(name: "shop_commission_pricing")
-	double shopCommissionPricing;@JSONField(name: "shop_commission_receiver_uid")
-	int shopCommissionReceiverUid;
-	bool private;
-	@JSONField(name: "owner_uid")
-	int ownerUid;
-	@JSONField(name: "owner_name")
-	String ownerName;
-	@JSONField(name: "owner_pic")
-	String ownerPic;
-	@JSONField(name: "hide_members")
-	bool hideMembers = true;
-	@JSONField(name: "hide_offline_pay")
-	bool hideOfflinePay = false;
-	@JSONField(name: "fee_type")
-	int feeType;
-	String mobile;
-	int id;
-	String picture;
-	@JSONField(name: "ban_expire_date")
-	String banExpireDate;
-	String address;
-	String introduction;
-	int uid;
-	String name;
-	@JSONField(name: "ban_start_date")
-	String banStartDate;
-	@JSONField(name: "shop_commission_percent")
-	bool shopCommissionPercent;
-	@JSONField(name: "owner_pay_platform_fee")
-	bool ownerPayPlatformFee;
-	double longitude;
-	double latitude;
+  @JSONField(name: "create_time")
+  String createTime;
+  @JSONField(name: "inner_trade")
+  bool innerTrade;
+  @JSONField(name: "shop_commission_threshold")
+  double shopCommissionThreshold;
+  String notice;
+  int state;
+  bool banned;
+  @JSONField(name: "shop_commission_pricing")
+  double shopCommissionPricing;
+	@JSONField(name: "pay_discount")
+	double payDiscount;
+  @JSONField(name: "shop_commission_receiver_uid")
+  int shopCommissionReceiverUid;
+  bool private;
+  @JSONField(name: "owner_uid")
+  int ownerUid;
+  @JSONField(name: "owner_name")
+  String ownerName;
+  @JSONField(name: "owner_pic")
+  String ownerPic;
+  @JSONField(name: "hide_members")
+  bool hideMembers = true;
+  @JSONField(name: "hide_offline_pay")
+  bool hideOfflinePay = false;
+  @JSONField(name: "fee_type")
+  int feeType;
+  String mobile;
+  int id;
+  String picture;
+  @JSONField(name: "ban_expire_date")
+  String banExpireDate;
+  String address;
+  String introduction;
+  int uid;
+  String name;
+  @JSONField(name: "ban_start_date")
+  String banStartDate;
+  @JSONField(name: "shop_commission_percent")
+  bool shopCommissionPercent;
+  @JSONField(name: "owner_pay_platform_fee")
+  bool ownerPayPlatformFee;
+  double longitude;
+  double latitude;
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 478 - 409
lib/generated/json/base/json_convert_content.dart


+ 6 - 0
lib/generated/json/store_bean_entity_helper.dart

@@ -64,6 +64,11 @@ storeBeanDataDataFromJson(StoreBeanDataData data, Map<String, dynamic> json) {
 				? double.tryParse(json['shop_commission_pricing'])
 				: json['shop_commission_pricing'].toDouble();
 	}
+	if (json['pay_discount'] != null) {
+		data.payDiscount = json['pay_discount'] is String
+				? double.tryParse(json['pay_discount'])
+				: json['pay_discount'].toDouble();
+	}
 	if (json['shop_commission_receiver_uid'] != null) {
 		data.shopCommissionReceiverUid = json['shop_commission_receiver_uid'] is String
 				? int.tryParse(json['shop_commission_receiver_uid'])
@@ -153,6 +158,7 @@ Map<String, dynamic> storeBeanDataDataToJson(StoreBeanDataData entity) {
 	data['state'] = entity.state;
 	data['banned'] = entity.banned;
 	data['shop_commission_pricing'] = entity.shopCommissionPricing;
+	data['pay_discount'] = entity.payDiscount;
 	data['shop_commission_receiver_uid'] = entity.shopCommissionReceiverUid;
 	data['private'] = entity.private;
 	data['owner_uid'] = entity.ownerUid;

+ 2 - 1
lib/my_tools/dims.dart

@@ -60,7 +60,8 @@ var shopDims = [
   'auto_address',
   'province',
   'city',
-  'county'
+  'county',
+  'pay_discount'
 ];
 
 var userDims = [

+ 6 - 0
lib/my_tools/my_tools.dart

@@ -333,3 +333,9 @@ getAddressByLatitudeAndLongitude(
     EventBus().emit('getLocation');
   });
 }
+
+double balanceDisplay(double balance){
+  int a = (balance*100).toInt();
+  double b = a/100;
+  return b;
+}

+ 29 - 9
lib/my_tools/my_views.dart

@@ -586,13 +586,7 @@ class MyViews {
             children: [
               Container(
                 child: ClipRRect(
-                  child: flow.traderUid == 0
-                      ? Image.asset(
-                          'images/app_logo.png',
-                          width: 50,
-                          height: 50,
-                        )
-                      : MyViews().netImg(imgURL(flow.traderPic), 50, 50),
+                  child: flowIcon(flow),
                   borderRadius: BorderRadius.all(Radius.circular(25)),
                 ),
                 margin: EdgeInsets.only(right: 12),
@@ -650,7 +644,7 @@ class MyViews {
                               TextStyle(color: MyColors.c666666, fontSize: 12),
                         ),
                         Text(
-                          '${flow.userBalance.toStringAsFixed(2)}',
+                          '${balanceDisplay(flow.userBalance).toStringAsFixed(2)}',
                           style:
                               TextStyle(color: MyColors.c666666, fontSize: 11),
                         ),
@@ -1938,7 +1932,7 @@ class MyViews {
         ),
       );
     } else if (data.type == orderTypeOfflineTransfer ||
-        data.type == orderTypeOfflinePay) {
+        data.type == orderTypeOfflinePay||data.type==orderTypeShopOwnerCreated) {
       //线下付款
       return Container(
         margin: EdgeInsets.only(left: 10, right: 10),
@@ -2503,6 +2497,32 @@ class MyViews {
         },
         context: context);
   }
+
+ Widget flowIcon(FlowBeanDataDataRecords flow ) {
+    if(flow.traderUid == 0){
+      return Image.asset(
+        'images/app_logo.png',
+        width: 50,
+        height: 50,
+      );
+    }else if(flow.traderUid == 1){
+      return Image.asset(
+        'images/Alipay.png',
+        width: 50,
+        height: 50,
+      );
+    }
+    else if(flow.traderUid == 2){
+      return Image.asset(
+        'images/WeChat.png',
+        width: 50,
+        height: 50,
+      );
+    }
+    else{
+      return MyViews().netImg(imgURL(flow.traderPic), 50, 50);
+    }
+  }
 }
 
 Widget noData() {

+ 4 - 1
lib/paegs/gang_page/gang_in_page/gang_in_page.dart

@@ -29,6 +29,7 @@ import 'package:bbyyy/paegs/gang_page/gang_in_page/qr_pay_page/set_amount_page.d
 import 'package:bbyyy/paegs/gang_page/gang_in_page/send_red_envelope_page/send_red_envelope_page.dart';
 import 'package:bbyyy/paegs/gang_page/gang_in_page/shop_flow_page/shop_flow_page.dart';
 import 'package:bbyyy/paegs/gang_page/qr_code_for_store_payment_page/qr_code_for_store_payment_page.dart';
+import 'package:bbyyy/paegs/home_page/qr_code_payment/new_qr_code_payment_page.dart';
 import 'package:bbyyy/paegs/mine_page/privacy_protection_props_page/privacy_protection_props_page.dart';
 import 'package:bbyyy/paegs/mine_page/referrer_page/referrer_page.dart';
 import 'package:bbyyy/paegs/other_people_s_turnover_page/other_people_s_turnover_page.dart';
@@ -907,8 +908,10 @@ class _GangInPageState extends State<GangInPage> {
                                   }
                                 });
                               } else {
+                                // MyTools().toPage(context,
+                                //     PayToTheHelperPage(widget.data), (then) {});
                                 MyTools().toPage(context,
-                                    PayToTheHelperPage(widget.data), (then) {});
+                                    NewPayToTheGangPage(widget.data.shopUid,orderTypeOfflineTransfer), (then) {});
                               }
                             },
                             behavior: HitTestBehavior.translucent,

+ 1 - 1
lib/paegs/gang_page/gang_in_page/gang_information_page/member_list_page/member_order_flow.dart

@@ -193,7 +193,7 @@ class _MemberOrderFlowPageState extends State<MemberOrderFlowPage> {
                         Container(
                           margin: EdgeInsets.only(left: 10),
                           child: Text(
-                            '${widget.data.userName}(${widget.data.userUid})',
+                            '${widget.data.userName}(${hideUID(widget.data.userUid.toString())})',
                             style: TextStyle(color: Colors.white, fontSize: 15),
                           ),
                         ),

+ 1 - 1
lib/paegs/gang_page/gang_in_page/gang_order_page/gang_order_page.dart

@@ -155,7 +155,7 @@ class _GangOrderPageState extends State<GangOrderPage> {
                           child:
                               MyViews().getOrdersItem(orders[index], context),
                           actionPane: SlidableDrawerActionPane(),
-                          enabled: orders[index].state==orderStateUnpaid,
+                          enabled: orders[index].state==orderStateUnpaid&&orders[index].type!=orderTypeShopOwnerCreated,
                           actionExtentRatio: 0.25,
                           secondaryActions: <Widget>[
                             SlideAction(

+ 41 - 7
lib/paegs/gang_page/gang_in_page/pay_to_the_helper_page/pay_to_the_helper_page.dart

@@ -15,6 +15,7 @@ import 'package:bbyyy/my_tools/my_views.dart';
 import 'package:bbyyy/paegs/pay_page/order_information_page.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
+import 'package:number_precision/number_precision.dart';
 
 class PayToTheHelperPage extends StatefulWidget {
   MyShopBeanDataData data;
@@ -115,6 +116,12 @@ class _PayToTheHelperPageState extends State<PayToTheHelperPage> {
                                   keyboardType: TextInputType.numberWithOptions(
                                       decimal: true),
                                   onChanged: (t) {
+                                    try {
+                                      amount = double.parse(
+                                          _controller.text.toString());
+                                    } catch (e) {
+                                      amount = 0;
+                                    }
                                     setState(() {});
                                   },
                                 ),
@@ -126,6 +133,33 @@ class _PayToTheHelperPageState extends State<PayToTheHelperPage> {
                       crossAxisAlignment: CrossAxisAlignment.start,
                     ),
                   ),
+                  if (store != null && store.payDiscount != 0)
+                    Container(
+                      decoration: BoxDecoration(
+                          color: Colors.white,
+                          borderRadius: BorderRadius.circular(4)),
+                      margin: EdgeInsets.symmetric(horizontal: 17, vertical: 2),
+                      padding:
+                          EdgeInsets.symmetric(horizontal: 20, vertical: 15),
+                      child: Column(
+                        children: [
+                          MyViews().myText('店铺折扣', MyColors.c333333, 16),
+                          Row(
+                            children: [
+                              Text('实际付款'),
+                              Text('¥${NP.minus(amount, balanceDisplay(amount * (1-store.payDiscount)))}'),
+                            ],
+                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                          ),
+                          Row(children: [
+                            Text('折扣金额'),
+                            Text(
+                                '¥${balanceDisplay(amount * (1-store.payDiscount))}'),
+                          ], mainAxisAlignment: MainAxisAlignment.spaceBetween)
+                        ],
+                        crossAxisAlignment: CrossAxisAlignment.start,
+                      ),
+                    ),
                   GestureDetector(
                     onTap: () {
                       generateOrders();
@@ -185,7 +219,7 @@ class _PayToTheHelperPageState extends State<PayToTheHelperPage> {
   }
 
   StoreBeanDataData store;
-  double amount;
+  double amount = 0.0;
 
   void queryStoreInformation() {
     MyDio().query({
@@ -200,6 +234,7 @@ class _PayToTheHelperPageState extends State<PayToTheHelperPage> {
         StoreBeanEntity entity =
             StoreBeanEntity().fromJson(json.decode(response.data.toString()));
         store = entity.data.data[0];
+        setState(() {});
       }
     }, (error) {});
   }
@@ -222,12 +257,11 @@ class _PayToTheHelperPageState extends State<PayToTheHelperPage> {
           sellName: widget.data.ownerName,
           sellPic: widget.data.ownerPic,
           sellUid: widget.data.ownerUid,
-        ),
-        (then) {
-          if(then is int && then ==1){
-            Navigator.pop(context);
-          }
-        });
+        ), (then) {
+      if (then is int && then == 1) {
+        Navigator.pop(context);
+      }
+    });
     // MyTools().toPage(context, PayPage(orderUID, true, amount), (then) {
     //   if (then is String) {
     //     if (then == '支付成功') {

+ 3 - 2
lib/paegs/home_page/home_page.dart

@@ -19,6 +19,7 @@ import 'package:bbyyy/my_tools/my_cookie.dart';
 import 'package:bbyyy/my_tools/my_tools.dart';
 import 'package:bbyyy/my_tools/my_views.dart';
 import 'package:bbyyy/paegs/gang_page/gang_in_page/scan_page/scan_page.dart';
+import 'package:bbyyy/paegs/home_page/qr_code_payment/new_qr_code_payment_page.dart';
 import 'package:bbyyy/paegs/home_page/qr_code_payment/qr_code_payment_page.dart';
 import 'package:bbyyy/paegs/home_page/recommended_today_page.dart';
 import 'package:bbyyy/paegs/root_page/root_page_view.dart';
@@ -26,6 +27,7 @@ import 'package:flutter/cupertino.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_svg/flutter_svg.dart';
 import 'package:flutter_swiper/flutter_swiper.dart';
+import 'package:get/get.dart';
 import 'package:pull_to_refresh/pull_to_refresh.dart';
 
 class HomePage extends StatefulWidget {
@@ -567,9 +569,8 @@ class _HomePageState extends State<HomePage>
                                   MyTools().hideKeyboard(context);
                                   int shopUid = int.parse(then.split('=')[1]);
                                   print(shopUid);
-                                  MyTools().toPage(context, PayToTheGangPage(shopUid), (then){
+                                  MyTools().toPage(context, NewPayToTheGangPage(shopUid,orderTypeOfflinePay), (then){});
 
-                                  });
                                 });
                               }
                             }

+ 371 - 0
lib/paegs/home_page/qr_code_payment/new_qr_code_payment_page.dart

@@ -0,0 +1,371 @@
+import 'dart:convert';
+import 'dart:math';
+
+import 'package:bbyyy/beans/offline_payment_bean_entity.dart';
+import 'package:bbyyy/beans/store_bean_entity.dart';
+import 'package:bbyyy/https/MyDio.dart';
+import 'package:bbyyy/https/url.dart';
+import 'package:bbyyy/my_tools/const.dart';
+import 'package:bbyyy/my_tools/dims.dart';
+import 'package:bbyyy/my_tools/easy_loading/easy_loading.dart';
+import 'package:bbyyy/my_tools/my_colors.dart';
+import 'package:bbyyy/my_tools/my_cookie.dart';
+import 'package:bbyyy/my_tools/my_tools.dart';
+import 'package:bbyyy/my_tools/my_views.dart';
+import 'package:bbyyy/paegs/pay_page/order_information_page.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:number_precision/number_precision.dart';
+
+class NewPayToTheGangPage extends StatefulWidget {
+  int shopUid;
+  int type;
+
+  NewPayToTheGangPage(this.shopUid, this.type);
+
+  @override
+  _NewPayToTheGangPageState createState() => _NewPayToTheGangPageState();
+}
+
+class _NewPayToTheGangPageState extends State<NewPayToTheGangPage> {
+  TextEditingController _controller = TextEditingController();
+
+  @override
+  void initState() {
+    // TODO: implement initState
+    super.initState();
+    Future.delayed(Duration.zero, () {
+      queryStoreInformation();
+    });
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return GestureDetector(
+      onTap: () {
+        MyTools().hideKeyboard(context);
+      },
+      child: Scaffold(
+        body: Container(
+          decoration: BoxDecoration(
+            gradient: LinearGradient(
+                colors: MyColors.lg2,
+                begin: Alignment.topCenter,
+                end: Alignment.bottomCenter),
+          ),
+          child: Column(
+            children: [
+              SafeArea(
+                bottom: false,
+                child: Container(
+                  height: 45,
+                  width: double.infinity,
+                  child: Stack(
+                    children: [
+                      Text(
+                        '支付',
+                        style: TextStyle(color: Colors.white, fontSize: 16),
+                      ),
+                      Positioned(
+                        left: 0,
+                        child: GestureDetector(
+                          onTap: () {
+                            Navigator.pop(context);
+                          },
+                          behavior: HitTestBehavior.translucent,
+                          child: Transform.rotate(
+                            angle: pi,
+                            child: Padding(
+                              padding: EdgeInsets.only(
+                                  left: 16, right: 16, top: 8, bottom: 8),
+                              child: SvgPicture.asset(
+                                'images/svg/箭头.svg',
+                                color: Colors.white,
+                                height: 14,
+                              ),
+                            ),
+                          ),
+                        ),
+                      ),
+                    ],
+                    alignment: Alignment.center,
+                  ),
+                ),
+              ),
+              Expanded(
+                child: SingleChildScrollView(
+                  child: Container(
+                    decoration: BoxDecoration(
+                        color: Colors.white,
+                        borderRadius: BorderRadius.circular(15)),
+                    margin: EdgeInsets.symmetric(horizontal: 15, vertical: 30),
+                    child: Column(
+                      children: [
+                        Container(
+                          margin: EdgeInsets.only(top: 40),
+                          child: ClipRRect(
+                            child: MyViews().netImg(
+                                imgURL(store == null ? '' : store.picture),
+                                65,
+                                65),
+                            borderRadius: BorderRadius.circular(32.5),
+                          ),
+                        ),
+                        Container(
+                          margin: EdgeInsets.only(top: 20, bottom: 30),
+                          child: RichText(
+                            textAlign: TextAlign.center,
+                            text: TextSpan(
+                              text: '您正在向 ',
+                              children: [
+                                TextSpan(
+                                    text: '${store == null ? '' : store.name}',
+                                    style: TextStyle(
+                                        color: MyColors.c333333,
+                                        fontSize: 20,
+                                        fontWeight: FontWeight.bold)),
+                                TextSpan(
+                                  text: ' 付款',
+                                ),
+                                if (store != null && store.payDiscount != 0)
+                                  TextSpan(
+                                    text: '\n实付金额为',
+                                  ),
+                                if (store != null && store.payDiscount != 0)
+                                  TextSpan(
+                                      text:
+                                          '${NP.minus(amount, balanceDisplay(amount * (1 - store.payDiscount)))}',
+                                      style: TextStyle(
+                                          color: MyColors.cE2A62D,
+                                          fontSize: 20,
+                                          fontWeight: FontWeight.bold)),
+                                if (store != null && store.payDiscount != 0)
+                                  TextSpan(
+                                    text: '元',
+                                  ),
+                              ],
+                              style: TextStyle(
+                                  color: MyColors.c333333, fontSize: 15),
+                            ),
+                          ),
+                        ),
+                        Container(
+                          margin: EdgeInsets.symmetric(horizontal: 22),
+                          child: Column(
+                            children: [
+                              Row(
+                                children: [
+                                  Container(
+                                      margin: EdgeInsets.only(bottom: 9),
+                                      child: Text(
+                                        '付款金额:',
+                                        style: TextStyle(
+                                            color: MyColors.c999999,
+                                            fontSize: 15),
+                                      )),
+                                  Expanded(
+                                    child: TextField(
+                                      inputFormatters: [
+                                        FilteringTextInputFormatter.allow(
+                                            RegExp("[0-9.]")),
+                                      ],
+                                      controller: _controller,
+                                      cursorColor: MyColors.cFF4233,
+                                      cursorWidth: 1.0,
+                                      decoration: InputDecoration(
+                                          border: InputBorder.none,
+                                          disabledBorder: InputBorder.none,
+                                          enabledBorder: InputBorder.none,
+                                          focusedBorder: InputBorder.none,
+                                          hintText: '请输入…',
+                                          hintStyle: TextStyle(
+                                              color: MyColors.c999999,
+                                              fontSize: 15),
+                                          isDense: true,
+                                          contentPadding:
+                                              const EdgeInsets.fromLTRB(
+                                                  5, 4.5, 8, 4.5)),
+                                      maxLines: 1,
+                                      style: TextStyle(
+                                          color: MyColors.c333333,
+                                          fontSize: 32,
+                                          fontWeight: FontWeight.bold,
+                                          height: 1.3,
+                                          letterSpacing: 0.2),
+                                      keyboardType:
+                                          TextInputType.numberWithOptions(
+                                              decimal: true),
+                                      onChanged: (t) {
+                                        try {
+                                          amount = double.parse(
+                                              _controller.text.toString());
+                                        } catch (e) {
+                                          amount = 0;
+                                        }
+                                        setState(() {});
+                                      },
+                                    ),
+                                  ),
+                                ],
+                                crossAxisAlignment: CrossAxisAlignment.end,
+                              ),
+                              Container(
+                                height: 0.5,
+                                color: MyColors.cE7E7E7,
+                              ),
+                            ],
+                          ),
+                        ),
+                        if (store != null && store.payDiscount != 0)
+                          Row(
+                            children: [
+                              Container(
+                                margin: EdgeInsets.only(top: 9, left: 22),
+                                child: RichText(
+                                  text: TextSpan(
+                                    text: '店铺折扣金额:',
+                                    children: [
+                                      TextSpan(
+                                        text:
+                                            '${balanceDisplay(amount * (1 - store.payDiscount))}',
+                                        style: TextStyle(
+                                          color: MyColors.cE2A62D,
+                                        ),
+                                      ),
+                                      TextSpan(
+                                        text: '元',
+                                      ),
+                                    ],
+                                    style: TextStyle(
+                                        color: MyColors.c999999, fontSize: 14),
+                                  ),
+                                ),
+                              ),
+                            ],
+                          ),
+                        GestureDetector(
+                          onTap: () {
+                            generateOrders();
+                          },
+                          behavior: HitTestBehavior.translucent,
+                          child: Container(
+                            decoration: BoxDecoration(
+                              color: MyColors.cFF4233,
+                              borderRadius: BorderRadius.circular(20),
+                            ),
+                            height: 40,
+                            child: Text(
+                              '确认支付',
+                              style:
+                                  TextStyle(color: Colors.white, fontSize: 14),
+                            ),
+                            alignment: Alignment.center,
+                            margin: EdgeInsets.symmetric(
+                                horizontal: 22, vertical: 40),
+                          ),
+                        )
+                      ],
+                    ),
+                  ),
+                ),
+              )
+            ],
+          ),
+        ),
+      ),
+    );
+  }
+
+  StoreBeanDataData store;
+  double amount = 0.0;
+
+  void queryStoreInformation() {
+    EasyLoading.show();
+    MyDio().query({
+      "key": "shop",
+      "filters": {
+        "conditions": ["uid == ${widget.shopUid}"]
+      },
+      "dims": shopDims,
+      "paging": [1, 5]
+    }, (response, hasError) {
+      if (!hasError) {
+        StoreBeanEntity entity =
+            StoreBeanEntity().fromJson(json.decode(response.data.toString()));
+        store = entity.data.data[0];
+        setState(() {
+          EasyLoading.dismiss();
+        });
+      }
+    }, (error) {});
+  }
+
+  //生成订单
+  generateOrders() {
+    EasyLoading.show();
+    try {
+      amount = double.parse(_controller.text.toString());
+      MyDio().save({
+        'key': 'order',
+        'object': {
+          'uuid': widget.type == orderTypeOfflineTransfer
+              ? generateMd5(reOS('付款给店主${DateTime.now()}'))
+              : generateMd5(reOS('扫码付款${DateTime.now()}')),
+          'shop_uid': store.uid,
+          'shop_pic': store.picture,
+          'shop_name': store.name,
+          'seller_pic': store.ownerPic,
+          'seller_uid': store.ownerUid,
+          'seller_name': store.ownerName,
+          'buyer_name': MyCookie().getName(),
+          'buyer_uid': MyCookie().getUID(),
+          'buyer_pic': MyCookie().userBean.picture,
+          'type': widget.type,
+          'amount': amount
+        }
+      }, (response, hasError) {
+        if (!hasError) {
+          OfflinePaymentBeanEntity entity = OfflinePaymentBeanEntity()
+              .fromJson(json.decode(response.data.toString()));
+          payTheOrder(entity.data);
+        }
+      }, (error) {});
+    } catch (e) {
+      showToast('请输入正确的金额');
+    }
+  }
+
+  void payTheOrder(int orderUID) {
+    _controller.clear();
+    MyTools().toPage(
+        context,
+        OrderInformationPage(
+          false,
+          orderType: widget.type,
+          amount: amount,
+          uid: orderUID,
+          buyerUid: MyCookie().getUID(),
+          buyerName: MyCookie().getName(),
+          buyerPic: MyCookie().getPic(),
+          commodityCount: 1,
+          commodityTitle: '到店支付',
+          commodityCover: '',
+          sellName: store.ownerName,
+          sellPic: store.ownerPic,
+          sellUid: store.ownerUid,
+          discountAmount: store.payDiscount==0?0:balanceDisplay(amount * (1 - store.payDiscount)),
+        ), (then) {
+      if (then is int && then == 1) {
+        Navigator.pop(context);
+      }
+    });
+    // MyTools().toPage(context, PayPage(orderUID, true, amount), (then) {
+    //   if (then is String) {
+    //     if (then == '支付成功') {
+    //       Navigator.pop(context);
+    //     }
+    //   }
+    // });
+  }
+}

+ 1 - 1
lib/paegs/mine_page/mine_page.dart

@@ -157,7 +157,7 @@ class _MinePageState extends State<MinePage> {
                                       Container(
                                         margin: EdgeInsets.only(left: 20),
                                         child: MyViews().myText(
-                                            '¥${MyCookie().userBean.balance.toStringAsFixed(2)}',
+                                            '¥${balanceDisplay(MyCookie().userBean.balance).toStringAsFixed(2)}',
                                             Colors.white,
                                             24),
                                       ),

+ 1 - 1
lib/paegs/mine_page/order_page/order_page.dart

@@ -217,7 +217,7 @@ class _OrderPageState extends State<OrderPage> {
                               (orders[index].type == orderTypeOfflineTransfer &&
                                   orders[index].buyerUid ==
                                       MyCookie().getUID()&&selectedIndex!=3) ||
-                              (orders[index].buyerUid == MyCookie().getUID()&&selectedIndex!=3),
+                              (orders[index].buyerUid == MyCookie().getUID()&&selectedIndex!=3&&orders[index].type != orderTypeShopOwnerCreated),
                           actionExtentRatio: 0.25,
                           secondaryActions: <Widget>[
                             SlideAction(

+ 1 - 1
lib/paegs/mine_page/referrer_page/referrer_flow_page.dart

@@ -120,7 +120,7 @@ class _ReferrerFlowPageState extends State<ReferrerFlowPage> {
                         Container(
                           margin: EdgeInsets.only(left: 10),
                           child: Text(
-                            '${widget.data.recommenderName}(${widget.data.recommenderUid})',
+                            '${widget.data.recommenderName}(${hideUID(widget.data.recommenderUid.toString())})',
                             style: TextStyle(color: Colors.white, fontSize: 15),
                           ),
                         ),

+ 11 - 11
lib/paegs/mine_page/wallet_page/withdraw_page/withdraw_page.dart

@@ -39,6 +39,7 @@ class _WithdrawPageState extends State<WithdrawPage> {
   bool showWeChat = false;
   bool showHandlingFee = false;
   double handlingFee = 0.0;
+  double balance = 0.0;
 
   @override
   void initState() {
@@ -59,14 +60,14 @@ class _WithdrawPageState extends State<WithdrawPage> {
           showAlipay =
               payWays[payWays.indexWhere((element) => element.way == 1)]
                   .withdraw;
-          if (MyCookie().userBean.wxOpenid.isNotEmpty &&
-              payWays[payWays.indexWhere((element) => element.way == 2)]
-                  .withdraw) {
-            withdrawalPath = 2;
-          } else if (MyCookie().userBean.aliPayAccount.isNotEmpty &&
+          if (MyCookie().userBean.aliPayAccount.isNotEmpty &&
               payWays[payWays.indexWhere((element) => element.way == 1)]
                   .withdraw) {
             withdrawalPath = 1;
+          }  else  if (MyCookie().userBean.wxOpenid.isNotEmpty &&
+              payWays[payWays.indexWhere((element) => element.way == 2)]
+                  .withdraw) {
+            withdrawalPath = 2;
           }
           setState(() {});
         }
@@ -299,7 +300,7 @@ class _WithdrawPageState extends State<WithdrawPage> {
                                     color: MyColors.c999999, fontSize: 15),
                                 children: [
                                   TextSpan(
-                                    text: '${MyCookie().userBean.balance.toStringAsFixed(2)}',
+                                    text: '${balanceDisplay(balance).toStringAsFixed(2)}',
                                     style: TextStyle(
                                         color: MyColors.cFF4233, fontSize: 15),
                                   ),
@@ -315,9 +316,7 @@ class _WithdrawPageState extends State<WithdrawPage> {
                                           fontSize: 15),
                                       recognizer: TapGestureRecognizer()
                                         ..onTap = () {
-                                          _controller.text = MyCookie()
-                                              .userBean
-                                              .balance
+                                          _controller.text = balance
                                               .toStringAsFixed(2);
                                           showH();
                                           setState(() {
@@ -505,7 +504,7 @@ class _WithdrawPageState extends State<WithdrawPage> {
     EasyLoading.show();
     try {
       double amount = double.parse(_controller.text.toString());
-      if (amount <= MyCookie().userBean.balance && amount >= minPerHand) {
+      if (amount <= balance && amount >= minPerHand) {
         var j = {
           'user_uid': MyCookie().getUID(),
           'way': withdrawalPath,
@@ -530,7 +529,7 @@ class _WithdrawPageState extends State<WithdrawPage> {
             withdrawalStatus = 0;
           });
         });
-      } else if (amount > MyCookie().userBean.balance) {
+      } else if (amount > balance) {
         setState(() {
           withdrawalStatus = 0;
         });
@@ -570,6 +569,7 @@ class _WithdrawPageState extends State<WithdrawPage> {
         UserBeanEntity entity =
             UserBeanEntity().fromJson(json.decode(response.data.toString()));
         MyCookie().userBean = entity.data.data[0];
+        balance = balanceDisplay(MyCookie().userBean.balance);
         EventBus().emit('userChange');
         setState(() {});
         if (withdrawalStatus == 2) {

+ 39 - 7
lib/paegs/pay_page/order_information_page.dart

@@ -43,6 +43,7 @@ class OrderInformationPage extends StatefulWidget {
   String commodityTitle;
 
   bool cancelOrder;
+  double discountAmount;
 
   OrderInformationPage(this.cancelOrder,
       {this.orderType,
@@ -56,7 +57,8 @@ class OrderInformationPage extends StatefulWidget {
       this.buyerPic,
       this.commodityCover,
       this.commodityTitle,
-      this.commodityCount});
+      this.commodityCount,
+      this.discountAmount=0.0});
 
   @override
   _OrderInformationPageState createState() => _OrderInformationPageState();
@@ -85,11 +87,13 @@ class _OrderInformationPageState extends State<OrderInformationPage> {
             if (!hE) {
               UserBalanceEntity balance =
                   UserBalanceEntity().fromJson(json.decode(re.data.toString()));
-              this.balance = balance.data;
+              this.balance = balanceDisplay(balance.data);
               if (widget.amount > balance.data) {
                 payWays.forEach((element) {
-                  if (element.pay) {
-                    payWay = element.way;
+                  if (payWay == 0) {
+                    if (element.pay) {
+                      payWay = element.way;
+                    }
                   }
                 });
               }
@@ -210,6 +214,34 @@ class _OrderInformationPageState extends State<OrderInformationPage> {
                     alignment: Alignment.centerLeft,
                     padding: EdgeInsets.all(10),
                   ),
+                  if(widget.discountAmount!=null&&widget.discountAmount!=0)
+                  Container(
+                    height: 10,
+                    color: MyColors.cEFEFEF,
+                  ),
+                  if(widget.discountAmount!=null&&widget.discountAmount!=0)
+                  Container(
+                    color: Colors.white,
+                    child: Row(
+                      children: [
+                        MyViews().myText('店铺折扣', MyColors.c333333, 16),
+                        Row(
+                          children: [
+                            Container(
+                              child: MyViews().myText(
+                                  widget.discountAmount.toStringAsFixed(2),
+                                  MyColors.c333333,
+                                  13),
+                              margin: EdgeInsets.only(left: 6, right: 6),
+                            ),
+                          ],
+                        )
+                      ],
+                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
+                    ),
+                    alignment: Alignment.centerLeft,
+                    padding: EdgeInsets.all(10),
+                  ),
                 ],
               ),
             ),
@@ -228,7 +260,7 @@ class _OrderInformationPageState extends State<OrderInformationPage> {
                       children: [
                         MyViews().myText('合计:', MyColors.c333333, 16),
                         MyViews().myText(
-                            '¥${couponData == null ? widget.amount.toStringAsFixed(2) : NumUtil.subtract(widget.amount, couponData.amount) < 0 ? 0.0.toStringAsFixed(2) : NumUtil.subtract(widget.amount, couponData.amount).toStringAsFixed(2)}',
+                            '¥${couponData == null ? NumUtil.subtract(widget.amount, widget.discountAmount).toStringAsFixed(2) : NumUtil.subtract(widget.amount, couponData.amount) < 0 ? 0.0.toStringAsFixed(2) : NumUtil.subtract(widget.amount, couponData.amount).toStringAsFixed(2)}',
                             MyColors.cFF4233,
                             18),
                       ],
@@ -608,7 +640,7 @@ class _OrderInformationPageState extends State<OrderInformationPage> {
     MyTools().toPage(
         context,
         PayPage(
-            widget.uid, widget.cancelOrder, widget.amount, payWay, couponData),
+            widget.uid, widget.cancelOrder, widget.amount, payWay, couponData,widget.discountAmount),
         (then) {
       if (then is int) {
         if (then == 1) {
@@ -725,7 +757,7 @@ class _OrderInformationPageState extends State<OrderInformationPage> {
                     ),
                     Container(
                       child: MyViews().myText(
-                          '当前积分${balance.toStringAsFixed(2)}',
+                          '当前积分${balanceDisplay(balance).toStringAsFixed(2)}',
                           MyColors.cFF4233,
                           16),
                       margin: EdgeInsets.only(left: 6, right: 6),

+ 16 - 14
lib/paegs/pay_page/pay_page.dart

@@ -20,8 +20,6 @@ import 'package:bbyyy/my_tools/my_colors.dart';
 import 'package:bbyyy/my_tools/my_tools.dart';
 import 'package:bbyyy/my_tools/my_views.dart';
 import 'package:bbyyy/paegs/mine_page/wallet_page/wallet_page.dart';
-import 'package:bbyyy/paegs/root_page/root_page.dart';
-import 'package:bbyyy/paegs/root_page/root_page_view.dart';
 import 'package:bbyyy/pay/pay_tools.dart';
 import 'package:flustars/flustars.dart';
 import 'package:flutter/cupertino.dart';
@@ -36,9 +34,10 @@ class PayPage extends StatefulWidget {
   double amount;
   int payWay;
   MyCouponBeanDataData couponData;
+  double discountAmount;
 
   PayPage(this.orderUID, this.cancelOrder, this.amount, this.payWay,
-      this.couponData);
+      this.couponData,this.discountAmount);
 
   @override
   _PayPageState createState() => _PayPageState();
@@ -374,16 +373,18 @@ class _PayPageState extends State<PayPage> with WidgetsBindingObserver {
   }
 
   pay() {
+    EasyLoading.show();
     getUserWalletBalance((re, hE) {
       if (!hE) {
         UserBalanceEntity balance =
             UserBalanceEntity().fromJson(json.decode(re.data.toString()));
+        double balanceAm = balanceDisplay(balance.data);
         if (widget.payWay == payWayWallet) {
-          if (balance.data >= widget.amount) {
+          if (balanceAm >= widget.amount) {
             payWithWallet();
           } else {
             if (widget.couponData != null) {
-              if (balance.data + widget.couponData.amount >= widget.amount) {
+              if (balanceAm + widget.couponData.amount >= widget.amount) {
                 payWithWallet();
               } else {
                 showToast('积分不足,请选择其他支付方式');
@@ -398,7 +399,7 @@ class _PayPageState extends State<PayPage> with WidgetsBindingObserver {
           }
         } else if (widget.payWay == payWayAliPay) {
           payWithAliPay();
-        }else if(widget.payWay == payWayWeChat){
+        } else if (widget.payWay == payWayWeChat) {
           payByWeChat();
         }
       }
@@ -526,19 +527,21 @@ class _PayPageState extends State<PayPage> with WidgetsBindingObserver {
   }
 
   void payByWeChat() {
-    payOrder(widget.couponData, widget.payWay, widget.orderUID, (re,hE){
-      if(!hE){
-        PayByWeChatBeanEntity entity = PayByWeChatBeanEntity().fromJson(json.decode(re.toString()));
+    payOrder(widget.couponData, widget.payWay, widget.orderUID, (re, hE) {
+      if (!hE) {
+        PayByWeChatBeanEntity entity =
+            PayByWeChatBeanEntity().fromJson(json.decode(re.toString()));
         EventBus().on('WeChatPaymentResponse', (arg) {
-          if(arg){
+          if (arg) {
             count = 30;
             showToast('支付成功');
             checkIfTheOrderIsPaid();
-          }else if(!arg){
+          } else if (!arg) {
             showToast('支付失败');
             if (widget.cancelOrder) {
               revokePayOrder(widget.orderUID);
             } else {
+
               resetOrder(widget.orderUID);
             }
             status = 2;
@@ -551,12 +554,11 @@ class _PayPageState extends State<PayPage> with WidgetsBindingObserver {
           partnerId: entity.data.partnerid,
           prepayId: entity.data.prepayid,
           packageValue: entity.data.package,
-          nonceStr:entity.data.noncestr,
+          nonceStr: entity.data.noncestr,
           timeStamp: int.parse(entity.data.timestamp),
           sign: entity.data.sign,
         );
       }
-    }, (e){}, context);
+    }, (e) {}, context);
   }
-
 }

+ 7 - 0
pubspec.lock

@@ -511,6 +511,13 @@ packages:
       url: "https://pub.flutter-io.cn"
     source: hosted
     version: "1.0.0"
+  number_precision:
+    dependency: "direct main"
+    description:
+      name: number_precision
+      url: "https://pub.flutter-io.cn"
+    source: hosted
+    version: "2.0.1+1"
   octo_image:
     dependency: transitive
     description:

+ 1 - 0
pubspec.yaml

@@ -74,6 +74,7 @@ dependencies:
   provider: ^6.0.0
   encrypt: ^5.0.1
   get: ^4.3.8
+  number_precision: ^2.0.1+1
 
 dev_dependencies:
   flutter_test:

Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.