|
|
@@ -1,11 +1,12 @@
|
|
|
-import { accountid, clientType, getErrorMsg, isEncrypted, marketid, protoHeader, timetample, userid } from "../../../../services/utils"
|
|
|
-import { hideLoading, showLoading, showModel } from "../../../../utils/message/index"
|
|
|
+import { accountid, clientType, getErrorMsg, isEncrypted, marketID, protoHeader, timetample, userid } from "../../../../services/utils"
|
|
|
+import { hideLoading, showLoading } from "../../../../utils/message/index"
|
|
|
import { encryptBody } from "../../../../utils/websocket/crypto"
|
|
|
import { FunCode } from "../../../../constants/enum/funcode"
|
|
|
import { sendMsgToMQ } from "../../../../services/api/common/index"
|
|
|
-import { formatDateString } from "../../../../utils/util"
|
|
|
+import { formatDateString, getDecimalNum } from "../../../../utils/util"
|
|
|
import { queryPermancePlanTmp } from "../../../../services/api/orders/index"
|
|
|
import services from "../../../../services/index"
|
|
|
+import Long from "long"
|
|
|
|
|
|
Page({
|
|
|
|
|
|
@@ -18,12 +19,16 @@ Page({
|
|
|
safeBottom: getApp().globalData.safeBottom,
|
|
|
/// 数据信息
|
|
|
item: {},
|
|
|
+ /// 认购数量
|
|
|
+ orderQty: '',
|
|
|
/// 选中履约模板
|
|
|
tmp: <GuangZuan.PermancePlanTmp>({}),
|
|
|
/// 颜色
|
|
|
colors: ['rebeccapurple', 'green', 'hotpink', 'orange', 'darkgoldenrod', 'firebrick', 'forestgreen', 'darksalmon', 'goldenrod', 'khaki', 'rosybrown', 'sandybrown'],
|
|
|
/// banner图
|
|
|
- banners: ['']
|
|
|
+ banners: [''],
|
|
|
+ /// 是否显示弹出层
|
|
|
+ show: false
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -34,52 +39,75 @@ Page({
|
|
|
wx.navigateBack()
|
|
|
},
|
|
|
|
|
|
+ onClose() {
|
|
|
+ if (!this.data.show) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ /// 关闭弹出层
|
|
|
+ this.setData({ show: false })
|
|
|
+ },
|
|
|
+
|
|
|
+ /// 显示弹出层
|
|
|
+ showPopup() {
|
|
|
+ if (this.data.show) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ /// 关闭弹出层
|
|
|
+ this.setData({ show: true })
|
|
|
+ },
|
|
|
+
|
|
|
+ // input输入中
|
|
|
+ getInputNum (e: any) {
|
|
|
+ /// 截取2位小数位
|
|
|
+ let num = getDecimalNum(e.detail)
|
|
|
+ this.setData({ orderQty: num})
|
|
|
+ },
|
|
|
+
|
|
|
/**
|
|
|
* 立即购买
|
|
|
*/
|
|
|
- doSubmit(orderID: string, qty: string) {
|
|
|
- /// showModel
|
|
|
- showModel(() => {
|
|
|
- /// showLoading
|
|
|
- showLoading(() => {
|
|
|
- /// 请求参数
|
|
|
- const info = JSON.stringify({
|
|
|
- Header: protoHeader(FunCode.GZPresaleOrderReq),
|
|
|
- UserID: userid(),
|
|
|
- AccountID: accountid(),
|
|
|
- WRTradeOrderID: Number(orderID),
|
|
|
- OrderQty: Number(qty),
|
|
|
- MarketID: marketid(),
|
|
|
- ClientType: clientType(),
|
|
|
- ClientOrderTime: formatDateString(new Date().toString()),
|
|
|
- ClientSerialNo: timetample().toString()
|
|
|
- })
|
|
|
- /// 发送请求
|
|
|
- sendMsgToMQ({
|
|
|
- data: {
|
|
|
- data: encryptBody(info),
|
|
|
- funCodeReq: FunCode.GZPresaleOrderReq,
|
|
|
- funCodeRsp: FunCode.GZPresaleOrderRsp,
|
|
|
- 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)
|
|
|
+ doSubmit() {
|
|
|
+ /// 关闭弹出窗
|
|
|
+ this.onClose()
|
|
|
+ /// showLoading
|
|
|
+ showLoading(() => {
|
|
|
+ /// 请求参数
|
|
|
+ const info = JSON.stringify({
|
|
|
+ Header: protoHeader(FunCode.GZPresaleOrderReq),
|
|
|
+ UserID: userid(),
|
|
|
+ AccountID: accountid(),
|
|
|
+ WRTradeOrderID: Long.fromNumber(this.data.item.sellwrtradeorderid),
|
|
|
+ OrderQty: Number(this.data.orderQty),
|
|
|
+ MarketID: marketID(63),
|
|
|
+ ClientType: clientType(),
|
|
|
+ ClientOrderTime: formatDateString(new Date().toString()),
|
|
|
+ ClientSerialNo: timetample().toString()
|
|
|
+ })
|
|
|
+ /// 发送请求
|
|
|
+ sendMsgToMQ({
|
|
|
+ data: {
|
|
|
+ data: encryptBody(info),
|
|
|
+ funCodeReq: FunCode.GZPresaleOrderReq,
|
|
|
+ funCodeRsp: FunCode.GZPresaleOrderRsp,
|
|
|
+ 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)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, '提交申请中....')
|
|
|
},
|
|
|
|
|
|
/// 获取履约模板信息
|