登录保存商户信息
This commit is contained in:
parent
9c97a912a7
commit
c6b4e503dc
|
|
@ -34,9 +34,11 @@ const model = {
|
|||
// 1. 清空app级别缓存。
|
||||
Object.keys(appCache).forEach(k => appCache[k] = null)
|
||||
const merchantName=uni.getStorageSync('merchantName')
|
||||
const MerchantId=uni.getStorageSync('MerchantId')
|
||||
let envName = model.env() // 获取到当前的环境变量
|
||||
uni.clearStorageSync() // 清除所有的缓存信息
|
||||
uni.setStorageSync('merchantName',merchantName)
|
||||
uni.setStorageSync('MerchantId',MerchantId)
|
||||
model.env(envName) // 重置env
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,9 @@
|
|||
import { reactive, ref, computed } from "vue"
|
||||
import go from "@/commons/utils/go.js"
|
||||
import ent from '@/commons/utils/ent.js'
|
||||
|
||||
import {
|
||||
hasPermission
|
||||
} from '@/commons/utils/hasPermission.js';
|
||||
// 定义组件参数
|
||||
const props = defineProps({
|
||||
//显示类型: 支持 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) {
|
||||
return nav.clickFunc(nav)
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ import {
|
|||
import infoBox from "@/commons/utils/infoBox.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 = 'http://192.168.1.15:8000'
|
||||
let baseUrl = 'http://192.168.1.15:8000'
|
||||
|
||||
// 多少 ms 以内, 不提示loading
|
||||
const loadingShowTime = 200
|
||||
|
|
@ -64,7 +64,6 @@ function commonsProcess(showLoading, httpReqCallback) {
|
|||
|
||||
return httpReqCallback().then((httpData) => {
|
||||
reqFinishFunc(); // 请求完毕的动作
|
||||
console.log(httpData,'调试1')
|
||||
// 从http响应数据中解构响应数据 [ 响应码、 bodyData ]
|
||||
let {
|
||||
statusCode,
|
||||
|
|
|
|||
|
|
@ -220,10 +220,11 @@ export function callTablecall(data) {
|
|||
});
|
||||
}
|
||||
// 获取员工列表
|
||||
export function rolesGet() {
|
||||
export function rolesGet(params) {
|
||||
return request({
|
||||
url: `/api/tbPlussShopStaff`,
|
||||
method: "get"
|
||||
method: "get",
|
||||
params
|
||||
});
|
||||
}
|
||||
// 删除员工
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
</view>
|
||||
</view>
|
||||
<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">
|
||||
<radio-group class="u-flex u-flex-wrap" @change="sizeChange($event,'classifyPrint')">
|
||||
<label class="radio u-m-r-60">
|
||||
|
|
|
|||
|
|
@ -69,11 +69,14 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(item,index) in tableList" :key="item.productId">
|
||||
<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-else-if="index==1" src="../pageTable/index/images/2.png" 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>
|
||||
<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-else-if="index==1" src="../pageTable/index/images/2.png"
|
||||
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>
|
||||
{{item.productName}}
|
||||
</td>
|
||||
<td style="padding-left: 16rpx;">{{item.num}}</td>
|
||||
|
|
@ -142,11 +145,19 @@
|
|||
startTime = formatTime() + ' 00:00:00'
|
||||
endTime = formatTime() + ' 23:59:59'
|
||||
} else if (selected.value == 'circumference') {
|
||||
startTime = dayjs().add(-7, 'day').format('YYYY-MM-DD 00:00:00')
|
||||
endTime = dayjs().format('YYYY-MM-DD 23:59:59')
|
||||
var now = new Date();
|
||||
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') {
|
||||
startTime = dayjs().add(-30, 'day').format('YYYY-MM-DD 00:00:00')
|
||||
endTime = dayjs().format('YYYY-MM-DD 23:59:59')
|
||||
startTime = dayjs().startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
|
||||
endTime = dayjs().endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
|
||||
} else if (selected.value == 'custom') {
|
||||
startTime = start
|
||||
endTime = end
|
||||
|
|
@ -171,6 +182,7 @@
|
|||
}
|
||||
|
||||
function changeTime(e) {
|
||||
|
||||
selected.value = e
|
||||
if (e == 'custom') {
|
||||
currentInstance.ctx.$refs.datePicker.toggle()
|
||||
|
|
@ -196,7 +208,7 @@
|
|||
dateProduct({
|
||||
shopId: uni.getStorageSync('shopId'),
|
||||
day: day.value,
|
||||
page: 1,
|
||||
page: 0,
|
||||
size: 5
|
||||
}).then((res) => {
|
||||
tableList.value = res.productList.content
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
<view class="content">
|
||||
<view>
|
||||
<view>
|
||||
员工姓名
|
||||
<text style="color: red;">*</text>员工姓名
|
||||
</view>
|
||||
<input type="text" v-model="datas.formData.name" placeholder="请填写员工名称" />
|
||||
<hr />
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
手机号
|
||||
<text style="color: red;">*</text>手机号
|
||||
</view>
|
||||
<input type="text" v-model="datas.formData.phone" placeholder="请填写手机号" />
|
||||
<hr />
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<view>
|
||||
<view>
|
||||
员工编号
|
||||
<text style="color: red;">*</text>员工编号
|
||||
</view>
|
||||
<input type="text" v-model="datas.formData.code" placeholder="请填写员工编号" />
|
||||
<hr />
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
<view>
|
||||
<view>
|
||||
员工账号
|
||||
<text style="color: red;">*</text>员工账号
|
||||
</view>
|
||||
<input type="text" v-model="datas.formData.account" placeholder="请填写员工账号,建议使用手机号" />
|
||||
<hr />
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
</view>
|
||||
<view>
|
||||
<view>
|
||||
角色
|
||||
<text style="color: red;">*</text> 角色
|
||||
</view>
|
||||
<view @tap="show=true" style="height: 50rpx;font-size: 28rpx;color: #999999;">{{datas.rolesdata }}</view>
|
||||
<hr />
|
||||
|
|
@ -78,9 +78,11 @@
|
|||
<view class="bottomBotton" @tap="sumbitEvent">
|
||||
保存
|
||||
</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>
|
||||
<!-- 弹窗 -->
|
||||
|
|
@ -149,6 +151,15 @@
|
|||
}
|
||||
|
||||
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)
|
||||
if (rolesId.length == 0) {
|
||||
currentInstance.ctx.$refs.message.open()
|
||||
|
|
@ -166,7 +177,7 @@
|
|||
shopId: uni.getStorageSync("shopId"),
|
||||
...datas.formData
|
||||
}).then(res => {
|
||||
toUrl()
|
||||
go.back()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -195,12 +206,14 @@
|
|||
go.to('PAGES_STAFF')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
<style>
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
padding: 32rpx 28rpx;
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="less">
|
||||
|
||||
|
||||
.h7 {
|
||||
margin: 32rpx 0;
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 9.0 KiB |
|
|
@ -3,7 +3,7 @@
|
|||
<li v-for="item in datas.list " :key="item.id">
|
||||
<view class="">
|
||||
<view class="">
|
||||
<span style="font-size: 28rpx;color: #333333; ">{{item.name}}</span>
|
||||
<span style="font-size: 28rpx;color: #333333; ">{{item.name}} </span>
|
||||
<span style="font-size: 24rpx;color: #999; ">{{item.code}}</span>
|
||||
</view>
|
||||
<view class="" style="font-size: 24rpx;color: #666666;">
|
||||
|
|
@ -25,7 +25,12 @@
|
|||
</view>
|
||||
</view>
|
||||
</li>
|
||||
<li style="background-color: rgba(0,0,0,0);"></li>
|
||||
</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>
|
||||
|
|
@ -41,6 +46,9 @@
|
|||
watch,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
onShow
|
||||
} from '@dcloudio/uni-app';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import {
|
||||
rolesGet,
|
||||
|
|
@ -53,7 +61,7 @@
|
|||
// 删除员工id
|
||||
rolesId: ""
|
||||
})
|
||||
onMounted(() => {
|
||||
onShow(() => {
|
||||
getList()
|
||||
})
|
||||
|
||||
|
|
@ -94,14 +102,18 @@
|
|||
function getList() {
|
||||
rolesGet({
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
page: 1,
|
||||
page: 0,
|
||||
size: 100
|
||||
}).then((res) => {
|
||||
datas.list = res.content
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped>
|
||||
* {
|
||||
padding: 0;
|
||||
|
|
@ -110,9 +122,7 @@
|
|||
outline: none;
|
||||
}
|
||||
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
|
||||
ul,
|
||||
li {
|
||||
|
|
@ -133,7 +143,7 @@
|
|||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 96rpx;
|
||||
|
||||
|
||||
}
|
||||
|
||||
>view:first-child {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
<!-- 不需要label, 需要修改: label-width="0" -->
|
||||
<uni-forms ref="loginFormRef" label-width="0" :model="vdata.formData" :rules="rules">
|
||||
<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 v-if="vdata.loginType == 'pwd' ">
|
||||
<template v-if="accountType.sel==1">
|
||||
|
|
@ -27,7 +28,7 @@
|
|||
</uni-easyinput>
|
||||
</uni-forms-item>
|
||||
</template>
|
||||
|
||||
|
||||
<uni-forms-item name="username">
|
||||
<uni-easyinput class='jeepay-easyinput' placeholder="请输入登录名/手机号"
|
||||
v-model="vdata.formData.username" :clearable="false">
|
||||
|
|
@ -173,15 +174,20 @@
|
|||
login,
|
||||
getCodeImg
|
||||
} from '@/http/yskApi/login.js';
|
||||
|
||||
const accountType=reactive({
|
||||
list:[
|
||||
{label:'商户',value:'merchant'},
|
||||
{label:'员工',value:'staff'},
|
||||
|
||||
const accountType = reactive({
|
||||
list: [{
|
||||
label: '商户',
|
||||
value: 'merchant'
|
||||
},
|
||||
{
|
||||
label: '员工',
|
||||
value: 'staff'
|
||||
},
|
||||
],
|
||||
sel:0
|
||||
sel: 0
|
||||
})
|
||||
|
||||
|
||||
const loginFormRef = ref()
|
||||
const envChangeTipsRef = ref()
|
||||
const refAgr = ref()
|
||||
|
|
@ -192,7 +198,7 @@
|
|||
} from "@/commons/utils/pushmsg/wxTextToSpeach.js"
|
||||
// #endif
|
||||
const rules = {
|
||||
merchantName:{
|
||||
merchantName: {
|
||||
rules: [formUtil.rules.requiredInputShowToast('商户号')],
|
||||
},
|
||||
username: {
|
||||
|
|
@ -239,21 +245,24 @@
|
|||
|
||||
})
|
||||
// #ifdef H5
|
||||
// vdata.formData.username = '18049104914'
|
||||
// vdata.formData.username = '15699991111'
|
||||
// vdata.formData.pwd = '123456'
|
||||
vdata.formData.username = '15699991111'
|
||||
vdata.formData.pwd = 'qwer1234'
|
||||
vdata.formData.username = ''
|
||||
vdata.formData.pwd = ''
|
||||
// #endif
|
||||
// #ifdef MP-WEIXIN
|
||||
vdata.formData.username = '15699991111'
|
||||
vdata.formData.pwd = 'qwer1234'
|
||||
vdata.formData.username = ''
|
||||
vdata.formData.pwd = ''
|
||||
// vdata.formData.username = '15699991111'
|
||||
// vdata.formData.pwd = 'qwer1234'
|
||||
// #endif
|
||||
|
||||
function accountTypeChange(e){
|
||||
|
||||
function accountTypeChange(e) {
|
||||
// #ifdef H5
|
||||
if(e==1){
|
||||
vdata.formData.merchantName = '18049104914'
|
||||
vdata.formData.username = '13666666666'
|
||||
if (e == 1) {
|
||||
// vdata.formData.merchantName = '18049104914'
|
||||
// vdata.formData.merchantName = ''
|
||||
// vdata.formData.username = ''
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
|
|
@ -277,7 +286,13 @@
|
|||
// 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 = login({
|
||||
username: vdata.formData.username,
|
||||
password: encrypt(vdata.formData.pwd) ,
|
||||
password: encrypt(vdata.formData.pwd),
|
||||
rememberMe: false,
|
||||
code: vdata.formData.code,
|
||||
uuid: vdata.formData.uuid,
|
||||
|
|
@ -312,13 +327,18 @@
|
|||
if (loginPromise == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// 请求后的操作
|
||||
loginPromise.then(res=> {
|
||||
console.log(res);
|
||||
loginPromise.then(res => {
|
||||
// 登录成功
|
||||
loginFinishFunc(res)
|
||||
|
||||
}).catch(e=>{
|
||||
// 保存商户号
|
||||
uni.setStorageSync('MerchantId', {
|
||||
merchantName: vdata.formData.merchantName,
|
||||
username: vdata.formData.username,
|
||||
})
|
||||
}).catch(e => {
|
||||
getCode()
|
||||
})
|
||||
})
|
||||
|
|
@ -340,11 +360,11 @@
|
|||
})
|
||||
// #endif
|
||||
}
|
||||
watch(()=>accountType.sel,(newval)=>{
|
||||
if(newval==1){
|
||||
vdata.formData.merchantName=uni.getStorageSync('merchantName')||''
|
||||
}else{
|
||||
vdata.formData.username=''
|
||||
watch(() => accountType.sel, (newval) => {
|
||||
if (newval == 1) {
|
||||
vdata.formData.merchantName = uni.getStorageSync('merchantName') || ''
|
||||
} else {
|
||||
vdata.formData.username = ''
|
||||
}
|
||||
})
|
||||
// 封装登录成功后的操作
|
||||
|
|
@ -355,6 +375,7 @@
|
|||
storageManage.shopId(loginBizData.shopId)
|
||||
storageManage.shopUserId(loginBizData.user.user.id)
|
||||
storageManage.userInfo(loginBizData)
|
||||
|
||||
// 跳转到首页
|
||||
go.to("PAGES_INDEX", {
|
||||
isGetCid: true
|
||||
|
|
|
|||
|
|
@ -387,7 +387,6 @@ class SchemaValidator extends RuleValidator {
|
|||
}
|
||||
|
||||
async validateUpdate(data, allData) {
|
||||
console.log(allData);
|
||||
let result = this._checkFieldInSchema(data)
|
||||
if (!result) {
|
||||
result = await this.invokeValidateUpdate(data, false, allData)
|
||||
|
|
|
|||
Loading…
Reference in New Issue