819527061@qq.com
2024-05-11 f73ed7862edc9c3cb78a2610486643a2fa079fde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<template>
    <view class="orderDetail-wrap">
        <u-popup v-model="popupShow"  mode="center" width="90%" closeable>
            <view class="orderDetail-main">
                <view class="peisongDate-box">
                    <view class="peisongDate">
                        <text>配送时间:</text>
                        <text>{{sendDate}}</text>
                    </view>
                    <text class="status">{{status == 1  ? '已签收' : (status == 0  ? '未签收' : '异常签收')}}</text>
                </view>
                <view class="shangpin-table">
                    <view class="shangpin-biaoti">
                        <view class="shangpin-name">卷烟名称</view>
                        <view class="shangpin-num">条数</view>
                    </view>
                    <view class="shangpin-box">
                        <scroll-view scroll-y="true" style="height: 480rpx;">
                            <view class="shangpin-table-line" v-for="item in orderDetailList" :key="item.id">
                                <view class="shangpin-name">{{item.product}}</view>
                                <view class="shangpin-num">{{item.num}}</view>
                            </view>
                        </scroll-view>
                        <!-- <view class="shangpin-table-line">
                            <view class="shangpin-name">钻石(硬特醇)</view>
                            <view class="shangpin-num">122</view>
                        </view> -->
                    </view>
                </view>
                <view class="peisong-total">
                    <text>配送总量:</text>
                    <text>{{totalComputed}}条</text>
                </view>
                <view v-if="customerInformation.name">
                    <view class="shoujianrenxinxi-line">
                        <text>签收人:{{customerInformation.name}}</text>
                        <text>{{customerInformation.updateTime}}</text>
                    </view>
                    <view class="shoujianrenxinxi-line">
                        <text>电话:{{customerInformation.phone}}</text>
                        <!-- <text>签收方式:指纹</text> -->
                    </view>
                </view>
                <u-button  
                  v-if="level == 0"
                  :disabled="status == 0 ? true : false"
                  :type="status == 0 ? 'info' : 'success'" 
                  class="pingjiaBtn"
                  @click="gotoPingjia">我要评价</u-button>
            </view>
            
        </u-popup>
        <pingjia v-if="pingjiaVisiable" ref="pingjia" @refeshOrderDetail="refeshOrderDetail"></pingjia>
    </view>
</template>
 
<script>
    export default {
        name:"orderDetail",
        data() {
            return {
                orderDetailList:[],
                popupShow: false,
                pingjiaVisiable: false,
                customerInformation:{},
                customerReceiveId:'', //接货人ID
                status:0, //签收状态
                level:0,
                sendDate:'',  //配送时间
                type: 'success'
            };
        },
        computed:{
            totalComputed() {
                let total = 0
                this.orderDetailList.forEach(item => {
                    total += item.num
                })
                return total
            }
        },
        methods: {
            init(item) {
                console.log(item,'item------item')
                this.customerReceiveId = item.customerReceiveId
                this.status = item.status
                this.level = item.level
                this.sendDate = item.sendDate
                this.popupShow = true
                this.getOrderDetail(item.id,this.customerReceiveId)
            },
            refeshOrderDetail() {
                this.pingjiaVisiable = false
                this.$emit('refeshOrderDetail')
            },
            getOrderDetail(id,customerReceiveId) { //接货人ID 判断是否有接货人ID 有的话有收货人信息 没有则没有收货人信息
                this.$u.api.getOrderDetail({orderId:id}).then(res => {
                    if(res.code == 200) {
                        this.orderDetailList = res.result
                        if(customerReceiveId) {
                            this.getCustomerReceiveById(customerReceiveId)
                            this.type = 'success'
                        }else {
                            this.type = 'info'
                        }
                    }
                })
            },
            getCustomerReceiveById(customerReceiveId) {
                console.log('customerReceiveId==',customerReceiveId)
                this.$u.api.getCustomerReceiveById({customerReceiveId:customerReceiveId}).then(res => {
                    if(res.code == 200) {
                        this.customerInformation = res.result
                    }
                })
            },
            gotoPingjia() {
                this.pingjiaVisiable = true
                this.$nextTick(() => {
                    console.log('this.$refs',this.$refs)
                    this.$refs.pingjia.pingjiaInit()
                })
                
            }
        }
    }
</script>
 
<style lang="scss" scoped>
  /deep/ .u-btn--default{
        background-color: red;
    }
  .orderDetail-main{
      width: 90%;
      margin: 20rpx auto;
      display: flex;
      flex-direction: column;
  }
  .peisongDate-box{
      display: flex;
      justify-content: space-between;
      padding: 20rpx;
      border-bottom: 1px dashed #CCCCCC;
      .peisongDate{
          display: flex;
          text{
              font-size: 28rpx;
              color: #111111;
              font-weight: light;
              line-height: 2;
              &:first-child{
                  margin-right: 10rpx;
              }
          }
          
      }
      .status{
          font-size: 28rpx;
          color: #FF0000;
          font-weight: light;
          line-height: 2;
      }
  }
  .shangpin-table{
      display: flex;
      flex-direction: column;
      .shangpin-biaoti{
          display: flex;
          padding: 20rpx 0;
          border-bottom: 1px dashed #CCCCCC;
          .shangpin-name{
              flex: 2;
              font-size: 28rpx;
              color: #111111;
              font-weight: light;
              text-align: center;
          }
          .shangpin-num{
              flex: 1;
              font-size: 28rpx;
              color: #111111;
              font-weight: light;
              text-align: center;
          }
      }
      .shangpin-box{
          display: flex;
          flex-direction: column;
          border-bottom: 1px dashed #CCCCCC;
          // max-height: 480rpx;
          // overflow-y: auto;
          // touch-action: pan-y;
          // -webkit-overflow-scrolling: touch;
          .shangpin-table-line{
              display: flex;
              padding: 20rpx 0;
              .shangpin-name{
                  flex: 2;
                  font-size: 28rpx;
                  color: #111111;
                  font-weight: light;
                  text-align: center;
              }
              .shangpin-num{
                  flex: 1;
                  font-size: 28rpx;
                  color: #111111;
                  font-weight: light;
                  text-align: center;
              }
          }
      }
  }
  .peisong-total{
      padding: 10rpx;
      margin-top: 20rpx;
      text{
          font-size: 32rpx;
          color: #111111;
          font-weight: light;
      }
  }
  .shoujianrenxinxi-line{
      display: flex;
      justify-content: space-between;
      padding: 10rpx;
      text{
          font-size: 28rpx;
          color: #111111;
          font-weight: light;
          line-height: 2;
      }
  }
  .pingjiaBtn{
      margin: 40rpx auto 0;
      background-color: #1F9F4C;
      width: 250rpx;
      height: 76rpx;
  }
</style>