diff --git a/api/saas.js b/api/saas.js index 48baa38..bbc1598 100644 --- a/api/saas.js +++ b/api/saas.js @@ -32,7 +32,7 @@ const updatePaperPrice = (params) => mPost(`/ztb-factory/factory/update/product- const getCustomerList = (params) => mGet(`/ztb-factory/factory/get/customer-list`, params, sconfig) const editCustomer = (params) => mPost(`/ztb-factory/factory/edit/customer`, params, sconfig) const deleteCustomer = (id) => mPost(`/ztb-factory/factory/delete/customer/${id}`, null, sconfig) -const getCustomerInfo = (id) => mPost(`/ztb-factory/factory/wechat-applet/get/customer-detail/${id}`, null, sconfig) +const getCustomerInfo = (id) => mGet(`/ztb-factory/factory/wechat-applet/get/customer-detail/${id}`, null, sconfig) export { sconfig, diff --git a/pages/home/customer-info/index.js b/pages/home/customer-info/index.js index b04e577..15a6863 100644 --- a/pages/home/customer-info/index.js +++ b/pages/home/customer-info/index.js @@ -1,10 +1,15 @@ // pages/home/customer-info/index.js -Page({ +import { generateCode } from "../../../api/user" +import { getCustomerInfo } from "../../../api/saas" +const util = require('../../../utils/util') +const app = getApp() +Page({ /** * 页面的初始数据 */ data: { + form: null, base64: null, showEmbedded: false }, @@ -12,16 +17,25 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - + if(options.id){ + wx.showLoading({ title: '正在获取', mask: true }) + getCustomerInfo(options.id).then(result => { + wx.hideLoading() + this.setData({ form: result.data }) + }).catch(err => { + wx.hideLoading() + util.showToast(err) + }) + } }, onClickHideEmbedded: function(){ this.setData({ showEmbedded: false }) }, - addEmployee: function(event){ + registCustomer: function(){ wx.showLoading({ title: '加载中', mask: true }) - const form = { id: 5 } - form.metaData = { factoryId: app.userInfo.factoryId, factoryName: app.userInfo.factoryName } - generateCode(form).then(result => { + const params = { id: 6 } + params.metaData = { factoryId: app.userInfo.factoryId, factoryName: app.userInfo.factoryName, factoryCustomerId: this.data.form.id } + generateCode(params).then(result => { this.setData({ showEmbedded: true, base64: result.data }) wx.hideLoading() }).catch(err => { diff --git a/pages/home/customer-info/index.wxml b/pages/home/customer-info/index.wxml index 5ddd8d0..a72ecc1 100644 --- a/pages/home/customer-info/index.wxml +++ b/pages/home/customer-info/index.wxml @@ -9,37 +9,37 @@ 客户姓名 - {{form.factoryCustomerName}} + {{form.name}} 手机号码 - {{form.factoryCustomerName}} + {{form.mobile}} 付款方式 - {{form.factoryCustomerName}} + {{form.defaultPaymentMethod == 2 ? '转账' : '现金'}} - + 银行名称 - {{form.factoryCustomerName}} + {{form.bankName}} - + 银行卡号 - {{form.factoryCustomerName}} + {{form.bankCardNo}} - - 邀请注册纸通宝 + + 邀请注册纸通宝 保存 diff --git a/pages/home/customer-list/index.js b/pages/home/customer-list/index.js index f44d6d6..84631d1 100644 --- a/pages/home/customer-list/index.js +++ b/pages/home/customer-list/index.js @@ -1,4 +1,5 @@ // pages/home/customer/index.js +import { generateCode } from "../../../api/user" import { getCustomerList } from "../../../api/saas" const util = require('../../../utils/util') const app = getApp() @@ -87,15 +88,16 @@ Page({ this.onRefreshList() }, customerInfo: function(e){ - wx.navigateTo({ url: '/pages/process/customer-info/index?id=' + e.currentTarget.dataset.id }) + wx.navigateTo({ url: '/pages/home/customer-info/index?id=' + e.currentTarget.dataset.id }) }, onClickHideEmbedded: function(){ this.setData({ showEmbedded: false }) }, - addEmployee: function(event){ + bindCustomer: function(e){ + var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] wx.showLoading({ title: '加载中', mask: true }) - const form = { id: 5 } - form.metaData = { factoryId: app.userInfo.factoryId, factoryName: app.userInfo.factoryName } + const form = { id: 6 } + form.metaData = { factoryId: app.userInfo.factoryId, factoryName: app.userInfo.factoryName, factoryCustomerId: item.id } generateCode(form).then(result => { this.setData({ showEmbedded: true, base64: result.data }) wx.hideLoading() diff --git a/pages/home/customer-list/index.wxml b/pages/home/customer-list/index.wxml index c9e3607..62bff39 100644 --- a/pages/home/customer-list/index.wxml +++ b/pages/home/customer-list/index.wxml @@ -17,12 +17,13 @@ - + - + {{item.name || ''}} {{item.mobile || ('卡号:' + item.cardNo)}} + 邀请注册纸通宝 diff --git a/pages/login/index.js b/pages/login/index.js index 8337c0c..4257575 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -106,34 +106,12 @@ Page({ // 这里要进行账号的绑定,对工厂进行绑定;或者进行申请操作; this.setData({ loging: false, metaData: this.data.metaData }) } else { - if(app.userInfo.isSaasPerssion){ + if(app.userInfo.factoryId){ wx.redirectTo({ url: '/pages/index/index' }) } else { wx.redirectTo({ url: '/pages/client/index/index' }) } } - // if(app.userInfo.enterpriseId){ - // storage.put('Authorization', app.globalData.token) - // this.setData({ loging: false}) - // if(this.data.metaData && app.userInfo.factoryId != this.data.metaData.factoryId){ - // Dialog.alert({ title: '温馨提示', message: '您已经绑定过工厂了,现在就进入?' }).then(() => { - // wx.redirectTo({ url: '/pages/index/index' }) - // }) - // } else { - // wx.redirectTo({ url: '/pages/index/index' }) - // } - // } else if(this.data.metaData){ - // // 这里要进行账号的绑定,对工厂进行绑定;或者进行申请操作; - // this.setData({ loging: false, metaData: this.data.metaData }) - // } else if(app.userInfo.applicationStatus == 0){ - // this.setData({ loging: false}) - // Dialog.alert({ title: '温馨提示', message: '您的申请还在审核中,如有疑问请联系管理员。' }).then(() => { - // }) - // } else { - // this.setData({ loging: false}) - // Dialog.alert({ title: '温馨提示', message: '您还不是纸通宝SAAS用户,请联系工厂管理员,或者联系纸通宝客户人员。' }).then(() => { - // }) - // } }).catch(err => { wx.hideLoading() if(err.code == 400){ diff --git a/pages/login/index.wxml b/pages/login/index.wxml index 242f90d..cd7d9ab 100644 --- a/pages/login/index.wxml +++ b/pages/login/index.wxml @@ -4,15 +4,19 @@ - 欢迎您使用千鸟跟单王! + 欢迎您使用纸通宝工厂版! 现邀请您成为{{metaData.factoryName}}的管理员 现邀请您成为{{metaData.factoryName}}的员工 + + {{metaData.factoryName}}邀请您成为纸通宝注册会员 + + maxlength="20" placeholder="请输入您的姓名,以便于识别" bindinput="bindInput" disabled="{{loging}}" bindfocus="inputFocus" + wx:if="{{ metaData.qrPage == '/page/index/yaoqing' || metaData.qrPage == '/page/index/shenqing' }}"/> @@ -51,7 +55,7 @@ 提交 + bind:click="submitForm" wx:if="{{ metaData }}">确定 登录