|
|
@@ -1,85 +1,46 @@
|
|
|
<template>
|
|
|
<div class="app-content">
|
|
|
<div v-show="showStaffArea">
|
|
|
- <!-- 员工信息 -->
|
|
|
<form @submit="formSubmit">
|
|
|
<div class="module-com input-line-wrap">
|
|
|
<tui-list-cell class="line-cell" :arrow="true">
|
|
|
<div class="tui-title required">角色</div>
|
|
|
- <picker
|
|
|
- mode="selector"
|
|
|
- :value="form.roleId"
|
|
|
- :range="roleList"
|
|
|
- range-key="roleName"
|
|
|
- @change="changeRoleFn"
|
|
|
- class="tui-input"
|
|
|
- >
|
|
|
+ <picker mode="selector" :value="form.roleId" :range="roleList" range-key="roleName" @change="changeRoleFn" class="tui-input" >
|
|
|
<input v-model="form.roleId" name="roleId" type="text" hidden />
|
|
|
<div v-if="form.roleId">{{ roleSelData.roleName }}</div>
|
|
|
<div class="tui-placeholder" v-else>请选择</div>
|
|
|
</picker>
|
|
|
</tui-list-cell>
|
|
|
- </div>
|
|
|
- <!-- 动态通知 -->
|
|
|
- <div class="module-com input-line-wrap">
|
|
|
- <tui-list-cell class="line-cell between" padding="14upx 30upx" :hover="false">
|
|
|
- <div class="tui-title">动态通知</div>
|
|
|
- <div>
|
|
|
- <switch :checked="form.remind == 0 ? false : true" @change="remindChangeFn" />
|
|
|
- </div>
|
|
|
- </tui-list-cell>
|
|
|
- </div>
|
|
|
- <div class="module-com input-line-wrap">
|
|
|
<tui-list-cell class="line-cell" :hover="false">
|
|
|
- <div class="tui-title">登录密码</div>
|
|
|
- <input
|
|
|
- v-model="form.password"
|
|
|
- placeholder-class="phcolor"
|
|
|
- class="tui-input"
|
|
|
- name="password"
|
|
|
- placeholder="请输入"
|
|
|
- maxlength="50"
|
|
|
- type="password"
|
|
|
- />
|
|
|
+ <div class="tui-title">动态通知</div>
|
|
|
+ <view><switch style="transform:scale(0.7,0.7)" :checked="form.remind == 0 ? false : true" @change="remindChangeFn" /></view>
|
|
|
</tui-list-cell>
|
|
|
<tui-list-cell class="line-cell remark-wrap" :hover="false">
|
|
|
<div class="tui-title">备注信息</div>
|
|
|
<div class="tui-input">
|
|
|
- <textarea
|
|
|
- v-model="form.remark"
|
|
|
- class="tui-textarea remark"
|
|
|
- placeholder-class="phcolor"
|
|
|
- placeholder="选填"
|
|
|
- />
|
|
|
+ <textarea v-model="form.remark" class="tui-textarea remark" placeholder-class="phcolor" placeholder="选填" />
|
|
|
</div>
|
|
|
</tui-list-cell>
|
|
|
</div>
|
|
|
- <!-- 提交 -->
|
|
|
<div class="confirm-btn">
|
|
|
- <button class="admin-button-com big blue" formType="submit">确认</button>
|
|
|
+ <button class="admin-button-com big blue" formType="submit">提交</button>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
<div v-show="showMiniCodeArea">
|
|
|
<view style="text-align:center;">
|
|
|
- <image style="width:200upx;height:200upx;margin:0 auto;" :src="miniCodeSrc"></image>
|
|
|
- <view style="text-align:center;margin-top:20upx;margin-bottom:20upx;">请让员工扫描上方太阳码完成绑定</view>
|
|
|
- <button class="admin-button-com big blue" @click="complete" style="padding-left:23upx;padding-right:23upx;">完成</button>
|
|
|
+ <image style="width:400upx;height:400upx;margin:0 auto;" :src="miniCodeSrc"></image>
|
|
|
+ <view style="text-align:center;margin-top:20upx;margin-bottom:20upx;font-size:30upx;">请让员工扫描上方太阳码完成添加</view>
|
|
|
+ <button class="admin-button-com big blue" @click="complete" style="padding-left:40upx;padding-right:40upx;">完成</button>
|
|
|
</view>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
<script>
|
|
|
import TuiListCell from "@/components/plugin/list-cell";
|
|
|
import AppAvatarModule from "@/components/module/app-avatar";
|
|
|
const form = require("@/utils/formValidation.js");
|
|
|
-// api
|
|
|
-import {
|
|
|
- getRoleList,
|
|
|
- getStaffDet as getDet,
|
|
|
- updateStaff as update
|
|
|
-} from "@/api/staff";
|
|
|
+import { getRoleList, getStaffDet as getDet, updateStaff as update } from "@/api/staff";
|
|
|
import { getDet as getMemberDet } from "@/api/member";
|
|
|
import { prepareBind } from "@/api/shop-admin";
|
|
|
export default {
|
|
|
@@ -108,13 +69,9 @@ export default {
|
|
|
onLoad() {},
|
|
|
onShow() {
|
|
|
if (this.option.id) {
|
|
|
- uni.setNavigationBarTitle({
|
|
|
- title: `修改员工`
|
|
|
- });
|
|
|
+ uni.setNavigationBarTitle({ title: `修改员工` })
|
|
|
} else {
|
|
|
- uni.setNavigationBarTitle({
|
|
|
- title: `添加员工`
|
|
|
- });
|
|
|
+ uni.setNavigationBarTitle({ title: `添加员工` })
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -132,16 +89,15 @@ export default {
|
|
|
this.memberData = memberData;
|
|
|
this.form.userId = memberData.id;
|
|
|
}
|
|
|
-
|
|
|
- if (data) return false;
|
|
|
-
|
|
|
+ if (data){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
this._getRoleList().then(res => {
|
|
|
if (this.option.id) {
|
|
|
this._getDet();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // api
|
|
|
async _getRoleList() {
|
|
|
await getRoleList().then(res => {
|
|
|
if (this.$util.isEmpty(res.data)) return false;
|
|
|
@@ -163,15 +119,12 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 获取客户详情
|
|
|
_getMemberDet() {
|
|
|
getMemberDet({ userId: this.form.userId }).then(res => {
|
|
|
if (this.$util.isEmpty(res.data)) return;
|
|
|
this.memberData = res.data;
|
|
|
});
|
|
|
},
|
|
|
- // option
|
|
|
- // 关联微信
|
|
|
selMemberFn() {
|
|
|
let data = {
|
|
|
form: this.form,
|
|
|
@@ -197,15 +150,10 @@ export default {
|
|
|
this.form.id = this.option.id;
|
|
|
}
|
|
|
hostFn(this.form).then(res => {
|
|
|
- console.log('23rh23r23')
|
|
|
- console.log(res)
|
|
|
- console.log(this.option.id)
|
|
|
if(typeof(this.option.id) == 'undefined'){
|
|
|
this.showMiniCodeArea = true;
|
|
|
this.miniCodeSrc = res.data.miniCode;
|
|
|
this.showStaffArea = false;
|
|
|
- console.log(this.miniCodeSrc)
|
|
|
- console.log('--oo0oooo---')
|
|
|
}else{
|
|
|
let promptText = this.option.id ? "修改成功!" : "添加成功!";
|
|
|
this.$msg(promptText);
|
|
|
@@ -219,7 +167,6 @@ export default {
|
|
|
complete(){
|
|
|
this.$util.pageTo(1)
|
|
|
},
|
|
|
- // 表单验证
|
|
|
formSubmit(e) {
|
|
|
let rules = [
|
|
|
{
|
|
|
@@ -239,7 +186,6 @@ export default {
|
|
|
}
|
|
|
};
|
|
|
</script>
|
|
|
-
|
|
|
<style lang="scss" scoped>
|
|
|
.app-content {
|
|
|
min-height: calc(100vh - 20upx);
|
|
|
@@ -250,7 +196,6 @@ export default {
|
|
|
padding-left: 30upx;
|
|
|
margin-bottom: 30upx;
|
|
|
}
|
|
|
-// ---
|
|
|
.module-com {
|
|
|
margin-bottom: 20upx;
|
|
|
.member-wrap {
|
|
|
@@ -266,7 +211,6 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-// 按钮
|
|
|
.confirm-btn {
|
|
|
width: calc(100% - 60upx);
|
|
|
margin: 60upx 30upx 20upx;
|
|
|
@@ -274,4 +218,4 @@ export default {
|
|
|
width: 100%;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|