21 changed files with 1659 additions and 1355 deletions
Binary file not shown.
@ -0,0 +1,707 @@ |
|||
<!-- 新增库存页 --> |
|||
<template> |
|||
<view class="page1"> |
|||
<view class="content"> |
|||
<view class="content-box"> |
|||
<view class="shop-box" style="position: fixed;top:0;z-index: 99;width:100%;border-bottom: 1px solid #eee;margin-bottom: 20rpx;"> |
|||
<u-grid :col="2" border> |
|||
<u-grid-item index="add" @tap.stop="scanCodeAdd"> |
|||
<u-icon name="scan" size="36"></u-icon> |
|||
<text>扫一扫</text> |
|||
</u-grid-item> |
|||
<u-grid-item @tap.stop="goodsAdd"> |
|||
<u-icon name="plus" size="28"></u-icon> |
|||
<text>添加商品</text> |
|||
</u-grid-item> |
|||
</u-grid> |
|||
</view> |
|||
<view class="shop-box" style="border-top:5px solid #eee;margin-top: 132rpx;" v-for="(value,key) in Array.from(carList)" |
|||
:key="key"> |
|||
<view class="shop-name"> |
|||
<img class="img-radius" :src="value[1].productPicture" alt="" |
|||
style="width: 140rpx;height: 140rpx;margin: 30rpx 0 0 30rpx;"> |
|||
<view class="shop-productName"> |
|||
<view style="color:#FF5809;">品名:{{value[1].productName}} ({{value[1].productSn}})</view> |
|||
<view>单价:{{value[1].purchasePrice || 0}} 数量:{{value[1].productCount}}</view> |
|||
<view>总价:{{value[1].price}}</view> |
|||
</view> |
|||
|
|||
</view> |
|||
<view class="tui-order-content"> |
|||
<u-collapse> |
|||
<u-collapse-item v-for="(item,index) in returnList" :key="index" :title="item.returnSale.createTime" |
|||
:name="item.returnSale.saleId"> |
|||
<view style="display: flex;border-bottom: 1px solid #eee;height: 50rpx;line-height: 50rpx;"> |
|||
<view style="width: 49%;text-align: center;border-right: 1px solid #eee;">商品规格</view> |
|||
<view style="width: 50%;text-align: center;">总数量</view> |
|||
</view> |
|||
<view v-for="(items,index1) in item.purchaseDetails"> |
|||
<view v-for="(data,index2) in items.stockLogList1" style='height: 50rpx;line-height: 50rpx;'> |
|||
<view style="width: 49%;text-align: center;border-right: 1px solid #eee;float: left;"> |
|||
{{data.attributeList | sliceMsg}} |
|||
</view> |
|||
<view style="width: 50%;text-align: center;float: left;"> |
|||
{{data.productCount}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</u-collapse-item> |
|||
</u-collapse> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="content-box" style="margin-bottom:110rpx;" :style="{'margin-top':(carList.size>0?0:132) + 'rpx' }"> |
|||
<!-- 账号权限是否可以维护成本价格(主账号和被授权的账号可以维护),参数名:shop_admin_cost,维护在用户表中,存在前后端缓存里,把备注栏挪出来,谁都可以备注 --> |
|||
<view class="price-box-list"> |
|||
<view class="content-list"> |
|||
<view class="list-name">备注</view> |
|||
<view class=""> |
|||
<textarea v-model="remark" /> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="bottom-box"> |
|||
<view class="bottom-left"> |
|||
<text>合计:{{totalAmount}}</text> |
|||
<text style="color: #ffa200;">¥{{shouldPay}}</text> |
|||
</view> |
|||
<view class="bottom-right"> |
|||
<button class="bottom-btn" @tap='inventorySubmit'>入库</button> |
|||
</view> |
|||
</view> |
|||
<!-- 弹出层 --> |
|||
<view> |
|||
<uni-popup ref="shopPopup" background-color="#fff"> |
|||
<view class="shop-popup-content"> |
|||
<view class="shop-popup-title"> |
|||
<view class="shop-popup-title-left"> |
|||
<img class="img-radius" :src="goodsDetail.productPicture" alt="" v-if="goodsDetail.productPicture"> |
|||
<view class="noPic" v-else>暂无图片</view> |
|||
</view> |
|||
<view class="shop-popup-title-right"> |
|||
<view class="shop-popup-title-right-box" style="color: #088FEB;">{{goodsDetail.productName}} |
|||
</view> |
|||
<view class="shop-popup-title-right-box">{{goodsDetail.productSn}}</view> |
|||
</view> |
|||
</view> |
|||
<view class="shop-popup-container"> |
|||
<ul style="border-top:20rpx;"> |
|||
<li v-for="(items,index) in goodsDetail.attributeList" :key="index"> |
|||
<view class="shop-title-fur"> |
|||
<view class="shop-title-name">{{items.name}}</view> |
|||
</view> |
|||
<view class="shop-attrs"> |
|||
<uni-data-checkbox v-model="value" :localdata="range"></uni-data-checkbox> |
|||
<text v-for="(itemTag, index1) in items.value" :key="index1" |
|||
@tap.stop="attrNameChange(index,index1) " |
|||
:class="itemTag.isChecked ? 'checkedText' : '' "> {{itemTag.value}}</text> |
|||
</view> |
|||
</li> |
|||
</ul> |
|||
<view style="padding-bottom: 100rpx;"> |
|||
<view class="shop-checkList" v-for="(item,index) in temporaryList" :key="index"> |
|||
<view @tap.stop="delCarData(index)" style="margin-right: 20rpx"> |
|||
<uni-icons color="red" type="minus" size="26"></uni-icons> |
|||
</view> |
|||
<view class="shop-checkList-box"> |
|||
<text style="width: 300rpx;display: inline-block;">{{item.name}}</text> <text style="color:#777;font-size: 12px;">库存:{{item.productNum}}</text> |
|||
</view> |
|||
<uni-number-box max='1000000' v-model="item.productCount" @change="temporaryChange" /> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
<view class="shop-popup-bottom" v-for="(item,index) in temporaryList" :key="index"> |
|||
<view class="shop-popup-bottom-left"> |
|||
<text>数量:{{zNum}} 件</text> |
|||
</view> |
|||
<view class="shop-popup-bottom-right"> |
|||
<view class="bottom-btn" @tap="temporaryCheck">选好了</view> |
|||
</view> |
|||
</view> |
|||
</uni-popup> |
|||
</view> |
|||
<!-- 弹出输入框 --> |
|||
<uni-popup ref="inputDialog" type="dialog"> |
|||
<uni-popup-dialog ref="inputClose" mode="input" title="采购价" placeholder="请输入采购价" |
|||
@confirm="changePrice"></uni-popup-dialog> |
|||
</uni-popup> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
mapState |
|||
} from 'vuex'; |
|||
export default { |
|||
computed: mapState(['shopName']), |
|||
data() { |
|||
return { |
|||
// 表单数据 |
|||
formData: { |
|||
name: '', |
|||
manufacturer: '', |
|||
price: '', |
|||
single: '' |
|||
}, |
|||
khName: [], |
|||
carList: new Map(), |
|||
remark: '', |
|||
otherPay: '', |
|||
noPay: 0, |
|||
alreadyPay: '', |
|||
realAmount: 0, |
|||
shouldPay: '', |
|||
totalAmount: 0, |
|||
index: '', |
|||
index1: '', |
|||
goodsDetail: [], |
|||
columns: [], |
|||
keyList: [], |
|||
temporaryList: [], |
|||
zNum: 0, |
|||
storageType:'', |
|||
productNum:0, |
|||
productId:'' |
|||
} |
|||
}, |
|||
filters: { |
|||
sliceMsg(val) { |
|||
var name = '' |
|||
if (typeof(val) == 'string') { |
|||
let newObj = JSON.parse(val) |
|||
for (let as in newObj) { |
|||
name += newObj[as] + '/' |
|||
} |
|||
} |
|||
return name; |
|||
} |
|||
}, |
|||
onShow() { |
|||
let that = this; |
|||
this.khName = JSON.parse(JSON.stringify(this.khName)) || '' |
|||
if (this.carList.size == 0) { //当前页没有数据 |
|||
for (let i = 0; i < this.carList1.length; i++) { |
|||
let obj = { |
|||
purchasePrice: "", //进货价 |
|||
price: 0, |
|||
productCount: 0, |
|||
productId: this.carList1[i].id, |
|||
productName: this.carList1[i].productName, |
|||
productPicture: this.carList1[i].productPicture, |
|||
productSn: this.carList1[i].productSn, |
|||
stockLogList: new Map(), |
|||
stockLogList1: [] |
|||
} |
|||
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { |
|||
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i] |
|||
.saleDetailQueryDTO[m].productCount) |
|||
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount |
|||
} |
|||
this.carList.set(this.carList1[i].id, obj) |
|||
} |
|||
this.carList1 = [] |
|||
} else { //当前页有数据 |
|||
for (let i = 0; i < this.carList1.length; i++) { |
|||
if (this.carList.has(this.carList1[i].id) == true) { //商品相同 |
|||
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { |
|||
if (this.carList.get(this.carList1[i].id).stockLogList.has(this.carList1[i].saleDetailQueryDTO[ |
|||
m].attributeList) == true) { //规格相同 |
|||
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ |
|||
m].attributeList, this.carList.get(this.carList1[i].id).stockLogList.get(this |
|||
.carList1[i].saleDetailQueryDTO[m].attributeList) + this.carList1[i] |
|||
.saleDetailQueryDTO[m].productCount) |
|||
|
|||
} else { //规格不同 |
|||
this.carList.get(this.carList1[i].id).stockLogList.set(this.carList1[i].saleDetailQueryDTO[ |
|||
m].attributeList, this.carList1[i].saleDetailQueryDTO[m].productCount) |
|||
|
|||
} |
|||
this.carList.get(this.carList1[i].id).productCount += this.carList1[i].saleDetailQueryDTO[ |
|||
m].productCount |
|||
} |
|||
} else { //商品不同 |
|||
let obj = { |
|||
purchasePrice: "", //进货价 |
|||
price: 0, |
|||
productCount: 0, |
|||
productId: this.carList1[i].id, |
|||
productName: this.carList1[i].productName, |
|||
productPicture: this.carList1[i].productPicture, |
|||
productSn: this.carList1[i].productSn, |
|||
stockLogList: new Map(), |
|||
stockLogList1: [], |
|||
name: '' |
|||
} |
|||
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) { |
|||
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].attributeList, this.carList1[i] |
|||
.saleDetailQueryDTO[m].productCount) |
|||
obj.name = this.carList1[i].saleDetailQueryDTO[m].name |
|||
obj.productCount += this.carList1[i].saleDetailQueryDTO[m].productCount |
|||
} |
|||
this.carList.set(this.carList1[i].id, obj) |
|||
} |
|||
|
|||
this.carList.get(this.carList1[i].id).price = this.carList.get(this.carList1[i].id).purchasePrice * this.carList.get(this.carList1[i].id).productCount; |
|||
} |
|||
this.carList1 = [] |
|||
} |
|||
this.getAllPrice() |
|||
}, |
|||
onLoad() { |
|||
this.storageType = uni.getStorageSync('type') |
|||
}, |
|||
methods: { |
|||
//扫一扫功能 |
|||
scanCodeAdd() { |
|||
uni.scanCode({ |
|||
success: (res) => { |
|||
if(res.scanType == "QR_CODE"){ //二维码 |
|||
|
|||
let shopId = res.result.split(',')[1] |
|||
if(shopId == uni.getStorageSync('shopId')){ |
|||
this.productId = res.result.split(',')[0] |
|||
this.toggle('bottom', res.result.split(',')[0]); |
|||
if (item.saleDetailDTOList) { |
|||
for (let i = 0; i < item.saleDetailDTOList.length; i++) { |
|||
this.carList.push(item.saleDetailDTOList[i]) |
|||
} |
|||
} |
|||
}else{ |
|||
this.tui.toast('您的店铺中暂无该商品!') |
|||
} |
|||
}else{ |
|||
this.productId = res.result |
|||
this.tui.request("/app/product/getByBarcode", "POST", { |
|||
barcode:res.result |
|||
}, false, true).then((res1) => { |
|||
if (res1.code == 200) { |
|||
if(res1.result == ''){ |
|||
this.tui.toast('您的店铺中暂无该商品!') |
|||
}else{ |
|||
this.toggle('bottom', res1.result[0].id); |
|||
if (item.saleDetailDTOList) { |
|||
for (let i = 0; i < item.saleDetailDTOList.length; i++) { |
|||
this.carList.push(item.saleDetailDTOList[i]) |
|||
} |
|||
} |
|||
} |
|||
|
|||
} else { |
|||
this.tui.toast(res.message) |
|||
} |
|||
}).catch((res) => { |
|||
this.tui.toast(res) |
|||
}) |
|||
} |
|||
|
|||
}, |
|||
fail: (res) => { |
|||
uni.showToast({ |
|||
title: '扫描失败', |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
goodsAdd() { |
|||
uni.navigateTo({ |
|||
url: "/pages/index/addStock" |
|||
}) |
|||
}, |
|||
//删除整条商品 |
|||
delShop(id) { |
|||
var that = this; |
|||
uni.showModal({ |
|||
title: "提示", |
|||
content: "确定删除此条商品吗?", |
|||
success: function(res) { |
|||
if(res.confirm){ |
|||
that.tui.request("/app/checkStockDetail/deleteCheckStockDetail", "POST", { |
|||
categoryId: id |
|||
}, false, true).then((res1) => { |
|||
if (res1.code == 200) { |
|||
that.tui.toast("删除成功") |
|||
} else { |
|||
that.tui.toast(res.message) |
|||
} |
|||
}).catch((res) => {}) |
|||
} |
|||
} |
|||
}) |
|||
|
|||
}, |
|||
//确认盘点 |
|||
inventorySubmit() { |
|||
uni.showModal({ |
|||
title: "提示", |
|||
content: "请再次确认盘点信息是否正确。确认完成盘点吗?", |
|||
success: function(res) { |
|||
if(res.confirm){ |
|||
that.tui.request("/app/checkStock/submitToStock", "post", {}, false, false).then((res) => { |
|||
if (res.code == 200) { |
|||
uni.showToast({ |
|||
title: "盘点成功", |
|||
icon: 'none' |
|||
}) |
|||
setTimeout(res=> { |
|||
uni.navigateBack({ |
|||
delta: 1 |
|||
}) |
|||
},2000) |
|||
|
|||
} else { |
|||
uni.showToast({ |
|||
title: "盘点失败", |
|||
icon: 'none' |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
page, |
|||
.page1 { |
|||
height: 100%; |
|||
} |
|||
|
|||
.content { |
|||
border-top: 1px solid #eee; |
|||
overflow-y: scroll; |
|||
max-height: 100vh; |
|||
margin-bottom: 100rpx; |
|||
} |
|||
|
|||
.content-box { |
|||
width: 100%; |
|||
height: auto; |
|||
background: #fff; |
|||
margin-bottom: 20rpx; |
|||
|
|||
} |
|||
|
|||
.content-list { |
|||
width: 95%; |
|||
margin: 0 auto; |
|||
display: flex; |
|||
height: 80rpx; |
|||
border-bottom: 1px solid #eee; |
|||
} |
|||
|
|||
.content-list:last-child { |
|||
border-bottom: none; |
|||
height: auto; |
|||
} |
|||
|
|||
.list-name { |
|||
width: 200rpx; |
|||
text-align: left; |
|||
line-height: 40px; |
|||
height: 80rpx; |
|||
padding-left: 20rpx; |
|||
} |
|||
|
|||
.list-val { |
|||
width: 560rpx; |
|||
height: 80rpx; |
|||
line-height: 80rpx; |
|||
} |
|||
|
|||
.list-val input { |
|||
width: 400rpx; |
|||
height: 60rpx; |
|||
display: inline-block; |
|||
line-height: 60rpx; |
|||
float: left; |
|||
margin-top: 10rpx; |
|||
padding-left: 20rpx; |
|||
border-bottom: 1px solid #088FEB; |
|||
} |
|||
|
|||
.uni-data-select { |
|||
width: 80%; |
|||
text-align: center; |
|||
} |
|||
|
|||
.uni-select { |
|||
border: none !important; |
|||
border-radius: 0 !important; |
|||
} |
|||
|
|||
.uni-select__input-placeholder { |
|||
color: #6a6a6a; |
|||
font-size: 28rpx !important; |
|||
width: 400rpx; |
|||
} |
|||
|
|||
.uni-select__input-box { |
|||
.uni-icons { |
|||
margin-left: 100rpx; |
|||
} |
|||
} |
|||
|
|||
.shop-box { |
|||
width: 95%; |
|||
margin: 0 auto; |
|||
position: relative; |
|||
background: #fff; |
|||
} |
|||
|
|||
.shop-name { |
|||
width: 100%; |
|||
height: 200rpx; |
|||
line-height: 80rpx; |
|||
border-top: 1px solid #eee; |
|||
border-bottom: 1px solid #eee; |
|||
font-size: 28rpx; |
|||
font-weight: bold; |
|||
display: flex; |
|||
|
|||
.uni-icons { |
|||
color: #088FEB !important; |
|||
} |
|||
} |
|||
|
|||
.shop-productName { |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: column; |
|||
padding-left: 20rpx; |
|||
} |
|||
|
|||
.shop-productName view { |
|||
height: 55rpx; |
|||
} |
|||
|
|||
.shop-collapse { |
|||
display: flex; |
|||
height: 80rpx; |
|||
font-size: 26rpx; |
|||
line-height: 80rpx; |
|||
} |
|||
|
|||
.shop-collapse text { |
|||
width: 40%; |
|||
text-align: center; |
|||
padding-right: 40rpx; |
|||
border-right: 1px solid #eee; |
|||
} |
|||
|
|||
.price-box-title { |
|||
width: 95%; |
|||
height: 80rpx; |
|||
line-height: 80rpx; |
|||
margin: 0 auto; |
|||
display: flex; |
|||
text-align: center; |
|||
border-bottom: 1px solid #eee; |
|||
} |
|||
|
|||
.price-box-title text { |
|||
flex: 1; |
|||
} |
|||
|
|||
.uni-list-cell { |
|||
display: flex; |
|||
margin-right: 20rpx; |
|||
} |
|||
|
|||
.bottom-box { |
|||
width: 100%; |
|||
position: absolute; |
|||
bottom: 0rpx; |
|||
display: flex; |
|||
background: #fff; |
|||
border-top: 1px solid #eee; |
|||
height: 110rpx; |
|||
} |
|||
|
|||
.bottom-left { |
|||
flex: 1; |
|||
height: 110rpx; |
|||
line-height: 110rpx; |
|||
} |
|||
|
|||
.bottom-right { |
|||
flex: 1; |
|||
height: 110rpx; |
|||
line-height: 110rpx; |
|||
} |
|||
|
|||
.bottom-left text { |
|||
line-height: 84rpx; |
|||
display: inline-block; |
|||
padding-left: 20rpx; |
|||
} |
|||
|
|||
.bottom-btn { |
|||
width: 320rpx; |
|||
background: linear-gradient(90deg, #60F3FF, #088FEB); |
|||
color: #fff; |
|||
border-radius: 50rpx; |
|||
height: 85rpx; |
|||
margin-top: 15rpx; |
|||
} |
|||
|
|||
textarea { |
|||
margin: 20rpx; |
|||
border: 1px solid #eee; |
|||
height: 150rpx; |
|||
width: 500rpx; |
|||
} |
|||
|
|||
.shop-popup-content { |
|||
align-items: center; |
|||
justify-content: center; |
|||
padding: 15px; |
|||
height: 1200rpx; |
|||
background-color: #fff; |
|||
margin-bottom: 30rpx; |
|||
overflow: scroll; |
|||
} |
|||
|
|||
.shop-popup-title { |
|||
display: flex; |
|||
height: 180rpx; |
|||
border-bottom: 1px solid #eee; |
|||
margin-top: 20rpx; |
|||
} |
|||
|
|||
.shop-popup-title-left { |
|||
width: 150rpx; |
|||
height: 150rpx; |
|||
} |
|||
|
|||
.shop-popup-title-left img { |
|||
width: 150rpx; |
|||
height: 150rpx; |
|||
|
|||
} |
|||
|
|||
.shop-popup-title-right { |
|||
width: 400rpx; |
|||
margin-left: 30rpx; |
|||
} |
|||
|
|||
.shop-popup-title-right-box { |
|||
height: 50rpx; |
|||
line-height: 50rpx; |
|||
} |
|||
|
|||
.shop-popup-container { |
|||
width: 100%; |
|||
background: #fff; |
|||
height: 50rpx; |
|||
} |
|||
|
|||
.shop-title-fur { |
|||
width: 95%; |
|||
height: 70rpx; |
|||
margin: 0 auto; |
|||
} |
|||
|
|||
.shop-title-name { |
|||
font-size: 30rpx; |
|||
width: 50%; |
|||
float: left; |
|||
height: 70rpx; |
|||
line-height: 70rpx; |
|||
} |
|||
|
|||
.shop-attrs { |
|||
text { |
|||
display: inline-block; |
|||
border: 1px solid #5fd9ee; |
|||
margin: 20rpx; |
|||
background-color: #fff; |
|||
color: #5fd9ee; |
|||
width: 100rpx; |
|||
line-height: 70rpx; |
|||
height: 70rpx; |
|||
text-align: center; |
|||
} |
|||
|
|||
.checkedText { |
|||
background-color: $u-primary; |
|||
color: #fff; |
|||
} |
|||
} |
|||
|
|||
.shop-checkList { |
|||
display: flex; |
|||
height: 50rpx; |
|||
font-size: 28rpx; |
|||
line-height: 50rpx; |
|||
margin: 20rpx 0; |
|||
} |
|||
|
|||
.shop-checkList-box { |
|||
height: 50rpx; |
|||
width: 60%; |
|||
} |
|||
|
|||
.shop-popup-bottom { |
|||
width: 95%; |
|||
height: 100rpx; |
|||
position: fixed; |
|||
bottom: 0; |
|||
left: 2.5%; |
|||
display: flex; |
|||
z-index: 99; |
|||
background: #fff; |
|||
} |
|||
|
|||
.shop-popup-bottom-left { |
|||
width: 50%; |
|||
line-height: 80rpx; |
|||
} |
|||
|
|||
.shop-popup-bottom-right { |
|||
width: 50%; |
|||
line-height: 100rpx; |
|||
|
|||
.bottom-btn { |
|||
width: 70%; |
|||
line-height: 35px; |
|||
height: 70rpx; |
|||
text-align: center; |
|||
color: #fff; |
|||
font-size: 28rpx; |
|||
margin: 0 auto; |
|||
background: linear-gradient(90deg, #60F3FF, #088FEB); |
|||
border-radius: 70rpx; |
|||
} |
|||
} |
|||
.noPic{ |
|||
border-radius: 10px; |
|||
width: 150rpx; |
|||
height: 150rpx; |
|||
// margin: 30rpx 0 0 30rpx; |
|||
text-align: center; |
|||
line-height: 140rpx; |
|||
color: #777; |
|||
background: #eee; |
|||
} |
|||
.tui-order-content { |
|||
width: 100%; |
|||
padding: 24rpx 30rpx; |
|||
box-sizing: border-box; |
|||
background: #fff; |
|||
font-size: 24rpx; |
|||
line-height: 30rpx; |
|||
} |
|||
.u-collapse-content { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
line-height: 30px; |
|||
} |
|||
</style> |
|||
File diff suppressed because it is too large
Binary file not shown.
@ -1,107 +0,0 @@ |
|||
<template> |
|||
<view> |
|||
<view class="popup-height"> |
|||
<uni-forms :modelValue="addForm" ref="addForm" validateTrigger="bind" :rules="rules" label-width="160rpx" |
|||
label-align="right"> |
|||
<uni-forms-item label="员工姓名" required name="nickname"> |
|||
<uni-easyinput type="text" v-model="addForm.nickname" placeholder="请输入员工姓名" /> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="手机号" required name="mobile"> |
|||
<uni-easyinput type="text" v-model="addForm.mobile" placeholder="请输入员工手机号" /> |
|||
</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> |
|||
<u-button type="primary" @click="onFormSubmit">保存</u-button> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
addForm: { |
|||
nickname: '', |
|||
mobile: '', |
|||
type: '', |
|||
password:'123456' |
|||
}, |
|||
id: '', |
|||
typeList: [{ |
|||
value: 0, |
|||
text: "管理员" |
|||
}, |
|||
{ |
|||
value: 1, |
|||
text: "员工" |
|||
}, |
|||
], |
|||
rules: { |
|||
nickname: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '不能为空' |
|||
}] |
|||
}, |
|||
mobile: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '不能为空' |
|||
}] |
|||
}, |
|||
type: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '不能为空' |
|||
}] |
|||
}, |
|||
} |
|||
} |
|||
}, |
|||
onLoad(options) { |
|||
const type = options.type |
|||
const item = JSON.parse(options.item) |
|||
this.type = options.type |
|||
if (type === 'edit') { |
|||
this.addForm.nickname = item.nickname |
|||
this.addForm.mobile = item.mobile |
|||
this.addForm.type = Number(item.type) |
|||
this.id = item.id |
|||
} |
|||
uni.setNavigationBarTitle({ |
|||
title: type === 'add' ? '新增员工' : '编辑信息' |
|||
}); |
|||
}, |
|||
methods: { |
|||
onFormSubmit() { |
|||
this.$refs.addForm.validate().then(async () => { |
|||
let url; |
|||
if(this.type=='edit'){ |
|||
url = '/app/common/user/edit' |
|||
this.addForm.id = this.id |
|||
}else{ |
|||
url = '/app/common/user/add' |
|||
} |
|||
const res = await this.tui.request(url, 'post', this.addForm, false, |
|||
true, false) |
|||
if (res.code == 200) { |
|||
uni.navigateBack() |
|||
} else { |
|||
this.tui.toast(res.message) |
|||
} |
|||
}, (reason) => { |
|||
|
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.popup-height { |
|||
padding: 0 25upx; |
|||
background-color: #fff; |
|||
} |
|||
</style> |
|||
@ -1,144 +0,0 @@ |
|||
<template> |
|||
<view> |
|||
<view class="" v-if="peopleType=='1'"> |
|||
<view class="status">当前状态:{{value}}</view> |
|||
<view class="clock-button" :class="{isClock:isClock}" type="success" @click="onClock">打卡</view> |
|||
</view> |
|||
<view class="" v-else> |
|||
<uni-section class="mb-10" title="时间选择" type="line"> |
|||
<uni-datetime-picker v-model="range" type="daterange" /> |
|||
</uni-section> |
|||
<uni-card title="打卡情况"> |
|||
<uni-list> |
|||
<uni-list-item direction="row" v-for="(item , index) in staffList" :key="index"> |
|||
<template #body> |
|||
<view class="tag-wrap"> |
|||
<view v-if="item.departmentTitle"> |
|||
<u-tag :text="item.departmentTitle" size="12" /> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
<template #header> |
|||
<view class="avatar-wrap"> |
|||
<!-- <u-avatar :src="item.avatar" size="24"> |
|||
</u-avatar> --> |
|||
<text class="staff-name">{{ item.nickname }}</text> |
|||
</view> |
|||
</template> |
|||
<template #footer> |
|||
<view style="font-size: 24rpx;"> |
|||
<text style="margin-right: 10px;">正常:20</text> |
|||
<text style="margin-right: 10px;">迟到:<text style="color: red;">2</text></text> |
|||
<text>早退:<text style="color: red;">3</text></text> |
|||
</view> |
|||
</template> |
|||
</uni-list-item> |
|||
</uni-list> |
|||
</uni-card> |
|||
</view> |
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
mapState |
|||
} from 'vuex' |
|||
export default { |
|||
data() { |
|||
return { |
|||
value: '未打卡', |
|||
isClock: false, |
|||
peopleType: '0', |
|||
staffList:[] |
|||
} |
|||
}, |
|||
computed: mapState(['userId']), |
|||
onLoad() { |
|||
//明珠A 116.805796,38.335286 |
|||
//明珠D 116.806408,38.338111 |
|||
//明珠B 116.806913,38.336937 |
|||
//明珠C 116.80562,38.337177 |
|||
//明珠早市精品二合一给一个大的范围 116.810029,38.335321 |
|||
this.peopleType = uni.getStorageSync('type') |
|||
if(this.peopleType == 0){ |
|||
this.getStaffList() |
|||
} |
|||
|
|||
}, |
|||
methods: { |
|||
getStaffList() { |
|||
this.tui.request('/app/common/user/findAllUserByShopId', 'get', {}, false, false, true).then((res) => { |
|||
if (res.code !== 200) return |
|||
this.staffList = res.result |
|||
}) |
|||
}, |
|||
onClock() { |
|||
uni.getLocation({ |
|||
type: 'wgs84', |
|||
isHighAccuracy:true, |
|||
accuracy:'best', |
|||
success: function (res) { |
|||
console.log('当前位置的经度:' + res.longitude); |
|||
console.log('当前位置的纬度:' + res.latitude); |
|||
} |
|||
}); |
|||
// if (!this.isClock) { |
|||
// this.tui.request("/app/clockIn/", "get", { |
|||
// userId: this.userId |
|||
// }, false, true).then((res) => { |
|||
// if (res.code == 200) { |
|||
// this.tui.toast('打卡成功', 2000, true) |
|||
// this.value = '已打卡' |
|||
// this.isClock = true |
|||
// } else { |
|||
// this.tui.toast(res.message) |
|||
// } |
|||
// }) |
|||
// } |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.status { |
|||
font-size: 40upx; |
|||
color: #333333; |
|||
text-align: center; |
|||
padding: 80upx; |
|||
} |
|||
|
|||
.clock-button { |
|||
width: 200upx; |
|||
height: 200upx; |
|||
line-height: 200upx; |
|||
border-radius: 200upx; |
|||
text-align: center; |
|||
background-color: #5fd9ee; |
|||
color: #fef0f0; |
|||
font-size: 56upx; |
|||
margin: 50upx auto; |
|||
} |
|||
|
|||
.isClock { |
|||
background: grey; |
|||
} |
|||
|
|||
.tag-wrap { |
|||
width: 100rpx; |
|||
flex: 1; |
|||
display: flex; |
|||
|
|||
view { |
|||
margin: 0 2upx; |
|||
} |
|||
} |
|||
|
|||
.avatar-wrap { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
font-size: 24upx; |
|||
} |
|||
</style> |
|||
@ -1,92 +0,0 @@ |
|||
<template> |
|||
<view> |
|||
<uni-section class="mb-10" title="业绩查看范围" type="line"> |
|||
<uni-datetime-picker v-model="range" type="daterange" @change="change" /> |
|||
</uni-section> |
|||
<view class=""> |
|||
<uni-card title="业绩排名"> |
|||
<uni-list> |
|||
<uni-list-item direction="row" v-for="(item , index) in staffList" :key="index"> |
|||
<template #header> |
|||
<view class="avatar-wrap"> |
|||
<text class="staff-name">{{ item.createByName?item.createByName:'暂无' }}</text> |
|||
</view> |
|||
</template> |
|||
<template #footer> |
|||
<view style="font-size: 24rpx;display: flex;flex-direction: column;width: 250rpx;"> |
|||
<text style="display: inline-block;width: auto;">单数:{{item.totalCount?item.totalCount:'暂无'}}单</text> |
|||
<text style="display: inline-block;width: auto;">总金额:{{item.totalPrice?item.totalPrice:'暂无'}}元</text> |
|||
</view> |
|||
</template> |
|||
</uni-list-item> |
|||
</uni-list> |
|||
</uni-card> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
range: [], |
|||
name: '', |
|||
staffList:[] |
|||
} |
|||
}, |
|||
onLoad() { |
|||
this.getMonth(); |
|||
this.getStaffList() |
|||
}, |
|||
methods: { |
|||
//改变时间选择 |
|||
change(e){ |
|||
var start = e[0] |
|||
var end = e[1] |
|||
this.range = [start,end] |
|||
this.getStaffList(); |
|||
}, |
|||
//获取业绩列表 |
|||
getStaffList() { |
|||
this.tui.request('/app/sale/getSalesRankingByShopId', 'post', { |
|||
startTime:this.range[0], |
|||
endTime:this.range[1], |
|||
}, false, false, true).then((res) => { |
|||
if (res.code !== 200) return |
|||
this.staffList = res.result |
|||
}) |
|||
}, |
|||
//获取当月1日到当前时间 |
|||
getMonth() { |
|||
let date = new Date() |
|||
let year = date.getFullYear().toString() |
|||
let month = date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1).toString():(date.getMonth()+1).toString() //'月' |
|||
let da = date.getDate() < 10 ? '0'+date.getDate().toString():date.getDate().toString() //'日' |
|||
let end = year + '-' + month + '-' + da |
|||
let beg = year + '-' + month + '-01' |
|||
this.range = [beg,end] |
|||
} |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.example-body {} |
|||
.tag-wrap { |
|||
width: 100rpx; |
|||
flex: 1; |
|||
display: flex; |
|||
|
|||
view { |
|||
margin: 0 2upx; |
|||
} |
|||
} |
|||
|
|||
.avatar-wrap { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: space-between; |
|||
font-size: 24upx; |
|||
} |
|||
</style> |
|||
@ -1,141 +0,0 @@ |
|||
<template> |
|||
<view> |
|||
<view class="popup-height"> |
|||
<uni-forms :modelValue="addForm" ref="addForm" validateTrigger="bind" :rules="rules" label-width="160rpx" |
|||
label-align="right"> |
|||
<uni-forms-item label="上班时间" required> |
|||
<picker mode="time" :value="addForm.startTime" start="00:00" end="23:59" @change="start"> |
|||
<view class="uni-input">{{addForm.startTime}}</view> |
|||
</picker> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="下班时间" required> |
|||
<picker mode="time" :value="addForm.endTime" start="00:00" end="23:59" @change="end"> |
|||
<view class="uni-input">{{addForm.endTime}}</view> |
|||
</picker> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="定位" name="latitude" required> |
|||
<input type="text" v-model="addForm.latitude + ','+addForm.longitude" style="text-align:center;width:70%;border: 1px solid #eee;height: 72rpx;line-height: 72rpx !important;" disabled placeholder="获取位置用于员工打卡"> |
|||
<view class="dw-btn" @tap="clockPosi">一键定位</view> |
|||
</uni-forms-item> |
|||
<uni-forms-item label="打卡范围" name="categoryId" required> |
|||
<uni-data-select class="uni-data-select" :localdata="categoryList" v-model="formData.categoryId" |
|||
placeholder="请选择打卡范围"></uni-data-select> |
|||
</uni-forms-item> |
|||
</uni-forms> |
|||
<u-button type="primary" @click="onFormSubmit">保存</u-button> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
addForm: { |
|||
startTime: '06:00', |
|||
endTime: '14:00', |
|||
latitude:'', |
|||
longitude:'', |
|||
categoryId: '', |
|||
}, |
|||
categoryList: [{ |
|||
value: 1, |
|||
text: '100米' |
|||
},{ |
|||
value: 2, |
|||
text: '200米' |
|||
},{ |
|||
value: 3, |
|||
text: '500米' |
|||
}], |
|||
rules: { |
|||
categoryId: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '请选择打卡范围', |
|||
}], |
|||
}, |
|||
latitude: { |
|||
rules: [{ |
|||
required: true, |
|||
errorMessage: '请定位店铺位置', |
|||
}], |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
onLoad() { |
|||
|
|||
}, |
|||
methods: { |
|||
bindTimeChange(e) { |
|||
this.time = e.detail.value; |
|||
}, |
|||
clockPosi(){ |
|||
let that = this; |
|||
uni.getLocation({ |
|||
type: 'wgs84', |
|||
isHighAccuracy:true, |
|||
accuracy:'best', |
|||
success: function (res) { |
|||
that.addForm.latitude = res.latitude |
|||
that.addForm.longitude = res.longitude |
|||
} |
|||
}); |
|||
}, |
|||
onFormSubmit() { |
|||
this.$refs.addForm.validate().then(async () => { |
|||
let url; |
|||
if (this.type == 'edit') { |
|||
url = '/app/common/user/edit' |
|||
this.addForm.id = this.id |
|||
} else { |
|||
url = '/app/common/user/add' |
|||
} |
|||
const res = await this.tui.request(url, 'post', this.addForm, false, |
|||
true, false) |
|||
if (res.code == 200) { |
|||
uni.navigateBack() |
|||
} else { |
|||
this.tui.toast(res.message) |
|||
} |
|||
}, (reason) => { |
|||
}) |
|||
}, |
|||
start(e) { |
|||
this.addForm.startTime = e.detail.value |
|||
}, |
|||
end(e) { |
|||
this.addForm.endTime = e.detail.value |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
.popup-height { |
|||
padding: 0 25upx; |
|||
background-color: #fff; |
|||
} |
|||
|
|||
.uni-date__input { |
|||
height: 40px; |
|||
width: 100%; |
|||
line-height: 40px; |
|||
font-size: 14px; |
|||
} |
|||
|
|||
.text-center { |
|||
text-align: center; |
|||
} |
|||
.dw-btn{ |
|||
width: 30%; |
|||
line-height: 72rpx; |
|||
text-align: center; |
|||
background: #088FEB; |
|||
color: #fff; |
|||
} |
|||
.uni-data-select { |
|||
width: 100%; |
|||
} |
|||
</style> |
|||
Loading…
Reference in new issue