| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- import { accountid, clientType, getErrorMsg, isEncrypted, marketid, protoHeader, timetample, userid } from "../../../../services/utils"
- import { hideLoading, showLoading, showModel } 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 { queryGZMyPresell, queryPermancePlanTmp } from "../../../../services/api/orders/index"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- navTitle: '集采详情',
- /// 底部安全区域
- safeBottom: getApp().globalData.safeBottom,
- /// 数据信息
- item: {},
- /// 选中履约模板
- tmp: <GuangZuan.PermancePlanTmp>({}),
- /// 颜色
- colors: ['rebeccapurple', 'green', 'hotpink', 'orange', 'darkgoldenrod', 'firebrick'],
- /// banner图
- banners: [''],
- /// 预售认购列表查询
- sells: <GuangZuan.GZMyPreSell[]>[]
- },
- /**
- * 返回上层视图
- */
- backToParent() {
- /// 返回上层视图
- wx.navigateBack()
- },
- /// 我的预售认购列表查询
- queryGZMyPresell(presaleapplyid: number) {
- /// showLoading
- showLoading(() => {
- queryGZMyPresell({
- data: {
- presaleapplyid: presaleapplyid
- },
- success: (res) => {
- /// 获取数据
- this.setData({ sells: res.data })
- },
- complete: () => {
- /// hideLoading
- hideLoading()
- }
- })
- })
- },
- /**
- * 立即购买
- */
- doSubmit(orderID: string, qty: string) {
- /// showModel
- showModel(() => {
- /// showLoading
- showLoading(() => {
- /// 请求参数
- const info = JSON.stringify({
- Header: protoHeader(FunCode.GZCenterPurchaseOrderReq),
- 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.GZCenterPurchaseOrderReq,
- funCodeRsp: FunCode.GZCenterPurchaseOrderRsp,
- 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)
- }
- })
- }, '提交申请请求中....')
- }, '提示', '确认要立即购买申请吗?')
- },
- /// 获取履约模板信息
- queryPermancePlanTmp(performancetemplateid: number) {
- /// showLoading
- showLoading(() => {
- queryPermancePlanTmp({
- success: (res) => {
- /// 获取数据
- this.setData({
- tmp: res.data.filter(obj => { return obj.autoid === performancetemplateid })[0]
- })
- },
- complete: () => {
- /// hideLoading
- hideLoading()
- }
- })
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options: any) {
- const obj = JSON.parse(options.item)
- /// 解析数据
- this.setData({ item: obj })
- // 查询履约模板
- this.queryPermancePlanTmp(obj.performancetemplateid)
- /// 我的预售认购列表查询
- this.queryGZMyPresell(obj.presaleapplyid)
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|