采购列表页面,部分手机无法输入价格、数量:售价、进价,需要排查
This commit is contained in:
parent
82fdf4b73d
commit
c329fa5864
@ -4,22 +4,19 @@
|
||||
"version" : "0.0",
|
||||
"configurations" : [
|
||||
{
|
||||
"app-plus" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"default" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-weixin" :
|
||||
{
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
"app-plus" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"default" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"mp-weixin" : {
|
||||
"launchtype" : "local"
|
||||
},
|
||||
"type" : "uniCloud"
|
||||
},
|
||||
{
|
||||
"playground" : "custom",
|
||||
"playground" : "standard",
|
||||
"type" : "uni-app:app-android"
|
||||
}
|
||||
]
|
||||
|
@ -3,7 +3,8 @@ module.exports = {
|
||||
// baseUrl: 'https://www.nuoyunr.com',
|
||||
// baseUrl: 'http://124.222.105.7:48080',
|
||||
// baseUrl: 'http://192.168.1.4:48080',
|
||||
baseUrl: "http://localhost:48080",
|
||||
// baseUrl: "http://localhost:48080",
|
||||
baseUrl: "http://rzqhb7.natappfree.cc",
|
||||
imagesUrl: 'http://shequ.0315e.com/static/images/pages/',
|
||||
baseImageUrl: 'https://www.nuoyunr.com/minio/',
|
||||
shareUrl: 'https://www.lighting-it.cn/share?inviteId=',
|
||||
|
@ -11,7 +11,7 @@
|
||||
<view class="formItem" v-if="isInput">
|
||||
<text class="formLabel">关键字</text>
|
||||
<input type="text" style="text-align: right" v-model="query" placeholder="名称、规格、编码"/>
|
||||
<view @click="searchQuery">查询</view>
|
||||
<view @click="searchQuery" style="width: 3rem">查询</view>
|
||||
</view>
|
||||
<view class="formItem" v-if="!isInput">
|
||||
<text class="formLabel">备注</text>
|
||||
@ -35,8 +35,8 @@
|
||||
</view>
|
||||
</uni-card>
|
||||
<uni-collapse ref="collapse">
|
||||
<uni-collapse-item v-for="[key, value] in partList" :title="key + `(${value.length})`">
|
||||
<uni-card v-for="(item, index) in value" :key="index">
|
||||
<uni-collapse-item v-for="(key, index) in keys" :key="index" :title="key + `(${values.get(key).length})`">
|
||||
<uni-card v-for="(item, index) in values.get(key)" :key="index">
|
||||
<template>
|
||||
<view class="card-header">
|
||||
<radio v-if="isInput" :checked="item.isSelected" @click="chooseItem(item)"/>
|
||||
@ -45,16 +45,19 @@
|
||||
</template>
|
||||
<view class="formItem">
|
||||
<view class="formLabel">进价</view>
|
||||
<input type="number" style="text-align: right" v-model="item.wares.purPrice" placeholder="请输入单价"/>
|
||||
<input type="number" style="text-align: right" v-model="item.wares.purPrice"
|
||||
placeholder="请输入单价"/>
|
||||
</view>
|
||||
<view class="formItem">
|
||||
<view class="formLabel">售价</view>
|
||||
<input type="number" style="text-align: right" v-model="item.wares.price" placeholder="请输入单价"/>
|
||||
<input type="number" style="text-align: right" v-model="item.wares.price"
|
||||
placeholder="请输入单价"/>
|
||||
</view>
|
||||
<view class="formItem">
|
||||
<view class="formLabel">分类</view>
|
||||
<view>
|
||||
<picker @change="bindPickerChange($event, item)" :range="options" range-key="label">
|
||||
<picker @change="bindPickerChange($event, item)" :range="options"
|
||||
range-key="label">
|
||||
<view class="picker">
|
||||
{{ getServerName(item.wares.type) }}
|
||||
</view>
|
||||
@ -63,7 +66,8 @@
|
||||
</view>
|
||||
<view class="formItem">
|
||||
<view class="formLabel">计量单价</view>
|
||||
<picker @change="bindUnitChange($event, item)" :range="unitList" range-key="label">
|
||||
<picker @change="bindUnitChange($event, item)" :range="unitList"
|
||||
range-key="label">
|
||||
<view class="picker">
|
||||
{{ getUnitName(item.wares.unit) }}
|
||||
</view>
|
||||
@ -71,30 +75,23 @@
|
||||
</view>
|
||||
<view class="formItem" v-if="!isInput">
|
||||
<view class="formLabel">数量</view>
|
||||
<input type="number" style="text-align: right" v-model="item.waresCount" placeholder="请输入数量"/>
|
||||
<input type="number" style="text-align: right" v-model="item.waresCount"
|
||||
placeholder="请输入数量"/>
|
||||
</view>
|
||||
<view class="formItem" v-if="isInput">
|
||||
<view class="formLabel">数量</view>
|
||||
<input type="number" style="text-align: right" v-model="item.inCount" placeholder="请输入数量"/>
|
||||
<input type="number" style="text-align: right" v-model="item.inCount"
|
||||
placeholder="请输入数量"/>
|
||||
</view>
|
||||
<view class="formItem">
|
||||
<view class="formLabel">仓库</view>
|
||||
<uni-data-picker placeholder="请选择仓库" popup-title="请选择仓库" :localdata="waresTree" v-model="item.wares.warehouse">
|
||||
<uni-data-picker placeholder="请选择仓库" popup-title="请选择仓库"
|
||||
:localdata="waresTree" v-model="item.wares.warehouse">
|
||||
</uni-data-picker>
|
||||
</view>
|
||||
</uni-card>
|
||||
</uni-collapse-item>
|
||||
</uni-collapse>
|
||||
<!-- <uni-card v-for="(item, index) in partList" :key="index" :title="item.name" :extra="'上次价格:'+item.purPrice">-->
|
||||
<!-- <view class="formItem">-->
|
||||
<!-- <view class="formLabel">单价</view>-->
|
||||
<!-- <input type="number" style="text-align: right" v-model="item.newPrice" placeholder="请输入单价"/>-->
|
||||
<!-- </view>-->
|
||||
<!-- <view class="formItem">-->
|
||||
<!-- <view class="formLabel">数量</view>-->
|
||||
<!-- <input type="number" style="text-align: right" v-model="item.count" placeholder="请输入数量"/>-->
|
||||
<!-- </view>-->
|
||||
<!-- </uni-card>-->
|
||||
</view>
|
||||
</view>
|
||||
<view class="footer">
|
||||
@ -151,6 +148,8 @@ export default {
|
||||
subLoading: false,
|
||||
waresTree: [],
|
||||
chooseWares: null,
|
||||
keys: [],
|
||||
values: null
|
||||
};
|
||||
},
|
||||
onLoad(data) {
|
||||
@ -173,7 +172,7 @@ export default {
|
||||
},
|
||||
computed: {},
|
||||
methods: {
|
||||
listWarehouse(){
|
||||
listWarehouse() {
|
||||
request({
|
||||
url: '/admin-api/conf/baseWarehouse/list',
|
||||
method: 'get'
|
||||
@ -182,29 +181,29 @@ export default {
|
||||
})
|
||||
},
|
||||
chooseItem(item) {
|
||||
const parentIndex = this.partList.map(([key, value]) => value).reduce((acc, value) => acc.concat(value)).findIndex(i => i.id === item.id)
|
||||
const index = this.selectRows.findIndex(i => i.id === item.id)
|
||||
if (index === -1){
|
||||
this.$set(item, 'isSelected', true)
|
||||
this.selectRows.push(item)
|
||||
}else {
|
||||
this.$set(item, 'isSelected', false)
|
||||
this.selectRows.splice(index, 1)
|
||||
const index = this.selectRows.findIndex(i => i.id === item.id);
|
||||
if (index === -1) {
|
||||
item.isSelected = true;
|
||||
this.selectRows.push(item);
|
||||
} else {
|
||||
item.isSelected = false;
|
||||
this.selectRows.splice(index, 1);
|
||||
}
|
||||
if (parentIndex !== -1){
|
||||
const partListFlat = this.partList
|
||||
.map(([key, value]) => value)
|
||||
.reduce((acc, value) => acc.concat(value), []);
|
||||
this.$set(partListFlat, parentIndex, { ...partListFlat[parentIndex], isSelected: item.isSelected });
|
||||
const updatedPartList = this.partList.map(([key, value]) => {
|
||||
const newValue = value.map(v => {
|
||||
const foundItem = partListFlat.find(f => f.id === v.id);
|
||||
return foundItem ? { ...v, ...foundItem } : v;
|
||||
});
|
||||
return [key, newValue];
|
||||
|
||||
// 将 Map 中的所有值展平成一个数组
|
||||
const partListFlat = Array.from(this.values.values()).flat();
|
||||
|
||||
// 更新 Map 中的值
|
||||
const updatedValues = new Map();
|
||||
for (const [key, value] of this.values) {
|
||||
const newValue = value.map(v => {
|
||||
const foundItem = partListFlat.find(f => f.id === v.id);
|
||||
return foundItem ? { ...v, ...foundItem } : v;
|
||||
});
|
||||
this.$set(this, 'partList', updatedPartList);
|
||||
updatedValues.set(key, newValue);
|
||||
}
|
||||
|
||||
this.values = updatedValues;
|
||||
},
|
||||
searchQuery() {
|
||||
this.getSoiId()
|
||||
@ -214,7 +213,7 @@ export default {
|
||||
const index = this.unitList.findIndex(item => item.value === id)
|
||||
if (index !== -1) {
|
||||
return this.unitList[index].label
|
||||
}else {
|
||||
} else {
|
||||
return "请选择"
|
||||
}
|
||||
}
|
||||
@ -325,6 +324,8 @@ export default {
|
||||
i.totalPrice = i.waresCount * i.wares.purPrice
|
||||
})
|
||||
})
|
||||
this.keys = this.partList.map(([key, value]) => key)
|
||||
this.values = new Map(this.partList)
|
||||
})
|
||||
},
|
||||
/**
|
||||
@ -360,7 +361,7 @@ export default {
|
||||
*/
|
||||
submit() {
|
||||
const userInfo = getUserInfo()
|
||||
const values = this.partList.map(([key, value]) => value).reduce((acc, value) => acc.concat(value))
|
||||
const values = Array.from(this.values.values()).flat();
|
||||
const data = {
|
||||
soType: '01',
|
||||
purchaseType: '01',
|
||||
@ -388,7 +389,7 @@ export default {
|
||||
}
|
||||
})]
|
||||
data.waresList = [...values.map(item => item.wares)]
|
||||
if (this.twId){
|
||||
if (this.twId) {
|
||||
data.twId = this.twId
|
||||
}
|
||||
request({
|
||||
@ -426,38 +427,40 @@ export default {
|
||||
})
|
||||
})
|
||||
const values = this.partList.map(([key, value]) => value)
|
||||
if (!this.selectRows || this.selectRows.length === 0){
|
||||
if (!this.selectRows || this.selectRows.length === 0) {
|
||||
values.forEach(item => {
|
||||
item.forEach(i => {
|
||||
i.isSelected = false
|
||||
})
|
||||
})
|
||||
}else {
|
||||
} else {
|
||||
values.forEach(item => {
|
||||
item.forEach(i => {
|
||||
i.isSelected = this.selectRows.findIndex(j => j.id === i.id) !== -1
|
||||
})
|
||||
})
|
||||
}
|
||||
this.keys = this.partList.map(([key, value]) => key)
|
||||
this.values = new Map(this.partList)
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 入库
|
||||
*/
|
||||
inWare() {
|
||||
if (!this.subLoading){
|
||||
if (!this.subLoading) {
|
||||
this.subLoading = true
|
||||
const data = {
|
||||
id: this.soId,
|
||||
soNo: createUniqueCodeByHead("RK")
|
||||
}
|
||||
const values = this.partList.map(([key, value]) => value).reduce((acc, item) => acc.concat(item))
|
||||
if (this.selectRows && this.selectRows.length > 0){
|
||||
const values = Array.from(this.values.values()).flat();
|
||||
if (this.selectRows && this.selectRows.length > 0) {
|
||||
const ids = this.selectRows.map(item => item.id)
|
||||
const newSelect = values.filter(item => ids.includes(item.id))
|
||||
data.soiList = [...newSelect]
|
||||
data.waresList = [...newSelect.map(item => item.wares)]
|
||||
}else {
|
||||
} else {
|
||||
data.soiList = [...values]
|
||||
data.waresList = [...values.map(item => item.wares)]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user