| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295 |
- 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: {
- /// 状态栏高度
- 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: '我参与的预售'}],
- /// subtabs
- subtabs: [{id: 1, name: '未开始'}, {id: 2, name: '执行中'}],
- /// 类别
- active: 0,
- /// 状态
- status: 1,
- /// 是否空数据
- 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 {
- pictureurls: obj.pictureurls,
- bannerpicurl: obj.bannerpicurl,
- performancetemplateid: obj.performancetemplateid,
- presaleapplyid: obj.presaleapplyid,
- 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.unitprice.toFixed(2)+'(元/克拉)',
- presalestatus: obj.presalestatus,
- ysproductionmode: obj.ysproductionmode,
- yszscategory: obj.yszscategory,
- yieldrate: isnullstr(obj.yieldrate),
- zsclaritytypestr: isnullstr(obj.zsclaritytypestr),
- zscolortypestr: isnullstr(obj.zscolortypestr),
- zscuttypestr: isnullstr(obj.zscuttypestr),
- zsfluorescencetypestr: isnullstr(obj.zsfluorescencetypestr),
- zspolishtypestr: isnullstr(obj.zspolishtypestr),
- zsshapetypestr: isnullstr(obj.zsshapetypestr),
- zssymmetrytypestr: isnullstr(obj.zssymmetrytypestr),
- sizestr: isnullstr(obj.sizestr),
- remark: isnullstr(obj.remark),
- placeqty: obj.placeqty,
- qtydesc: isnullstr(obj.qtydesc),
- weightdesc: isnullstr(obj.weightdesc)
- }
- })
- })
- })
- },
- 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 {
- pictureurls: obj.pictureurls,
- bannerpicurl: obj.bannerpicurl,
- performancetemplateid: obj.performancetemplateid,
- presaleapplyid: obj.presaleapplyid,
- 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)+'(元/克拉)',
- orderqty: obj.orderqty.toFixed(2),
- ysproductionmode: obj.ysproductionmode,
- yszscategory: obj.yszscategory,
- yieldrate: isnullstr(obj.yieldrate),
- zsclaritytypestr: isnullstr(obj.zsclaritytypestr),
- zscolortypestr: isnullstr(obj.zscolortypestr),
- zscuttypestr: isnullstr(obj.zscuttypestr),
- zsfluorescencetypestr: isnullstr(obj.zsfluorescencetypestr),
- zspolishtypestr: isnullstr(obj.zspolishtypestr),
- zsshapetypestr: isnullstr(obj.zsshapetypestr),
- zssymmetrytypestr: isnullstr(obj.zssymmetrytypestr),
- sizestr: isnullstr(obj.sizestr),
- remark: isnullstr(obj.remark),
- placeqty: obj.placeqty,
- qtydesc: isnullstr(obj.qtydesc),
- weightdesc: isnullstr(obj.weightdesc)
- }
- })
- })
- })
- },
- fail: (emsg) => {
- hideLoading(()=>{}, emsg)
- },
- complete: () => {
- /// 停止下拉刷新
- wx.stopPullDownRefresh()
- }
- })
- }, '加载中....')
- },
- /**
- * 返回上层视图
- */
- backToParent() {
- /// 返回上层视图
- wx.navigateBack()
- },
- /// 点击
- onItemClick(e: any) {
- wx.navigateTo({
- url: '/mHome/pages/presell/detail/index?item='+JSON.stringify(this.data.values[Number(e.currentTarget.id)])+'&index='+this.data.active
- })
- },
- /**
- * 预售申请
- */
- addPreSell() {
- wx.navigateTo({
- url: '/mHome/pages/presell/new/index'
- })
- },
- /**
- * 预售申请
- */
- onTabChange(e: any) {
- if (e.target.id === "category") {
- /// 重置状态
- this.setData({ status: 1, active: e.detail.name })
- /// 数据重置
- switch (e.detail.name) {
- case 1: /// 预售大厅
- this.setData({ subtabs: [{id: 1, name: '未开始'}, {id: 2, name: '执行中'}] })
- break;
- case 2: /// 我的预售
- this.setData({ subtabs: [{id: 1, name: '未开始'}, {id: 2, name: '执行中'}, {id: 3, name: '已结束'}] })
- break;
- default: /// 我参与的预售
- this.setData({ subtabs: [{id: 1, name: '预售中'}, {id: 2, name: '执行中'}, {id: 3, name: '已完成'}] })
- break;
- }
- } else {
- console.log(e)
- this.setData({ status: e.detail.name })
- }
- this.data.active != 3 ? this.queryGZPreSell(this.data.status) : this.queryGZMyTradingPreSell(this.data.status)
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad() {
- this.data.active != 3 ? this.queryGZPreSell(this.data.status) : this.queryGZMyTradingPreSell(this.data.status)
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- this.data.active != 3 ? this.queryGZPreSell(this.data.status) : this.queryGZMyTradingPreSell(this.data.status)
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|