|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
// 上架/下架需求 |
|
|
// 上架/下架需求 |
|
|
productRelease(e) { |
|
|
productRelease(e) { |
|
|
|
|
|
let item = e.currentTarget.dataset.item; |
|
|
|
|
|
let that = this; |
|
|
|
|
|
if (item.state == 0) { |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: "是否确认下架?", |
|
|
|
|
|
confirmText: "确认", |
|
|
|
|
|
cancelText: "取消", |
|
|
|
|
|
success(res) { |
|
|
|
|
|
if (res.confirm) { |
|
|
|
|
|
that.productReleasePost(item); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
that.productReleasePost(item); |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
productReleasePost(item) { |
|
|
|
|
|
wx.showLoading({ |
|
|
|
|
|
title: '加载中', |
|
|
|
|
|
mask:true |
|
|
|
|
|
}) |
|
|
|
|
|
let { businessCommunicationDemandId, state } = item; |
|
|
|
|
|
$request.post(`/businessCommunicationDemand/outDemand.action`, |
|
|
|
|
|
{ businessCommunicationDemandId, state } |
|
|
|
|
|
).then(res => { |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
if (res.status == 0) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: state == 0 ? '下架' : '上架' + '成功', |
|
|
|
|
|
icon: 'success', |
|
|
|
|
|
duration: 2000 |
|
|
|
|
|
}) |
|
|
|
|
|
let listData = this.data.listData; |
|
|
|
|
|
listData.forEach(el => { |
|
|
|
|
|
if (el.businessCommunicationDemandId == businessCommunicationDemandId) { |
|
|
|
|
|
el.state = state == 0 ? 1 : 0; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
listData |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}).catch(error => { |
|
|
|
|
|
console.log(error, 'error appletLogin') |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 删除需求 |
|
|
|
|
|
productDel(e) { |
|
|
let item = e.currentTarget.dataset.item; |
|
|
let item = e.currentTarget.dataset.item; |
|
|
let that = this; |
|
|
let that = this; |
|
|
wx.showModal({ |
|
|
wx.showModal({ |
|
|
title: '提示', |
|
|
title: '提示', |
|
|
content: "是否确认下架?", |
|
|
|
|
|
|
|
|
content: "是否确认删除?", |
|
|
confirmText: "确认", |
|
|
confirmText: "确认", |
|
|
cancelText: "取消", |
|
|
cancelText: "取消", |
|
|
success(res) { |
|
|
success(res) { |
|
|
if (res.confirm) { |
|
|
if (res.confirm) { |
|
|
that.productReleasePost(item); |
|
|
|
|
|
|
|
|
that.productDelPost(item); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
productReleasePost(item) { |
|
|
|
|
|
let { businessCommunicationDemandId, state } = item; |
|
|
|
|
|
$request.post(`/businessCommunicationDemand/outDemand.action`, { businessCommunicationDemandId, state } |
|
|
|
|
|
|
|
|
productDelPost(item) { |
|
|
|
|
|
let { businessCommunicationDemandId } = item; |
|
|
|
|
|
wx.showLoading({ |
|
|
|
|
|
title: '加载中', |
|
|
|
|
|
mask:true |
|
|
|
|
|
}) |
|
|
|
|
|
$request.post(`/businessCommunicationDemand/deleteDemand.action`, |
|
|
|
|
|
{ businessCommunicationDemandId } |
|
|
).then(res => { |
|
|
).then(res => { |
|
|
|
|
|
wx.hideLoading() |
|
|
if (res.status == 0) { |
|
|
if (res.status == 0) { |
|
|
wx.showToast({ |
|
|
wx.showToast({ |
|
|
title: state == 0 ? '下架' : '上架' + '成功', |
|
|
|
|
|
|
|
|
title: '删除成功', |
|
|
icon: 'success', |
|
|
icon: 'success', |
|
|
duration: 2000 |
|
|
duration: 2000 |
|
|
}) |
|
|
}) |
|
|
let listData = this.data.listData; |
|
|
let listData = this.data.listData; |
|
|
listData.forEach(el => { |
|
|
|
|
|
|
|
|
listData.forEach((el, inx) => { |
|
|
if (el.businessCommunicationDemandId == businessCommunicationDemandId) { |
|
|
if (el.businessCommunicationDemandId == businessCommunicationDemandId) { |
|
|
el.state = state == 0 ? 1 : 0; |
|
|
|
|
|
|
|
|
listData.splice(inx, 1); |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}).catch(error => { |
|
|
}).catch(error => { |
|
|
console.log(error, 'error appletLogin') |
|
|
console.log(error, 'error appletLogin') |
|
|
|
|
|
wx.hideLoading() |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
getListData() { |
|
|
getListData() { |
|
|
|
|
|
|
|
|
console.log(error, 'error appletLogin') |
|
|
console.log(error, 'error appletLogin') |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
// |
|
|
/** |
|
|
/** |
|
|
* 页面上拉触底事件的处理函数 |
|
|
* 页面上拉触底事件的处理函数 |
|
|
*/ |
|
|
*/ |