From aac5e719df71934cd8bbed6e73562aae828621bf Mon Sep 17 00:00:00 2001 From: ztt <835303992@qq.com> Date: Mon, 26 Feb 2024 21:18:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8B=E5=8D=95=E6=8E=A5=E5=8F=A3=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/service/order/Checkout.php | 3 +++ app/common.php | 8 ++++++++ app/common/model/Order.php | 21 +++++++++++++++++++++ app/store/model/OrderRefund.php | 3 +-- 4 files changed, 33 insertions(+), 2 deletions(-) diff --git a/app/api/service/order/Checkout.php b/app/api/service/order/Checkout.php index b6a28900..af78868e 100644 --- a/app/api/service/order/Checkout.php +++ b/app/api/service/order/Checkout.php @@ -850,6 +850,9 @@ class Checkout extends BaseService 'order_status' => OrderStatusEnum::NORMAL, 'platform' => getPlatform(), 'store_id' => $this->storeId, + 'expect_receive_time' => $this->param['expect_receive_time'],//期待收货时间 + 'is_street_take' => $this->param['is_street_take'],//是否街边1-在 0-不在 + 'to_store_time' => $this->param['to_store_time'],//预计到店时间 ]; if ($order['delivery'] == DeliveryTypeEnum::EXPRESS) { $data['express_price'] = $order['expressPrice']; diff --git a/app/common.php b/app/common.php index 85804676..9da1220b 100644 --- a/app/common.php +++ b/app/common.php @@ -458,3 +458,11 @@ function getUrl($value, $host = ''){ return $value ? $host."/".$value : ""; } + +function calc_time($startTime, $endTime) { + $diffTime = ($endTime - $startTime); + if ($diffTime > 3600) { + return ""; + } + return date('i分钟s秒', (3600 - $diffTime)); +} diff --git a/app/common/model/Order.php b/app/common/model/Order.php index f7ff113f..a8082a41 100644 --- a/app/common/model/Order.php +++ b/app/common/model/Order.php @@ -57,6 +57,8 @@ class Order extends BaseModel 'state_text', // 售后单状态文字描述 'pay_method_text', //订单支付方式文字描述 'delivery_type_text', //配送方式文字描述 + 'time_text', //倒计时文字 + 'store_phone'//商家电话 ]; /** @@ -406,4 +408,23 @@ class Order extends BaseModel { return !empty(DeliveryType::data()[$data['delivery_type']])? DeliveryType::data()[$data['delivery_type']]['name']: '';//配送方式 } + + public function getTimeTextAttr($value, $data) : int + { + $diffTime = 60*60*24;//24小时倒计时 + // 付款状态 + if ($data['pay_status'] == PayStatusEnum::PENDING) { + return (($data['create_time'] + $diffTime) - time()) * 1000; + } + + // 收货状态 + if ($data['receipt_status'] == ReceiptStatusEnum::NOT_RECEIVED) { + return (($data['delivery_time'] + $diffTime) - time()) * 1000; + } + return 0; + } + + public function getStorePhoneAttr($value,$data) { + return Store::get($data['store_id'])->phone ?: ''; + } } diff --git a/app/store/model/OrderRefund.php b/app/store/model/OrderRefund.php index 198f79b4..4a4aa5b5 100644 --- a/app/store/model/OrderRefund.php +++ b/app/store/model/OrderRefund.php @@ -108,8 +108,6 @@ class OrderRefund extends OrderRefundModel foreach ($list['data'] as $key => $row) { $row['orderData']['pay_method_text'] = Method::data()[$row['orderData']['pay_method']]['name'];//支付方式 $row['orderData']['delivery_type_text'] = DeliveryType::data()[$row['orderData']['delivery_type']]['name'];//配送方式 -// $row['orderData']['order_status'] = $row['orderData']['status']; -// unset($row['orderData']['status']); $newRow = array_merge($row, $row['orderData']); $list['data'][$key] = $newRow; unset($list['data'][$key]['orderData']); @@ -160,6 +158,7 @@ class OrderRefund extends OrderRefundModel } // 起止时间 if (!empty($params['betweenTime'])) { + $params['betweenTime'] = explode(',', $params['betweenTime']); $times = between_time($params['betweenTime']); $filter[] = ['refund.create_time', '>=', $times['start_time']]; $filter[] = ['refund.create_time', '<', $times['end_time'] + 86400];