lhl 2 years ago
parent
commit
697b50a9b7

+ 10 - 1
src/api/marketing.js

@@ -1386,7 +1386,16 @@ export function serveProductDeleteApi(id) {
 //服务项目列表
 export function ServeItemListApi(data) {
 	return request({
-	    url: `/productLst/lst`,
+	    url: `service/productLst/lst`,
 	    method: 'get'
 	});
+}
+
+//创建/修改服务项目
+export function createServeProduct(id,data) {
+	return request({
+	    url: `service/productUpdate/${id}`,
+	    method: 'post',
+		data
+	});
 }

+ 16 - 0
src/api/store.js

@@ -704,4 +704,20 @@ export function delYg(data) {
 		data
 	})
 }
+// 编辑员工
+export function editYg(data) {
+	return request({
+	    url: `work/edit`,
+	    method: 'post',
+		data
+	})
+}
 
+//打卡规则列表
+export function checkRuleList(data) {
+	return request({
+	    url: `work/checkRule`,
+	    method: 'post',
+		data
+	})
+}

+ 52 - 40
src/pages/marketing/serveItem/create.vue

@@ -3,7 +3,7 @@
 		<div class="i-layout-page-header">
 			<PageHeader class="product_tabs" hidden-breadcrumb>
 				<div slot="title">
-					<router-link :to="{ path: `${roterPre}/marketing/serve/index` }">
+					<router-link :to="{ path: `${roterPre}/marketing/serve_item/index` }">
 						<div class="font-sm after-line">
 							<span class="iconfont iconfanhui"></span>
 							<span class="pl10">返回</span>
@@ -15,31 +15,35 @@
 		</div>
 		<Card :bordered="false" dis-hover class="ivu-mt">
 			<Form :model="formData" :label-width="150">
-				<FormItem label="选择对应服务:" required>
+				<FormItem label="选择对应服务项目:" required>
 				    <div class="picBox" @click="changeGoods()">
-						<Button type="primary" v-if="!formData.card_name">选择商品</Button>
-				        <div class="" v-if="formData.card_name">
-							{{formData.card_name}}
+						<Button type="primary" v-if="!formData.store_name">选择商品</Button>
+				        <div class="" v-if="formData.store_name">
+							{{formData.store_name}}
 				        </div>
-						<Button type="primary" v-if="formData.card_name">
+						<Button type="primary" v-if="formData.store_name">
 							切换商品
 						</Button>
 				    </div>
 				</FormItem>
-				<!-- <FormItem label="服务卡名称" required>
-					<Input v-model="formData.card_name" v-width="320" placeholder="请输入服务卡名称"></Input>
-				</FormItem> -->
-				<!-- <FormItem label="售价" required>
-					<InputNumber :min="1" :max="100000000" v-model="formData.card_price" v-width="320"></InputNumber>
+				<FormItem label="价格" v-if="formData.price">
+					<Input  v-model="formData.price" v-width="320" disabled ></Input>
 				</FormItem>
-				<FormItem label="库存" required>
-					<InputNumber :min="1" :max="100000000" v-model="formData.repertory" v-width="320"></InputNumber>
-					</InputNumber>
-				</FormItem> -->
-				<!-- explain -->
-				<FormItem label="备注">
-					<Input v-model="formData.explain" v-width="320" placeholder=""></Input>
+				<FormItem label="库存" v-if="formData.repertory">
+					<Input  v-model="formData.repertory" v-width="320" disabled></Input>
+				</FormItem>
+				<FormItem label="业绩值" required>
+					<Input  v-model="formData.performance_value" v-width="320"></Input>
+				</FormItem>
+				<FormItem label="手工费" required>
+					<Input  v-model="formData.craft_price" v-width="320"></Input>
+				</FormItem>
+				<FormItem label="销售提成" required>
+					<Input  v-model="formData.sales_commissions" v-width="320"></Input>
 				</FormItem>
+				<!-- <FormItem label="备注">
+					<Input v-model="formData.explain" v-width="320" placeholder=""></Input>
+				</FormItem> -->
 			</Form>
 			<div style="width: 500px; display: flex;justify-content: center;">
 				<Button  type="primary" class="submission" @click="save" :disabled="disabled" v-if="!formData.id">立即创建</Button>
@@ -49,7 +53,7 @@
 		<!-- 选择商品-->
 		<Modal v-model="modals" title="商品列表" footerHide class="paymentFooter" scrollable width="900"
 		    @on-cancel="cancel">
-		    <goods-list ref="goodslist" :goodsType="1" v-if="modals" @getProductId="getProductId" :serviceCard="1"></goods-list>
+		    <goods-list ref="goodslist" :goodsType="1" v-if="modals" @getProductId="getProductId" :serviceProject="1"></goods-list>
 		</Modal>
 	</div>
 </template>
@@ -66,7 +70,8 @@
 		couponDetailApi,
 		VipEditApi,
 		serveAddApi,
-		serveReadApi
+		serveReadApi,
+		createServeProduct
 	} from "@/api/marketing";
 	import {
 		brandList
@@ -86,10 +91,10 @@
 				disabled: false,
 				storesList: [],
 				formData: {
-					id: '',
+					id: 0,
 					product_name: '',
 					product_id: 0,
-					card_name: '',
+					store_name: '',
 					repertory: '',
 					card_price: '',
 					explain: '',
@@ -112,8 +117,14 @@
 		},
 		created() {
 			if (this.$route.query.id) {
-				this.id = this.$route.query.id
-				this.getDetail();
+				let query = this.$route.query
+				this.formData.id = query.id;
+				this.formData.store_name = query.store_name;
+				this.formData.repertory = query.repertory;
+				this.formData.slider_image = query.slider_image;
+				this.formData.performance_value = query.performance_value;
+				this.formData.craft_price = query.craft_price;
+				this.formData.sales_commissions = query.sales_commissions
 			}
 		},
 		methods: {
@@ -124,13 +135,14 @@
 			    this.modals = false;
 			    setTimeout(() => {
 					this.formData.product_id = row.id
-						this.formData.card_name = row.store_name
+						this.formData.store_name = row.store_name
 						this.formData.product_id = row.id
 						this.formData.card_price = row.price
 						this.formData.unit_name = row.unit_name
-						this.formData.image = row.image
-						this.formData.images = row.slider_image
-						this.formData.is_show = 1
+						this.formData.slider_image = row.image
+						this.formData.price = row.price
+						// this.formData.slider_image = row.slider_image
+						// this.formData.is_show = 1
 						this.formData.repertory = row.stock
 					// this.formData.image = row.image
 			    }, 500);
@@ -140,27 +152,27 @@
 			    this.modals = true;
 			},
 			downTab() {
-				if (!this.formData.card_name) {
-					return this.$Message.error("请输入服务卡名称");
-				}
-				if (!this.formData.card_price) {
-					return this.$Message.error("请输入售价");
-				}
-				if (!this.formData.repertory) {
-					return this.$Message.error("请输入库存");
-				}
+				// if (!this.formData.store_name) {
+				// 	return this.$Message.error("请输入服务卡名称");
+				// }
+				// if (!this.formData.card_price) {
+				// 	return this.$Message.error("请输入售价");
+				// }
+				// if (!this.formData.repertory) {
+				// 	return this.$Message.error("请输入库存");
+				// }
 			},
 			// 创建
 			save() {
 				this.downTab();
 				console.log('这');
-				serveAddApi(this.formData)
+				createServeProduct(this.formData.id, this.formData)
 					.then((res) => {
 						this.disabled = true;
 						this.$Message.success(res.msg);
 						setTimeout(() => {
 							this.$router.push({
-								path: this.roterPre + "/marketing/serve/index",
+								path: this.roterPre + "/marketing/serve_item/index",
 							});
 						}, 1000);
 					})
@@ -212,7 +224,7 @@
 					this.formData = {
 						id: row.id,
 						product_id: row.id,
-						card_name: row.card_name,
+						store_name: row.store_name,
 						card_price: row.card_price,
 						explain: row.explain,
 						unit_name: row.unit_name,

+ 17 - 22
src/pages/marketing/serveItem/index.vue

@@ -30,7 +30,7 @@
 				<Row type="flex">
 					<Col v-bind="grid">
 					<Button v-auth="['admin-marketing-serve-add']" type="primary" icon="md-add"
-						@click="add">添加服务</Button>
+						@click="add">添加服务项目</Button>
 					</Col>
 				</Row>
 			</Form>
@@ -52,11 +52,11 @@
 					<span> {{row.add_time }}</span>
 				</template>
 				<template slot-scope="{ row, index }" slot="action">
-					<a @click="bind(row)">绑定项目</a>
-					<Divider type="vertical" />
+					<!-- <a @click="bind(row)">绑定项目</a>
+					<Divider type="vertical" /> -->
 					<a @click="couponSend(row)">编辑</a>
 					<Divider type="vertical" />
-					<a @click="couponDel(row,'删除服务',index)">删除</a>
+					<a @click="couponDel(row,'删除服务项目',index)">删除</a>
 				</template>
 			</Table>
 			<div class="acea-row row-right page">
@@ -116,33 +116,28 @@
 						width: 80
 					},
 					{
-						title: '优惠券名称',
-						key: 'card_name',
+						title: '服务项目',
+						key: 'store_name',
 						minWidth: 150
 					},
 					{
-						title: '售价',
-						key: 'card_price',
+						title: '业绩值',
+						key: 'performance_value',
 						minWidth: 80
 					},
 					{
-						title: '库存',
-						key: 'repertory',
+						title: '手工费',
+						key: 'craft_price',
 						minWidth: 100
 					},
 					{
-						title: '销售',
-						key: 'sales_volume',
+						title: '销售提成',
+						key: 'sales_commissions',
 						minWidth: 100
 					},
-					// {
-					// 	title: '是否显示',
-					// 	slot: 'is_show',
-					// 	minWidth: 100
-					// },
 					{
-						title: '备注',
-						key: 'explain',
+						title: '库存',
+						key: 'repertory',
 						minWidth: 100
 					},
 					{
@@ -209,14 +204,14 @@
 			// 发布
 			couponSend(row) {
 				// this.$modalForm(serveEditApi(row.id)).then(() => this.getList());
-				this.$router.push({path: this.roterPre + "/marketing/serve/create?id=" + row.id});
+				this.$router.push({path: this.roterPre + "/marketing/serve_item/create?id=" + row.id + '&craft_price=' + row.craft_price + '&performance_value=' + row.performance_value + '&product_id=' + row.product_id + '&repertory=' + row.repertory + '&sales_commissions=' + row.sales_commissions + '&slider_image=' + row.slider_image + '&store_name=' + row.store_name});
 				console.log(row);
 			},
 			// 删除
 			couponDel(row, tit, num) {
 				let delfromData = {
 					title: tit,
-					url: `service/delete/${row.id}`,
+					url: `service/productDelete/${row.id}`,
 					method: 'DELETE',
 					ids: ''
 				};
@@ -251,7 +246,7 @@
 			// 添加
 			add() {
 				this.$router.push({
-					path: this.roterPre + "/marketing/serve/create"
+					path: this.roterPre + "/marketing/serve_item/create"
 				});
 				// this.addType(0);
 			},

+ 396 - 0
src/pages/store/checkRule/create.vue

@@ -0,0 +1,396 @@
+<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}/marketing/serve_item/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="规则名称" required>
+					<Input v-model="formData.groupname" v-width="320" disabled></Input>
+				</FormItem>
+			</Form>
+			<div style="width: 500px; display: flex;justify-content: center;">
+				<Button type="primary" class="submission" @click="save" :disabled="disabled"
+					v-if="!formData.id">立即创建</Button>
+				<Button type="primary" class="submission" @click="save" :disabled="disabled" v-else>立即修改</Button>
+			</div>
+		</Card>
+	</div>
+</template>
+
+<script>
+	import {
+		mapState
+	} from "vuex";
+	import storeList from "@/components/storeList";
+	import {
+		couponCategoryApi,
+		couponSaveApi,
+		couponDetailApi,
+		VipEditApi,
+		serveAddApi,
+		serveReadApi,
+		createServeProduct
+	} from "@/api/marketing";
+	import {
+		brandList
+	} from "@/api/product";
+	// import { formatDate } from '@/utils/validate';
+	import Setting from "@/setting";
+	export default {
+		name: "storeCouponCreate",
+		components: {
+			storeList
+		},
+		data() {
+			return {
+				id: '',
+				roterPre: Setting.roterPre,
+				disabled: false,
+				storesList: [],
+				formData: {
+					groupname: '',
+					groupid: '',
+					grouptype: 2, //规则类型: 1-固定时间上下班;2-按班次上下班;3-自由上下班
+					type: 2, //	打卡方式 0-手机,2-考勤机,3-手机/考勤机
+					loc_infos: [{
+						lat: 30547030,
+						lng: 104062890,
+						loc_title: "腾讯成都大厦",
+						loc_detail: "四川省成都市武侯区高新南区天府三街",
+						distance: 300
+					}],
+					range: {
+						userid: [
+							"xiaoxioa"
+						]
+					},//打卡人员
+					schedulelist: [
+						{
+							
+						}
+					]
+				},
+				id: 0,
+				product_name: '',
+				product_id: 0,
+				store_name: '',
+				repertory: '',
+				card_price: '',
+				explain: '',
+				unit_name: '',
+				image: '',
+				images: ''
+			},
+				modals: false,
+				}
+		};
+	},
+	computed: {
+			...mapState("admin/layout", ["isMobile", "menuCollapse"]),
+		},
+		created() {
+			if (this.$route.query.id) {
+				let query = this.$route.query
+				this.formData.id = query.id;
+				this.formData.store_name = query.store_name;
+				this.formData.repertory = query.repertory;
+				this.formData.slider_image = query.slider_image;
+				this.formData.performance_value = query.performance_value;
+				this.formData.craft_price = query.craft_price;
+				this.formData.sales_commissions = query.sales_commissions
+			}
+		},
+		methods: {
+			// 商品id
+			getProductId(row) {
+				console.log(row, '这个');
+				this.modal_loading = false;
+				this.modals = false;
+				setTimeout(() => {
+					this.formData.product_id = row.id
+					this.formData.store_name = row.store_name
+					this.formData.product_id = row.id
+					this.formData.card_price = row.price
+					this.formData.unit_name = row.unit_name
+					this.formData.slider_image = row.image
+					this.formData.price = row.price
+					// this.formData.slider_image = row.slider_image
+					// this.formData.is_show = 1
+					this.formData.repertory = row.stock
+					// this.formData.image = row.image
+				}, 500);
+			},
+			// 选择商品
+			changeGoods() {
+				this.modals = true;
+			},
+			downTab() {
+				// if (!this.formData.store_name) {
+				// 	return this.$Message.error("请输入服务卡名称");
+				// }
+				// if (!this.formData.card_price) {
+				// 	return this.$Message.error("请输入售价");
+				// }
+				// if (!this.formData.repertory) {
+				// 	return this.$Message.error("请输入库存");
+				// }
+			},
+			// 创建
+			save() {
+				this.downTab();
+				console.log('这');
+				createServeProduct(this.formData.id, this.formData)
+					.then((res) => {
+						this.disabled = true;
+						this.$Message.success(res.msg);
+						setTimeout(() => {
+							this.$router.push({
+								path: this.roterPre + "/marketing/serve_item/index",
+							});
+						}, 1000);
+					})
+					.catch((err) => {
+						this.$Message.error(err.msg);
+					});
+			},
+			// 使用有效期--时间段
+			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)
+				);
+			},
+			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}`;
+					}
+				});
+			},
+			// 获取详情
+			getDetail() {
+				serveReadApi(this.id).then(res => {
+					console.log(res);
+					let row = res.data.info.storeInfo
+					this.formData = {
+						id: row.id,
+						product_id: row.id,
+						store_name: row.store_name,
+						card_price: row.card_price,
+						explain: row.explain,
+						unit_name: row.unit_name,
+						image: row.image,
+						images: row.slider_image,
+						repertory: row.repertory,
+						is_show: 1
+					}
+				})
+			}
+		},
+	};
+</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;
+	}
+</style>

+ 224 - 2
src/pages/store/checkRule/index.vue

@@ -1,8 +1,230 @@
 <template>
+    <div>
+        <div class="i-layout-page-header">
+            <PageHeader class="product_tabs" title="会员卡" hidden-breadcrumb></PageHeader>
+        </div>
+        <Card :bordered="false" dis-hover class="ivu-mt">
+			<Form ref="tableFrom" :model="tableFrom"  :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
+			    <Row type="flex">
+			        <Col v-bind="grid">
+			            <Button v-auth="['admin-marketing-store_coupon-add']" type="primary"  icon="md-add" @click="add">添加打卡规则</Button>
+			        </Col>
+			    </Row>
+			</Form>
+            <Table :columns="columns1" :data="tableList" ref="table" class="mt25"
+                   :loading="loading" highlight-row
+                   no-userFrom-text="暂无数据"
+                   no-filtered-userFrom-text="暂无筛选结果">
+								<template slot-scope="{ row }" slot="coupon_price">
+								   <span v-if="row.coupon_type==1">{{row.coupon_price}}元</span>
+									 <span v-if="row.coupon_type==2">{{parseFloat(row.coupon_price)/10}}折({{row.coupon_price.toString().split(".")[0]}}%)</span>
+								</template>	 
+                <template slot-scope="{ row, index }" slot="status">
+                    <Icon type="md-checkmark" v-if="row.status === 1" color="#0092DC" size="14"/>
+                    <Icon type="md-close" v-else color="#ed5565" size="14"/>
+                </template>
+                <template slot-scope="{ row, index }" slot="add_time">
+                    <span> {{row.add_time | formatDate}}</span>
+                </template>
+                <template slot-scope="{ row, index }" slot="action">
+                    <a @click="couponSend(row)" >编辑</a>
+                    <Divider type="vertical" />
+                    <a @click="couponDel(row,'删除会员卡',index)">删除</a>
+                </template>
+            </Table>
+            <div class="acea-row row-right page">
+                <Page :total="total" :current="tableFrom.page" show-elevator show-total @on-change="pageChange"
+                      :page-size="tableFrom.limit"/>
+            </div>
+        </Card>
+        <!--表单编辑-->
+        <edit-from :FromData="FromData" @changeType="changeType" ref="edits"></edit-from>
+    </div>
 </template>
 
 <script>
+    import { mapState } from 'vuex';
+    import { couponListApi, couponCreateApi, couponEditeApi, couponSendApi,vipListApi,VipDeleteApi ,VipEditApi} from '@/api/marketing';
+	import { checkGroupList,checkRuleList } from '@/api/store';
+    import editFrom from '@/components/from/from';
+    import { formatDate } from '@/utils/validate';
+	import Setting from "@/setting";
+    export default {
+        name: 'storeCoupon',
+        filters: {
+            formatDate (time) {
+                if (time !== 0) {
+                    let date = new Date(time * 1000);
+                    return formatDate(date, 'yyyy-MM-dd hh:mm');
+                }
+            }
+        },
+        components: { editFrom },
+        data () {
+            return {
+				roterPre: Setting.roterPre,
+                grid: {
+                    xl: 7,
+                    lg: 7,
+                    md: 12,
+                    sm: 24,
+                    xs: 24
+                },
+                loading: false,
+                columns1: [
+                    {
+                        title: 'ID',
+                        key: 'id',
+                        width: 80
+                    },
+                    {
+                        title: '考勤组名称',
+                        key: 'name',
+                        minWidth: 150
+                    },
+                    {
+                        title: 'price',
+                        key: 'price',
+                        minWidth: 80
+                    },
+                    {
+                        title: 'classes_id',
+                        key: 'classes_id',
+                        minWidth: 100
+                    },
+                    // {
+                    //     title: '折扣',
+                    //     key: 'discount_ratio',
+                    //     minWidth: 100
+                    // },
+                    {
+                        title: '操作',
+                        slot: 'action',
+                        fixed: 'right',
+                        minWidth: 170
+                    }
+                ],
+                tableFrom: {
+                    page: 1,
+                    limit: 15
+                },
+                tableList: [],
+                total: 0,
+                FromData: null
+            }
+        },
+        created () {
+            this.getList();
+        },
+        computed: {
+            ...mapState('admin/layout', [
+                'isMobile'
+            ]),
+            labelWidth () {
+                return this.isMobile ? undefined : 90;
+            },
+            labelPosition () {
+                return this.isMobile ? 'top' : 'left';
+            }
+        },
+        methods: {
+            // 失效
+            couponInvalid (row, tit, num) {
+                let delfromData = {
+                    title: tit,
+                    num: num,
+                    url: `marketing/coupon/status/${row.id}`,
+                    method: 'PUT',
+                    ids: ''
+                };
+                this.$modalSure(delfromData).then((res) => {
+                    this.$Message.success(res.msg);
+                    this.getList();
+                }).catch(res => {
+                    this.$Message.error(res.msg);
+                });
+            },
+            // 发布
+            couponSend (row) {
+                this.$modalForm(VipEditApi(row.id)).then(() => this.getList());
+            },
+            // 删除
+            couponDel (row, tit, num) {
+                let delfromData = {
+                    title: tit,
+                    url: `membership/deleteCard/${row.id}`,
+                    method: 'DELETE',
+                    ids: ''
+                };
+                this.$modalSure(delfromData).then((res) => {
+                    this.$Message.success(res.msg);
+                    this.tableList.splice(num, 1)
+                }).catch(res => {
+                    this.$Message.error(res.msg);
+                });
+            },
+            // 列表
+            getList () {
+                this.loading = true;
+                
+                checkRuleList(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();
+            },
+            changeType (data) {
+                this.type = data;
+            },
+            // 添加
+            add () {
+                // this.$modalForm(couponCreateApi()).then(() => this.getList());
+				this.$router.push({ path: this.roterPre + "/store/checkRule/create" });
+                // this.addType(0);
+            },
+            addType (type) {
+                couponCreateApi(type).then(async res => {
+                    if (res.data.status === false) {
+                        return this.$authLapse(res.data);
+                    }
+					// console.log()
+					console.log(res.data,'res.data');
+                    this.FromData = res.data;
+                    this.$refs.edits.modals = true;
+                }).catch(res => {
+                    this.$Message.error(res.msg);
+                })
+            },
+            // 编辑
+            edit (row) {
+                this.$modalForm(couponEditeApi(row.id)).then(() => this.getList());
+            },
+            // 表格搜索
+            userSearchs () {
+                this.tableFrom.page = 1;
+                this.getList();
+            },
+            // 修改成功
+            submitFail () {
+                this.getList();
+            }
+        }
+    }
 </script>
 
-<style>
-</style>
+<style scoped>
+    .ivu-col:nth-of-type(1) .ivu-form-item .ivu-form-item-label{
+        width: 80px !important;
+    }
+    .ivu-col:nth-of-type(1) .ivu-form-item .ivu-form-item-content{
+        margin-left: 80px !important;
+    }
+</style>

+ 55 - 37
src/pages/store/components/addStaff.vue

@@ -138,7 +138,8 @@
 		cascaderList,
 		staffListInfo,
 		getDepartmentList,
-		addYg
+		addYg,
+		editYg
 	} from '@/api/store';
 	import {
 		erpConfig
@@ -177,6 +178,7 @@
 				}
 			};
 			return {
+				isEdit: 0,//0->添加 1->编辑
 				staffData: [],
 				goodsList: [],
 				modals: false,
@@ -260,6 +262,17 @@
 			}
 			this.cityInfo(data);
 			this.staffList()
+			if(this.isEdit == 0) {
+				this.formItem = {
+					name: '',
+					avatar: '',
+					mobile: '',
+					alias: '',
+					address: '',
+					main_department: '',
+					direct_leader: 'ZhouFengYu'
+				}
+			}
 		},
 		computed: {
 			...mapState('admin/layout', [
@@ -348,38 +361,20 @@
 			},
 			clearFrom() {
 				this.goodsList = [];
-				// this.formItem = {
-				// 	cate_id: [],
-				// 	id: 0,
-				// 	store_account: '',
-				// 	store_password: "",
-				// 	image: '',
-				// 	erp_shop_id: 0,
-				// 	name: '',
-				// 	introduction: '',
-				// 	phone: '',
-				// 	is_show: 1,
-				// 	day_time: [],
-				// 	is_store: 0,
-				// 	address: '',
-				// 	detailed_address: '',
-				// 	latitude: '',
-				// 	longitude: '',
-				// 	province: 0,
-				// 	city: 0,
-				// 	area: 0,
-				// 	street: 0,
-				// 	addressSelect: [],
-				// 	valid_range: 0,
-				// 	product_verify_status: 0,
-				// 	product_status: 1,
-				// 	type: 1,
-				// 	applicable_type: 1
-				// }
+				this.formItem = {
+					name: '',
+					avatar: '',
+					mobile: '',
+					alias: '',
+					address: '',
+					main_department: '',
+					direct_leader: 'ZhouFengYu'
+				}
 				this.add = 0;
 				this.isApi = 0;
 			},
 			cancel() {
+				console.log('关闭');
 				this.isTemplate = false;
 				// this.$refs['formItem'].resetFields();
 				this.clearFrom();
@@ -494,15 +489,38 @@
 			handleSubmit(name) {
 				this.$refs[name].validate((valid) => {
 					if (valid) {
+						if(this.formItem.id) {
+							editYg({
+								id: this.formItem.id,
+								name:  this.formItem.name,
+								avatar:  this.formItem.avatar,
+								mobile:  this.formItem.mobile,
+								alias:  this.formItem.alias,
+								address:  this.formItem.address,
+								main_department:  this.formItem.main_department,
+								department: this.formItem.department,
+								uid: this.formItem.uid,
+								userid: this.formItem.userid,
+								direct_leader: 'ZhouFengYu'
+							}).then(async res => {
+								this.$Message.success(res.msg);
+								this.isTemplate = false;
+								this.$emit('success')
+								// this.clearFrom();
+							}).catch(res => {
+								this.$Message.error(res.msg);
+							})
+						}else {
+							addYg(this.formItem).then(async res => {
+								this.$Message.success(res.msg);
+								this.isTemplate = false;
+								this.$emit('success')
+								// this.clearFrom();
+							}).catch(res => {
+								this.$Message.error(res.msg);
+							})
+						}
 						
-						addYg(this.formItem).then(async res => {
-							this.$Message.success(res.msg);
-							this.isTemplate = false;
-							this.$emit('success')
-							// this.clearFrom();
-						}).catch(res => {
-							this.$Message.error(res.msg);
-						})
 					} else {
 						return false;
 					}

+ 14 - 36
src/pages/store/staff/index.vue

@@ -28,6 +28,9 @@
 					<template slot-scope="{ row }" slot="avatar">
 						<img :src="row.avatar" />
 					</template>
+					<template slot-scope="{ row }" slot="department_list">
+						<div>{{row.department_list[0].name.name || ''}}</div>
+					</template>
 					<template slot-scope="{ row, index }" slot="action">
 						<!-- <a @click="gostore(row)">进入门店</a>
 						<Divider type="vertical" />
@@ -46,7 +49,7 @@
 				</div>
 			</div>
 		</Card>
-		<add-staff ref="template" @success="addsuccess" :staffInfo="staffInfo"></add-staff>
+		<add-staff ref="template" @success="addsuccess" :staffInfo="staffInfo" ></add-staff>
 	</div>
 </template>
 
@@ -70,6 +73,7 @@
 		},
 		data() {
 			return {
+				
 				staffInfo: {},
 				staffData: [],
 				queryData:{
@@ -110,6 +114,11 @@
 						key: "name",
 						minWidth: 80,
 					},
+					{
+						title: "部门",
+						slot: "department_list",
+						minWidth: 100
+					},
 					{
 						title: "职务",
 						key: "position",
@@ -196,6 +205,7 @@
 				this.$modalForm(resetApi(row.id)).then(() => this.getList());
 			},
 			add() {
+				this.$refs.template.isEdit = 0;
 				this.$refs.template.title = "添加店员";
 				this.$refs.template.add = 1;
 				this.$refs.template.isTemplate = true;
@@ -207,6 +217,8 @@
 				this.$refs.template.title = "编辑店员";
 				this.$refs.template.isTemplate = true;
 				// this.$refs.template.getInfo(row.id);
+				let editData = row
+				console.log(row);
 				this.$refs.template.formItem = row
 			},
 			getExpiresTime(expiresTime) {
@@ -214,41 +226,7 @@
 				let expiresTimeNum = expiresTime - nowTimeNum;
 				return parseFloat(parseFloat(parseFloat(expiresTimeNum / 60) / 60) / 24);
 			},
-			// 进入门店
-			gostore(item) {
-				storeLogin(item.id)
-					.then((res) => {
-						let data = res.data;
-						let expires = data.expires_time;
-						util.cookies.setStore("token", data.token, {
-							expires: expires,
-						});
-						util.cookies.setStore("uuid", data.user_info.id, {
-							expires: expires,
-						});
-						util.cookies.setStore("expires_time", expires, {
-							expires: expires,
-						});
-						util.makeMenu(`/${data.prefix}`, data.menus);
-						let storage = window.localStorage;
-						storage.setItem("menuListStore", JSON.stringify(data.menus));
-						storage.setItem("uniqueAuthStore", JSON.stringify(data.unique_auth));
-						let userInfoStore = {
-							account: data.user_info.account,
-							head_pic: data.user_info.avatar,
-							logo: data.logo,
-							logoSmall: data.logo_square,
-							version: data.version,
-						};
-						storage.setItem("userInfoStore", JSON.stringify(userInfoStore));
-						// menuListStore
-						this.BaseURL = Setting.apiBaseURL.replace(/adminapi/, `${item.prefix}/home/`);
-						window.open(this.BaseURL);
-					})
-					.catch((err) => {
-						this.$Message.error(err.msg);
-					});
-			},
+			
 			delte(row, tit, num) {
 				let delfromData = {
 					title: tit,

+ 18 - 0
src/router/modules/store.js

@@ -158,5 +158,23 @@ export default {
 			},
 			component: () => import('@/pages/store/checkGroup/index')
 		},
+		{
+			path: 'checkRule/index',
+			name: `${pre}checkRuleIndex`,
+			meta: {
+				auth: ['admin-store-checkRule-index'],
+				title: '打卡规则'
+			},
+			component: () => import('@/pages/store/checkRule/index')
+		},
+		{
+			path: 'checkRule/create',
+			name: `${pre}checkRuleCreate`,
+			meta: {
+				auth: ['admin-store-checkRule-add'],
+				title: '打卡规则'
+			},
+			component: () => import('@/pages/store/checkRule/create')
+		},
 	]
 };