Browse Source

no message

feature/v1.0
xpz2018 5 years ago
parent
commit
8f6b6a656c
7 changed files with 47 additions and 48 deletions
  1. 2
      api/saas.js
  2. 26
      pages/home/customer-info/index.js
  3. 18
      pages/home/customer-info/index.wxml
  4. 10
      pages/home/customer-list/index.js
  5. 5
      pages/home/customer-list/index.wxml
  6. 24
      pages/login/index.js
  7. 10
      pages/login/index.wxml

2
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,

26
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 => {

18
pages/home/customer-info/index.wxml

@ -9,37 +9,37 @@
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">客户姓名</view>
<view class="text-gray">{{form.factoryCustomerName}}</view>
<view class="text-gray">{{form.name}}</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">手机号码</view>
<view class="text-gray">{{form.factoryCustomerName}}</view>
<view class="text-gray">{{form.mobile}}</view>
</view>
</van-cell>
<van-cell>
<view slot="title" class="flex flex-justify">
<view class="text-black">付款方式</view>
<view class="text-gray">{{form.factoryCustomerName}}</view>
<view class="text-gray">{{form.defaultPaymentMethod == 2 ? '转账' : '现金'}}</view>
</view>
</van-cell>
<van-cell>
<van-cell wx:if="{{form.bankName}}">
<view slot="title" class="flex flex-justify">
<view class="text-black">银行名称</view>
<view class="text-gray">{{form.factoryCustomerName}}</view>
<view class="text-gray">{{form.bankName}}</view>
</view>
</van-cell>
<van-cell>
<van-cell wx:if="{{form.bankCardNo}}">
<view slot="title" class="flex flex-justify">
<view class="text-black">银行卡号</view>
<view class="text-gray">{{form.factoryCustomerName}}</view>
<view class="text-gray">{{form.bankCardNo}}</view>
</view>
</van-cell>
<view style="height:32rpx"></view>
<view style="margin-top:20rpx;padding:40rpx 80rpx">
<van-button block type="default" bind:click="submitForm">邀请注册纸通宝</van-button>
<view style="margin-top:20rpx;padding:48rpx 32rpx">
<van-button block type="default" bind:click="registCustomer">邀请注册纸通宝</van-button>
<view style="height:32rpx"></view>
<van-button block type="info" bind:click="submitForm">保存</van-button>
</view>

10
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()

5
pages/home/customer-list/index.wxml

@ -17,12 +17,13 @@
</view>
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{orderList}}" wx:key="pageIndex">
<van-cell clickable wx:for="{{pageItem}}" wx:key="index">
<view slot="title" class="flex" style="margin-bottom:-12rpx" data-id="{{item.id}}" bindtap="customerInfo">
<view slot="title" class="flex flex-justify" style="margin-bottom:-12rpx" data-id="{{item.id}}" bindtap="customerInfo">
<van-image round width="80rpx" height="80rpx" src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}" />
<view style="margin-left:18rpx;width:100%">
<view style="margin-left:18rpx;width:100%;flex:1">
<view class="text-sg text-bold">{{item.name || ''}}</view>
<view class="text-sm text-gray" style="line-height:32rpx">{{item.mobile || ('卡号:' + item.cardNo)}}</view>
</view>
<view class="text-blue" style="padding:6rpx 0rpx" data-page="{{pageIndex}}" data-index="{{index}}" catchtap="bindCustomer">邀请注册纸通宝</view>
</view>
</van-cell>
</view>

24
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){

10
pages/login/index.wxml

@ -4,15 +4,19 @@
</view>
<view style="padding: 30rpx 80rpx;height:480rpx" wx:if="{{ metaData }}">
<view class="text-xl">欢迎您使用千鸟跟单王!</view>
<view class="text-xl">欢迎您使用纸通宝工厂版!</view>
<view class="text-df" style="padding:20rpx 0rpx" wx:if="{{metaData.qrPage == '/page/index/yaoqing'}}">
<text class="text-df">现邀请您成为<text class="text-bold text-blue">{{metaData.factoryName}}</text>的管理员</text>
</view>
<view class="text-df" style="padding:20rpx 0rpx" wx:elif="{{metaData.qrPage == '/page/index/shenqing'}}">
<text class="text-df">现邀请您成为<text class="text-bold text-blue">{{metaData.factoryName}}</text>的员工</text>
</view>
<view class="text-df" style="padding:20rpx 0rpx" wx:elif="{{metaData.qrPage == '/page/index/shenqing'}}">
<text class="text-df"><text class="text-bold text-blue">{{metaData.factoryName}}</text>邀请您成为纸通宝注册会员</text>
</view>
<input id="userName" style="padding:0rpx 30rpx;border:1rpx solid #eee;height:80rpx;margin-top:64rpx" placeholder-style="color:#aaa"
maxlength="20" placeholder="请输入您的姓名,以便于识别" bindinput="bindInput" disabled="{{loging}}" bindfocus="inputFocus" />
maxlength="20" placeholder="请输入您的姓名,以便于识别" bindinput="bindInput" disabled="{{loging}}" bindfocus="inputFocus"
wx:if="{{ metaData.qrPage == '/page/index/yaoqing' || metaData.qrPage == '/page/index/shenqing' }}"/>
</view>
<view style="padding: 30rpx 80rpx;height:480rpx" wx:elif="{{ regist }}">
<view class="flex">
@ -51,7 +55,7 @@
<view style="margin-top:20rpx;padding:40rpx 80rpx">
<van-button block type="info" loading="{{loging}}" loading-text="提交..." disabled="{{!metaData.userName}}"
bind:click="submitForm" wx:if="{{ metaData }}">提交</van-button>
bind:click="submitForm" wx:if="{{ metaData }}">确定</van-button>
<van-button block type="info" loading="{{loging}}" loading-text="登录中..." disabled="{{loginEnable}}"
bind:click="registAccount" wx:elif="{{ regist }}">登录</van-button>
<van-button block type="info" loading="{{loging}}" loading-text="登录中..." open-type="getUserInfo"

Loading…
Cancel
Save