lhl 2 years ago
parent
commit
b4abfe4c79

+ 9 - 0
src/api/store.js

@@ -729,4 +729,13 @@ export function addCheckRule(data) {
 	    method: 'post',
 	    method: 'post',
 		data
 		data
 	})
 	})
+}
+
+//班次列表
+export function getClasses(data) {
+	return request({
+	    url: `work/checkClasses`,
+	    method: 'get',
+		params: data
+	})
 }
 }

+ 465 - 0
src/components/ruleList/index.vue

@@ -0,0 +1,465 @@
+<template>
+	<div class="goodList">
+		<Table ref="table" no-data-text="暂无数据" @on-select-all="selectAll" @on-select-all-cancel="cancelAll"
+			@on-select="TableSelectRow" @on-select-cancel="TableSelectCancelRow" no-filtered-data-text="暂无筛选结果"
+			:columns="columns4" :data="tableList" :loading="loading" class="mr-20" height="500">
+			<!-- <template slot-scope="{ row }" slot="store_name">
+				<Tooltip max-width="200" placement="bottom">
+					<span class="line2">{{ row.store_name }}{{row.suk}}</span>
+					<p slot="content">{{ row.store_name }}{{row.suk}}</p>
+				</Tooltip>
+			</template> -->
+			<template slot-scope="{ row }" slot="avatar">
+				<viewer>
+					<div class="tabBox_img">
+						<img v-lazy="row.avatar" />
+					</div>
+				</viewer>
+			</template>
+		</Table>
+		<div class="acea-row row-right page">
+			<Page :total="total" show-elevator show-total @on-change="pageChange" :page-size="formValidate.limit" />
+		</div>
+		<div class="footer" slot="footer" >
+			<Button type="primary" size="large" :loading="modal_loading" long @click="ok">确定</Button>
+		</div>
+	</div>
+</template>
+
+<script>
+	import {
+		mapState
+	} from "vuex";
+	import {
+		cascaderListApi,
+		changeListApi,
+		allLabelApi
+	} from "@/api/product";
+	import {
+		getYgList
+	} from '@/api/store'
+	import {
+		liveGoods
+	} from "@/api/live";
+	export default {
+		name: "index",
+		props: {
+			serviceProject: {
+				type: Number,
+				default: 0,
+			},
+			serviceCard: {
+				type: Number,
+				default: 0,
+			},
+			goodsType: {
+				type: Number,
+				default: 0,
+			},
+			storeType: {
+				type: Number,
+				default: 0,
+			},
+			is_new: {
+				type: String,
+				default: "",
+			},
+			diy: {
+				type: Boolean,
+				default: false,
+			},
+			isdiy: {
+				type: Boolean,
+				default: false,
+			},
+			ischeckbox: {
+				type: Boolean,
+				default: false,
+			},
+			liveStatus: {
+				type: Boolean,
+				default: false,
+			},
+			isLive: {
+				type: Boolean,
+				default: false,
+			},
+			datas: {
+				type: Object,
+				default: function() {
+					return {};
+				},
+			},
+		},
+		data() {
+			return {
+				//选中商品集合
+				selectEquips: [],
+				// 选中的id集合
+				selectEquipsIds: [],
+				labelSelect: [],
+				cateIds: [],
+				modal_loading: false,
+				treeSelect: [],
+				formValidate: {
+					service_project: this.serviceProject,
+					service_card: this.serviceCard,
+					page: 1,
+					limit: 10,
+					cate_id: "",
+					store_name: "",
+					is_new: this.is_new,
+					store_label_id: ""
+				},
+				total: 0,
+				modals: false,
+				loading: false,
+				grid: {
+					xl: 10,
+					lg: 10,
+					md: 12,
+					sm: 24,
+					xs: 24,
+				},
+				tableList: [],
+				currentid: 0,
+				productRow: {},
+				columns4: [{
+						type: 'selection',
+						width: 60,
+						align: 'center'
+					},
+					{
+						title: "员工ID",
+						key: "id",
+					},
+					{
+						title: "头像",
+						slot: "avatar",
+						width: 60,
+					},
+					{
+						title: "员工姓名",
+						key: "name",
+						minWidth: 200,
+					},
+					{
+						title: "创建时间",
+						key: "create_time",
+						minWidth: 100,
+					},
+				],
+				columns5: [{
+						title: "商品ID",
+						key: "id",
+					},
+					{
+						title: "图片",
+						slot: "image",
+					},
+					{
+						title: "商品名称",
+						key: "name",
+						minWidth: 250,
+					},
+				],
+				images: [],
+				many: "",
+			};
+		},
+		computed: {
+			...mapState("admin/layout", ["isMobile"]),
+			labelWidth() {
+				return this.isMobile ? undefined : 120;
+			},
+			labelPosition() {
+				return this.isMobile ? "top" : "right";
+			},
+		},
+		created() {
+			// let radio = {
+			// 	title: "选择",
+			// 	width: 70,
+			// 	align: "center",
+			// 	render: (h, params) => {
+			// 		let id = params.row.id;
+			// 		let flag = false;
+			// 		if (this.currentid === id) {
+			// 			flag = true;
+			// 		} else {
+			// 			flag = false;
+			// 		}
+			// 		let self = this;
+			// 		return h("div", [
+			// 			h("Radio", {
+			// 				props: {
+			// 					value: flag,
+			// 				},
+			// 				on: {
+			// 					"on-change": () => {
+			// 						self.currentid = id;
+			// 						this.productRow = params.row;
+			// 						console.log('zhe+++')
+			// 						this.$emit("getProductId", this.productRow);
+			// 						if (this.productRow.id) {
+			// 							if (this.$route.query.fodder === "image") {
+			// 								/* eslint-disable */
+			// 								let imageObject = {
+			// 									image: this.productRow.image,
+			// 									product_id: this.productRow.id,
+			// 									name: this.productRow.name,
+			// 								};
+			// 								form_create_helper.set("image", imageObject);
+			// 								form_create_helper.close("image");
+			// 							}
+			// 						} else {
+			// 							this.$Message.warning("请先选择商品");
+			// 						}
+			// 					},
+			// 				},
+			// 			}),
+			// 		]);
+			// 	},
+			// };
+
+			// let checkbox = {
+			// 	type: "selection",
+			// 	width: 60,
+			// 	align: "center",
+			// };
+			// let many = "";
+			// if (this.ischeckbox) {
+			// 	many = "many";
+			// } else {
+			// 	many = this.$route.query.type;
+			// }
+			// this.many = many;
+			// if (many === "many") {
+			// 	this.columns4.unshift(checkbox);
+			// 	this.columns5.unshift(checkbox);
+			// } else {
+			// 	this.columns4.unshift(radio);
+			// 	this.columns5.unshift(radio);
+			// }
+		},
+		mounted() {
+			this.goodsCategory();
+			this.getList();
+			this.getAllLabelApi();
+		},
+		methods: {
+			// 判断是否选中
+			sortData() {
+				if (this.selectEquipsIds.length) {
+					this.tableList.forEach(ele => {
+						if (this.selectEquipsIds.includes(ele.id)) ele._checked = true;
+					})
+				}
+			},
+			// 选中一行
+			TableSelectRow(selection, row) {
+				if (!this.selectEquipsIds.includes(row.id)) {
+					this.selectEquipsIds.push(row.id);
+					this.selectEquips.push(row);
+				}
+			},
+			// 取消选中一行
+			TableSelectCancelRow(selection, row) {
+				var _index = this.selectEquipsIds.indexOf(row.id);
+				if (_index != -1) {
+					this.selectEquipsIds.splice(_index, 1);
+					this.selectEquips.splice(_index, 1);
+				}
+			},
+			// 选中所有
+			selectAll() {
+				for (let i = this.tableList.length - 1; i >= 0; i--) {
+					this.TableSelectRow(null, this.tableList[i]);
+				}
+			},
+			// 取消选中所有
+			cancelAll() {
+				for (let i = this.tableList.length - 1; i >= 0; i--) {
+					this.TableSelectCancelRow(null, this.tableList[i]);
+				}
+			},
+			getAllLabelApi() {
+				allLabelApi().then(res => {
+					this.labelSelect = res.data
+				}).catch(err => {
+					this.$Message.error(err.msg);
+				})
+			},
+			handleSelectAll() {
+				this.$refs.table.selectAll(false);
+			},
+			// 商品分类;
+			goodsCategory() {
+				cascaderListApi(1)
+					.then((res) => {
+						this.treeSelect = res.data;
+					})
+					.catch((res) => {
+						this.$Message.error(res.msg);
+					});
+			},
+			pageChange(index) {
+				this.formValidate.page = index;
+				this.getList();
+			},
+			// 列表
+			getList() {
+				this.loading = true;
+				if (!this.liveStatus) {
+					if (this.isLive) {
+						this.formValidate.is_live = 1;
+					}
+					if (this.goodsType) {
+						this.formValidate.is_presale_product = 0;
+						this.formValidate.is_vip_product = 0;
+					}
+					if (this.storeType) {
+						this.formValidate.is_supplier = 0;
+					}
+
+					this.formValidate.cate_id = this.cateIds[this.cateIds.length - 1]
+					getYgList(this.formValidate)
+						.then(async (res) => {
+							let data = res.data;
+							this.tableList = data.list;
+							this.total = res.data.count;
+							this.sortData();
+							this.loading = false;
+						})
+						.catch((res) => {
+							this.loading = false;
+							this.$Message.error(res.msg);
+						});
+				} else {
+					liveGoods({
+							is_show: "1",
+							status: "1",
+							live_id: this.datas.id,
+							kerword: this.formValidate.store_name,
+							page: this.formValidate.page,
+							limit: this.formValidate.limit,
+						})
+						.then(async (res) => {
+							let data = res.data;
+							data.list.forEach((el) => {
+								el.image = el.cover_img;
+							});
+							this.tableList = data.list;
+							this.total = res.data.count;
+							this.sortData();
+							this.loading = false;
+						})
+						.catch((res) => {
+							this.loading = false;
+							this.$Message.error(res.msg);
+						});
+				}
+			},
+			changeCheckbox(selection) {
+				let images = [];
+				selection.forEach(function(item) {
+					let imageObject = {
+						image: item.image,
+						product_id: item.id,
+						store_name: item.store_name,
+						temp_id: item.temp_id
+					};
+					images.push(imageObject);
+				});
+				this.images = images;
+				this.$emit("getProductDiy", selection);
+			},
+			ok() {
+				// console.log('selectEquips',this.selectEquips)
+				this.$emit("getProductId", this.selectEquips);
+				// let images = [];
+				// this.selectEquips.forEach(function(item) {
+				// 	let imageObject = {
+				// 		image: item.image,
+				// 		product_id: item.id,
+				// 		store_name: item.store_name,
+				// 		temp_id: item.temp_id
+				// 	};
+				// 	images.push(imageObject);
+				// });
+				// if (images.length > 0) {
+				// 	if (this.$route.query.fodder === "image") {
+				// 		let imageValue = form_create_helper.get("image");
+				// 		form_create_helper.set("image", imageValue.concat(images));
+				// 		form_create_helper.close("image");
+				// 	} else {
+				// 		if (this.isdiy) {
+				// 			this.$emit("getProductId", this.selectEquips);
+				// 		} else {
+				// 			this.$emit("getProductId", images);
+				// 		}
+				// 	}
+				// } else {
+				// 	this.$Message.warning("请先选择商品");
+				// }
+			},
+			treeSearchs(value) {
+				this.cateIds = value;
+				this.formValidate.page = 1;
+				this.getList();
+			},
+			// 表格搜索
+			userSearchs() {
+				this.formValidate.page = 1;
+				this.getList();
+			},
+			clear() {
+				this.productRow.id = "";
+				this.currentid = "";
+			},
+		},
+	};
+</script>
+
+<style scoped lang="stylus">
+	/deep/.ivu-table-header thead tr th {
+		padding: 8px 5px;
+	}
+
+	/deep/.ivu-radio-wrapper {
+		margin-right: 0 !important;
+	}
+
+	.footer {
+		margin: 15px 0;
+	}
+
+	.tabBox_img {
+		width: 36px;
+		height: 36px;
+		border-radius: 4px;
+		cursor: pointer;
+
+		img {
+			width: 100%;
+			height: 100%;
+		}
+	}
+
+	.tabform {
+		>>>.ivu-form-item {
+			margin-bottom: 16px !important;
+		}
+	}
+
+	.btn {
+		margin-top: 20px;
+		float: right;
+	}
+
+	.goodList {}
+
+	.mr-20 {
+		margin-right: 10px;
+	}
+</style>

+ 557 - 0
src/pages/store/checkGroup/create.vue

@@ -0,0 +1,557 @@
+<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}/store/checkRule/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"></Input>
+				</FormItem>
+				<FormItem label="打卡员工" required>
+					<!-- <Input v-model="formData.groupname" v-width="320"></Input> -->
+					<template v-for="item in checkedStaff">
+						<Tag>{{item.name}}</Tag>
+					</template>
+					<Button type="primary" @click="chooseSatff">选择员工</Button>
+				</FormItem>
+				<FormItem label="打卡经度">
+					<Input v-model="formData.loc_infos[0].lng" v-width="320"></Input>
+					<span> (实际经度的1000000倍)</span>
+				</FormItem>
+				<FormItem label="打卡纬度">
+					<Input v-model="formData.loc_infos[0].lat" v-width="320"></Input>
+					<span> (实际纬度的1000000倍)</span>
+				</FormItem>
+				<FormItem label="打卡地名">
+					<Input v-model="formData.loc_infos[0].loc_title" v-width="320"></Input>
+					<span> (实际纬度的1000000倍)</span>
+				</FormItem>
+				<FormItem label="打卡详细地址">
+					<Input v-model="formData.loc_infos[0].loc_detail" v-width="320"></Input>
+					<span> (实际纬度的1000000倍)</span>
+				</FormItem>
+				<FormItem label="WiFi名称">
+					<Input v-model="formData.wifimac_infos[0].wifiname" v-width="320"></Input>
+					<span> </span>
+				</FormItem>
+				<FormItem label="无线路由器MAC地址">
+					<Input v-model="formData.wifimac_infos[0].wifimac" v-width="320"></Input>
+					<span> </span>
+				</FormItem>
+				<card v-for="(itemx,indexx) in formData.checkindate" style="width:1000px;">
+					<div style="padding-bottom: 10px;">打卡时间
+						<Button type="primary" style="margin-left: 20px;" @click="addNewDkTime()"
+							v-if="indexx == 0">添加新打卡时间</Button>
+						<Button type="primary" style="margin-left: 20px;" @click="delNewDkTime(indexx)"
+							v-else>删除</Button>
+					</div>
+					<FormItem label="工作日" required>
+						<TagSelect v-model="itemx.workdays" hide-check-all>
+							<TagSelectOption :name="1">星期一</TagSelectOption>
+							<TagSelectOption :name="2">星期二</TagSelectOption>
+							<TagSelectOption :name="3">星期三</TagSelectOption>
+							<TagSelectOption :name="4">星期四</TagSelectOption>
+							<TagSelectOption :name="5">星期五</TagSelectOption>
+							<TagSelectOption :name="6">星期六</TagSelectOption>
+							<TagSelectOption :name="0">星期天</TagSelectOption>
+						</TagSelect>
+					</FormItem>
+					<card v-for="(item,index) in itemx.checkintime" style="margin-bottom: 10px;">
+						<FormItem label="时段id" required>
+							<Input v-width="320" placeholder="大于0,小于99999,且唯一" v-model="item.time_id"></Input>
+							<Button type="primary" style="margin-left: 20px;" @click="addNewDk(itemx)"
+								v-if="index == 0">添加新上班时段</Button>
+							<Button type="primary" style="margin-left: 20px;" @click="delNewDk(itemx,index)"
+								v-else>删除</Button>
+						</FormItem>
+						<FormItem label="上班时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.work_sec" />
+						</FormItem>
+						<FormItem label="上班最早时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.earliest_work_sec" />
+						</FormItem>
+						<FormItem label="上班最晚时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.latest_work_sec" />
+						</FormItem>
+						<FormItem label="上班提醒时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.remind_work_sec" />
+						</FormItem>
+						<FormItem label="下班时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.off_work_sec" />
+						</FormItem>
+						<FormItem label="下班最早时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.earliest_off_work_sec" />
+						</FormItem>
+						<FormItem label="下班最晚时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.latest_off_work_sec" />
+						</FormItem>
+						<FormItem label="下班提醒时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.remind_off_work_sec" />
+						</FormItem>
+					</card>
+				</card>
+
+
+			</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>
+				<Button type="primary" @click="showDate()">测试数据</Button>
+			</div>
+		</Card>
+		<Modal v-model="modals" title="员工列表" footerHide class="paymentFooter" scrollable width="900"
+			@on-cancel="cancel">
+			<staff-list ref="stafflist" :goodsType="1" v-if="modals" @getProductId="getProductId"
+				:serviceCard="1"></staff-list>
+		</Modal>
+	</div>
+</template>
+
+<script>
+	import {
+		mapState
+	} from "vuex";
+	import staffList from "@/components/staffList/index";
+	import storeList from "@/components/storeList";
+	import {
+		couponCategoryApi,
+		couponSaveApi,
+		couponDetailApi,
+		VipEditApi,
+		serveAddApi,
+		serveReadApi,
+		createServeProduct
+	} from "@/api/marketing";
+	import {
+		addCheckRule
+	} from '@/api/store';
+	import {
+		brandList
+	} from "@/api/product";
+	// import { formatDate } from '@/utils/validate';
+	import Setting from "@/setting";
+	export default {
+		name: "storeCouponCreate",
+		components: {
+			storeList,
+			staffList
+		},
+		data() {
+			return {
+				checkedStaff: [],
+				modals: false, //选择员工弹出
+				value: '',
+				id: '',
+				work_sec: '',
+				roterPre: Setting.roterPre,
+				disabled: false,
+				storesList: [],
+				formData: {
+					groupname: '',
+					grouptype: 1, //规则类型: 1-固定时间上下班;2-按班次上下班;3-自由上下班
+					type: 2, //	打卡方式 0-手机,2-考勤机,3-手机/考勤机
+					loc_infos: [{
+						lat: 30547030,
+						lng: 104062890,
+						loc_title: "腾讯成都大厦",
+						loc_detail: "四川省成都市武侯区高新南区天府三街",
+						distance: 300
+					}],
+					wifimac_infos: [{
+						"wifiname": "Tencent-WiFi-1",
+						"wifimac": "c0:7b:bc:37:f8:d3"
+					}],
+					range: {
+						userid: [
+							"qywx4633487382413312"
+						]
+					}, //打卡人员
+					checkindate: [{
+						'workdays': [],
+						"checkintime": [{
+							"time_id": '1',
+							"work_sec": '', //上班时间(距0点秒数,整分钟)
+							"off_work_sec": '', //下班时间
+							"remind_work_sec": '', //上班提醒时间
+							"remind_off_work_sec": '', //下班提醒时间
+							"earliest_work_sec": '', //上班最早时间
+							"latest_work_sec": '', //上班最晚时间
+							"earliest_off_work_sec": '', //下班最早时间
+							"latest_off_work_sec": '' //	下班最晚时间
+						}],
+						"flex_on_duty_time": 0,
+						"flex_off_duty_time": 0
+					}]
+
+				},
+				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() {},
+		methods: {
+			// 测试数据
+			showDate() {
+				console.log('shuju', this.formData)
+			},
+			// 打开员工选择弹窗
+			chooseSatff() {
+				this.modals = true;
+			},
+			changeT(e) {
+				// close()
+				console.log(e, 'dddddddddddddd')
+			},
+			showTime(time) {
+
+				let hh = '',
+					mm = '';
+				hh = Math.floor(time / 3600);
+				hh = hh > 9 ? hh : ('0' + hh)
+				mm = Math.floor((time % 3600) / 60);
+				mm = mm > 9 ? mm : ('0' + mm)
+				let str = hh + ':' + mm + ':' + '00'
+				console.log('str:', str)
+				return str
+
+
+			},
+			addNewDk(item) {
+				item.checkintime.push({
+					"time_id": '',
+					"work_sec": '', //上班时间(距0点秒数,整分钟)
+					"off_work_sec": '', //下班时间
+					"remind_work_sec": '', //上班提醒时间
+					"remind_off_work_sec": '', //下班提醒时间
+					"earliest_work_sec": '', //上班最早时间
+					"latest_work_sec": '', //上班最晚时间
+					"earliest_off_work_sec": '', //下班最早时间
+					"latest_off_work_sec": '' //	下班最晚时间
+				})
+			},
+			addNewDkTime() {
+				this.formData.checkindate.push({
+					'workdays': [],
+					"checkintime": [{
+						"time_id": '',
+						"work_sec": '', //上班时间(距0点秒数,整分钟)
+						"off_work_sec": '', //下班时间
+						"remind_work_sec": '', //上班提醒时间
+						"remind_off_work_sec": '', //下班提醒时间
+						"earliest_work_sec": '', //上班最早时间
+						"latest_work_sec": '', //上班最晚时间
+						"earliest_off_work_sec": '', //下班最早时间
+						"latest_off_work_sec": '' //	下班最晚时间
+					}],
+					"flex_on_duty_time": 0,
+					"flex_off_duty_time": 0
+				})
+			},
+
+			delNewDkTime(index) {
+				this.formData.checkindate.splice(index, 1)
+			},
+			delNewDk(item,index) {
+				item.splice(index, 1)
+			},
+			// 
+			onchangeTime(e) {
+				console.log(e, 'xuanz');
+			},
+			// 商品id
+			getProductId(row) {
+				this.modals = false;
+				console.log(row, '这个');
+				this.checkedStaff = row
+				let arr = []
+				this.checkedStaff.forEach(item => {
+					arr.push(item.userid)
+				})
+				this.formData.range.userid = arr
+
+			},
+			// 选择商品
+			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("请输入库存");
+				// }
+			},
+			getTime(str) {
+				if(typeof(str) == 'string') {
+					let arr = str.split(':')
+					return arr[0]*60*60 + arr[1]*60
+				}else {
+					return str
+				}
+				
+			},
+			// 创建
+			save() {
+				let that = this
+				this.downTab();
+				console.log('这');
+				let qdata = {}
+				qdata = Object.assign(qdata,this.formData)
+				try{
+					// let qdata = JSON.parse(JSON.stringify(this.formData))
+					let checkindate = []
+					this.formData.checkindate.forEach(item => {
+						// checkindate.push(item.)
+						let mitem = []
+						item.checkintime.forEach(itemt => {
+							for(let key in itemt) {
+								// let val = ''
+								if(key != 'time_id') {
+									itemt[key] = that.getTime(itemt[key])
+								}else {
+									itemt[key] = itemt[key]*1
+								}
+							}
+							mitem.push(itemt)
+						})
+						item.checkintime = mitem
+						checkindate.push(item)
+					})
+					qdata.checkindate = checkindate
+					console.log(qdata,'this.formData')
+				}catch(e){
+					//TODO handle the exception
+					console.log(e,'cuow')
+				}
+				
+				
+				addCheckRule({
+						'group': qdata
+					})
+					.then((res) => {
+						this.disabled = true;
+						this.$Message.success(res.msg);
+						setTimeout(() => {
+							this.$router.push({
+								path: this.roterPre + "/store/checkRule/index",
+							});
+						}, 1000);
+					})
+					.catch((err) => {
+						this.$Message.error(err.msg);
+					});
+			},
+			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;
+	}
+</style>

+ 2 - 2
src/pages/store/checkGroup/index.vue

@@ -7,7 +7,7 @@
 			<Form ref="tableFrom" :model="tableFrom"  :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
 			<Form ref="tableFrom" :model="tableFrom"  :label-width="labelWidth" :label-position="labelPosition" @submit.native.prevent>
 			    <Row type="flex">
 			    <Row type="flex">
 			        <Col v-bind="grid">
 			        <Col v-bind="grid">
-			            <Button v-auth="['admin-marketing-store_coupon-add']" type="primary"  icon="md-add" @click="add">添加会员卡</Button>
+			            <Button v-auth="['admin-marketing-store_coupon-add']" type="primary"  icon="md-add" @click="add">添加考勤组</Button>
 			        </Col>
 			        </Col>
 			    </Row>
 			    </Row>
 			</Form>
 			</Form>
@@ -187,7 +187,7 @@
             // 添加
             // 添加
             add () {
             add () {
                 // this.$modalForm(couponCreateApi()).then(() => this.getList());
                 // this.$modalForm(couponCreateApi()).then(() => this.getList());
-				this.$router.push({ path: this.roterPre + "/marketing/vip/create" });
+				this.$router.push({ path: this.roterPre + "/store/checkGroup/create" });
                 // this.addType(0);
                 // this.addType(0);
             },
             },
             addType (type) {
             addType (type) {

+ 512 - 0
src/pages/store/classes/create.vue

@@ -0,0 +1,512 @@
+<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}/store/checkRule/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"></Input>
+				</FormItem>
+				<FormItem label="打卡规则" required>
+					<!-- <Input v-model="formData.groupname" v-width="320"></Input> -->
+					<template v-for="item in checkedStaff">
+						<Tag>{{item.name}}</Tag>
+					</template>
+					<Button type="primary" @click="chooseSatff">选择员工</Button>
+				</FormItem>
+				<card v-for="(itemx,indexx) in formData.checkindate" style="width:1000px;">
+					<card v-for="(item,index) in itemx.checkintime" style="margin-bottom: 10px;">
+						<FormItem label="时段id" required>
+							<Input v-width="320" placeholder="大于0,小于99999,且唯一" v-model="item.time_id"></Input>
+						</FormItem>
+						<FormItem label="上班时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.work_sec" />
+						</FormItem>
+						<FormItem label="上班最早时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.earliest_work_sec" />
+						</FormItem>
+						<FormItem label="上班最晚时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.latest_work_sec" />
+						</FormItem>
+						<FormItem label="上班提醒时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.remind_work_sec" />
+						</FormItem>
+						<FormItem label="下班时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.off_work_sec" />
+						</FormItem>
+						<FormItem label="下班最早时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.earliest_off_work_sec" />
+						</FormItem>
+						<FormItem label="下班最晚时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.latest_off_work_sec" />
+						</FormItem>
+						<FormItem label="下班提醒时间" required>
+							<TimePicker :steps="[1, 5]" placeholder="" v-width="320" format="HH:mm"
+								v-model="item.remind_off_work_sec" />
+						</FormItem>
+					</card>
+				</card>
+
+
+			</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>
+				<Button type="primary" @click="showDate()">测试数据</Button>
+			</div>
+		</Card>
+		<Modal v-model="modals" title="员工列表" footerHide class="paymentFooter" scrollable width="900"
+			@on-cancel="cancel">
+			<staff-list ref="stafflist" :goodsType="1" v-if="modals" @getProductId="getProductId"
+				:serviceCard="1"></staff-list>
+		</Modal>
+	</div>
+</template>
+
+<script>
+	import {
+		mapState
+	} from "vuex";
+	import staffList from "@/components/staffList/index";
+	import storeList from "@/components/storeList";
+	import {
+		couponCategoryApi,
+		couponSaveApi,
+		couponDetailApi,
+		VipEditApi,
+		serveAddApi,
+		serveReadApi,
+		createServeProduct
+	} from "@/api/marketing";
+	import {
+		addCheckRule
+	} from '@/api/store';
+	import {
+		brandList
+	} from "@/api/product";
+	// import { formatDate } from '@/utils/validate';
+	import Setting from "@/setting";
+	export default {
+		name: "storeCouponCreate",
+		components: {
+			storeList,
+			staffList
+		},
+		data() {
+			return {
+				checkedStaff: [],
+				modals: false, //选择员工弹出
+				value: '',
+				id: '',
+				work_sec: '',
+				roterPre: Setting.roterPre,
+				disabled: false,
+				storesList: [],
+				formData: {
+					groupname: '',
+					grouptype: 1, //规则类型: 1-固定时间上下班;2-按班次上下班;3-自由上下班
+					type: 2, //	打卡方式 0-手机,2-考勤机,3-手机/考勤机
+					loc_infos: [{
+						lat: 30547030,
+						lng: 104062890,
+						loc_title: "腾讯成都大厦",
+						loc_detail: "四川省成都市武侯区高新南区天府三街",
+						distance: 300
+					}],
+					wifimac_infos: [{
+						"wifiname": "Tencent-WiFi-1",
+						"wifimac": "c0:7b:bc:37:f8:d3"
+					}],
+					range: {
+						userid: [
+							"qywx4633487382413312"
+						]
+					}, //打卡人员
+					checkindate: [{
+						'workdays': [],
+						"checkintime": [{
+							"time_id": '1',
+							"work_sec": '', //上班时间(距0点秒数,整分钟)
+							"off_work_sec": '', //下班时间
+							"remind_work_sec": '', //上班提醒时间
+							"remind_off_work_sec": '', //下班提醒时间
+							"earliest_work_sec": '', //上班最早时间
+							"latest_work_sec": '', //上班最晚时间
+							"earliest_off_work_sec": '', //下班最早时间
+							"latest_off_work_sec": '' //	下班最晚时间
+						}],
+						"flex_on_duty_time": 0,
+						"flex_off_duty_time": 0
+					}]
+
+				},
+				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() {},
+		methods: {
+			// 测试数据
+			showDate() {
+				console.log('shuju', this.formData)
+			},
+			// 打开员工选择弹窗
+			chooseSatff() {
+				this.modals = true;
+			},
+			changeT(e) {
+				// close()
+				console.log(e, 'dddddddddddddd')
+			},
+			showTime(time) {
+
+				let hh = '',
+					mm = '';
+				hh = Math.floor(time / 3600);
+				hh = hh > 9 ? hh : ('0' + hh)
+				mm = Math.floor((time % 3600) / 60);
+				mm = mm > 9 ? mm : ('0' + mm)
+				let str = hh + ':' + mm + ':' + '00'
+				console.log('str:', str)
+				return str
+
+
+			},
+			addNewDk(item) {
+				item.checkintime.push({
+					"time_id": '',
+					"work_sec": '', //上班时间(距0点秒数,整分钟)
+					"off_work_sec": '', //下班时间
+					"remind_work_sec": '', //上班提醒时间
+					"remind_off_work_sec": '', //下班提醒时间
+					"earliest_work_sec": '', //上班最早时间
+					"latest_work_sec": '', //上班最晚时间
+					"earliest_off_work_sec": '', //下班最早时间
+					"latest_off_work_sec": '' //	下班最晚时间
+				})
+			},
+			addNewDkTime() {
+				this.formData.checkindate.push({
+					'workdays': [],
+					"checkintime": [{
+						"time_id": '',
+						"work_sec": '', //上班时间(距0点秒数,整分钟)
+						"off_work_sec": '', //下班时间
+						"remind_work_sec": '', //上班提醒时间
+						"remind_off_work_sec": '', //下班提醒时间
+						"earliest_work_sec": '', //上班最早时间
+						"latest_work_sec": '', //上班最晚时间
+						"earliest_off_work_sec": '', //下班最早时间
+						"latest_off_work_sec": '' //	下班最晚时间
+					}],
+					"flex_on_duty_time": 0,
+					"flex_off_duty_time": 0
+				})
+			},
+
+			delNewDkTime(index) {
+				this.formData.checkindate.splice(index, 1)
+			},
+			delNewDk(item,index) {
+				item.splice(index, 1)
+			},
+			// 
+			onchangeTime(e) {
+				console.log(e, 'xuanz');
+			},
+			// 商品id
+			getProductId(row) {
+				this.modals = false;
+				console.log(row, '这个');
+				this.checkedStaff = row
+				let arr = []
+				this.checkedStaff.forEach(item => {
+					arr.push(item.userid)
+				})
+				this.formData.range.userid = arr
+
+			},
+			// 选择商品
+			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("请输入库存");
+				// }
+			},
+			getTime(str) {
+				if(typeof(str) == 'string') {
+					let arr = str.split(':')
+					return arr[0]*60*60 + arr[1]*60
+				}else {
+					return str
+				}
+				
+			},
+			// 创建
+			save() {
+				let that = this
+				this.downTab();
+				console.log('这');
+				let qdata = {}
+				qdata = Object.assign(qdata,this.formData)
+				try{
+					// let qdata = JSON.parse(JSON.stringify(this.formData))
+					let checkindate = []
+					this.formData.checkindate.forEach(item => {
+						// checkindate.push(item.)
+						let mitem = []
+						item.checkintime.forEach(itemt => {
+							for(let key in itemt) {
+								// let val = ''
+								if(key != 'time_id') {
+									itemt[key] = that.getTime(itemt[key])
+								}else {
+									itemt[key] = itemt[key]*1
+								}
+							}
+							mitem.push(itemt)
+						})
+						item.checkintime = mitem
+						checkindate.push(item)
+					})
+					qdata.checkindate = checkindate
+					console.log(qdata,'this.formData')
+				}catch(e){
+					//TODO handle the exception
+					console.log(e,'cuow')
+				}
+				
+				
+				addCheckRule({
+						'group': qdata
+					})
+					.then((res) => {
+						this.disabled = true;
+						this.$Message.success(res.msg);
+						setTimeout(() => {
+							this.$router.push({
+								path: this.roterPre + "/store/checkRule/index",
+							});
+						}, 1000);
+					})
+					.catch((err) => {
+						this.$Message.error(err.msg);
+					});
+			},
+			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;
+	}
+</style>

+ 300 - 0
src/pages/store/classes/index.vue

@@ -0,0 +1,300 @@
+<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-store-classes-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, index }" slot="groupname">
+					{{row.checkin_option.groupname}}
+				</template>
+				<!-- workdays -->
+				<template slot-scope="{ row, index }" slot="workdays">
+					<el-tag v-for="witem in row.checkin_option.checkindate[0].workdays">{{witem | showWd}}</el-tag>
+				</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="time">
+					<!-- <span> {{row.add_time | formatDate}}</span> -->
+					<div v-for="time in row.time" style="margin-top: 10px;">
+						<span>{{time.work_sec| showTime}} </span> - <span>{{time.off_work_sec | showTime}}</span>
+					</div>
+				</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 {
+		checkGroupList,
+		checkRuleList,
+		getClasses
+	} 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');
+				}
+			},
+			showWd(day) {
+				let str = ''
+				if(day) {
+					switch (day*1){
+						case 1:
+							str = '星期一'
+							break;
+						case 2:
+							str = '星期二'
+							break;
+						case 3:
+							str = '星期三'
+							break;
+						case 4:
+							str = '星期四'
+							break;
+						case  5:
+							str = '星期五'
+							break;
+						case 6:
+							str = '星期六'
+							break;
+						case  0:
+							str = '星期日'
+							break;
+						default:
+							break;
+					}
+				}
+				return str
+			}
+		},
+		components: {
+			editFrom
+		},
+		filters: {
+			showTime(seconds) {
+				  
+
+				if(seconds ) {
+					var hours = Math.floor(seconds / 3600);
+					var minutes = Math.floor((seconds % 3600) / 60);
+					return (hours > 9?hours: '0' + hours ) + ": " + (minutes>9?minutes: '0'+ minutes) 
+				}
+			}
+		},
+		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: '打卡奖励',
+						key: 'price',
+						minWidth: 80
+					},
+					{
+						title: '打卡时段',
+						slot: 'time',
+						minWidth: 100
+					},
+					{
+						title: '添加时间',
+						key: 'create_time',
+						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());
+				this.$router.push({
+					path: this.roterPre + "/store/checkRule/create"
+				});
+			},
+			// 删除
+			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;
+
+				getClasses(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/classes/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 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>

+ 28 - 1
src/router/modules/store.js

@@ -154,10 +154,19 @@ export default {
 			name: `${pre}checkGroupList`,
 			name: `${pre}checkGroupList`,
 			meta: {
 			meta: {
 				auth: ['admin-store-checkGroup-index'],
 				auth: ['admin-store-checkGroup-index'],
-				title: '新增/修改部门'
+				title: '考勤组'
 			},
 			},
 			component: () => import('@/pages/store/checkGroup/index')
 			component: () => import('@/pages/store/checkGroup/index')
 		},
 		},
+		{
+			path: 'checkGroup/create',
+			name: `${pre}checkGroupCreate`,
+			meta: {
+				auth: ['admin-store-checkGroup-add'],
+				title: '添加考勤组'
+			},
+			component: () => import('@/pages/store/checkGroup/create')
+		},
 		{
 		{
 			path: 'checkRule/index',
 			path: 'checkRule/index',
 			name: `${pre}checkRuleIndex`,
 			name: `${pre}checkRuleIndex`,
@@ -176,5 +185,23 @@ export default {
 			},
 			},
 			component: () => import('@/pages/store/checkRule/create')
 			component: () => import('@/pages/store/checkRule/create')
 		},
 		},
+		{
+			path: 'classes/index',
+			name: `${pre}classIndex`,
+			meta: {
+				auth: ['admin-store-classes-index'],
+				title: '打卡规则'
+			},
+			component: () => import('@/pages/store/classes/index')
+		},
+		{
+			path: 'classes/create',
+			name: `${pre}classIndex`,
+			meta: {
+				auth: ['admin-store-classes-add'],
+				title: '打卡规则'
+			},
+			component: () => import('@/pages/store/classes/create')
+		},
 	]
 	]
 };
 };