|
|
@@ -1,302 +0,0 @@
|
|
|
-// pages/mine/myorders/myorders.ts
|
|
|
-
|
|
|
-import {queryMySellOrder, queryMyBuyOrder, queryMyDeListing} from '../../../services/api/orders/index'
|
|
|
-import { userid } from '../../../services/utils'
|
|
|
-
|
|
|
-Page({
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面的初始数据
|
|
|
- */
|
|
|
- data: {
|
|
|
- /// 底部安全区域
|
|
|
- safeBottom: getApp().globalData.safeBottom,
|
|
|
- /// 列头
|
|
|
- tabs: [{id: 1, name: '我的出售'},
|
|
|
- {id: 2, name: '我的求购'},
|
|
|
- {id: 3, name: '我的摘牌'},
|
|
|
- {id: 4, name: '我的询价'}],
|
|
|
- /// 是否空数据
|
|
|
- isEmpty: false,
|
|
|
- /// 选中行数
|
|
|
- selectRow: -1,
|
|
|
- /// 列表总宽度
|
|
|
- totalWidth: 0,
|
|
|
- /// 查询数据
|
|
|
- datas: [{}],
|
|
|
- /// 列表宽度
|
|
|
- widths: [0],
|
|
|
- /// 列头
|
|
|
- titles: [''],
|
|
|
- /// 内容
|
|
|
- values: <any>[[]]
|
|
|
- },
|
|
|
-
|
|
|
- /// 查询我的求购
|
|
|
- queryMyBuyOrder() {
|
|
|
- /// loding
|
|
|
- wx.showLoading({ title: '数据请求中' })
|
|
|
-
|
|
|
- /// 数据查询请求
|
|
|
- queryMyBuyOrder({
|
|
|
- data: {
|
|
|
- userid: userid()
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- /// 请求失败
|
|
|
- if (res.code != 200) {
|
|
|
- wx.showToast({ icon: 'error', title: '请求失败,原因:'+res.msg })
|
|
|
- return
|
|
|
- }
|
|
|
- /// 设置数据
|
|
|
- this.setData({
|
|
|
- /// 设置列头
|
|
|
- titles: ['会员', '商品分类', '求购信息', '状态', '有效日'],
|
|
|
- /// 重置宽度
|
|
|
- widths: [80, 80, 150, 80, 120],
|
|
|
- /// 数据信息
|
|
|
- datas: res.data,
|
|
|
- /// 设置数值
|
|
|
- values: res.data.map(obj => {
|
|
|
- return ['xxxx',
|
|
|
- obj.zscategorydisplay,
|
|
|
- obj.zssymmetrytypedisplay,
|
|
|
- obj.wrtradeorderstatus,
|
|
|
- obj.validtime]
|
|
|
- }),
|
|
|
- })
|
|
|
- /// 计算整个宽度
|
|
|
- this.calculateTotalWidth()
|
|
|
- },
|
|
|
- /// 加载失败
|
|
|
- fail: () => {
|
|
|
- wx.showToast({ icon: 'error', title: '请求失败,原因:接口请求失败' })
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- /// hideLoading
|
|
|
- wx.hideLoading()
|
|
|
- /// 判断数据是否为空
|
|
|
- this.setData({
|
|
|
- isEmpty: this.data.values.length == 0
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- /// 查询我的出售
|
|
|
- queryMySellOrder() {
|
|
|
- /// loding
|
|
|
- wx.showLoading({ title: '数据请求中' })
|
|
|
-
|
|
|
- /// 数据查询请求
|
|
|
- queryMySellOrder({
|
|
|
- data: {
|
|
|
- userid: userid()
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- console.log(res)
|
|
|
- /// 请求失败
|
|
|
- if (res.code != 200) {
|
|
|
- wx.showToast({ icon: 'error', title: '请求失败,原因:'+res.msg })
|
|
|
- return
|
|
|
- }
|
|
|
- /// 设置数据
|
|
|
- this.setData({
|
|
|
- /// 设置列头
|
|
|
- titles: ['状态', '挂牌方', '商品分类/编号', '委托量', '委托价', '成交数量', '委托时间'],
|
|
|
- /// 重置宽度
|
|
|
- widths: [60, 60, 100, 110, 90, 90, 150],
|
|
|
- /// 数据信息
|
|
|
- datas: res.data,
|
|
|
- /// 设置数值
|
|
|
- values: res.data.map(obj => {
|
|
|
- return [obj.wrtradeorderstatus,
|
|
|
- 'xxx',
|
|
|
- obj.zscategorydisplay+'\n'+obj.goodsno,
|
|
|
- obj.totalqty,
|
|
|
- obj.tradeprice,
|
|
|
- obj.selledqty,
|
|
|
- obj.ordertime]
|
|
|
- }),
|
|
|
- })
|
|
|
- /// 计算整个宽度
|
|
|
- this.calculateTotalWidth()
|
|
|
- },
|
|
|
- fail: (er) => {
|
|
|
- console.log(er)
|
|
|
- wx.showToast({ icon: 'error', title: '请求失败,原因:接口请求失败' })
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- /// hideLoading
|
|
|
- wx.hideLoading()
|
|
|
- /// 判断数据是否为空
|
|
|
- this.setData({
|
|
|
- isEmpty: this.data.values.length == 0
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- /// 查询我的摘牌
|
|
|
- queryMyDeListing() {
|
|
|
- /// loding
|
|
|
- wx.showLoading({ title: '数据请求中' })
|
|
|
-
|
|
|
- /// 数据查询请求
|
|
|
- queryMyDeListing({
|
|
|
- data: {
|
|
|
- userid: userid()
|
|
|
- },
|
|
|
- success: (res) => {
|
|
|
- console.log(res)
|
|
|
- /// 请求失败
|
|
|
- if (res.code != 200) {
|
|
|
- wx.showToast({ icon: 'error', title: '请求失败,原因:'+res.msg })
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- /// 设置数据
|
|
|
- this.setData({
|
|
|
- /// 设置列头
|
|
|
- titles: ['商品分类', '商品编号', '方向', '对手方', '成交重量', '成交价格', '成交金额'],
|
|
|
- /// 重置宽度
|
|
|
- widths: [80, 100, 80, 80, 80, 80, 80],
|
|
|
- /// 数据信息
|
|
|
- datas: res.data,
|
|
|
- /// 设置数值
|
|
|
- values: res.data.map(obj => {
|
|
|
- return [obj.zscategorydisplay,
|
|
|
- obj.goodsno,
|
|
|
- '',
|
|
|
- obj.matchusername,
|
|
|
- '',
|
|
|
- obj.tradeprice,
|
|
|
- obj.tradeamount]
|
|
|
- }),
|
|
|
- })
|
|
|
- /// 计算整个宽度
|
|
|
- this.calculateTotalWidth()
|
|
|
- },
|
|
|
- fail: () => {
|
|
|
- wx.showToast({ icon: 'error', title: '请求失败,原因:接口请求失败' })
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- /// hideLoading
|
|
|
- wx.hideLoading()
|
|
|
- /// 判断数据是否为空
|
|
|
- this.setData({
|
|
|
- isEmpty: this.data.values.length == 0
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * tabbar点击事件
|
|
|
- */
|
|
|
- onTabChange(e: any) {
|
|
|
- switch (e.detail.index) {
|
|
|
- case 0: /// 查询我的出售
|
|
|
- this.queryMySellOrder()
|
|
|
- break;
|
|
|
- case 1: /// 查询我的求购
|
|
|
- this.queryMyBuyOrder()
|
|
|
- break;
|
|
|
- case 2: /// 查询我的摘牌
|
|
|
- this.queryMyDeListing()
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 返回上层视图
|
|
|
- */
|
|
|
- backToParent() {
|
|
|
- /// 返回上层视图
|
|
|
- wx.navigateBack()
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 点击每行触发事件
|
|
|
- */
|
|
|
- onListItemClick(e: any) {
|
|
|
- this.setData({
|
|
|
- selectRow: this.data.selectRow == e.currentTarget.id ? -1 : e.currentTarget.id
|
|
|
- })
|
|
|
- console.log(this.data.selectRow)
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 按钮点击响应事件
|
|
|
- */
|
|
|
- onButtonPressed(e: any){
|
|
|
- switch (e.currentTarget.id) {
|
|
|
- case "goods-detail": /// 商品详情
|
|
|
- wx.navigateTo({
|
|
|
- url: '/mHome/pages/goodsdetail/goodsdetail'
|
|
|
- })
|
|
|
- break;
|
|
|
- case "listing-detail": /// 商品详情
|
|
|
- wx.navigateTo({
|
|
|
- url: '/mMine/pages/listingdetail/listingdetail'
|
|
|
- })
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /// 计算整个宽度
|
|
|
- calculateTotalWidth() {
|
|
|
- /// 计算总高度
|
|
|
- let num = 0.0
|
|
|
- this.data.widths.forEach(function(v) { num += v })
|
|
|
- /// 设置总高度
|
|
|
- this.setData({ totalWidth: num })
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面加载
|
|
|
- */
|
|
|
- onLoad() {},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面初次渲染完成
|
|
|
- */
|
|
|
- onReady() {},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面显示
|
|
|
- */
|
|
|
- onShow() {
|
|
|
- /// 查询我的出售
|
|
|
- this.queryMySellOrder()
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面隐藏
|
|
|
- */
|
|
|
- onHide() {},
|
|
|
-
|
|
|
- /**
|
|
|
- * 生命周期函数--监听页面卸载
|
|
|
- */
|
|
|
- onUnload() {},
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面相关事件处理函数--监听用户下拉动作
|
|
|
- */
|
|
|
- onPullDownRefresh() {},
|
|
|
-
|
|
|
- /**
|
|
|
- * 页面上拉触底事件的处理函数
|
|
|
- */
|
|
|
- onReachBottom() {},
|
|
|
-
|
|
|
- /**
|
|
|
- * 用户点击右上角分享
|
|
|
- */
|
|
|
- onShareAppMessage() {}
|
|
|
-})
|