|
|
@@ -66,18 +66,35 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="Name"
|
|
|
+ prop="UserName"
|
|
|
label="会员名"
|
|
|
width="90"
|
|
|
>
|
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
|
- prop="Phone"
|
|
|
- label="手机号"
|
|
|
+ prop="StaticHr"
|
|
|
+ label="静态心率"
|
|
|
width="110"
|
|
|
sortable
|
|
|
>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="Height"
|
|
|
+ label="身高(CM)"
|
|
|
+ width="110"
|
|
|
+ sortable
|
|
|
+ >
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="Weight"
|
|
|
+ label="体重(KG)"
|
|
|
+ width="110"
|
|
|
+ sortable
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span>{{scope.row.Weight / 10}}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column
|
|
|
prop="Sex"
|
|
|
label="类型"
|
|
|
@@ -99,14 +116,14 @@
|
|
|
>
|
|
|
</el-table-column>
|
|
|
<!--<el-table-column-->
|
|
|
- <!--prop="ClassInfo"-->
|
|
|
- <!--label="会员课程"-->
|
|
|
- <!--width="220px"-->
|
|
|
+ <!--prop="ClassInfo"-->
|
|
|
+ <!--label="会员课程"-->
|
|
|
+ <!--width="220px"-->
|
|
|
<!-->-->
|
|
|
- <!--<template slot-scope="scope">-->
|
|
|
- <!--<span class="lessonSpan" :style="{background:lesson.ClassColor}"-->
|
|
|
- <!--v-for="lesson in scope.row.ClassInfo">{{ lesson.ClassName }}</span>-->
|
|
|
- <!--</template>-->
|
|
|
+ <!--<template slot-scope="scope">-->
|
|
|
+ <!--<span class="lessonSpan" :style="{background:lesson.ClassColor}"-->
|
|
|
+ <!--v-for="lesson in scope.row.ClassInfo">{{ lesson.ClassName }}</span>-->
|
|
|
+ <!--</template>-->
|
|
|
<!--</el-table-column>-->
|
|
|
<el-table-column
|
|
|
prop="UserInfo.Memo"
|
|
|
@@ -124,6 +141,17 @@
|
|
|
<span v-if="scope.row.Memo.length <= 6">{{ scope.row.Memo }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column
|
|
|
+ prop="UserInfo.Status"
|
|
|
+ label="操作"
|
|
|
+ width="160px"
|
|
|
+ >
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <el-button class="btn" type="default" size="mini" @click="editMember(scope.row)"
|
|
|
+ v-if="userLevel != 4">编辑
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
<br>
|
|
|
<el-pagination
|
|
|
@@ -133,18 +161,84 @@
|
|
|
@current-change="pageChange"
|
|
|
></el-pagination>
|
|
|
</div>
|
|
|
+
|
|
|
+ <el-dialog :title="dialogTitle" :visible.sync="dialogMemberVisible"
|
|
|
+ :width="form.btnType == 1 ?'650px':'650px'">
|
|
|
+ <div class="dialogContent">
|
|
|
+ <div :class="['pull-left',{'tabwild':form.btnType == 1}]">
|
|
|
+ <el-form ref="form" :model="form" label-width="80px">
|
|
|
+ <el-form-item label="会员名" :required="true">
|
|
|
+ <el-input v-model="form.name"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="备注">
|
|
|
+ <el-input v-model="form.memo"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="身高" :required="true">
|
|
|
+ <el-input v-model="form.height" placeholder="cm" type="number"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="体重" :required="true">
|
|
|
+ <el-input v-model="form.weight" placeholder="kg" type="number"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="静态心率" >
|
|
|
+ <el-input v-model="form.staticHr" placeholder="请输入" type="number"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="性别" :required="true">
|
|
|
+ <el-select v-model="form.sex " placeholder="">
|
|
|
+ <el-option
|
|
|
+ v-for="item in sexOptions"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="头像" :required="true">
|
|
|
+ <div class="upload">
|
|
|
+ <el-upload
|
|
|
+ class="avatar-uploader"
|
|
|
+ :action=domain
|
|
|
+ :http-request=upqiniu
|
|
|
+ :show-file-list="false"
|
|
|
+ :before-upload="beforeUpload">
|
|
|
+ <!--<i v-else class="el-icon-plus avatar-uploader-icon"></i>-->
|
|
|
+ </el-upload>
|
|
|
+ <img v-if="imageUrl" :src="imageUrl" class="avatar">
|
|
|
+ <ImgCutter v-on:cutDown="cutDown"></ImgCutter>
|
|
|
+ </div>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="出生年份" :required="true">
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.birthday"
|
|
|
+ align="right"
|
|
|
+ type="date"
|
|
|
+ placeholder="选择日期"
|
|
|
+ >
|
|
|
+ </el-date-picker>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="dialogFooter">
|
|
|
+ <el-button :disabled="addDisabled" :loading="addDisabled" type="primary" size="small" v-if="form.btnType == 0"
|
|
|
+ @click="confirmMember">确定
|
|
|
+ </el-button>
|
|
|
+ <el-button type="primary" size="small" v-if="form.btnType == 1" @click="confirmEditMember">确定
|
|
|
+ </el-button>
|
|
|
+ <el-button size="small" @click="dialogMemberVisible = false">取消</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import Global from '../Global.js'
|
|
|
- import ImgCutter from 'vue-img-cutter'
|
|
|
- import {
|
|
|
- TmpUserQuery,
|
|
|
- testTable,
|
|
|
- testSelect
|
|
|
- } from "../api/getApiRes";
|
|
|
+ import Global from '../Global.js'
|
|
|
+ import ImgCutter from 'vue-img-cutter'
|
|
|
+ import {
|
|
|
+ TmpUserQuery,
|
|
|
+ testTable,
|
|
|
+ testSelect
|
|
|
+ } from "../api/getApiRes";
|
|
|
|
|
|
let qs = require('qs');
|
|
|
export default {
|
|
|
@@ -158,8 +252,11 @@
|
|
|
tableRadio: [],
|
|
|
userLevel: localStorage.userLevel,
|
|
|
serachBtnStatus: false,
|
|
|
+ addDisabled: false,
|
|
|
start: 0,
|
|
|
draw: 1,
|
|
|
+ dialogTitle: '新增临时会员',
|
|
|
+ dialogMemberVisible: false,//新增会员dialog
|
|
|
sexOptions: [
|
|
|
{value: 1, label: '男'},//性别 1:男, 2:女
|
|
|
{value: 2, label: '女'},
|
|
|
@@ -196,6 +293,31 @@
|
|
|
total: 100,
|
|
|
pageIndex: 1,
|
|
|
},
|
|
|
+ form: {
|
|
|
+ phone: '',
|
|
|
+ name: '',
|
|
|
+ userCode: '',
|
|
|
+ shopId: '',
|
|
|
+ Id: '',
|
|
|
+ userId: '',
|
|
|
+ height: '',
|
|
|
+ weight: '',
|
|
|
+ staticHr: '',
|
|
|
+ head: '',
|
|
|
+ birthday: '',
|
|
|
+ sex: 1,
|
|
|
+ vipType: 1,
|
|
|
+ normalhour: 0,
|
|
|
+ newnormalhour: 0,
|
|
|
+ gifthour: 0,
|
|
|
+ newgifthour: 0,
|
|
|
+ btnType: 0,//0新建,1编辑编辑
|
|
|
+ memo: '',
|
|
|
+ expTime: '',
|
|
|
+ classlist: [],
|
|
|
+ dialogdata: [],//穿梭待选
|
|
|
+ dialogValue: [],//穿梭已选
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
@@ -211,15 +333,230 @@
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
- addMember(){
|
|
|
+ addMember() {
|
|
|
+ this.clearForm();
|
|
|
+ this.dialogMemberVisible = true;
|
|
|
+ this.btnType = 0;
|
|
|
+ this.form.btnType = 0;
|
|
|
+ this.dialogTitle = '新增临时会员'
|
|
|
+ },
|
|
|
+ editMember() {
|
|
|
|
|
|
},
|
|
|
- delList(){
|
|
|
+ delList() {
|
|
|
|
|
|
},
|
|
|
clickChange(item) {
|
|
|
this.tableRadio = item
|
|
|
},
|
|
|
+ // 确认提交新增会员
|
|
|
+ confirmMember() {
|
|
|
+ let that = this;
|
|
|
+ // checkNum
|
|
|
+ if (!that.form.phone) {
|
|
|
+ this.$message.error('错了哦,手机号不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!globalCheckPhone(that.form.phone)) {
|
|
|
+ this.$message.error('错了哦,手机号格式不正确');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!that.form.name) {
|
|
|
+ this.$message.error('错了哦,会员名不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (that.form.name.length > 8) {
|
|
|
+ this.$message.error('错了哦,会员名字数超过8个字');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (that.form.memo) {
|
|
|
+ if (that.form.memo.length > 200) {
|
|
|
+ this.$message.error('错了哦,备注字数超过200个字');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!that.form.height) {
|
|
|
+ this.$message.error('错了哦,身高不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!that.form.weight) {
|
|
|
+ this.$message.error('错了哦,体重不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // if (!that.form.staticHr) {
|
|
|
+ // this.$message.error('错了哦,静态心率不能为空');
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
+ if (!that.form.birthday) {
|
|
|
+ this.$message.error('错了哦,出生年份不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ // 课程添加使用字符串形式
|
|
|
+ let curClasslist = '';
|
|
|
+ if (that.form.classlist) {
|
|
|
+ curClasslist = that.form.classlist.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ shopId: localStorage.shopId,
|
|
|
+ phone: that.form.phone,
|
|
|
+ name: that.form.name,
|
|
|
+ vipType: that.form.vipType,
|
|
|
+ normalhour: that.form.normalhour,
|
|
|
+ gifthour: that.form.gifthour,
|
|
|
+ classlist: curClasslist,
|
|
|
+ memo: that.form.memo,
|
|
|
+ height: that.form.height,
|
|
|
+ weight: that.form.weight,
|
|
|
+ staticHr: that.form.staticHr,
|
|
|
+ sex: that.form.sex,
|
|
|
+ head: that.form.head,
|
|
|
+ birthday: nonTfmtDatetoLength(that.form.birthday, 10),
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ VipUserAdd(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ // 关闭弹窗
|
|
|
+ that.dialogMemberVisible = false;
|
|
|
+ // 重载列表
|
|
|
+ that.getTableQuery();
|
|
|
+ that.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '会员添加成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.$message.error(json.Memo + '错误码:' + json.Code);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ confirmEditMember() {
|
|
|
+ let that = this;
|
|
|
+ // checkNum
|
|
|
+ if (!that.form.phone) {
|
|
|
+ this.$message.error('错了哦,手机号不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!globalCheckPhone(that.form.phone)) {
|
|
|
+ this.$message.error('错了哦,手机号格式不正确');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!that.form.name) {
|
|
|
+ this.$message.error('错了哦,会员名不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (that.form.name.length > 8) {
|
|
|
+ this.$message.error('错了哦,会员名字数超过8个字');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (that.form.memo) {
|
|
|
+ if (that.form.memo.length > 200) {
|
|
|
+ this.$message.error('错了哦,备注字数超过200个字');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!that.form.height) {
|
|
|
+ this.$message.error('错了哦,身高不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if (!that.form.weight) {
|
|
|
+ this.$message.error('错了哦,体重不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ // if (!that.form.staticHr) {
|
|
|
+ // this.$message.error('错了哦,静态心率不能为空');
|
|
|
+ // return false
|
|
|
+ // }
|
|
|
+ if (!that.form.birthday) {
|
|
|
+ this.$message.error('错了哦,出生年份不能为空');
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ userId: that.form.Id,
|
|
|
+ phone: that.form.phone,
|
|
|
+ name: that.form.name,
|
|
|
+ memo: that.form.memo,
|
|
|
+ head: that.form.head,
|
|
|
+ height: that.form.height,
|
|
|
+ weight: that.form.weight,
|
|
|
+ staticHr: that.form.staticHr,
|
|
|
+ sex: that.form.sex,
|
|
|
+ birthday: nonTfmtDatetoLength(that.form.birthday, 10),
|
|
|
+ ubId: that.form.ubId
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ console.log(param);
|
|
|
+ VipUserEdit(postdata).then(res => {
|
|
|
+ let json = res;
|
|
|
+ if (json.Code == 0) {
|
|
|
+ // 关闭弹窗
|
|
|
+ that.dialogMemberVisible = false;
|
|
|
+ // 重载列表
|
|
|
+ that.getTableQuery();
|
|
|
+ that.$message({
|
|
|
+ showClose: true,
|
|
|
+ message: '会员信息编辑成功!',
|
|
|
+ type: 'success'
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ that.$message.error(json.Memo + '错误码:' + json.Code);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 验证文件合法性
|
|
|
+ beforeUpload(file) {
|
|
|
+ const isJPG = file.type === 'image/jpeg' || file.type === 'image/png';
|
|
|
+ const isLt2M = file.size / 1024 / 1024 < 70;
|
|
|
+ if (!isJPG) {
|
|
|
+ this.$message.error('上传头像图片只能是 JPG 格式!')
|
|
|
+ }
|
|
|
+ if (!isLt2M) {
|
|
|
+ this.$message.error('上传头像图片大小不能超过 70MB!')
|
|
|
+ }
|
|
|
+ return isJPG && isLt2M
|
|
|
+ },
|
|
|
+ cutDown(e){
|
|
|
+ console.log(e);
|
|
|
+ this.imageUrl = e.dataURL;
|
|
|
+ this.upqiniu(e);
|
|
|
+ },
|
|
|
+ // 上传文件到七牛云
|
|
|
+ upqiniu(req) {
|
|
|
+ let that = this;
|
|
|
+ const config = {
|
|
|
+ headers: {'Content-Type': 'multipart/form-data'}
|
|
|
+ };
|
|
|
+ let filetype = '';
|
|
|
+ if (req.file.type === 'image/png') {
|
|
|
+ filetype = 'png'
|
|
|
+ } else {
|
|
|
+ filetype = 'jpg'
|
|
|
+ }
|
|
|
+ // 重命名要上传的文件
|
|
|
+ const keyname = 'GoAllOut' + new Date().valueOf() + Math.floor(Math.random() * 100) + '.' + filetype;
|
|
|
+ // 从后端获取上传凭证token
|
|
|
+ let param = {
|
|
|
+ token: localStorage.token,
|
|
|
+ };
|
|
|
+ let postdata = qs.stringify(param);
|
|
|
+ this.axios.post(headapi + 'v1/QiNiu/GetSimpleQiNiuToken', postdata).then(res => {
|
|
|
+ const formdata = new FormData();
|
|
|
+ formdata.append('file', req.file);
|
|
|
+ formdata.append('token', res.data.QiNinToken);
|
|
|
+ formdata.append('key', keyname);
|
|
|
+ // 获取到凭证之后再将文件上传到七牛云空间
|
|
|
+ this.axios.post(this.domain, formdata, config).then(res => {
|
|
|
+ this.imageUrl = 'http://' + this.qiniuaddr + '/' + res.data.key;
|
|
|
+ this.form.head = 'http://' + this.qiniuaddr + '/' + keyname;
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
// 查询按钮
|
|
|
query() {
|
|
|
let that = this;
|
|
|
@@ -329,9 +666,11 @@
|
|
|
},
|
|
|
// 过滤时间
|
|
|
filterFmtDate(value, row, column) {
|
|
|
- let that = this;
|
|
|
return nonTfmtDatetoLength(column, 11);
|
|
|
},
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ ImgCutter
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
@@ -371,4 +710,20 @@
|
|
|
.change button.pull-right {
|
|
|
float: right;
|
|
|
}
|
|
|
+ .dialogContent {
|
|
|
+ width: 100%;
|
|
|
+ overflow: hidden;
|
|
|
+ display: block;
|
|
|
+ margin: 0 auto;
|
|
|
+ }
|
|
|
+
|
|
|
+ .dialogContent .pull-left {
|
|
|
+ width: 40%;
|
|
|
+ float: left;
|
|
|
+ }
|
|
|
+
|
|
|
+ .dialogContent .pull-right {
|
|
|
+ width: 60%;
|
|
|
+ float: right;
|
|
|
+ }
|
|
|
</style>
|