Browse Source

no message

feature/v2.2
xpz2018 4 years ago
parent
commit
07c4923887
5 changed files with 35 additions and 43 deletions
  1. 15
      pages/home/customer-list/index.js
  2. 2
      pages/home/employee-info/index.js
  3. 28
      pages/home/employee/index.js
  4. 25
      pages/home/qrcode-info/index.js
  5. 8
      pages/home/qrcode-info/index.wxml

15
pages/home/customer-list/index.js

@ -174,9 +174,6 @@ Scene({
this.setData({ searchList: result, loading: false }) this.setData({ searchList: result, loading: false })
} }
}, },
// onSearch: function(){
// this.onRefreshList()
// },
customerInfo: function(e){ customerInfo: function(e){
var item = null var item = null
if(util.isEmpty(this.data.form.name)){ if(util.isEmpty(this.data.form.name)){
@ -207,18 +204,6 @@ Scene({
} }
wx.navigateTo({ url: `/pages/home/registe/index?id=${item.id}` }) wx.navigateTo({ url: `/pages/home/registe/index?id=${item.id}` })
}, },
qrcodeCustomer: function(e){
var item = null
if(util.isEmpty(this.data.form.name)){
this.data.page = e.currentTarget.dataset.page
this.data.index = e.currentTarget.dataset.index
item = this.data.orderList[e.currentTarget.dataset.page].data[e.currentTarget.dataset.index]
} else {
this.data.index = e.currentTarget.dataset.index
item = this.data.searchList[e.currentTarget.dataset.index]
}
wx.navigateTo({ url: `/pages/home/qrcode-info/index?id=${item.id}&userId=${item.userId}` })
},
addCustomer: function(){ addCustomer: function(){
wx.navigateTo({ url: `/pages/home/customer-info/index?` }) wx.navigateTo({ url: `/pages/home/customer-info/index?` })
}, },

2
pages/home/employee-info/index.js

@ -24,7 +24,7 @@ Scene({
if(options.id){ if(options.id){
let channel = this.getOpenerEventChannel() let channel = this.getOpenerEventChannel()
let that = this let that = this
channel.on('onParam', function (data) {
channel.once('onParam', function (data) {
if(data.enterpriseRoleIds && data.enterpriseRoleIds.indexOf(',') > 0){ if(data.enterpriseRoleIds && data.enterpriseRoleIds.indexOf(',') > 0){
data.enterpriseRoleIds = data.enterpriseRoleIds.split(',') data.enterpriseRoleIds = data.enterpriseRoleIds.split(',')
} else if(data.enterpriseRoleIds && !Array.isArray(data.enterpriseRoleIds)){ } else if(data.enterpriseRoleIds && !Array.isArray(data.enterpriseRoleIds)){

28
pages/home/employee/index.js

@ -2,6 +2,7 @@
import Scene from '../../index/scene' import Scene from '../../index/scene'
import { getCheckList, auditEmploye, createQrcode } from "../../../api/user" import { getCheckList, auditEmploye, createQrcode } from "../../../api/user"
import { getEmployeList } from "../../../api/saas" import { getEmployeList } from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util') const util = require('../../../utils/util')
const app = getApp() const app = getApp()
@ -25,6 +26,7 @@ Scene({
if(options.type){ if(options.type){
this.data.type = Number(options.type) this.data.type = Number(options.type)
} }
event.on('EventMessage', this, this.onEvent)
this.setData({ height: app.globalData.fragmentHeight }) this.setData({ height: app.globalData.fragmentHeight })
this.fetchMemberList() this.fetchMemberList()
if(this.data.type == 0){ if(this.data.type == 0){
@ -37,6 +39,11 @@ Scene({
}) })
} }
}, },
onEvent: function(message){
if (message.what == 120) {
this.fetchMemberList()
}
},
fetchMemberList: function(){ fetchMemberList: function(){
wx.showLoading({ title: '加载中', mask: true }) wx.showLoading({ title: '加载中', mask: true })
if(this.data.type == 0){ if(this.data.type == 0){
@ -55,7 +62,6 @@ Scene({
}) })
}, },
lookItem: function(e){ lookItem: function(e){
var that = this
this.data.nowIndex = e.currentTarget.dataset.index this.data.nowIndex = e.currentTarget.dataset.index
var item = this.data.memberList[this.data.nowIndex] var item = this.data.memberList[this.data.nowIndex]
if(this.data.type){ if(this.data.type){
@ -64,14 +70,7 @@ Scene({
wx.navigateBack() wx.navigateBack()
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: `/pages/home/employee-info/index?id=${item.enterpriseMemberId}`,
events: {
onCallback: (data) => {
if (data.what == 120) {
that.fetchMemberList()
}
}
},
url: `/pages/home/employee-info/index?type=1&id=${item.enterpriseMemberId}`,
success: function(res) { success: function(res) {
res.eventChannel.emit('onParam', item) res.eventChannel.emit('onParam', item)
} }
@ -79,18 +78,10 @@ Scene({
} }
}, },
agreeItem: function(e){ agreeItem: function(e){
var that = this
this.data.nowIndex = e.currentTarget.dataset.index this.data.nowIndex = e.currentTarget.dataset.index
var item = this.data.checkList[this.data.nowIndex] var item = this.data.checkList[this.data.nowIndex]
wx.navigateTo({ wx.navigateTo({
url: `/pages/home/employee-info/index?id=${item.enterpriseMemberId}`, url: `/pages/home/employee-info/index?id=${item.enterpriseMemberId}`,
events: {
onCallback: (data) => {
if (data.what == 120) {
that.fetchMemberList()
}
}
},
success: function(res) { success: function(res) {
res.eventChannel.emit('onParam', item) res.eventChannel.emit('onParam', item)
} }
@ -113,5 +104,8 @@ Scene({
imageUrl: 'https://img.imgdb.cn/item/607660278322e6675ccd9960.png', imageUrl: 'https://img.imgdb.cn/item/607660278322e6675ccd9960.png',
path: `pages/login/index?qrcode=${this.data.qrcode}` path: `pages/login/index?qrcode=${this.data.qrcode}`
} }
},
onUnload: function(){
event.remove('EventMessage', this)
} }
}) })

25
pages/home/qrcode-info/index.js

@ -15,7 +15,7 @@ Scene({
type: 0, type: 0,
id: null, id: null,
userId: null, userId: null,
form: null,
form: null
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
@ -30,7 +30,12 @@ Scene({
if(this.data.type == 0){ if(this.data.type == 0){
this.fetchCustomerInfo() this.fetchCustomerInfo()
} else if(this.data.type == 1){ } else if(this.data.type == 1){
this.fetchEmplyeeInfo()
let channel = this.getOpenerEventChannel()
let that = this
channel.once('onParam', function (data) {
that.setData({ form: data, type: that.data.type })
that.showQrCode(`?mark=ztb_saas&QrCodeRecordId=${that.data.id}` )
})
} }
} }
event.on('EventMessage', this, this.onEvent) event.on('EventMessage', this, this.onEvent)
@ -41,8 +46,6 @@ Scene({
} else if (message.what == 102) { } else if (message.what == 102) {
if(this.data.type == 0){ if(this.data.type == 0){
this.fetchCustomerInfo() this.fetchCustomerInfo()
} else if(this.data.type == 1){
this.fetchEmplyeeInfo()
} }
} }
}, },
@ -89,8 +92,18 @@ Scene({
} }
}) })
}, },
customerInfo: function(){
wx.navigateTo({ url: `/pages/home/customer-info/index?id=${this.data.id}&userId=${this.data.userId}` })
toDetail: function(){
if(this.data.type == 0){
wx.navigateTo({ url: `/pages/home/customer-info/index?id=${this.data.id}&userId=${this.data.userId}` })
} else if(this.data.type == 1){
var that = this
wx.navigateTo({
url: `/pages/home/employee-info/index?id=${this.data.id}`,
success: function(res) {
res.eventChannel.emit('onParam', that.data.form)
}
})
}
}, },
onUnload: function(){ onUnload: function(){
event.remove('EventMessage', this) event.remove('EventMessage', this)

8
pages/home/qrcode-info/index.wxml

@ -1,15 +1,15 @@
<cu-custom bgColor="bg-white" isBack="{{true}}"> <cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">客户二维码</view>
<view slot="content">{{type == 0 ? '客户' : '员工'}}二维码</view>
</cu-custom> </cu-custom>
<view style="padding:32rpx;margin-top:64rpx" wx:if="{{form}}"> <view style="padding:32rpx;margin-top:64rpx" wx:if="{{form}}">
<van-cell clickable is-link> <van-cell clickable is-link>
<view slot="title" class="flex flex-justify" style="width:100%" bindtap="customerInfo">
<view slot="title" class="flex flex-justify" style="width:100%" bindtap="toDetail">
<van-image round width="80rpx" height="80rpx" src="{{'/assets/image/ygImg.png' }}" /> <van-image round width="80rpx" height="80rpx" src="{{'/assets/image/ygImg.png' }}" />
<view style="width:100%;flex:1;margin-left: 18rpx"> <view style="width:100%;flex:1;margin-left: 18rpx">
<view class="text-sg text-bold">{{form.name || ''}}</view>
<view class="text-sg text-bold">{{form.name || form.enterpriseMemberName || ''}}</view>
<view class="text-sm text-gray" style="line-height:32rpx;height:32rpx"> <view class="text-sm text-gray" style="line-height:32rpx;height:32rpx">
<text>联系电话:{{form.mobile}}</text>
<text>联系电话:{{form.mobile || form.phone}}</text>
</view> </view>
</view> </view>
</view> </view>

Loading…
Cancel
Save