Commit 5db0eaa5 by 杨北旺

添加异常处理

1 parent 3d5b679e
import { preReleaseAppId } from '~/config' import { preReleaseAppId } from '~/config'
const target = ['ip', 'dev', 'uat', 'prod', 'preRelease'] const target = ['ip', 'dev', 'uat', 'prod', 'preRelease']
let index = 2 let index = 3
/** /**
* *
......
...@@ -234,6 +234,6 @@ module.exports = { ...@@ -234,6 +234,6 @@ module.exports = {
return api.post({ return api.post({
method: `scrm.api.shopmall.weapp.merchant.detail.list`, method: `scrm.api.shopmall.weapp.merchant.detail.list`,
...data ...data
}) },true)
}, },
}; };
import { IMG_URL } from '~/config'; import { IMG_URL } from '~/config';
import { env } from '~/api/env/index' import { env } from '~/api/env/index'
import { MERCHANT_STATIC_LIST} from '~/utils/constants' import { MERCHANT_STATIC_LIST } from '~/utils/constants'
Component({ Component({
properties: { properties: {
show:{ show: {
type:Boolean, type: Boolean,
observer(n) { observer(n) {
if (n) this.getMerchantList() if (n) this.getMerchantList()
} }
...@@ -36,8 +36,9 @@ Component({ ...@@ -36,8 +36,9 @@ Component({
}, },
// 获取门店信息 // 获取门店信息
async getMerchantList() { async getMerchantList() {
const have_enter = this.checkFirst() const have_enter = this.checkFirst()
if(have_enter)return if (have_enter) return
// 获取mock配置门店 // 获取mock配置门店
const MOCKDATA = wx.p.storage.get("mock_data"); const MOCKDATA = wx.p.storage.get("mock_data");
let MerchantList = MERCHANT_STATIC_LIST[env] let MerchantList = MERCHANT_STATIC_LIST[env]
...@@ -48,7 +49,9 @@ Component({ ...@@ -48,7 +49,9 @@ Component({
} }
} }
let storeList = [], index = 0 let storeList = [], index = 0
try {
storeList = await this.getMerchantListData(MerchantList) storeList = await this.getMerchantListData(MerchantList)
if(!storeList) throw false
storeList.forEach((ele, i) => { storeList.forEach((ele, i) => {
ele.merchantId = ele.merchantNo ele.merchantId = ele.merchantNo
if (this.defaultMerchant == ele.merchantId) { if (this.defaultMerchant == ele.merchantId) {
...@@ -57,8 +60,14 @@ Component({ ...@@ -57,8 +60,14 @@ Component({
}) })
this.setData({ this.setData({
storeList, storeList,
show:true show: true
}) })
} catch (error) {
this.setData({
storeList:[],
show: false
})
}
}, },
// 选择门店 // 选择门店
toSelect(e) { toSelect(e) {
...@@ -78,7 +87,8 @@ Component({ ...@@ -78,7 +87,8 @@ Component({
// 获取门店列表 // 获取门店列表
async getMerchantListData(merchantIdList) { async getMerchantListData(merchantIdList) {
const res = await wx.p.api.shopmallApi.getStoreList({ merchantIdList }) const res = await wx.p.api.shopmallApi.getStoreList({ merchantIdList })
return res || [] if (res.code == 0) return res.data
else return false
}, },
}, },
lifetimes: { lifetimes: {
......
...@@ -185,7 +185,8 @@ Page({ ...@@ -185,7 +185,8 @@ Page({
// 获取门店列表 // 获取门店列表
async getMerchantListData(merchantIdList) { async getMerchantListData(merchantIdList) {
const res = await wx.p.api.shopmallApi.getStoreList({ merchantIdList }) const res = await wx.p.api.shopmallApi.getStoreList({ merchantIdList })
return res || [] if(res.code==0) return res.data
else return false
}, },
// 获取选择门店的信息 // 获取选择门店的信息
getMerchantIdDetail(merchantId) { getMerchantIdDetail(merchantId) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!