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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<template>
  <div class="detail-view">
    <el-drawer
      :visible.sync="detailConfig.visible"
      size="80%"
      :before-close="handleClose"
      :wrapperClosable="false"
      :append-to-body="true"
    >
      <template slot="title">
        <div class="header">
          <span class="header-label">报价单</span>
          <span class="header-title">{{ detailConfig.infomation.number }}</span>
        </div>
      </template>
      <div class="content">
        <!-- <div class="top">{{ "合同发起人:" + "" }}</div> -->
        <div class="tab-view">
          <el-tabs v-model="activeName" @tab-click="tabsClick">
            <el-tab-pane label="详情" name="first"></el-tab-pane>
            <!-- <el-tab-pane label="报价变更单" name="changeOrder"> -->
            <!-- <template slot="label">
                <div>跟进记录<el-badge type="primary" :value="2"> </el-badge></div>
              </template> -->
            <!-- </el-tab-pane> -->
            <!-- <el-tab-pane label="销售明细单" name="detail"></el-tab-pane> -->
            <el-tab-pane label="服务合同" name="serviceContract"></el-tab-pane>
          </el-tabs>
        </div>
        <div v-if="activeName === 'first'" class="detail">
          <!-- 标签 -->
          <!-- <div class="basic-info">
            <div class="basic-info-label" @click="expandClick('label')">
              <i v-if="isLabelExpand" class="el-icon-arrow-down"></i>
              <i v-else class="el-icon-arrow-up"></i>
              <span style="margin-left: 10px">标签</span>
            </div>
            <div v-show="isLabelExpand" class="basic-info-content"></div>
          </div> -->
          <!-- 基本信息 -->
          <div class="basic-info">
            <div class="basic-info-label" @click="expandClick('basic')">
              <i v-if="isBasicExpand" class="el-icon-arrow-down"></i>
              <i v-else class="el-icon-arrow-up"></i>
              <span style="margin-left: 10px">基本信息</span>
            </div>
            <div v-show="isBasicExpand" class="basic-info-content">
              <ul>
                <li v-for="(item, i) in basicInfoList" :key="i">
                  <div class="left">
                    <div class="content-title">{{ item.leftStr + ":" }}</div>
                    <div class="content-data">{{ item.leftValue ? item.leftValue : "--" }}</div>
                  </div>
                  <div v-if="item.rightStr.length > 0" class="right">
                    <div class="content-title">{{ item.rightStr + ":" }}</div>
                    <div class="content-data">{{ item.rightValue ? item.rightValue : "--" }}</div>
                  </div>
                </li>
              </ul>
            </div>
          </div>
          <!-- 附件信息 -->
          <!-- <div class="basic-info">
            <div class="basic-info-label" @click="expandClick('annex')">
              <i v-if="isAnnexExpand" class="el-icon-arrow-down"></i>
              <i v-else class="el-icon-arrow-up"></i>
              <span style="margin-left: 10px">附件信息</span>
            </div>
            <div v-show="isAnnexExpand" class="basic-info-content">
              <ul>
                <li>
                  <div class="left remark">
                    <div class="content-title">{{ "附件:" }}</div>
                    <div class="content-data">{{ "" }}</div>
                  </div>
                </li>
              </ul>
            </div>
          </div> -->
          <!-- 产品管理 -->
          <div class="basic-info">
            <div class="basic-info-label" @click="expandClick('product')">
              <i v-if="isProductExpand" class="el-icon-arrow-down"></i>
              <i v-else class="el-icon-arrow-up"></i>
              <span style="margin-left: 10px">产品管理</span>
              <span style="margin-left: 30px">{{ "币种:" + "人民币(¥)" }}</span>
            </div>
            <div v-show="isProductExpand" class="basic-info-content">
              <CommonFormTableView
                :detail-enter="true"
                :show-summary="showSummary"
                :product-table-list="productTableList"
              />
            </div>
          </div>
          <!-- 条件与条款 -->
          <div class="basic-info">
            <div class="basic-info-label" @click="expandClick('termsConditions')">
              <i v-if="isTermsConditionsExpand" class="el-icon-arrow-down"></i>
              <i v-else class="el-icon-arrow-up"></i>
              <span style="margin-left: 10px">条件与条款</span>
            </div>
            <div v-show="isTermsConditionsExpand" class="basic-info-content">
              <div class="termsConditions">
                <div class="content-title">{{ "条件与条款" + ":" }}</div>
                <div class="content-termsConditions">
                  {{ "\n" + detailConfig.infomation.conditions }}
                  <!-- <ul>
                    <li v-for="(item, index) in Status.termsConditions" :key="index">{{ item }}</li>
                  </ul> -->
                </div>
              </div>
            </div>
          </div>
          <!-- 审批日志 -->
          <!-- <div class="basic-info">
            <div class="basic-info-label" @click="expandClick('approval')">
              <i v-if="isApprovalExpand" class="el-icon-arrow-down"></i>
              <i v-else class="el-icon-arrow-up"></i>
              <span style="margin-left: 10px">审批日志</span>
            </div>
            <div v-show="isApprovalExpand" class="basic-info-content"></div>
          </div> -->
        </div>
        <div v-if="activeName === 'changeOrder'" class="second">
          <!-- <FollowupRecords :isDetail="true" /> -->
        </div>
        <div v-if="activeName === 'detail'" class="second">
          <SalesDetails :isDetail="true" :add-config="addConfig" />
        </div>
        <div v-if="activeName === 'serviceContract'" class="second">
          <ServiceContract :isDetail="true" :add-config="addConfig" />
        </div>
      </div>
    </el-drawer>
  </div>
</template>
 
<script>
import SalesDetails from "@/views/sales/salesDetails"
import ServiceContract from "@/views/service/serviceContract"
import Status from "@/common/const/salesFixedStatus"
import CommonFormTableView from "@/components/makepager/CommonFormTableView"
export default {
  name: "DetailQuotation",
  props: {
    quotationDetail: {
      type: Object,
      default: () => {
        return {
          visible: false,
          infomation: {}
        }
      }
    }
  },
  components: { SalesDetails, ServiceContract, CommonFormTableView },
  computed: {},
  data() {
    return {
      Status: Status,
      detailConfig: this.quotationDetail,
      activeName: "first",
      isLabelExpand: true, // 标签
      isBasicExpand: true, // 基本信息
      basicInfoList: [],
      isTermsConditionsExpand: true, // 条件与条款
      isAnnexExpand: true, // 附件信息
      isProductExpand: true, // 产品管理
      isApprovalExpand: true, // 审批日志
      showSummary: {
        show: true,
        total: true,
        sumProp: ["amount", "price", "total"],
        mergeNumber: 1
      },
      productTableList: {},
      addConfig: {}
    }
  },
  created() {
    this.setData(this.detailConfig.infomation)
    this.addConfig = {
      id_name: "quotation_number",
      keywordType: "报价单",
      keyword: this.detailConfig.infomation.number,
      id: this.detailConfig.infomation.id,
      common_name: this.detailConfig.infomation.name,
      client_name: this.detailConfig.infomation.client.name,
      contact_name: this.detailConfig.infomation.contact_name,
      client_id: this.detailConfig.infomation.client_id,
      contact_id: this.detailConfig.infomation.contact_id
    }
    this.setTableForm()
  },
  mounted() {},
  methods: {
    setData(item) {
      this.basicInfoList = [
        {
          leftStr: "客户名称",
          leftValue: item.client_name,
          rightStr: "报价编号",
          rightValue: item.number
        },
        {
          leftStr: "报价单状态",
          leftValue: item.quotation_status.name,
          rightStr: "销售机会",
          rightValue: item.sale_chance.name
        },
        {
          leftStr: "有效期至",
          leftValue: item.validity_date,
          rightStr: "销售负责人",
          rightValue: item.member.username
        },
        {
          leftStr: "创建时间",
          leftValue: "",
          rightStr: "",
          rightValue: ""
        }
      ]
    },
    handleClose() {
      this.detailConfig.visible = false
    },
    // tab切换
    tabsClick(tab, event) {
      console.log(tab, event)
    },
    // 展开收起点击事件
    expandClick(value) {
      console.log(value)
      if (value === "basic") {
        this.isBasicExpand = !this.isBasicExpand
      } else if (value === "label") {
        this.isLabelExpand = !this.isLabelExpand
      } else if (value === "termsConditions") {
        this.isTermsConditionsExpand = !this.isTermsConditionsExpand
      } else if (value === "annex") {
        this.isAnnexExpand = !this.isAnnexExpand
      } else if (value === "product") {
        this.isProductExpand = !this.isProductExpand
      } else if (value === "approval") {
        this.isApprovalExpand = !this.isApprovalExpand
      }
    },
    setTableForm() {
      this.productTableList = {
        tableData: this.detailConfig.infomation.products,
        tableColumn: [
          { label: "产品名称", prop: "name", productName: true, isRequird: true },
          { label: "产品编号", prop: "number" },
          { label: "数量", prop: "amount", inputNumber: true, isRequird: true },
          { label: "销售单价", prop: "price", inputFloat: true },
          { label: "价税合计", prop: "total", inputFloat: true }
        ]
      }
    }
  }
}
</script>
 
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
::v-deep {
  .el-drawer__header {
    padding: 0;
    margin-bottom: 0px;
    .header {
      height: 56px;
      display: flex;
      align-items: center;
      padding-left: 10px;
      .header-label {
        padding: 5px;
        border-radius: 4px;
        background-color: #ff6600;
        color: #fff;
        font-size: 12px;
      }
      .header-title {
        color: #323232;
        font-size: 15px;
        margin-left: 10px;
        font-weight: inherit;
      }
    }
  }
  .el-tabs--top .el-tabs__item.is-top:nth-child(2) {
    padding-left: 20px;
  }
  .el-tabs__item.is-active,
  .el-tabs__item:hover,
  .el-tabs__active-bar {
    color: $color-primary;
  }
  .el-tabs__header {
    margin: 0;
  }
  .el-drawer__body {
    .content {
      background-color: rgb(230, 233, 240);
      padding: 8px;
      .top {
        height: 42px;
        line-height: 42px;
        margin-bottom: 10px;
        text-align: center;
        font-size: 14px;
        color: #555;
        background-color: #fff;
      }
      .tab-view {
        background: #fff;
        .item {
          position: absolute;
          top: 0px;
          right: 0px;
        }
      }
      .detail {
        .basic-info {
          .basic-info-label {
            padding-left: 10px;
            height: 42px;
            line-height: 42px;
            background: #f4f8fe;
            color: #333;
            font-size: 14px;
          }
          .basic-info-content {
            background: #fff;
            ul {
              padding-inline-start: 0;
            }
            li {
              display: flex;
              font-size: 14px;
              font-family: PingFangSC;
              border-bottom: 1px solid #f9f9fb;
              .left,
              .right,
              .all {
                width: 50%;
                display: flex;
                align-items: center;
                height: 40px;
                .content-title {
                  width: 320px;
                  text-align: right;
                  color: #555;
                }
                .content-data {
                  text-align: left;
                  margin-left: 25px;
                  color: #333;
                }
              }
              .all {
                width: 100%;
              }
              .remark {
                width: 100%;
              }
              .history {
                .content-title {
                  width: 200px;
                  color: #8b0000;
                }
                .content-data {
                  color: #8b0000;
                }
              }
            }
            .step-view {
              padding: 30px 60px 5px;
              height: 100px;
              .step-title-view {
                margin-top: 10px;
                font-size: 12px;
                color: #555;
                position: relative;
                .step-label {
                  margin-top: -65px;
                  height: 60px;
                }
                .step-btn {
                  position: absolute;
                  bottom: -25px;
                  left: 50%;
                  margin-left: -28px;
                  width: 56px;
                  height: 24px;
                  line-height: 24px;
                  text-align: center;
                  color: #2d82f4;
                  border: 1px solid #2d82f4;
                  border-radius: 15px;
                  cursor: pointer;
                }
                .step-desc {
                  margin-top: 15px;
                }
              }
              .el-step__head.is-process {
                color: #ff8707;
                border-color: #ff8707;
              }
              .el-step__head.is-finish .el-step__line {
                background-color: #409eff;
              }
            }
            .termsConditions {
              display: flex;
              align-items: center;
              font-size: 14px;
              font-family: PingFangSC;
              min-height: 40px;
              // padding: 5px 0;
              .content-title {
                width: 320px;
                text-align: right;
                color: #555;
              }
              .content-termsConditions {
                margin: 0px 25px 15px;
                font-size: 13px;
                color: #333;
                white-space: pre-wrap;
                // li {
                //   margin: 5px 0;
                //   border-bottom: 0px solid #f9f9fb;
                // }
              }
            }
          }
        }
      }
      .second {
        background: #fff;
        .followup-records {
          .table-view {
            margin-top: 0 !important;
            margin-bottom: 0;
          }
        }
      }
    }
  }
}
</style>