Browse Source

修改

master
tianyi@bogon 3 years ago
parent
commit
63af7828ee
  1. 186
      pages/billing/addUser.vue
  2. 2
      pages/billing/saveOrder.vue
  3. 30
      pages/index/peopleList.vue
  4. 188
      pages/inventory/addGoods.vue
  5. 2
      pages/inventory/goodsList1.vue
  6. 1
      pages/inventory/inventory.vue
  7. 234
      pages/staff/addStaff/addStaff.vue
  8. 79
      pages/staff/staff.vue

186
pages/billing/addUser.vue

@ -2,9 +2,7 @@
<view> <view>
<view class="formBox"> <view class="formBox">
<uni-forms ref="form" :modelValue="formData" :rules="rules" labelWidth="85px"> <uni-forms ref="form" :modelValue="formData" :rules="rules" labelWidth="85px">
<!-- <uni-forms-item label="店铺名称" name="name">
<uni-easyinput type="text" v-model="shopName" disabled />
</uni-forms-item> -->
<uni-forms-item label="收货人" name="name"> <uni-forms-item label="收货人" name="name">
<uni-easyinput type="text" v-model="formData.name" placeholder="请输入收货人" @blur="nameBlur" /> <uni-easyinput type="text" v-model="formData.name" placeholder="请输入收货人" @blur="nameBlur" />
</uni-forms-item> </uni-forms-item>
@ -139,102 +137,102 @@
}, },
methods: { methods: {
del() { del() {
this.delShow = true; this.delShow = true;
}, },
delItemModal() { delItemModal() {
this.delShow = false; this.delShow = false;
this.tui.request("/app/customer/delById", "post", { this.tui.request("/app/customer/delById", "post", {
id: this.userInfo.id, id: this.userInfo.id,
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
uni.showToast({ uni.showToast({
title: "删除成功", title: "删除成功",
icon: 'none' icon: 'none'
}) })
uni.navigateBack() uni.navigateBack()
} else { } else {
uni.showToast({ uni.showToast({
title: "删除失败", title: "删除失败",
icon: 'none' icon: 'none'
}) })
} }
}) })
}, },
nameBlur() { nameBlur() {
this.formData.username = this.formData.phone; this.formData.username = this.formData.phone;
}, },
openPicker() { openPicker() {
console.log('执行打开地址选择器') console.log('执行打开地址选择器')
this.show = true this.show = true
}, },
onhideShow() { onhideShow() {
this.show = false this.show = false
console.log('执行了关闭地址选择器') console.log('执行了关闭地址选择器')
}, },
//选中省市区 //选中省市区
onsetCity(e) { onsetCity(e) {
let data = e.detail.target.dataset; let data = e.detail.target.dataset;
let address = data.province + data.city + data.area; let address = data.province + data.city + data.area;
this.show = false this.show = false
this.formData.address1 = address; this.formData.address1 = address;
this.addressObj = { this.addressObj = {
province: data.province, province: data.province,
city: data.city, city: data.city,
area: data.area, area: data.area,
}
console.log(this.formData, this.addressObj);
},
// 触发提交表单
submit() {
this.$refs.form.validate().then(res => {
// res.shopId = this.shopIndex;
res.shopId = 1;
if (this.userInfo) {
res.id = this.userInfo.id
this.tui.request("/app/customer/edit", "post", Object.assign(this.addressObj, res), false,
true).then((res) => {
if (res.code == 200) {
uni.showToast({
title: "修改成功",
icon: 'none'
})
uni.navigateBack()
} else {
uni.showToast({
title: "修改失败",
icon: 'none'
})
}
})
} else {
this.tui.request("/app/customer/save", "post", Object.assign(this.addressObj, res), false,
true).then((res) => {
if (res.code == 200) {
uni.showToast({
title: "添加成功",
icon: 'none'
})
uni.navigateBack({
delta: 1
})
} else {
uni.showToast({
title: "添加失败",
icon: 'none'
})
}
})
} }
}).catch(err => { console.log(this.formData, this.addressObj);
console.log('表单错误信息:', err); },
}) // 触发提交表单
submit() {
this.$refs.form.validate().then(res => {
// res.shopId = this.shopIndex;
res.shopId = 1;
if (this.userInfo) {
res.id = this.userInfo.id
this.tui.request("/app/customer/edit", "post", Object.assign(this.addressObj, res), false,
true).then((res) => {
if (res.code == 200) {
uni.showToast({
title: "修改成功",
icon: 'none'
})
uni.navigateBack()
} else {
uni.showToast({
title: "修改失败",
icon: 'none'
})
}
})
} else {
this.tui.request("/app/customer/save", "post", Object.assign(this.addressObj, res), false,
true).then((res) => {
if (res.code == 200) {
uni.showToast({
title: "添加成功",
icon: 'none'
})
uni.navigateBack({
delta: 1
})
} else {
uni.showToast({
title: "添加失败",
icon: 'none'
})
}
})
}
}).catch(err => {
console.log('表单错误信息:', err);
})
}
} }
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

2
pages/billing/saveOrder.vue

@ -94,7 +94,7 @@
this.tui.toast(res.message) this.tui.toast(res.message)
} }
}) })
this.tui.request('/app/common/user/list', 'get', {}, false, false, true).then((res) => { this.tui.request('/app/common/user/findAllUserByShopId', 'get', {}, false, false, true).then((res) => {
if (res.code !== 200) return if (res.code !== 200) return
this.staffList = res.result; this.staffList = res.result;
this.createCandidates = res.result.map(item =>{ return item.nickname}) this.createCandidates = res.result.map(item =>{ return item.nickname})

30
pages/index/peopleList.vue

@ -67,7 +67,7 @@
console.log(options.companyType) console.log(options.companyType)
// this.radioType = options.radioType // this.radioType = options.radioType
if (options.popleType == 'khName' || options.popleType == 'gysName') { //供应商或者客户 if (options.popleType == 'khName' || options.popleType == 'gysName') { //供应商或者客户
this.khOrGysList(options.popleType); this.khOrGysList();
} else if (options.popleType == 'wlName' || options.popleType == 'kdName') { //物流快递 } else if (options.popleType == 'wlName' || options.popleType == 'kdName') { //物流快递
this.wlOrKdList(options.popleType) this.wlOrKdList(options.popleType)
} else if (options.popleType == 'fcName') { } else if (options.popleType == 'fcName') {
@ -78,16 +78,24 @@
}, },
methods: { methods: {
//客户、供应商列表 //客户、供应商列表
khOrGysList() { khOrGysList() {
this.tui.request("/app/customer/list", "get", { if(this.popleType == 'gysName'){ //供应商
this.tui.request("/app/supplier/getbyShopId", "post", {}, false, true).then((res) => {
}, false, true).then((res) => { if (res.code == 200) {
if (res.code == 200) { this.popleList = res.result;
this.popleList = res.result; }else{
}else{ this.tui.toast(res.message)
this.tui.toast(res.message) }
} })
}) }else{ //客户
this.tui.request("/app/customer/list", "get", {}, false, true).then((res) => {
if (res.code == 200) {
this.popleList = res.result;
}else{
this.tui.toast(res.message)
}
})
}
}, },
//物流或者快递列表 //物流或者快递列表
wlOrKdList(e) { wlOrKdList(e) {

188
pages/inventory/addGoods.vue

@ -9,66 +9,30 @@
<u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple <u-upload :fileList="fileList1" @afterRead="afterRead" @delete="deletePic" name="1" multiple
:maxCount="10"></u-upload> :maxCount="10"></u-upload>
</uni-forms-item> </uni-forms-item>
<uni-forms-item label=" 供应商" required name="supplierId">
<uni-easyinput type="text" v-model="formData.supplierId" placeholder="请输入供应商" trim="all" />
<!-- <uni-easyinput type="text" v-model="formData.name" /> -->
</uni-forms-item>
<uni-forms-item label="货号" name="productSn" required> <uni-forms-item label="货号" name="productSn" required>
<uni-easyinput type="text" v-model="formData.productSn" placeholder="请输入货号" trim="all" /> <uni-easyinput type="text" v-model="formData.productSn" placeholder="请输入货号" trim="all" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="条码" name="barcode" required>
<uni-easyinput type="text" v-model="formData.barcode" placeholder="请输入条码" trim="all" />
</uni-forms-item>
<uni-forms-item label="采购价" name="purchasePrice" required>
<uni-easyinput type="digit" v-model="formData.purchasePrice" placeholder="请输入采购价" trim="all" />
</uni-forms-item>
<uni-forms-item label="批发价" name="wholesalePrice" required> <uni-forms-item label="批发价" name="wholesalePrice" required>
<uni-easyinput type="digit" v-model="formData.wholesalePrice" placeholder="请输入批发价" trim="all" /> <uni-easyinput type="digit" v-model="formData.wholesalePrice" placeholder="请输入批发价" trim="all" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="市场价" name="price" required> <uni-forms-item label="市场价" name="price" required>
<uni-easyinput type="digit" v-model="formData.price" placeholder="请输入零售价" trim="all" /> <uni-easyinput type="digit" v-model="formData.price" placeholder="请输入零售价" trim="all" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="销售周期" name="salesWeek"> <uni-forms-item label="尾货预警" name="salesWeek" required>
<!-- <uni-easyinput type="digit" v-model="formData.salesWeek" placeholder="请输入零售价" trim="all" /> --> <!-- <uni-easyinput type="digit" v-model="formData.salesWeek" placeholder="请输入零售价" trim="all" /> -->
<uni-datetime-picker type="date" :clear-icon="false" v-model="formData.salesWeek" /> <uni-datetime-picker type="date" :clear-icon="false" v-model="formData.salesWeek" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="尾货预警" name="tailWarn" required> <uni-forms-item label="库存预警" name="tailWarn" required>
<uni-easyinput type="digit" v-model="formData.tailWarn" placeholder="请设置尾货预警天数" trim="all" /> <uni-easyinput type="digit" v-model="formData.tailWarn" placeholder="请设置库存预警天数" trim="all" />
</uni-forms-item> </uni-forms-item>
<uni-forms-item label="分类" name="categoryId" required> <uni-forms-item label="分类" name="categoryId" required>
<uni-data-select class="uni-data-select" :localdata="categoryList" v-model="formData.categoryId" <uni-data-select class="uni-data-select" :localdata="categoryList" v-model="formData.categoryId"
placeholder="请选择分类" @change="categoryChange"></uni-data-select> placeholder="请选择分类" @change="categoryChange"></uni-data-select>
</uni-forms-item> </uni-forms-item>
<view class="attr">
<view class="content" v-for="(items,index) in arrtChange" :key="items.id">
<view class="attrName">
{{items.attributeName }}
</view>
<view class="attrs">
<text v-for="(itemTag, index1) in items.attrNameRange" :key="index1"
@tap.stop="attrNameChange(index,index1) "
:class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.text}}</text>
</view>
</view>
</view>
<uni-forms-item label="货品简介" name="productIntro"> <uni-forms-item label="货品简介" name="productIntro">
<uni-easyinput type="textarea" autoHeight v-model="formData.productIntro" placeholder="请输入货品简介" <uni-easyinput type="textarea" autoHeight v-model="formData.productIntro" placeholder="请输入货品简介"
trim="all" /> trim="all" />
</uni-forms-item> </uni-forms-item>
<!-- <uni-forms-item label="库存数量" name="name">
<uni-easyinput type="number" v-model="formData.name" placeholder="请输入库存数量" trim="all"/>
</uni-forms-item> -->
<!-- <uni-forms-item label="上架日期" name="name">
<uni-datetime-picker type="date" :clear-icon="false" v-model="formData.single" @maskClick="maskClick" />
</uni-forms-item> -->
<!-- <uni-forms-item label="销售周期" name="name">
<uni-data-select
class="uni-data-select"
:localdata="range"
v-model="formData.manufacturer"
placeholder="请选择销售周期"
></uni-data-select>
</uni-forms-item> -->
</uni-forms> </uni-forms>
<u-button type="primary" @tap.stop="submit(ret)">保存</u-button> <u-button type="primary" @tap.stop="submit(ret)">保存</u-button>
@ -88,22 +52,22 @@
fileList1: [], fileList1: [],
// 表单数据 // 表单数据
formData: { formData: {
name: '', productName: '',
manufacturer: '', price: '',
price: '', productSn:'',
single: '', wholesalePrice:'',
classification: '', // classification: '',
// domains 字段下会有多个结果 productPicture: [],
domains: {}, productIntro:'',
productPicture: [] categoryId:'',
salesWeek:'',
tailWarn:''
}, },
categoryList: [], categoryList: [],
arrtList: [], arrtList: [],
arrtChange: [], arrtChange: [],
bufferData: '', bufferData: '',
attributeList: {},
rules: { rules: {
// 对name字段进行必填验证
categoryId: { categoryId: {
rules: [{ rules: [{
required: true, required: true,
@ -122,37 +86,30 @@
errorMessage: '请填写批发价', errorMessage: '请填写批发价',
}, ], }, ],
}, },
purchasePrice: {
rules: [{
required: true,
errorMessage: '请填写采购价',
}, ],
},
barcode: {
rules: [{
required: true,
errorMessage: '请填写条码',
}, ],
},
productSn: { productSn: {
rules: [{ rules: [{
required: true, required: true,
errorMessage: '请填写货号', errorMessage: '请填写货号',
}, ], }, ],
}, },
supplierId: {
rules: [{
required: true,
errorMessage: '请填写姓名',
}, ],
},
productName: { productName: {
rules: [{ rules: [{
required: true, required: true,
errorMessage: '请填写商品名称', errorMessage: '请填写商品名称',
}, ], }, ],
}, },
fileList1: [], tailWarn: {
rules: [{
required: true,
errorMessage: '请填写库存预警天数',
}, ],
},
salesWeek: {
rules: [{
required: true,
errorMessage: '请选择尾货预警天数',
}, ],
}
} }
} }
}, },
@ -217,8 +174,7 @@
console.log(url); console.log(url);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let a = uni.uploadFile({ let a = uni.uploadFile({
url: 'https://storage.xenjoyou.com/hiver/upload/file', // 仅为示例,非真实的接口地址 url: 'https://storage.xenjoyou.com/hiver/upload/file',
// https://unidemo.dcloud.net.cn/upload
filePath: url, filePath: url,
name: 'file', name: 'file',
header: { header: {
@ -227,94 +183,22 @@
}, },
formData: {}, formData: {},
success: (uploadFileRes) => { success: (uploadFileRes) => {
console.log('uploadFileRes', JSON.parse(uploadFileRes.data));
let path = JSON.parse(uploadFileRes.data)
//后端返回的地址,存入图片地址 //后端返回的地址,存入图片地址
this.imageValue.push({ this.formData.productPicture.push({
url: this.imgURL + path.imgUrl, url: uploadFileRes.result,
name: '' name: ''
}) })
console.log('imageValue', this.imageValue)
} }
}); });
}) })
}, },
attrNameChange(index, index1) {
if (!this.arrtList[index].attrNameRange[index1].isChecked) this.arrtList[index].attrNameRange[index1]
.isChecked = false
this.arrtList[index].attrNameRange[index1].isChecked = this.arrtList[index].attrNameRange[index1]
.isChecked ? false : true;
this.arrtChange = JSON.parse(JSON.stringify(this.arrtList));
},
categoryChange(e) { categoryChange(e) {
this.tui.request("/app/productAttribute/selectByCategoryId", "get", {
categoryId: e
}, false, true).then((res) => {
if (res.code == 200) {
this.arrtList = res.result;
if (this.arrtList.length > 0) {
this.arrtList.forEach((items) => {
console.log(items, 'items');
this.tui.request("/app/productAttributeValue/selectByAttributeId", "get", {
id: items.id
}, false, true).then((res1) => {
if (res1.code == 200) {
items.attrNameRange = res1.result.map(val => {
return {
text: val.value,
value: val.id
}
})
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
})
setTimeout(() => {
this.arrtChange = this.arrtList
}, 500)
}
} else {
this.tui.toast(res.message)
}
}).catch((res) => {})
}, },
/**
* 复写 binddata 方法,如果只是为了校验,无复杂自定义操作,可忽略此方法
* @param {String} name 字段名称
* @param {String} value 表单域的值
*/
// binddata(name,value){
// 通过 input 事件设置表单指定 name 的值
// this.$refs.form.setValue(name, value)
// },
// 触发提交表单 // 触发提交表单
submit() { submit() {
this.arrtList.forEach((item, index) => {
item.value = [];
item.attrNameRange.forEach((item2, index2) => {
if (item2.isChecked) {
item.value.push(item2.text)
}
})
})
this.attributeList = this.arrtList.reduce((obj, item) => ({
...obj,
[item.attributeName]: item.value
}), {})
for (let val in this.attributeList) {
if (this.attributeList[val].length == 0) {
return uni.showToast({
title: "请添加属性",
icon: "none"
})
}
}
this.$refs.form.validate().then(res => { this.$refs.form.validate().then(res => {
res.attributeList = JSON.stringify(this.attributeList); this.tui.request("/app/product/save", "post", res, false, false).then((res1) => {
this.tui.request("/app/product/save", "post", res, false, true).then((res1) => {
if (res1.code == 200) { if (res1.code == 200) {
uni.navigateBack({ uni.navigateBack({
delta: 1 delta: 1
@ -331,14 +215,6 @@
}) })
}, },
onPrint(opt) { onPrint(opt) {
/**
* 打印文字 addCPCLText
* x: 文字方块左上角X座标,单位dot
* y: 文字方块左上角Y座标,单位dot
* fontName,fontSize: 字体,取值: 參考文檔
* rotation: 旋转 1-90度 2-180度 3-270度 其他-不旋转
* content: 文字内容
*/
//快递单600*1040 入库单440*320 //快递单600*1040 入库单440*320
let strCmd = blesdk.CreatCPCLPage(440, 320, 1, 0); let strCmd = blesdk.CreatCPCLPage(440, 320, 1, 0);
strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '商品名:女装小西裤') strCmd += blesdk.addCPCLText('0', '30', '24', '0', 0, '商品名:女装小西裤')

2
pages/inventory/goodsList1.vue

@ -273,7 +273,7 @@
methods: { methods: {
//销售员列表 //销售员列表
xsyList() { xsyList() {
this.tui.request('/app/common/user/list', 'get', { this.tui.request('/app/common/user/findAllUserByShopId', 'get', {
}, false, false, true).then((res) => { }, false, false, true).then((res) => {
if (res.code !== 200) return if (res.code !== 200) return

1
pages/inventory/inventory.vue

@ -180,7 +180,6 @@
//点击分类获取商品列表 //点击分类获取商品列表
getShareList(id) { getShareList(id) {
this.tui.request("/app/product/getShareList", "POST", { this.tui.request("/app/product/getShareList", "POST", {
shopId: '002',
categoryId:id, categoryId:id,
supplierName:this.keyword, supplierName:this.keyword,
pageNum: this.pageNum, pageNum: this.pageNum,

234
pages/staff/addStaff/addStaff.vue

@ -1,148 +1,102 @@
<template> <template>
<view> <view>
<view class="popup-height"> <view class="popup-height">
<uni-forms :modelValue="addForm" ref="addForm" validateTrigger="bind" :rules="rules" label-width="160rpx" label-align="right"> <uni-forms :modelValue="addForm" ref="addForm" validateTrigger="bind" :rules="rules" label-width="160rpx"
<uni-forms-item label="登录账号" required name="username"> label-align="right">
<uni-easyinput type="text" v-model="addForm.username" placeholder="请输入登录账号" /> <uni-forms-item label="员工姓名" required name="nickname">
</uni-forms-item> <uni-easyinput type="text" v-model="addForm.nickname" placeholder="请输入员工姓名" />
<uni-forms-item label="密码" required name="password"> </uni-forms-item>
<uni-easyinput type="password" v-model="addForm.password" placeholder="请输入登录密码" /> <uni-forms-item label="手机号" required name="mobile">
</uni-forms-item> <uni-easyinput type="text" v-model="addForm.mobile" placeholder="请输入员工手机号" />
<uni-forms-item label="用户名" required name="nickname"> </uni-forms-item>
<uni-easyinput type="text" v-model="addForm.nickname" placeholder="请输入员工姓名" /> <uni-forms-item label="权限" required name="type">
</uni-forms-item> <uni-data-select style="width: 100%" v-model="addForm.type" :localdata="typeList"></uni-data-select>
<uni-forms-item label="手机号" required name="mobile"> </uni-forms-item>
<uni-easyinput type="text" v-model="addForm.mobile" placeholder="请输入员工手机号" /> </uni-forms>
</uni-forms-item> <u-button type="primary" @click="onFormSubmit">保存</u-button>
<uni-forms-item label="邮箱" name="email"> </view>
<uni-easyinput type="text" v-model="addForm.email" placeholder="请输入员工邮箱" /> </view>
</uni-forms-item>
<!-- <uni-forms-item label="所属门店" required name="shopId">
<uni-data-select
style="width: 100%"
v-model="addForm.shopId"
:localdata="shopList"
></uni-data-select>
</uni-forms-item> -->
<uni-forms-item label="权限" required name="type">
<uni-data-select
style="width: 100%"
v-model="addForm.type"
:localdata="typeList"
></uni-data-select>
</uni-forms-item>
<uni-forms-item label="性别">
<uni-data-select
style="width: 100%"
v-model="addForm.sex"
:localdata="sexList"
></uni-data-select>
</uni-forms-item>
<uni-forms-item label="头像" >
<uni-file-picker fileMediatype="image" v-model="addForm.avatar"></uni-file-picker>
</uni-forms-item>
</uni-forms>
<u-button type="primary" @click="onFormSubmit">保存</u-button>
</view>
</view>
</template> </template>
<script> <script>
export default { export default {
data() { data() {
return { return {
addForm: { addForm: {
username: '', nickname: '',
password: '', mobile: '',
nickname:'', type: '',
mobile:'', password:'123456'
type:'', },
sex:'', id: '',
avatar:[], typeList: [{
// shopId:'', value: 0,
email:'' text: "普通用户"
}, },
typeList:[ {
{ value: 0, text: "普通用户" }, value: 1,
{ value: 1, text: "管理员" }, text: "管理员"
], },
sexList:[ ],
{ value: "男", text: "男" }, rules: {
{ value: "女", text: "女" }, nickname: {
], rules: [{
shopList:[], required: true,
rules:{ errorMessage: '不能为空'
username:{ }]
rules:[{required:true,errorMessage:'不能为空'}] },
}, mobile: {
password:{ rules: [{
rules:[{required:true,errorMessage:'不能为空'}] required: true,
}, errorMessage: '不能为空'
nickname:{ }]
rules:[{required:true,errorMessage:'不能为空'}] },
}, type: {
mobile:{ rules: [{
rules:[{required:true,errorMessage:'不能为空'}] required: true,
}, errorMessage: '不能为空'
// shopId:{ }]
// rules:[{required:true,errorMessage:'不能为空'}] },
// }, }
type:{ }
rules:[{required:true,errorMessage:'不能为空'}] },
}, onLoad(options) {
} const type = options.type
} const item = JSON.parse(options.item)
}, console.log(item)
onLoad(options) { if (type === 'edit') {
const {type} = options this.addForm.nickname = item.nickname
if (type === 'edit') { this.addForm.mobile = item.mobile
const editStaffInfo = this.$store.getters.editStaffInfo this.addForm.type = item.type
console.log('editStaffInfo',editStaffInfo) this.id = item.id
Object.assign(this.addForm,editStaffInfo) }
} uni.setNavigationBarTitle({
uni.setNavigationBarTitle({ title: type === 'add' ? '新增员工' : '编辑信息'
title: type=== 'add'? '新增员工' : '编辑信息' });
}); },
// this.getShopList() methods: {
}, onFormSubmit() {
methods:{ console.log('submit')
// getShopList() { this.$refs.addForm.validate().then(async () => {
// this.tui.request('/app/common/shops','get',{}, false,true,false).then(res => { const res = await this.tui.request('/app/common/user/add', 'post', this.addForm, false,
// if (res.code !== 200) { true, false)
// return uni.showToast({ if (res.code == 200) {
// title:res.message, uni.navigateBack()
// icon:'none' console.log(res)
// })} } else {
// this.shopList = res.result.map((v) => { this.tui.toast(res.message)
// return {
// text:v.shopName,
// value:v.id
// }
// })
// })
// },
onFormSubmit() {
console.log('submit')
this.$refs.addForm.validate().then(async () => {
const res = await this.tui.request('/app/common/user/add','post',this.addForm,false,true,false)
if (res.code == 200){
uni.navigateBack()
console.log(res)
}else{
this.tui.toast(res.message)
} }
},(reason) => { }, (reason) => {
console.log(reason) console.log(reason)
}) })
} }
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.popup-height { .popup-height {
padding: 0 25upx; padding: 0 25upx;
background-color: #fff; background-color: #fff;
} }
</style>
</style>

79
pages/staff/staff.vue

@ -1,8 +1,8 @@
<template> <template>
<view> <view>
<uni-card title="员工管理"> <uni-card title="员工管理">
<u-grid :col="4" border @click="onGridClick"> <u-grid :col="4" border>
<u-grid-item index="add" @tap="gotoAddStaffPage('add')"> <u-grid-item index="add" @tap="onDotClick('add','')">
<u-icon name="man-add" :size="size"></u-icon> <u-icon name="man-add" :size="size"></u-icon>
<view class="man-add">添加员工</view> <view class="man-add">添加员工</view>
</u-grid-item> </u-grid-item>
@ -10,7 +10,7 @@
<u-icon name="calendar" :size="size"></u-icon> <u-icon name="calendar" :size="size"></u-icon>
<view class="calendar">上班打卡</view> <view class="calendar">上班打卡</view>
</u-grid-item> </u-grid-item>
<u-grid-item @tap="gotoPerformancePage"> <u-grid-item @tap="gotoPerformancePage">
<u-icon name="list" :size="size"></u-icon> <u-icon name="list" :size="size"></u-icon>
<view class="list">业绩管理</view> <view class="list">业绩管理</view>
</u-grid-item> </u-grid-item>
@ -22,18 +22,19 @@
</uni-card> </uni-card>
<uni-card title="员工列表"> <uni-card title="员工列表">
<uni-list> <uni-list>
<uni-list-item direction="row" clickable @tap="onDotClick(item)" v-for="(item , index) in staffList" :key="index"> <uni-list-item direction="row" clickable @tap="onDotClick('edit',item)" v-for="(item , index) in staffList"
<template #body> :key="index">
<view class="tag-wrap"> <template #body>
<view v-if="item.departmentTitle"> <view class="tag-wrap">
<u-tag :text="item.departmentTitle" size="12" /> <view v-if="item.departmentTitle">
</view> <u-tag :text="item.departmentTitle" size="12" />
<view> </view>
<u-tag text="店长" v-if="item.type==1" size="12" /> <!-- <view>
<u-tag text="员工" v-if="item.type==0" size="12" /> <u-tag text="店长" v-if="item.type==1" size="12" />
</view> <u-tag text="员工" v-if="item.type==0" size="12" />
</view> </view> -->
</template> </view>
</template>
<template #header> <template #header>
<view class="avatar-wrap"> <view class="avatar-wrap">
<u-avatar :src="item.avatar" size="24"> <u-avatar :src="item.avatar" size="24">
@ -59,43 +60,31 @@
size: 30, size: 30,
}; };
}, },
onShow() { onShow() {
this.getStaffList() this.getStaffList()
}, },
methods: { methods: {
async onDotClick(item) { onDotClick(type,item) {
await this.$store.dispatch('SET_EDIT_STAFF_INFO',item) uni.navigateTo({
this.gotoAddStaffPage('edit') url: `/pages/staff/addStaff/addStaff?type=${type}&item=`+ JSON.stringify(item)
}, })
onGridClick(target) {
switch (target) {
case 0:
this.$refs.popup.open('bottom');
break;
default:
}
}, },
getStaffList() { getStaffList() {
this.tui.request('/app/common/user/list', 'get', {}, false, false, true).then((res) => { this.tui.request('/app/common/user/findAllUserByShopId', 'get', {}, false, false, true).then((res) => {
if (res.code !== 200) return if (res.code !== 200) return
this.staffList = res.result this.staffList = res.result
}) })
}, },
gotoAddStaffPage(type) { gotoPerformancePage() {
uni.navigateTo({ uni.navigateTo({
url:`/pages/staff/addStaff/addStaff?type=${type}` url: '/pages/staff/performance/performance'
}) })
}, },
gotoPerformancePage() { gotoClockPage() {
uni.navigateTo({ uni.navigateTo({
url:'/pages/staff/performance/performance' url: '/pages/staff/clock/clock'
}) })
}, }
gotoClockPage() {
uni.navigateTo({
url:'/pages/staff/clock/clock'
})
}
} }
} }
</script> </script>
@ -105,7 +94,7 @@
padding: 0 15upx; padding: 0 15upx;
} }
.tag-wrap { .tag-wrap {
width: 100rpx; width: 100rpx;
flex: 1; flex: 1;
display: flex; display: flex;
@ -121,4 +110,4 @@
justify-content: space-between; justify-content: space-between;
font-size: 24upx; font-size: 24upx;
} }
</style> </style>
Loading…
Cancel
Save