代码更新
This commit is contained in:
@@ -5,56 +5,23 @@
|
||||
<view class="addConsumables">
|
||||
<view>
|
||||
<view>
|
||||
<view>
|
||||
单位
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id="">
|
||||
</view>
|
||||
<view> 单位 </view>
|
||||
<view> <input type="text" placeholder="请输入单位" v-model="datas.form.conUnit" name="" id=""> </view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
耗材名称
|
||||
</view>
|
||||
<view>
|
||||
<input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id="">
|
||||
</view>
|
||||
<view> 耗材名称 </view>
|
||||
<view> <input type="text" placeholder="请输入耗材名称" v-model="datas.form.conName" name="" id=""> </view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
耗材价格
|
||||
</view>
|
||||
<view>
|
||||
<input class="uni-input" placeholder="请输入耗材价格" type="number" v-model="datas.form.price">
|
||||
</view>
|
||||
<view> 耗材价格 </view>
|
||||
<view> <input class="uni-input" placeholder="请输入耗材价格" type="number" v-model="datas.form.price"> </view>
|
||||
</view>
|
||||
<view>
|
||||
<view>
|
||||
预警值
|
||||
</view>
|
||||
<view>
|
||||
<input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id="">
|
||||
</view>
|
||||
<view> 预警值 </view>
|
||||
<view> <input type="number" placeholder="请输入预警值" v-model="datas.form.conWarning" name="" id=""> </view>
|
||||
</view>
|
||||
<!-- <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> -->
|
||||
</view>
|
||||
</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>
|
||||
@@ -62,72 +29,34 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {
|
||||
reactive,
|
||||
computed,
|
||||
onMounted
|
||||
} from 'vue';
|
||||
import {
|
||||
tbConsTypeList,
|
||||
tbConsTypeput
|
||||
} from '@/http/yskApi/requestAll.js';
|
||||
import { reactive, computed, onMounted } from 'vue';
|
||||
import { editCons } from '@/api/cons.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
|
||||
}
|
||||
})
|
||||
let datas = reactive({
|
||||
form: {
|
||||
conWarning: 999
|
||||
},
|
||||
})
|
||||
onMounted(() => {
|
||||
let obj = JSON.parse(props.item)
|
||||
datas.form = obj
|
||||
|
||||
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 = () => {
|
||||
tbConsTypeput([{
|
||||
...datas.form,
|
||||
status: datas.form.status * 1,
|
||||
isCheck: datas.form.isCheck * 1,
|
||||
conWarning: datas.form.conWarning * 1,
|
||||
shopId: uni.getStorageSync("shopId"),
|
||||
conTypeId: datas.list[datas.nowStatusIndex].id,
|
||||
id: datas.form.id
|
||||
}]).then(res => {
|
||||
editCons(datas.form).then(res => {
|
||||
go.back()
|
||||
})
|
||||
}
|
||||
const statusHeight = computed(() => {
|
||||
return 30 * datas.typelist.length + 14 + 'px'
|
||||
})
|
||||
|
||||
function changeNowStatusIndex(i) {
|
||||
datas.nowStatusIndex = i
|
||||
datas.showStatus = false
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>
|
||||
page {
|
||||
@@ -135,12 +64,7 @@
|
||||
}
|
||||
</style>
|
||||
<style scoped lang="less">
|
||||
ul,
|
||||
li {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
|
||||
.topTitle {
|
||||
font-weight: 400;
|
||||
font-size: 32rpx;
|
||||
@@ -195,16 +119,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
.status {
|
||||
margin: 0 32rpx;
|
||||
position: absolute;
|
||||
// top: 100%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 10;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.df() {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user