index.vue 7.7 KB

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