lhl hai 1 ano
pai
achega
6ee29051f0
Modificáronse 3 ficheiros con 340 adicións e 238 borrados
  1. 9 0
      src/api/store.js
  2. 75 19
      src/pages/store/checkRule/create.vue
  3. 256 219
      src/pages/store/checkRule/index.vue

+ 9 - 0
src/api/store.js

@@ -720,4 +720,13 @@ export function checkRuleList(data) {
 	    method: 'post',
 		data
 	})
+}
+
+//添加打卡规则
+export function addCheckRule(data) {
+	return request({
+	    url: `work/addCheckRule`,
+	    method: 'post',
+		data
+	})
 }

+ 75 - 19
src/pages/store/checkRule/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_item/index` }">
+					<router-link :to="{ path: `${roterPre}/store/checkRule/index` }">
 						<div class="font-sm after-line">
 							<span class="iconfont iconfanhui"></span>
 							<span class="pl10">返回</span>
@@ -16,9 +16,41 @@
 		<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>
+					<Input v-model="formData.groupname" v-width="320"></Input>
+				</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>
 			</Form>
+
+			<!-- wifimac_infos[
+			            {
+			                "wifiname": "Tencent-WiFi-1",
+			                "wifimac": "c0:7b:bc:37:f8:d3"
+			            }
+			        ] -->
+
 			<div style="width: 500px; display: flex;justify-content: center;">
 				<Button type="primary" class="submission" @click="save" :disabled="disabled"
 					v-if="!formData.id">立即创建</Button>
@@ -42,6 +74,9 @@
 		serveReadApi,
 		createServeProduct
 	} from "@/api/marketing";
+	import {
+		addCheckRule
+	} from '@/api/store';
 	import {
 		brandList
 	} from "@/api/product";
@@ -60,8 +95,7 @@
 				storesList: [],
 				formData: {
 					groupname: '',
-					groupid: '',
-					grouptype: 2, //规则类型: 1-固定时间上下班;2-按班次上下班;3-自由上下班
+					grouptype: 1, //规则类型: 1-固定时间上下班;2-按班次上下班;3-自由上下班
 					type: 2, //	打卡方式 0-手机,2-考勤机,3-手机/考勤机
 					loc_infos: [{
 						lat: 30547030,
@@ -70,16 +104,38 @@
 						loc_detail: "四川省成都市武侯区高新南区天府三街",
 						distance: 300
 					}],
+					wifimac_infos: [{
+						"wifiname": "Tencent-WiFi-1",
+						"wifimac": "c0:7b:bc:37:f8:d3"
+					}],
 					range: {
 						userid: [
-							"xiaoxioa"
+							"qywx4633487382413312"
 						]
-					},//打卡人员
-					schedulelist: [
-						{
-							
-						}
-					]
+					}, //打卡人员
+					checkindate: [{
+						workdays: [
+							1,
+							2,
+							3,
+							4,
+							5
+						],
+						"checkintime": [{
+							"time_id": 33,
+							"work_sec": 36000,
+							"off_work_sec": 43200,
+							"remind_work_sec": 35400,
+							"remind_off_work_sec": 43200,
+							"earliest_work_sec": 35040,
+							"latest_work_sec": 37020,
+							"earliest_off_work_sec": 43140,
+							"latest_off_work_sec": 43800
+						}],
+						"flex_on_duty_time": 0,
+						"flex_off_duty_time": 0
+					}]
+
 				},
 				id: 0,
 				product_name: '',
@@ -90,13 +146,11 @@
 				explain: '',
 				unit_name: '',
 				image: '',
-				images: ''
-			},
+				images: '',
 				modals: false,
-				}
-		};
-	},
-	computed: {
+			}
+		},
+		computed: {
 			...mapState("admin/layout", ["isMobile", "menuCollapse"]),
 		},
 		created() {
@@ -150,13 +204,15 @@
 			save() {
 				this.downTab();
 				console.log('这');
-				createServeProduct(this.formData.id, this.formData)
+				addCheckRule({
+						'group': this.formData
+					})
 					.then((res) => {
 						this.disabled = true;
 						this.$Message.success(res.msg);
 						setTimeout(() => {
 							this.$router.push({
-								path: this.roterPre + "/marketing/serve_item/index",
+								path: this.roterPre + "/store/checkRule/index",
 							});
 						}, 1000);
 					})

+ 256 - 219
src/pages/store/checkRule/index.vue

@@ -1,230 +1,267 @@
 <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>
+	<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>
+			<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 }" 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 {
+		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 {
+	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) {
+				if(day) {
+					switch (day){
+						case value:
+							break;
+						default:
+							break;
+					}
+				}
+			}
+		},
+		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);
-                    }
+				grid: {
+					xl: 7,
+					lg: 7,
+					md: 12,
+					sm: 24,
+					xs: 24
+				},
+				loading: false,
+				columns1: [{
+						title: 'ID',
+						key: 'id',
+						width: 80
+					},
+					{
+						title: '规则名称',
+						slot: 'groupname',
+						minWidth: 150
+					},
+					{
+						title: '工作日',
+						slot: 'workdays',
+						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.data;
+					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();
-            }
-        }
-    }
+					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>
+	.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>