{"version":3,"file":"order.js","sources":["../../../../../../src/sheep/api/trade/order.js"],"sourcesContent":["import request from '@/sheep/request'\r\nimport { isEmpty } from '@/sheep/helper/utils'\r\n\r\nconst OrderApi = {\r\n // 计算订单信息\r\n settlementOrder: (data) => {\r\n const data2 = {\r\n ...data,\r\n }\r\n // 移除多余字段\r\n if (!(data.couponId > 0)) {\r\n delete data2.couponId\r\n }\r\n if (!(data.addressId > 0)) {\r\n delete data2.addressId\r\n }\r\n if (!(data.pickUpStoreId > 0)) {\r\n delete data2.pickUpStoreId\r\n }\r\n if (isEmpty(data.receiverName)) {\r\n delete data2.receiverName\r\n }\r\n if (isEmpty(data.receiverMobile)) {\r\n delete data2.receiverMobile\r\n }\r\n if (!(data.combinationActivityId > 0)) {\r\n delete data2.combinationActivityId\r\n }\r\n if (!(data.combinationHeadId > 0)) {\r\n delete data2.combinationHeadId\r\n }\r\n if (!(data.seckillActivityId > 0)) {\r\n delete data2.seckillActivityId\r\n }\r\n // 解决 SpringMVC 接受 List 参数的问题\r\n delete data2.items\r\n for (let i = 0; i < data.items.length; i++) {\r\n data2[encodeURIComponent('items[' + i + '' + '].skuId')] = data.items[i].skuId + ''\r\n data2[encodeURIComponent('items[' + i + '' + '].count')] = data.items[i].count + ''\r\n if (data.items[i].cartId) {\r\n data2[encodeURIComponent('items[' + i + '' + '].cartId')] = data.items[i].cartId + ''\r\n }\r\n }\r\n const queryString = Object.keys(data2)\r\n .map((key) => key + '=' + data2[key])\r\n .join('&')\r\n return request({\r\n url: `/trade/order/settlement?${queryString}`,\r\n method: 'GET',\r\n custom: {\r\n showError: true,\r\n showLoading: true,\r\n },\r\n })\r\n },\r\n // 创建订单\r\n createOrder: (data) => {\r\n return request({\r\n url: `/trade/order/create`,\r\n method: 'POST',\r\n data,\r\n })\r\n },\r\n // 获得订单\r\n getOrder: (id) => {\r\n return request({\r\n url: `/trade/order/get-detail`,\r\n method: 'GET',\r\n params: {\r\n id,\r\n },\r\n custom: {\r\n showLoading: false,\r\n },\r\n })\r\n },\r\n // 订单列表\r\n getOrderPage: (params) => {\r\n return request({\r\n url: '/trade/order/page',\r\n method: 'GET',\r\n params,\r\n custom: {\r\n showLoading: false,\r\n },\r\n })\r\n },\r\n // 确认收货\r\n receiveOrder: (id) => {\r\n return request({\r\n url: `/trade/order/receive`,\r\n method: 'PUT',\r\n params: {\r\n id,\r\n },\r\n })\r\n },\r\n // 取消订单\r\n cancelOrder: (id) => {\r\n return request({\r\n url: `/trade/order/cancel`,\r\n method: 'DELETE',\r\n params: {\r\n id,\r\n },\r\n })\r\n },\r\n // 删除订单\r\n deleteOrder: (id) => {\r\n return request({\r\n url: `/trade/order/delete`,\r\n method: 'DELETE',\r\n params: {\r\n id,\r\n },\r\n })\r\n },\r\n // 获得交易订单的物流轨迹\r\n getOrderExpressTrackList: (id) => {\r\n return request({\r\n url: `/trade/order/get-express-track-list`,\r\n method: 'GET',\r\n params: {\r\n id,\r\n },\r\n })\r\n },\r\n // 获得交易订单数量\r\n getOrderCount: () => {\r\n return request({\r\n url: '/trade/order/get-count',\r\n method: 'GET',\r\n custom: {\r\n showLoading: false,\r\n auth: true,\r\n },\r\n })\r\n },\r\n // 创建单个评论\r\n createOrderItemComment: (data) => {\r\n return request({\r\n url: `/trade/order/item/create-comment`,\r\n method: 'POST',\r\n data,\r\n })\r\n },\r\n}\r\n\r\nexport default OrderApi\r\n"],"names":["isEmpty","request"],"mappings":";;;;;;;;;;;;;;;;;;;AAGK,MAAC,WAAW;AAAA;AAAA,EAEf,iBAAiB,CAAC,SAAS;AACzB,UAAM,QAAQ,mBACT;AAGL,QAAI,EAAE,KAAK,WAAW,IAAI;AACxB,aAAO,MAAM;AAAA,IACd;AACD,QAAI,EAAE,KAAK,YAAY,IAAI;AACzB,aAAO,MAAM;AAAA,IACd;AACD,QAAI,EAAE,KAAK,gBAAgB,IAAI;AAC7B,aAAO,MAAM;AAAA,IACd;AACD,QAAIA,mBAAO,QAAC,KAAK,YAAY,GAAG;AAC9B,aA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