From 6b72b3bf5f1e783c7f31684513317641b6a6e174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=AE=B6=E5=8D=8E?= <3599164049@qq.com> Date: Mon, 19 Apr 2021 16:04:24 +0800 Subject: [PATCH] update --- src/pages/index/index.vue | 2 +- .../retail/pages/confirm_goods/confirm_goods.vue | 20 +++-- src/subpackage/retail/pages/index/index.vue | 97 ++++++++++++---------- src/subpackage/retail/pages/search/search.vue | 76 ++++++++--------- 4 files changed, 101 insertions(+), 94 deletions(-) diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue index 22a34cc..29474ae 100644 --- a/src/pages/index/index.vue +++ b/src/pages/index/index.vue @@ -115,7 +115,7 @@ id: 7, name: '商品零售', path: '/subpackage/retail/pages/index/index', - serverKey: 1011 // 后端对应权限编号 + serverKey: 1010 // 后端对应权限编号 } ]; diff --git a/src/subpackage/retail/pages/confirm_goods/confirm_goods.vue b/src/subpackage/retail/pages/confirm_goods/confirm_goods.vue index f83eca3..e280f05 100644 --- a/src/subpackage/retail/pages/confirm_goods/confirm_goods.vue +++ b/src/subpackage/retail/pages/confirm_goods/confirm_goods.vue @@ -109,11 +109,7 @@ } if (!data.length) { - uni.showToast({ - title: "暂无商品数量!", - icon: "none" - }); - + util.showNone("暂无商品数量!"); return; } @@ -124,12 +120,18 @@ store_id: _this.curStore.id, goods_data: data, }, + isDefaultGet: false, failMsg: '出库失败!' }).then(res => { - util.hideLoad(); - uni.navigateBack({ - delta: 1 - }); + if (res.data.code == 0) { + util.hideLoad(); + uni.navigateBack({ + delta: 1 + }); + } + else { + util.showNone(res.data.message || '操作失败!'); + } }); }, diff --git a/src/subpackage/retail/pages/index/index.vue b/src/subpackage/retail/pages/index/index.vue index 4be3b3b..e6b7ef5 100644 --- a/src/subpackage/retail/pages/index/index.vue +++ b/src/subpackage/retail/pages/index/index.vue @@ -7,6 +7,7 @@ range-key="name" :range="curStoreList" value="0" + :disabled="storeListDisabled" > @@ -20,7 +21,7 @@ @@ -106,6 +107,7 @@ export default { // curStoreList: [{ id: '', name: '请选择门店'}], // 当前门店列表 indexData: {}, // 首页 统计数据 curStoreList: [], // 当前门店列表 + storeListDisabled: false, // 当前门店列表禁用状态 curStore: {}, // 当前门店 goodsInfo: [], // 商品信息 mainHeight: "0rpx", // 主内容高度 @@ -317,10 +319,7 @@ export default { }); } else { - uni.showToast({ - title: "购物车无数据!", - icon: "none" - }); + util.showNone("购物车无数据!"); } }, @@ -547,45 +546,51 @@ export default { data: { // brand_id: _this.indexData.brand.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.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 +604,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 || '操作失败!'); + } }); }, diff --git a/src/subpackage/retail/pages/search/search.vue b/src/subpackage/retail/pages/search/search.vue index fee4490..0947c81 100644 --- a/src/subpackage/retail/pages/search/search.vue +++ b/src/subpackage/retail/pages/search/search.vue @@ -5,7 +5,7 @@ @@ -45,11 +45,7 @@ // 删除历史搜索 searchHistoryDelete() { if (this.historyList.length <= 0) { - uni.showToast({ - title: "暂无历史数据!", - icon: "none" - }) - + util.showNone("暂无历史数据!"); return; } @@ -83,11 +79,7 @@ // 触发搜索 searchTrigger(text, type) { if (!text) { - uni.showToast({ - title: "请输入商品名称!", - icon: "none" - }); - + util.showNone("请输入商品名称、sku"); return; } @@ -113,42 +105,42 @@ data: { assistant_key: text }, + isDefaultGet: false, failMsg: '搜索失败!' }).then(res => { - let mark = false; - for (let i = 0; i < res.list.length; ++i) { - if (res.list[i].goods_list) { - mark = true; + if (res.data.code == 0) { + let mark = false; + for (let i = 0; i < res.data.data.list.length; ++i) { + if (res.data.data.list[i].goods_list) { + mark = true; + } } - } - - // 没数据 - if (!mark) { - uni.showToast({ - title: "暂无数据", - icon: "none" + + // 没数据 + if (!mark) { + util.showNone("暂无数据"); + return; + } + + uni.setStorage({ + key: "searchData", + data: res.data.data.list, + success: function() { + util.hideLoad(); + + // 有数据的话就返回到上一页面,加载对应数据 + uni.navigateBack({ + delta: 1 + }); + }, + fail: function(err) { + util.showNone("搜索失败"); + }, }); - return; } - - uni.setStorage({ - key: "searchData", - data: res.list, - success: function() { - util.hideLoad(); - - // 有数据的话就返回到上一页面,加载对应数据 - uni.navigateBack({ - delta: 1 - }); - }, - fail: function(err) { - uni.showToast({ - title: "搜索失败", - icon: "none" - }); - }, - }); + else { + util.showNone(res.data.message || '操作失败!'); + } }); },