| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232 |
- import { FunCode } from "../../../../constants/enum/funcode"
- import { sendMsgToMQ } from "../../../../services/api/common/index"
- import { queryGZBSFWOrder } from "../../../../services/api/trade/index"
- import { clientType, getErrorMsg, isEncrypted, loginCode, loginid, protoHeader, timetample, userid } from "../../../../services/utils"
- import { hideLoading, showLoading } from "../../../../utils/message/index"
- import { isnullstr } from "../../../../utils/util"
- import { encryptBody } from "../../../../utils/websocket/crypto"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- /// 底部安全区域
- safeBottom: getApp().globalData.safeBottom,
- /// tabs
- tabs: [{id: 0, name: '待处理'}, {id: 1, name: '进行中'}, {id: 2, name: '已结束'}],
- /// tab索引
- active: 0,
- /// 列头
- titles: [['总净重(ct)| 总净重(g)| 总毛重(g)', '单据编号'],
- ['总值(USD)| 单价(USD/ct)', '状态'], ['内容 | 备注']],
- /// 是否空数据
- isEmpty: true,
- /// 数据信息
- bonds: <GuangZuan.GZBSFWOrder[]>[],
- /// 显示的值
- values: <{}[]>[]
- },
- /**
- * 返回上层视图
- */
- backToParent() {
- /// 返回上层视图
- wx.navigateBack()
- },
- onButtonPressed(e: any) {
- /// 获取对应的id
- const ids = String(e.target.id).split(' ')
- let id = String(e.target.id).split(' ')[0]
- const index = Number(ids[1])
- /// 传参
- const { orderid, gzbsstatusdisplay, gzbsstatus, orderno } = this.data.bonds[index]
- switch (id) {
- case 'detail': /// 详情
- wx.navigateTo({ url: "/mHome/pages/bond/detail/index?orderid="+orderid+'&status='+gzbsstatusdisplay+'&orderno='+orderno })
- break;
- case 'confirmprepayment': /// 确认预付款
- wx.navigateTo({ url: '/mHome/pages/bond/prepayment/index?orderid='+orderid+'&statusdisplay='+gzbsstatusdisplay+'&status='+gzbsstatus+'&orderno='+orderno })
- break;
- case 'confirmpayment': /// 确认付款
- wx.navigateTo({ url: '/mHome/pages/bond/payment/index?orderid='+orderid+'&statusdisplay='+gzbsstatusdisplay+'&status='+gzbsstatus+'&orderno='+orderno })
- break;
- default:
- break;
- }
- },
- /**
- * tab触发事件
- */
- onTabChange(e: any) {
- /// 设置激活项
- this.setData({ active: e.detail.index })
- /// 查询保税服务单据
- this.queryGZBSFWOrder()
- },
- /**
- * 查询保税服务单据
- */
- queryGZBSFWOrder() {
- /// loding.....
- showLoading(() => {
- /// 发送查询
- queryGZBSFWOrder({
- data: {
- /// 模糊搜索
- userid: userid(),
- executestatus: this.data.active+1
- },
- /// 加载成功
- success: (res) => {
- if (res.code != 200) {
- /// 加载失败
- hideLoading(()=>{}, '加载失败...')
- return
- }
- hideLoading(() => {
- /// 数据赋值
- this.setData({
- bonds: res.data,
- /// 显示的值
- values: res.data.map(obj => {
- /// 宽度设置
- var width = 50.0
- if (obj.gzbsstatus === 5 || obj.gzbsstatus === 11) {
- width = 100.0
- }
- return { up: [obj.totalnetweigthct.toString()+' | '+
- obj.totalnetweightgm.toString()+' | '+
- obj.totalgrossweightgm.toString(),
- isnullstr(obj.orderno)],
- mid:[obj.totalamount.toString(),
- obj.priceper.toString(),
- obj.gzbsstatusdisplay],
- dwn: [isnullstr(obj.contentrange.toString())+' | '+ '--',
- ''],
- width: width}
- }),
- isEmpty: res.data.length === 0
- })
- })
- },
- fail: (emsg) => {
- hideLoading(()=>{}, '加载失败...'+emsg)
- },
- complete: () => {
- /// 停止下拉刷新
- wx.stopPullDownRefresh()
- }
- })
- })
- },
- /**
- * 保税服务操作
- */
- doBSFWOperator(operator: number, orderid: number) {
- /// loding.....
- showLoading(()=>{
- /// 参数信息
- const info = JSON.stringify({
- UserID: userid(),
- OperateID: loginid(),
- ClientType: clientType,
- ClientSerialNo: timetample().toString,
- OperateAccount: loginCode(),
- OrderID: orderid,
- OperateType: operator,
- Header: protoHeader(FunCode.BSFWMemberOperateReq, 66201)
- })
- /// 发送请求
- sendMsgToMQ({
- data: {
- data: encryptBody(info),
- funCodeReq: FunCode.BSFWMemberOperateReq,
- funCodeRsp: FunCode.BSFWMemberOperateRsp,
- isEncrypted: isEncrypted()
- },
- success: (res) => {
- /// 解析对象
- const data = JSON.parse(res.data.data)
- if (data.RetCode != 0) {
- hideLoading(() => {}, getErrorMsg(data.RetCode))
- return
- }
- /// 操作成功
- hideLoading(()=>{
- /// 重新获取数据
- this.queryGZBSFWOrder()
- })
- },
- fail: (emsg) => {
- /// 操作失败
- hideLoading(()=>{}, emsg)
- }
- })
- }, '操作请求中.....')
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad() {
- /// 查询保税服务单据
- this.queryGZBSFWOrder()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- /// 查询保税服务单据
- this.queryGZBSFWOrder()
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|