import { queryGetDivisions } from "./api/common/index"; import { getTaAccounts } from './api/account/index'; import { v4 } from "../store/utils/uuid/index"; import { IMessageHead } from './../services/socket/trade/protobuf/proto'; import Toast from "../miniprogram_npm/@vant/weapp/toast/toast"; /// 获取履约步骤类型ID export function getSteptype(typeid: number): string { switch (typeid) { case 1: return '买方支付' break; case 2: return '卖方收款' break; case 3: return '买方自提' break; case 4: return '卖方发货' break; case 5: return '买方确认货' break; case 6: return '卖方发票' break; case 7: return '买方确认票' break; case 8: return '卖仓单转移' break; case 9: return '释放卖方冻结' break; case 10: return '货款溢短' break; case 11: return '生成合同[中江]' break; case 12: return '运费' break; case 90: return '确认支付' break; case 91: return '确认放行' break; default: return '买方支付(直接扣款)' break; } } /// 获取履约状态 export function getPerformancestatus(status: number): string { switch (status) { case 1: return '待激活' break; case 2: return '正常' break; case 3: return '处理错误' break; case 4: return '违约待处理' break; case 5: return '违约处理中' break; case 6: return '完成' break; case 7: return '违约已完成' break; case 8: return '释放冻结失败 ' break; case 9: return '超时待处理' break; default: return '超时关闭' break; } } /// 获取出境检测执行状态 export function getExecutestatus(status: number) { switch (status) { case 1: return '未生效' break; case 2: return '进行中' break; default: return '已结束' break; } } /// 获取地区区域信息 export function getDivisions() { /// 发送请求 queryGetDivisions({ enableAuthorization: false, success: (res) => { /// 数据缓存 wx.setStorageSync('GetDivisions', res.data) }, fail: () => { Toast('地区信息获取失败') } }) } /// 获取资金账户信息 export function taAccounts() { /// 发送请求 getTaAccounts({ data: { loginID: loginid() }, success: (res) => { /// 数据缓存 wx.setStorageSync('GetTaAccounts', res.data) wx.setStorageSync('AccountID', res.data[0].accountid) }, fail: () => { Toast('资金账户信息获取失败') } }) } /// 获取登录Loginid export function loginid() { return wx.getStorageSync('LoginID') } /// 获取用户userid export function userid() { return wx.getStorageSync('UserId') } /// 获取资金用户ID export function accountid() { return wx.getStorageSync('AccountID') } /// 获取用户Token export function xtoken() { return wx.getStorageSync('Authorization') } /// 获取市场id export function marketid() { return wx.getStorageSync('MarketID') } /// 是否加密 export function isEncrypted() { return false } /// 获取地区信息 export function divisions() { return wx.getStorageSync('GetDivisions') } /// 终端类型 export function clientType() { return 5 } /// 返回proto交易头 export function protoHeader(funcode: number) { /// 组合请求头 const header: IMessageHead = { FunCode: funcode, AccountID: accountid(), UserID: userid(), MarketID: marketid(), UUID: v4() } return header } /// 获取时间戳 export function timetample() { return Date.parse(new Date().toString()) }