|
|
@ -3,11 +3,12 @@
|
|
|
|
<van-checkbox
|
|
|
|
<van-checkbox
|
|
|
|
v-model="checked"
|
|
|
|
v-model="checked"
|
|
|
|
icon-size="18px"
|
|
|
|
icon-size="18px"
|
|
|
|
|
|
|
|
:disabled="invalid"
|
|
|
|
:checked-color="variables.theme"
|
|
|
|
:checked-color="variables.theme"
|
|
|
|
style="padding:0 10px 0 16px"
|
|
|
|
style="padding:0 10px 0 16px; background-color: white;"
|
|
|
|
/>
|
|
|
|
/>
|
|
|
|
<van-swipe-cell style="width:100%" :before-close="beforeClose">
|
|
|
|
<van-swipe-cell style="width:100%; background-color: white;" :before-close="beforeClose">
|
|
|
|
<van-card :tag="tag" :price="price" :desc="desc" :title="title" :thumb="thumb">
|
|
|
|
<van-card :price="price" :desc="desc" :title="title" :thumb="thumb">
|
|
|
|
<!-- <template #tags>
|
|
|
|
<!-- <template #tags>
|
|
|
|
<van-tag
|
|
|
|
<van-tag
|
|
|
|
v-for="(item,idx) in tags"
|
|
|
|
v-for="(item,idx) in tags"
|
|
|
@ -19,10 +20,12 @@
|
|
|
|
</template> -->
|
|
|
|
</template> -->
|
|
|
|
<template #footer>
|
|
|
|
<template #footer>
|
|
|
|
<van-stepper
|
|
|
|
<van-stepper
|
|
|
|
:value="value"
|
|
|
|
v-if="!invalid"
|
|
|
|
:default-value="value"
|
|
|
|
:value="num"
|
|
|
|
theme="round"
|
|
|
|
:default-value="num"
|
|
|
|
button-size="20"
|
|
|
|
button-size="26px"
|
|
|
|
|
|
|
|
min="1"
|
|
|
|
|
|
|
|
:max="maxNumber"
|
|
|
|
integer
|
|
|
|
integer
|
|
|
|
async-change
|
|
|
|
async-change
|
|
|
|
@change="onChange"
|
|
|
|
@change="onChange"
|
|
|
@ -34,6 +37,7 @@
|
|
|
|
<template #right>
|
|
|
|
<template #right>
|
|
|
|
<van-button square text="删除" type="danger" style="height:100%" />
|
|
|
|
<van-button square text="删除" type="danger" style="height:100%" />
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<div v-if="invalid" class="invalid">无货</div>
|
|
|
|
</van-swipe-cell>
|
|
|
|
</van-swipe-cell>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -84,13 +88,18 @@ export default {
|
|
|
|
type: Number,
|
|
|
|
type: Number,
|
|
|
|
default: 0
|
|
|
|
default: 0
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
maxNum: {
|
|
|
|
|
|
|
|
type: Number,
|
|
|
|
|
|
|
|
default: 0
|
|
|
|
|
|
|
|
},
|
|
|
|
isChecked: {
|
|
|
|
isChecked: {
|
|
|
|
type: Boolean,
|
|
|
|
type: Boolean,
|
|
|
|
default: false
|
|
|
|
default: false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
data() {
|
|
|
|
return { value: this.num }
|
|
|
|
return {
|
|
|
|
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
computed: {
|
|
|
|
variables() {
|
|
|
|
variables() {
|
|
|
@ -103,8 +112,27 @@ export default {
|
|
|
|
set(val) {
|
|
|
|
set(val) {
|
|
|
|
this.$emit('input', { val, idx: this.index })
|
|
|
|
this.$emit('input', { val, idx: this.index })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
maxNumber() {
|
|
|
|
|
|
|
|
return this.maxNum > this.num ? this.maxNum : this.num
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
invalid() {
|
|
|
|
|
|
|
|
const valid = this.maxNum < this.num
|
|
|
|
|
|
|
|
return valid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
|
|
|
|
num: {
|
|
|
|
|
|
|
|
handler(n, o) {
|
|
|
|
|
|
|
|
console.log('watch:' + n + ' ' + o)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
deep: true,
|
|
|
|
|
|
|
|
immediate: true
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
console.log('id:' + this.index + ' maxNum:' + this.maxNum + ' curNum:' + this.num)
|
|
|
|
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
methods: {
|
|
|
|
// position 为关闭时点击的位置
|
|
|
|
// position 为关闭时点击的位置
|
|
|
|
// instance 为对应的 SwipeCell 实例
|
|
|
|
// instance 为对应的 SwipeCell 实例
|
|
|
@ -140,7 +168,7 @@ export default {
|
|
|
|
// 注意此时修改 value 后会再次触发 change 事件
|
|
|
|
// 注意此时修改 value 后会再次触发 change 事件
|
|
|
|
changeNumber(this.index, value)
|
|
|
|
changeNumber(this.index, value)
|
|
|
|
.then((res) => {
|
|
|
|
.then((res) => {
|
|
|
|
this.value = value
|
|
|
|
this.curNum = value
|
|
|
|
this.$emit('changeNum', this.index, Number(value))
|
|
|
|
this.$emit('changeNum', this.index, Number(value))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.catch()
|
|
|
|
.catch()
|
|
|
@ -151,12 +179,31 @@ export default {
|
|
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.card__item {
|
|
|
|
.card__item {
|
|
|
|
|
|
|
|
position: relative;
|
|
|
|
display: flex;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
flex-direction: row;
|
|
|
|
margin-bottom: 14px;
|
|
|
|
background-color: #f9f8f8;
|
|
|
|
|
|
|
|
padding: 0px 10px 15px 10px;
|
|
|
|
.van-card__num {
|
|
|
|
.van-card__num {
|
|
|
|
font-size: 16px;
|
|
|
|
font-size: 16px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.van-card__footer {
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
top: 150px;
|
|
|
|
|
|
|
|
left: -16px;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
.invalid {
|
|
|
|
|
|
|
|
position: absolute;
|
|
|
|
|
|
|
|
width: 120px;
|
|
|
|
|
|
|
|
height: 120px;
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
|
|
|
|
line-height: 120px;
|
|
|
|
|
|
|
|
border-radius: 50%;
|
|
|
|
|
|
|
|
background-color: #554f4f;
|
|
|
|
|
|
|
|
color: white;
|
|
|
|
|
|
|
|
top: 40px;
|
|
|
|
|
|
|
|
left: 60px;
|
|
|
|
|
|
|
|
filter: opacity(80%);
|
|
|
|
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</style>
|
|
|
|