Commit d79cc5bb by 张立顺

bug修复

1 parent 6edf27d7
import { import { checkLoginUserInfo, setRouteData, setLoginInfo, loginModal } from '../lib/index'
checkLoginUserInfo, import { getSessionId } from '~/utils/cache/storageApi'
setRouteData,
setLoginInfo,
loginModal
} from '../lib/index'
import {
getSessionId,
} from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index' import USERAPI from '~/api/usersApi/index'
import { IMG_URL } from '~/utils/constantData'
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
IMG_URL
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad(options) { onLoad(options) {},
},
/** /**
* 生命周期函数--监听页面初次渲染完成 * 生命周期函数--监听页面初次渲染完成
*/ */
onReady() { onReady() {},
},
/** /**
* 生命周期函数--监听页面显示 * 生命周期函数--监听页面显示
...@@ -39,9 +27,7 @@ Page({ ...@@ -39,9 +27,7 @@ Page({
const appEnter = wx.getEnterOptionsSync() const appEnter = wx.getEnterOptionsSync()
if (appEnter.scene == 1037) { if (appEnter.scene == 1037) {
if (Object.keys(appEnter.referrerInfo).length) { if (Object.keys(appEnter.referrerInfo).length) {
const { const { extraData } = appEnter.referrerInfo
extraData
} = appEnter.referrerInfo
if (extraData && Object.keys(extraData).length) this.phoneSmsLogin(extraData) if (extraData && Object.keys(extraData).length) this.phoneSmsLogin(extraData)
else this.init() else this.init()
} else this.init() } else this.init()
...@@ -51,44 +37,31 @@ Page({ ...@@ -51,44 +37,31 @@ Page({
/** /**
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide() { onHide() {},
},
/** /**
* 生命周期函数--监听页面卸载 * 生命周期函数--监听页面卸载
*/ */
onUnload() { onUnload() {},
},
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
onPullDownRefresh() { onPullDownRefresh() {},
},
/** /**
* 页面上拉触底事件的处理函数 * 页面上拉触底事件的处理函数
*/ */
onReachBottom() { onReachBottom() {},
},
init() { init() {
wx.nextTick(() => { wx.nextTick(() => {
const sessionId = getSessionId(), const sessionId = getSessionId(),
{ { url, targetPath = url ? decodeURIComponent(url) : '' } = this.options
url,
targetPath = url ? decodeURIComponent(url) : ''
} = this.options
let path = 'pages.index', let path = 'pages.index',
obj = {} obj = {}
if (targetPath) obj.targetPath = targetPath if (targetPath) obj.targetPath = targetPath
if (sessionId) { if (sessionId) {
USERAPI.checkSession().then(({ USERAPI.checkSession().then(({ code }) => {
code
}) => {
if (code == '0') { if (code == '0') {
if (targetPath) { if (targetPath) {
path = setRouteData(targetPath).url path = setRouteData(targetPath).url
...@@ -103,25 +76,14 @@ Page({ ...@@ -103,25 +76,14 @@ Page({
autoLogin(obj) { autoLogin(obj) {
const autoLoginObject = wx.$storage.get('auto_login_object') const autoLoginObject = wx.$storage.get('auto_login_object')
if (autoLoginObject) { if (autoLoginObject) {
const { const { failureTime, userName, password } = autoLoginObject
failureTime,
userName,
password
} = autoLoginObject
if (Date.now() < failureTime) { if (Date.now() < failureTime) {
USERAPI.accountLogin({ USERAPI.accountLogin({
userName, userName,
password password
}).then(async ({ }).then(async ({ data, code, message }) => {
data,
code,
message
}) => {
if (code == '0' && data.loginUserInfoList.length) { if (code == '0' && data.loginUserInfoList.length) {
const { const { sessionId, loginUserInfoList } = data
sessionId,
loginUserInfoList
} = data
setLoginInfo(loginUserInfoList[0], sessionId) setLoginInfo(loginUserInfoList[0], sessionId)
} else { } else {
try { try {
...@@ -142,13 +104,10 @@ Page({ ...@@ -142,13 +104,10 @@ Page({
phoneSmsLogin(extraData) { phoneSmsLogin(extraData) {
console.log(extraData) console.log(extraData)
USERAPI.phoneSmsLogin({ USERAPI.phoneSmsLogin({
mobile: extraData.phone, mobile: extraData.phone,
code: extraData.smscode code: extraData.smscode
}).then(({ })
code, .then(({ code, data, message }) => {
data,
message
}) => {
if (code == '0') checkLoginUserInfo(data) if (code == '0') checkLoginUserInfo(data)
else { else {
wx.$api.showToast(message || '系统异常') wx.$api.showToast(message || '系统异常')
...@@ -164,4 +123,4 @@ Page({ ...@@ -164,4 +123,4 @@ Page({
}, 1e3) }, 1e3)
}) })
} }
})
\ No newline at end of file \ No newline at end of file
})
...@@ -10,6 +10,13 @@ const listObj = Object.freeze([ ...@@ -10,6 +10,13 @@ const listObj = Object.freeze([
editLabel: '商户号' editLabel: '商户号'
}, },
{ {
key: 'actualContactName',
label: '商户账号:'
// placeholder: '请输入您的商户账号',
// editLabel: '商户账号',
// maxLength: 20
},
{
key: 'merchantName', key: 'merchantName',
label: '门店名称:', label: '门店名称:',
placeholder: '请输入您的客户门店简称', placeholder: '请输入您的客户门店简称',
...@@ -128,12 +135,15 @@ Component({ ...@@ -128,12 +135,15 @@ Component({
.then(result => { .then(result => {
console.log(result) console.log(result)
let { pages, list, total } = result let { pages, list, total } = result
console.log(list)
list = list.map(item => { list = list.map(item => {
item.merchantName = item.merchantName || item.actualMerchantName item.merchantName = item.merchantName || item.actualMerchantName
item.phone = item.phone || item.actualPhone item.phone = item.phone || item.actualPhone
item.contactName = item.contactName || item.actualContactName // || item.actualContactName
item.contactName = item.contactName || item.actualAccountName
return item return item
}) })
console.log(list)
this.setData({ this.setData({
customerList: pageNum == 1 ? list : [...customerList, ...list], customerList: pageNum == 1 ? list : [...customerList, ...list],
triggered: false, triggered: false,
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
}, },
{ {
"name": "客户管理", "name": "客户管理",
"pathName": "pages/mineDetail/customerManagement/customerManagement", "pathName": "packagesList/mineDetail/pages/customerManagement",
"query": "", "query": "",
"launchMode": "default", "launchMode": "default",
"scene": null "scene": null
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!