liukangdong
2024-09-29 b2d360d9113b6955287108ca9e90d76a1f3c1419
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
<template>
  <TableLayout :permissions="['business:customerlog:query']">
    <!-- 搜索表单 -->
    <el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
      <el-form-item label="手机号" prop="phone">
        <el-input v-model="searchForm.phone" placeholder="请输入手机号" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="年龄段 " prop="ageInfo">
        <el-select v-model="searchForm.ageInfo" clearable @change="search">
          <el-option value="0" label="70后" ></el-option>
          <el-option value="1" label="80后"></el-option>
          <el-option value="2" label="90后"></el-option>
          <el-option value="3" label="00后"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="省份名称" prop="provinceName">
        <el-input v-model="searchForm.provinceName" placeholder="请输入省份名称" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="城市名称" prop="cityName">
        <el-input v-model="searchForm.cityName" placeholder="请输入城市名称" @keypress.enter.native="search"></el-input>
      </el-form-item>
      <el-form-item label="提交类型" prop="type" >
        <el-select v-model="searchForm.type" clearable @change="search">
          <el-option value="0" label="测试装修风格"></el-option>
          <el-option value="1" label="0元定制"></el-option>
          <el-option value="2" label="装修计算器"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="crm提交状态" prop="crmStatus">
        <el-select v-model="searchForm.crmStatus" clearable @change="search">
          <el-option value="0" label="未提交"></el-option>
          <el-option value="1" label="已提交"></el-option>
          <el-option value="2" label="提交失败"></el-option>
        </el-select>
      </el-form-item>
      <TimerRange :radio="0"  @callback="searchTime"></TimerRange>
      <section>
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button type="primary" :loading="isWorking.export" v-permissions="['business:customerlog:exportExcel']" @click="exportExcel">导出</el-button>
        <el-button @click="reset">重置</el-button>
      </section>
    </el-form>
    <!-- 表格和分页 -->
    <template v-slot:table-wrap>
      <ul class="toolbar" v-permissions="['business:customerlog:create', 'business:customerlog:delete']">
        <li><el-button type="primary" @click="reSubmitAll(0)" icon="el-icon-plus" v-permissions="['business:customerlog:update']">提交全部【未提交】数据</el-button></li>
        <li><el-button type="primary" @click="reSubmitAll(2)" icon="el-icon-plus" v-permissions="['business:customerlog:update']">重新提交【失败】数据</el-button></li>
      </ul>
      <el-table
        v-loading="isWorking.search"
        :data="tableData.list"
        stripe
        @selection-change="handleSelectionChange"
      >
        <el-table-column label="序号"  width="55" fixed><template slot-scope="scope" >{{scope.$index+1}}</template></el-table-column>
        <el-table-column prop="type" label="提交类型" fixed min-width="100px">
          <template slot-scope="{row}">
              <span v-if="row.type ==0">测试装修风格</span>
              <span v-if="row.type ==1">0元定制</span>
              <span v-if="row.type ==2">装修计算器</span>
          </template>
        </el-table-column>
        <el-table-column prop="phone" label="手机号" fixed min-width="100px"></el-table-column>
        <el-table-column prop="name" label="姓名" fixed min-width="100px"></el-table-column>
        <el-table-column prop="crmStatus" label="crm提交状态" fixed min-width="100px">
          <template slot-scope="{row}">
            <span v-if="row.crmStatus ==0" style="color: blue">未提交</span>
            <span v-if="row.crmStatus ==1" style="color: green">已提交</span>
            <span v-if="row.crmStatus ==2" style="color: red">提交失败</span>
          </template>
        </el-table-column>
        <el-table-column prop="provinceName" label="省份名称" min-width="100px">
          <template slot-scope="{row}">
            {{row.provinceName||''}}{{row.cityName||''}}
          </template>
        </el-table-column>
        <el-table-column prop="createDate" label="创建时间"  min-width="140px"></el-table-column>
        <el-table-column prop="orderDate" label="预约量房时间" min-width="120px"></el-table-column>
        <el-table-column prop="plaDate" label="计划装修开始时间" min-width="120px">
          <template slot-scope="{row}">
            <span v-if="row.plaDate ==0">半个月内</span>
            <span v-if="row.plaDate ==1">一个月内</span>
            <span v-if="row.plaDate ==2">两个月内</span>
            <span v-if="row.plaDate ==3">两个月以上</span>
          </template>
        </el-table-column>
        <el-table-column prop="designType" label="设计类型" min-width="80px">
          <template slot-scope="{row}">
            <span v-if="row.designType ==0">精装</span>
            <span v-if="row.designType ==1">工装</span>
          </template>
        </el-table-column>
        <el-table-column prop="houseStatus" label="房屋状况" min-width="80px">
          <template slot-scope="{row}">
            <span v-if="row.type ==0 && row.houseStatus ==0">毛坯房</span>
            <span v-if="row.type ==0 && row.houseStatus ==1">旧房翻新</span>
            <span v-if="row.type ==0 && row.houseStatus ==2">局部改造</span>
            <span v-if="row.type ==1 && row.houseStatus ==0">精装</span>
            <span v-if="row.type ==1 && row.houseStatus ==1">毛坯</span>
          </template>
        </el-table-column>
        <el-table-column prop="district" label="楼盘小区名称" min-width="100px"></el-table-column>
        <el-table-column prop="area" label="房屋面积" min-width="100px"></el-table-column>
        <el-table-column prop="info" label="备注说明" min-width="100px"></el-table-column>
        <el-table-column prop="costomerId" label="用户编码" min-width="100px"></el-table-column>
        <el-table-column prop="houseType" label="房子户型" min-width="100px">
          <template slot-scope="{row}">
            <span v-if="row.type ==0 && row.houseType ==0">一居</span>
            <span v-if="row.type ==0 && row.houseType ==1">两居</span>
            <span v-if="row.type ==0 && row.houseType ==2">三居</span>
            <span v-if="row.type ==2 && row.houseType ==0">一室一厅</span>
            <span v-if="row.type ==2 && row.houseType ==1">两室一厅</span>
            <span v-if="row.type ==2 && row.houseType ==2">两室两厅</span>
            <span v-if="row.type ==2 && row.houseType ==3">三室两厅</span>
            <span v-if="row.type ==2 && row.houseType ==4">四室两厅</span>
            <span v-if="row.type ==2 && row.houseType ==5">五室两厅及以上</span>
          </template>
        </el-table-column>
        <el-table-column prop="sex" label="性别" min-width="80px">
          <template slot-scope="{row}">
            <span v-if="row.sex ==0">男</span>
            <span v-if="row.sex ==1">女</span>
          </template>
        </el-table-column>
        <el-table-column prop="ageInfo" label="年龄段" min-width="80px">
          <template slot-scope="{row}">
            <span v-if="row.ageInfo ==0">70后</span>
            <span v-if="row.ageInfo ==1">80后</span>
            <span v-if="row.ageInfo ==2">90后</span>
            <span v-if="row.ageInfo ==3">00后</span>
          </template>
        </el-table-column>
        <el-table-column prop="styleInfo" label="风格" min-width="100px"></el-table-column>
        <el-table-column prop="budget" label="装修预算(元)" min-width="100px"></el-table-column>
        <el-table-column prop="crmDate" label="crm提交时间" min-width="100px"></el-table-column>
        <el-table-column prop="crmInfo" label="crm提交备注" min-width="100px"></el-table-column>
        <el-table-column
          v-if="containPermissions(['business:customerlog:update', 'business:customerlog:delete'])"
          label="操作"
          min-width="150"
          fixed="right"
          align="center"
        >
          <template slot-scope="{row}">
            <!-- <el-button type="text" @click="$refs.operaCustomerLogWindow.open('编辑客户留资记录信息表', row)" icon="el-icon-edit" v-permissions="['business:customerlog:update']">编辑</el-button>-->
            <el-button type="text" @click="reSubmit(row)" icon="el-icon-edit" v-permissions="['business:customerlog:update']" v-if="row.crmStatus !=1">重新提交crm</el-button>
          </template>
        </el-table-column>
      </el-table>
      <pagination
        @size-change="handleSizeChange"
        @current-change="handlePageChange"
        :pagination="tableData.pagination"
      >
      </pagination>
    </template>
    <!-- 新建/修改 -->
    <OperaCustomerLogWindow ref="operaCustomerLogWindow" @success="handlePageChange"/>
  </TableLayout>
</template>
 
<script>
import BaseTable from '@/components/base/BaseTable'
import TableLayout from '@/layouts/TableLayout'
import Pagination from '@/components/common/Pagination'
import OperaCustomerLogWindow from '@/components/business/OperaCustomerLogWindow'
export default {
  name: 'CustomerLog',
  extends: BaseTable,
  components: { TableLayout, Pagination, OperaCustomerLogWindow },
  data () {
    return {
      running: false,
      // 搜索
      searchForm: {
        queryEndDate: '',
        queryStartDate: '',
        provinceName: '',
        cityName: '',
        phone: '',
        type: '',
        crmStatus: ''
      }
    }
  },
  created () {
    this.config({
      module: '客户留资记录信息表',
      api: '/business/customerLog',
      'field.id': 'id',
      'field.main': 'id'
    })
    this.search()
  },
  methods: {
    // 查询数据
    reSubmit (row) {
      this.api.reSubmit({ id: row.id })
        .then(res => {
          this.handlePageChange()
        })
        .finally(() => {
        })
    },
    reSubmitAll (status) {
      this.$dialog.actionConfirm('确认进行该操作吗??')
        .then(() => {
          this.running = true
          this.api.reSubmitAll({ crmStatus: status })
            .then(res => {
              this.handlePageChange()
            })
            .finally(() => {
            })
            .catch(e => {
            })
            .finally(() => {
              this.running = false
            })
        })
    }
  }
}
</script>