Browse Source

no message

feature/v1.0
xpz2018 5 years ago
parent
commit
d88d0b938a
20 changed files with 433 additions and 84 deletions
  1. 6
      api/saas.js
  2. 2
      app.json
  3. 61
      components/action-sheet/index.wxml
  4. 2
      components/tabbar/index.wxml
  5. 5
      pages/formate.wxs
  6. 15
      pages/index/index.js
  7. 2
      pages/index/index.wxml
  8. 64
      pages/process/index/index.js
  9. 3
      pages/process/index/index.json
  10. 19
      pages/process/index/index.wxml
  11. 1
      pages/process/order-info/index.js
  12. 23
      pages/process/order-list/index.js
  13. 114
      pages/process/payment-list/index.js
  14. 11
      pages/process/payment-list/index.json
  15. 41
      pages/process/payment-list/index.wxml
  16. 7
      pages/process/payment-list/index.wxss
  17. 72
      pages/process/payment/index.js
  18. 9
      pages/process/payment/index.json
  19. 50
      pages/process/payment/index.wxml
  20. 10
      pages/process/payment/index.wxss

6
api/saas.js

@ -12,9 +12,11 @@ const sconfig = {
const loginToken = (params) => mPost(`/recycle-user-center/authorize/get/product-line-token/by/login-token`, params, sconfig)
const getUserInfo = () => mGet(`/recycle-user-center/user/get/user-info`, null, sconfig)
const getBaseInfo = () => mGet(`/ztb-factory/get/self-enterprise-profile-detail`, null, sconfig)
const getStatisticsInfo = (params) => mGet(`/ztb-factory/get/my-workbench-statistics-info`, params, sconfig)
const bindingAdmin = (params) => mPost(`/recycle-user-center/bind/factory-admin`, params, sconfig)
const getOrderList = (params) => mGet(`/ztb-factory/factory-customer/get/order-list`, params, sconfig)
const getReceiptList = (params) => mGet(`/ztb-factory/factory/get/order-receipt-proof-audit-list`, params, sconfig)
const getPeymentList = (params) => mGet(`/ztb-factory/get/order-pay-list`, params, sconfig)
const getOrderInfo = (id) => mGet(`/ztb-factory/factory-customer/get/order-detail/${id}`, null, sconfig)
const pricingOrder = (params) => mPost(`/ztb-factory/factory/submit/order-price`, params, sconfig)
const cancelOrder = (id) => mPost(`/ztb-factory/factory/cancel/order/${id}`, null, sconfig)
@ -42,6 +44,7 @@ export {
getFactoryOrderInfo,
getOrderList,
getReceiptList,
getPeymentList,
getOrderInfo,
createOrder,
checkingOrder,
@ -55,5 +58,6 @@ export {
deleteCustomer,
getCustomerInfo,
getPaperList,
repeatOrder
repeatOrder,
getStatisticsInfo
}

2
app.json

@ -9,6 +9,8 @@
"pages/process/order-list/index",
"pages/process/order-price/index",
"pages/process/order-info/index",
"pages/process/payment-list/index",
"pages/process/payment/index",
"pages/htmls/agreement/index",
"pages/message/detail/index"
],

61
components/action-sheet/index.wxml

@ -1,67 +1,36 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<van-popup
show="{{ show }}"
position="bottom"
round="{{ round }}"
z-index="{{ zIndex }}"
overlay="{{ overlay }}"
custom-class="van-action-sheet"
safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}"
bind:close="onClickOverlay"
>
<van-popup show="{{ show }}" position="bottom" round="{{ round }}" z-index="{{ zIndex }}" overlay="{{ overlay }}"
custom-class="van-action-sheet" safe-area-inset-bottom="{{ safeAreaInsetBottom }}"
close-on-click-overlay="{{ closeOnClickOverlay }}" bind:close="onClickOverlay">
<view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header">
{{ title }}
<van-icon
name="close"
custom-class="van-action-sheet__close"
bind:click="onClose"
/>
<van-icon name="close" custom-class="van-action-sheet__close" bind:click="onClose" />
</view>
<view wx:if="{{ description }}" class="van-action-sheet__description">
{{ description }}
</view>
<view wx:if="{{ actions && actions.length }}">
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 -->
<button
wx:for="{{ actions }}"
wx:key="index"
open-type="{{ item.openType }}"
<button wx:for="{{ actions }}" wx:key="index" open-type="{{ item.openType }}"
style="{{ item.color ? 'color: ' + item.color : '' }}"
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}"
hover-class="van-action-sheet__item--hover"
data-index="{{ index }}"
bind:tap="onSelect"
bindgetuserinfo="bindGetUserInfo"
bindcontact="bindContact"
bindgetphonenumber="bindGetPhoneNumber"
binderror="bindError"
bindlaunchapp="bindLaunchApp"
bindopensetting="bindOpenSetting"
lang="{{ lang }}"
session-from="{{ sessionFrom }}"
send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}"
send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}"
app-parameter="{{ appParameter }}"
>
hover-class="van-action-sheet__item--hover" data-index="{{ index }}" bind:tap="onSelect"
bindgetuserinfo="bindGetUserInfo" bindcontact="bindContact" bindgetphonenumber="bindGetPhoneNumber"
binderror="bindError" bindlaunchapp="bindLaunchApp" bindopensetting="bindOpenSetting" lang="{{ lang }}"
session-from="{{ sessionFrom }}" send-message-title="{{ sendMessageTitle }}"
send-message-path="{{ sendMessagePath }}" send-message-img="{{ sendMessageImg }}"
show-message-card="{{ showMessageCard }}" app-parameter="{{ appParameter }}">
<block wx:if="{{ !item.loading }}">
{{ item.name }}
<text wx:if="{{ item.subname }}" class="van-action-sheet__subname" >{{ item.subname }}</text>
<text wx:if="{{ item.subname }}" class="van-action-sheet__subname">{{ item.subname }}</text>
</block>
<van-loading wx:else custom-class="van-action-sheet__loading" size="20px" />
</button>
</view>
<slot />
<view
wx:if="{{ cancelText }}"
class="van-action-sheet__cancel"
hover-class="van-action-sheet__cancel--hover"
hover-stay-time="70"
bind:tap="onCancel"
>
<view wx:if="{{ cancelText }}" class="van-action-sheet__cancel" hover-class="van-action-sheet__cancel--hover"
hover-stay-time="70" bind:tap="onCancel">
{{ cancelText }}
</view>
</van-popup>
</van-popup>

2
components/tabbar/index.wxml

@ -1,4 +1,4 @@
<wxs src="../wxs/utils.wxs" module="utils" />
<view class="custom-class {{ utils.bem('tabbar', { fixed, safe: safeAreaInsetBottom }) }}" style="{{ zIndex ? 'z-index: ' + zIndex : '' }}">
<view class="custom-class {{ utils.bem('tabbar', { fixed, safe: safeAreaInsetBottom }) }}" style="{{ zIndex ? 'z-index: ' + zIndex : '' }};width:750rpx">
<slot />
</view>

5
pages/formate.wxs

@ -56,8 +56,13 @@ function formateAmount(amount) {
return Number(amount).toFixed(2)
}
function formateWeight(weight) {
return Number(weight).toFixed(3)
}
module.exports = {
formateAmount: formateAmount,
formateWeight: formateWeight,
formatTime: formatTime,
formateDate: formateDate
}

15
pages/index/index.js

@ -1,4 +1,5 @@
// pages/administ/index.js
const event = require('../../utils/event')
const app = getApp()
Page({
@ -13,7 +14,8 @@ Page({
{ index: 1, value: 'work', badge: 0, name: '工作台', blue: '/assets/image/tabbar/process-blue.png', gray: '/assets/image/tabbar/process-gray.png' },
{ index: 2, value: 'home', badge: 0, name: '我的', blue: '/assets/image/tabbar/home-blue.png', gray: '/assets/image/tabbar/home-gray.png' }
],
tabIndex: 1
tabIndex: 1,
visiable: true
},
/************************************** 初始化流程 ********************************************/
onLoad: function (options) {
@ -23,7 +25,8 @@ Page({
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate()
})
this.setData({fragment: (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight) - 100, safeBottom: app.globalData.safeBottom })
event.on('TabMessage', this, this.onEvent)
this.setData({fragment: (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight), safeBottom: app.globalData.safeBottom })
},
/************************************** 生命周期函数--监听页面初次渲染完成 ********************************************/
onShow: function () {
@ -38,5 +41,13 @@ Page({
},
stopTouchMove: function(e){
return false
},
onEvent: function (message) {
if (message.what == 99) {
this.setData({ visiable: message.visiable })
}
},
onUnload: function(){
event.remove('TabMessage', this)
}
})

2
pages/index/index.wxml

@ -5,7 +5,7 @@
<swiper-item catchtouchmove="stopTouchMove"><home id="{{tabList[2].value}}"/></swiper-item>
</swiper>
<view class="bg-white foot" style="height:{{100 + safeBottom}}rpx;padding-bottom:{{safeBottom}}rpx">
<view class="cu-bar bg-white foot" style="height:{{100 + safeBottom}}rpx;padding-bottom:{{safeBottom}}rpx;display:{{visiable? 'block' : 'none'}}">
<van-tabbar active="{{ tabIndex }}" fixed="{{false}}" bind:change="onChange">
<van-tabbar-item wx:for="{{tabList}}" wx:key="index" >
<van-icon slot="icon" name="{{item.gray}}" size="25"/>

64
pages/process/index/index.js

@ -1,5 +1,5 @@
// pages/index/index.js
import { getUserInfo } from "../../../api/user"
import { getStatisticsInfo } from "../../../api/saas"
const event = require('../../../utils/event')
const app = getApp()
@ -19,8 +19,19 @@ Component({
{ status: 2, badge: '', name: '过磅审核', icon: '/assets/image/icon_checking.png' },
{ status: 3, badge: '', name: '待付款', icon: '/assets/image/icon_payment.png' },
{ status: 4, badge: '', name: '已完成', icon: '/assets/image/icon_finish.png' },
{ status: 5, badge: '', name: '已关闭', icon: '/assets/image/icon_close.png' }
]
// { status: 5, badge: '', name: '已关闭', icon: '/assets/image/icon_close.png' }
],
show: false,
actions: [
{ name: '选项1' },
{ name: '选项2' },
{ name: '选项3' },
],
form: {},
totalInfo: {
totalMoney: 0,
totalWeight: 0,
}
},
lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
@ -34,14 +45,53 @@ Component({
},
methods: {
onRestart: function () {
this.fetchStatisticsInfo()
},
onEvent: function (message) {
if (message.what == 888) {
}
},
toOrderList: function (e) {
wx.navigateTo({ url: '/pages/process/order-list/index?status=' + e.currentTarget.dataset.status })
}
orderList: function (e) {
if(e.currentTarget.dataset.status == 3){
wx.navigateTo({ url: '/pages/process/payment-list/index?status=' + e.currentTarget.dataset.status })
} else {
wx.navigateTo({ url: '/pages/process/order-list/index?status=' + e.currentTarget.dataset.status })
}
},
fetchStatisticsInfo: function(){
getStatisticsInfo(this.data.form).then(result => {
if(Number(result.data.priceOrderNum) > 0){
this.data.tabList[0].badge = Number(result.data.priceOrderNum)
} else {
this.data.tabList[0].badge = ''
}
if(Number(result.data.waitAuditOrderNum) > 0){
this.data.tabList[1].badge = Number(result.data.waitAuditOrderNum)
} else {
this.data.tabList[1].badge = ''
}
if(Number(result.data.waitPayOrderNum) > 0){
this.data.tabList[2].badge = Number(result.data.waitPayOrderNum)
} else {
this.data.tabList[2].badge = ''
}
this.setData({ tabList: this.data.tabList, totalInfo: result.data })
}).catch(err => {
console.log(err)
})
},
showSheet: function(){
// this.setData({ show: true })
// event.emit('TabMessage', { what: 99, visiable: false })
},
onClose() {
this.setData({ show: false })
setTimeout(function(){
event.emit('TabMessage', { what: 99, visiable: true })
}, 100)
},
onSelect({detail}) {
console.log(detail)
},
}
})

3
pages/process/index/index.json

@ -6,6 +6,7 @@
"van-cell": "/components/cell/index",
"van-cell-group": "/components/cell-group/index",
"van-info": "/components/info/index",
"van-icon": "/components/icon/index"
"van-icon": "/components/icon/index",
"van-action-sheet": "/components/action-sheet/index"
}
}

19
pages/process/index/index.wxml

@ -1,4 +1,5 @@
<!--pages/process/index.wxml-->
<wxs module="formate" src="../../formate.wxs"></wxs>
<cu-custom bgColor="bg-white">
<view slot="content" style="color:black;font-size:36rpx">工作台</view>
</cu-custom>
@ -7,7 +8,7 @@
<view style="height:250rpx;background-color:#008AFF;border-radius: 0rpx 0rpx 12rpx 12rpx;">
<view class="flex flex-center" style="padding:32rpx 28rpx;justify-content: flex-start">
<image style="width:100rpx;height:100rpx" src="/assets/image/icon_logo.png"></image>
<view class="text-xxl text-bold name">{{userInfo.factoryName}}</view>
<view class="text-xxl text-bold name">{{userInfo.factoryName || userInfo.enterpriseName}}</view>
</view>
</view>
@ -15,7 +16,7 @@
<view class="bg-white" style="border-radius: 20rpx;padding: 24rpx 0rpx 8rpx 0rpx">
<view class="flex flex-justify" style="padding: 0rpx 28rpx 24rpx 28rpx">
<view class="text-black text-sg text-bold">收货统计</view>
<view class="flex flex-center">
<view class="flex flex-center" bindtap="showSheet">
<view class="text-black text-sm" style="margin-right:8rpx">今日</view>
<van-icon name="arrow-down" />
</view>
@ -26,15 +27,15 @@
<view style="height:24rpx;width:6rpx;background:#007AFF"></view>
<view class="text-black text-sm" style="margin-left: 12rpx">收货重量</view>
</view>
<view class="text-xxl text-bold" style="margin:12rpx 0rpx">0.000吨</view>
<view class="text-xxl text-bold" style="margin:12rpx 0rpx">{{formate.formateWeight(totalInfo.totalWeight)}}吨</view>
<view class="text-gray text-sm">查看收货详情</view>
</view>
<view style="flex:1;padding:0rpx 32rpx;margin-left:12rpx" bindtap="orderList">
<view style="flex:1;padding:0rpx 32rpx;margin-left:12rpx">
<view class="flex flex-center" style="justify-content: flex-start">
<view style="height:24rpx;width:6rpx;background:#FF8413"></view>
<view class="text-black text-sm" style="margin-left: 12rpx">收货金额</view>
</view>
<view class="text-xxl text-bold text-price" style="margin:12rpx 0rpx">0.00</view>
<view class="text-xxl text-bold text-price" style="margin:12rpx 0rpx">{{formate.formateAmount(totalInfo.totalMoney)}}</view>
</view>
</view>
</view>
@ -43,8 +44,8 @@
<view style="padding: 0rpx 28rpx;margin-top:24rpx">
<view class="bg-white" style="border-radius: 20rpx;padding: 24rpx 0rpx">
<view class="text-black text-sg text-bold" style="padding: 0rpx 28rpx 12rpx 28rpx">收货订单</view>
<van-grid column-num="5" border="{{fasle}}">
<van-grid-item wx:for="{{ tabList }}" wx:key="index" data-status="{{item.status}}" bind:click="toOrderList" text="{{item.name}}">
<van-grid column-num="4" border="{{fasle}}">
<van-grid-item wx:for="{{ tabList }}" wx:key="index" data-status="{{item.status}}" bind:click="orderList" text="{{item.name}}">
<van-icon slot="icon" name="{{ item.icon }}" size="68rpx" info="{{item.badge}}" />
</van-grid-item>
</van-grid>
@ -91,4 +92,6 @@
</view>
</view> -->
<view style="height:24rpx;"></view>
</scroll-view>
</scroll-view>
<van-action-sheet show="{{ show }}" actions="{{ actions }}" bind:close="onClose" bind:select="onSelect" z-index="22"/>

1
pages/process/order-info/index.js

@ -33,7 +33,6 @@ Page({
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err)
console.log(err)
})
}
},

23
pages/process/order-list/index.js

@ -1,6 +1,6 @@
// pages/process/order-list/index.js
import Dialog from '../../../components/dialog/dialog'
import { getFactoryOrderList, cancelOrder, getReceiptList } from "../../../api/saas"
import { getFactoryOrderList, cancelOrder } from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
@ -67,21 +67,12 @@ Page({
} else {
this.setData({ requesting: true })
}
if(this.data.form.funcType == 3){
getReceiptList(this.data.form).then(result => {
this.handResult(result)
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
} else {
getFactoryOrderList(this.data.form).then(result => {
this.handResult(result)
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
}
getFactoryOrderList(this.data.form).then(result => {
this.handResult(result)
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
},
handResult: function(result){
if (result.data && result.data.records.length) {

114
pages/process/payment-list/index.js

@ -0,0 +1,114 @@
// pages/process/order-list/index.js
import { getPeymentList } from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const app = getApp()
Page({
// * 页面的初始数据
data: {
height: app.globalData.fragmentHeight,
loading: true,
requesting: false,
finished: false,
top: 0,
orderList: [],
form: {
status: 4,
funcType: 4,
pageNum: 1,
pageSize: 10
},
lastTime: null
},
// * 生命周期函数--监听页面加载
onLoad: function (options) {
event.on('OrderMessage', this, this.onEvent)
this.setData({ height: app.globalData.fragmentHeight })
this.fetchOrderList()
},
onEvent: function(message){
if (message.what == 12) {
this.onRefreshList()
}
},
onRefreshList: function () {
this.setData({
orderList: [],
['form.pageNum']: 1,
loading: true,
finished: false
})
this.data.lastTime = null
this.fetchOrderList()
},
//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 })
}
getPeymentList(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)
})
},
lookItem: function (e) {
var item = this.data.orderList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
wx.navigateTo({ url: '/pages/process/payment/index?mobile=' + item.factoryCustomerMobile })
},
onUnload: function(){
event.remove('OrderMessage', this)
}
})

11
pages/process/payment-list/index.json

@ -0,0 +1,11 @@
{
"usingComponents": {
"refresh-view": "/components/refresher/index",
"van-button": "/components/button/index",
"van-index-bar": "/components/index-bar/index",
"van-index-anchor": "/components/index-anchor/index",
"van-cell": "/components/cell/index",
"van-divider": "/components/divider/index",
"van-loading": "/components/loading/index"
}
}

41
pages/process/payment-list/index.wxml

@ -0,0 +1,41 @@
<!--pages/process/order-list/index.wxml-->
<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>

7
pages/process/payment-list/index.wxss

@ -0,0 +1,7 @@
/* pages/process/order-list/index.wxss */
.item-content{
padding: 20rpx 32rpx 20rpx 0rpx;
border-bottom:1rpx solid #f3f3f3;
margin-left:32rpx;
align-items: flex-start;
}

72
pages/process/payment/index.js

@ -0,0 +1,72 @@
// pages/process/payment/index.js
import Dialog from '../../../components/dialog/dialog'
import { getPeymentList, repeatOrder } from "../../../api/saas"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const math = require('../../../utils/math') //导入模块
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
safeBottom: app.globalData.safeBottom,
form: {
status: 4,
pageNum: 1,
pageSize: 100
},
amount: 0,
orderList: null
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
if(options.mobile){
this.data.form.mobile = options.mobile
}
wx.showLoading({ title: '正在获取', mask: true })
getPeymentList(this.data.form).then(result => {
wx.hideLoading()
var amount = 0
if (result.data && result.data.records.length) {
for (let index = 0; index < result.data.records.length; index++) {
amount = math.plus(amount, result.data.records[index].settlePrice)
}
this.setData({ safeBottom: app.globalData.safeBottom, orderList: result.data.records, amount })
} else {
this.setData({ safeBottom: app.globalData.safeBottom })
}
}).catch(err => {
wx.hideLoading()
this.setData({ safeBottom: app.globalData.safeBottom })
util.showToast(err)
})
},
lookItem: function(e){
var item = this.data.orderList[e.currentTarget.dataset.index]
item.checked = !item.checked
var amount = 0
for (let index = 0; index < this.data.orderList.length; index++) {
if(!this.data.orderList[index].checked){
amount = math.plus(amount, this.data.orderList[index].settlePrice)
}
}
this.setData({ ['orderList[' + e.currentTarget.dataset.index + '].checked']: item.checked, amount })
},
paymentOrder: function(){
Dialog.confirm({ title: '温馨提示', message: '确定要付款吗?' }).then(() => {
wx.showLoading({ title: '正在获取', mask: true })
repeatOrder(this.data.form.id).then(result => {
wx.hideLoading()
util.showBackToast('订单已经处理')
event.emit('OrderMessage', { what: 12, desc: 'cancelOrder' })
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
})
}
})

9
pages/process/payment/index.json

@ -0,0 +1,9 @@
{
"usingComponents": {
"van-cell": "/components/cell/index",
"van-button": "/components/button/index",
"van-checkbox": "/components/checkbox/index",
"van-image": "/components/image/index",
"van-dialog": "/components/dialog/index"
}
}

50
pages/process/payment/index.wxml

@ -0,0 +1,50 @@
<!--pages/process/payment/index.wxml-->
<wxs module="formate" src="../../formate.wxs"></wxs>
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">收货付款</view>
</cu-custom>
<view class="flex flex-column" style="height:360rpx;background-color:#008AFF;align-items: center">
<view class="text-white text-sg" style="margin-top:72rpx">付款金额(元)</view>
<view class="text-white text-sl text-bold" style="margin-top:16rpx">{{formate.formateAmount(amount)}}</view>
</view>
<view class="bg-white" style="border-radius: 20rpx 20rpx 0rpx 0rpx;padding: 32rpx;margin-top:-90rpx">
<view class="flex flex-center" style="justify-content: flex-start">
<view style="height:24rpx;width:6rpx;background:#007AFF"></view>
<view class="text-black text-sg text-bold" style="margin-left: 12rpx">付款备注</view>
</view>
<view class="flex flex-center" style="min-height:90rpx;border-bottom:1rpx solid #eee;">
<input placeholder-style="color:#aaa" style="width:100%;height:80rpx" placeholder="请输入付款备注" bindinput="bindInput" />
</view>
</view>
<view class="flex flex-center bg-white lable" style="justify-content: flex-start" wx:if="{{orderList}}">
<view style="height:24rpx;width:6rpx;background:#007AFF"></view>
<view style="margin-left: 12rpx">
<text class="text-black text-sg text-bold">订单列表</text>
<text class="text-gray text-sm" style="margin-left:18rpx">(共3笔订单)</text>
</view>
</view>
<van-cell clickable wx:for="{{ orderList }}" wx:key="index" data-index="{{index}}" bindtap="lookItem">
<view slot="title" class="flex" style=";justify-content: flex-start">
<van-checkbox value="{{ !item.checked }}" custom-class="checkbox" icon-size="36rpx" shape="square"></van-checkbox>
<view style="flex:1;margin-left:16rpx">
<view class="flex flex-justify">
<view class="text-black text-lg">{{item.factoryCustomerName}} {{item.factoryCustomerMobile}}</view>
<view class="text-sm text-gray">2021年2月22日</view>
</view>
<view class="text-sm text-gray" style="line-height:54rpx">
<text>废纸品类:{{item.productCategoryName}}</text>
<text style="margin-left:32rpx">金额:{{formate.formateAmount(item.settlePrice)}}元</text>
</view>
</view>
</view>
</van-cell>
<view style="height:{{132 + safeBottom}}rpx;"></view>
<view class="cu-bar bg-white foot" style="height:{{132 + safeBottom}}rpx;padding:0rpx 32rpx {{safeBottom}}rpx 32rpx;" wx:if="{{orderList}}">
<van-button type="info" custom-style="height:88rpx;width:686rpx" disabled="{{amount==0}}" bind:click="paymentOrder">付款</van-button>
</view>
<van-dialog id="van-dialog" />

10
pages/process/payment/index.wxss

@ -0,0 +1,10 @@
/* pages/process/payment/index.wxss */
.checkbox{
padding-top: 6rpx;
}
.lable{
padding: 32rpx 32rpx 24rpx 32rpx;
margin-top:18rpx;
border-bottom:1rpx solid #eee
}
Loading…
Cancel
Save