| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- import 'index.dart';
- import '../utils/index.dart';
- import '../models/index.dart';
- extension OrderAPI on Network {
- // confirm order
- Future<ConfirmInfo> confirmOrder(dynamic cartId) async {
- var resp = await Request.post('order/confirm', params: {"cartId": cartId});
- return ConfirmInfo.fromJson(resp);
- }
- // compute order info
- Future<ComputeInfo> 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<OrderInfo> 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<OrderInfo> 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");
-
- }
- }
|