SmartStorage/pages/newInStore/newInStore.vue

412 lines
8.9 KiB
Vue

<template>
<view>
<view
class="single-fetch"
v-for="(fetch, index) in fetchMaterialList"
:key="index"
>
<view class="fetch-upper">
<checkbox-group
v-show="fetch.status == '2'"
style="margin-right: 15rpx;"
@change="checkClick(fetch)"
>
<checkbox :checked="fetch.checked" />
</checkbox-group>
<view class="upper-lef">
<image :src="fetch.avatar" mode=""></image>
</view>
<view class="upper-rig">
<h4 style="font-size: 16px;">{{ fetch.name }}</h4>
</view>
</view>
<view class="fetch-lower">
<view>
<span>采购单号</span>
<h4>{{ fetch.orderNum }}</h4>
</view>
<view>
<span>工机具类型</span>
<h4>{{ fetch.deviceType }}</h4>
</view>
<view>
<span>采购日期</span>
<h4>{{ fetch.purchaseDate }}</h4>
</view>
<view>
<span>到货日期</span>
<h4>{{ fetch.arriveDate }}</h4>
</view>
<view>
<span>发布人员</span>
<h4>{{ fetch.publishPerson }}</h4>
</view>
<view>
<span>发布时间</span>
<h4>{{ fetch.publishDate }}</h4>
</view>
</view>
<view class="fetch-btns">
<view style="background-color: #3788FF;" @click="seeDetail">
<uni-icons style="color: #fff;" type="eye" size="36"></uni-icons>
查看
</view>
<view
style="background-color: #FCA30D;"
v-show="fetch.status == '2'"
@click="seeExam(fetch.name)"
>
<uni-icons style="color: #fff;" type="auth" size="36"></uni-icons>
审核
</view>
<view style="background-color: #1bd30b;">
<uni-icons style="color: #fff;" type="cart" size="36"></uni-icons>
入库
</view>
</view>
<view class="sticky-area">
<image src="/static/passed.png" v-show="fetch.status == '0'" mode=""></image>
<image src="/static/noPass.png" v-show="fetch.status == '1'" mode=""></image>
<image src="/static/noExam.png" v-show="fetch.status == '2'" mode=""></image>
</view>
</view>
<view class="btm-sticky">
<view class="checked">
<checkbox-group @tap="checkAll" style="margin-right: 15rpx;">
<checkbox :checked="allChecked" />
</checkbox-group>
<text>全选</text>
</view>
<view
class="exam"
@click="toggleExam"
>
审核
</view>
</view>
<uni-popup
ref="popup"
type="center"
:mask-click="false"
>
<view class="popup">
<view class="pop-top">
<h4>审批</h4>
<uni-icons
style="color: #AAAAAA; font-weight: bold;"
type="closeempty"
size="32"
@click="closePopup"
>
</uni-icons>
</view>
<view class="select-area">
<uni-forms ref="examForm" :modelValue="examFormData" :rules="rules" label-position="top">
<uni-forms-item name="ifPass" required label="是否通过" label-width="150">
<uni-data-select
v-model="examFormData.ifPass"
:localdata="ifPassRange"
:clear="false"
></uni-data-select>
</uni-forms-item>
<uni-forms-item name="noPassReason" label="不通过原因" label-width="150">
<uni-easyinput type="textarea" v-model="examFormData.noPassReason" placeholder="请输入内容"></uni-easyinput>
</uni-forms-item>
<button class="submit-btn" @click="formSubmit">确认</button>
</uni-forms>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
export default {
data() {
return {
allChecked: false,
examFormData: {
ifPass: '',
noPassReason: ''
},
ifPassRange: [
{ text: '是', value: '0' },
{ text: '否', value: '1' }
],
rules: {
ifPass: {
rules: [
{
required: true,
errorMessage: '请选择是否通过!'
}
]
}
},
fetchMaterialList: [
{
name: '王明涛(采购)',
orderNum: 'NSJJ00214457',
deviceType: '机动角磨机、卸扣',
purchaseDate: '2023-12-12',
arriveDate: '2023-12-16',
publishPerson: '李淑静',
publishDate: '2023-12-12',
status: '1',
avatar: '/static/bg1.jpg',
},
{
name: '王明涛(采购)',
orderNum: 'DAWW1147993',
deviceType: '机动角磨机',
purchaseDate: '2023-12-19',
arriveDate: '2023-12-20',
publishPerson: '王铭鹏',
publishDate: '2023-12-16',
status: '2',
avatar: '/static/bg4.jpg',
checked: false
},
{
name: '王明涛(采购)',
orderNum: 'YUMI88520317',
deviceType: '卸扣',
purchaseDate: '2023-12-19',
arriveDate: '2023-12-20',
publishPerson: '李贤传',
publishDate: '2023-12-16',
status: '3',
avatar: '/static/bg4.jpg',
},
{
name: '王明涛(采购)',
orderNum: 'IIOP22038512',
deviceType: '南煎丸子',
purchaseDate: '2023-12-19',
arriveDate: '2023-12-20',
publishPerson: '随道珀',
publishDate: '2023-12-16',
status: '2',
avatar: '/static/bg3.jpg',
checked: false
}
],
examList: []
}
},
methods: {
seeDetail () {
uni.navigateTo({
url: '/pages/newBuyDetail/newBuyDetail'
})
},
checkAll() {
this.allChecked = !this.allChecked
if (this.allChecked) {
this.fetchMaterialList.map(item => {
if (item.checked == false) {
item.checked = true
}
})
} else {
this.fetchMaterialList.map(item => {
if (item.checked == true) {
item.checked = false
}
})
}
},
checkClick(item) {
item.checked = !item.checked
if (!item.checked) {
this.allChecked = false
} else {
const goods = this.fetchMaterialList.every(item => {
return item.checked === true
})
if (goods) {
this.allChecked = true
} else {
this.allChecked = false
}
}
},
toggleExam () {
let that = this
that.examList = that.fetchMaterialList.filter((item) => {
return item.checked == true
}).map((subItem) => {
return {
name: subItem['name']
}
})
console.log(that.examList);
},
closePopup () {
this.$refs.popup.close()
},
seeExam (name) {
console.log(name);
this.$refs.popup.open()
},
formSubmit () {
let that = this
that.$refs.examForm.validate().then(formData => {
console.log(formData);
that.$refs.popup.close()
})
}
}
}
</script>
<style lang="scss">
body{
background-color: #f8f8f8;
box-sizing: border-box;
padding-bottom: 10vh;
}
.single-fetch{
width: 95%;
margin: 20rpx auto;
background-color: #fff;
border-radius: 15rpx;
box-sizing: border-box;
padding: 15rpx;
position: relative;
.fetch-upper{
width: 100%;
box-sizing: border-box;
padding: 15rpx;
border-bottom: 1px solid #D7D7D7;
display: flex;
align-items: center;
.upper-lef{
width: 15%;
height: 6.5vh;
border-radius: 15rpx;
overflow: hidden;
image{
width: 100%;
height: 100%;
}
}
.upper-rig{
flex: 1;
box-sizing: border-box;
padding: 10rpx 20rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
h4{
font-weight: normal;
font-size: 14px;
}
}
}
.fetch-lower{
width: 100%;
box-sizing: border-box;
padding: 15rpx;
border-bottom: 1px solid #D7D7D7;
view{
width: 100%;
display: flex;
align-items: center;
margin-bottom: 15rpx;
font-size: 14px;
span{
color: #9D9D9D;
padding-right: 20rpx;
}
h4{
color: #000;
font-size: 14px;
font-weight: normal;
}
}
view:last-child{
margin-bottom: 0;
}
}
.fetch-btns{
width: 100%;
box-sizing: border-box;
padding: 15rpx;
display: flex;
justify-content: flex-end;
view{
box-sizing: border-box;
padding: 8rpx 25rpx;
border-radius: 15rpx;
color: #fff;
margin-right: 15rpx;
font-size: 14px;
}
view:last-child{
margin-right: 0;
}
}
.sticky-area{
position: absolute;
top: 0;
right: 0;
width: 11vh;
height: 10vh;
image{
width: 100%;
height: 100%;
}
}
}
.btm-sticky{
position: fixed;
bottom: 0;
left: 0;
width: 100%;
box-sizing: border-box;
padding: 15rpx 30rpx;
background-color: #fff;
display: flex;
justify-content: space-between;
align-items: center;
.checked{
display: flex;
align-items: center;
}
.exam{
box-sizing: border-box;
padding: 10rpx 50rpx;
border-radius: 30rpx;
background-color: #3788FF;
font-size: 14px;
color: #fff;
}
}
.popup{
width: 80vw;
height: 60vh;
background-color: #fff;
border-radius: 15rpx;
overflow: hidden;
background: linear-gradient(#D9E7FE, #fff, #fff, #fff);
.pop-top{
width: 100%;
height: 5vh;
box-sizing: border-box;
padding: 0 25rpx;
display: flex;
justify-content: space-between;
align-items: center;
}
.select-area{
width: 85%;
margin: 40rpx auto;
.submit-btn{
background-color: #409EFF;
color: #fff;
}
}
}
</style>