Commit 7fe1f266 by 李伟康

feat(OrderPopup): 优化败单搜索功能

- 增加对败单的搜索支持,可搜索商品名称和套餐名称
- 修复非败单搜索逻辑,提高搜索准确性
- 移除无用的 console.log 语句
1 parent 5693c008
...@@ -87,17 +87,31 @@ export default { ...@@ -87,17 +87,31 @@ export default {
if (data && data.length) this.updateParams(params, data) if (data && data.length) this.updateParams(params, data)
}, },
handleSearch (searchValue) { handleSearch (searchValue) {
let { isDefeatOrder } = this
if (!searchValue) this.searchStatus = false if (!searchValue) this.searchStatus = false
else { else {
let { list } = this, let { list } = this,
goodsList = JSON.parse(JSON.stringify(list)), goodsList = JSON.parse(JSON.stringify(list)),
arr = [] arr = []
goodsList.map(c => { goodsList.map(i => {
let name = '' let name = ''
if (c.goodsFlag == 1 && c.goods) name = c.goods.goodsAlias || c.goods.upgradeGoodsName || c.goods.goodsName || '' if (isDefeatOrder) {
if (name.indexOf(searchValue) != -1) { let upgradeGoodsList = [];
arr.push(c) i.upgradeGoodsList.map((c) => {
let name = c.upgradeGoodsAlias || c.upgradeGoodsName || c.goodsInfo.goodsName;
if (name.indexOf(searchValue) != -1) upgradeGoodsList.push(c)
})
if (i.goodsTypeName.indexOf(searchValue) != -1 || upgradeGoodsList.length > 0) {
i.upgradeGoodsList = upgradeGoodsList.length > 0 ? upgradeGoodsList : i.upgradeGoodsList
arr.push(i)
}
} else {
if (i.goodsFlag == 1 && i.goods) name = i.goods.goodsAlias || i.goods.upgradeGoodsName || i.goods.goodsName || ''
if (name.indexOf(searchValue) != -1) {
arr.push(i)
}
} }
}) })
this.searchList = arr this.searchList = arr
this.searchStatus = true this.searchStatus = true
......
...@@ -190,7 +190,6 @@ export default { ...@@ -190,7 +190,6 @@ export default {
this.initPopupData() this.initPopupData()
}, },
cancel () { cancel () {
console.log()
this.$refs.popup.close() this.$refs.popup.close()
this.$emit('cancel') this.$emit('cancel')
}, },
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!