最新服务器上的版本,以后用这个
zhangmeng
2023-04-20 539f96592c84e47cd260f30804d16b50ff060fd8
快递单号显示在订单列表页面
3 files modified
28 ■■■■ changed files
forms/common/order/CommonOrder.php 16 ●●●●● patch | view | raw | blame | history
forms/mall/order/BaseOrderForm.php 9 ●●●● patch | view | raw | blame | history
views/components/app-order.php 3 ●●●●● patch | view | raw | blame | history
forms/common/order/CommonOrder.php
@@ -173,7 +173,21 @@
            ->andWhere(['!=', 'express', ''])
            ->orderBy(['created_at' => SORT_DESC])
            ->one();
        return $order ? $order->express : '';
    }
    // 获取最后一次发货的快递数据实体
    public function getLastExpressModel()
    {
        $order = OrderDetailExpress::find()->andWhere([
            'mall_id' => \Yii::$app->mall->id,
            'mch_id' => \Yii::$app->user->identity->mch_id,
            'send_type' => 1,
        ])
            ->andWhere(['!=', 'express', ''])
            ->orderBy(['created_at' => SORT_DESC])
            ->one();
        //\Yii::warning('快递 数据:'.($order ? $order->express_no : '未发货'));
        return $order;
    }
}
forms/mall/order/BaseOrderForm.php
@@ -146,7 +146,7 @@
            ->asArray()
            ->all();
        $lastExpress = (new CommonOrder)->getLastExpress();
        //$lastExpress = (new CommonOrder)->getLastExpress();
        $userList = User::find()->with(['userInfo', 'userPlatform'])
            ->where(['id' => array_column($list, 'user_id')])
@@ -278,7 +278,12 @@
            $item['new_express_single'] = $order->getExpressSingleList($item);
            $item['cancel_data'] = $item['cancel_data'] ? json_decode($item['cancel_data'], true) : [];
            $item['send_template_discount_price'] = price_format($item['total_goods_original_price'] + $item['express_price'] - $item['total_pay_price']);
            $item['last_express'] = $lastExpress;
            // 快递信息
            //$item['last_express'] = $lastExpress;
            $lastExpressModel = (new CommonOrder)->getLastExpressModel();
            $item['last_express'] = $lastExpressModel?$lastExpressModel->express:'';
            $item['last_express_no'] = $lastExpressModel?$lastExpressModel->express_no:'';
        }
        $menuList = \Yii::$app->role->getShareMenu();
views/components/app-order.php
@@ -491,6 +491,9 @@
                                <el-tag size="small" type="success" v-if="item.is_sale == 1">已完成</el-tag>
                                <el-tag size="small" type="danger" v-if="item.cancel_status == 1">已取消</el-tag>
                                <el-tag size="small" type="danger" v-else-if="item.cancel_status == 2">申请取消</el-tag>
                                <el-tag size="small" type="danger" v-if="item.is_send == 1 && item.is_confirm == 0">
                                    {{ item.last_express }} : {{ item.last_express_no }}
                                </el-tag>
                            </template>
                            <slot name="orderTag" :order="item"></slot>
                        </div>