|
|
@@ -10,7 +10,6 @@
|
|
|
</uni-data-picker>
|
|
|
</u-cell>
|
|
|
<u-cell title="编码" arrow-direction="down">
|
|
|
-
|
|
|
<u--input v-if="form.typeId != '2'" slot="value" placeholder="请输入" border="surround"
|
|
|
v-model="form.code">
|
|
|
</u--input>
|
|
|
@@ -19,10 +18,10 @@
|
|
|
</view>
|
|
|
</u-cell>
|
|
|
<u-cell title="名称" arrow-direction="down">
|
|
|
- <u--input @click.native="selectProduct" slot="value" placeholder="请选择" border="surround"
|
|
|
+ <u--input v-if="form.typeId == '2'" @click.native="selectProduct" slot="value" placeholder="请选择" border="surround"
|
|
|
v-model="form.name">
|
|
|
</u--input>
|
|
|
- <!-- <u--input slot="value" placeholder="请输入" border="surround" v-model="form.name"></u--input> -->
|
|
|
+ <u--input slot="value" v-if="form.typeId != '2'" placeholder="请输入" border="surround" v-model="form.name"></u--input>
|
|
|
</u-cell>
|
|
|
<u-cell title="型号" arrow-direction="down">
|
|
|
<u--input slot="value" v-if="form.typeId != '2'" placeholder="请输入" border="surround"
|
|
|
@@ -40,10 +39,10 @@
|
|
|
</u-cell>
|
|
|
<u-cell title="仓库" arrow-direction="down">
|
|
|
<template>
|
|
|
- <uni-data-picker v-model="form.warehouseId" slot="value" :clear-icon='false' placeholder="请选择"
|
|
|
+ <uni-data-picker v-if="form.typeId != '2'" v-model="form.warehouseId" slot="value" :clear-icon='false' placeholder="请选择"
|
|
|
:localdata="warehouseList" @change="warehouseOnchange">
|
|
|
</uni-data-picker>
|
|
|
- <!-- <u--input slot="value" placeholder="请输入" border="surround" v-model="form.warehouseId"></u--input> -->
|
|
|
+ <u--input v-if="form.typeId == '2'" slot="value" placeholder="请输入" border="surround" v-model="form.warehouseName"></u--input>
|
|
|
</template>
|
|
|
</u-cell>
|
|
|
<u-cell title="库存" arrow-direction="down">
|
|
|
@@ -60,12 +59,12 @@
|
|
|
</view>
|
|
|
</u-cell>
|
|
|
<u-cell title="数量" arrow-direction="down">
|
|
|
- <u--input slot="value" @input=" (val) =>inputChange(val,'totalCount')" placeholder="请输入" border="surround"
|
|
|
- v-model="form.totalCount"></u--input>
|
|
|
+ <u--input slot="value" type="number" @input=" (val) =>inputChange(val,'totalCount')" placeholder="请输入"
|
|
|
+ border="surround" v-model="form.totalCount"></u--input>
|
|
|
</u-cell>
|
|
|
<u-cell title="单价" arrow-direction="down">
|
|
|
- <u--input slot="value" @input="inputChange('singlePrice')" placeholder="请输入" border="surround"
|
|
|
- v-model="form.singlePrice"></u--input>
|
|
|
+ <u--input type="number" slot="value" @input="(val) =>inputChange(val,'singlePrice')" placeholder="请输入"
|
|
|
+ border="surround" v-model="form.singlePrice"></u--input>
|
|
|
</u-cell>
|
|
|
<u-cell title="合计" arrow-direction="down">
|
|
|
<view class="labels" slot="value">
|
|
|
@@ -80,6 +79,7 @@
|
|
|
<u-button type="primary" @click="save" text="保存"></u-button>
|
|
|
</view>
|
|
|
</u-cell-group>
|
|
|
+ <u-toast ref="uToast"></u-toast>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -120,6 +120,11 @@
|
|
|
}
|
|
|
},
|
|
|
onLoad(params) {
|
|
|
+ let data = JSON.parse(params.data);
|
|
|
+ if(data.code){
|
|
|
+ this.form = data;
|
|
|
+ }
|
|
|
+ console.log(data,'params')
|
|
|
this.obtain = params.obtain || '主数据'
|
|
|
},
|
|
|
created() {
|
|
|
@@ -129,7 +134,6 @@
|
|
|
...this.form,
|
|
|
...data
|
|
|
};
|
|
|
- console.log(this.form, 'form 数据')
|
|
|
this.warehouseList = data.warehouseList.map((el) => {
|
|
|
el.text = el.warehouse_name;
|
|
|
el.value = el.warehouse_id;
|
|
|
@@ -158,8 +162,6 @@
|
|
|
singlePrice: '', // 单价
|
|
|
settlementPrice: '', // 合计
|
|
|
}
|
|
|
- console.log(this.form, 'form -0-')
|
|
|
- console.log(e, 'eee');
|
|
|
},
|
|
|
warehouseOnchange(e) {
|
|
|
|
|
|
@@ -170,13 +172,26 @@
|
|
|
})
|
|
|
},
|
|
|
save() {
|
|
|
-
|
|
|
+ if(!this.form.name){
|
|
|
+ this.$refs.uToast.show({
|
|
|
+ type: "warning",
|
|
|
+ message: "请填写名称",
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ uni.$emit('updateInfo', this.form);
|
|
|
+ this.back();
|
|
|
+ },
|
|
|
+ inputChange(e, field) {
|
|
|
+ let value = e.replace(/[^\d]/g, '');
|
|
|
+ if (value.startsWith('0') && value.length > 1) {
|
|
|
+ value = value.replace(/^0+/, '');
|
|
|
+ }
|
|
|
+ this.form[field] = value;
|
|
|
+ let num1 = this.form.totalCount ? this.form.totalCount - 0 : 0;
|
|
|
+ let num2 = this.form.singlePrice ? this.form.singlePrice - 0 : 0;
|
|
|
+ this.form.settlementPrice = num1 * num2;
|
|
|
},
|
|
|
- inputChange(val,field) {
|
|
|
- console.log(val,'val')
|
|
|
- this.form[field] = this.form[field].replace(/[^\d]/g, '').replace(/^0+/, '')
|
|
|
- console.log(field, 'eeeee');
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
</script>
|