Browse Source

no message

feature/v1.0
xpz2018 5 years ago
parent
commit
4016911537
24 changed files with 717 additions and 192 deletions
  1. 35
      api/payment.js
  2. 4
      api/saas.js
  3. 4
      api/user.js
  4. 2
      app.js
  5. 157
      pages/client/bank-add/index.js
  6. 13
      pages/client/bank-add/index.wxml
  7. 36
      pages/client/bank-list/index.js
  8. 125
      pages/client/factory-list/index.js
  9. 8
      pages/client/factory-list/index.json
  10. 39
      pages/client/factory-list/index.wxml
  11. 143
      pages/client/order-list/index.js
  12. 8
      pages/client/order-list/index.json
  13. 37
      pages/client/order-list/index.wxml
  14. 191
      pages/client/withdrawal/index.js
  15. 1
      pages/client/withdrawal/index.json
  16. 27
      pages/client/withdrawal/index.wxml
  17. 12
      pages/home/customer-info/index.js
  18. 6
      pages/home/customer-info/index.wxml
  19. 9
      pages/home/customer-info/index.wxss
  20. 12
      pages/home/customer-list/index.js
  21. 6
      pages/home/customer-list/index.wxml
  22. 9
      pages/home/customer-list/index.wxss
  23. 23
      pages/login/index.js
  24. 2
      pages/login/index.wxml

35
api/payment.js

@ -0,0 +1,35 @@
/**
* Copyright © 2020-present LiuDanYang. All rights Reserved.
*/
import { mGet, mPost } from "./request"
const app = getApp()
const urls = ['https://api-client-psc-dev.qniao.cn', 'https://api-client-psc-test.qniao.cn', 'https://api-client-psc.qniao.cn']
const pconfig = {
baseUrl: urls[app.evn]
}
// *******************************************************账户业务***********************************************************
const getBankcardInfo = (cardNo) => mGet(`/payment-settlement-center/bankcard/bankcard/home/${cardNo}`, null, pconfig)
const ocrBankcard = (params) => mPost(`/payment-settlement-center/bankcard/get/ocr/bankcard`, params, pconfig)
const verifyBankcard = (params) => mPost(`/payment-settlement-center/bankcard/post/verify/bankverify`, params, pconfig)
const getBankCardList = () => mGet(`/payment-settlement-center/bankcard/getBankCardList`, null, pconfig)
const deleteBankcard = (id) => mPost(`/payment-settlement-center/bankcard/delete/bankCard/${id}`, null, pconfig)
const getTradeOrder = (id) => mGet(`/payment-settlement-center/get/payment-order/by-trade-order-id/${id}`, null, pconfig)
const paymentFor = (params) => mPost(`/payment-settlement-center/pay`, params, pconfig)
const getBalanceInfo = () => mGet(`/payment-settlement-center/balance/get/balance`, null, pconfig)
const getWithdrawalList = () => mGet(`/payment-settlement-center/balance/get/order-withdrawal-list`, null, pconfig)
const paymentOrder = (params) => mPost(`/payment-settlement-center/balance/order/withdraw`, params, pconfig)
export {
pconfig,
getBankcardInfo,
ocrBankcard,
verifyBankcard,
getBankCardList,
deleteBankcard,
getTradeOrder,
paymentFor,
getBalanceInfo,
getWithdrawalList,
paymentOrder
}

4
api/saas.js

@ -6,7 +6,7 @@ const app = getApp()
const urls = [`https://api-client-ztb-dev.qniao.cn`, `https://api-client-ztb-test.qniao.cn`, `https://api-client-ztb.qniao.cn`]
const sconfig = {
baseUrl: urls[app.release % 3]
baseUrl: urls[app.evn % 3]
}
// *****************************************账户业务**********************************************
const loginToken = (params) => mPost(`/recycle-user-center/authorize/get/product-line-token/by/login-token`, params, sconfig)
@ -33,6 +33,7 @@ const getCustomerList = (params) => mGet(`/ztb-factory/factory/get/customer-list
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) => mGet(`/ztb-factory/factory/wechat-applet/get/customer-detail/${id}`, null, sconfig)
const bindCustomer = (params) => mPost(`/ztb-factory/user/binding/factory-customer`, params, sconfig)
export {
sconfig,
@ -57,6 +58,7 @@ export {
editCustomer,
deleteCustomer,
getCustomerInfo,
bindCustomer,
getPaperList,
repeatOrder,
getStatisticsInfo

4
api/user.js

@ -3,13 +3,14 @@
*/
import { mGet, mPost } from "./request"
import { sconfig } from "./saas"
import { pconfig } from "./payment"
const util = require('../utils/util')
const storage = require('../utils/storage')
const app = getApp()
const urls = [`https://uec-dev.qniao.cn`, `https://uec-test.qniao.cn`, `https://uec.qniao.cn`]
const config = {
baseUrl: urls[app.release]
baseUrl: urls[app.evn]
}
const wechatApplet = (params) => mPost('/uec/get/wechat-applet-session', params, config)
const loginCaptcha = (params) => mPost(`/uec/authorize/by-captcha`, params, config)
@ -180,6 +181,7 @@ function phoneWechat(form) {
function finalizeToken(){
config.header = null
sconfig.header = null
pconfig.header = null
}
export {

2
app.js

@ -1,6 +1,6 @@
//app.js
App({
release: 2, // 0: 开发版本;1:测试版本;2:生产版本
evn: 2, // 0: 开发版本;1:测试版本;2:生产版本
tmplIds: [''],
version: 152,
xAppId: '503258978847953926',

157
pages/client/bank-add/index.js

@ -1,25 +1,106 @@
// pages/client/bank-add/index.js
import { postCaptcha, verifyCode } from "../../../api/user"
import { getBankcardInfo, ocrBankcard, verifyBankcard } from "../../../api/payment"
import { postCaptcha } from "../../../api/user"
const util = require('../../../utils/util')
const event = require('../../../utils/event')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
second: '获取验证码',
userInfo: null,
form: {
phone: null, //银行卡预留手机号
cardName: null, //银行名称
cardNo: null, //卡号
openingBank: null,
cardType: null, //银行卡类型
idno: null, //身份证号
name: null, //持卡人姓名
verificationCode: null, //验证码
isExist: 0, //查询银行卡是否重复1重复0不重复
type: 2
},
bankName: null,
cardType: null,
codeEnable: true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({ ['form.name']: app.userInfo.realName })
},
bindForm: function (e) {
this.data.form[e.target.id] = e.detail.value
if (e.target.id == 'cardNo') {
this.setData({
['form.cardName']: null,
bankName: null,
['form.cardType']: null,
['form.type']: 2,
cardType: null
})
} else if (e.target.id == 'phone') {
this.setData({ codeEnable: util.isEmpty(e.detail.value) })
}
},
checkCardNo: function(cardNo){
cardNo = cardNo.replace(/\s+/g, '')
getBankcardInfo(cardNo).then(result => {
this.setData({
['form.cardName']: result.data.bank,
['form.type']: 4,
bankName: result.data.bankName,
['form.cardType']: result.data.cardType,
cardType: this.getCardType(result.data.cardType)
})
}).catch(error => {
util.showToast(error)
})
},
getCardType: function(type){
if('DC' == type){
return '储蓄卡'
}
if('CC' == type){
return '信用卡'
}
if('SCC' == type){
return '准贷记卡'
}
if('PC' == type){
return '预付费卡'
}
return ''
},
fetchCaptcha: function(){
if (!(/^1\d{10}$/.test(this.data.form.account)) || this.data.form.account.length < 11) {
if (util.isEmpty(this.data.bankName) && !util.isEmpty(this.data.form.cardNo)) {
this.checkCardNo(this.data.form.cardNo)
return
}
if (util.isEmpty(this.data.form.name)) {
util.showToast('请输入持卡人姓名')
return
}
if (util.isEmpty(this.data.form.cardNo)) {
util.showToast('请输入银行卡卡号')
return
}
if (util.isEmpty(this.data.form.phone)) {
util.showToast('请输入手机号码')
return
}
if (!(/^1\d{10}$/.test(this.data.form.phone)) || this.data.form.phone.length < 11) {
util.showToast('请输入11位手机号码')
return
}
this.data.form.cardNo = this.data.form.cardNo.replace(/\s+/g, '')
wx.showLoading({ title: '正在获取', mask: true })
postCaptcha({ verifiableAccount: this.data.form.account, verifiableAccountType: 1, purpose: 1 }).then(result => {
postCaptcha({ verifiableAccount: this.data.form.phone, verifiableAccountType: 1, purpose: 4 }).then(result => {
wx.hideLoading()
this.setData({ codeEnable: false })
util.showToast('验证码已经发送')
@ -40,4 +121,72 @@ Page({
onFinished: function(){
this.setData({ second: '重新获取验证码', codeEnable: true })
},
submitForm: function(){
if (util.isEmpty(this.data.form.name)) {
util.showToast('请输入持卡人姓名')
return
}
if (util.isEmpty(this.data.form.cardNo)) {
util.showToast('请输入银行卡卡号')
return
}
if (util.isEmpty(this.data.bankName) && !util.isEmpty(this.data.form.cardNo)) {
this.checkCardNo(this.data.form.cardNo)
return
}
if (util.isEmpty(this.data.form.phone) && this.data.form.type == 4) {
util.showToast('请输入手机号码')
return
}
if (this.data.form.type == 4 && (!(/^1\d{10}$/.test(this.data.form.phone)) || this.data.form.phone.length < 11)) {
util.showToast('请输入11位手机号码')
return
}
if (util.isEmpty(this.data.form.verificationCode) && this.data.form.type == 4) {
util.showToast('请输入验证码')
return
}
wx.showLoading({ title: '处理中', mask: true })
verifyBankcard(this.data.form).then(res => {
wx.hideLoading()
if(res.data.trxstatus == 1){
util.showBackToast('添加成功')
event.emit('EventMessage', { what: 201, desc: 'AddCard' })
} else{
util.showToast('银行卡添加失败')
}
}).catch(error => {
wx.hideLoading()
util.showToast(error)
})
},
scanCard: function(){
var that = this
wx.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], //从相册选择
success: (res) => {
const fileSystemManager = wx.getFileSystemManager()
fileSystemManager.readFile({
filePath: res.tempFilePaths[0], // 例如图片临时路径
encoding: 'base64',
success(res) {
that.ocrBankcard(res.data)
}
})
}
})
},
ocrBankcard: function(base64Image){
wx.showLoading({ title: '处理中', mask: true })
ocrBankcard({base64Image}).then(res => {
wx.hideLoading()
this.setData({ ['form.cardNo']: res.data.card_num })
this.checkCardNo(res.data.card_num)
}).catch(error => {
wx.hideLoading()
util.showToast(error)
})
}
})

13
pages/client/bank-add/index.wxml

@ -9,18 +9,17 @@
<view class="cu-form-group margin-top">
<view class="title">持卡人姓名:</view>
<input id="name" maxlength="16" style="width:65%" disabled="{{true}}" value="{{form.name}}" placeholder="请输入持卡人姓名"
bindinput="bindForm"></input>
<input id="name" maxlength="16" style="width:65%" value="{{form.name}}" placeholder="请输入持卡人姓名" bindinput="bindForm"></input>
</view>
<view class="cu-form-group">
<view class="title">银行卡卡号:</view>
<input id="cardNo" maxlength="24" style="width:65%" type="number" value="{{form.cardNo}}" bindinput="bindForm"
<input id="cardNo" maxlength="24" style="width:65%; flex:1" type="number" value="{{form.cardNo}}" bindinput="bindForm"
placeholder="请输入银行卡卡号" bindinput="bindForm"></input>
<text class="cuIcon-scan text-blue" style="font-size:48rpx" bindtap="scanCard"/>
</view>
<view class="cu-form-group" wx:if="{{form.cardName}}">
<image class="cu-avatar sm round"
src="{{'https://medou.oss-cn-shenzhen.aliyuncs.com/bank/' + form.cardName + '.png'}}"></image>
<view style="margin-left:24rpx">{{bankName}}</view>
<image class="cu-avatar sm round" src="{{'https://medou.oss-cn-shenzhen.aliyuncs.com/bank/' + form.cardName + '.png'}}"></image>
<view style="margin-left:24rpx;flex:1">{{bankName}}</view>
<view class="text-gray" style="margin-left:24rpx">{{cardType}}</view>
</view>
@ -31,7 +30,7 @@
<view class="cu-form-group" wx:if="{{form.type == 4}}">
<view class="title">验证码:</view>
<input id="verificationCode" maxlength="6" type="number" placeholder="请输入验证码" bindinput="bindForm"></input>
<van-button size="small" plain type="info" custom-style="width:220rpx" disabled="{{!mobileEnable || !codeEnable}}"
<van-button size="small" plain type="info" custom-style="width:220rpx" disabled="{{codeEnable}}"
bind:click="fetchCaptcha">
<van-count-down class="count-down" time="{{ 60000 }}" use-slot auto-start="{{false}}" bind:change="onCountChange"
bind:finish="onFinished">

36
pages/client/bank-list/index.js

@ -1,7 +1,8 @@
// pages/client/bank-list/index.js
import Dialog from '../../../components/dialog/dialog'
import { getBankCardList, deleteBankCard, checkPayPassword, bankCardDefault } from "../../../api/saas"
import { getBankCardList, deleteBankcard } from "../../../api/payment"
const util = require('../../../utils/util')
const event = require('../../../utils/event')
const app = getApp()
Page({
@ -14,12 +15,24 @@ Page({
{ id: 1, name: '设为默认' },
{ id: 2, name: '解除绑定' }
],
nowIndex: -1,
bankList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
wx.showLoading({ title: '加载中', mask: true })
getBankCardList().then(result => {
console.log(result)
this.setData({ bankList: result.data, height: app.globalData.fragmentHeight })
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
this.setData({ height: app.globalData.fragmentHeight })
util.showToast(err)
console.log(err)
})
},
showActionSheet(e) {
this.data.nowIndex = e.currentTarget.dataset.index
@ -39,6 +52,23 @@ Page({
this.setData({ show: false })
},
onSelect: function({detail}) {
console.log(detail)
if(detail.id == 2){
Dialog.alert({ title: '温馨提示', message: '确定解除绑定该银行卡?' }).then(() => {
this.unbindCard()
})
}
},
unbindCard: function () {
wx.showLoading({ title: '处理中', mask: true })
var item = this.data.bankList[this.data.nowIndex]
deleteBankcard(item.id).then(res => {
wx.hideLoading()
util.showToast('解除成功')
this.data.bankList.splice(this.data.nowIndex, 1);
this.setData({ bankList: this.data.bankList })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
})

125
pages/client/factory-list/index.js

@ -1,66 +1,89 @@
// pages/client/factory-list/index.js
Page({
// pages/client/order-list/index.js
import { getFactoryOrderList } from "../../../api/saas"
const util = require('../../../utils/util')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
height: app.globalData.fragmentHeight,
loading: true,
requesting: false,
finished: false,
top: 0,
orderList: [],
form: {
funcType: 0,
pageNum: 1,
pageSize: 10
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
this.setData({ height: app.globalData.fragmentHeight })
this.fetchOrderList()
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onRefreshList: function () {
this.setData({
orderList: [],
['form.pageNum']: 1,
loading: true,
finished: false
})
this.fetchOrderList()
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
//1:待定价,2:待过皮重,3:待过磅审核,4:待付款,5:已完成
fetchOrderList: function () {
if (this.data.requesting || this.data.finished) {
return
}
if (this.data.loading) {
this.data.requesting = true
} else {
this.setData({ requesting: true })
}
getFactoryOrderList(this.data.form).then(result => {
if (result.data && result.data.records.length) {
var respList = result.data.records
// 对返回的消息列表进行处理,将同一天的消息显示在一起
let nowList = `orderList[${this.data.orderList.length}]`
var num = this.data.form.pageNum
var finished = ((num - 1) * this.data.form.pageSize + respList.length) >= result.data.total
if(this.data.form.pageNum == 1){
this.setData({
[nowList]: respList,
['form.pageNum']: (num + 1),
top: 0,
finished,
requesting: false,
loading: false
})
} else {
this.setData({
[nowList]: respList,
['form.pageNum']: (num + 1),
finished,
requesting: false,
loading: false
})
}
} else {
this.setData({ finished: true, requesting: false, loading: false })
}
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
if(item.status == 2 || item.status == 3 || item.status == 4 || item.status == 5){
wx.navigateTo({ url: '/pages/process/order-info/index?id=' + item.id })
}
}
})

8
pages/client/factory-list/index.json

@ -1,3 +1,9 @@
{
"usingComponents": {}
"usingComponents": {
"refresh-view": "/components/refresher/index",
"van-cell": "/components/cell/index",
"van-divider": "/components/divider/index",
"van-loading": "/components/loading/index",
"van-dialog": "/components/dialog/index"
}
}

39
pages/client/factory-list/index.wxml

@ -1,4 +1,41 @@
<!--pages/client/factory-list/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">我的打包</view>
<view slot="content">我的打包</view>
</cu-custom>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchOrderList">
<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">
<view class="bg-white" wx:for="{{pageItem}}" wx:key="index">
<view style="background-color:#f3f3f3;" wx:if="{{item.tipsTime}}">
<text class="text-sg" style="line-height:64rpx;padding-left:32rpx">{{item.tipsTime}}</text>
</view>
<view class="flex flex-justify item-content" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem">
<view style="height: 88rpx">
<view class="flex flex-center text-sg text-black">
<text>客户名称:{{item.factoryCustomerName}}</text>
<text wx:if="{{item.status != 1 && item.factoryCustomerMobile}}">({{item.factoryCustomerMobile}})</text>
</view>
<view class="text-sm text-gray" style="margin-top:12rpx">毛重:{{item.totalWeight}}KG</view>
</view>
<view class="flex flex-center" wx:if="{{item.status == 4}}">
<view class="text-df" style="color:#FA541C">待付款</view>
</view>
<view class="flex flex-center" wx:if="{{item.status == 5}}">
<view class="text-df" style="color:#028A00">已完成</view>
</view>
</view>
</view>
</view>
<!--加载更多的UI-->
<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>

143
pages/client/order-list/index.js

@ -1,66 +1,109 @@
// pages/client/order-list/index.js
Page({
import { getFactoryOrderList } from "../../../api/saas"
const util = require('../../../utils/util')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
height: app.globalData.fragmentHeight,
loading: true,
requesting: false,
finished: false,
top: 0,
orderList: [],
form: {
funcType: 0,
pageNum: 1,
pageSize: 10
},
lastTime: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
this.setData({ height: app.globalData.fragmentHeight })
this.fetchOrderList()
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
onRefreshList: function () {
this.setData({
orderList: [],
['form.pageNum']: 1,
loading: true,
finished: false
})
this.data.lastTime = null
this.fetchOrderList()
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
//1:待定价,2:待过皮重,3:待过磅审核,4:待付款,5:已完成
fetchOrderList: function () {
if (this.data.requesting || this.data.finished) {
return
}
if (this.data.loading) {
this.data.requesting = true
} else {
this.setData({ requesting: true })
}
getFactoryOrderList(this.data.form).then(result => {
if (result.data && result.data.records.length) {
var respList = result.data.records
// 对返回的消息列表进行处理,将同一天的消息显示在一起
for (let i = 0; i < respList.length; i++) {
if (util.isEmpty(this.data.lastTime)) {
this.data.lastTime = respList[i].createTime
if (this.data.lastTime.length > 10) {
this.data.lastTime = this.data.lastTime.substring(0, 10)
}
respList[i].tipsTime = this.data.lastTime
} else {
var itemTime = respList[i].createTime
if (itemTime.length > 10) {
itemTime = itemTime.substring(0, 10)
}
if (this.data.lastTime !== itemTime) {
respList[i].tipsTime = itemTime
}
this.data.lastTime = itemTime
}
}
let nowList = `orderList[${this.data.orderList.length}]`
var num = this.data.form.pageNum
var finished = ((num - 1) * this.data.form.pageSize + respList.length) >= result.data.total
if(this.data.form.pageNum == 1){
this.setData({
[nowList]: respList,
['form.pageNum']: (num + 1),
top: 0,
finished,
requesting: false,
loading: false
})
} else {
this.setData({
[nowList]: respList,
['form.pageNum']: (num + 1),
finished,
requesting: false,
loading: false
})
}
} else {
this.setData({ finished: true, requesting: false, loading: false })
}
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
if(item.status == 2 || item.status == 3 || item.status == 4 || item.status == 5){
wx.navigateTo({ url: '/pages/process/order-info/index?id=' + item.id })
}
}
})

8
pages/client/order-list/index.json

@ -1,3 +1,9 @@
{
"usingComponents": {}
"usingComponents": {
"refresh-view": "/components/refresher/index",
"van-cell": "/components/cell/index",
"van-divider": "/components/divider/index",
"van-loading": "/components/loading/index",
"van-dialog": "/components/dialog/index"
}
}

37
pages/client/order-list/index.wxml

@ -2,3 +2,40 @@
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">订单列表</view>
</cu-custom>
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchOrderList">
<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">
<view class="bg-white" wx:for="{{pageItem}}" wx:key="index">
<view style="background-color:#f3f3f3;" wx:if="{{item.tipsTime}}">
<text class="text-sg" style="line-height:64rpx;padding-left:32rpx">{{item.tipsTime}}</text>
</view>
<view class="flex flex-justify item-content" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem">
<view style="height: 88rpx">
<view class="flex flex-center text-sg text-black">
<text>客户名称:{{item.factoryCustomerName}}</text>
<text wx:if="{{item.status != 1 && item.factoryCustomerMobile}}">({{item.factoryCustomerMobile}})</text>
</view>
<view class="text-sm text-gray" style="margin-top:12rpx">毛重:{{item.totalWeight}}KG</view>
</view>
<view class="flex flex-center" wx:if="{{item.status == 4}}">
<view class="text-df" style="color:#FA541C">待付款</view>
</view>
<view class="flex flex-center" wx:if="{{item.status == 5}}">
<view class="text-df" style="color:#028A00">已完成</view>
</view>
</view>
</view>
</view>
<!--加载更多的UI-->
<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>

191
pages/client/withdrawal/index.js

@ -1,66 +1,161 @@
// pages/client/withdrawal/index.js
Page({
import Dialog from '../../../components/dialog/dialog'
import { getBalanceInfo, getWithdrawalList, getBankCardList, paymentOrder } from '../../../api/payment'
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const event = require('../../../utils/event')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
safeBottom: app.globalData.safeBottom,
accountMoney: 0, //用户余额
sumMoney: 0, //用户余额
expendMoney: '',
xsaccountMoney: 0, //显示余额
banckCardList: [], //用户银行卡列表
banckList: [],
orderList: [],
checkIds: [],
chooseBankCard: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function () {
this.getUserInfo()
this.fetchCardList()
event.on('EventMessage', this, this.onEvent)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
onEvent: function(message){
if (message.what == 201) {
this.fetchCardList()
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
fetchCardList: function(){
getBankCardList().then(res => {
var list = []
for (let index = 0; index < res.data.length; index++) {
const element = res.data[index]
list.push({ text: element.bankName + '(' + element.cardNoSuffix + ')', value: element.id })
}
this.setData({ banckCardList: res.data, banckList: list })
if (this.data.banckCardList[0] && this.data.banckCardList[0].cardName) {
const element = this.data.banckCardList[0]
var defaultCard = { cardId: element.id, cardName: element.bankName + '(' + element.cardNoSuffix + ')' }
this.setData({ chooseBankCard: defaultCard })
}
})
},
/**
* 生命周期函数--监听页面隐藏
* 获取用户数据
*/
onHide: function () {
getUserInfo: function () {
wx.showLoading({ title: '加载中', mask: true })
getBalanceInfo().then(result => {
this.setData({ accountMoney: result.data.accountMoney, xsaccountMoney: math.minus(result.data.accountMoney, result.data.frozenMoney) })
}).catch(err => {
console.log(err)
})
getWithdrawalList().then(result => {
wx.hideLoading()
this.data.sumMoney = 0
for (let index = 0; index < result.data.length; index++) {
const element = result.data[index]
if(element.status == 0){
this.data.sumMoney = math.plus(this.data.sumMoney, element.money)
}
}
this.setData({ orderList: result.data, sumMoney: this.data.sumMoney })
}).catch(err => {
wx.hideLoading()
})
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
allExpend: function () {
var sum = 0
this.data.checkIds = []
for (let index = 0; index < this.data.orderList.length; index++) {
const element = this.data.orderList[index]
if(element.status == 0){
element.check = true
this.data.checkIds.push(element.id)
sum = math.plus(sum, element.money)
}
}
this.setData({ orderList: this.data.orderList, expendMoney: sum || '' })
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
chooseCard: function () {
if (this.data.chooseBankCard) {
this.pickerView.showPicker(this.data.banckList, this.data.chooseBankCard.cardId)
} else {
Dialog.alert({ title: '温馨提示', message: '您还没有绑定银行卡,请先去绑定银行卡' }).then(() => {
wx.navigateTo({ url: '/pages/client/bank-add/index' })
})
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
onCardChange: function(e){
if(!e.detail){
return
}
this.setData({
['chooseBankCard.cardName']: this.data.banckCardList[e.detail.current].bankName,
['chooseBankCard.cardId']: this.data.banckCardList[e.detail.current].id
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
onPickerChange: function (e) {
if(!e.detail){
return
}
this.setData({ ['chooseBankCard.cardName']: e.detail.text, ['chooseBankCard.cardId']: e.detail.value })
},
checkoutAmount: function () {
if (Number(this.data.expendMoney) <= 0) {
util.showToast('提现金额必须大于0')
return
}
if (!this.data.chooseBankCard || !this.data.chooseBankCard.cardId) {
util.showToast('请选择一张银行卡')
return
}
wx.showLoading({ title: '加载中', mask: true })
paymentOrder({ bankId: this.data.chooseBankCard.cardId, ids: this.data.checkIds }).then(res => {
wx.hideLoading()
if(res.data.markedWords){
Dialog.alert({ title: '温馨提示', message: res.data.markedWords }).then(() => {
wx.navigateBack()
})
} else {
Dialog.alert({ title: '温馨提示', message: '提现申请已经提交,请等待提现结果。' }).then(() => {
wx.navigateBack()
})
}
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
},
checkList: function(e){
var item = this.data.orderList[e.currentTarget.dataset.index]
if(item.status != 0){
return
}
var checked = !item.check
var sum = 0
this.data.checkIds = []
for (let index = 0; index < this.data.orderList.length; index++) {
const element = this.data.orderList[index]
if(index == e.currentTarget.dataset.index){
element.check = !element.check
}
if(element.check){
sum = math.plus(sum, element.money)
this.data.checkIds.push(element.id)
}
}
this.setData({ ['orderList[' + e.currentTarget.dataset.index + '].check']: checked, expendMoney: sum || '' })
},
onUnload: function(){
event.remove('EventMessage', this)
}
})

1
pages/client/withdrawal/index.json

@ -2,6 +2,7 @@
"usingComponents": {
"van-cell": "/components/cell/index",
"van-cell-group": "/components/cell-group/index",
"van-dialog": "/components/dialog/index",
"van-button": "/components/button/index"
}
}

27
pages/client/withdrawal/index.wxml

@ -1,27 +1,36 @@
<!--pages/client/withdrawal/index.wxml-->
<wxs module="formate" src="../../formate.wxs"></wxs>
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">申请提现</view>
</cu-custom>
<view class="bg-white" style="margin-top:24rpx;padding: 30rpx 0rpx 0rpx 40rpx">
<view class="bg-white" style="padding:24rpx;font-size:24rpx;">
<view>提现到账:对私预计两小时内到账,对公预计下一个工作日内到账</view>
<view>提现申请后T+1个工作日到账(周六、周日及节假日顺延到工作日),如有疑问请联系客服<text class="text-blue">400-6881-001</text></view>
</view>
<view style="height:32rpx"></view>
<van-cell is-link bind:click="chooseCard">
<view class="flex" slot="title" style="align-items: center">
<text class="text-sg" style="margin-left:12rpx">到账银行卡</text>
</view>
</van-cell>
<view class="bg-white" style="padding: 30rpx 0rpx 0rpx 40rpx">
<text class="text-sg text-bold text-black" bindtap="banlanceDetails">提现金额</text>
<view class="cu-form-group" style="border-bottom: 1px solid #f3f3f3;margin-top:24rpx;padding: 2rpx 0rpx">
<view><text style="font-size:50rpx;font-weight: 600; color:black">¥</text></view>
<input type="digit" style="font-size:45rpx;" value="{{expendMoney}}" bindinput="bindAndSet" placeholder="请输入金额"></input>
</view>
</view>
<van-cell link-type="navigateTo" url="/pages/home/mobile/index">
<van-cell>
<view class="flex" slot="title" style="align-items: center">
<text class="text-sg" style="margin-left:12rpx">账户余额¥{{formate.numberFormat2(xsaccountMoney)}}</text>
<text class="text-sg" style="margin-left:12rpx">账户余额¥{{formate.formateAmount(xsaccountMoney)}}</text>
<text class="text-sm text-blue" style="margin-left:30rpx" bindtap="allExpend">全部提现</text>
</view>
</van-cell>
<van-cell is-link bind:click="chooseCard">
<view class="flex" slot="title" style="align-items: center">
<text class="text-sg" style="margin-left:12rpx">到账银行卡</text>
</view>
</van-cell>
<view style="margin-top:20rpx;padding:80rpx 32rpx">
<van-button block type="info" bind:click="submitForm">提现</van-button>
</view>
</view>
<van-dialog id="van-dialog" />

12
pages/home/customer-info/index.js

@ -11,7 +11,8 @@ Page({
data: {
form: null,
base64: null,
showEmbedded: false
showEmbedded: false,
customerName: ''
},
/**
* 生命周期函数--监听页面加载
@ -34,9 +35,14 @@ Page({
registCustomer: function(){
wx.showLoading({ title: '加载中', mask: true })
const params = { id: 6 }
params.metaData = { factoryId: app.userInfo.factoryId, factoryName: app.userInfo.factoryName, factoryCustomerId: this.data.form.id }
params.metaData = {
factoryId: app.userInfo.factoryId,
factoryName: app.userInfo.factoryName,
factoryCustomerId: this.data.form.id,
factoryCustomerName: this.data.form.name
}
generateCode(params).then(result => {
this.setData({ showEmbedded: true, base64: result.data })
this.setData({ showEmbedded: true, base64: result.data, customerName: this.data.form.name })
wx.hideLoading()
}).catch(err => {
wx.hideLoading()

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

@ -53,7 +53,11 @@
<view class="image-load" slot="loading"><van-loading type="spinner" size="32" /></view>
</van-image>
</view>
<text class="text-df text-white" style="margin-top:36rpx;text-align:center">为保证企业账户安全,二维码仅在3小时内有效,失效后,可重新生成。</text>
<text class="text-df text-white" style="margin-top:36rpx;text-align:center">
<text>邀请</text>
<text class="text-blue">{{customerName}}</text>
<text>邀请注册纸通宝</text>
</text>
<van-icon name="close" color="white" size="36px" custom-style="margin-top:48px" catch:tap="onClickHideEmbedded" />
</view>
</van-overlay>

9
pages/home/customer-info/index.wxss

@ -1 +1,8 @@
/* pages/home/customer-info/index.wxss */
/* pages/home/customer-info/index.wxss */
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding: 0px 15%;
}

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

@ -21,7 +21,8 @@ Page({
pageSize: 10
},
base64: null,
showEmbedded: false
showEmbedded: false,
customerName: ''
},
/**
* 生命周期函数--监听页面加载
@ -97,9 +98,14 @@ Page({
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
wx.showLoading({ title: '加载中', mask: true })
const form = { id: 6 }
form.metaData = { factoryId: app.userInfo.factoryId, factoryName: app.userInfo.factoryName, factoryCustomerId: item.id }
form.metaData = {
factoryId: app.userInfo.factoryId,
factoryName: app.userInfo.factoryName,
factoryCustomerId: item.id,
factoryCustomerName: item.name
}
generateCode(form).then(result => {
this.setData({ showEmbedded: true, base64: result.data })
this.setData({ showEmbedded: true, base64: result.data, customerName: item.name })
wx.hideLoading()
}).catch(err => {
wx.hideLoading()

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

@ -41,7 +41,11 @@
<view class="image-load" slot="loading"><van-loading type="spinner" size="32" /></view>
</van-image>
</view>
<text class="text-df text-white" style="margin-top:36rpx;text-align:center">为保证企业账户安全,二维码仅在3小时内有效,失效后,可重新生成。</text>
<text class="text-df text-white" style="margin-top:36rpx;text-align:center">
<text>邀请</text>
<text class="text-blue">{{customerName}}</text>
<text>邀请注册纸通宝</text>
</text>
<van-icon name="close" color="white" size="36px" custom-style="margin-top:48px" catch:tap="onClickHideEmbedded" />
</view>
</van-overlay>

9
pages/home/customer-list/index.wxss

@ -1 +1,8 @@
/* pages/home/customer/index.wxss */
/* pages/home/customer/index.wxss */
.wrapper {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
padding: 0px 15%;
}

23
pages/login/index.js

@ -1,7 +1,8 @@
//获取应用实例
import Dialog from '../../components/dialog/dialog'
import { config, wechatApplet, loginWechat, postCaptcha, loginCaptcha, loginPwd, verifyCode, applyEmplyee } from "../../api/user"
import { sconfig, loginToken, getUserInfo, bindingAdmin } from "../../api/saas"
import { sconfig, loginToken, getUserInfo, bindingAdmin, bindCustomer } from "../../api/saas"
import { pconfig } from "../../api/payment"
const util = require('../../utils/util')
const storage = require('../../utils/storage')
const app = getApp()
@ -24,7 +25,7 @@ Page({
regist: false,
metaData: null,
code: null
// code: '?mark=ztb_saas&QrCodeRecordId=554641854092677120'
// code: '?mark=ztb_saas&QrCodeRecordId=561997269805699072'
},
/************************************** 初始化登录流程 ********************************************/
onLoad: function (options) {
@ -93,6 +94,7 @@ Page({
// token 切换流程
loginToken({loginToken: authorization}).then(result => {
sconfig.header = { 'Authorization': 'QNT ' + result.data }
pconfig.header = { 'Authorization': 'QNT ' + result.data }
getUserInfo().then(result => {
wx.hideLoading()
app.userInfo = result.data
@ -104,9 +106,12 @@ Page({
})
} else if(this.data.metaData){
// 这里要进行账号的绑定,对工厂进行绑定;或者进行申请操作;
if(this.data.metaData.qrPage == '/page/index/register'){
this.data.metaData.userName = this.data.metaData.factoryCustomerName || '默认姓名'
}
this.setData({ loging: false, metaData: this.data.metaData })
} else {
if(app.userInfo.factoryId){
if(!app.userInfo.factoryId){
wx.redirectTo({ url: '/pages/index/index' })
} else {
wx.redirectTo({ url: '/pages/client/index/index' })
@ -308,6 +313,18 @@ Page({
this.setData({loging: false})
util.showToast(error)
})
} else if(this.data.metaData.qrPage == '/page/index/register'){
this.data.metaData.factorycustomerId = this.data.metaData.factoryCustomerId
bindCustomer(this.data.metaData).then(result => {
this.data.metaData = null
wx.hideLoading()
this.setData({loging: false})
wx.redirectTo({ url: '/pages/client/index/index' })
}).catch(error => {
wx.hideLoading()
this.setData({loging: false})
util.showToast(error)
})
} else {
Dialog.alert({ title: '温馨提示', message: '扫码错误,请重新扫码。' }).then(() => {
})

2
pages/login/index.wxml

@ -11,7 +11,7 @@
<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'}}">
<view class="text-df" style="padding:20rpx 0rpx" wx:elif="{{metaData.qrPage == '/page/index/register'}}">
<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"

Loading…
Cancel
Save