123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276 |
- <template>
- <view class="content">
- <view class="row row-bottom">
- <view class="left">日期</view>
- <picker mode="date" @change="bindDateChange">
- <view>{{param.date}}</view>
- </picker>
- </view>
- <view class="row row-bottom">
- <view class="left">类型</view>
- <radio-group @change="selectType">
- <label v-for="item in inOutType" :key="item">
- <radio :value="item" :checked="item==param.type" />{{item}}
- </label>
- </radio-group>
- </view>
- <view v-if="param.type=='出库'" class="row row-bottom">
- <view class="left">班组</view>
- <picker @change="outtypeChange" :value="industryIndex" :range="list" range-key="name">
- {{industryIndex>0 ? list[industryIndex].name : industryIndex==0 ? list[0].name :'请选择班组'}}
- </picker>
- </view>
- <view v-if="param.type=='出库'" class="row row-bottom">
- <view class="left">班次</view>
- <radio-group @change="chang">
- <label v-for="item in radioGroup" :key="item">
- <radio :value="item" :checked="item==param.banci" />{{item}}
- </label>
- </radio-group>
- </view>
- <view v-if="param.type=='出库'" class="row row-bottom">
- <view class="left">巴西(吨)</view>
- <input v-model='param.filed1' class="right-bottom" type="number" placeholder="请输入"></input>
- </view>
- <view v-if="param.type=='出库'" class="row row-bottom">
- <view class="left">中美洲(吨)</view>
- <input v-model='param.filed2' class="right-bottom" type="number" placeholder="请输入"></input>
- </view>
- <view v-if="param.type=='出库'" class="row row-bottom">
- <view class="left">回溶(吨)</view>
- <input v-model='param.filed3' class="right-bottom" type="number" placeholder="请输入"></input>
- </view>
- <view v-if="param.type=='出库'" class="row row-bottom">
- <view class="left">加工糖100%(吨)</view>
- <input v-model='param.filed4' class="right-bottom" type="number" placeholder="请输入"></input>
- </view>
- <view v-if="param.type=='出库'" class="row row-bottom">
- <view class="left">非食用糖92%(吨)</view>
- <input v-model='param.filed5' class="right-bottom" type="number" placeholder="请输入"></input>
- </view>
- <view v-if="param.type=='出库'" class="row row-bottom">
- <view class="left">国储(吨)</view>
- <input v-model='param.filed6' class="right-bottom" type="number" placeholder="请输入"></input>
- </view>
- <view v-if="param.type=='出库'" class="row row-bottom">
- <view class="left">合计(吨)</view>
- <input :disabled="true" v-model='total' class="right-bottom" placeholder="请输入"></input>
- </view>
- <view v-if="param.type=='入库'" class="row row-bottom">
- <view class="left">入库量(吨)</view>
- <input v-model='param.inNum' class="right-bottom" placeholder="请输入"></input>
- </view>
- <view class="row row-bottom">
- <view class="left">密码(必填)</view>
- <input v-model='param.password' class="right-bottom" type="password" placeholder="请输入"></input>
- </view>
- <view class="bottom-btn">
- <button type="primary" class="submit" hover-class="none" @click="submit()">提交</button>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- param: {
- filed1: '0',
- filed2: '0',
- filed3: '0',
- filed4: '0',
- filed5: '0',
- filed6: '0',
- total: '0',
- banci: '白班',
- banzu: '甲班',
- type: '出库',
- inNum: '0',
- password:'',
- date: this.getDate()
- },
- radioGroup: ['白班', '夜班'],
- inOutType: ['出库', '入库'],
- list: [{
- name: '甲班'
- },
- {
- name: '乙班'
- },
- {
- name: '丙班'
- }
- ],
- industryIndex: 0,
- }
- },
- computed: {
- total() {
- return parseFloat(this.param.filed1) +
- parseFloat(this.param.filed2) +
- parseFloat(this.param.filed3) +
- parseFloat(this.param.filed4) +
- parseFloat(this.param.filed5) +
- parseFloat(this.param.filed6);
- }
- },
- onLoad() {
- },
- methods: {
- submit() {
- console.log(this.param,12)
- if (!this.param.password) {
- uni.showToast({
- title: '密码不能为空',
- icon: 'none'
- })
- return false;
- }
- this.param.total = this.total;
- let that = this
- uni.showModal({
- title: '提示',
- content: '确定提交?',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({
- title: '正在提交',
- mask: true
- });
- uni.request({
- url: 'http://10.23.250.94:18087/v1/testTable',
- method: 'POST',
- data: that.param,
- success: (res) => {
- if(res.data.code!=200){
- uni.showToast({
- title: res.data.msg,
- mask: true,
- icon: 'error',
- duration: 2000
- })
- }
- else{
- uni.showToast({
- title: '提交成功',
- mask: true,
- icon: 'success',
- duration: 2000
- })
- }
- }
- })
- uni.hideLoading()
- .catch(res => {
- uni.hideLoading()
- })
- } else {
- // 执行取消后的操作
- }
- },
- })
- },
- chang(e) {
- this.banci = e.detail.value; //选中按钮的value值
- this.param.banci = e.detail.value;
- },
- selectType(e) {
- this.type = e.detail.value; //选中按钮的value值
- this.param.type = e.detail.value;
- },
- outtypeChange(e) {
- this.industryIndex = e.detail.value
- this.banzu = this.list[e.detail.value].name
- this.param.banzu =this.list[e.detail.value].name
- },
- getDate() {
- const date = new Date();
- let year = date.getFullYear();
- let month = date.getMonth() + 1;
- let day = date.getDate();
- month = month > 9 ? month : '0' + month;
- day = day > 9 ? day : '0' + day;
- return `${year}-${month}-${day}`;
- },
- bindDateChange: function(e) {
- this.date = e.detail.value;
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .content,
- .content1,
- .content2 {
- border-radius: 20rpx;
- background: white;
- padding: 20rpx;
- .title {
- font-size: 28rpx;
- font-weight: 600;
- color: #333333;
- }
- .row {
- display: flex;
- justify-content: space-between;
- border-bottom: 1px solid #EEEEEE;
- padding: 21rpx 0;
- .right,
- input {
- font-size: 28rpx;
- color: #333333;
- }
- }
- .row-bottom {
- // border: 0;
- .right-bottom {
- width: 280rpx;
- text-align: right;
- }
- }
- }
- .right-bottom {
- width: 280rpx;
- text-align: right;
- }
- .logo {
- height: 200rpx;
- width: 200rpx;
- margin-top: 200rpx;
- margin-left: auto;
- margin-right: auto;
- margin-bottom: 50rpx;
- }
- .text-area {
- display: flex;
- justify-content: center;
- }
- .title {
- font-size: 36rpx;
- color: #8f8f94;
- }
- .bottom-btn {
- padding: 30rpx;
- background: #FFFFFF;
- width: 92%;
- position: fixed;
- bottom: 0rpx;
- display: flex;
- }
- </style>
|