Browse Source

no message

featrue/v4.1
xpz2018 5 years ago
parent
commit
c832fea9dd
7 changed files with 66 additions and 124 deletions
  1. 28
      pages/api/ztb.js
  2. 70
      pages/bidding/detail/index.js
  3. 2
      pages/bidding/detail/index.wxml
  4. 10
      pages/bidding/index/index.js
  5. 20
      pages/html/integral/index.js
  6. 11
      pages/html/notice/index.js
  7. 49
      pages/mall/detail/index.js

28
pages/api/ztb.js

@ -22,6 +22,7 @@ const getFactoryPriceDetail = (id) => mGet(`/recycle-service/get/paper-mill-pape
const getFactoryCity = () => mGet(`/recycle-service/get/paper-mill-city`, null, zconfig) const getFactoryCity = () => mGet(`/recycle-service/get/paper-mill-city`, null, zconfig)
// /get/index-info-id 首页获取公告id接口 // /get/index-info-id 首页获取公告id接口
const getIndexInfoId = () => mGet(`/recycle-service/get/index-info-id`, null, zconfig) const getIndexInfoId = () => mGet(`/recycle-service/get/index-info-id`, null, zconfig)
const getIndexInfo = (id) => mGet(`/recycle-service/get/index-info/${id}`, null, zconfig)
// /get/paper-mill-list 获取纸厂列表 // /get/paper-mill-list 获取纸厂列表
const getFactoryList = () => mGet(`/recycle-service/get/paper-mill-list`, null, zconfig) const getFactoryList = () => mGet(`/recycle-service/get/paper-mill-list`, null, zconfig)
// /get/paper-mill-received-weight-list/on-today 获取纸厂今日收货量(排队)列表 // /get/paper-mill-received-weight-list/on-today 获取纸厂今日收货量(排队)列表
@ -66,6 +67,18 @@ const getGoodProductList = (params) => mGet(`/recycle-service/get/product-list`,
// /recycle-service/update/product-status // /recycle-service/update/product-status
const statusProductInfo = (params) => mPost(`/recycle-service/update/product-status`, params, zconfig) const statusProductInfo = (params) => mPost(`/recycle-service/update/product-status`, params, zconfig)
const deleteProduct = (params) => mPost(`/recycle-service/delete/product`, params, zconfig) const deleteProduct = (params) => mPost(`/recycle-service/delete/product`, params, zconfig)
const getTaskList = () => mGet(`/recycle-service/point-task/get/potn-task/list`, null, zconfig)
const getPointList = () => mGet(`/recycle-service/point-product/get/point-product-list`, null, zconfig)
const getPointProduct = (id) => mGet(`/recycle-service/point-product/buy/point-product/${id}`, null, zconfig)
const getBiddingActivity = (id) => mGet(`/recycle-service/get/bidding-activity-detail/${id}`, null, zconfig)
const getBiddingDetail = (id) => mGet(`/recycle-service/get/bidding-detail/${id}`, null, zconfig)
const biddingActivity = (id, params) => mPost(`/recycle-service/bid/${id}`, params, zconfig)
const getMyBiddingList = (params) => mGet(`/recycle-service/get/bidding-list`, params, zconfig)
const getBiddingList = (id) => mGet(`/recycle-service/get/bidding-list/${id}`, null, zconfig)
const getUserProduct = (id) => mGet(`/recycle-service/get/user-product/${id}`, null, zconfig)
const confirmBidding = (params) => mPost(`/recycle-service/confirm/bidding`, params, zconfig)
const cancelBidding = (id) => mPost(`/recycle-service/cancel/bidding-activity/${id}`, null, zconfig)
const getMyBidding = (id) => mGet(`/recycle-service/get/my-bidding/${id}`, null, zconfig)
export { export {
zconfig, zconfig,
@ -75,6 +88,7 @@ export {
getFactoryPrice, getFactoryPrice,
getFactoryCity, getFactoryCity,
getIndexInfoId, getIndexInfoId,
getIndexInfo,
getFactoryList, getFactoryList,
getFactoryTodayList, getFactoryTodayList,
getVehicleList, getVehicleList,
@ -107,5 +121,17 @@ export {
getBiddingInterval, getBiddingInterval,
getGoodProductList, getGoodProductList,
statusProductInfo, statusProductInfo,
deleteProduct
deleteProduct,
getTaskList,
getPointList,
getPointProduct,
getBiddingActivity,
getBiddingDetail,
biddingActivity,
getMyBiddingList,
getBiddingList,
getUserProduct,
confirmBidding,
cancelBidding,
getMyBidding
} }

70
pages/bidding/detail/index.js

@ -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()

2
pages/bidding/detail/index.wxml

@ -92,7 +92,7 @@
店铺 店铺
</view> </view>
<view style="width:100%"> <view style="width:100%">
<wux-button block type="assertive" bind:click="biddingActicity" wx:if="{{biddingInfo.status == 0}}">修改报价</wux-button>
<wux-button block type="assertive" bind:click="showBiddingDialog" wx:if="{{biddingInfo.status == 0}}">修改报价</wux-button>
<wux-button block type="positive" bind:click="offerOrder" wx:if="{{biddingInfo.status == 1}}">立即下单</wux-button> <wux-button block type="positive" bind:click="offerOrder" wx:if="{{biddingInfo.status == 1}}">立即下单</wux-button>
</view> </view>
</view> </view>

10
pages/bidding/index/index.js

@ -1,5 +1,5 @@
// pages/morder/index/index.js // pages/morder/index/index.js
const request = require('../../../utils/request') //导入模块
import { getMyBiddingList } from "../../api/ztb"
const util = require('../../../utils/util') const util = require('../../../utils/util')
const event = require('../../../utils/event.js') const event = require('../../../utils/event.js')
const app = getApp() const app = getApp()
@ -60,13 +60,9 @@ Page({
if (this.data.loading) { if (this.data.loading) {
this.data.requesting = true this.data.requesting = true
} else { } else {
this.setData({
requesting: true
})
this.setData({ requesting: true })
} }
// /product/cheapList特价产品列表
request.get('/recycle-service/get/bidding-list', this.data.form).then(result => {
//成功回调
getMyBiddingList(this.data.form).then(result => {
if (result.data.records.length) { if (result.data.records.length) {
var respList = result.data.records var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]` let nowList = `orderList[${this.data.orderList.length}]`

20
pages/html/integral/index.js

@ -1,8 +1,8 @@
// pages/ztbvip/index.js // pages/ztbvip/index.js
const request = require('../../../utils/request') //导入模块
import { getBaseInfo, getTaskList, getPointProduct } from "../../api/ztb"
const util = require('../../../utils/util') const util = require('../../../utils/util')
const events = require('../../../utils/event.js')
import WxCountUp from '../../../utils/countup.js'
const events = require('../../../utils/event')
import WxCountUp from '../../../utils/countup'
const app = getApp() const app = getApp()
Page({ Page({
@ -29,13 +29,11 @@ Page({
}, },
fetchUserInfo: function () { fetchUserInfo: function () {
wx.showLoading({ title: '处理中', mask: true }) wx.showLoading({ title: '处理中', mask: true })
// /user/userInfo 获取用户信息
request.get('/recycle-service/user/get/base-info').then(result => {
getBaseInfo().then(result => {
app.globalData.userInfo = result.data app.globalData.userInfo = result.data
this.countUp.update(app.globalData.userInfo.memberRewardPoint) this.countUp.update(app.globalData.userInfo.memberRewardPoint)
}) })
//point-task/get/potn-task/list查询所有积分任务
request.get('/recycle-service/point-task/get/potn-task/list').then(result => {
getTaskList().then(result => {
var shareIndex = -1 var shareIndex = -1
for (let index = 0; index < result.data.length; index++) { for (let index = 0; index < result.data.length; index++) {
const element = result.data[index] const element = result.data[index]
@ -49,8 +47,7 @@ Page({
} }
this.setData({ taskList: result.data }) this.setData({ taskList: result.data })
}) })
// /point-product/get/point-product-list 查询所有积分产品
request.get('/recycle-service/point-product/get/point-product-list').then(result => {
getPointList().then(result => {
this.setData({ pointList: result.data }) this.setData({ pointList: result.data })
wx.hideLoading() wx.hideLoading()
}).catch(error => { }).catch(error => {
@ -106,12 +103,11 @@ Page({
return return
} }
wx.showLoading({ title: '处理中', mask: true }) wx.showLoading({ title: '处理中', mask: true })
// /point-product/buy/point-product/{id} 购买积分产品
request.get('/recycle-service/point-product/buy/point-product/' + item.id).then(res => {
getPointProduct(item.id).then(res => {
util.showToast('兑换成功') util.showToast('兑换成功')
app.globalData.userInfo.isVIP = 1 app.globalData.userInfo.isVIP = 1
events.emit('EventMessage', { what: 200, desc: 'Vip' }) events.emit('EventMessage', { what: 200, desc: 'Vip' })
request.get('/recycle-service/point-product/get/point-product-list').then(result => {
getPointList().then(result => {
this.setData({ pointList: result.data }) this.setData({ pointList: result.data })
wx.hideLoading() wx.hideLoading()
app.globalData.userInfo.memberRewardPoint -= parseInt(item.price) app.globalData.userInfo.memberRewardPoint -= parseInt(item.price)

11
pages/html/notice/index.js

@ -1,26 +1,21 @@
// pages/html/notice/index.js // pages/html/notice/index.js
const request = require('../../../utils/request') //导入模块
import { getIndexInfo } from "../../api/ztb"
const util = require('../../../utils/util') const util = require('../../../utils/util')
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
*/ */
data: { data: {
noticeInfo: null noticeInfo: null
}, },
/** /**
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
if(!util.isEmpty(options.id)){ if(!util.isEmpty(options.id)){
wx.showLoading({
title: '加载中',
mask: true
})
request.get('/recycle-service/get/index-info/' + options.id).then(result => {
wx.showLoading({ title: '加载中', mask: true })
getIndexInfo(options.id).then(result => {
wx.hideLoading() wx.hideLoading()
this.setData({ noticeInfo: result.data }) this.setData({ noticeInfo: result.data })
}).catch(err => { }).catch(err => {

49
pages/mall/detail/index.js

@ -1,6 +1,6 @@
// pages/order/order-info/index.js // pages/order/order-info/index.js
import { biddingActivity, getBiddingList, getUserProduct } from "../../api/ztb"
import { $wuxCountDown } from '../../../components/index' import { $wuxCountDown } from '../../../components/index'
const request = require('../../../utils/request') //导入模块
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')
@ -51,9 +51,7 @@ Page({
} }
}, },
fetchInfo: function (id) { fetchInfo: function (id) {
// /product/{id}产品详情
request.get('/recycle-service/get/user-product/' + id).then(result => {
//成功回调
getUserProduct(id).then(result => {
wx.hideLoading() wx.hideLoading()
if (Number(result.data.minBuyNum) > 1) { if (Number(result.data.minBuyNum) > 1) {
this.data.form.number = parseInt(result.data.minBuyNum) this.data.form.number = parseInt(result.data.minBuyNum)
@ -88,15 +86,7 @@ Page({
}] }]
}) })
} else if (result.data.bidType == 2 && (result.data.biddingActivityStatus != 0)) { } else if (result.data.bidType == 2 && (result.data.biddingActivityStatus != 0)) {
// this.wuxDialog.open({
// maskClosable: false,
// title: '温馨提示',
// content: '该商品的竞价已经结束,无法报价',
// buttons: [{
// text: '确定',
// type: 'primary'
// }]
// })
} else if (result.data.bidType == 2 && result.data.biddingActivityStatus == 0) { } else if (result.data.bidType == 2 && result.data.biddingActivityStatus == 0) {
this.fetchBiddingList(result.data.biddingActivityId) this.fetchBiddingList(result.data.biddingActivityId)
if(this.data.frist){ if(this.data.frist){
@ -104,7 +94,6 @@ Page({
} }
} }
}).catch(err => { }).catch(err => {
//异常回调
wx.hideLoading() wx.hideLoading()
util.showToast(err) util.showToast(err)
}) })
@ -134,8 +123,7 @@ Page({
this.setData({ current: e.detail.current + 1 }) this.setData({ current: e.detail.current + 1 })
}, },
fetchBiddingList: function (biddingActivityId) { fetchBiddingList: function (biddingActivityId) {
request.get('/recycle-service/get/bidding-list/' + biddingActivityId).then(result => {
//成功回调
getBiddingList(biddingActivityId).then(result => {
for (let index = 0; index < result.data.records.length; index++) { for (let index = 0; index < result.data.records.length; index++) {
const element = result.data.records[index] const element = result.data.records[index]
if(element.isMine && app.globalData.userInfo){ if(element.isMine && app.globalData.userInfo){
@ -154,7 +142,6 @@ Page({
}, },
// 事件处理 // 事件处理
onEvent: function (message) { onEvent: function (message) {
console.log('mall>>order>>onEvent', message)
if (message.what == 1) { if (message.what == 1) {
} else if (message.what == 10) { } else if (message.what == 10) {
@ -179,9 +166,7 @@ Page({
}, },
bindended: function () { bindended: function () {
this.videoContext.exitFullScreen() this.videoContext.exitFullScreen()
this.setData({
visible: false
})
this.setData({ visible: false })
}, },
// 图片查看 // 图片查看
viewImage: function (e) { viewImage: function (e) {
@ -195,10 +180,7 @@ Page({
} }
imgList.push(this.data.imgList[index]) imgList.push(this.data.imgList[index])
} }
wx.previewImage({
urls: imgList,
current: e.currentTarget.dataset.url
});
wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url })
}, },
// 进入支付流程 // 进入支付流程
offerProject: function (e) { offerProject: function (e) {
@ -268,12 +250,6 @@ Page({
} }
return 0 return 0
}, },
// 就行登录流程;然后进入下一步的支付操作
onGotPhoneNumber: function (e) {
request.loginWechat(e.detail).then(data => {
this.offerProject()
})
},
onShareAppMessage: function () { onShareAppMessage: function () {
var title = this.data.orderInfo.locProvinceName + this.data.orderInfo.locCityName var title = this.data.orderInfo.locProvinceName + this.data.orderInfo.locCityName
if(this.data.orderInfo.bidType == 2){ if(this.data.orderInfo.bidType == 2){
@ -323,17 +299,8 @@ Page({
util.showToast('请输入合理的报价') util.showToast('请输入合理的报价')
return return
} }
// if(Number(price) < Number(this.data.orderInfo.unitPrice)){
// util.showToast('您输入单价低于最低报价,请重新输入')
// return
// }
wx.showLoading({
title: '加载中',
mask: true
})
// /recycle-service/bid/{biddingActivityId} 参与报价
request.post('/recycle-service/bid/' + this.data.orderInfo.biddingActivityId, { biddingUnitPrice: price }).then(result => {
//成功回调
wx.showLoading({ title: '加载中', mask: true })
biddingActivity(this.data.orderInfo.biddingActivityId, { biddingUnitPrice: price }).then(result => {
wx.hideLoading() wx.hideLoading()
this.fetchBiddingList(this.data.orderInfo.biddingActivityId) this.fetchBiddingList(this.data.orderInfo.biddingActivityId)
util.showToast('报价成功') util.showToast('报价成功')

Loading…
Cancel
Save