|
|
@ -1,5 +1,5 @@ |
|
|
// pages/bidding/detail/index.js
|
|
|
// pages/bidding/detail/index.js
|
|
|
const request = require('../../../utils/request') //导入模块
|
|
|
|
|
|
|
|
|
import { getBiddingDetail, getBiddingActivity, getBiddingList, biddingActivity, confirmBidding, cancelBidding, getMyBidding } from "../../api/ztb" |
|
|
const util = require('../../../utils/util') |
|
|
const util = require('../../../utils/util') |
|
|
const math = require('../../../utils/math') |
|
|
const math = require('../../../utils/math') |
|
|
const event = require('../../../utils/event.js') |
|
|
const event = require('../../../utils/event.js') |
|
|
@ -7,7 +7,6 @@ import { $wuxCountDown } from '../../../components/index' |
|
|
const app = getApp() |
|
|
const app = getApp() |
|
|
|
|
|
|
|
|
Page({ |
|
|
Page({ |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 页面的初始数据 |
|
|
* 页面的初始数据 |
|
|
*/ |
|
|
*/ |
|
|
@ -45,9 +44,7 @@ Page({ |
|
|
fetchInfo: function(id){ |
|
|
fetchInfo: function(id){ |
|
|
if (this.data.type == 1) { |
|
|
if (this.data.type == 1) { |
|
|
wx.showLoading({ title: '加载中', mask: true }) |
|
|
wx.showLoading({ title: '加载中', mask: true }) |
|
|
// recycle-service/get/bidding-activity-detail/{biddingActivityId}
|
|
|
|
|
|
request.get('/recycle-service/get/bidding-activity-detail/' + id).then(result => { |
|
|
|
|
|
//成功回调
|
|
|
|
|
|
|
|
|
getBiddingActivity(id).then(result => { |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
type: this.data.type, |
|
|
type: this.data.type, |
|
|
biddingInfo: result.data, |
|
|
biddingInfo: result.data, |
|
|
@ -66,9 +63,7 @@ Page({ |
|
|
} else { |
|
|
} else { |
|
|
this.biddingDialog = this.biddingDialog || this.selectComponent('#bidding-good') |
|
|
this.biddingDialog = this.biddingDialog || this.selectComponent('#bidding-good') |
|
|
wx.showLoading({ title: '加载中', mask: true }) |
|
|
wx.showLoading({ title: '加载中', mask: true }) |
|
|
// recycle-service/get/bidding-detail/{biddingId}
|
|
|
|
|
|
request.get('/recycle-service/get/bidding-detail/' + id).then(result => { |
|
|
|
|
|
//成功回调
|
|
|
|
|
|
|
|
|
getBiddingDetail(id).then(result => { |
|
|
if(result.data.status == 0 && this.data.frist){ |
|
|
if(result.data.status == 0 && this.data.frist){ |
|
|
this.expiredTime(result.data.biddingActivity.expiredTime, id) |
|
|
this.expiredTime(result.data.biddingActivity.expiredTime, id) |
|
|
} else if(result.data.status == 1 && this.data.frist){ |
|
|
} else if(result.data.status == 1 && this.data.frist){ |
|
|
@ -107,19 +102,13 @@ Page({ |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
fetchBiddingInfo: function (biddingActivityId) { |
|
|
fetchBiddingInfo: function (biddingActivityId) { |
|
|
request.get('/recycle-service/get/my-bidding/' + biddingActivityId).then(result => { |
|
|
|
|
|
//成功回调
|
|
|
|
|
|
this.setData({ |
|
|
|
|
|
recordInfo: result.data |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
getMyBidding(biddingActivityId).then(result => { |
|
|
|
|
|
this.setData({ recordInfo: result.data }) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
fetchBiddingList: function (biddingActivityId) { |
|
|
fetchBiddingList: function (biddingActivityId) { |
|
|
request.get('/recycle-service/get/bidding-list/' + biddingActivityId).then(result => { |
|
|
|
|
|
//成功回调
|
|
|
|
|
|
|
|
|
getBiddingList(biddingActivityId).then(result => { |
|
|
var record = null |
|
|
var record = null |
|
|
if(this.data.biddingInfo.winBiddingId){ |
|
|
if(this.data.biddingInfo.winBiddingId){ |
|
|
for (let index = 0; index < result.data.records.length; index++) { |
|
|
for (let index = 0; index < result.data.records.length; index++) { |
|
|
@ -130,10 +119,7 @@ Page({ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
this.setData({ |
|
|
|
|
|
recordList: result.data.records, |
|
|
|
|
|
recordInfo: record |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
this.setData({ recordList: result.data.records, recordInfo: record }) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
toShopInfo: function () { |
|
|
toShopInfo: function () { |
|
|
@ -156,7 +142,7 @@ Page({ |
|
|
} |
|
|
} |
|
|
return 0 |
|
|
return 0 |
|
|
}, |
|
|
}, |
|
|
biddingActicity: function () { |
|
|
|
|
|
|
|
|
showBiddingDialog: function () { |
|
|
var that = this |
|
|
var that = this |
|
|
this.wuxDialog.prompt({ |
|
|
this.wuxDialog.prompt({ |
|
|
offer: true, |
|
|
offer: true, |
|
|
@ -186,17 +172,12 @@ Page({ |
|
|
title: '加载中', |
|
|
title: '加载中', |
|
|
mask: true |
|
|
mask: true |
|
|
}) |
|
|
}) |
|
|
// /recycle-service/bid/{biddingActivityId} 参与报价
|
|
|
|
|
|
request.post('/recycle-service/bid/' + this.data.biddingInfo.biddingActivity.id, { biddingUnitPrice: price }).then(result => { |
|
|
|
|
|
//成功回调
|
|
|
|
|
|
|
|
|
biddingActivity(this.data.biddingInfo.biddingActivity.id, { biddingUnitPrice: price }).then(result => { |
|
|
wx.hideLoading() |
|
|
wx.hideLoading() |
|
|
util.showToast('报价成功') |
|
|
util.showToast('报价成功') |
|
|
this.setData({ |
|
|
|
|
|
['biddingInfo.unitPrice']: price |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
this.setData({ ['biddingInfo.unitPrice']: price }) |
|
|
this.fetchBiddingList(this.data.biddingInfo.biddingActivity.id) |
|
|
this.fetchBiddingList(this.data.biddingInfo.biddingActivity.id) |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
//异常回调
|
|
|
|
|
|
wx.hideLoading() |
|
|
wx.hideLoading() |
|
|
util.showToast(err) |
|
|
util.showToast(err) |
|
|
}) |
|
|
}) |
|
|
@ -221,13 +202,8 @@ Page({ |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
cancelActivity: function(){ |
|
|
cancelActivity: function(){ |
|
|
wx.showLoading({ |
|
|
|
|
|
title: '处理中', |
|
|
|
|
|
mask: true |
|
|
|
|
|
}) |
|
|
|
|
|
// /recycle-service/bid/{biddingActivityId} 参与报价
|
|
|
|
|
|
request.post('/recycle-service/cancel/bidding-activity/' + this.data.biddingInfo.id).then(result => { |
|
|
|
|
|
//成功回调
|
|
|
|
|
|
|
|
|
wx.showLoading({ title: '处理中', mask: true }) |
|
|
|
|
|
cancelBidding(this.data.biddingInfo.id).then(result => { |
|
|
wx.hideLoading() |
|
|
wx.hideLoading() |
|
|
util.showToast('竞价取消成功') |
|
|
util.showToast('竞价取消成功') |
|
|
event.emit('EventMessage', { what: 301, desc: 'bidding-cancel' }) |
|
|
event.emit('EventMessage', { what: 301, desc: 'bidding-cancel' }) |
|
|
@ -238,26 +214,19 @@ Page({ |
|
|
util.showToast(err) |
|
|
util.showToast(err) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
checkRecord: function(e){ |
|
|
checkRecord: function(e){ |
|
|
if(this.data.biddingInfo.status == 0){ |
|
|
if(this.data.biddingInfo.status == 0){ |
|
|
this.setData({recordIndex: e.currentTarget.dataset.index}) |
|
|
this.setData({recordIndex: e.currentTarget.dataset.index}) |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
biddingConfrim: function(){ |
|
|
biddingConfrim: function(){ |
|
|
if(this.data.recordIndex < 0){ |
|
|
if(this.data.recordIndex < 0){ |
|
|
util.showToast('请选择一个报价') |
|
|
util.showToast('请选择一个报价') |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
wx.showLoading({ |
|
|
|
|
|
title: '处理中', |
|
|
|
|
|
mask: true |
|
|
|
|
|
}) |
|
|
|
|
|
// /recycle-service/bid/{biddingActivityId} 参与报价
|
|
|
|
|
|
|
|
|
wx.showLoading({ title: '处理中', mask: true }) |
|
|
var biddingId = this.data.recordList[this.data.recordIndex].id |
|
|
var biddingId = this.data.recordList[this.data.recordIndex].id |
|
|
request.post('/recycle-service/confirm/bidding', { biddingId }).then(result => { |
|
|
|
|
|
//成功回调
|
|
|
|
|
|
|
|
|
confirmBidding({ biddingId }).then(result => { |
|
|
wx.hideLoading() |
|
|
wx.hideLoading() |
|
|
util.showToast('确认报价成功') |
|
|
util.showToast('确认报价成功') |
|
|
if (this.countDown) { |
|
|
if (this.countDown) { |
|
|
@ -276,20 +245,13 @@ Page({ |
|
|
util.showToast(err) |
|
|
util.showToast(err) |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
offerOrder: function(){ |
|
|
offerOrder: function(){ |
|
|
var productId = this.data.biddingInfo.biddingActivity.productId |
|
|
var productId = this.data.biddingInfo.biddingActivity.productId |
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/pages/morder/create/index?productId=' + productId + '&price=' + this.data.biddingInfo.unitPrice |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
wx.navigateTo({ url: '/pages/morder/create/index?productId=' + productId + '&price=' + this.data.biddingInfo.unitPrice }) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
restartActivity: function(){ |
|
|
restartActivity: function(){ |
|
|
wx.redirectTo({ |
|
|
|
|
|
url: '/pages/goods/create/index?id=' + this.data.biddingInfo.productId |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
wx.redirectTo({ url: '/pages/goods/create/index?id=' + this.data.biddingInfo.productId }) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
onUnload: function () { |
|
|
onUnload: function () { |
|
|
if (this.countDown) { |
|
|
if (this.countDown) { |
|
|
this.countDown.stop() |
|
|
this.countDown.stop() |
|
|
|