耗材列表
This commit is contained in:
207
pageConsumables/addConsumables.vue
Normal file
207
pageConsumables/addConsumables.vue
Normal file
@@ -0,0 +1,207 @@
|
||||
<template>
|
||||
<view class="topTitle">
|
||||
耗材信息
|
||||
</view>
|
||||
<view class="addConsumables">
|
||||
<ul>
|
||||
<li>
|
||||
<view>
|
||||
单位
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id="">
|
||||
</view>
|
||||
</li>
|
||||
<li>
|
||||
<view>
|
||||
耗材名称
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id="">
|
||||
</view>
|
||||
</li>
|
||||
<li>
|
||||
<view>
|
||||
耗材价格
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入耗材价格" v-model="datas.form.price" name="" id="">
|
||||
</view>
|
||||
</li>
|
||||
<li>
|
||||
<view>
|
||||
预警值
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="">
|
||||
</view>
|
||||
</li>
|
||||
<li style="justify-content: space-between;">
|
||||
<view>
|
||||
耗材类型
|
||||
</view>
|
||||
<view style="width: 54%;" @tap="datas.showStatus = !datas.showStatus">
|
||||
{{datas.typelist[datas.nowStatusIndex]}}
|
||||
</view>
|
||||
<uni-icons type="bottom" size="16"></uni-icons>
|
||||
</li>
|
||||
</ul>
|
||||
</view>
|
||||
<view :style="{height:datas.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 datas.typelist" :key="index">
|
||||
<view :class="{'color-main':datas.nowStatusIndex===index}">{{item}}</view>
|
||||
<uni-icons v-if="datas.nowStatusIndex===index" type="checkmarkempty" :color="color.ColorMain"></uni-icons>
|
||||
</view>
|
||||
<view :style="{height: '14px'}"></view>
|
||||
</view>
|
||||
<view class="bottombutton">
|
||||
<up-button type="primary" style="background-color: #318AFE;color: #fff;" @tap="sumbit" :plain="true"
|
||||
text="保存"></up-button>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
computed,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
tbConsTypeList,
|
||||
tbConsInfoAddlist
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
import color from '@/commons/color.js';
|
||||
import go from '@/commons/utils/go.js';
|
||||
let datas = reactive({
|
||||
form: {
|
||||
conWarning: 999
|
||||
},
|
||||
showStatus: false,
|
||||
list: [],
|
||||
typelist: [],
|
||||
nowStatusIndex: 0
|
||||
})
|
||||
// const props = defineProps({
|
||||
// item: {
|
||||
// type: String
|
||||
// }
|
||||
// })
|
||||
onMounted(() => {
|
||||
// console.log(props,'调试121')
|
||||
// let obj = JSON.parse(props.item)
|
||||
// console.log(obj,'调试121')
|
||||
gettbConsTypeList()
|
||||
})
|
||||
|
||||
let gettbConsTypeList = () => {
|
||||
datas.typelist = []
|
||||
tbConsTypeList({
|
||||
page: 0,
|
||||
size: 30,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
}).then(res => {
|
||||
datas.list = res.content
|
||||
res.content.forEach(ele => {
|
||||
datas.typelist.push(ele.conTypeName)
|
||||
})
|
||||
})
|
||||
}
|
||||
let sumbit = () => {
|
||||
tbConsInfoAddlist([{
|
||||
...datas.form,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
conTypeId: datas.list[datas.nowStatusIndex].id
|
||||
}]).then(res => {
|
||||
go.to('PAGES_SALES_CONSUMABLES')
|
||||
})
|
||||
}
|
||||
const statusHeight = computed(() => {
|
||||
return 30 * datas.typelist.length + 14 + 'px'
|
||||
})
|
||||
|
||||
function changeNowStatusIndex(i) {
|
||||
datas.nowStatusIndex = i
|
||||
datas.showStatus = false
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
page {
|
||||
background-color: #f9f9f9;
|
||||
}
|
||||
|
||||
ul,
|
||||
li {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.topTitle {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
margin: 32rpx 28rpx;
|
||||
}
|
||||
|
||||
.addConsumables {
|
||||
width: 694rpx;
|
||||
height: 640rpx;
|
||||
background: #FFFFFF;
|
||||
border-radius: 18rpx 18rpx 18rpx 18rpx;
|
||||
margin: 32rpx;
|
||||
padding: 1rpx 24rpx;
|
||||
box-sizing: border-box;
|
||||
|
||||
>ul {
|
||||
>li {
|
||||
width: 646rpx;
|
||||
height: 84rpx;
|
||||
background: #fcfcfc;
|
||||
border: 2rpx solid #F9F9F9;
|
||||
margin-top: 32rpx;
|
||||
.df;
|
||||
|
||||
>view:first-child {
|
||||
width: 190rpx;
|
||||
height: 84rpx;
|
||||
line-height: 84rpx;
|
||||
// text-align: left;
|
||||
padding-left: 24rpx;
|
||||
background: #F9F9F9;
|
||||
border-radius: 8rpx 0rpx 0rpx 8rpx;
|
||||
border: 2rpx solid #F9F9F9;
|
||||
font-family: Source Han Sans CN, Source Han Sans CN;
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
color: #333333;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bottombutton {
|
||||
margin-top: 84rpx;
|
||||
|
||||
>button {
|
||||
width: 530rpx;
|
||||
height: 80rpx;
|
||||
border-radius: 56rpx 56rpx 56rpx 56rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
margin: 0 32rpx;
|
||||
position: absolute;
|
||||
// top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.df() {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user