| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- import { FunCode } from "../../../../constants/enum/funcode"
- import { sendMsgToMQ } from "../../../../services/api/common/index"
- import { queryGzbscReckonOrder } from "../../../../services/api/orders/index"
- import { getEnumdicValue, getErrorMsg, isEncrypted, protoHeader, timetample, userid } from "../../../../services/utils"
- import { hideLoading, showLoading, showModel } from "../../../../utils/message/index"
- import { isnullstr } from "../../../../utils/util"
- import { encryptBody } from "../../../../utils/websocket/crypto"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- /// 底部安全区域
- safeBottom: getApp().globalData.safeBottom,
- /// tabs
- tabs: [{id: 2, name: '待支付'}, {id: 3, name: '已支付'}],
- /// 类别
- active: 0,
- /// 是否空数据
- isEmpty: false,
- /// 显示数据信息
- values: <{}>[]
- },
- /**
- * 返回上层视图
- */
- backToParent() {
- /// 返回上层视图
- wx.navigateBack()
- },
- onTabChange(e: any) {
- // 重置状态
- this.setData({ active: e.detail.index })
- /// 查询数据
- this.queryGzbscReckonOrder()
- },
- /// 申请支付提交
- doPayment(orderID: string) {
- /// showModel
- showModel(() => {
- /// showLoading
- showLoading(() => {
- /// 请求参数
- const info = JSON.stringify({
- Header: protoHeader(FunCode.BSWMSReckonPayReq),
- UserID: userid(),
- OrderID: orderID,
- ClientSerialNo: timetample().toString()
- })
- /// 发送请求
- sendMsgToMQ({
- data: {
- data: encryptBody(info),
- funCodeReq: FunCode.BSWMSReckonPayReq,
- funCodeRsp: FunCode.BSWMSReckonPayRsp,
- isEncrypted: isEncrypted()
- },
- success: (res) => {
- /// 解析对象
- const data = JSON.parse(res.data.data)
- if (data.RetCode != 0) {
- hideLoading(() => {}, getErrorMsg(data.RetCode))
- return
- }
- /// 求购发布请求成功
- hideLoading(() => {
- wx.navigateBack()
- }, '提交支付申请成功', 'success')
- },
- fail: (emsg) => {
- hideLoading(()=>{}, emsg)
- }
- })
- }, '提交申请请求中....')
- }, '提示', '确认要提交支付申请吗?')
- },
- /// 保税仓结算单表查询
- queryGzbscReckonOrder() {
- /// showLoading
- showLoading(() => {
- queryGzbscReckonOrder({
- data: {
- userid: userid(),
- paystatus: this.data.active+2
- },
- success: (res) => {
- /// 获取数据
- this.setData({
- isEmpty: res.data.length === 0,
- values: res.data.map(obj => {
- return {
- servicefee: obj.servicefee,
- paystatusdesc: getEnumdicValue('GZBSCPayStatus', obj.paystatus),
- paytradedate: isnullstr(obj.paytradedate),
- totalfee: obj.totalfee,
- storagefee: obj.storagefee,
- powerfee: obj.powerfee,
- premium: obj.premium,
- customsfee: obj.customsfee,
- paystatus: obj.paystatus,
- paytime: obj.paytime,
- orderid: obj.orderid
- }
- })
- })
- },
- complete: () => {
- /// hideLoading
- hideLoading()
- }
- })
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad() {
- /// 保税仓结算单表查询
- this.queryGzbscReckonOrder()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- /// 保税仓结算单表查询
- this.queryGzbscReckonOrder()
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|