Files
hht-longdianningxin-uni/pages/manage/waste-foil-move.vue
2024-09-13 15:55:28 +08:00

125 lines
2.8 KiB
Vue

<template>
<view class="zd_container">
<nav-bar :title="title"></nav-bar>
<view class="zd_content">
<view class="zd_wrapper">
<view class="zd-row">
<view class="zd-col-5">
<span class="filter_label">点位</span>
</view>
<view class="zd-col-19">
<search-box
v-model="val1"
/>
</view>
</view>
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-5 button-default" @tap="clearUp">清空</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1}" :disabled="disabled" @tap="toSure1">开始</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1}" :disabled="disabled" @tap="toSure2('1')">确认</button>
<button class="zd-col-6 button-primary" :class="{'button-info': !val1}" :disabled="disabled" @tap="toSure2('2')">结束</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import SearchBox from '@/components/SearchBox.vue'
import LinkScan from '@/components/LinkScan.vue'
import {startMoveWasteFoilv2, resumeMoveWasteFoilv2} from '@/utils/getData2.js'
export default {
components: {
NavBar,
SearchBox,
LinkScan
},
data() {
return {
title: '',
val1: '',
disabled: false
};
},
onLoad (options) {
this.title = options.title
},
methods: {
async toSure1 () {
this.disabled = true
if (!this.val1) {
this.disabled = false
return
}
uni.showModal({
title: '提示',
content: '请开始废箔搬运',
confirmColor: '#ff6a00',
success: (res) => {
if (res.confirm) {
this._startMoveWasteFoilv2()
} else if (res.cancel) {
this.disabled = false
}
}
})
},
async _startMoveWasteFoilv2 () {
try {
let res = await startMoveWasteFoilv2(this.val1)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
toSure2 (type) {
this.disabled = true
if (!this.val1) {
this.disabled = false
return
}
if (type === '1') {
uni.showModal({
title: '提示',
content: '请确认废箔搬运',
confirmColor: '#ff6a00',
success: (res) => {
if (res.confirm) {
this._resumeMoveWasteFoilv2(type)
} else if (res.cancel) {
this.disabled = false
}
}
})
} else {
this._resumeMoveWasteFoilv2(type)
}
},
async _resumeMoveWasteFoilv2 (type) {
try {
let res = await resumeMoveWasteFoilv2(type, this.val1)
this.clearUp()
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (e) {
this.disabled = false
}
},
clearUp () {
this.val1 = ''
this.disabled = false
}
}
}
</script>
<style lang="stylus">
</style>