| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- import { FunCode } from "../../../constants/enum/funcode"
- import { EOrderSrc } from "../../../constants/enum/index"
- import { sendMsgToMQ } from "../../../services/api/common/index"
- import { getGoods } from "../../../services/api/orders/index"
- import { accountid, clientType, isEncrypted, loginid, marketid, protoHeader, timetample, userid } from "../../../services/utils"
- import { hideLoading, showLoading, showModel, showToast } from "../../../utils/message/index"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- /// 底部安全区域
- safeBottom: getApp().globalData.safeBottom,
- /// 商品信息
- goods: <GuangZuan.GetGoods>({}),
- /// 商品编号
- goodsno: '',
- /// 卖单信息
- order: <GuangZuan.SellOrder>({})
- },
- /**
- * 返回上层视图
- */
- backToParent() {
- /// 返回上层视图
- wx.navigateBack()
- },
- /**
- * 获取商品数据信息
- */
- getGoods() {
- showLoading(() => {
- /// 发送请求
- getGoods({
- data: {
- goodsno: this.data.goodsno
- },
- success: (res) => {
- hideLoading( ()=> {
- this.setData({ goods: res.data })
- })
- },
- fail: (emsg) => {
- hideLoading( ()=> {}, '数据请求失败,原因:'+emsg)
- }
- })
- })
-
- },
- /// 钻石买摘牌接口
- doZSBuyOrderDesting() {
- /// showModel
- showModel(() => {
- /// showLoding....
- showLoading(() => {
- /// 构建参数信息
- const params = {
- Header: protoHeader(FunCode.ZSBuyOrderDestingReq),
- UserID: userid(),
- AccountID: accountid(),
- RelatedWRTradeOrderID: this.data.order.wrtradeorderid,
- OrderQty: this.data.order.remainqty,
- OrderSrc: EOrderSrc.ORDERSRC_CLIENT,
- ClientSerialNo: timetample().toString(),
- ClientType: clientType(),
- OperatorID: loginid(),
- MarketID: marketid()
- }
- /// 发送请求
- sendMsgToMQ({
- data: {
- data: JSON.stringify(params),
- funCodeReq: FunCode.ZSBuyOrderDestingReq,
- funCodeRsp: FunCode.ZSBuyOrderDestingRsp,
- isEncrypted: isEncrypted(),
- },
- success: () => {
- /// 请求成功
- hideLoading(() => {
- wx.navigateBack()
- }, '购买请求成功')
- },
- fail: (emsg) => {
- hideLoading(() => {
- showToast('购买操作请求失败,原因:'+emsg)
- })
- }
- })
- }, '请求中......')
- }, '提示', '确定要购买吗?', true)
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options: any) {
- /// 单据信息
- const item = JSON.parse(options.item)
- if (item) {
- this.setData({ order: item })
- }
- /// 商品编号
- this.setData({ goodsno: options.goodsno })
- /// 获取商品数据
- this.getGoods()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {},
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {},
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {},
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {},
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|