|
|
@@ -1,11 +1,152 @@
|
|
|
-// mHome/pages/presell/list/index.ts
|
|
|
+import { queryGZMyTradingPreSell, queryGZPreSell } from "../../../../services/api/orders/index"
|
|
|
+import { getEnumdicValue, marketid, userid } from "../../../../services/utils"
|
|
|
+import { hideLoading, showLoading } from "../../../../utils/message/index"
|
|
|
+import { isnullstr } from "../../../../utils/util"
|
|
|
+
|
|
|
Page({
|
|
|
|
|
|
/**
|
|
|
* 页面的初始数据
|
|
|
*/
|
|
|
- data: {
|
|
|
+ data: {
|
|
|
+ /// 状态栏高度
|
|
|
+ statusBarHeight: getApp().globalData.statusBarHeight,
|
|
|
+ /// 导航栏高度
|
|
|
+ navHeight: getApp().globalData.navHeight,
|
|
|
+ /// 底部安全区域
|
|
|
+ safeBottom: getApp().globalData.safeBottom,
|
|
|
+ /// 窗口高度
|
|
|
+ windowHeight: getApp().globalData.windowHeight,
|
|
|
+ /// tabs
|
|
|
+ tabs: [{id: 1, name: '预售大厅'}, {id: 2, name: '我的预售'}, {id: 3, name: '我参与的预售'}],
|
|
|
+ /// 是否空数据
|
|
|
+ isEmpty: false,
|
|
|
+ /// 预售大厅/我的预售/集采大厅/我的集采 列表查询
|
|
|
+ perSells: <GuangZuan.GZPreSell[]>[{}],
|
|
|
+ /// 我参与的预售(预售中\执行中)\我参与的集采(集采中\执行中) 列表查询
|
|
|
+ myTradingPreSells: <GuangZuan.GZMyTradingPreSell[]>[{}],
|
|
|
+ /// 显示数据信息
|
|
|
+ values: [{}]
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预售大厅/我的预售/集采大厅/我的集采 列表查询
|
|
|
+ * 预售状态 - 1:未开始 2:进行中 3:已结束 4:已关闭 5:处理中 6::处理失败 7:已完成
|
|
|
+ */
|
|
|
+ queryGZPreSell(presalestatus: number) {
|
|
|
+ /// loding
|
|
|
+ showLoading(()=>{
|
|
|
+ /// 数据查询请求
|
|
|
+ queryGZPreSell({
|
|
|
+ data: {
|
|
|
+ presalestatus: presalestatus,
|
|
|
+ marketid: marketid()
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ /// 请求失败
|
|
|
+ if (res.code != 200) {
|
|
|
+ /// 加载失败
|
|
|
+ hideLoading(()=>{}, '请求失败,原因:'+res.msg)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ hideLoading(()=>{
|
|
|
+ /// 设置数据
|
|
|
+ this.setData({
|
|
|
+ /// 设置列头
|
|
|
+ perSells: res.data,
|
|
|
+ /// 数据是否为空
|
|
|
+ isEmpty: res.data.length === 0,
|
|
|
+ values: res.data.map(obj => {
|
|
|
+ return {
|
|
|
+ wrstandardname: isnullstr(obj.wrstandardname),
|
|
|
+ customername: isnullstr(obj.customername),
|
|
|
+ status: getEnumdicValue('WRPresaleStatus', obj.presalestatus),
|
|
|
+ startdate: isnullstr(obj.startdate),
|
|
|
+ enddate: isnullstr(obj.enddate),
|
|
|
+ minsuccessqty: obj.minsuccessqty.toFixed(0),
|
|
|
+ minbuyqty: obj.minbuyqty.toFixed(0),
|
|
|
+ maxbuyqty: obj.maxbuyqty.toFixed(0),
|
|
|
+ presaleqty: obj.presaleqty.toFixed(0)+'克拉',
|
|
|
+ buymarginvalue: (obj.buymarginvalue*100).toFixed(2)+'%',
|
|
|
+ surplusqty: (obj.presaleqty-obj.placeqty).toFixed(0),
|
|
|
+ price: '¥'+obj.lastprice.toFixed(2)+'(元/克拉)'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: (emsg) => {
|
|
|
+ hideLoading(()=>{}, emsg)
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ /// 停止下拉刷新
|
|
|
+ wx.stopPullDownRefresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, '加载中....')
|
|
|
+ },
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 我参与的预售(预售中\执行中)\我参与的集采(集采中\执行中) 列表查询
|
|
|
+ * 状态 1:预售中\集采中 2:执行中 3:已完成
|
|
|
+ */
|
|
|
+ queryGZMyTradingPreSell(status: number) {
|
|
|
+ /// loding
|
|
|
+ showLoading(()=>{
|
|
|
+ /// 数据查询请求
|
|
|
+ queryGZMyTradingPreSell({
|
|
|
+ data: {
|
|
|
+ userid: userid(),
|
|
|
+ marketid: marketid(),
|
|
|
+ status: status
|
|
|
+ },
|
|
|
+ success: (res) => {
|
|
|
+ /// 请求失败
|
|
|
+ if (res.code != 200) {
|
|
|
+ /// 加载失败
|
|
|
+ hideLoading(()=>{}, '请求失败,原因:'+res.msg)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ hideLoading(()=>{
|
|
|
+ /// 设置数据
|
|
|
+ this.setData({
|
|
|
+ /// 设置列头
|
|
|
+ myTradingPreSells: res.data,
|
|
|
+ /// 数据是否为空
|
|
|
+ isEmpty: res.data.length === 0,
|
|
|
+ /// 显示数据
|
|
|
+ values: res.data.map(obj => {
|
|
|
+ return {
|
|
|
+ wrstandardname: isnullstr(obj.wrstandardname),
|
|
|
+ customername: isnullstr(obj.customername),
|
|
|
+ tradeamount: obj.tradeamount.toFixed(2),
|
|
|
+ status: obj.status,
|
|
|
+ ordertime: isnullstr(obj.ordertime),
|
|
|
+ freezemargin: obj.freezemargin.toFixed(2),
|
|
|
+ marginvalue: (obj.marginvalue*100).toFixed(2)+'%',
|
|
|
+ tradeprice: '¥'+obj.tradeprice.toFixed(2)+'(元/克拉)'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: (emsg) => {
|
|
|
+ hideLoading(()=>{}, emsg)
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ /// 停止下拉刷新
|
|
|
+ wx.stopPullDownRefresh()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }, '加载中....')
|
|
|
+ },
|
|
|
|
|
|
+ /**
|
|
|
+ * 返回上层视图
|
|
|
+ */
|
|
|
+ backToParent() {
|
|
|
+ /// 返回上层视图
|
|
|
+ wx.navigateBack()
|
|
|
},
|
|
|
|
|
|
/**
|