Blame view

app-wx/modules/order/controllers/CustomerController.php 2.98 KB
3a892ee0   xu   app-wx(v0.1.0 bui...
1
2
3
4
<?php

namespace app\wx\modules\order\controllers;

1de3211f   xu   app-wx(v0.1.0 bui...
5
use Yii;
bb9baa4c   xu   app-wx v0.1.0 bui...
6

1de3211f   xu   app-wx(v0.1.0 bui...
7

f3ed8f51   xu   app-wx(v0.1.0 bui...
8
9
10
use domain\order\RepairOrderRepository;
use domain\order\RepairOrderStatus;

3a892ee0   xu   app-wx(v0.1.0 bui...
11
12
13
14
15
use stdClass;

/**
 * 控制器
 */
bb9baa4c   xu   app-wx v0.1.0 bui...
16
class CustomerController extends CustomerBaseController
3a892ee0   xu   app-wx(v0.1.0 bui...
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
    /**
     * 首页
     */
    public function actionIndex()
    {
        return $this->render('/default/cindex');
    }

    /**
     * @return string
     */
    public function actionOrderDetails()
    {
        $e = new stdClass();
        $e->success = false;
        $e->message = 'ok';
        $orderUUId = $this->request->post('id');
        $md5Mobile = $this->request->post('sn');

        $orderModel = RepairOrderRepository::findOne(['uuid' => $orderUUId]);
6bece648   xu   app-wx(v0.1.0 bui...
38
        if (empty($orderModel)) {
3a892ee0   xu   app-wx(v0.1.0 bui...
39
40
41
            $e->message = '找不到该订单';
            return $this->renderJson($e);
        }
f3ed8f51   xu   app-wx(v0.1.0 bui...
42
        $brokenImageModels = RepairOrderRepository::findOrderImageAll(['repair_order_id' => $orderModel->id]);
3a892ee0   xu   app-wx(v0.1.0 bui...
43
44
45
46
        $brokenImages = [];
        $baseURL = Yii::$app->request->getHostInfo();
        foreach($brokenImageModels as $k => $v) {
            $brokenImages[] = $baseURL.'/'.$v->image_path;
f3ed8f51   xu   app-wx(v0.1.0 bui...
47
48
        }
        $totalPrice = $orderModel->order_price;
3a892ee0   xu   app-wx(v0.1.0 bui...
49
50
51
        $rPlans = RepairOrderRepository::findOrderPlansAll(['repair_order_id' => $orderModel->id]);
        $repairPlans = [];
        foreach($rPlans as $k => $plan) {
1de3211f   xu   app-wx(v0.1.0 bui...
52
53
54
55
            $repairPlans[] = ['plan' => $plan['repair_plan'] ,'price' => $plan['price']];
        }
        $fImages = RepairOrderRepository::findOrderFinishImageAll(['repair_order_id' => $orderModel->id]);
        $finishImages = [];
3a892ee0   xu   app-wx(v0.1.0 bui...
56
57
        foreach($fImages as $k => $image) {
            $finishImages[] = $baseURL.'/'.$image['image_path'];
f3ed8f51   xu   app-wx(v0.1.0 bui...
58
        }
3a892ee0   xu   app-wx(v0.1.0 bui...
59
60
61
62
        $hasComment = false;

        $e->success = true;
        $e->item = [
f3ed8f51   xu   app-wx(v0.1.0 bui...
63
            'carNo'     => $orderModel->car_no,
3a892ee0   xu   app-wx(v0.1.0 bui...
64
65
            'carModel'  => $orderModel->car_model,
            'customer'  => $orderModel->customer,
1de3211f   xu   app-wx(v0.1.0 bui...
66
67
68
69
            'mobile'    => '1*****'.substr($orderModel->contact_mobile,7,4),
            'preRepair' => $orderModel->predict_fault,
            'repairPrice'   => $orderModel->predict_price.'元',
            'preFinishDate' => date('Y-m-d H:00', $orderModel->predict_finish_time),
3a892ee0   xu   app-wx(v0.1.0 bui...
70
            'orderDateTime' => date('Y-m-d H:00', $orderModel->created_at),
f3ed8f51   xu   app-wx(v0.1.0 bui...
71
            'status'        => RepairOrderStatus::getEnLabel($orderModel->status),
3a892ee0   xu   app-wx(v0.1.0 bui...
72
            'hasComment'    => $hasComment,
f3ed8f51   xu   app-wx(v0.1.0 bui...
73
74
75
            'brokenImages'  => $brokenImages,
            'repairPlans'   => $repairPlans,
            'totalPrice'    => $totalPrice,
afd2f743   xu   app-ht(v0.0.1 bui...
76
77
78
79
80
81
82
            'finishImages'  => $finishImages
        ];

        return $this->renderJson($e);
    }

    /**
f3ed8f51   xu   app-wx(v0.1.0 bui...
83
     * @return string
32926e46   xu   app-wx(v0.1.0 bui...
84
85
86
87
88
89
90
91
     */
    public function actionSubmitRate()
    {
        $e = new stdClass();
        $e->success = false;
        $e->message = 'ok';
        $star = $this->request->post('star');
        $comment = $this->request->post('comment');
3a892ee0   xu   app-wx(v0.1.0 bui...
92
93
94
95
96
97

        //echo $star.'_'.$comment;
        $e->success = true;
        return $this->renderJson($e);
    }

32926e46   xu   app-wx(v0.1.0 bui...
98
} 
3a892ee0   xu   app-wx(v0.1.0 bui...

f3ed8f51   xu   app-wx(v0.1.0 bui...

3a892ee0   xu   app-wx(v0.1.0 bui...

afd2f743   xu   app-ht(v0.0.1 bui...

f3ed8f51   xu   app-wx(v0.1.0 bui...

3a892ee0   xu   app-wx(v0.1.0 bui...

bb9baa4c   xu   app-wx v0.1.0 bui...

afd2f743   xu   app-ht(v0.0.1 bui...

f3ed8f51   xu   app-wx(v0.1.0 bui...

d11ff394   xu   app-ht(v0.0.1 bui...

f3ed8f51   xu   app-wx(v0.1.0 bui...

d11ff394   xu   app-ht(v0.0.1 bui...

afd2f743   xu   app-ht(v0.0.1 bui...

f3ed8f51   xu   app-wx(v0.1.0 bui...

afd2f743   xu   app-ht(v0.0.1 bui...

f3ed8f51   xu   app-wx(v0.1.0 bui...

afd2f743   xu   app-ht(v0.0.1 bui...

c6779489   xu   app-wx(v0.1.0 bui...

afd2f743   xu   app-ht(v0.0.1 bui...

c6779489   xu   app-wx(v0.1.0 bui...

6bece648   xu   app-wx(v0.1.0 bui...

f3ed8f51   xu   app-wx(v0.1.0 bui...

3a892ee0   xu   app-wx(v0.1.0 bui...

3a892ee0   xu   app-wx(v0.1.0 bui...