数量小数问题
This commit is contained in:
parent
2f103e7b4e
commit
f40f985770
|
|
@ -58,7 +58,7 @@
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">待领数量:</uni-col>
|
<uni-col :span="6">待领数量:</uni-col>
|
||||||
<uni-col :span="16">
|
<uni-col :span="16">
|
||||||
<view class="cont">{{ item.preNum - item.alNum }}</view>
|
<view class="cont">{{ formatDiff(item.preNum, item.alNum) }}</view>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
|
|
@ -97,6 +97,7 @@
|
||||||
import { ref, onUnmounted } from 'vue'
|
import { ref, onUnmounted } from 'vue'
|
||||||
import { getOutboundDetailsAPI,getOutboundDetailsAPITwo,leaseOutBackApi } from '@/services/picking/outbound.js'
|
import { getOutboundDetailsAPI,getOutboundDetailsAPITwo,leaseOutBackApi } from '@/services/picking/outbound.js'
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||||
|
import { formatDiff } from '@/utils/bnsBase.js'
|
||||||
const taskStatus = ref(3)//进行中
|
const taskStatus = ref(3)//进行中
|
||||||
const detailsList = ref([])
|
const detailsList = ref([])
|
||||||
const keyWord = ref('')
|
const keyWord = ref('')
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@
|
||||||
<uni-row :gutter="24">
|
<uni-row :gutter="24">
|
||||||
<uni-col :span="6">待领数量:</uni-col>
|
<uni-col :span="6">待领数量:</uni-col>
|
||||||
<uni-col :span="18">
|
<uni-col :span="18">
|
||||||
<div class="cont">{{ item.preCountNum - item.alNum }}</div>
|
<div class="cont">{{ formatDiff(item.preCountNum, item.alNum) }}</div>
|
||||||
</uni-col>
|
</uni-col>
|
||||||
</uni-row>
|
</uni-row>
|
||||||
</uni-swipe-action-item>
|
</uni-swipe-action-item>
|
||||||
|
|
@ -143,6 +143,7 @@ import { getPickingOutboundListAPI } from '@/services/picking/outbound.js'
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||||
import { debounce } from 'lodash-es'
|
import { debounce } from 'lodash-es'
|
||||||
import { onBackPress } from '@dcloudio/uni-app'
|
import { onBackPress } from '@dcloudio/uni-app'
|
||||||
|
import { formatDiff } from '@/utils/bnsBase.js'
|
||||||
const total = ref(0) // 数据总量
|
const total = ref(0) // 数据总量
|
||||||
const active = ref(1) // tap索引
|
const active = ref(1) // tap索引
|
||||||
const tableList = ref([]) // 列表数据源
|
const tableList = ref([]) // 列表数据源
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
type="number"
|
type="number"
|
||||||
:clearable="false"
|
:clearable="false"
|
||||||
placeholder="出库数量"
|
placeholder="出库数量"
|
||||||
@input="onChangeNumber"
|
@change="onChangeNumber"
|
||||||
/>
|
/>
|
||||||
</uni-forms-item>
|
</uni-forms-item>
|
||||||
<!-- <uni-forms-item label="出库数量:">
|
<!-- <uni-forms-item label="出库数量:">
|
||||||
|
|
@ -54,6 +54,7 @@
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref } from 'vue'
|
||||||
import { setOutboundNumAPI, leaseOutByInfoApi } from '@/services/picking/outbound.js'
|
import { setOutboundNumAPI, leaseOutByInfoApi } from '@/services/picking/outbound.js'
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
import { onLoad, onShow } from '@dcloudio/uni-app'
|
||||||
|
import { formatDiff } from '@/utils/bnsBase.js'
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const formData = ref({})
|
const formData = ref({})
|
||||||
const outboundNum = ref(0)
|
const outboundNum = ref(0)
|
||||||
|
|
@ -84,7 +85,7 @@ onShow(() => {
|
||||||
|
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
queryParams.value = options.queryParams ? JSON.parse(options.queryParams) : {}
|
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)
|
console.log('xxxxxxxxxxxxxx', queryParams.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ import { http } from '@/utils/http'
|
||||||
* 登录方法 - 调试使用 - 产线环境需注释
|
* 登录方法 - 调试使用 - 产线环境需注释
|
||||||
*/
|
*/
|
||||||
export const appLoginAPI = (data) => {
|
export const appLoginAPI = (data) => {
|
||||||
return false
|
// return false
|
||||||
// return http({
|
return http({
|
||||||
// method: 'POST',
|
method: 'POST',
|
||||||
// url: '/auth/login',
|
url: '/auth/login',
|
||||||
// data,
|
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