商品管理

This commit is contained in:
1154079537 2024-05-18 19:40:29 +08:00
parent ff2c438d88
commit 5d29f788c3
3 changed files with 31 additions and 7 deletions

View File

@ -1,7 +1,7 @@
<template> <template>
<view class="content"> <view class="content">
<u--form :model="model1" ref="uForm" labelPosition="left" :labelStyle="{fontSize:'32rpx',color:'#444444'}" <u--form :model="model1" ref="uForm" labelPosition="left" :labelStyle="{fontSize:'32rpx',color:'#444444'}"
labelWidth='120' borderBottom> labelWidth='120' borderBottom style="padding-bottom: 100rpx;">
<view class="description"> <view class="description">
产品属性 产品属性

View File

@ -44,7 +44,8 @@
<view class=" card-li"> <view class=" card-li">
<text style="font-size: 32rpx;">商品库存</text> <text style="font-size: 32rpx;">商品库存</text>
<view class="" style="width: 300rpx;"> <view class="" style="width: 300rpx;">
<u--input type='number' placeholder="请填写库存数量" inputAlign='right' v-model="item.stock"></u--input> <u--input type='number' placeholder="请填写库存数量" inputAlign='right' :value="item.stock"
@input="onInput($event,item)"></u--input>
</view> </view>
</view> </view>
<u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line> <u-line direction="row" style="margin: 25rpx 0;" color="#ECECEC"></u-line>
@ -179,6 +180,20 @@
} }
}, },
methods: { methods: {
onInput(event, item) {
if (!/^\d*$/.test(event)) {
event = event.replace(/[^\d]/g, '');
}
console.log(event);
item.stock = event;
this.$forceUpdate();
//
},
delFn(index) { delFn(index) {
if (this.attrValue.length == 1) { if (this.attrValue.length == 1) {
return this.$util.Tips({ return this.$util.Tips({

View File

@ -15,12 +15,11 @@
{{short.store_name}} {{short.store_name}}
</view> </view>
<view class="" style="font-size: 24rpx;color: #989898;margin-top: 10rpx;"> <view class="" style="font-size: 24rpx;color: #989898;margin-top: 10rpx;">
<!-- 库存 {{short.attrValue[0].stock}} -->
库存 {{attrvalueStock}} 库存 {{attrvalueStock}}
</view> </view>
</view> </view>
<view class="" style="color: #FC452F;font-size: 24rpx;"> <view class="" style="color: #FC452F;font-size: 24rpx;">
<text style="font-size: 22rpx;"></text><text>10.00</text><text <text style="font-size: 22rpx;"></text><text>{{short.attrValue[0].price}}</text><text
style="color: #828282;">/{{short.attrValue && short.attrValue[0].unit_name}}</text> style="color: #828282;">/{{short.attrValue && short.attrValue[0].unit_name}}</text>
</view> </view>
</view> </view>
@ -30,13 +29,13 @@
{{item.sku||'单规格'}} {{item.sku||'单规格'}}
</view> </view>
<u-line color="#CECECE" style="margin: 30rpx 0 28rpx 0"></u-line> <u-line color="#CECECE" style="margin: 30rpx 0 28rpx 0"></u-line>
<view class="" style="display: flex;justify-content: space-between;font-size: 32rpx;"> <view class="" style="display: flex;justify-content: space-between;font-size: 32rpx;align-items: center;">
<view class=""> <view class="">
商品库存 商品库存
</view> </view>
<view class="" style="display: flex;align-items: center;color: #FC452F;"> <view class="" style="display: flex;align-items: center;color: #FC452F;">
<u--input border="surround" color='#FC452F' inputAlign='right' style='padding: 0;' <u--input type="number" border="surround" color='#FC452F' inputAlign='right' style='padding: 0;'
v-model="item.stock"></u--input>{{item.unit_name}} :value="item.stock" @input="onInput($event,item)"></u--input>{{item.unit_name}}
</view> </view>
</view> </view>
</view> </view>
@ -110,6 +109,14 @@
}, },
onShow() {}, onShow() {},
methods: { methods: {
onInput(event, item) {
if (!/^\d*$/.test(event)) {
event = event.replace(/[^\d]/g, '');
}
item.stock = event;
this.$forceUpdate();
//
},
preViewImg(url) { preViewImg(url) {
let that = this let that = this
uni.previewImage({ uni.previewImage({
@ -246,6 +253,8 @@
position: fixed; position: fixed;
bottom: 50rpx; bottom: 50rpx;
width: 670rpx; width: 670rpx;
left: 50%;
transform: translateX(-50%);
} }
// old // old