You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

327 lines
6.3 KiB

// pages/my_release/my_release.js
const axios = require('../../api/index')
let loading = false
Page({
/**
* 页面的初始数据
*/
data: {
status_list: [
{
name: '全部',
type: -1
},
{
name: '出售中',
type: 20
}, {
name: '审核中',
type: 10
}, {
name: '未通过',
type: 0
}, {
name: '已成交',
type: 30
}],
status_idx: -1,
showlist: [''],
pageSize: 10,
currentPage: 1,
list_total:0,
topNum:0,
is_show_refresh_mask: false,//刷新
refresh_is_show_lack_currency:false,//刷新前不够
is_show_top_mask:false,//置顶
is_show_lack_currency:false,//置顶不够钱
detail:{}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.getmyequipment()
},
getmyequipment() {
var data = {
currentPage: this.data.currentPage,
pageSize: this.data.pageSize,
state: this.data.status_idx
}
axios.getmyequipment(data).then(res => {
console.log(res)
var list_total = res.data.total
if (this.data.currentPage == 1) {
list = res.data.list
} else {
var list = [...this.data.showlist, ...res.data.list]
}
this.setData({
showlist: list,
list_total,
triggered: false
})
}).catch(err => {
console.log(err)
})
},
status_btn(e) {
let index = e.currentTarget.dataset.idx;
let status_idx = this.data.status_list[index].type
if (status_idx == this.data.status_idx) {
return
}
console.log(status_idx)
this.setData({
currentPage: 1,
topNum:0,
// show_list: [],
status_idx
},()=>{
this.getmyequipment()
})
},
// 上拉刷新
onScrolltolower() {
let {
list_total,
showlist
} = this.data;
if (list_total == showlist.length) return
this.setData({
currentPage: this.data.currentPage + 1,
}, () => {
this.getmyequipment()
})
},
// 下拉加载
onRefresh() {
this.setData({
currentPage: 1,
}, () => {
this.getmyequipment()
})
},
// 去发布
jump_fn() {
wx.navigateTo({
url: '/pages/new_show/new_show',
})
},
// 刷新
refresh(e){
this.setData({
detail:e.detail.item
},()=>{
this.show_refresh_mask()
})
},
//积分不够的时候确定
earn_currency() {
this.setData({
is_show_lack_currency: false,
refresh_is_show_lack_currency: false
})
wx.navigateTo({
url: '/pages/my_obtain/my_obtain?is_come=1',
})
},
// 隐藏弹框
hide_modal() {
this.setData({
is_show_refresh_mask: false,//刷新
refresh_is_show_lack_currency:false,//刷新前不够
is_show_top_mask:false,//置顶
is_show_lack_currency:false,//置顶不够钱
})
},
// 刷新
show_refresh_mask() {
this.setData({
is_show_refresh_mask: true
})
},
// 刷新
refresh_confirm_fn(e) {
this.setData({
is_show_refresh_mask: false,
}, () => {
this.refresh_job()
})
},
refresh_cancel_fn() {
this.setData({
is_show_refresh_mask: false,
})
},
// 刷新
refresh_job() {
let {
detail
} = this.data;
axios.refreshMyJobRec( detail.id).then(res => {
if (res.code == 2) {//刷新没钱
this.setData({
refresh_is_show_lack_currency: true
})
return
}
wx.showToast({
title: res.message || '刷新成功',
icon: 'none'
})
// this.get_detail()
}).catch(err => {
console.log(err)
})
},
// 置顶
totop(e){
let detail=e.detail.item
// if (detail.isTop) {
// wx.showToast({
// title: '该信息已置顶,请勿重复置顶',
// icon: 'none',
// duration: 1000,
// })
// return
// }
this.setData({
detail
},()=>{
this.show_top_mask_fn()
})
},
// 置顶
// 置顶hide_share_mask_fn
show_top_mask_fn() {
// let {
// detail
// } = this.data;
// if (detail.isTop) {
// wx.showToast({
// title: '该信息已置顶,请勿重复置顶',
// icon: 'none',
// duration: 1000,
// })
// return
// }
this.setData({
is_show_top_mask: true
})
},
top_confirm_fn(e) {
this.setData({
is_show_top_mask: false,
}, () => {
this.is_top()
})
},
top_cancel_fn() {
this.setData({
is_show_top_mask: false,
is_show_lack_currency: false,
refresh_is_show_lack_currency: false
})
},
// 置顶成功
is_top() {
let {
detail
} = this.data;
axios.upthrustTop(detail.id).then(res => {
console.log(123123)
if (res.code == 2) {//云币不足
this.setData({
is_show_lack_currency: true
})
return
}
if(res.code == 3){
console.log(2222)
wx.showToast({
title: res.msg,
icon:"none"
})
return
}
wx.showToast({
title: res.msg || '置顶成功',
icon: 'none'
})
// this.get_detail()
})
},
// 正在招人
change_status(e){
// setEquipmentState
var data={
id:e.detail.id,
value:e.detail.value?20:30
}
axios.setEquipmentState(data).then(res=>{
console.log(res)
// this.data.showlist.forEach((item,index)=>{
// if(item.id==e.detail.id){
// console.log(item.id)
// this.data.showlist[index].state=e.detail.value?20:30
// }
// })
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
// onShareAppMessage: function () {
// }
})