充电任务

This commit is contained in:
2024-08-14 14:04:33 +08:00
parent 3473030744
commit 91a786804f
5 changed files with 48 additions and 5 deletions

View File

@@ -20,14 +20,15 @@
</view>
</view>
<view class="zd-row submit-bar">
<button class="zd-col-22 button-primary" :disabled="disabled" @tap="toSure('1')">{{$t('button.handtask')}}</button>
<button class="zd-col-11 button-primary" :disabled="disabled" @tap="toSure('1')">{{$t('button.handtask')}}</button>
<button class="zd-col-11 button-primary" :disabled="disabled" @tap="toCharge">{{$t('charging-task')}}</button>
</view>
</view>
</template>
<script>
import NavBar from '@/components/NavBar.vue'
import {queryArea, queryPointByArea, callTask} from '@/utils/getData2.js'
import {queryArea, queryPointByArea, callTask, taskCharge} from '@/utils/getData2.js'
export default {
components: {
NavBar
@@ -71,6 +72,34 @@
} catch (err) {
this.disabled = false
}
},
toCharge () {
this.disabled = true
uni.showModal({
title: this.$t('warning'),
cancelText: this.$t('button.cancel'),
confirmText: this.$t('button.confirm'),
content: this.$t('toast.charging-task'),
success: (res) => {
if (res.confirm) {
this._taskCharge()
} else if (res.cancel) {
this.disabled = false
}
}
})
},
async _taskCharge () {
try {
let res = await taskCharge()
this.disabled = false
uni.showToast({
title: res.message,
icon: 'none'
})
} catch (err) {
this.disabled = false
}
}
}
}