You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
3.4 KiB
Vue

<template>
<view class="box-container">
<u-navbar leftIconSize="25px" height="70px" @leftClick="leftClick" :autoBack="true">
</u-navbar>
<view class="entry-info">
<view style="display: flex;justify-content: space-between;margin-bottom: 20px;">
<view>入库单号</view>
<view>{{form.inNo}}</view>
</view>
<view class="formContainer"><u-form labelPosition="top" labelWidth="120" :model="ruleForm" :rules="rules"
ref="ruleFormRef">
<u-form-item label="选择卸货订单" prop="orderNos" :required="true">
<view style="margin-top: 20px;">
<view style="margin-bottom: 20px;">
<u-radio-group v-model="checked">
<u-radio shape="square" label="全选" :name="true" @change="groupChange"></u-radio>
<u-radio :customStyle="{marginLeft: '20px'}" shape="square" label="取消全选"
:name="false" @change="groupChange"></u-radio>
</u-radio-group>
</view>
<view>
<u-checkbox-group v-model="ruleForm.orderNos" placement="column"
@change="handleCheckedCitiesChange">
<u-checkbox :customStyle="{marginBottom: '16px'}"
v-for="(orderNo,index) in orderNosList" :key="index" :label="'订单号 '+orderNo"
:name="orderNo"></u-checkbox>
</u-checkbox-group>
</view>
</view>
</u-form-item>
</u-form>
<view class="icon"><u-icon name="arrow-down" size="20"></u-icon></view>
</view>
<button type="primary" class="btn" @click="submitData"></button>
</view>
<u-toast ref="uToast"></u-toast>
</view>
</template>
<script>
import store from '@/store/index'
import Api from '@/api/api.js'
export default {
data() {
return {
ruleForm: {
warehouseId: store.state.userInfo.branchId,
orderNo: "",
orderNos: [],
workType: "1",
location: "",
number: "",
userId: "",
},
form: {
inNo: ""
},
rules: {
orderNos: {
type: 'array',
required: true,
message: '请选择订单号',
trigger: ['blur']
},
},
orderNosList: [],
checked: false,
}
},
onLoad(op) {
if (op.data) {
const resData = JSON.parse(op.data)
this.form.inNo = resData.inNo
this.orderNosList = resData.orderNos
this.ruleForm.orderNo = resData.orderNo
}
},
methods: {
leftClick() {},
groupChange(val) {
if (val) {
this.ruleForm.orderNos = this.orderNosList
} else {
this.ruleForm.orderNos = []
}
},
handleCheckedCitiesChange(val) {
const checkedCount = val.length;
if (checkedCount === this.orderNosList.length) {
this.checked = true
} else {
this.checked = false
}
},
submitData() {
this.$refs.ruleFormRef.validate().then(res => {
Api.storge.unload(this.ruleForm).then(valid => {
this.ruleForm.orderNos = []
this.form.inNo = ""
this.orderNosList = []
uni.navigateTo({
url: "/pages/outStock/recordingVolume?name=discharge"
})
})
})
}
}
}
</script>
<style lang="scss" scoped>
.box-container {
.entry-info {
width: 85%;
margin: auto;
margin-top: 230rpx;
.formContainer {
position: relative;
.icon {
position: absolute;
right: 0;
top: 25rpx;
}
}
.btn {
border-radius: 12px;
font-size: 28rpx;
margin-top: 80rpx;
background-color: #1A4F94;
}
}
}
</style>