Browse Source

no message

feature/v1.0
xpz2018 5 years ago
parent
commit
df0dddea8b
3 changed files with 29 additions and 5 deletions
  1. 2
      api/saas.js
  2. 30
      pages/process/payment/index.js
  3. 2
      pages/process/payment/index.wxml

2
api/saas.js

@ -22,6 +22,7 @@ const pricingOrder = (params) => mPost(`/ztb-factory/factory/submit/order-price`
const cancelOrder = (id) => mPost(`/ztb-factory/factory/cancel/order/${id}`, null, sconfig) const cancelOrder = (id) => mPost(`/ztb-factory/factory/cancel/order/${id}`, null, sconfig)
const repeatOrder = (id) => mPost(`/ztb-factory/factory/renew/empty-weight/${id}`, null, sconfig) const repeatOrder = (id) => mPost(`/ztb-factory/factory/renew/empty-weight/${id}`, null, sconfig)
const checkingOrder = (params) => mPost(`/ztb-factory/factory/audit-pass/order`, params, sconfig) const checkingOrder = (params) => mPost(`/ztb-factory/factory/audit-pass/order`, params, sconfig)
const paymentOrder = (params) => mPost(`/ztb-factory/factory/pay/selected-order`, params, sconfig)
const createOrder = (params) => mPost(`/ztb-factory/factory-customer/save/order`, params, sconfig) const createOrder = (params) => mPost(`/ztb-factory/factory-customer/save/order`, params, sconfig)
const getFactoryOrderList = (params) => mGet(`/ztb-factory/factory/wechat-applet/get/order-list`, params, sconfig) const getFactoryOrderList = (params) => mGet(`/ztb-factory/factory/wechat-applet/get/order-list`, params, sconfig)
const getFactoryOrderInfo = (id) => mGet(`/ztb-factory/factory/wechat-applet/get/order-detail/${id}`, null, sconfig) const getFactoryOrderInfo = (id) => mGet(`/ztb-factory/factory/wechat-applet/get/order-detail/${id}`, null, sconfig)
@ -51,6 +52,7 @@ export {
createOrder, createOrder,
checkingOrder, checkingOrder,
pricingOrder, pricingOrder,
paymentOrder,
cancelOrder, cancelOrder,
getPaperPrice, getPaperPrice,
savePaperPrice, savePaperPrice,

30
pages/process/payment/index.js

@ -1,6 +1,6 @@
// pages/process/payment/index.js // pages/process/payment/index.js
import Dialog from '../../../components/dialog/dialog' import Dialog from '../../../components/dialog/dialog'
import { getPeymentList, repeatOrder } from "../../../api/saas"
import { getPeymentList, paymentOrder } from "../../../api/saas"
const event = require('../../../utils/event') const event = require('../../../utils/event')
const util = require('../../../utils/util') const util = require('../../../utils/util')
const math = require('../../../utils/math') //导入模块 const math = require('../../../utils/math') //导入模块
@ -18,7 +18,12 @@ Page({
pageSize: 100 pageSize: 100
}, },
amount: 0, amount: 0,
orderList: null
orderList: null,
params: {
ids: [],
payRemark: ''
},
requesting: false
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
@ -31,9 +36,11 @@ Page({
getPeymentList(this.data.form).then(result => { getPeymentList(this.data.form).then(result => {
wx.hideLoading() wx.hideLoading()
var amount = 0 var amount = 0
this.data.params.ids = []
if (result.data && result.data.records.length) { if (result.data && result.data.records.length) {
for (let index = 0; index < result.data.records.length; index++) { for (let index = 0; index < result.data.records.length; index++) {
amount = math.plus(amount, result.data.records[index].settlePrice) amount = math.plus(amount, result.data.records[index].settlePrice)
this.data.params.ids.push(result.data.records[index].id)
} }
this.setData({ safeBottom: app.globalData.safeBottom, orderList: result.data.records, amount }) this.setData({ safeBottom: app.globalData.safeBottom, orderList: result.data.records, amount })
} else { } else {
@ -49,24 +56,39 @@ Page({
var item = this.data.orderList[e.currentTarget.dataset.index] var item = this.data.orderList[e.currentTarget.dataset.index]
item.checked = !item.checked item.checked = !item.checked
var amount = 0 var amount = 0
this.data.params.ids = []
for (let index = 0; index < this.data.orderList.length; index++) { for (let index = 0; index < this.data.orderList.length; index++) {
if(!this.data.orderList[index].checked){ if(!this.data.orderList[index].checked){
amount = math.plus(amount, this.data.orderList[index].settlePrice) amount = math.plus(amount, this.data.orderList[index].settlePrice)
this.data.params.ids.push(this.data.orderList[index].id)
} }
} }
this.setData({ ['orderList[' + e.currentTarget.dataset.index + '].checked']: item.checked, amount }) this.setData({ ['orderList[' + e.currentTarget.dataset.index + '].checked']: item.checked, amount })
}, },
bindInput: function (e) {
this.data.params[e.target.id] = e.detail.value
},
paymentOrder: function(){ paymentOrder: function(){
if(this.data.requesting){
return
}
if(this.data.params.ids.length <= 0){
util.showToast('请选择要付款的订单')
return
}
Dialog.confirm({ title: '温馨提示', message: '确定要付款吗?' }).then(() => { Dialog.confirm({ title: '温馨提示', message: '确定要付款吗?' }).then(() => {
wx.showLoading({ title: '正在获取', mask: true }) wx.showLoading({ title: '正在获取', mask: true })
repeatOrder(this.data.form.id).then(result => {
this.data.requesting = true
paymentOrder(this.data.params).then(result => {
wx.hideLoading() wx.hideLoading()
util.showBackToast('订单已经处理')
util.showBackToast('订单已经付款')
event.emit('OrderMessage', { what: 12, desc: 'cancelOrder' }) event.emit('OrderMessage', { what: 12, desc: 'cancelOrder' })
}).catch(err => { }).catch(err => {
wx.hideLoading() wx.hideLoading()
this.data.requesting = false
util.showToast(err) util.showToast(err)
}) })
}).catch(err => {
}) })
} }
}) })

2
pages/process/payment/index.wxml

@ -15,7 +15,7 @@
<view class="text-black text-sg text-bold" style="margin-left: 12rpx">付款备注</view> <view class="text-black text-sg text-bold" style="margin-left: 12rpx">付款备注</view>
</view> </view>
<view class="flex flex-center" style="min-height:90rpx;border-bottom:1rpx solid #eee;"> <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" />
<input id="payRemark" placeholder-style="color:#aaa" style="width:100%;height:80rpx" placeholder="请输入付款备注" bindinput="bindInput" />
</view> </view>
</view> </view>

Loading…
Cancel
Save