数量小数问题
This commit is contained in:
parent
2f103e7b4e
commit
f40f985770
|
|
@ -58,7 +58,7 @@
|
|||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">待领数量:</uni-col>
|
||||
<uni-col :span="16">
|
||||
<view class="cont">{{ item.preNum - item.alNum }}</view>
|
||||
<view class="cont">{{ formatDiff(item.preNum, item.alNum) }}</view>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
<uni-row :gutter="24">
|
||||
|
|
@ -97,6 +97,7 @@
|
|||
import { ref, onUnmounted } from 'vue'
|
||||
import { getOutboundDetailsAPI,getOutboundDetailsAPITwo,leaseOutBackApi } from '@/services/picking/outbound.js'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { formatDiff } from '@/utils/bnsBase.js'
|
||||
const taskStatus = ref(3)//进行中
|
||||
const detailsList = ref([])
|
||||
const keyWord = ref('')
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@
|
|||
<uni-row :gutter="24">
|
||||
<uni-col :span="6">待领数量:</uni-col>
|
||||
<uni-col :span="18">
|
||||
<div class="cont">{{ item.preCountNum - item.alNum }}</div>
|
||||
<div class="cont">{{ formatDiff(item.preCountNum, item.alNum) }}</div>
|
||||
</uni-col>
|
||||
</uni-row>
|
||||
</uni-swipe-action-item>
|
||||
|
|
@ -143,6 +143,7 @@ import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
|
|||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { debounce } from 'lodash-es'
|
||||
import { onBackPress } from '@dcloudio/uni-app'
|
||||
import { formatDiff } from '@/utils/bnsBase.js'
|
||||
const total = ref(0) // 数据总量
|
||||
const active = ref(1) // tap索引
|
||||
const tableList = ref([]) // 列表数据源
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
type="number"
|
||||
:clearable="false"
|
||||
placeholder="出库数量"
|
||||
@input="onChangeNumber"
|
||||
@change="onChangeNumber"
|
||||
/>
|
||||
</uni-forms-item>
|
||||
<!-- <uni-forms-item label="出库数量:">
|
||||
|
|
@ -54,6 +54,7 @@
|
|||
import { computed, ref } from 'vue'
|
||||
import { setOutboundNumAPI, leaseOutByInfoApi } from '@/services/picking/outbound.js'
|
||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||
import { formatDiff } from '@/utils/bnsBase.js'
|
||||
const loading = ref(false)
|
||||
const formData = ref({})
|
||||
const outboundNum = ref(0)
|
||||
|
|
@ -84,7 +85,7 @@ onShow(() => {
|
|||
|
||||
onLoad((options) => {
|
||||
queryParams.value = options.queryParams ? JSON.parse(options.queryParams) : {}
|
||||
outboundNum.value = queryParams.value.preNum - queryParams.value.alNum
|
||||
outboundNum.value = formatDiff(queryParams.value.preNum, queryParams.value.alNum)
|
||||
console.log('xxxxxxxxxxxxxx', queryParams.value)
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@ import { http } from '@/utils/http'
|
|||
* 登录方法 - 调试使用 - 产线环境需注释
|
||||
*/
|
||||
export const appLoginAPI = (data) => {
|
||||
return false
|
||||
// return http({
|
||||
// method: 'POST',
|
||||
// url: '/auth/login',
|
||||
// data,
|
||||
// })
|
||||
// return false
|
||||
return http({
|
||||
method: 'POST',
|
||||
url: '/auth/login',
|
||||
data,
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 获取用户信息
|
||||
|
|
|
|||
|
|
@ -48,3 +48,14 @@ export const uploadImgSignUrl = (file) => {
|
|||
})
|
||||
})
|
||||
}
|
||||
|
||||
export const formatDiff = (...nums) => {
|
||||
let result = nums.reduce((acc, cur) => acc - cur)
|
||||
|
||||
if (Number.isInteger(result)) {
|
||||
return result // 整数直接返回
|
||||
} else {
|
||||
// 保留 3 位小数,但去掉多余的 0
|
||||
return parseFloat(result.toFixed(3))
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue