|
|
@ -7,6 +7,7 @@ |
|
|
|
range-key="name" |
|
|
|
:range="curStoreList" |
|
|
|
value="0" |
|
|
|
:disabled="storeListDisabled" |
|
|
|
> |
|
|
|
<view class="header-store-selecter"> |
|
|
|
<image class="header-store-selecter-left-img" mode="aspectFit" src="/static/images/icon/retail/home.png"></image> |
|
|
@ -20,7 +21,7 @@ |
|
|
|
<image mode="aspectFit" src="/static/images/icon/retail/search.png"></image> |
|
|
|
<input |
|
|
|
type="text" |
|
|
|
placeholder="请输入商品名称" |
|
|
|
placeholder="请输入商品名称、sku" |
|
|
|
disabled |
|
|
|
/> |
|
|
|
</view> |
|
|
@ -106,6 +107,7 @@ export default { |
|
|
|
// curStoreList: [{ id: '', name: '请选择门店'}], // 当前门店列表 |
|
|
|
indexData: {}, // 首页 统计数据 |
|
|
|
curStoreList: [], // 当前门店列表 |
|
|
|
storeListDisabled: false, // 当前门店列表禁用状态 |
|
|
|
curStore: {}, // 当前门店 |
|
|
|
goodsInfo: [], // 商品信息 |
|
|
|
mainHeight: "0rpx", // 主内容高度 |
|
|
@ -218,8 +220,12 @@ export default { |
|
|
|
|
|
|
|
// 触发搜索 |
|
|
|
searchTrigger() { |
|
|
|
let data = { |
|
|
|
curStore: this.curStore, |
|
|
|
}; |
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
url: '/subpackage/retail/pages/search/search' |
|
|
|
url: `/subpackage/retail/pages/search/search?data=${encodeURIComponent(JSON.stringify(data))}` |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
@ -258,6 +264,12 @@ export default { |
|
|
|
|
|
|
|
switch (type) { |
|
|
|
case "add": { |
|
|
|
// 判断库存 |
|
|
|
if (this.cartList[i].erp_goods_sale_total + 1 > this.cartList[i].stock_num) { |
|
|
|
util.showNone("库存就这么多了!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this.cartList[i].erp_goods_sale_total += 1; |
|
|
|
for (let i = 0; i < mainItems.length; ++i) { |
|
|
|
mainItems[i].erp_goods_sale_total += 1; |
|
|
@ -317,10 +329,7 @@ export default { |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
uni.showToast({ |
|
|
|
title: "购物车无数据!", |
|
|
|
icon: "none" |
|
|
|
}); |
|
|
|
util.showNone("购物车无数据!"); |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
@ -491,6 +500,11 @@ export default { |
|
|
|
if (goodsItem) { |
|
|
|
switch (type) { |
|
|
|
case "add": { |
|
|
|
// 判断库存 |
|
|
|
if (goodsItem.erp_goods_sale_total + 1 > goodsItem.stock_num) { |
|
|
|
util.showNone("库存就这么多了!"); |
|
|
|
return; |
|
|
|
} |
|
|
|
goodsItem.erp_goods_sale_total += 1; |
|
|
|
} break; |
|
|
|
case "sub": { |
|
|
@ -538,54 +552,60 @@ export default { |
|
|
|
// 获取商品信息 |
|
|
|
getGoodsInfo() { |
|
|
|
let _this = this; |
|
|
|
|
|
|
|
_this.goodsInfo = []; |
|
|
|
// let categoryName = ""; |
|
|
|
|
|
|
|
retailServer.get({ |
|
|
|
url: retailApi.assistantListErpGoodsCateAndGoods, |
|
|
|
data: { |
|
|
|
// brand_id: _this.indexData.brand.id, |
|
|
|
stadium_id: _this.curStore.id, |
|
|
|
}, |
|
|
|
isDefaultGet: false, |
|
|
|
failMsg: '加载物品数据失败!' |
|
|
|
}).then(res => { |
|
|
|
_this.goodsInfo.push({ |
|
|
|
isCateShow: false, |
|
|
|
isShow: false, |
|
|
|
style: _this.categoryBtnStyle.default, |
|
|
|
cate: { |
|
|
|
created_at: "", |
|
|
|
erp_goods_cate_brandid: -1, |
|
|
|
erp_goods_cate_name: "搜索", |
|
|
|
id: -1, |
|
|
|
update_at: "", |
|
|
|
}, |
|
|
|
goods_list: [], |
|
|
|
}); |
|
|
|
|
|
|
|
console.log(res); |
|
|
|
for (let i = 0; i < res.list.length; ++i) { |
|
|
|
if (res.list[i].cate.erp_goods_cate_name == "热销") { |
|
|
|
_this.categoryIndex = 2; // 如果有热销,那么分类索引值从2开始,前面两项过滤掉(搜索、热销) |
|
|
|
} |
|
|
|
if (res.data.code == 0) { |
|
|
|
_this.goodsInfo.push({ |
|
|
|
isCateShow: false, |
|
|
|
isShow: false, |
|
|
|
style: _this.categoryBtnStyle.default, |
|
|
|
cate: { |
|
|
|
created_at: "", |
|
|
|
erp_goods_cate_brandid: -1, |
|
|
|
erp_goods_cate_name: "搜索", |
|
|
|
id: -1, |
|
|
|
update_at: "", |
|
|
|
}, |
|
|
|
goods_list: [], |
|
|
|
}); |
|
|
|
|
|
|
|
if (!res.list[i].goods_list) { |
|
|
|
res.list[i].goods_list = []; |
|
|
|
for (let i = 0; i < res.data.data.list.length; ++i) { |
|
|
|
if (res.data.data.list[i].cate.erp_goods_cate_name == "热销") { |
|
|
|
_this.categoryIndex = 2; // 如果有热销,那么分类索引值从2开始,前面两项过滤掉(搜索、热销) |
|
|
|
} |
|
|
|
|
|
|
|
if (!res.data.data.list[i].goods_list) { |
|
|
|
res.data.data.list[i].goods_list = []; |
|
|
|
} |
|
|
|
|
|
|
|
res.data.data.list[i].isCateShow = true; |
|
|
|
res.data.data.list[i].isShow = false; |
|
|
|
res.data.data.list[i].style = _this.categoryBtnStyle.default; |
|
|
|
_this.goodsInfo.push(res.data.data.list[i]); |
|
|
|
} |
|
|
|
|
|
|
|
res.list[i].isCateShow = true; |
|
|
|
res.list[i].isShow = false; |
|
|
|
res.list[i].style = _this.categoryBtnStyle.default; |
|
|
|
_this.goodsInfo.push(res.list[i]); |
|
|
|
_this.cartList = []; // 购物车的数据清空,每次切换门店都执行 |
|
|
|
_this.totalCount = 0; |
|
|
|
_this.totalPrice = 0; |
|
|
|
_this.goodsInfo[1].style = _this.categoryBtnStyle.click; |
|
|
|
_this.goodsInfo[1].isShow = true; |
|
|
|
_this.categoryGoTop(); // 分类列表需要滚动至顶部 |
|
|
|
|
|
|
|
util.hideLoad(); |
|
|
|
} |
|
|
|
else { |
|
|
|
util.hideLoad(); |
|
|
|
util.showNone(res.data.message || '操作失败!'); |
|
|
|
} |
|
|
|
|
|
|
|
_this.totalCount = 0; |
|
|
|
_this.totalPrice = 0; |
|
|
|
_this.goodsInfo[1].style = _this.categoryBtnStyle.click; |
|
|
|
_this.goodsInfo[1].isShow = true; |
|
|
|
_this.categoryGoTop(); // 分类列表需要滚动至顶部 |
|
|
|
|
|
|
|
util.hideLoad(); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
@ -599,12 +619,20 @@ export default { |
|
|
|
data: { |
|
|
|
// brand_id: _this.indexData.brand.id |
|
|
|
}, |
|
|
|
isDefaultGet: false, |
|
|
|
failMsg: '加载店铺失败!' |
|
|
|
}).then(res => { |
|
|
|
let _list = res.list || []; |
|
|
|
_this.curStoreList = [..._this.curStoreList, ..._list]; |
|
|
|
_this.curStore = _this.curStoreList[0] || {}; |
|
|
|
_this.getGoodsInfo(); // 获取商品信息 |
|
|
|
if (res.data.code == 0) { |
|
|
|
let _list = res.data.data.list || []; |
|
|
|
_this.curStoreList = [..._this.curStoreList, ..._list]; |
|
|
|
_this.curStore = _this.curStoreList[0] || {}; |
|
|
|
_this.storeListDisabled = _this.curStoreList.length > 1 ? false : true; |
|
|
|
_this.getGoodsInfo(); // 获取商品信息 |
|
|
|
} |
|
|
|
else { |
|
|
|
util.hideLoad(); |
|
|
|
util.showNone(res.data.message || '操作失败!'); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
@ -613,9 +641,10 @@ export default { |
|
|
|
let _this = this; |
|
|
|
let curStoreList = _this.curStoreList; |
|
|
|
_this.curStore = curStoreList[e.detail.value] || {}; |
|
|
|
// _this.$nextTick(function() { |
|
|
|
// _this.getGoodsInfo(); // 获取商品信息 |
|
|
|
// }); |
|
|
|
_this.$nextTick(function() { |
|
|
|
util.showLoad(); |
|
|
|
_this.getGoodsInfo(); // 获取商品信息 |
|
|
|
}); |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|