import 'index.dart'; import '../utils/index.dart'; import '../models/index.dart'; extension OrderAPI on Network { // confirm order Future confirmOrder(dynamic cartId) async { var resp = await Request.post('order/confirm', params: {"cartId": cartId}); return ConfirmInfo.fromJson(resp); } // compute order info Future computedOrder(String id, { int addressId, int couponId = 0, int shopType = 1, String payType, double useIntegral }) async { var data = { "addressId": addressId, "couponId": couponId, "payType": payType, "shipping_type": shopType, "useIntegral": useIntegral }; var resp = await Request.post("order/computed/$id", params: data); return ComputeInfo.fromJson(resp); } // get order detail info Future orderDetail() async { var resp = await Request.post("order/detail/"); } // pay order from id Future payOrder({String payType, String orderId}) async { var data = { "from": "app", "payType": payType, "uni": orderId }; var resp = await Request.post("order/pay", params: data); return OrderInfo.fromJson(resp); } // create order Future createOrder({String orderKey, String payType, int integral = 0, int address}) async { var data = { "addressId": address, "bargainId": 0, "combinationId": 0, "couponId": 0, "from": "app", "mark": "", "payType": payType, "phone": "", "pinkId": 0, "real_name": "", "seckill_id": 0, "shipping_type": 1, "useIntegral": integral, }; var resp = await Request.post('order/create/$orderKey', params: data); return OrderInfo.fromJson(resp); } Future getOrderList({int page = 1, int limit=20, int type = 0}) async { var resp = await Request.get("order/list?page=$page&limit=$limit&type=$type"); } }