初始化

This commit is contained in:
魏啾
2024-03-21 15:38:10 +08:00
parent e2f200ae7a
commit 81321b648f
479 changed files with 60060 additions and 1 deletions

395
pages/staff/add.vue Normal file
View File

@@ -0,0 +1,395 @@
<template>
<view class="content">
<view class="contentitem flex-between">
<view class="contentitemtext">
头像
</view>
<view class="onecontent_itemright flex-start">
<view class="onecontent_itemrightimges flex-colum" v-if="avatar" @click="chooseImagelist()">
<image :src="avatar"></image>
</view>
<view class="onecontent_itemrightimges flex-colum" v-else @click="chooseImagelist()">
+
</view>
</view>
</view>
<view class="contentitem flex-between">
<text class="contentitemtext">姓名</text>
<input class="contentiteminput" v-model="form.nickname" type="text" placeholder="请输入员工姓名">
</view>
<view class="contentitem flex-between" style="border-radius: 10rpx 10rpx 0 0 ;">
<text class="contentitemtext">账号/手机号</text>
<input class="contentiteminput" v-model="form.mobile" type="text" placeholder="请设置员工账号/手机号">
</view>
<view class="contentitem flex-between" style="border-radius: 10rpx 10rpx 0 0 ; margin-top:32rpx ;">
<text class="contentitemtext">登录密码</text>
<input class="contentiteminput" v-model="form.password" password="false" type="text" placeholder="员工登录密码">
</view>
<view v-if="staff_id" style="font-size: 24rpx; padding: 10rpx 0;">不修改密码请留空</view>
<view class="contentitem flex-between" style="border-radius:0 0 10rpx 10rpx;">
<text class="contentitemtext">确认密码</text>
<input class="contentiteminput" password="false" v-model="form.passwords" type="text" placeholder="再次输入密码">
</view>
<view class="contentitem flex-between" style="border-radius:10rpx; margin-top:32rpx;"
>
<text class="contentitemtext">排序</text>
<u-number-box integer v-model="form.sort"></u-number-box>
</view>
<view v-if="staff_id" class="positionfixed" @click="staffsavestaff">
确认修改
</view>
<view v-else class="positionfixed" @click="staffcreatestaff">
确认创建
</view>
<view class="positionfixeds" @click="staffdeletestaff">
删除员工
</view>
<view class="contentitem flex-between" style="border-radius:10rpx; margin-top:32rpx;"
@click="pickershow = true">
<text class="contentitemtext">全部订单权限</text>
<view class="flex-start">
<view class="contentiteminput">{{nameis_limits}}</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<u-picker :show="pickershow" :columns="columns" @confirm='confirm' keyName="label"
@cancel='pickershow = false'></u-picker>
</view>
</template>
<script>
import uploadImage from "@/js_sdk/yushijie-ossutil/ossutil/uploadFile.js";
import {
nextTick
} from "vue";
export default {
data() {
return {
columns: [
[{
label: '允许',
id: 1
}, {
label: '不允许',
id: 2
}],
],
pickershow: false,
staff_id: '',
avatar: '',
nameis_limits: '允许',
form: {
nickname: '',
mobile: '',
store_id: '',
password: '',
passwords: "",
sort: 1,
is_limits: 1,
avatar: ""
}
}
},
onLoad(e) {
if (e.id) {
uni.setNavigationBarTitle({
title: '修改员工'
})
this.staff_id = e.id
this.staffstaffreturn()
} else {
uni.setNavigationBarTitle({
title: '添加员工'
})
}
},
onShow() {},
methods: {
async staffdeletestaff(){
let res = await this.api.staffdeletestaff({
staff_id:this.staff_id
})
if (res.code == 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
},
confirm(e) {
this.pickershow = false
this.form.is_limits = e.value[0].id
this.nameis_limits = e.value[0].label
console.log(e)
},
// 上传
chooseImagelist() {
uni.showLoading({
title: '上传中',
mask: true
})
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album'], //从相册选择
success: (res) => {
let file = res.tempFilePaths[0];
uploadImage(file, 'wechat/staffadd/',
result => {
this.avatar = ''
this.$nextTick(() => {
this.form.avatar = result
this.avatar = result
uni.hideLoading()
})
}, result => {
uni.hideLoading()
})
},
fail: (res) => {
uni.hideLoading()
}
});
},
async staffstaffreturn() { //员工信息回显
let res = await this.api.staffstaffreturn({
staff_id: this.staff_id,
});
if (res.code == 1) {
this.form = res.data
this.avatar = res.data.avatar
if (this.form.is_limits == 1) {
this.nameis_limits = '允许'
} else {
this.nameis_limits = '不允许'
}
}
},
async staffsavestaff() { //修改员工
if (this.form.avatar == null || this.form.avatar == '') {
uni.showToast({
title: '请上传头像',
icon: 'none'
});
return false;
}
if (this.form.nickname == null || this.form.nickname == '') {
uni.showToast({
title: '请输入姓名',
icon: 'none'
});
return false;
}
if (this.form.mobile == null || this.form.mobile == '') {
uni.showToast({
title: '请输入电话/员工账号',
icon: 'none'
});
return false;
}
if (this.form.password != null || this.form.passwords != '' || this.form.password != '' || this.form
.passwords != null) {
if (this.form.password != this.form.passwords) {
uni.showToast({
title: '两次输入密码不相同',
icon: 'none'
});
return false;
}
}
if (this.form.password != this.form.passwords) {
uni.showToast({
title: '两次输入密码不相同',
icon: 'none'
});
return false;
}
if (this.form.sort == null || this.form.sort == '') {
uni.showToast({
title: '请输入排序',
icon: 'none'
});
return false;
}
let res = await this.api.staffsavestaff({
nickname: this.form.nickname,
mobile: this.form.mobile,
staff_id: this.staff_id,
sort: this.form.sort,
is_limits:this.form.is_limits,
avatar:this.form.avatar
});
if (res.code == 1) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
},
async staffcreatestaff() { //创建员工
if (this.form.avatar == null || this.form.avatar == '') {
uni.showToast({
title: '请上传头像',
icon: 'none'
});
return false;
}
if (this.form.nickname == null || this.form.nickname == '') {
uni.showToast({
title: '请输入姓名',
icon: 'none'
});
return false;
}
if (this.form.mobile == null || this.form.mobile == '') {
uni.showToast({
title: '请输入电话/员工账号',
icon: 'none'
});
return false;
}
if (this.form.password == null || this.form.password == '') {
uni.showToast({
title: '请输入密码',
icon: 'none'
});
return false;
}
if (this.form.passwords == null || this.form.passwords == '') {
uni.showToast({
title: '请输入确认密码',
icon: 'none'
});
return false;
}
if (this.form.password != this.form.passwords) {
uni.showToast({
title: '两次输入密码不相同',
icon: 'none'
});
return false;
}
if (this.form.sort == null || this.form.sort == '') {
uni.showToast({
title: '请输入排序',
icon: 'none'
});
return false;
}
let res = await this.api.staffcreatestaff(this.form);
if (res.code == 1) {
uni.showToast({
title: '创建成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 2000);
}
},
}
}
</script>
<style lang="scss">
page {
background: #FBFBFA;
}
.content {
margin: 32rpx 28rpx;
.positionfixeds {
position: fixed;
width: 70%;
bottom: 120rpx;
left: 15%;
padding: 10rpx 0;
text-align: center;
background: #d4d4d4;
font-size: 36rpx;
border-radius: 18rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #707070;
}
.positionfixed {
position: fixed;
width: 70%;
bottom: 40rpx;
left: 15%;
padding: 10rpx 0;
text-align: center;
background: #2F87FD;
font-size: 36rpx;
border-radius: 18rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #FFFFFF;
}
.contentitem {
width: 100%;
padding: 12rpx 16rpx;
border-bottom: 2rpx solid #E5E5E5;
background: #FFFFFF;
.contentitemtext {
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #333333;
}
.onecontent_itemright {
.onecontent_itemrighttext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.onecontent_itemrightimges {
width: 112rpx;
height: 112rpx;
background: #F5F5F5;
border-radius: 10rpx;
font-size: 40rpx;
color: #878787;
image {
width: 112rpx;
height: 112rpx;
}
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
.contentiteminput {
padding-left: 20rpx;
text-align: right;
flex: auto;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
</style>

204
pages/staff/createcap.vue Normal file
View File

@@ -0,0 +1,204 @@
<template>
<view class="index">
<view class="title_text">
创建分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
员工分类
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="name" maxlength="8" type="text"
placeholder="请输入员工分类">
</view>
</view>
</view>
<view class="thereconse" @click="servicecreateitemclass">
确定
</view>
<view class="title_text">
管理分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between" v-for="(item,index) in list" :key="index"
@click="contentfixedclick(item)">
<view class="onecontent_itemleft">
{{item.name}}
</view>
<u-icon name="arrow-right" color="#333" size="20"></u-icon>
</view>
</view>
<view v-if="list.length==0 && is_end == true" style="margin-top: 100rpx;width: 100%;" class="flex-colum">
<image src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
</view>
</template>
<script>
export default {
data() {
return {
name: '',
list: [],
is_end: false,
form: {
page: 1,
status: 'loadmore',
},
}
},
onReachBottom() {
this.shoppinggooodstype()
},
onShow() {
this.init_fn()
},
methods: {
init_fn() {
this.list = []
this.is_end = false
this.form.page = 1
this.form.status = 'loadmore'
this.shoppinggooodstype()
},
async shoppinggooodstype() {
let res = await this.api.staffemployee({
page:this.form.page
});
if (res.code == 1) {
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
contentfixedclick(e) {
// let data = {
// title: e.title,
// goods_type_id: e.id
// }
uni.navigateTo({
url: '/pages/staff/createcapinfo?name=' + e.name +'&goods_type_id='+ e.id
});
},
async servicecreateitemclass() {
let res = await this.api.staffemployeeadd({
name: this.name,
type: 1,
id: ''
});
if (res.code == 1) {
uni.showToast({
title: '创建成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.index {
.title_text {
padding: 12rpx 40rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #FFFFFF;
}
.onecontent {
background: #ffffff;
.onecontent_item {
width: 100%;
padding: 16rpx 46rpx;
border-bottom: 2rpx solid #E5E5E5;
.onecontent_itemleft {
flex: 1;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.onecontent_itemright {
flex: 3;
.onecontent_itemrighttext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.onecontent_itemrightimges {
width: 112rpx;
height: 112rpx;
background: #F5F5F5;
border-radius: 10rpx;
font-size: 40rpx;
color: #878787;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 50rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
background: #6699FF;
border-radius: 16rpx;
}
}
</style>

View File

@@ -0,0 +1,161 @@
<template>
<view class="index">
<view class="title_text">
修改分类
</view>
<view class="onecontent">
<view class="onecontent_item flex-between">
<view class="onecontent_itemleft">
员工分类
</view>
<view class="onecontent_itemright flex-start">
<input class="onecontent_itemright_text" v-model="form.name" maxlength="8" type="text"
placeholder="请输入员工分类">
</view>
</view>
</view>
<view class="thereconse" @click="servicecreateitemclass">
确定
</view>
<view class="thereconse thereconsess" @click="shoppingdeletegoodstype">
刪除
</view>
</view>
</template>
<script>
export default {
data() {
return {
form: {
name:'',
goods_type_id:''
},
}
},
onLoad(e) {
this.form.name = e.name
this.form.goods_type_id = e.goods_type_id
},
methods: {
async shoppingdeletegoodstype(){
let res = await this.api.staffemployeedel({
id:this.form.goods_type_id
});
if (res.code == 1) {
uni.showToast({
title: '删除成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
async servicecreateitemclass() {
let res = await this.api.staffemployeeadd({
name:this.form.name,
type:2,
id: this.form.goods_type_id
});
if (res.code == 1) {
uni.showToast({
title: '修改成功',
icon: 'none'
});
setTimeout(() => {
uni.navigateBack();
}, 1000);
}
},
}
}
</script>
<style lang="scss">
page {
background: #F6F6F6;
}
.index {
.title_text {
padding: 12rpx 40rpx;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
#editor {
width: 100%;
height: 456rpx;
padding: 12rpx 40rpx;
background: #FFFFFF;
}
.onecontent {
background: #ffffff;
.onecontent_item {
width: 100%;
padding: 16rpx 46rpx;
border-bottom: 2rpx solid #E5E5E5;
.onecontent_itemleft {
flex: 1;
font-size: 28rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #666666;
}
.onecontent_itemright {
flex: 3;
.onecontent_itemrighttext {
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
.onecontent_itemrightimges {
width: 112rpx;
height: 112rpx;
background: #F5F5F5;
border-radius: 10rpx;
font-size: 40rpx;
color: #878787;
}
.onecontent_itemright_text {
width: 100%;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
.thereconse {
width: 630rpx;
height: 80rpx;
background: #999999;
border-radius: 40rpx;
font-size: 36rpx;
text-align: center;
margin: 50rpx auto;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
color: #FFFFFF;
line-height: 80rpx;
background: #6699FF;
border-radius: 16rpx;
}
.thereconsess{
background:#fc5f69;
}
}
</style>

202
pages/staff/index.vue Normal file
View File

@@ -0,0 +1,202 @@
<template>
<view class="content">
<view class="flex-start">
<view class="onecontent_oen flex-start">
<input class="onecontent_oen_input" type="text" v-model="like" placeholder="请输入员工姓名">
<text class="onecontent_oen_text" @click="inif">搜索</text>
</view>
<view class="onecontent_oen_right flex-start" @click="showpickerclick">
<view class="onecontent_oen_rightimageview">员工分类</view>
</view>
</view>
<view class="towcontent">
<view class="towcontentitem flex-between" v-for="(item,index) in list" :key="index"
@click="contentfixedclick(item)">
<view class="towcontentitem_one flex-colum-start">
<text class="towcontentitem_onetext">{{item.nickname}}</text>
<text class="towcontentitem_towtext">{{item.mobile}}</text>
</view>
<u-icon name="arrow-right" color="#999999" size="18"></u-icon>
</view>
</view>
<view v-if="list.length==0 && is_end == true" class="flex-colum">
<image style="margin-top:100rpx;"
src="https://ointmentweapp.oss-cn-beijing.aliyuncs.com/image/my/order/nothave.png" mode="">
</image>
</view>
<u-loadmore :status="form.status" />
<view class="contentfixed" @click="contentfixedclick">
+
</view>
</view>
</template>
<script>
export default {
data() {
return {
list: [],
is_end: false,
like: '',
form: {
page: 1,
status: 'loadmore',
},
}
},
onShow() {
this.inif()
},
onReachBottom() {
this.stafflist()
},
methods: {
showpickerclick() {
uni.pro.navigateTo('staff/createcap')
},
inif() {
this.list = []
this.is_end = false,
this.form = {
page: 1,
status: 'loadmore',
},
this.stafflist()
},
contentfixedclick(e) {
uni.pro.navigateTo('staff/add', {
id: e.staff_id
})
},
async stafflist() { //
let res = await this.api.stafflist({
like: this.like,
page: this.form.page
});
if (res.code == 1) {
if (res.data.length == 0) {
this.is_end = true
this.form.status = 'nomore'
return false;
} else {
this.form.status = 'loading';
this.form.page = ++this.form.page;
setTimeout(() => {
this.list = [...this.list, ...res.data];
if (res.data.length == 10) {
this.form.status = 'loading';
} else {
this.is_end = true;
this.form.status = 'nomore';
}
}, 500)
}
}
},
}
}
</script>
<style lang="scss">
page {
background: #FBFBFA;
}
.content {
margin: 28rpx 30rpx;
position: relative;
top: 0;
right: 0;
.contentfixed {
position: fixed;
background: #2F87FD;
bottom: 16%;
right: 5%;
font-size: 52rpx;
color: #FFFFFF;
width: 100rpx;
height: 100rpx;
line-height: 100rpx;
text-align: center;
border-radius: 50%;
}
.flex-start {
flex-wrap: nowrap;
.onecontent_oen {
margin: 0 auto;
flex: auto;
height: 70rpx;
border-radius: 36rpx;
border: 2rpx solid #6699FF;
padding-right: 8rpx;
.onecontent_oen_input {
padding-left: 32rpx;
flex: 1;
}
.onecontent_oen_text {
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #FFFFFF;
text-align: center;
line-height: 56rpx;
width: 116rpx;
height: 56rpx;
background: #6699FF;
border-radius: 36rpx;
}
}
.onecontent_oen_right {
margin-left: 26rpx;
.onecontent_oen_rightimage {
width: 17.9rpx;
height: 19.34rpx;
}
.onecontent_oen_rightimageview {
text-align: center;
margin-left: 10rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #333333;
}
}
}
.towcontent {
width: 100%;
.towcontentitem {
margin-top: 30rpx;
padding-bottom: 14rpx;
border-bottom: 2rpx solid #E5E5E5;
.towcontentitem_one {
font-size: 32rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #000000;
}
.towcontentitem_towtext {
margin-top: 10rpx;
font-size: 24rpx;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
color: #999999;
}
}
}
}
</style>