Browse Source

no message

feature/v2.1
xpz2018 4 years ago
parent
commit
892797de49
17 changed files with 307 additions and 9 deletions
  1. 12
      api/saas.js
  2. 4
      app.js
  3. 4
      app.json
  4. 17
      pages/home/customer-info/index.js
  5. 1
      pages/home/customer-info/index.json
  6. 7
      pages/home/customer-info/index.wxml
  7. 5
      pages/home/customer-list/index.js
  8. 3
      pages/home/index/index.wxml
  9. 98
      pages/setting/vehicle-detial/index.js
  10. 10
      pages/setting/vehicle-detial/index.json
  11. 21
      pages/setting/vehicle-detial/index.wxml
  12. 1
      pages/setting/vehicle-detial/index.wxss
  13. 85
      pages/setting/vehicle-list/index.js
  14. 10
      pages/setting/vehicle-list/index.json
  15. 35
      pages/setting/vehicle-list/index.wxml
  16. 1
      pages/setting/vehicle-list/index.wxss
  17. 2
      utils/util.js

12
api/saas.js

@ -52,6 +52,11 @@ const getChanelList = (params) => mGet(`/ztb-factory/factorydeliverychannel/get/
const saveChanel = (params) => mPost(`/ztb-factory/factorydeliverychannel/save/factory-delivery-channel`, params, sconfig)
const getCardList = (params) => mGet(`/ztb-factory/get/self-factory/card-list`, params, sconfig)
const removeCardNop = (cardNo) => mPost(`/ztb-factory/remove/not-bind-card/${cardNo}`, null, sconfig)
const getCarList = (params) => mGet(`/ztb-factory/factory/get/factory-car-list`, params, sconfig)
const getCarInfo = (id) => mGet(`/ztb-factory/factory/get/factory-car/${id}`, null, sconfig)
const editCar = (params) => mPost(`/ztb-factory/factory/edit/factory-car`, params, sconfig)
const saveCar = (params) => mPost(`/ztb-factory/factory/save/factory-car`, params, sconfig)
const deleteCar = (id) => mPost(`/ztb-factory/factory/delete/factory-car/${id}`, null, sconfig)
const getPoundList = () => mGet(`/ztb-factory/get/self-factory-weight-note-list`, null, sconfig)
const getPoundInfo = (id) => mGet(`/ztb-factory/get/weight-note-detail/${id}`, null, sconfig)
@ -150,5 +155,10 @@ export {
getReceiptReport,
getSalesReport,
getGrossReport,
getAgentReport
getAgentReport,
getCarList,
getCarInfo,
saveCar,
editCar,
deleteCar,
}

4
app.js

@ -1,8 +1,8 @@
//app.js
App({
evn: 2, // 0: 开发版本;1:测试版本;2:生产版本
evn: 0, // 0: 开发版本;1:测试版本;2:生产版本
tmplIds: ['AFoM5TOfsgERsfcetNSB0UlmEixnLF1ySXr54Bqno2M', 'lOQ8Gvyy_dTk68bYGpRVnVA0M7DsYYrV81Gd39GUPBA'],
version: '2.1.0',
version: '2.2.0',
xAppId: '503258978847953926',
userInfo: null,
//----------------------------------------------globalData--------------------------------------

4
app.json

@ -54,7 +54,9 @@
"pages/setting/password/index",
"pages/setting/mobile/index",
"pages/setting/paper-list/index",
"pages/setting/paper-detial/index"
"pages/setting/paper-detial/index",
"pages/setting/vehicle-list/index",
"pages/setting/vehicle-detial/index"
],
"subpackages": [
{

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

@ -1,6 +1,7 @@
// pages/home/customer-info/index.js
import Scene from '../../index/scene'
import { getCustomerInfo, getBankList, editCustomer, saveCustomer} from "../../../api/saas"
import Dialog from '../../../components/dialog/dialog'
import { getCustomerInfo, getBankList, editCustomer, saveCustomer, deleteCustomer} from "../../../api/saas"
const util = require('../../../utils/util')
const event = require('../../../utils/event')
const app = getApp()
@ -146,5 +147,19 @@ Scene({
}
}
})
},
deleteForm: function(){
Dialog.confirm({ title: '温馨提示', message: '确定删除该客户?' }).then(() => {
wx.showLoading({ title: '正在处理', mask: true })
deleteCustomer(this.data.form.id).then(result => {
wx.hideLoading()
util.showBackToast('客户已删除')
event.emit('EventMessage', { what: 101 })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}).catch(err => {
})
}
})

1
pages/home/customer-info/index.json

@ -10,6 +10,7 @@
"van-notice-bar": "/components/notice-bar/index",
"van-picker": "/components/picker/index",
"van-popup": "/components/popup/index",
"van-dialog": "/components/dialog/index",
"notification": "/pages/message/notification/index"
}
}

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

@ -20,14 +20,16 @@
wx:if="{{form.defaultPaymentMethod == 2}}" />
<view style="height:32rpx"></view>
<view style="margin-top:20rpx;padding:48rpx 32rpx" wx:if="{{ cardNo }}">
<view style="margin-top:16rpx;padding:48rpx 32rpx" wx:if="{{ cardNo }}">
<van-button block type="default" bind:click="chooseMember">选择客户进行绑定</van-button>
<view style="height:36rpx"></view>
<van-button block type="info" bind:click="submitForm">确认绑定</van-button>
</view>
<view style="margin-top:20rpx;padding:48rpx 32rpx" wx:else>
<view style="margin-top:16rpx;padding:48rpx 32rpx" wx:else>
<van-button block type="primary" bind:click="registCustomer" wx:if="{{form.id && !form.userId}}">邀请注册纸通宝</van-button>
<view style="height:36rpx" wx:if="{{form.id && !form.userId}}"></view>
<van-button block type="danger" bind:click="deleteForm">删除客户</van-button>
<view style="height:36rpx"></view>
<van-button block type="info" bind:click="submitForm">确认绑定</van-button>
</view>
@ -36,4 +38,5 @@
<van-popup position="bottom" show="{{ visible }}" bind:close="onHide" z-index="29">
<van-picker show-toolbar title="{{columns.length == 6 ? '选择类型' : '选择银行'}}" columns="{{ columns }}" bind:cancel="onHide" bind:confirm="onConfirm" />
</van-popup>
<van-dialog id="van-dialog" />
<notification id="qn-notification" />

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

@ -36,7 +36,10 @@ Scene({
this.fetchCustomerList()
},
onEvent: function(message){
if (message.what == 102) {
console.log(message)
if (message.what == 101) {
this.onRefreshList()
} else if (message.what == 102) {
this.setData({ [`orderList[${this.data.page}][${this.data.index}]`]: message.detail })
}
},

3
pages/home/index/index.wxml

@ -45,6 +45,9 @@
<van-grid-item text="智能报表" url="/xtends/statics/index/index" wx:if="{{isAdmin}}">
<van-icon slot="icon" name="/assets/home/icon-report.png" size="76rpx" />
</van-grid-item>
<van-grid-item text="车辆管理" url="/pages/setting/vehicle-list/index">
<van-icon slot="icon" name="/assets/home/icon-card.png" size="76rpx" />
</van-grid-item>
</van-grid>
</view>
</view>

98
pages/setting/vehicle-detial/index.js

@ -0,0 +1,98 @@
// pages/setting/paper-detial/index.js
import Scene from '../../index/scene'
import Dialog from '../../../components/dialog/dialog'
import { getCarInfo, saveCar, editCar, deleteCar } from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
Scene({
/**
* 页面的初始数据
*/
data: {
safeBottom: app.globalData.safeBottom,
form: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.id){
wx.showLoading({ title: '正在获取', mask: true })
getCarInfo(options.id).then(result => {
wx.hideLoading()
this.setData({ form: result.data, safeBottom: app.globalData.safeBottom })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
},
showPlate: function(e){
if(e.currentTarget.id == 'plateNumber'){
this.keyboard = this.keyboard || this.selectComponent('#wux-keyboard')
this.keyboard.show(this.data.form.plateNumber, 0)
} else {
var that = this
var events = {}
events.onCallback = function(data){
if (data.what == 121) {
that.data.form.driverId = data.detail.enterpriseMemberId
that.setData({ ['form.driverName']: data.detail.enterpriseMemberName })
}
}
wx.navigateTo({url: `/pages/home/employee/index?type=1`, events})
}
},
onPlatenumber: function({detail}){
if(detail && detail.plateNumber){
this.setData({ ['form.plateNumber']: detail.plateNumber })
}
},
deleteForm: function(e){
Dialog.confirm({ title: '温馨提示', message: '确定删除该纸品?' }).then(() => {
wx.showLoading({ title: '正在处理', mask: true })
deleteCar(this.data.form.id).then(result => {
wx.hideLoading()
util.showBackToast('删除成功')
event.emit('OrderMessage', { what: 201 })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}).catch(err => {
})
},
submitForm: function(e){
if(util.isEmpty(this.data.form.plateNumber)){
util.showToast('请输入车牌号码')
return
}
if(util.isEmpty(this.data.form.driverId)){
util.showToast('请选择司机')
return
}
wx.showLoading({ title: '正在处理', mask: true })
if(util.isEmpty(this.data.form.id)){
saveCar(this.data.form).then(result => {
wx.hideLoading()
util.showBackToast('添加成功')
event.emit('OrderMessage', { what: 201 })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
} else {
editCar(this.data.form).then(result => {
wx.hideLoading()
util.showBackToast('修改成功')
event.emit('OrderMessage', { what: 202, detail: this.data.form })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
}
})

10
pages/setting/vehicle-detial/index.json

@ -0,0 +1,10 @@
{
"usingComponents": {
"van-button": "/components/button/index",
"van-field": "/components/field/index",
"van-dialog": "/components/dialog/index",
"vehicle-keyboard": "/components/vehicle-keyboard/index",
"van-notice-bar": "/components/notice-bar/index",
"notification": "/pages/message/notification/index"
}
}

21
pages/setting/vehicle-detial/index.wxml

@ -0,0 +1,21 @@
<!--pages/setting/paper-detial/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content" style="color:black;font-size:18px">车辆详情</view>
</cu-custom>
<van-notice-bar color="#1989fa" background="#008AFF" left-icon="info-o" text="点击可以修改车辆信息" />
<van-field id="plateNumber" title-width="360rpx" required value="{{form.plateNumber }}" readonly input-align="right"
label="车牌号码:" is-link arrow-direction="down" bindtap="showPlate" placeholder="请输入车牌号码" />
<van-field title-width="360rpx" required value="{{form.driverName }}" readonly input-align="right" label="司机名称:" is-link
bindtap="showPlate" placeholder="请选择司机" />
<view style="margin-top:48rpx;padding:48rpx 32rpx">
<van-button block type="danger" bind:click="deleteForm" wx:if="{{ form.id}}">删除</van-button>
<view style="height:36rpx" wx:if="{{ form.id}}"></view>
<van-button block type="info" bind:click="submitForm">保存</van-button>
</view>
<vehicle-keyboard id="wux-keyboard" safeBottom="{{safeBottom}}" triplet="{{1}}" bind:change="onPlatenumber">
</vehicle-keyboard>
<van-dialog id="van-dialog" />
<notification id="qn-notification" />

1
pages/setting/vehicle-detial/index.wxss

@ -0,0 +1 @@
/* pages/setting/paper-detial/index.wxss */

85
pages/setting/vehicle-list/index.js

@ -0,0 +1,85 @@
// pages/process/order-list/index.js
import Scene from '../../index/scene'
import { getCarList } from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
Scene({
// * 页面的初始数据
data: {
height: app.globalData.fragmentHeight,
loading: true,
requesting: false,
finished: false,
top: 0,
orderList: [],
form: {
pageNum: 1,
pageSize: 15
},
page: -1,
index: -1
},
// * 生命周期函数--监听页面加载
onLoad: function (options) {
event.on('OrderMessage', this, this.onEvent)
this.setData({ height: app.globalData.fragmentHeight })
this.fetchOrderList()
},
onEvent: function(message){
if (message.what == 201) {
this.onRefreshList()
} else if (message.what == 202) {
this.setData({ [`orderList[${this.data.page}][${this.data.index}]`]: message.detail })
}
},
onRefreshList: function () {
if (this.data.requesting) {
return
}
this.setData({ orderList: [], ['form.pageNum']: 1, loading: true, finished: false })
this.fetchOrderList()
},
fetchOrderList: function () {
if (this.data.requesting || this.data.finished) {
return
}
this.data.requesting = true
getCarList(this.data.form).then(result => {
if (result.data && result.data.records && 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), finished, top: 0, 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)
}).then(() => {
this.refresh = this.refresh || this.selectComponent('#refresh')
this.refresh.setRefresh(false)
})
},
lookItem: function (e) {
if(e.currentTarget.dataset.page >= 0){
this.data.page = e.currentTarget.dataset.page
this.data.index = e.currentTarget.dataset.index
var item = this.data.orderList[this.data.page][ this.data.index]
wx.navigateTo({ url: `/pages/setting/vehicle-detial/index?id=${item.id}` })
} else {
wx.navigateTo({ url: `/pages/setting/vehicle-detial/index` })
}
},
onUnload: function(){
event.remove('OrderMessage', this)
}
})

10
pages/setting/vehicle-list/index.json

@ -0,0 +1,10 @@
{
"usingComponents": {
"refresh-view": "/components/refresh-view/index",
"van-button": "/components/button/index",
"van-cell": "/components/cell/index",
"van-divider": "/components/divider/index",
"van-loading": "/components/loading/index",
"notification": "/pages/message/notification/index"
}
}

35
pages/setting/vehicle-list/index.wxml

@ -0,0 +1,35 @@
<!--pages/setting/paper/index.wxml-->
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content" style="color:black;font-size:18px">车辆管理</view>
</cu-custom>
<refresh-view id="refresh" height="{{height}}" bind:refresh="onRefreshList" bind:loadmore="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">
<van-cell center clickable is-link wx:for="{{pageItem}}" wx:key="index">
<view slot="title" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem">
<view class="text-sg text-bold">车牌号你:{{item.plateNumber}}</view>
<view class="text-sm text-gray" style="line-height: 28rpx">
<text>司机:{{item.driverName}}({{item.mobile}})</text>
</view>
</view>
</van-cell>
</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>
<view style="border-radius: 50rpx;position: fixed;bottom:160rpx;right:50rpx">
<van-button round type="info" icon="plus" bind:click="lookItem" custom-style="width: 100rpx;height: 100rpx;"></van-button>
</view>
<notification id="qn-notification"/>

1
pages/setting/vehicle-list/index.wxss

@ -0,0 +1 @@
/* pages/setting/paper-list/index.wxss */

2
utils/util.js

@ -215,7 +215,7 @@ function throttle(fn, interval) {
fn.call(context,arguments);
enterTime = backTime;//赋值给第一次触发的时间,这样就保存了第二次触发的时间
}
};
}
}
module.exports = {

Loading…
Cancel
Save