CredentialPopup
This commit is contained in:
@@ -63,13 +63,16 @@
|
||||
</view>
|
||||
<view class="zd-row submit-bar">
|
||||
<button class="zd-col-5 button-default" @tap="toEmpty">清空</button>
|
||||
<button class="zd-col-18 button-primary" :class="{'button-info': !val1 || !dataList.length}" :disabled="disabled" @tap="_leftoverMaterialBack" v-if="!flag">回库</button>
|
||||
<button class="zd-col-18 button-primary" :class="{'button-info': !val1 || !dataList.length}" :disabled="disabled" @tap="handleSubmit" v-if="!flag">回库</button>
|
||||
<button class="zd-col-18 button-primary" :class="{'button-info': !val1}" :disabled="disabled" @tap="_leftoverMaterialBack" v-if="flag">空盘退回</button>
|
||||
</view>
|
||||
<!-- 放置弹窗组件 -->
|
||||
<CredentialPopup ref="credentialPopup" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { RSAencrypt } from '@/utils/jsencrypt.js'
|
||||
import NavBar from '@/components/NavBar.vue'
|
||||
import SearchBox from '@/components/SearchBox.vue'
|
||||
import {getGroupInfo, leftoverMaterialBack} from '@/utils/getData3.js'
|
||||
@@ -92,6 +95,21 @@
|
||||
this.title = options.title
|
||||
},
|
||||
methods: {
|
||||
async handleSubmit() {
|
||||
if (!this.val1 || !this.dataList.length) {
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
// 显示弹窗,等待用户输入
|
||||
const { username, password } = await this.$refs.credentialPopup.show();
|
||||
// 调用原接口,传入账号密码
|
||||
this._leftoverMaterialBack(username, password);
|
||||
} catch (error) {
|
||||
// 用户取消,不做处理
|
||||
console.log('用户取消输入');
|
||||
}
|
||||
},
|
||||
toEmpty () {
|
||||
this.val1 = ''
|
||||
this.num = null
|
||||
@@ -123,14 +141,10 @@
|
||||
this.dataList = []
|
||||
}
|
||||
},
|
||||
async _leftoverMaterialBack () {
|
||||
async _leftoverMaterialBack (username, password) {
|
||||
this.disabled = true
|
||||
if (!this.val1 || !this.dataList.length) {
|
||||
this.disabled = false
|
||||
return
|
||||
}
|
||||
try {
|
||||
let res = await leftoverMaterialBack(this.val1, this.dataList)
|
||||
let res = await leftoverMaterialBack(username, RSAencrypt(password), this.val1, this.dataList)
|
||||
if (res) {
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
|
||||
Reference in New Issue
Block a user