zuozhanbaolishi.vue
7.4 KB
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
<template>
<div class="container">
<div class="flextwo sharetopk" @click="back">
<div class="leftrow leftrowkimg">
<img src="../../../assets/leftrow.png" alt />
</div>
<div class="sharemiddle">作战包历史</div>
<div class="sharebtn">
<!-- <img src="../../../assets/sharebtn.png" alt /> -->
</div>
</div>
<div class="zuozhantopkkk flextwo">
<div class="zuozhanitem" :class="iszuo==1?'zuozhanactive':''" @click="yixiang(1)">意向顾问</div>
<div class="zuozhanitem" :class="iszuo==2?'zuozhanactive':''" @click="yixiang(2)">意向经销商</div>
</div>
<!-- 意向顾问 -->
<div class="yixiangbox">
<div class="yixiangboxtop flexone">
<img src="../../../assets/yixiangimg.png" alt class="yixiangimg" />
作战包生成次数:{{count}}次
</div>
<div class="yiixangpage" v-if="iszuo==1">
<div class="yixiangpagetop flexone">
<div class="yiitem">顾客姓名</div>
<div class="yiitem">生成时间</div>
<div class="yiitem">查看内容</div>
<div class="yiitem jingxiao">经销商姓名</div>
<div class="yiitem caozuo">操作</div>
</div>
<div class="yixiangcontent">
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
<div
class="yixiangpagetop yixiangpagetopk flexone"
v-for="(item,index) in yixianglist"
:key="index"
>
<div class="yiitem yiname">{{item.name}}</div>
<div class="yiitem yiname yidate">{{item.createtime}}</div>
<div class="yiitem yisee" @click="seecontent(item.id)">查看</div>
<div class="yiitem yiname jingxiao">{{item.agent.name}}</div>
<div class="yiitem yisee caozuo" @click="delgu(item.id)">删除</div>
</div>
</van-list>
</div>
</div>
<div class="yiixangpage" v-if="iszuo==2">
<div class="yixiangpagetop flexone">
<div class="yiitem yijing">意向经销商</div>
<div class="yiitem">生成时间</div>
<div class="yiitem yicha">查看内容</div>
<div class="yiitem jingxiao">经销商姓名</div>
<div class="yiitem caozuo caojing">操作</div>
</div>
<div class="yixiangcontent">
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
<div
class="yixiangpagetop yixiangpagetopk flexone"
v-for="(item,index) in yixianglist"
:key="index"
>
<div class="yiitem yiname yijing">{{item.name}}</div>
<div class="yiitem yiname yidate">{{item.createtime}}</div>
<div class="yiitem yisee yicha" @click="jingxiaosee(item.id)">查看</div>
<div class="yiitem yiname jingxiao">{{item.agent.name}}</div>
<div class="yiitem yisee caozuo caojing" @click="deljing(item.id)">删除</div>
</div>
</van-list>
</div>
</div>
</div>
</div>
</template>
<script>
import Vue from "vue";
import { Dialog } from 'vant';
import { List, Toast } from "vant";
Vue.use(Toast, List)
export default {
data() {
return {
iszuo: 1,
page: 1,
yixianglist: [],
finished: false,
loading: false,
this_page: "",
total_page: "",
count: ''
}
},
created() {
this.getguwenlist()
},
methods: {
back() {
this.$router.go(-1)
},
yixiang(id) {
this.iszuo = id;
this.page = 1;
this.yixianglist = [];
if (this.iszuo == 1) {
this.getguwenlist()
} else[
this.getjingxiaolist()
]
},
//顾问查看
seecontent(id) {
this.$router.push({
path: "/productintro",
query: { subid: id }
});
},
// 经销商查看
jingxiaosee(id) {
this.$router.push({
path: "/companyintro",
query: { subid: id }
});
},
//列表上拉加载
onLoad() {
console.log(437843787)
let that = this;
// 异步更新数据
// setTimeout 仅做示例,真实场景中一般为 ajax 请求
setTimeout(() => {
console.log(3434);
let newpage = that.page;
newpage++;
that.page = newpage;
if (that.iszuo == 1) {
that.getguwenlist();
} else {
that.getjingxiaolist();
}
// 加载状态结束
this.loading = false;
// 数据全部加载完成
if (that.this_page == that.total_page) {
this.finished = true;
}
}, 1000);
},
// 获取意向顾客列表
getguwenlist() {
let that = this;
var url = "/api/user/assistance_list";
let param = {
page: this.page
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.yixianglist = that.yixianglist.concat(res.data.list)
that.this_page = res.data.this_page;
that.total_page = res.data.total_page;
that.count = res.data.count
})
.catch(function (error) {
console.log(error);
});
},
// 获取意向经销商列表
getjingxiaolist() {
let that = this;
var url = "/api/user/purpose_list";
let param = {
page: this.page
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
that.yixianglist = that.yixianglist.concat(res.data.list);
that.this_page = res.data.this_page;
that.total_page = res.data.total_page;
that.count = res.data.count
})
.catch(function (error) {
console.log(error);
});
},
// 删除顾客
delgu(id) {
Dialog.confirm({
title: '是否删除意向顾客',
})
.then((res) => {
console.log(3489348)
let that = this
var url = "/api/user/assistance_del";
let param = {
assistance_id: id
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
Toast("删除成功")
that.page = 1;
that.yixianglist = [];
that.getguwenlist()
})
.catch(function (err) {
console.log(err);
});
// on confirm
})
.catch((res) => {
// on cancel
});
},
// 删除经销商
deljing(id) {
Dialog.confirm({
title: '是否删除意向顾客',
})
.then((res) => {
console.log(3489348)
let that = this
var url = "/api/user/purpose_del";
let param = {
purpose_id: id
};
that.$axios
.post(url, param)
.then(function (res) {
console.log(res);
Toast("删除成功")
that.page = 1;
that.yixianglist = [];
that.getjingxiaolist()
})
.catch(function (err) {
console.log(err);
});
// on confirm
})
.catch((res) => {
// on cancel
});
}
}
}
</script>
<style scoped>
@import "../../../style/usercenter.css";
</style>