登录保存商户信息

This commit is contained in:
duan 2024-10-21 16:55:26 +08:00
parent 9c97a912a7
commit c6b4e503dc
11 changed files with 129 additions and 68 deletions

View File

@ -34,9 +34,11 @@ const model = {
// 1. 清空app级别缓存。 // 1. 清空app级别缓存。
Object.keys(appCache).forEach(k => appCache[k] = null) Object.keys(appCache).forEach(k => appCache[k] = null)
const merchantName=uni.getStorageSync('merchantName') const merchantName=uni.getStorageSync('merchantName')
const MerchantId=uni.getStorageSync('MerchantId')
let envName = model.env() // 获取到当前的环境变量 let envName = model.env() // 获取到当前的环境变量
uni.clearStorageSync() // 清除所有的缓存信息 uni.clearStorageSync() // 清除所有的缓存信息
uni.setStorageSync('merchantName',merchantName) uni.setStorageSync('merchantName',merchantName)
uni.setStorageSync('MerchantId',MerchantId)
model.env(envName) // 重置env model.env(envName) // 重置env
}, },

View File

@ -42,7 +42,9 @@
import { reactive, ref, computed } from "vue" import { reactive, ref, computed } from "vue"
import go from "@/commons/utils/go.js" import go from "@/commons/utils/go.js"
import ent from '@/commons/utils/ent.js' import ent from '@/commons/utils/ent.js'
import {
hasPermission
} from '@/commons/utils/hasPermission.js';
// //
const props = defineProps({ const props = defineProps({
// grid- list- // grid- list-
@ -59,7 +61,9 @@ const props = defineProps({
}) })
// //
function clickFunc(nav) { async function clickFunc(nav) {
let res =await hasPermission('允许查看经营数据')
console.log(res,'调试11111')
// //
if (nav.clickFunc) { if (nav.clickFunc) {
return nav.clickFunc(nav) return nav.clickFunc(nav)

View File

@ -16,10 +16,10 @@ import {
import infoBox from "@/commons/utils/infoBox.js" import infoBox from "@/commons/utils/infoBox.js"
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
// 测试服 // 测试服
let baseUrl = 'https://admintestpapi.sxczgkj.cn' // let baseUrl = 'https://admintestpapi.sxczgkj.cn'
// 王伟本地测 // 王伟本地测
// let baseUrl = '/ww' // let baseUrl = '/ww'
// let baseUrl = 'http://192.168.1.15:8000' let baseUrl = 'http://192.168.1.15:8000'
// 多少 ms 以内, 不提示loading // 多少 ms 以内, 不提示loading
const loadingShowTime = 200 const loadingShowTime = 200
@ -64,7 +64,6 @@ function commonsProcess(showLoading, httpReqCallback) {
return httpReqCallback().then((httpData) => { return httpReqCallback().then((httpData) => {
reqFinishFunc(); // 请求完毕的动作 reqFinishFunc(); // 请求完毕的动作
console.log(httpData,'调试1')
// 从http响应数据中解构响应数据 [ 响应码、 bodyData ] // 从http响应数据中解构响应数据 [ 响应码、 bodyData ]
let { let {
statusCode, statusCode,

View File

@ -220,10 +220,11 @@ export function callTablecall(data) {
}); });
} }
// 获取员工列表 // 获取员工列表
export function rolesGet() { export function rolesGet(params) {
return request({ return request({
url: `/api/tbPlussShopStaff`, url: `/api/tbPlussShopStaff`,
method: "get" method: "get",
params
}); });
} }
// 删除员工 // 删除员工

View File

@ -43,7 +43,7 @@
</view> </view>
</view> </view>
<view class="u-p-b-24 u-m-b-24 border-bottom"> <view class="u-p-b-24 u-m-b-24 border-bottom">
<view class="title">分类打印</view> <view class="title">分类打印(仅打印制作单[厨房])</view>
<view class="u-m-t-16"> <view class="u-m-t-16">
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'classifyPrint')"> <radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'classifyPrint')">
<label class="radio u-m-r-60"> <label class="radio u-m-r-60">

View File

@ -70,10 +70,13 @@
<tbody> <tbody>
<tr v-for="(item,index) in tableList" :key="item.productId"> <tr v-for="(item,index) in tableList" :key="item.productId">
<td style="width: 500rpx;padding-left: 16rpx;"> <td style="width: 500rpx;padding-left: 16rpx;">
<image v-if="index==0" src="../pageTable/index/images/1.png" style="width: 22rpx;height: 30rpx;" mode=""></image> <image v-if="index==0" src="../pageTable/index/images/1.png" style="width: 22rpx;height: 30rpx;"
<image v-else-if="index==1" src="../pageTable/index/images/2.png" style="width: 22rpx;height: 30rpx;" mode=""></image> mode=""></image>
<image v-else-if="index==2" src="../pageTable/index/images/3.png" style="width: 22rpx;height: 30rpx;" mode=""></image> <image v-else-if="index==1" src="../pageTable/index/images/2.png"
<span v-else>{{index}}</span> style="width: 22rpx;height: 30rpx;" mode=""></image>
<image v-else-if="index==2" src="../pageTable/index/images/3.png"
style="width: 22rpx;height: 30rpx;" mode=""></image>
<span v-else>{{index}}</span>
&nbsp;&nbsp;{{item.productName}} &nbsp;&nbsp;{{item.productName}}
</td> </td>
<td style="padding-left: 16rpx;">{{item.num}}</td> <td style="padding-left: 16rpx;">{{item.num}}</td>
@ -142,11 +145,19 @@
startTime = formatTime() + ' 00:00:00' startTime = formatTime() + ' 00:00:00'
endTime = formatTime() + ' 23:59:59' endTime = formatTime() + ' 23:59:59'
} else if (selected.value == 'circumference') { } else if (selected.value == 'circumference') {
startTime = dayjs().add(-7, 'day').format('YYYY-MM-DD 00:00:00') var now = new Date();
endTime = dayjs().format('YYYY-MM-DD 23:59:59') var nowTime = now.getTime();
var day = now.getDay();
var oneDayTime = 24 * 60 * 60 * 1000;
//
var MondayTime = nowTime - (day - 1) * oneDayTime;
//
var SundayTime = nowTime + (7 - day) * oneDayTime;
startTime = dayjs(MondayTime).format('YYYY-MM-DD 00:00:00')
endTime = dayjs(SundayTime).format('YYYY-MM-DD 23:59:59')
} else if (selected.value == 'moon') { } else if (selected.value == 'moon') {
startTime = dayjs().add(-30, 'day').format('YYYY-MM-DD 00:00:00') startTime = dayjs().startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
endTime = dayjs().format('YYYY-MM-DD 23:59:59') endTime = dayjs().endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
} else if (selected.value == 'custom') { } else if (selected.value == 'custom') {
startTime = start startTime = start
endTime = end endTime = end
@ -171,6 +182,7 @@
} }
function changeTime(e) { function changeTime(e) {
selected.value = e selected.value = e
if (e == 'custom') { if (e == 'custom') {
currentInstance.ctx.$refs.datePicker.toggle() currentInstance.ctx.$refs.datePicker.toggle()
@ -196,7 +208,7 @@
dateProduct({ dateProduct({
shopId: uni.getStorageSync('shopId'), shopId: uni.getStorageSync('shopId'),
day: day.value, day: day.value,
page: 1, page: 0,
size: 5 size: 5
}).then((res) => { }).then((res) => {
tableList.value = res.productList.content tableList.value = res.productList.content

View File

@ -3,14 +3,14 @@
<view class="content"> <view class="content">
<view> <view>
<view> <view>
员工姓名 <text style="color: red;">*</text>员工姓名
</view> </view>
<input type="text" v-model="datas.formData.name" placeholder="请填写员工名称" /> <input type="text" v-model="datas.formData.name" placeholder="请填写员工名称" />
<hr /> <hr />
</view> </view>
<view> <view>
<view> <view>
手机号 <text style="color: red;">*</text>手机号
</view> </view>
<input type="text" v-model="datas.formData.phone" placeholder="请填写手机号" /> <input type="text" v-model="datas.formData.phone" placeholder="请填写手机号" />
<hr /> <hr />
@ -18,7 +18,7 @@
<view> <view>
<view> <view>
员工编号 <text style="color: red;">*</text>员工编号
</view> </view>
<input type="text" v-model="datas.formData.code" placeholder="请填写员工编号" /> <input type="text" v-model="datas.formData.code" placeholder="请填写员工编号" />
<hr /> <hr />
@ -26,7 +26,7 @@
<view> <view>
<view> <view>
员工账号 <text style="color: red;">*</text>员工账号
</view> </view>
<input type="text" v-model="datas.formData.account" placeholder="请填写员工账号,建议使用手机号" /> <input type="text" v-model="datas.formData.account" placeholder="请填写员工账号,建议使用手机号" />
<hr /> <hr />
@ -57,7 +57,7 @@
</view> </view>
<view> <view>
<view> <view>
角色 <text style="color: red;">*</text> 角色
</view> </view>
<view @tap="show=true" style="height: 50rpx;font-size: 28rpx;color: #999999;">{{datas.rolesdata }}</view> <view @tap="show=true" style="height: 50rpx;font-size: 28rpx;color: #999999;">{{datas.rolesdata }}</view>
<hr /> <hr />
@ -78,9 +78,11 @@
<view class="bottomBotton" @tap="sumbitEvent"> <view class="bottomBotton" @tap="sumbitEvent">
保存 保存
</view> </view>
<view class="bottomBotton2" @tap="toUrl"> <!-- <view class="bottomBotton2" @tap="toUrl">
取消 取消
</view> </view> -->
<!-- 消息提示 -->
<up-toast ref="uToastRef"></up-toast>
<!-- 角色选择器 --> <!-- 角色选择器 -->
<up-picker :show="show" @confirm="confirm" @cancel="show = false" :columns="columns"></up-picker> <up-picker :show="show" @confirm="confirm" @cancel="show = false" :columns="columns"></up-picker>
<!-- 弹窗 --> <!-- 弹窗 -->
@ -149,6 +151,15 @@
} }
function sumbitEvent() { function sumbitEvent() {
//
if(!datas.formData.name||!datas.formData.phone||!datas.formData.code||!datas.formData.account){
currentInstance.ctx.$refs.uToastRef.show({
message: "请填写必填项",
type: 'default',
})
return
}
let rolesId = datas.rolesList.filter(ele => ele.name == datas.rolesdata) let rolesId = datas.rolesList.filter(ele => ele.name == datas.rolesdata)
if (rolesId.length == 0) { if (rolesId.length == 0) {
currentInstance.ctx.$refs.message.open() currentInstance.ctx.$refs.message.open()
@ -166,7 +177,7 @@
shopId: uni.getStorageSync("shopId"), shopId: uni.getStorageSync("shopId"),
...datas.formData ...datas.formData
}).then(res => { }).then(res => {
toUrl() go.back()
}) })
} }
@ -195,12 +206,14 @@
go.to('PAGES_STAFF') go.to('PAGES_STAFF')
} }
</script> </script>
<style>
<style scoped lang="less">
page { page {
background-color: #f9f9f9; background-color: #f9f9f9;
padding: 32rpx 28rpx; padding: 32rpx 28rpx;
} }
</style>
<style scoped lang="less">
.h7 { .h7 {
margin: 32rpx 0; margin: 32rpx 0;

BIN
pageStaff/bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -3,7 +3,7 @@
<li v-for="item in datas.list " :key="item.id"> <li v-for="item in datas.list " :key="item.id">
<view class=""> <view class="">
<view class=""> <view class="">
<span style="font-size: 28rpx;color: #333333; ">{{item.name}}</span> <span style="font-size: 28rpx;color: #333333; ">{{item.name}}&nbsp;</span>
<span style="font-size: 24rpx;color: #999; ">{{item.code}}</span> <span style="font-size: 24rpx;color: #999; ">{{item.code}}</span>
</view> </view>
<view class="" style="font-size: 24rpx;color: #666666;"> <view class="" style="font-size: 24rpx;color: #666666;">
@ -25,7 +25,12 @@
</view> </view>
</view> </view>
</li> </li>
<li style="background-color: rgba(0,0,0,0);"></li>
</ul> </ul>
<view v-if="datas.list.length==0" style="text-align: center;">
<image src="./bg.png" style="width: 325rpx;height: 335rpx;" mode=""></image>
<view style="font-size: 28rpx;color: #999;">暂无员工</view>
</view>
<view class="bottomBotton" @tap="toUrl"> <view class="bottomBotton" @tap="toUrl">
添加员工 添加员工
</view> </view>
@ -41,6 +46,9 @@
watch, watch,
onMounted onMounted
} from 'vue'; } from 'vue';
import {
onShow
} from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js'; import go from '@/commons/utils/go.js';
import { import {
rolesGet, rolesGet,
@ -53,7 +61,7 @@
// id // id
rolesId: "" rolesId: ""
}) })
onMounted(() => { onShow(() => {
getList() getList()
}) })
@ -94,14 +102,18 @@
function getList() { function getList() {
rolesGet({ rolesGet({
shopId: uni.getStorageSync("shopId"), shopId: uni.getStorageSync("shopId"),
page: 1, page: 0,
size: 100 size: 100
}).then((res) => { }).then((res) => {
datas.list = res.content datas.list = res.content
}) })
} }
</script> </script>
<style>
page {
background-color: #f9f9f9;
}
</style>
<style lang="less" scoped> <style lang="less" scoped>
* { * {
padding: 0; padding: 0;
@ -110,9 +122,7 @@
outline: none; outline: none;
} }
page {
background-color: #f9f9f9;
}
ul, ul,
li { li {

View File

@ -14,7 +14,8 @@
<!-- 不需要label, 需要修改 label-width="0" --> <!-- 不需要label, 需要修改 label-width="0" -->
<uni-forms ref="loginFormRef" label-width="0" :model="vdata.formData" :rules="rules"> <uni-forms ref="loginFormRef" label-width="0" :model="vdata.formData" :rules="rules">
<view class="u-p-b-30"> <view class="u-p-b-30">
<my-tabs size="large" @change="accountTypeChange" v-model="accountType.sel" :list="accountType.list" textKey="label"></my-tabs> <my-tabs size="large" @change="accountTypeChange" v-model="accountType.sel" :list="accountType.list"
textKey="label"></my-tabs>
</view> </view>
<view v-if="vdata.loginType == 'pwd' "> <view v-if="vdata.loginType == 'pwd' ">
<template v-if="accountType.sel==1"> <template v-if="accountType.sel==1">
@ -174,12 +175,17 @@
getCodeImg getCodeImg
} from '@/http/yskApi/login.js'; } from '@/http/yskApi/login.js';
const accountType=reactive({ const accountType = reactive({
list:[ list: [{
{label:'商户',value:'merchant'}, label: '商户',
{label:'员工',value:'staff'}, value: 'merchant'
},
{
label: '员工',
value: 'staff'
},
], ],
sel:0 sel: 0
}) })
const loginFormRef = ref() const loginFormRef = ref()
@ -192,7 +198,7 @@
} from "@/commons/utils/pushmsg/wxTextToSpeach.js" } from "@/commons/utils/pushmsg/wxTextToSpeach.js"
// #endif // #endif
const rules = { const rules = {
merchantName:{ merchantName: {
rules: [formUtil.rules.requiredInputShowToast('商户号')], rules: [formUtil.rules.requiredInputShowToast('商户号')],
}, },
username: { username: {
@ -239,21 +245,24 @@
}) })
// #ifdef H5 // #ifdef H5
// vdata.formData.username = '18049104914' // vdata.formData.username = '15699991111'
// vdata.formData.pwd = '123456' // vdata.formData.pwd = '123456'
vdata.formData.username = '15699991111' vdata.formData.username = ''
vdata.formData.pwd = 'qwer1234' vdata.formData.pwd = ''
// #endif // #endif
// #ifdef MP-WEIXIN // #ifdef MP-WEIXIN
vdata.formData.username = '15699991111' vdata.formData.username = ''
vdata.formData.pwd = 'qwer1234' vdata.formData.pwd = ''
// vdata.formData.username = '15699991111'
// vdata.formData.pwd = 'qwer1234'
// #endif // #endif
function accountTypeChange(e){ function accountTypeChange(e) {
// #ifdef H5 // #ifdef H5
if(e==1){ if (e == 1) {
vdata.formData.merchantName = '18049104914' // vdata.formData.merchantName = '18049104914'
vdata.formData.username = '13666666666' // vdata.formData.merchantName = ''
// vdata.formData.username = ''
} }
// #endif // #endif
} }
@ -277,7 +286,13 @@
// vdata.siteInfos = storageManage.siteInfos(bizData) // vdata.siteInfos = storageManage.siteInfos(bizData)
// }) // })
// } // }
// ,
let info = uni.getStorageSync('MerchantId')
// console.log(info.merchantName,'121')
if (info.merchantName) {
vdata.formData.merchantName = info.merchantName
vdata.formData.username = info.username
}
}) })
// //
@ -297,7 +312,7 @@
// loginPromise = $loginByPwd(vdata.formData.username, vdata.formData.pwd, vdata.formData.safetyCode) // loginPromise = $loginByPwd(vdata.formData.username, vdata.formData.pwd, vdata.formData.safetyCode)
loginPromise = login({ loginPromise = login({
username: vdata.formData.username, username: vdata.formData.username,
password: encrypt(vdata.formData.pwd) , password: encrypt(vdata.formData.pwd),
rememberMe: false, rememberMe: false,
code: vdata.formData.code, code: vdata.formData.code,
uuid: vdata.formData.uuid, uuid: vdata.formData.uuid,
@ -312,13 +327,18 @@
if (loginPromise == null) { if (loginPromise == null) {
return false; return false;
} }
// //
loginPromise.then(res=> { loginPromise.then(res => {
console.log(res);
// //
loginFinishFunc(res) loginFinishFunc(res)
//
}).catch(e=>{ uni.setStorageSync('MerchantId', {
merchantName: vdata.formData.merchantName,
username: vdata.formData.username,
})
}).catch(e => {
getCode() getCode()
}) })
}) })
@ -340,11 +360,11 @@
}) })
// #endif // #endif
} }
watch(()=>accountType.sel,(newval)=>{ watch(() => accountType.sel, (newval) => {
if(newval==1){ if (newval == 1) {
vdata.formData.merchantName=uni.getStorageSync('merchantName')||'' vdata.formData.merchantName = uni.getStorageSync('merchantName') || ''
}else{ } else {
vdata.formData.username='' vdata.formData.username = ''
} }
}) })
// //
@ -355,6 +375,7 @@
storageManage.shopId(loginBizData.shopId) storageManage.shopId(loginBizData.shopId)
storageManage.shopUserId(loginBizData.user.user.id) storageManage.shopUserId(loginBizData.user.user.id)
storageManage.userInfo(loginBizData) storageManage.userInfo(loginBizData)
// //
go.to("PAGES_INDEX", { go.to("PAGES_INDEX", {
isGetCid: true isGetCid: true

View File

@ -387,7 +387,6 @@ class SchemaValidator extends RuleValidator {
} }
async validateUpdate(data, allData) { async validateUpdate(data, allData) {
console.log(allData);
let result = this._checkFieldInSchema(data) let result = this._checkFieldInSchema(data)
if (!result) { if (!result) {
result = await this.invokeValidateUpdate(data, false, allData) result = await this.invokeValidateUpdate(data, false, allData)