20 changed files with 433 additions and 84 deletions
Unified View
Diff Options
-
6api/saas.js
-
2app.json
-
61components/action-sheet/index.wxml
-
2components/tabbar/index.wxml
-
5pages/formate.wxs
-
15pages/index/index.js
-
2pages/index/index.wxml
-
64pages/process/index/index.js
-
3pages/process/index/index.json
-
19pages/process/index/index.wxml
-
1pages/process/order-info/index.js
-
23pages/process/order-list/index.js
-
114pages/process/payment-list/index.js
-
11pages/process/payment-list/index.json
-
41pages/process/payment-list/index.wxml
-
7pages/process/payment-list/index.wxss
-
72pages/process/payment/index.js
-
9pages/process/payment/index.json
-
50pages/process/payment/index.wxml
-
10pages/process/payment/index.wxss
@ -1,67 +1,36 @@ |
|||||
<wxs src="../wxs/utils.wxs" module="utils" /> |
<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"> |
<view wx:if="{{ title }}" class="van-hairline--bottom van-action-sheet__header"> |
||||
{{ title }} |
{{ 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> |
||||
<view wx:if="{{ description }}" class="van-action-sheet__description"> |
<view wx:if="{{ description }}" class="van-action-sheet__description"> |
||||
{{ description }} |
{{ description }} |
||||
</view> |
</view> |
||||
<view wx:if="{{ actions && actions.length }}"> |
<view wx:if="{{ actions && actions.length }}"> |
||||
<!-- button外包一层view,防止actions动态变化,导致渲染时button被打散 --> |
<!-- 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 : '' }}" |
style="{{ item.color ? 'color: ' + item.color : '' }}" |
||||
class="{{ utils.bem('action-sheet__item', { disabled: item.disabled || item.loading }) }} van-hairline--top {{ item.className || '' }}" |
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 }}"> |
<block wx:if="{{ !item.loading }}"> |
||||
{{ item.name }} |
{{ 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> |
</block> |
||||
<van-loading wx:else custom-class="van-action-sheet__loading" size="20px" /> |
<van-loading wx:else custom-class="van-action-sheet__loading" size="20px" /> |
||||
</button> |
</button> |
||||
</view> |
</view> |
||||
<slot /> |
<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 }} |
{{ cancelText }} |
||||
</view> |
</view> |
||||
</van-popup> |
|
||||
|
</van-popup> |
||||
@ -1,4 +1,4 @@ |
|||||
<wxs src="../wxs/utils.wxs" module="utils" /> |
<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 /> |
<slot /> |
||||
</view> |
</view> |
||||
@ -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) |
||||
|
} |
||||
|
|
||||
|
}) |
||||
@ -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" |
||||
|
} |
||||
|
} |
||||
@ -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> |
||||
@ -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; |
||||
|
} |
||||
@ -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) |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
@ -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" |
||||
|
} |
||||
|
} |
||||
@ -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" /> |
||||
@ -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 |
||||
|
} |
||||
Write
Preview
Loading…
Cancel
Save