Commit 25bac99d authored by Facius's avatar Facius

备件库数量修改

parent 4e216908
<template> <template>
<view class="spare-item"> <view class="spare-item">
<view class="left-view"> <view class="left-view">
<u-checkbox v-if="showChecked" icon-size="28" size="40" v-model="check" @change="handleChange" shape="circle"/> <u-checkbox v-if="showChecked" icon-size="28" size="40" v-model="check" @change="handleChange"
shape="circle" />
<image class="image-view" :src="imageUrl"></image> <image class="image-view" :src="imageUrl"></image>
<view class="info-view"> <view class="info-view">
<view class="name-text">{{item.name}}</view> <view class="name-text">{{item.name}}</view>
...@@ -10,7 +11,8 @@ ...@@ -10,7 +11,8 @@
</view> </view>
<view class="count-view"> <view class="count-view">
<view v-if="showChecked"> <view v-if="showChecked">
<u-number-box v-model="value" :min="item.min || 0" :max="item.max || item[type]" @change="numChange"></u-number-box> <u-number-box v-model="value" :min="item.min || 0" :max="item.max || item[type]" @minus="numChange"
@plus="numChange" @blur="numChange"></u-number-box>
</view> </view>
<text v-else>x{{item[type]|| 0}}</text> <text v-else>x{{item[type]|| 0}}</text>
</view> </view>
...@@ -22,7 +24,7 @@ ...@@ -22,7 +24,7 @@
props: { props: {
showChecked: { // 是否显示勾选 showChecked: { // 是否显示勾选
type: Boolean, type: Boolean,
default() { default () {
return false return false
} }
}, },
...@@ -32,7 +34,7 @@ ...@@ -32,7 +34,7 @@
}, },
item: { item: {
type: Object, type: Object,
default() { default () {
return {} return {}
} }
}, },
...@@ -43,9 +45,9 @@ ...@@ -43,9 +45,9 @@
}, },
data() { data() {
return { return {
value: 0, value: 0, // 选数
check: false, check: false, // 选中
oldCount: 0 oldCount: 0 // 旧选数
} }
}, },
computed: { computed: {
...@@ -57,7 +59,8 @@ ...@@ -57,7 +59,8 @@
} }
}, },
imageUrl() { imageUrl() {
return this.item.images ? process.uniEnv.systemUrl.apiUrl + this.item.images.split(',').shift() : this.placeholderImage return this.item.images ? process.uniEnv.systemUrl.apiUrl + this.item.images.split(',').shift() : this
.placeholderImage
}, },
placeholderImage() { placeholderImage() {
return process.uniEnv.qn_base_url + 'morentupian.png' return process.uniEnv.qn_base_url + 'morentupian.png'
...@@ -72,12 +75,13 @@ ...@@ -72,12 +75,13 @@
}, },
'item.selected'(val) { 'item.selected'(val) {
this.check = val this.check = val
this.value= val ? this.item.stock : 0 this.value = val ? this.item.stock : 0
}, },
}, },
methods: { methods: {
handleChange(event) { handleChange(event) {
this.value= event.value ? this.item.stock : 0 this.value = event.value ? this.item.stock : 0
this.oldCount = this.value
this.$emit('change', event.value) this.$emit('change', event.value)
}, },
numChange(event) { numChange(event) {
...@@ -96,14 +100,11 @@ ...@@ -96,14 +100,11 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.spare-item { .spare-item {
display: flex; display: flex;
// width: 100%;
justify-content: space-between; justify-content: space-between;
align-items: flex-end; align-items: flex-end;
// padding: 30rpx;
// background-color: #FFFFFF;
// border-radius: 12rpx;
.left-view { .left-view {
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -133,5 +134,5 @@ ...@@ -133,5 +134,5 @@
color: #333333; color: #333333;
} }
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment