耗材列表
This commit is contained in:
@@ -3,18 +3,10 @@
|
||||
<ul>
|
||||
<li>
|
||||
<view>
|
||||
耗材名称
|
||||
账存数量
|
||||
</view>
|
||||
<view>
|
||||
耗材
|
||||
</view>
|
||||
</li>
|
||||
<li>
|
||||
<view>
|
||||
账户库存
|
||||
</view>
|
||||
<view>
|
||||
耗材
|
||||
{{datas.item.balance}}
|
||||
</view>
|
||||
</li>
|
||||
<li>
|
||||
@@ -22,7 +14,23 @@
|
||||
实际数量
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="输入数量" name="" id="">
|
||||
<input type="text" v-model="datas.form.balance" placeholder="输入数量" name="" id="">
|
||||
</view>
|
||||
</li>
|
||||
<li>
|
||||
<view>
|
||||
单价
|
||||
</view>
|
||||
<view>
|
||||
{{datas.item.price}}
|
||||
</view>
|
||||
</li>
|
||||
<li>
|
||||
<view>
|
||||
盈亏数量
|
||||
</view>
|
||||
<view>
|
||||
{{profitNumber}}
|
||||
</view>
|
||||
</li>
|
||||
<li>
|
||||
@@ -30,24 +38,16 @@
|
||||
总盈亏
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="输入总价值(元)" name="" id="">
|
||||
{{profitPrice}}
|
||||
</view>
|
||||
</li>
|
||||
</ul>
|
||||
<view :style="{height:showStatus?statusHeight:0}" class="tranistion status overflow-hide">
|
||||
<view @tap="changeNowStatusIndex(index)" class="u-flex u-p-l-30 lh30 u-p-r-30 u-row-between"
|
||||
v-for="(item,index) in status" :key="index">
|
||||
<view :class="{'color-main':nowStatusIndex===index}">{{item}}</view>
|
||||
<uni-icons v-if="nowStatusIndex===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
|
||||
</view>
|
||||
<view :style="{height: '14px'}"></view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottombutton">
|
||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="toggle" :plain="true"
|
||||
text="保存"></up-button>
|
||||
<up-button type="text" style="background-color: #f9f9f9;color: #999;" @tap="toggle" :plain="true"
|
||||
text="取消"></up-button>
|
||||
<!-- <up-button type="text" style="background-color: #f9f9f9;color: #999;" @tap="toggle" :plain="true"
|
||||
text="取消"></up-button> -->
|
||||
</view>
|
||||
</template>
|
||||
|
||||
@@ -55,24 +55,79 @@
|
||||
<script setup>
|
||||
import {
|
||||
ref,
|
||||
computed
|
||||
computed,
|
||||
onMounted,
|
||||
reactive
|
||||
} from 'vue';
|
||||
import go from '@/commons/utils/go.js';
|
||||
import color from '@/commons/color.js';
|
||||
import {
|
||||
tbConsInfotbConCheck
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
let showStatus = ref(false)
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object
|
||||
}
|
||||
})
|
||||
let datas = reactive({
|
||||
item: "",
|
||||
form: {}
|
||||
})
|
||||
onMounted(() => {
|
||||
datas.item = JSON.parse(props.item)
|
||||
datas.form = {
|
||||
...datas.item
|
||||
}
|
||||
})
|
||||
let profitPrice = computed(() => {
|
||||
// 如果剩余数量为负数
|
||||
// if (datas.item.balance < 0) {
|
||||
// let a = datas.item.balance * -1
|
||||
// return formatDecimal((a - datas.form.balance) * datas.item.price)
|
||||
// } else {
|
||||
return formatDecimal((datas.item.balance - datas.form.balance) * datas.item.price)
|
||||
// }
|
||||
})
|
||||
let profitNumber = computed(() => {
|
||||
// 盈亏数量
|
||||
return datas.item.balance - datas.form.balance
|
||||
})
|
||||
|
||||
function toggle() {
|
||||
tbConsInfotbConCheck({
|
||||
stockNumber: datas.item.balance,
|
||||
conInfoId: datas.form.consId,
|
||||
lpNum: profitNumber._value
|
||||
}).then(res => {
|
||||
go.to('PAGES_SALES_CONSUMABLES')
|
||||
})
|
||||
}
|
||||
/**
|
||||
* 保留小数n位,不进行四舍五入
|
||||
* num你传递过来的数字,
|
||||
* decimal你保留的几位,默认保留小数后两位
|
||||
* isInt 是否保留0
|
||||
*/
|
||||
function formatDecimal(num = 0, decimal = 2, isInt = false) {
|
||||
num = num.toFixed(3).toString();
|
||||
const index = num.indexOf(".");
|
||||
if (index !== -1) {
|
||||
num = num.substring(0, decimal + index + 1);
|
||||
} else {
|
||||
num = num.substring(0);
|
||||
}
|
||||
//截取后保留两位小数
|
||||
if (isInt) {
|
||||
return parseFloat(num);
|
||||
} else {
|
||||
return parseFloat(num).toFixed(decimal);
|
||||
}
|
||||
}
|
||||
|
||||
function showStatusToggle() {
|
||||
showStatus.value = !showStatus.value
|
||||
}
|
||||
let nowStatusIndex = ref(0)
|
||||
|
||||
function changeNowStatusIndex(i) {
|
||||
nowStatusIndex.value = i
|
||||
showStatus.value = false
|
||||
}
|
||||
const status = ['开多钱', '好像上次', '海峡市场']
|
||||
const statusHeight = computed(() => {
|
||||
return 30 * status.length + 14 + 'px'
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@@ -94,7 +149,7 @@
|
||||
.status {
|
||||
margin: 0 32rpx;
|
||||
position: absolute;
|
||||
|
||||
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
@@ -103,7 +158,7 @@
|
||||
|
||||
.warehouseEntry {
|
||||
width: 694rpx;
|
||||
height: 496rpx;
|
||||
height: 650rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
margin: 32rpx;
|
||||
|
||||
Reference in New Issue
Block a user