采购列表页面,部分手机无法输入价格、数量:售价、进价,需要排查

This commit is contained in:
xiaofajia 2024-11-26 16:53:43 +08:00
parent 82fdf4b73d
commit c329fa5864
3 changed files with 66 additions and 65 deletions

View File

@ -4,22 +4,19 @@
"version" : "0.0", "version" : "0.0",
"configurations" : [ "configurations" : [
{ {
"app-plus" : "app-plus" : {
{ "launchtype" : "local"
"launchtype" : "local" },
}, "default" : {
"default" : "launchtype" : "local"
{ },
"launchtype" : "local" "mp-weixin" : {
}, "launchtype" : "local"
"mp-weixin" : },
{ "type" : "uniCloud"
"launchtype" : "local"
},
"type" : "uniCloud"
}, },
{ {
"playground" : "custom", "playground" : "standard",
"type" : "uni-app:app-android" "type" : "uni-app:app-android"
} }
] ]

View File

@ -3,7 +3,8 @@ module.exports = {
// baseUrl: 'https://www.nuoyunr.com', // baseUrl: 'https://www.nuoyunr.com',
// baseUrl: 'http://124.222.105.7:48080', // baseUrl: 'http://124.222.105.7:48080',
// baseUrl: 'http://192.168.1.4: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/', imagesUrl: 'http://shequ.0315e.com/static/images/pages/',
baseImageUrl: 'https://www.nuoyunr.com/minio/', baseImageUrl: 'https://www.nuoyunr.com/minio/',
shareUrl: 'https://www.lighting-it.cn/share?inviteId=', shareUrl: 'https://www.lighting-it.cn/share?inviteId=',

View File

@ -11,7 +11,7 @@
<view class="formItem" v-if="isInput"> <view class="formItem" v-if="isInput">
<text class="formLabel">关键字</text> <text class="formLabel">关键字</text>
<input type="text" style="text-align: right" v-model="query" placeholder="名称、规格、编码"/> <input type="text" style="text-align: right" v-model="query" placeholder="名称、规格、编码"/>
<view @click="searchQuery">查询</view> <view @click="searchQuery" style="width: 3rem">查询</view>
</view> </view>
<view class="formItem" v-if="!isInput"> <view class="formItem" v-if="!isInput">
<text class="formLabel">备注</text> <text class="formLabel">备注</text>
@ -35,8 +35,8 @@
</view> </view>
</uni-card> </uni-card>
<uni-collapse ref="collapse"> <uni-collapse ref="collapse">
<uni-collapse-item v-for="[key, value] in partList" :title="key + `(${value.length})`"> <uni-collapse-item v-for="(key, index) in keys" :key="index" :title="key + `(${values.get(key).length})`">
<uni-card v-for="(item, index) in value" :key="index"> <uni-card v-for="(item, index) in values.get(key)" :key="index">
<template> <template>
<view class="card-header"> <view class="card-header">
<radio v-if="isInput" :checked="item.isSelected" @click="chooseItem(item)"/> <radio v-if="isInput" :checked="item.isSelected" @click="chooseItem(item)"/>
@ -45,16 +45,19 @@
</template> </template>
<view class="formItem"> <view class="formItem">
<view class="formLabel">进价</view> <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>
<view class="formItem"> <view class="formItem">
<view class="formLabel">售价</view> <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>
<view class="formItem"> <view class="formItem">
<view class="formLabel">分类</view> <view class="formLabel">分类</view>
<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"> <view class="picker">
{{ getServerName(item.wares.type) }} {{ getServerName(item.wares.type) }}
</view> </view>
@ -63,7 +66,8 @@
</view> </view>
<view class="formItem"> <view class="formItem">
<view class="formLabel">计量单价</view> <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"> <view class="picker">
{{ getUnitName(item.wares.unit) }} {{ getUnitName(item.wares.unit) }}
</view> </view>
@ -71,30 +75,23 @@
</view> </view>
<view class="formItem" v-if="!isInput"> <view class="formItem" v-if="!isInput">
<view class="formLabel">数量</view> <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>
<view class="formItem" v-if="isInput"> <view class="formItem" v-if="isInput">
<view class="formLabel">数量</view> <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>
<view class="formItem"> <view class="formItem">
<view class="formLabel">仓库</view> <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> </uni-data-picker>
</view> </view>
</uni-card> </uni-card>
</uni-collapse-item> </uni-collapse-item>
</uni-collapse> </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> </view>
<view class="footer"> <view class="footer">
@ -151,6 +148,8 @@ export default {
subLoading: false, subLoading: false,
waresTree: [], waresTree: [],
chooseWares: null, chooseWares: null,
keys: [],
values: null
}; };
}, },
onLoad(data) { onLoad(data) {
@ -173,7 +172,7 @@ export default {
}, },
computed: {}, computed: {},
methods: { methods: {
listWarehouse(){ listWarehouse() {
request({ request({
url: '/admin-api/conf/baseWarehouse/list', url: '/admin-api/conf/baseWarehouse/list',
method: 'get' method: 'get'
@ -182,29 +181,29 @@ export default {
}) })
}, },
chooseItem(item) { 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);
const index = this.selectRows.findIndex(i => i.id === item.id) if (index === -1) {
if (index === -1){ item.isSelected = true;
this.$set(item, 'isSelected', true) this.selectRows.push(item);
this.selectRows.push(item) } else {
}else { item.isSelected = false;
this.$set(item, 'isSelected', false) this.selectRows.splice(index, 1);
this.selectRows.splice(index, 1)
} }
if (parentIndex !== -1){
const partListFlat = this.partList // Map
.map(([key, value]) => value) const partListFlat = Array.from(this.values.values()).flat();
.reduce((acc, value) => acc.concat(value), []);
this.$set(partListFlat, parentIndex, { ...partListFlat[parentIndex], isSelected: item.isSelected }); // Map
const updatedPartList = this.partList.map(([key, value]) => { const updatedValues = new Map();
const newValue = value.map(v => { for (const [key, value] of this.values) {
const foundItem = partListFlat.find(f => f.id === v.id); const newValue = value.map(v => {
return foundItem ? { ...v, ...foundItem } : v; const foundItem = partListFlat.find(f => f.id === v.id);
}); return foundItem ? { ...v, ...foundItem } : v;
return [key, newValue];
}); });
this.$set(this, 'partList', updatedPartList); updatedValues.set(key, newValue);
} }
this.values = updatedValues;
}, },
searchQuery() { searchQuery() {
this.getSoiId() this.getSoiId()
@ -214,7 +213,7 @@ export default {
const index = this.unitList.findIndex(item => item.value === id) const index = this.unitList.findIndex(item => item.value === id)
if (index !== -1) { if (index !== -1) {
return this.unitList[index].label return this.unitList[index].label
}else { } else {
return "请选择" return "请选择"
} }
} }
@ -325,6 +324,8 @@ export default {
i.totalPrice = i.waresCount * i.wares.purPrice 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() { submit() {
const userInfo = getUserInfo() 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 = { const data = {
soType: '01', soType: '01',
purchaseType: '01', purchaseType: '01',
@ -388,7 +389,7 @@ export default {
} }
})] })]
data.waresList = [...values.map(item => item.wares)] data.waresList = [...values.map(item => item.wares)]
if (this.twId){ if (this.twId) {
data.twId = this.twId data.twId = this.twId
} }
request({ request({
@ -426,38 +427,40 @@ export default {
}) })
}) })
const values = this.partList.map(([key, value]) => value) 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 => { values.forEach(item => {
item.forEach(i => { item.forEach(i => {
i.isSelected = false i.isSelected = false
}) })
}) })
}else { } else {
values.forEach(item => { values.forEach(item => {
item.forEach(i => { item.forEach(i => {
i.isSelected = this.selectRows.findIndex(j => j.id === i.id) !== -1 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() { inWare() {
if (!this.subLoading){ if (!this.subLoading) {
this.subLoading = true this.subLoading = true
const data = { const data = {
id: this.soId, id: this.soId,
soNo: createUniqueCodeByHead("RK") soNo: createUniqueCodeByHead("RK")
} }
const values = this.partList.map(([key, value]) => value).reduce((acc, item) => acc.concat(item)) const values = Array.from(this.values.values()).flat();
if (this.selectRows && this.selectRows.length > 0){ if (this.selectRows && this.selectRows.length > 0) {
const ids = this.selectRows.map(item => item.id) const ids = this.selectRows.map(item => item.id)
const newSelect = values.filter(item => ids.includes(item.id)) const newSelect = values.filter(item => ids.includes(item.id))
data.soiList = [...newSelect] data.soiList = [...newSelect]
data.waresList = [...newSelect.map(item => item.wares)] data.waresList = [...newSelect.map(item => item.wares)]
}else { } else {
data.soiList = [...values] data.soiList = [...values]
data.waresList = [...values.map(item => item.wares)] data.waresList = [...values.map(item => item.wares)]
} }