Browse Source

电子卡

feature/v2.2
xpz2018 4 years ago
parent
commit
584860f100
5 changed files with 13 additions and 41 deletions
  1. 2
      app.js
  2. 32
      pages/home/customer-list/index.wxml
  3. 7
      pages/home/qrcode-info/index.js
  4. 8
      pages/home/qrcode-info/index.wxml
  5. 5
      pages/home/qrcode-info/index.wxss

2
app.js

@ -2,7 +2,7 @@
App({
evn: 2, // 0: 开发版本;1:测试版本;2:生产版本
tmplIds: ['AFoM5TOfsgERsfcetNSB0UlmEixnLF1ySXr54Bqno2M', 'lOQ8Gvyy_dTk68bYGpRVnVA0M7DsYYrV81Gd39GUPBA'],
version: '2.3.3',
version: '2.4.0',
xAppId: '503258978847953926',
userInfo: null,
//----------------------------------------------globalData--------------------------------------

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

@ -3,38 +3,6 @@
<view slot="content">客户列表</view>
</cu-custom>
<!-- <van-search value="{{ form.name }}" shape="round" placeholder="请输入名字或者电话号码" use-action-slot bind:change="onChange">
<view slot="action" bind:tap="onSearch" style="padding: 0rpx 8rpx">搜索</view>
</van-search> -->
<!-- <refresh-view id="refresh" height="{{height}}" bind:refresh="onRefreshList" bind:loadmore="fetchCustomerList">
<view class="list-empty" style="height:{{height}}rpx" wx:if="{{!orderList.length}}">
<view style="margin-bottom:24px" wx:if="{{loading}}">
<van-loading type="spinner" size="32" />
</view>
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image>
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view>
</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 flex-justify" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="customerInfo">
<van-image round width="80rpx" height="80rpx" src="{{ item.avatarUrl || '/assets/image/ygImg.png' }}" />
<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;height:32rpx">
<text wx:if="{{item.mobile}}">{{'电话号码:' + item.mobile}}</text>
<text wx:elif="{{item.cardNo}}">{{'卡号:' + item.cardNo}}</text>
</view>
</view>
<view class="text-blue" style="padding:6rpx 0rpx" data-page="{{pageIndex}}" data-index="{{index}}"
catchtap="bindCustomer" wx:if="{{!item.userId}}">注册纸通宝</view>
</view>
</van-cell>
</view>
<van-divider content-position="center" wx:if="{{ form.pageNum > 1}}" custom-style="padding:0rpx 120rpx">
<van-loading type="spinner" size="16" wx:if="{{!finished}}" />
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text>
</van-divider>
</refresh-view> -->
<van-search value="{{ form.name }}" disabled="{{!orderList.length}}" shape="round" placeholder="请输入名字或者电话号码" use-action-slot bind:change="onChange">
<!-- <van-button slot="action" plain type="info" size="small" bind:click="addCustomer">添加客户</van-button> -->
<view slot="action" bind:tap="onChange" style="padding: 0rpx 8rpx" wx:if="{{form.name}}">取消</view>

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

@ -5,6 +5,7 @@ const util = require('../../../utils/util')
const event = require('../../../utils/event')
const qrCode = require('../../../utils/weapp-qrcode')
const app = getApp()
const qrUrl = 'https://apicloudprint.qniao.cn/cloud-print-user-center/verify/qrcode'
Scene({
/**
@ -27,9 +28,10 @@ Scene({
this.data.type = Number(options.type)
}
if(this.data.type == 0){
this.showQrCode(`${qrUrl}?mark=ztb_saas&type=${this.data.type}&factoryId=${app.userInfo.factoryId}&customerId=${this.data.id}`)
this.fetchCustomerInfo()
} else if(this.data.type == 1){
this.showQrCode(`?mark=ztb_saas&type=${this.data.type}&userId=${this.data.id}` )
this.showQrCode(`${qrUrl}?mark=ztb_saas&type=${this.data.type}&factoryId=${app.userInfo.factoryId}&customerId=${this.data.id}`)
let channel = this.getOpenerEventChannel()
let that = this
channel.once('onParam', function (data) {
@ -53,9 +55,8 @@ Scene({
fetchCustomerInfo: function(){
wx.showLoading({ title: '正在获取', mask: true })
getCustomerInfo(this.data.id).then(result => {
wx.hideLoading()
this.setData({ form: result.data, type: this.data.type })
this.showQrCode(`?mark=ztb_saas&type=${this.data.type}&userId=${this.data.id}` )
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
util.showToast(err)

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

@ -1,9 +1,9 @@
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">{{type == 0 ? '客户' : '员工'}}二维码</view>
<view slot="content">{{type == 0 ? '客户' : '员工'}}电子卡</view>
</cu-custom>
<view style="padding:32rpx;margin-top:64rpx" wx:if="{{form}}">
<van-cell clickable is-link>
<view style="padding:32rpx;margin-top:72rpx;border-radius: 20rpx" wx:if="{{form}}">
<van-cell clickable is-link custom-class="group-top">
<view slot="title" class="flex flex-justify" style="width:100%" bindtap="lookDetail">
<van-image round width="80rpx" height="80rpx" src="{{'/assets/image/ygImg.png' }}" />
<view style="width:100%;flex:1;margin-left: 18rpx">
@ -14,7 +14,7 @@
</view>
</view>
</van-cell>
<view class="bg-white flex flex-center" style="padding:48rpx 32rpx;" bindtap="previewImage">
<view class="bg-white flex flex-center" style="padding:48rpx 32rpx;border-radius: 0rpx 0rpx 20rpx 20rpx" bindtap="previewImage">
<canvas style="width:600rpx; height:600rpx;" canvas-id="van-qrcode"></canvas>
</view>
</view>

5
pages/home/qrcode-info/index.wxss

@ -1 +1,4 @@
/* pages/home/customer-info/index.wxss */
/* pages/home/customer-info/index.wxss */
.group-top{
border-radius: 20rpx 20rpx 0rpx 0rpx;
}
Loading…
Cancel
Save