index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <div class="customer">
  3. <Form ref="formValidate" :model="formValidate" :label-width="100" @submit.native.prevent>
  4. <Row :gutter="24" type="flex">
  5. <Col span="24" class="ivu-text-left">
  6. <FormItem label="搜索日期:">
  7. <RadioGroup
  8. v-model="formValidate.data"
  9. type="button"
  10. @on-change="selectChange(formValidate.data)"
  11. class="mr"
  12. >
  13. <Radio :label="item.val" v-for="(item, i) in fromList.fromTxt" :key="i">{{ item.text }}</Radio>
  14. </RadioGroup>
  15. <DatePicker
  16. :editable="false"
  17. @on-change="onchangeTime"
  18. :value="timeVal"
  19. format="yyyy/MM/dd"
  20. type="daterange"
  21. placement="bottom-end"
  22. placeholder="请选择时间"
  23. style="width: 200px"
  24. ></DatePicker>
  25. </FormItem>
  26. </Col>
  27. <Col span="12" class="ivu-text-left">
  28. <FormItem label="用户名称:">
  29. <Input
  30. search
  31. enter-button
  32. placeholder="请输入用户名称"
  33. v-model="formValidate.nickname"
  34. style="width: 90%"
  35. @on-search="userSearchs"
  36. ></Input>
  37. </FormItem>
  38. </Col>
  39. </Row>
  40. </Form>
  41. <Table
  42. :loading="loading2"
  43. highlight-row
  44. no-userFrom-text="暂无数据"
  45. no-filtered-userFrom-text="暂无筛选结果"
  46. ref="selection"
  47. :columns="columns4"
  48. :data="tableList2"
  49. >
  50. <template slot-scope="{ row, index }" slot="nickname">
  51. <div>{{ row.nickname }}</div>
  52. <div style="color: red">{{ row.is_del ? '用户已注销' : '' }}</div>
  53. </template>
  54. <template slot-scope="{ row, index }" slot="headimgurl">
  55. <div class="tabBox_img" v-viewer>
  56. <img v-lazy="row.headimgurl" />
  57. </div>
  58. </template>
  59. <template slot-scope="{ row, index }" slot="user_type">
  60. <span v-if="row.user_type === 'wechat'">公众号</span>
  61. <span v-else-if="row.user_type === 'routine'">小程序</span>
  62. <span v-else-if="row.user_type === 'h5'">H5</span>
  63. <span v-else-if="row.user_type === 'pc'">PC</span>
  64. <span v-else>--</span>
  65. </template>
  66. <template slot-scope="{ row, index }" slot="sex">
  67. <span v-show="row.sex === 1">男</span>
  68. <span v-show="row.sex === 2">女</span>
  69. <span v-show="row.sex === 0">保密</span>
  70. <span v-show="row.sex === null">--</span>
  71. </template>
  72. <template slot-scope="{ row, index }" slot="country">
  73. <span v-if="row.country || row.province || row.city">{{ row.country + row.province + row.city }}</span>
  74. <span v-else>--</span>
  75. </template>
  76. <template slot-scope="{ row, index }" slot="subscribe">
  77. <span v-text="row.subscribe === 1 ? '关注' : '未关注'"></span>
  78. </template>
  79. </Table>
  80. <div class="acea-row row-right page">
  81. <Page :total="total2" show-elevator show-total @on-change="pageChange2" :page-size="formValidate.limit" />
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. import { kefucreateApi } from '@/api/setting';
  87. export default {
  88. name: 'index',
  89. data() {
  90. return {
  91. formValidate: {
  92. page: 1,
  93. limit: 15,
  94. data: '',
  95. nickname: '',
  96. },
  97. tableList2: [],
  98. timeVal: [],
  99. fromList: {
  100. title: '选择时间',
  101. custom: true,
  102. fromTxt: [
  103. { text: '全部', val: '' },
  104. { text: '今天', val: 'today' },
  105. { text: '昨天', val: 'yesterday' },
  106. { text: '最近7天', val: 'lately7' },
  107. { text: '最近30天', val: 'lately30' },
  108. { text: '本月', val: 'month' },
  109. { text: '本年', val: 'year' },
  110. ],
  111. },
  112. currentid: 0,
  113. productRow: {},
  114. columns4: [
  115. {
  116. title: '选择',
  117. key: 'chose',
  118. width: 60,
  119. align: 'center',
  120. render: (h, params) => {
  121. let uid = params.row.uid;
  122. let flag = false;
  123. if (this.currentid === uid) {
  124. flag = true;
  125. } else {
  126. flag = false;
  127. }
  128. let self = this;
  129. return h('div', [
  130. h('Radio', {
  131. props: {
  132. value: flag,
  133. disabled: !!params.row.is_del,
  134. },
  135. on: {
  136. 'on-change': () => {
  137. self.currentid = uid;
  138. this.productRow = params.row;
  139. if (this.productRow.uid) {
  140. if (this.$route.query.fodder === 'image') {
  141. /* eslint-disable */
  142. let imageObject = {
  143. image: this.productRow.headimgurl,
  144. uid: this.productRow.uid,
  145. };
  146. form_create_helper.set('image', imageObject);
  147. form_create_helper.close('image');
  148. } else {
  149. this.$emit('imageObject', {
  150. image: this.productRow.headimgurl,
  151. uid: this.productRow.uid,
  152. });
  153. }
  154. } else {
  155. this.$Message.warning('请先选择商品');
  156. }
  157. },
  158. },
  159. }),
  160. ]);
  161. },
  162. },
  163. {
  164. title: 'ID',
  165. key: 'uid',
  166. width: 80,
  167. },
  168. {
  169. title: '微信用户名称',
  170. slot: 'nickname',
  171. minWidth: 180,
  172. },
  173. {
  174. title: '客服头像',
  175. slot: 'headimgurl',
  176. minWidth: 60,
  177. },
  178. {
  179. title: '用户类型',
  180. slot: 'user_type',
  181. minWidth: 100,
  182. },
  183. {
  184. title: '性别',
  185. slot: 'sex',
  186. minWidth: 60,
  187. },
  188. {
  189. title: '地区',
  190. slot: 'country',
  191. minWidth: 120,
  192. },
  193. {
  194. title: '是否关注公众号',
  195. slot: 'subscribe',
  196. minWidth: 120,
  197. },
  198. ],
  199. loading2: false,
  200. total2: 0,
  201. };
  202. },
  203. created() {},
  204. mounted() {
  205. this.getListService();
  206. },
  207. methods: {
  208. // 具体日期
  209. onchangeTime(e) {
  210. this.timeVal = e;
  211. this.formValidate.data = this.timeVal.join('-');
  212. this.getListService();
  213. },
  214. // 选择时间
  215. selectChange(tab) {
  216. this.formValidate.data = tab;
  217. this.timeVal = [];
  218. this.getListService();
  219. },
  220. // 客服列表
  221. getListService() {
  222. this.loading2 = true;
  223. kefucreateApi(this.formValidate)
  224. .then(async (res) => {
  225. let data = res.data;
  226. this.tableList2 = data.list;
  227. this.total2 = data.count;
  228. this.tableList2.map((item) => {
  229. item._isChecked = false;
  230. });
  231. this.loading2 = false;
  232. })
  233. .catch((res) => {
  234. this.loading2 = false;
  235. this.$Message.error(res.msg);
  236. });
  237. },
  238. pageChange2(pageIndex) {
  239. this.formValidate.page = pageIndex;
  240. this.getListService();
  241. },
  242. // 搜索
  243. userSearchs() {
  244. this.formValidate.page = 1;
  245. this.getListService();
  246. },
  247. },
  248. };
  249. </script>
  250. <style scoped lang="stylus">
  251. .customer
  252. overflow-y auto
  253. overflow-x hidden
  254. height 500px
  255. .tabBox_img
  256. width 36px
  257. height 36px
  258. border-radius:4px;
  259. cursor pointer
  260. img
  261. width 100%
  262. height 100%
  263. .modelBox
  264. >>>
  265. .ivu-table-header
  266. width 100% !important
  267. .trees-coadd
  268. width: 100%;
  269. height: 385px;
  270. .scollhide
  271. width: 100%;
  272. height: 100%;
  273. overflow-x: hidden;
  274. overflow-y: scroll;
  275. .scollhide::-webkit-scrollbar {
  276. display: none;
  277. }
  278. .footer{
  279. margin: 15px 0;
  280. padding-right: 20px;
  281. }
  282. </style>