lhl před 1 rokem
rodič
revize
0512d8e731

+ 32 - 0
src/api/agent.js

@@ -113,4 +113,36 @@ export function getKpi(params) {
 	    method: 'get',
 	    params
 	})
+}
+
+export function addGlobal(data) {
+	return request({
+	    url: 'user/global/save',
+	    method: 'post',
+	    data
+	})
+}
+
+export function editGlobal(data) {
+	return request({
+	    url: 'user/global/updata',
+	    method: 'post',
+	    data
+	})
+}
+
+export function delGlobal(data) {
+	return request({
+	    url: 'user/global/delete',
+	    method: 'post',
+	    data
+	})
+}
+
+export function globalList(params) {
+	return request({
+	    url: 'user/global/lst',
+	    method: 'get',
+	    params
+	})
 }

+ 296 - 0
src/components/userList/index.vue

@@ -0,0 +1,296 @@
+<template>
+<!-- 选择用户 -->
+  <div>
+    <Form
+      ref="formValidate"
+      inline
+      :model="formValidate"
+      :label-width="labelWidth"
+      :label-position="labelPosition"
+      @submit.native.prevent
+    >
+          <FormItem label="注册日期:">
+            <DatePicker
+              :editable="false"
+              @on-change="onchangeTime"
+              :value="timeVal"
+              format="yyyy/MM/dd"
+              type="datetimerange"
+              placement="bottom-end"
+              placeholder="请选择时间"
+              class="input-width"
+              :options="options"
+            ></DatePicker>
+          </FormItem>
+          <FormItem label="用户名称:">
+            <Input
+              placeholder="请输入用户名称"
+              v-model="formValidate.nickname"
+              class="input-add"
+              @on-search="userSearchs"
+            ></Input>
+            <Button type="primary" @click="userSearchs()">查询</Button>
+          </FormItem>
+    </Form>
+    <Table
+      :loading="loading2"
+      highlight-row
+      no-userFrom-text="暂无数据"
+      no-filtered-userFrom-text="暂无筛选结果"
+      ref="selection"
+      :columns="columns4"
+      :data="tableList2"
+      height="500"
+    >
+      <template slot-scope="{ row, index }" slot="headimgurl">
+        <viewer>
+          <div class="tabBox_img">
+            <img v-lazy="row.headimgurl" />
+          </div>
+        </viewer>
+      </template>
+      <template slot-scope="{ row, index }" slot="user_type">
+        <span v-if="row.user_type === 'wechat'">公众号</span>
+        <span v-if="row.user_type === 'routine'">小程序</span>
+        <span v-if="row.user_type === 'h5'">H5</span>
+        <span v-if="row.user_type === 'pc'">PC</span>
+      </template>
+      <template slot-scope="{ row, index }" slot="sex">
+        <span v-show="row.sex === 1">男</span>
+        <span v-show="row.sex === 2">女</span>
+        <span v-show="row.sex === 0">保密</span>
+      </template>
+      <template slot-scope="{ row, index }" slot="country">
+        <span>{{ row.country + row.province + row.city }}</span>
+      </template>
+      <template slot-scope="{ row, index }" slot="subscribe">
+        <span v-text="row.subscribe === 1 ? '关注' : '未关注'"></span>
+      </template>
+    </Table>
+    <div class="acea-row row-right page">
+      <Page
+        :current="formValidate.page"
+        :total="total2"
+        show-elevator
+        show-total
+        @on-change="pageChange2"
+        :page-size="formValidate.limit"
+      />
+    </div>
+  </div>
+</template>
+<script>
+import { kefucreateApi } from "@/api/setting";
+import template from "@/pages/setting/devise/template.vue";
+import timeOptions from "@/utils/timeOptions";
+import { mapState } from 'vuex';
+export default {
+  components: { template },
+  name: "index",
+  data() {
+    return {
+      formValidate: {
+        page: 1,
+        limit: 15,
+        data: "",
+        nickname: "",
+      },
+      tableList2: [],
+      timeVal: [],
+      options: timeOptions,
+      fromList: {
+        title: "选择时间",
+        custom: true,
+        fromTxt: [
+          { text: "全部", val: "" },
+          { text: "今天", val: "today" },
+          { text: "昨天", val: "yesterday" },
+          { text: "最近7天", val: "lately7" },
+          { text: "最近30天", val: "lately30" },
+          { text: "本月", val: "month" },
+          { text: "本年", val: "year" },
+        ],
+      },
+      currentid: 0,
+      productRow: {},
+      columns4: [
+        {
+          title: "选择",
+          key: "chose",
+          width: 60,
+          align: "center",
+          render: (h, params) => {
+            let uid = params.row.uid;
+            let flag = false;
+            if (this.currentid === uid) {
+              flag = true;
+            } else {
+              flag = false;
+            }
+            let self = this;
+            return h("div", [
+              h("Radio", {
+                props: {
+                  value: flag,
+                },
+                on: {
+                  "on-change": () => {
+                    self.currentid = uid;
+                    this.productRow = params.row;
+                    if (this.productRow.uid) {
+                      if (this.$route.query.fodder === "image") {
+                        /* eslint-disable */
+                        let imageObject = {
+                          image: this.productRow.headimgurl,
+                          uid: this.productRow.uid,
+                        };
+                        form_create_helper.set("image", imageObject);
+                        form_create_helper.close("image");
+                      } else {
+                        this.$emit("imageObject", {
+                          image: this.productRow.headimgurl,
+                          uid: this.productRow.uid,
+						  name: this.productRow.nickname
+                        });
+                      }
+                    } else {
+                      this.$Message.warning("请先选择商品");
+                    }
+                  },
+                },
+              }),
+            ]);
+          },
+        },
+        {
+          title: "ID",
+          key: "uid",
+          width: 80,
+        },
+        {
+          title: "微信用户名称",
+          key: "nickname",
+          minWidth: 180,
+        },
+        {
+          title: "头像",
+          slot: "headimgurl",
+          minWidth: 60,
+        },
+        {
+          title: "用户类型",
+          slot: "user_type",
+          minWidth: 100,
+        },
+        {
+          title: "性别",
+          slot: "sex",
+          minWidth: 60,
+        },
+        {
+          title: "地区",
+          slot: "country",
+          minWidth: 120,
+        },
+        // {
+        //   title: "是否关注公众号",
+        //   slot: "subscribe",
+        //   width: 120,
+        // },
+      ],
+      loading2: false,
+      total2: 0,
+    };
+  },
+  computed: {
+    ...mapState('admin/layout', [
+        'isMobile'
+    ]),
+    labelWidth () {
+        return this.isMobile ? undefined : 96;
+    },
+    labelPosition () {
+        return this.isMobile ? 'top' : 'right';
+    }
+  },
+  created() {},
+  mounted() {
+    this.getListService();
+  },
+  methods: {
+    // 具体日期
+    onchangeTime(e) {
+      this.timeVal = e;
+      this.formValidate.data = this.timeVal[0] ? this.timeVal.join("-") : "";
+      this.getListService();
+    },
+    // 选择时间
+    selectChange(tab) {
+      this.formValidate.data = tab;
+      this.timeVal = [];
+      this.getListService();
+    },
+    // 客服列表
+    getListService() {
+      this.loading2 = true;
+      kefucreateApi(this.formValidate)
+        .then(async (res) => {
+          let data = res.data;
+          this.tableList2 = data.list;
+          this.total2 = data.count;
+          this.tableList2.map((item) => {
+            item._isChecked = false;
+          });
+          this.loading2 = false;
+        })
+        .catch((res) => {
+          this.loading2 = false;
+          this.$Message.error(res.msg);
+        });
+    },
+    pageChange2(pageIndex) {
+      this.formValidate.page = pageIndex;
+      this.getListService();
+    },
+    // 搜索
+    userSearchs() {
+      this.formValidate.page = 1;
+      this.getListService();
+    },
+  },
+};
+</script>
+
+<style scoped lang="stylus">
+.input-add {
+width: 250px;
+margin-right:14px
+}
+.tabBox_img
+    width 36px
+    height 36px
+    border-radius:4px;
+    cursor pointer
+    img
+        width 100%
+        height 100%
+.modelBox
+    >>>
+    .ivu-table-header
+        width 100% !important
+.trees-coadd
+    width: 100%;
+    height: 385px;
+    .scollhide
+        width: 100%;
+        height: 100%;
+        overflow-x: hidden;
+        overflow-y: scroll;
+.scollhide::-webkit-scrollbar {
+    display: none;
+}
+.footer{
+    margin: 15px 0;
+    padding-right: 20px;
+}
+</style>

+ 506 - 0
src/pages/agent/global/create.vue

@@ -0,0 +1,506 @@
+<template>
+	<div class="form-submit">
+		<div class="i-layout-page-header">
+			<PageHeader class="product_tabs" hidden-breadcrumb>
+				<div slot="title">
+					<router-link :to="{ path: `${roterPre}/agent/global/index` }">
+						<div class="font-sm after-line">
+							<span class="iconfont iconfanhui"></span>
+							<span class="pl10">返回</span>
+						</div>
+					</router-link>
+					<span v-text="$route.params.id ? '编辑' : '添加'" class="mr20 ml16"></span>
+				</div>
+			</PageHeader>
+		</div>
+		<Card :bordered="false" dis-hover class="ivu-mt">
+
+			<Form :model="formData" :label-width="150">
+				<FormItem label="选择用户:" prop="product_id" required>
+					<div class="picBox">
+						<Button type="primary" v-if="!formData.uid" @click="changeGoods()">选择用户</Button>
+						<template v-else>
+							<div class="">
+								{{formData.name}}
+							</div>
+							<Button type="primary" v-if="!formData.id" @click="changeGoods()">切换用户</Button>
+						</template>
+					</div>
+					<div></div>
+				</FormItem>
+				<FormItem label="奖励百分比(%)" required>
+					<InputNumber v-model="formData.global_commission" v-width="320"></InputNumber>
+				</FormItem>
+			</Form>
+
+		</Card>
+		<Modal v-model="modals" title="用户列表" footerHide class="paymentFooter" scrollable width="900"
+			@on-cancel="cancel">
+			<user-list ref="goodslist" :goodsType="1" v-if="modals" @imageObject="getProductId"
+				:serviceProject="1"></user-list>
+		</Modal>
+		<div style="width: 500px; display: flex;justify-content: center;">
+			<Button type="primary" class="submission" @click="save" :disabled="disabled">保存</Button>
+		</div>
+	</div>
+</template>
+
+<script>
+	import {
+		mapState
+	} from "vuex";
+	import userList from "@/components/userList/index"
+	import {
+		couponCategoryApi,
+		couponSaveApi,
+		couponDetailApi,
+		VipEditApi,
+		serveAddApi,
+		bindServe,
+		addServiceProject,
+		serveReadApi,
+		serveProductDeleteApi
+	} from "@/api/marketing";
+	import {
+		brandList,
+		changeListApi
+	} from "@/api/product";
+	import { addGlobal } from '@/api/agent'
+	// import { formatDate } from '@/utils/validate';
+	import Setting from "@/setting";
+	export default {
+		name: "storeCouponCreate",
+		components: {
+			userList
+		},
+		data() {
+			return {
+				baseForm: {
+					product_name: '',
+					product_id: 0,
+					performance_value: 0,
+					craft_price: 0,
+					sales_commissions: 0,
+					repertory: 0
+				}, //基础数据
+				modal_loading: false,
+				modals: false,
+				id: '',
+				roterPre: Setting.roterPre,
+				disabled: false,
+				storesList: [],
+				formData: {
+					id: '',
+					name: '',
+					uid: '',
+					global_commission: 0,
+				},
+				isMinPrice: 0,
+				isCouponTime: 1,
+				isReceiveTime: 0,
+				modals: false,
+				datetime1: [],
+				datetime2: [],
+				storeModals: false,
+				currentTab: '1',
+				current: {},
+				service_card_id: '',
+				productList: [],
+			};
+		},
+		computed: {
+			...mapState("admin/layout", ["isMobile", "menuCollapse"]),
+		},
+		created() {
+			console.log(this.$route.query);
+			if (this.$route.query.id) {
+				
+			}
+		},
+		methods: {
+			showPrice(id) {
+				let item = this.productList.find(i => {
+					return i.id == id
+				})
+				if (item) {
+					return item.price
+				} else {
+					return ''
+				}
+			},
+			// 选择商品
+			changeGoods() {
+				this.modals = true;
+			},
+			addNewProject() {
+				console.log('dddddddddddddddddd');
+				let that = this
+				try {
+					this.formData.push({
+						service_card_id: that.service_card_id,
+						id: 0,
+						product_id: 0,
+						store_name: '',
+						slider_image: '',
+						performance_value: '',
+						craft_price: '',
+						sales_commissions: '',
+						repertory: 0,
+					})
+					console.log(this.formData);
+				} catch (e) {
+					console.log(e);
+				}
+			},
+			delNewProject(index, item) {
+				let that = this
+				if (item.id) {
+					try {
+						let delfromData = {
+							title: '删除服务项目',
+							url: `service/productDelete/${item.id}`,
+							method: 'DELETE',
+							ids: ''
+						};
+						this.$modalSure(delfromData).then((res) => {
+							that.$Message.success(res.msg);
+							that.formData.splice(index, 1)
+						}).catch(res => {
+							that.$Message.error(res.msg);
+						});
+					} catch (e) {
+						//TODO handle the exception
+						console.log(e, '错误');
+					}
+
+					// serveProductDeleteApi(item.id).then(res => {
+					// 	this.formData.splice(index,1)
+					// })
+				} else {
+					this.formData.splice(index, 1)
+				}
+				if (that.formData.length == 0) {
+					that.formData = [{
+						id: 0,
+						service_card_id: that.service_card_id,
+						product_id: 0,
+						store_name: '',
+						slider_image: '',
+						performance_value: '',
+						craft_price: '',
+						sales_commissions: '',
+						repertory: 0,
+					}]
+				}
+			},
+			// 商品id
+			getProductId(row) {
+				console.log(row, '这个');
+				//   this.modal_loading = false;
+				this.modals = false;
+				this.formData.name = row.name
+				this.formData.uid = row.uid
+				//   setTimeout(() => {
+				// this.current.product_id = row.id
+				// this.current.store_name = row.store_name
+				// this.current.slider_image = row.image
+				// // this.formData.image = row.image
+				//   }, 500);
+			},
+			downTab() {
+				if (!this.formData.uid) {
+					return this.$Message.error("请选择用户");
+				}
+				if (!this.formData.global_commission) {
+					return this.$Message.error("请输入全局奖励百分比");
+				}
+			},
+			// 创建
+			save() {
+				if (this.formData.id) {
+
+				} else {
+					addGlobal({
+						uid: this.formData.uid,
+						global_commission: this.formData.global_commission
+					}).then(res => {
+						this.$Message.success(res.msg);
+						setTimeout(() => {
+							this.$router.push({
+								path: "/admin/agent/global/index",
+							});
+						}, 1000);
+					}).catch(err => {})
+				}
+				// bindServe(this.service_card_id,{item: this.formData})
+				// 	.then((res) => {
+				// 		this.disabled = true;
+				// 		this.$Message.success(res.msg);
+				// 		setTimeout(() => {
+				// 			this.$router.push({
+				// 				path: this.roterPre + "/marketing/serve/index",
+				// 			});
+				// 		}, 1000);
+				// 	})
+				// 	.catch((err) => {
+				// 		this.$Message.error(err.msg);
+				// 		this.disabled = false;
+				// 	});
+			},
+			// 使用有效期--时间段
+			dateChange(time) {
+				this.formData.start_use_time = time[0];
+				this.formData.end_use_time = time[1];
+			},
+			// 限时
+			timeChange(time) {
+				this.formData.start_time = time[0];
+				this.formData.end_time = time[1];
+			},
+			//对象数组去重;
+			unique(arr) {
+				const res = new Map();
+				return arr.filter(
+					(arr) => !res.has(arr.product_id) && res.set(arr.product_id, 1)
+				);
+			},
+			// // 选择的商品
+			// getProductId(productList) {
+			// 	this.modals = false;
+			// 	this.productList = this.unique(this.productList.concat(productList));
+			// 	this.formData.product_id = "";
+			// 	this.productList.forEach((value) => {
+			// 		if (this.formData.product_id) {
+			// 			this.formData.product_id += `,${value.product_id}`;
+			// 		} else {
+			// 			this.formData.product_id += `${value.product_id}`;
+			// 		}
+			// 	});
+			// },
+			cancel() {
+				this.modals = false;
+			},
+			// 删除商品
+			remove(productId) {
+				for (let index = 0; index < this.productList.length; index++) {
+					if (this.productList[index].product_id == productId) {
+						this.productList.splice(index, 1);
+					}
+				}
+				this.formData.product_id = "";
+				this.productList.forEach((value) => {
+					if (this.formData.product_id) {
+						this.formData.product_id += `,${value.product_id}`;
+					} else {
+						this.formData.product_id += `${value.product_id}`;
+					}
+				});
+			},
+			cancel() {
+				this.modals = false;
+			},
+
+		},
+	};
+</script>
+
+<style scoped lang="stylus">
+	.tips {
+		display: inline-bolck;
+		font-size: 12px;
+		font-weight: 400;
+		color: #999999;
+		margin-top: 10px;
+	}
+
+	.imgPic {
+		.info {
+			width: 60%;
+			margin-left: 10px;
+		}
+
+		.pictrue {
+			height: 36px;
+			margin: 7px 3px 0 3px;
+
+			img {
+				height: 100%;
+				display: block;
+			}
+		}
+	}
+
+	.productType {
+		width: 120px;
+		height: 60px;
+		background: #FFFFFF;
+		border-radius: 3px;
+		border: 1px solid #E7E7E7;
+		float: left;
+		text-align: center;
+		padding-top: 8px;
+		position: relative;
+		cursor: pointer;
+		line-height: 23px;
+		margin-right: 12px;
+
+		&.on {
+			border-color: #1890FF;
+		}
+
+		.name {
+			font-size: 14px;
+			font-weight: 600;
+			color: rgba(0, 0, 0, 0.85);
+
+			&.on {
+				color: #1890FF;
+			}
+		}
+
+		.title {
+			font-size: 12px;
+			font-weight: 400;
+			color: #999999;
+		}
+
+		.jiao {
+			position: absolute;
+			bottom: 0;
+			right: 0;
+			width: 0;
+			height: 0;
+			border-bottom: 26px solid #1890FF;
+			border-left: 26px solid transparent;
+		}
+
+		.iconfont {
+			position: absolute;
+			bottom: -3px;
+			right: 1px;
+			color: #FFFFFF;
+			font-size: 12px;
+		}
+	}
+
+	.info {
+		color: #888;
+		font-size: 12px;
+	}
+
+	.ivu-input-wrapper {
+		width: 320px;
+	}
+
+	.ivu-input-number {
+		width: 160px;
+	}
+
+	.ivu-date-picker {
+		width: 320px;
+	}
+
+	.ivu-icon-ios-camera-outline {
+		width: 58px;
+		height: 58px;
+		border: 1px dotted rgba(0, 0, 0, 0.1);
+		border-radius: 4px;
+		background-color: rgba(0, 0, 0, 0.02);
+		line-height: 58px;
+		cursor: pointer;
+		vertical-align: middle;
+	}
+
+	.upload-list {
+		width: 58px;
+		height: 58px;
+		border: 1px dotted rgba(0, 0, 0, 0.1);
+		border-radius: 4px;
+		margin-right: 15px;
+		display: inline-block;
+		position: relative;
+		cursor: pointer;
+		vertical-align: middle;
+	}
+
+	.upload-list img {
+		display: block;
+		width: 100%;
+		height: 100%;
+	}
+
+	.ivu-icon-ios-close-circle {
+		position: absolute;
+		top: 0;
+		right: 0;
+		transform: translate(50%, -50%);
+	}
+
+	.form-submit {
+		/deep/.ivu-card {
+			border-radius: 0;
+		}
+
+		margin-bottom: 79px;
+
+		.fixed-card {
+			position: fixed;
+			right: 0;
+			bottom: 0;
+			left: 200px;
+			z-index: 99;
+			box-shadow: 0 -1px 2px rgb(240, 240, 240);
+
+			/deep/ .ivu-card-body {
+				padding: 15px 16px 14px;
+			}
+
+			.ivu-form-item {
+				margin-bottom: 0;
+			}
+
+			/deep/ .ivu-form-item-content {
+				margin-right: 124px;
+				text-align: center;
+			}
+
+			.ivu-btn {
+				height: 36px;
+				padding: 0 20px;
+			}
+		}
+	}
+
+	/deep/.vxe-tree-cell {
+		padding-left: 0 !important;
+	}
+
+	.upLoad {
+		width: 58px;
+		height: 58px;
+		line-height: 58px;
+		border: 1px dotted rgba(0, 0, 0, 0.1);
+		border-radius: 4px;
+		background: rgba(0, 0, 0, 0.02);
+		cursor: pointer;
+	}
+
+	.product-item {
+		border: 1px solid #eee;
+		min-width: 300px;
+
+		padding: 20px ;
+		.submission {
+			// display: block;
+			margin-left: 500px;
+		}
+	}
+
+	.bom {
+		margin-right: 20px
+	}
+
+	.heji {
+		padding: 10px
+	}
+</style>

+ 377 - 0
src/pages/agent/global/index.vue

@@ -0,0 +1,377 @@
+<template>
+	<!-- 用户-客服管理-客服列表 -->
+	<div>
+		<Card :bordered="false" dis-hover class="ivu-mt">
+			<!-- 添加客服 -->
+			<Row type="flex" class="mb20">
+				<Col span="24">
+				<Button v-auth="['admin-agent-global-add']" type="primary" @click="add" class="mr10">添加</Button>
+				</Col>
+			</Row>
+			<!-- 客服列表表格 -->
+			<Table :columns="columns1" :data="tableList" :loading="loading" highlight-row no-userFrom-text="暂无数据"
+				no-filtered-userFrom-text="暂无筛选结果">
+				<template slot-scope="{ row }" slot="avatar">
+					<viewer>
+						<div class="tabBox_img">
+							<img v-lazy="row.avatar" />
+						</div>
+					</viewer>
+				</template>
+				<template slot-scope="{ row, index }" slot="action">
+					<a @click="edit(row)">编辑</a>
+					<Divider type="vertical" />
+					<a @click="del(row, '删除', index)">删除</a>
+				</template>
+			</Table>
+			<div class="acea-row row-right page">
+				<Page :total="total" show-elevator show-total @on-change="pageChange" :page-size="tableFrom.limit" />
+			</div>
+		</Card>
+	</div>
+</template>
+
+<script>
+	import {
+		mapState
+	} from "vuex";
+	import util from "@/libs/util";
+	import Setting from "@/setting";
+	import {
+		kefuListApi,
+		kefucreateApi,
+		kefuaddApi,
+		kefuAddApi,
+		kefusetStatusApi,
+		kefuEditApi,
+		kefuRecordApi,
+		kefuChatlistApi,
+		kefuLogin,
+	} from "@/api/setting";
+	import { globalList } from '@/api/agent'
+	export default {
+		name: "index",
+		filters: {
+			typeFilter(status) {
+				const statusMap = {
+					wechat: "微信用户",
+					routine: "小程序用户",
+				};
+				return statusMap[status];
+			},
+		},
+		computed: {
+			...mapState("admin/layout", ["isMobile"]),
+			...mapState("admin/userLevel", ["categoryId"]),
+			labelWidth() {
+				return this.isMobile ? undefined : 80;
+			},
+			labelPosition() {
+				return this.isMobile ? "top" : "left";
+			},
+		},
+		data() {
+			return {
+				isChat: true,
+				formValidate3: {
+					page: 1,
+					limit: 15,
+				},
+				total3: 0,
+				loading3: false,
+				modals3: false,
+				tableList3: [],
+				columns3: [{
+						title: "用户名称",
+						key: "nickname",
+						width: 200,
+					},
+					{
+						title: "客服头像",
+						slot: "headimgurl",
+					},
+					{
+						title: "操作",
+						slot: "action",
+					},
+				],
+				formValidate5: {
+					page: 1,
+					limit: 15,
+					uid: 0,
+					to_uid: 0,
+					id: 0,
+				},
+				total5: 0,
+				loading5: false,
+				tableList5: [],
+				columns5: [{
+						title: "用户名称",
+						key: "nickname",
+						width: 200,
+					},
+					{
+						title: "用户头像",
+						slot: "avatar",
+					},
+					{
+						title: "发送消息",
+						key: "msn",
+						width: 250,
+					},
+					{
+						title: "发送时间",
+						key: "add_time",
+					},
+				],
+				FromData: null,
+				formValidate: {
+					page: 1,
+					limit: 15,
+					data: "",
+					type: "",
+					nickname: "",
+				},
+				tableList2: [],
+				modals: false,
+				total: 0,
+				tableFrom: {
+					page: 1,
+					limit: 15,
+				},
+				timeVal: [],
+				fromList: {
+					title: "选择时间",
+					custom: true,
+					fromTxt: [{
+							text: "全部",
+							val: ""
+						},
+						{
+							text: "今天",
+							val: "today"
+						},
+						{
+							text: "昨天",
+							val: "yesterday"
+						},
+						{
+							text: "最近7天",
+							val: "lately7"
+						},
+						{
+							text: "最近30天",
+							val: "lately30"
+						},
+						{
+							text: "本月",
+							val: "month"
+						},
+						{
+							text: "本年",
+							val: "year"
+						},
+					],
+				},
+				loading: false,
+				tableList: [],
+				columns1: [{
+						title: "ID",
+						key: "id",
+						width: 80,
+					},
+					{
+						title: "微信用户名称",
+						key: "nickname",
+						minWidth: 120,
+					},
+					{
+						title: "客服头像",
+						slot: "avatar",
+						minWidth: 60,
+					},
+					{
+						title: "客服名称",
+						key: "wx_name",
+						minWidth: 120,
+					},
+					{
+						title: "企微员工",
+						slot: "workMember",
+						minWidth: 120,
+					},
+					{
+						title: "账号状态",
+						slot: "account_status",
+						minWidth: 120,
+					},
+					{
+						title: "添加时间",
+						key: "add_time",
+						minWidth: 130,
+					},
+					{
+						title: "操作",
+						slot: "action",
+						fixed: "right",
+						width: 200,
+					},
+				],
+				columns4: [{
+						type: "selection",
+						width: 60,
+						align: "center",
+					},
+					{
+						title: "ID",
+						key: "uid",
+						width: 80,
+					},
+					{
+						title: "微信用户名称",
+						key: "nickname",
+						minWidth: 160,
+					},
+					{
+						title: "客服头像",
+						slot: "headimgurl",
+						minWidth: 60,
+					},
+					{
+						title: "用户类型",
+						slot: "user_type",
+						width: 100,
+					},
+					{
+						title: "性别",
+						slot: "sex",
+						minWidth: 60,
+					},
+					{
+						title: "地区",
+						slot: "country",
+						minWidth: 120,
+					},
+					{
+						title: "是否关注公众号",
+						slot: "subscribe",
+						minWidth: 120,
+					},
+				],
+				loading2: false,
+				total2: 0,
+				addFrom: {
+					uids: [],
+				},
+				selections: [],
+				rows: {},
+				rowRecord: {},
+			};
+		},
+		created() {
+			this.getList();
+		},
+		methods: {
+			// 修改成功
+			submitFail() {
+				this.getList();
+			},
+			// 编辑
+			edit(row) {
+				// this.$modalForm(kefuEditApi(row.id)).then(() => this.getList());
+				this.$router.push({
+					path: "/admin/agent/global/add?id=" + row.id + '&uid=' + row.uid + '&name=' + row.name
+				});
+			},
+			// 添加
+			add() {
+				this.$router.push({
+					path: "/admin/agent/global/add"
+				});
+			},
+			// 删除
+			del(row, tit, num) {
+				let delfromData = {
+					title: tit,
+					num: num,
+					url: `user/global/delete`,
+					method: "DELETE",
+					ids: {
+						id: row.id
+					},
+				};
+				this.$modalSure(delfromData)
+					.then((res) => {
+						this.$Message.success(res.msg);
+						this.tableList.splice(num, 1);
+						if (!this.tableList.length) {
+							this.tableFrom.page =
+								this.tableFrom.page == 1 ? 1 : this.tableFrom.page - 1;
+						}
+						this.getList();
+					})
+					.catch((res) => {
+						this.$Message.error(res.msg);
+					});
+			},
+			// 列表
+			getList() {
+				this.loading = true;
+				globalList(this.tableFrom)
+					.then(async (res) => {
+						let data = res.data;
+						this.tableList = data.list;
+						this.total = res.data.count;
+						this.loading = false;
+					})
+					.catch((res) => {
+						this.loading = false;
+						this.$Message.error(res.msg);
+					});
+			},
+			pageChange(index) {
+				this.tableFrom.page = index;
+				this.getList();
+			},
+		},
+	};
+</script>
+
+<style scoped lang="stylus">
+	.tabBox_img {
+		width: 36px;
+		height: 36px;
+		border-radius: 4px;
+		cursor: pointer;
+
+		img {
+			width: 100%;
+			height: 100%;
+		}
+	}
+
+	.modelBox {
+
+		>>>,
+		.ivu-table-header {
+			width: 100% !important;
+		}
+	}
+
+	.trees-coadd {
+		width: 100%;
+		height: 385px;
+
+		.scollhide {
+			width: 100%;
+			height: 100%;
+			overflow-x: hidden;
+			overflow-y: scroll;
+		}
+	}
+
+	// margin-left: 18px;
+	.scollhide::-webkit-scrollbar {
+		display: none;
+	}
+</style>

+ 19 - 1
src/router/modules/agent.js

@@ -47,9 +47,27 @@ export default {
 		    name: `${pre}kpi`,
 		    meta: {
 		        auth: ['admin-agent-kpi-index'],
-		        title: '分销说明'
+		        title: '业绩记录'
 		    },
 		    component: () => import('@/pages/agent/kpi/index')
+		},
+		{
+		    path: 'global/index',
+		    name: `${pre}global`,
+		    meta: {
+		        auth: ['admin-agent-global-index'],
+		        title: '全局奖励'
+		    },
+		    component: () => import('@/pages/agent/global/index')
+		},
+		{
+		    path: 'global/add',
+		    name: `${pre}globalAdd`,
+		    meta: {
+		        auth: ['admin-agent-global-add'],
+		        title: '添加全局奖励'
+		    },
+		    component: () => import('@/pages/agent/global/create')
 		}
     ]
 };