diff --git a/pages/order/order-detail/index.js b/pages/order/order-detail/index.js index 8c09aee..5915910 100644 --- a/pages/order/order-detail/index.js +++ b/pages/order/order-detail/index.js @@ -1,15 +1,26 @@ -import { formatTime } from '../../../utils/util'; -import { OrderStatus, LogisticsIconMap } from '../config'; +import { + formatTime +} from '../../../utils/util'; +import { + OrderStatus, + LogisticsIconMap +} from '../config'; import { fetchBusinessTime, fetchOrderDetail, } from '../../../services/order/orderDetail'; +import { + getOrderDetails +} from '../../../services/order/getOrderDetails'; import Toast from 'tdesign-miniprogram/toast/index'; -import { getAddressPromise } from '../../usercenter/address/list/util'; +import { + getAddressPromise +} from '../../usercenter/address/list/util'; Page({ data: { pageLoading: true, + orderGuid: '', order: {}, // 后台返回的原始数据 _order: {}, // 内部使用和提供给 order-card 的数据 storeDetail: {}, @@ -23,7 +34,9 @@ Page({ }, onLoad(query) { - this.orderNo = query.orderNo; + this.setData({ + orderGuid: query.orderGuid + }) this.init(); this.navbar = this.selectComponent('#navbar'); this.pullDownRefresh = this.selectComponent('#wr-pull-down-refresh'); @@ -33,7 +46,9 @@ Page({ // 当从其他页面返回,并且 backRefresh 被置为 true 时,刷新数据 if (!this.data.backRefresh) return; this.onRefresh(); - this.setData({ backRefresh: false }); + this.setData({ + backRefresh: false + }); }, onPageScroll(e) { @@ -48,11 +63,15 @@ Page({ // 页面初始化,会展示pageLoading init() { - this.setData({ pageLoading: true }); + this.setData({ + pageLoading: true + }); this.getStoreDetail(); this.getDetail() .then(() => { - this.setData({ pageLoading: false }); + this.setData({ + pageLoading: false + }); }) .catch((e) => { console.error(e); @@ -72,27 +91,30 @@ Page({ // 页面刷新,展示下拉刷新 onPullDownRefresh_(e) { - const { callback } = e.detail; + const { + callback + } = e.detail; return this.getDetail().then(() => callback && callback()); }, getDetail() { const params = { - parameter: this.orderNo, + OrderGuid: this.data.orderGuid, }; - return fetchOrderDetail(params).then((res) => { + return getOrderDetails(params).then((res) => { + console.log(res.data, 'res'); const order = res.data; const _order = { id: order.orderId, orderNo: order.orderNo, parentOrderNo: order.parentOrderNo, - storeId: order.storeId, + // storeId: order.storeId, storeName: order.storeName, status: order.orderStatus, statusDesc: order.orderStatusName, amount: order.paymentAmount, - totalAmount: order.goodsAmountApp, - logisticsNo: order.logisticsVO.logisticsNo, + totalAmount: order.goodsAmount, + // logisticsNo: order.logisticsVO.logisticsNo, goodsList: (order.orderItemVOs || []).map((goods) => Object.assign({}, goods, { id: goods.id, @@ -103,15 +125,18 @@ Page({ specs: (goods.specifications || []).map((s) => s.specValue), price: goods.tagPrice ? goods.tagPrice : goods.actualPrice, // 商品销售单价, 优先取限时活动价 num: goods.buyQuantity, - titlePrefixTags: goods.tagText ? [{ text: goods.tagText }] : [], + titlePrefixTags: goods.tagText ? [{ + text: goods.tagText + }] : [], buttons: goods.buttonVOs || [], }), ), buttons: order.buttonVOs || [], createTime: order.createTime, receiverAddress: this.composeAddress(order), - groupInfoVo: order.groupInfoVo, + // groupInfoVo: order.groupInfoVo, }; + console.log(_order); this.setData({ order, _order, @@ -120,15 +145,13 @@ Page({ 'YYYY-MM-DD HH:mm', ), // 格式化订单创建时间 countDownTime: this.computeCountDownTime(order), - addressEditable: - [OrderStatus.PENDING_PAYMENT, OrderStatus.PENDING_DELIVERY].includes( - order.orderStatus, - ) && order.orderSubStatus !== -1, // 订单正在取消审核时不允许修改地址(但是返回的状态码与待发货一致) + addressEditable: [OrderStatus.PENDING_PAYMENT, OrderStatus.PENDING_DELIVERY].includes( + order.orderStatus, + ) && order.orderSubStatus !== -1, // 订单正在取消审核时不允许修改地址(但是返回的状态码与待发货一致) isPaid: !!order.paymentVO.paySuccessTime, invoiceStatus: this.datermineInvoiceStatus(order), invoiceDesc: order.invoiceDesc, - invoiceType: - order.invoiceVO?.invoiceType === 5 ? '电子普通发票' : '不开发票', //是否开票 0-不开 5-电子发票 + invoiceType: order.invoiceVO?.invoiceType === 5 ? '电子普通发票' : '不开发票', //是否开票 0-不开 5-电子发票 logisticsNodes: this.flattenNodes(order.trajectoryVos || []), }); }); @@ -160,12 +183,12 @@ Page({ // 拼接省市区 composeAddress(order) { return [ - //order.logisticsVO.receiverProvince, - order.logisticsVO.receiverCity, - order.logisticsVO.receiverCountry, - order.logisticsVO.receiverArea, - order.logisticsVO.receiverAddress, - ] + //order.logisticsVO.receiverProvince, + order.logisticsVO.receiverCity, + order.logisticsVO.receiverCountry, + order.logisticsVO.receiverArea, + order.logisticsVO.receiverAddress, + ] .filter((s) => !!s) .join(' '); }, @@ -176,7 +199,9 @@ Page({ storeTel: res.data.telphone, storeBusiness: res.data.businessTime.join('\n'), }; - this.setData({ storeDetail }); + this.setData({ + storeDetail + }); }); }, @@ -184,14 +209,17 @@ Page({ // 返回时间若是大于2020.01.01,说明返回的是关闭时间,否则说明返回的直接就是剩余时间 computeCountDownTime(order) { if (order.orderStatus !== OrderStatus.PENDING_PAYMENT) return null; - return order.autoCancelTime > 1577808000000 - ? order.autoCancelTime - Date.now() - : order.autoCancelTime; + return order.autoCancelTime > 1577808000000 ? + order.autoCancelTime - Date.now() : + order.autoCancelTime; }, onCountDownFinish() { //this.setData({ countDownTime: -1 }); - const { countDownTime, order } = this.data; + const { + countDownTime, + order + } = this.data; if ( countDownTime > 0 || (order && order.groupInfoVo && order.groupInfoVo.residueTime > 0) @@ -201,9 +229,13 @@ Page({ }, onGoodsCardTap(e) { - const { index } = e.currentTarget.dataset; + const { + index + } = e.currentTarget.dataset; const goods = this.data.order.orderItemVOs[index]; - wx.navigateTo({ url: `/pages/goods/details/index?spuId=${goods.spuId}` }); + wx.navigateTo({ + url: `/pages/goods/details/index?spuId=${goods.spuId}` + }); }, onEditAddressTap() { @@ -269,7 +301,9 @@ Page({ /** 跳转拼团详情/分享页*/ toGrouponDetail() { - wx.showToast({ title: '点击了拼团' }); + wx.showToast({ + title: '点击了拼团' + }); }, clickService() { @@ -285,4 +319,4 @@ Page({ url: `/pages/order/invoice/index?orderNo=${this.orderNo}`, }); }, -}); +}); \ No newline at end of file diff --git a/pages/order/order-detail/index.wxml b/pages/order/order-detail/index.wxml index f27bf9e..8414f60 100644 --- a/pages/order/order-detail/index.wxml +++ b/pages/order/order-detail/index.wxml @@ -8,24 +8,14 @@ 拼团剩余 - + 过时自动取消 {{order.orderSatusRemark || ''}} 剩 - + 支付,过时订单将会取消 超时未支付 @@ -54,23 +44,8 @@ - - + + @@ -107,12 +82,7 @@ {{isPaid ? '实付' : '应付'}} - + @@ -131,13 +101,13 @@ - + 备注 @@ -145,10 +115,10 @@ - + @@ -156,4 +126,4 @@ - + \ No newline at end of file diff --git a/pages/order/order-list/index.js b/pages/order/order-list/index.js index 0a9d23a..a218081 100644 --- a/pages/order/order-list/index.js +++ b/pages/order/order-list/index.js @@ -130,6 +130,8 @@ Page({ case 50: _status = 4 break; + default: + _status = 0 } const params = { pageIndex: this.page.num, @@ -141,286 +143,19 @@ Page({ listLoading: 1 }); return getOrderList(params) - .then((_res) => { + .then((res) => { // console.log(res); - const res = { - "code": 200, - "msg": "SUCCESS", - "data": { - "pageSize": 10, - "pageIndex": 1, - "totalNum": 9, - "totalPage": 1, - "result": [{ - "orderId": 17, - "orderGuid": "1714904293930307584", - "orderNo": "Q2310191520196710002", - "goodsList": [{ - "goodsGuId": "1672964367177617408", - "thumb": "http://shop.back.aerwen.net/prod-api//Uploads/Goods/20231010/BD3521D2710CF9CD.jpg", - "title": "韩哚馨(HANDUOXIN)韩哚馨 感学院风短袖茶歇法式连衣裙子碎花长裙2023新款", - "skuId": 232, - "specifications": [{ - "specTitle": "规格", - "specValue": "常规款加绒" - }], - "price": 160.00, - "buyQuantity": 1 - }], - "goodsTotalAmoun": 160.00, - "orderAmount": 155.00, - "payPrice": 0.01, - "expressPrice": 0.00, - "payStatus": 2, - "deliveryStatus": 1, - "receiptStatus": 1, - "orderStatus": 2, - "isComment": 1, - "status": 0, - "statusName": null - }, - { - "orderId": 16, - "orderGuid": "1714900618189082624", - "orderNo": "Q2310191505433070002", - "goodsList": [{ - "goodsGuId": "1672964367177617408", - "thumb": "http://shop.back.aerwen.net/prod-api//Uploads/Goods/20231010/BD3521D2710CF9CD.jpg", - "title": "韩哚馨(HANDUOXIN)韩哚馨 感学院风短袖茶歇法式连衣裙子碎花长裙2023新款", - "skuId": 232, - "specifications": [{ - "specTitle": "规格", - "specValue": "常规款加绒" - }], - "price": 160.00, - "buyQuantity": 3 - }], - "goodsTotalAmoun": 480.00, - "orderAmount": 475.00, - "payPrice": 0.01, - "expressPrice": 0.00, - "payStatus": 2, - "deliveryStatus": 1, - "receiptStatus": 1, - "orderStatus": 1, - "isComment": 1, - "status": 2, - "statusName": "待发货" - }, - { - "orderId": 15, - "orderGuid": "1714899117605523456", - "orderNo": "Q2310191459455300002", - "goodsList": [{ - "goodsGuId": "1672961736711475200", - "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231009/2E9F7284DE854663.jpg", - "title": "2024新款裙子夏季女法式桔梗碎花公主裙吊带连衣裙仙气仙森系 连衣裙 均码", - "skuId": 220, - "specifications": [{ - "specTitle": "颜色分类", - "specValue": "碎花【收藏优先发货】" - }, - { - "specTitle": "尺码 ", - "specValue": "S【建议70-95斤】" - } - ], - "price": 65.30, - "buyQuantity": 1 - }], - "goodsTotalAmoun": 65.30, - "orderAmount": 60.30, - "payPrice": 0.01, - "expressPrice": 0.00, - "payStatus": 2, - "deliveryStatus": 1, - "receiptStatus": 1, - "orderStatus": 1, - "isComment": 1, - "status": 2, - "statusName": "待发货" - }, - { - "orderId": 13, - "orderGuid": "1714355378755604480", - "orderNo": "Q2310180259081130005", - "goodsList": [{ - "goodsGuId": "1680467517816049664", - "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231014/FFCD5093C92A62B1.jpg", - "title": "三只松鼠肉松饼1000g 黄金肉松饼早餐代餐休闲零食办公室点心面包量贩箱装", - "skuId": 0, - "specifications": null, - "price": 9.90, - "buyQuantity": 2 - }], - "goodsTotalAmoun": 19.80, - "orderAmount": 3001.80, - "payPrice": 19.80, - "expressPrice": 13.00, - "payStatus": 2, - "deliveryStatus": 1, - "receiptStatus": 1, - "orderStatus": 1, - "isComment": 1, - "status": 2, - "statusName": "待发货" - }, - { - "orderId": 14, - "orderGuid": "1714355379099537408", - "orderNo": "Q2310180259081130006", - "goodsList": [{ - "goodsGuId": "1673671239077597184", - "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231014/666229CAA9F1B6AE.jpg", - "title": "三星 Galaxy S21 5G(SM-G9910)双模5G 骁龙888 超高清专业摄像 120Hz护目屏 游戏手机 8G+128G", - "skuId": 235, - "specifications": [{ - "specTitle": "颜色", - "specValue": "梵梦紫" - }], - "price": 2969.00, - "buyQuantity": 1 - }], - "goodsTotalAmoun": 2969.00, - "orderAmount": 3001.80, - "payPrice": 2969.00, - "expressPrice": 13.00, - "payStatus": 2, - "deliveryStatus": 1, - "receiptStatus": 1, - "orderStatus": 1, - "isComment": 1, - "status": 2, - "statusName": "待发货" - }, - { - "orderId": 9, - "orderGuid": "1713568156318044160", - "orderNo": "Q2310152250589130002", - "goodsList": [{ - "goodsGuId": "1672961736711475200", - "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231009/2E9F7284DE854663.jpg", - "title": "2024新款裙子夏季女法式桔梗碎花公主裙吊带连衣裙仙气仙森系 连衣裙 均码", - "skuId": 220, - "specifications": [{ - "specTitle": "颜色分类", - "specValue": "碎花【收藏优先发货】" - }, - { - "specTitle": "尺码 ", - "specValue": "S【建议70-95斤】" - } - ], - "price": 65.30, - "buyQuantity": 2 - }], - "goodsTotalAmoun": 130.60, - "orderAmount": 130.60, - "payPrice": 2.00, - "expressPrice": 0.00, - "payStatus": 2, - "deliveryStatus": 2, - "receiptStatus": 1, - "orderStatus": 1, - "isComment": 1, - "status": 3, - "statusName": "待收货" - }, - { - "orderId": 7, - "orderGuid": "1713125767367495680", - "orderNo": "Q2310141733050100001", - "goodsList": [{ - "goodsGuId": "1672964367177617408", - "thumb": "http://shop.back.aerwen.net/prod-api//Uploads/Goods/20231010/BD3521D2710CF9CD.jpg", - "title": "韩哚馨(HANDUOXIN)韩哚馨 感学院风短袖茶歇法式连衣裙子碎花长裙2023新款", - "skuId": 231, - "specifications": [{ - "specTitle": "规格", - "specValue": "爆款加绒" - }], - "price": 199.00, - "buyQuantity": 1 - }], - "goodsTotalAmoun": 199.00, - "orderAmount": 199.00, - "payPrice": 1.00, - "expressPrice": 0.00, - "payStatus": 2, - "deliveryStatus": 1, - "receiptStatus": 1, - "orderStatus": 1, - "isComment": 1, - "status": 2, - "statusName": "待发货" - }, - { - "orderId": 6, - "orderGuid": "1713124559743488000", - "orderNo": "Q2310141728171060001", - "goodsList": [{ - "goodsGuId": "1680467515018448896", - "thumb": "http://shop.back.aerwen.net/prod-api/Uploads/Goods/20231014/EF0885623F14CA0C.jpg", - "title": "双汇 火腿肠 玉米热狗40g*8支 网兜装 出游 露营款", - "skuId": 0, - "specifications": null, - "price": 13.00, - "buyQuantity": 10 - }], - "goodsTotalAmoun": 130.00, - "orderAmount": 143.00, - "payPrice": 1.00, - "expressPrice": 13.00, - "payStatus": 2, - "deliveryStatus": 1, - "receiptStatus": 1, - "orderStatus": 1, - "isComment": 1, - "status": 2, - "statusName": "待发货" - }, - { - "orderId": 5, - "orderGuid": "1713121315600338944", - "orderNo": "Q2310141715235960001", - "goodsList": [{ - "goodsGuId": "1672964367177617408", - "thumb": "http://shop.back.aerwen.net/prod-api//Uploads/Goods/20231010/BD3521D2710CF9CD.jpg", - "title": "韩哚馨(HANDUOXIN)韩哚馨 感学院风短袖茶歇法式连衣裙子碎花长裙2023新款", - "skuId": 231, - "specifications": [{ - "specTitle": "规格", - "specValue": "爆款加绒" - }], - "price": 199.00, - "buyQuantity": 1 - }], - "goodsTotalAmoun": 199.00, - "orderAmount": 199.00, - "payPrice": 0.00, - "expressPrice": 0.00, - "payStatus": 1, - "deliveryStatus": 1, - "receiptStatus": 1, - "orderStatus": 1, - "isComment": 1, - "status": 1, - "statusName": "待付款" - } - ], - "extra": {} - } - } this.page.num++; let orderList = []; if (res && res.data && res.data.result) { orderList = (res.data.result || []).map((order) => { return { id: order.orderId, + Guid: order.orderGuid, orderNo: order.orderNo, // parentOrderNo: order.parentOrderNo, - storeId: order.storeId, - storeName: order.storeName, + // storeId: order.storeId, + // storeName: order.storeName, status: order.orderStatus, statusDesc: order.statusName, amount: order.payPrice, @@ -428,11 +163,11 @@ Page({ // logisticsNo: order.logisticsVO.logisticsNo, // createTime: order.createTime, goodsList: (order.goodsList || []).map((goods) => ({ - id: goods.id, + id: goods.goodsGuId, thumb: goods.thumb, title: goods.title, skuId: goods.skuId, - spuId: goods.spuId, + // spuId: goods.spuId, specs: (goods.specifications || []).map( (spec) => spec.specValue, ), @@ -443,7 +178,7 @@ Page({ }] : [], })), buttons: order.buttonVOs || [], - groupInfoVo: order.groupInfoVo, + // groupInfoVo: order.groupInfoVo, freightFee: order.expressPrice, }; }); @@ -476,15 +211,14 @@ Page({ }, onTabChange(e) { - console.log(e); + // console.log(e); const { value } = e.detail; this.setData({ status: value, }); - console.log(value); - // console.log(value,'asdasd'); + // console.log(value); this.refreshList(value); }, @@ -531,7 +265,7 @@ Page({ order } = e.currentTarget.dataset; wx.navigateTo({ - url: `/pages/order/order-detail/index?orderNo=${order.orderNo}`, + url: `/pages/order/order-detail/index?orderGuid=${order.Guid}`, }); }, }); \ No newline at end of file diff --git a/services/order/getOrderDetails.js b/services/order/getOrderDetails.js new file mode 100644 index 0000000..3593899 --- /dev/null +++ b/services/order/getOrderDetails.js @@ -0,0 +1,21 @@ +import { + request +} from '../_utils/request'; + + +/* 获取物流公司列表 */ +export async function getOrderDetails(data) { + return new Promise((resolve, reject) => { + request({ + url: `OrderApi/getOrderDetails`, + method: 'Get', + data: data, + success: function (res) { + resolve(res); + }, + fail: function (error) { + reject(error); + } + }); + }); +}