代码更新

This commit is contained in:
GaoHao
2025-03-03 09:44:11 +08:00
parent b4a0393d2d
commit fd0c452a76
55 changed files with 2263 additions and 2658 deletions

View File

@@ -2,71 +2,51 @@
<view class="h7">基本信息设置</view>
<view class="content">
<view>
<view>
<text style="color: red;">*</text>员工姓名
</view>
<view> <text style="color: red;">*</text>员工姓名 </view>
<input type="text" v-model="datas.formData.name" placeholder="请填写员工名称" />
</view>
<view>
<view>
<text style="color: red;">*</text>手机号
</view>
<view> <text style="color: red;">*</text>手机号 </view>
<input type="text" v-model="datas.formData.phone" placeholder="请填写手机号" />
</view>
<view>
<view>
<text style="color: red;">*</text>员工编号
</view>
<view> <text style="color: red;">*</text>员工编号 </view>
<input type="text" v-model="datas.formData.code" placeholder="请填写员工编号" />
</view>
<view>
<view>
<text style="color: red;">*</text>员工账号
</view>
<view> <text style="color: red;">*</text>员工账号 </view>
<input type="text" v-model="datas.formData.accountName" placeholder="请填写员工账号,建议使用手机号" />
</view>
<view>
<view>
登录密码
</view>
<view> <text style="color: red;">*</text>登录密码 </view>
<view style="margin: 24rpx 0;display: flex;justify-content: space-between;align-items: center;">
<input type="text" v-model="datas.formData.accountPwd" @change="datas.isPassword = true" placeholder="请输入登录密码不填写默认123456" />
<view style="color: #2979ff;" @click="datas.isPassword = true">重置密码</view>
<input type="text" v-model="datas.formData.accountPwd" @change="datas.isPassword = true" placeholder="请输入登录密码" />
<view style="color: #2979ff;" @click="datas.isPassword = true;datas.formData.accountPwd=''">重置密码</view>
</view>
</view>
<view>
<view style="margin-bottom: 24rpx;">
优惠类型
</view>
<view style="margin-bottom: 24rpx;"> 优惠类型 </view>
<up-radio-group v-model="datas.formData.discountType" placement="row" >
<up-radio label="折扣" name="1"></up-radio>&nbsp;&nbsp;&nbsp;&nbsp;
<up-radio label="金额" name="0"></up-radio>
</up-radio-group>
</view>
<view>
<view>
最低优惠折扣
</view>
<view> 最低优惠折扣 </view>
<input v-if="datas.formData.discountType==1" @blur="maxdisinput" type="number"
v-model="datas.formData.maxDiscountAmount" placeholder="请输入最低优惠折扣" />
<input v-if="datas.formData.discountType==0" type="number" v-model="datas.formData.maxDiscountAmount"
placeholder="请输入最低优惠折扣" />
</view>
<view>
<view>
<text style="color: red;">*</text> 角色
</view>
<view> <text style="color: red;">*</text> 角色 </view>
<view @tap="show=true" style="height: 50rpx;font-size: 28rpx;color: #999999;margin-top: 24rpx;">{{datas.rolesdata }}</view>
</view>
</view>
<view class="h7">员工权限设置</view>
<view class="contentBottom" v-for="item in datas.permissions" :key="item.id">
<view>
{{item.label}}
</view>
<view> {{item.label}} </view>
<view class="">
<up-checkbox shape='circle' :customStyle="{marginBottom: '8px'}" v-model:checked="ele.hasPermission"
usedAlone v-for="(ele, index) in item.children" :key="index" :label="ele.label"
@@ -74,9 +54,7 @@
</up-checkbox>
</view>
</view>
<view class="bottomBotton" @tap="sumbitEvent">
保存
</view>
<view class="bottomBotton" @tap="sumbitEvent"> 保存 </view>
<!-- 消息提示 -->
<up-toast ref="uToastRef"></up-toast>
@@ -89,15 +67,8 @@
</template>
<script setup>
import {
getCurrentInstance,
reactive,
ref
} from 'vue';
import {
onShow,
} from '@dcloudio/uni-app';
import { getCurrentInstance, reactive, ref } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js';
import { shopStaffDetail,getShopStaffPermission,shopStaffAdd,shopStaffPut } from "@/api/staff.js"
@@ -129,8 +100,6 @@
]);
const show = ref(false)
onShow(() => {
init()
})
@@ -140,6 +109,7 @@
//获取权限列表
let res = await getShopPermission()
datas.permissions = res
Object.assign(datas.permissions, res)
if (props.type == 'edit') {
uni.setNavigationBarTitle({
title: '编辑员工'
@@ -172,7 +142,6 @@
datas.permissions.forEach(ele => {
ele.children.forEach(res => {
console.log(res)
res2.forEach(v => {
if (res.id == v ) {
res.hasPermission = 1
@@ -180,7 +149,6 @@
})
})
})
console.log(datas.permissions)
})
}
@@ -191,7 +159,7 @@
*/
function getShopStaffDetail(id) {
shopStaffDetail({id:id}).then(res => {
datas.formData = res
Object.assign(datas.formData, res)
if (datas.rolesList) {
let rolefilter = datas.rolesList.filter(ele => ele.id == res.roleId)
datas.rolesdata = rolefilter[0].name
@@ -218,7 +186,10 @@
if(datas.permissions){
datas.permissions.forEach(ele => {
ele.children.forEach(res => {
if (res.hasPermission) {
console.log(res)
console.log(datas.formData.shopPermissionIds)
res.hasPermission = 1
datas.formData.shopPermissionIds.push(res.id)
}

View File

@@ -13,7 +13,7 @@
<view class="">
<view style="display: flex;justify-content: center;align-items: center;">
<span style="font-size: 28rpx;color: #999999;">是否启用</span>&nbsp;&nbsp;
<up-switch :activeValue="true" :inactiveValue="false" v-model="item.status" size="18"
<up-switch :activeValue="1" :inactiveValue="0" v-model="item.status" size="18"
@change="switch2Change($event,item)"></up-switch>
</view>
<view class="df">