From 24531d011cb0a85a134a3b2d59e4b6c33c6d5845 Mon Sep 17 00:00:00 2001 From: ZhaoTongYao <531131322@qq.com> Date: Mon, 28 Dec 2020 16:35:07 +0800 Subject: [PATCH] =?UTF-8?q?v=201.6.14=20;=20=E6=8B=BC=E5=9B=A2=E8=B4=AD?= =?UTF-8?q?=E6=94=B9=E7=89=88=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 4 + pages/heartNew/heartNew.wxml | 2 +- pages/toRegister/toRegister.js | 2 +- .../cancelSignupDialog/cancelSignupDialog.js | 21 +- .../cancelSignupDialog.wxml | 2 +- .../heart/components/noticeNew/noticeNew.wxml | 66 +++- subpages/heart/images/add.png | Bin 0 -> 2103 bytes subpages/heart/images/btnbk0.png | Bin 0 -> 5199 bytes subpages/heart/images/checkbox-checked.png | Bin 0 -> 1374 bytes subpages/heart/images/checkbox.png | Bin 0 -> 1274 bytes subpages/heart/images/icon_close.png | Bin 0 -> 1962 bytes subpages/heart/images/ig_tianjiatupian@2x.png | Bin 0 -> 22592 bytes subpages/heart/images/loading.gif | Bin 0 -> 3897 bytes subpages/heart/images/minus.png | Bin 0 -> 1930 bytes subpages/heart/images/my-groupbuy.png | Bin 0 -> 10796 bytes subpages/heart/images/signed2.png | Bin 0 -> 3434 bytes subpages/heart/images/signup.png | Bin 0 -> 9532 bytes subpages/heart/images/unsignup.png | Bin 0 -> 12601 bytes subpages/heart/pages/dropByList/dropByList.js | 15 + .../heart/pages/dropByList/dropByList.wxml | 6 +- subpages/heart/pages/evaluate/evaluate.js | 346 ++++++++++++++++++ subpages/heart/pages/evaluate/evaluate.json | 7 + subpages/heart/pages/evaluate/evaluate.wxml | 36 ++ subpages/heart/pages/evaluate/evaluate.wxss | 157 ++++++++ .../groupBuyConfirmList.js | 191 ++++++++++ .../groupBuyConfirmList.json | 8 + .../groupBuyConfirmList.wxml | 34 ++ .../groupBuyConfirmList.wxss | 104 ++++++ .../pages/groupBuyDetail/groupBuyDetail.js | 276 ++++++++++++++ .../pages/groupBuyDetail/groupBuyDetail.json | 9 + .../pages/groupBuyDetail/groupBuyDetail.wxml | 82 +++++ .../pages/groupBuyDetail/groupBuyDetail.wxss | 158 ++++++++ .../heart/pages/groupBuyList/groupBuyList.js | 35 +- .../pages/groupBuyList/groupBuyList.wxml | 25 +- .../pages/groupBuyList/groupBuyList.wxss | 134 ++++++- .../pages/groupBuyListMy/groupBuyListMy.js | 300 +++++++++++++++ .../pages/groupBuyListMy/groupBuyListMy.json | 10 + .../pages/groupBuyListMy/groupBuyListMy.wxml | 67 ++++ .../pages/groupBuyListMy/groupBuyListMy.wxss | 201 ++++++++++ .../pages/groupBuyPublish/groupBuyPublish.js | 241 ++++++++++-- .../groupBuyPublish/groupBuyPublish.json | 3 +- .../groupBuyPublish/groupBuyPublish.wxml | 35 +- .../groupBuyPublish/groupBuyPublish.wxss | 67 +++- subpages/heart/pages/volunteer/volunteer.js | 8 +- subpages/heart/utils/api.js | 64 +++- 45 files changed, 2631 insertions(+), 85 deletions(-) create mode 100644 subpages/heart/images/add.png create mode 100644 subpages/heart/images/btnbk0.png create mode 100644 subpages/heart/images/checkbox-checked.png create mode 100644 subpages/heart/images/checkbox.png create mode 100644 subpages/heart/images/icon_close.png create mode 100644 subpages/heart/images/ig_tianjiatupian@2x.png create mode 100644 subpages/heart/images/loading.gif create mode 100644 subpages/heart/images/minus.png create mode 100644 subpages/heart/images/my-groupbuy.png create mode 100644 subpages/heart/images/signed2.png create mode 100644 subpages/heart/images/signup.png create mode 100644 subpages/heart/images/unsignup.png create mode 100644 subpages/heart/pages/evaluate/evaluate.js create mode 100644 subpages/heart/pages/evaluate/evaluate.json create mode 100644 subpages/heart/pages/evaluate/evaluate.wxml create mode 100644 subpages/heart/pages/evaluate/evaluate.wxss create mode 100644 subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.js create mode 100644 subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.json create mode 100644 subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxml create mode 100644 subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxss create mode 100644 subpages/heart/pages/groupBuyDetail/groupBuyDetail.js create mode 100644 subpages/heart/pages/groupBuyDetail/groupBuyDetail.json create mode 100644 subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxml create mode 100644 subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxss create mode 100644 subpages/heart/pages/groupBuyListMy/groupBuyListMy.js create mode 100644 subpages/heart/pages/groupBuyListMy/groupBuyListMy.json create mode 100644 subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxml create mode 100644 subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxss diff --git a/app.json b/app.json index 0e6fd24..cb6a589 100644 --- a/app.json +++ b/app.json @@ -117,6 +117,10 @@ "pages/myApplyDetail/myApplyDetail", "pages/bannerDetail/bannerDetail", "pages/groupBuyList/groupBuyList", + "pages/groupBuyListMy/groupBuyListMy", + "pages/groupBuyDetail/groupBuyDetail", + "pages/groupBuyConfirmList/groupBuyConfirmList", + "pages/evaluate/evaluate", "pages/dropByList/dropByList", "pages/groupBuyPublish/groupBuyPublish", "pages/dropByPublish/dropByPublish", diff --git a/pages/heartNew/heartNew.wxml b/pages/heartNew/heartNew.wxml index b618ca9..2df8e54 100644 --- a/pages/heartNew/heartNew.wxml +++ b/pages/heartNew/heartNew.wxml @@ -56,7 +56,7 @@ - {{item.remark}} + diff --git a/pages/toRegister/toRegister.js b/pages/toRegister/toRegister.js index 11580c8..a7a89a1 100644 --- a/pages/toRegister/toRegister.js +++ b/pages/toRegister/toRegister.js @@ -21,7 +21,7 @@ Page({ // } // }) let that = this - const versionNum = "1.6.13" + const versionNum = "1.6.14" api.getScanSwitch(versionNum).then(function (res) { console.log(res.data) let state = res.data.scanFlag diff --git a/subpages/heart/components/cancelSignupDialog/cancelSignupDialog.js b/subpages/heart/components/cancelSignupDialog/cancelSignupDialog.js index 9a2df90..53eedbb 100644 --- a/subpages/heart/components/cancelSignupDialog/cancelSignupDialog.js +++ b/subpages/heart/components/cancelSignupDialog/cancelSignupDialog.js @@ -54,11 +54,12 @@ Component({ close () { this.triggerEvent("close", {data: this.data.textareaValue}) this.setData({ - visible: !this.data.visible + visible: !this.data.visible, + textareaValue: '' }) }, confirm () { - if (this.data.textareaValue === "") { + if (this.data.textareaValue.trim() === "") { wx.showToast({ title: "原因不能为空", icon: "none", @@ -68,14 +69,20 @@ Component({ } this.triggerEvent("confirm", {data: this.data.textareaValue}) this.setData({ - visible: !this.data.visible + visible: !this.data.visible, + textareaValue: '' }) }, textareaInput (e) { - this.setData({ - textareaValue: e.detail.value - }) - console.log(this.data.textareaValue) + if (this.data.visible) { + this.setData({ + textareaValue: e.detail.value + }) + } else { + this.setData({ + textareaValue: '' + }) + } }, closeDialog () { this.setData({ diff --git a/subpages/heart/components/cancelSignupDialog/cancelSignupDialog.wxml b/subpages/heart/components/cancelSignupDialog/cancelSignupDialog.wxml index b045dcd..a38ce82 100644 --- a/subpages/heart/components/cancelSignupDialog/cancelSignupDialog.wxml +++ b/subpages/heart/components/cancelSignupDialog/cancelSignupDialog.wxml @@ -5,7 +5,7 @@ {{title}} - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/subpages/heart/pages/evaluate/evaluate.wxss b/subpages/heart/pages/evaluate/evaluate.wxss new file mode 100644 index 0000000..d68cebb --- /dev/null +++ b/subpages/heart/pages/evaluate/evaluate.wxss @@ -0,0 +1,157 @@ +page { + width: 100%; + height:100%; +} +.add-evaluate { + width: 100%; + height: 100%; + background: #f7f7f7; + box-sizing: border-box; + padding: 20rpx; +} +.add-evaluate .evaluate { + width: 100%; + height: 640rpx; + background: #fff; + border-radius: 16rpx; + box-sizing: border-box; + padding: 45rpx 20rpx 0; +} +.add-evaluate .evaluate textarea { + color: #333; + font-size: 34rpx; + line-height: 46rpx; + width: 100%; + height: 340rpx; + box-sizing: border-box; + padding-bottom: 20rpx; + position: relative; +} +.add-evaluate .evaluate textarea .placeholder-textarea { + font-size: 28rpx; + line-height: 46rpx; + color: #999; + position: absolute; + left: 0; + top: 0; +} +.add-evaluate .evaluate .picture { + display: flex; + height: 255rpx; + box-sizing: border-box; + padding: 20rpx 0; +} +.add-evaluate .evaluate .picture .image-box, .add-evaluate .evaluate .picture image { + width: 215rpx; + height: 215rpx; + object-fit:cover; + border-radius: 8rpx; +} +.add-evaluate .evaluate .picture .image-box image { + width: 215rpx; + height: 215rpx; + object-fit:cover; +} +.add-evaluate .evaluate .picture .image-box { + position: relative; +} +.add-evaluate .evaluate .picture .image-box .loading { + position: absolute; + left: 25%; + top: 25%; + width: 50%; + height: 50%; +} +.add-evaluate .evaluate .picture .image-box .delete-image { + width: 40rpx; + height: 40rpx; + position: absolute; + right: -20rpx; + top: -20rpx; +} +.add-evaluate .evaluate .picture .image-box + .image-box { + margin-left: 10rpx; +} + +.add-evaluate .address { + width: 100%; + height: 210rpx; + background: #fff; + border-radius: 16rpx; + margin-top: 20rpx; + box-sizing: border-box; + padding: 0 20rpx; +} +.add-evaluate .address textarea { + width: 100%; + height: 122rpx; + box-sizing: border-box; + padding-top: 35rpx; + font-size: 34rpx; + color: #333; + line-height: 46rpx; +} +.add-evaluate .address .placeholder-textarea { + font-size: 28rpx; + line-height: 46rpx; + color: #999; +} +.add-evaluate .address .tip { + width: 100%; + height: 78rpx; + display: flex; + align-items: center; +} +.add-evaluate .address .tip image { + width: 22rpx; + height: 26rpx; + object-fit: cover; +} +.add-evaluate .address .tip text { + font-size: 26rpx; + color: #999; + margin-left: 14rpx; +} + +.add-evaluate .evaluate-button { + width: 100%; + height: 85rpx; + display:flex; + justify-content: center; + align-items: center; + position: fixed; + bottom: 100rpx; + left: 0; +} +.add-evaluate .evaluate-button button { + width: 560rpx; + height: 100rpx; + line-height: 85rpx; + text-align:center; + color: #fff; + font-size: 36rpx; + border-radius: 16rpx; + /* background: linear-gradient(to right, #F40C0C, #FF4E4E) */ + background-color: transparent; +} +.add-evaluate .evaluate-button .hover-button { + /* background: red; */ +} +button image { + width: 100%; + height: 100%; +} +button text { + position: absolute; + width: 100%; + height: 100%; + left: 0; +} +button::after { + border: none; +} + +.wux-actionsheet__button { + font-size: 34rpx !important; + color: #333 !important; +} \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.js b/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.js new file mode 100644 index 0000000..bd1e5d8 --- /dev/null +++ b/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.js @@ -0,0 +1,191 @@ +// subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.js +const api = require('../../utils/api') +Page({ + /** + * 页面的初始数据 + */ + data: { + pageIndex: 1, + pageSize: 10, + nodata: false, + loadMoreType: 'none', + loadMoreVisible: false, + groupBuyId: '', //拼团购的ID + confirmlist:[], + _checklist:[], + allChecked: false, + dialogVisible: false, //提示框 + dialogTitle: '', //提示内容 + lock: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + groupBuyId: options.id + }) + this.getConfirmList() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + + }, + + /** + * 用户点击右上角分享 + */ + // onShareAppMessage: function () { + + // } + changeCheckValue (e) { + let index = e.currentTarget.dataset.index + let status = e.currentTarget.dataset.status + this.data.confirmlist[index].signUpStatus = (status == '0' ? '5' : '0') + this.setData({ + confirmlist: this.data.confirmlist + }) + + for(let i=0; i { + item.signUpStatus = this.data.allChecked ? '5' : '0' + let val = { + id: item.id, + signUpStatus: item.signUpStatus + } + this.data._checklist.push(val) + }) + + this.setData({ + allChecked: this.data.allChecked, + confirmlist: this.data.confirmlist + }) + console.log(this.data._checklist) + }, + submitConfirm () { + if (this.data.lock) { + return + } + console.log('tradeConfirmationList', this.data._checklist) + if (this.data._checklist.length > 0) { + const para = { + tradeConfirmationList: this.data._checklist + } + this.setData({ + lock: true + }) + api.tradeConfirmation(para).then(res => { + console.log(res.data) + this.setData({ + allChecked: false, + confirmlist: [], + _checklist: [], + pageIndex: 1, + dialogVisible: true, + dialogTitle: '提交成功', + lock: false + }) + this.getConfirmList() + }).catch(err => { + this.setData({ + lock: false + }) + }) + } + }, + //获取列表 + getConfirmList () { + const para = { + id: this.data.groupBuyId, + pageIndex: this.data.pageIndex, + pageSize: this.data.pageSize + } + api.getGroupBuySignUpList(para).then(res => { + console.log(res) + this.setData({ + confirmlist: [...this.data.confirmlist,...res.data], + loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', + loadMoreVisible: res.data.length === this.data.pageSize ? false : true, + nodata: false, + }) + if (this.data.confirmlist.length == 0) { + this.setData({ + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + } + }).catch(err => { + this.setData({ + confirmlist: [], + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + console.log(err) + }) + }, + + // 关闭弹框 + closeDialog () { + this.setData({ + dialogVisible: false + }) + }, +}) \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.json b/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.json new file mode 100644 index 0000000..0bb28ac --- /dev/null +++ b/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.json @@ -0,0 +1,8 @@ +{ + "usingComponents": { + "notice": "../../components/notice/notice", + "load-more": "/components/loadMore/loadMore", + "no-data": "/components/nodata/nodata" + }, + "navigationBarTitleText": "报名列表" +} \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxml b/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxml new file mode 100644 index 0000000..00c42b8 --- /dev/null +++ b/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxml @@ -0,0 +1,34 @@ + + + + 微信名 + 联系电话 + 是否完成交易 + + + + {{item.nickname}} + {{item.mobile}} + + + + + + + + + + + {{allChecked ? '取消全选' : '全选'}} + + + + 提交 + + + + + + + + diff --git a/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxss b/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxss new file mode 100644 index 0000000..d70fb17 --- /dev/null +++ b/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxss @@ -0,0 +1,104 @@ +/* subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxss */ +page { + background: #f7f7f7; +} +.groupbuy-confirm-list { + background: #ffffff; +} +.top-title { + width: 690rpx; + display: flex; + justify-content: space-around; + align-items: center; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #333333; + height: 100rpx; + line-height: 100rpx; + margin: 0 auto; +} +.top-title view { + flex: 1; +} +.confirm-list { + width: 690rpx; + margin: 0 auto; + border-top: 1px solid #DCDCDC; +} +.confirm-list .confirm-item { + width: 100%; + display: flex; + justify-content: flex-start; + align-items: center; + height: 78rpx; +} +.confirm-list .confirm-item .username { + width: 220rpx; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 400; + color: #333333; + overflow: hidden; + text-overflow:ellipsis; + white-space: nowrap; +} +.confirm-list .confirm-item .userphone { + width: 240rpx; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 400; + color: #333333; +} +.confirm-list .confirm-item .checkbox { + width: 200rpx; + display: flex; + justify-content: center; + align-items: center; +} +.confirm-list .confirm-item .checkbox image { + width: 42rpx; + height: 42rpx; +} +.bottom-menu { + background: #fff; + position: fixed; + bottom: 0; + width: 100%; + height: 98rpx; + display: flex; + align-items: center; + justify-content: space-between; +} +.bottom-menu .checkbox { + display: flex; + justify-content: center; + align-items: center; + margin-left: 32rpx; +} +.bottom-menu .checkbox image { + width: 42rpx; + height: 42rpx; + margin-right: 12rpx; +} + +.bottom-menu .submit { + width: 178rpx; + height: 78rpx; + position: relative; +} +.bottom-menu .submit .submit-bk { + width: 100%; + height: 100%; + position: absolute; + z-index: -1; +} +.bottom-menu .submit .submit-text { + font-size: 34rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + height: 78rpx; + line-height: 78rpx; + text-align: center; +} \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyDetail/groupBuyDetail.js b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.js new file mode 100644 index 0000000..b28aab0 --- /dev/null +++ b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.js @@ -0,0 +1,276 @@ +// subpages/heart/pages/groupBuyDetail/groupBuyDetail.js +const api = require("../../utils/api") +const app = getApp() + +Page({ + + /** + * 页面的初始数据 + */ + data: { + pageIndex: 1, + pageSize: 10, + nodata: false, + loadMoreType: 'none', + loadMoreVisible: false, + infoCompleted: 0, //完善信息标志 + noticeId: '', + details: {}, //团购详情 + evaluateList: [], //评价列表 + detailType: '', //团购详情,结束详情 + dialogVisible: false, //提示框 + dialogTitle: '', //提示内容 + lock: false, + }, + + /** + * 生命周期函数--监听页面加载 + */ + onLoad: function (options) { + this.setData({ + infoCompleted: app.globalData.infoCompleted, + noticeId: options.id, + detailType: options.type || '', + details: {} + }) + this.getNoticeDetail() + this.getEvaluationList() + }, + + /** + * 生命周期函数--监听页面初次渲染完成 + */ + onReady: function () { + + }, + + /** + * 生命周期函数--监听页面显示 + */ + onShow: function () { + + }, + + /** + * 生命周期函数--监听页面隐藏 + */ + onHide: function () { + + }, + + /** + * 生命周期函数--监听页面卸载 + */ + onUnload: function () { + + }, + + /** + * 页面相关事件处理函数--监听用户下拉动作 + */ + onPullDownRefresh: function () { + + }, + + /** + * 页面上拉触底事件的处理函数 + */ + onReachBottom: function () { + this.setData({ + loadMoreVisible: true + }) + if (this.data.loadMoreType === "loading") { + this.setData({ + pageIndex: this.data.pageIndex + 1 + }) + this.getEvaluationList() + } + }, + + /** + * 用户点击右上角分享 + */ + // onShareAppMessage: function () { + + // }, + + //列表照片的放大查看 + previewImage (e) { + console.log(e.currentTarget.dataset) + wx.previewImage({ + urls: e.currentTarget.dataset.imgarry, + current: e.currentTarget.dataset.src + }) + }, + + getEvaluationList () { + const para = { + groupBuyId: this.data.noticeId, + pageIndex: this.data.pageIndex, + pageSize: this.data.pageSize + } + api.getEvaluationList(para).then(res => { + console.log(res) + this.setData({ + evaluateList: [...this.data.evaluateList,...res.data], + loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', + loadMoreVisible: res.data.length === this.data.pageSize ? false : true, + nodata: false, + }) + if (this.data.evaluateList.length == 0) { + this.setData({ + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + } + }).catch(err => { + this.setData({ + evaluateList: [], + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + console.log(err) + }) + }, + + getNoticeDetail () { + wx.showLoading({ + title: '加载中...' + }) + api.getGroupBuyDetail(this.data.noticeId).then(res => { + // console.log(res.data) + wx.hideLoading() + this.setData({ + details: res.data + }) + }) + }, + callNumber () { + let mobile = this.data.details.groupBuyMobile + console.log('拨打电话', mobile) + let that = this + wx.showModal({ + title: "拨打电话", + content: "", + cancelColor: "#29B9A5", + confirmColor: "#29B9A5", + success: (res) => { + if (res.confirm) { + console.log("用户点击确定") + that.countCall() + wx.makePhoneCall({ + phoneNumber: mobile + }) + } else if (res.cancel) { + console.log("用户点击取消") + } + } + }) + }, + countCall () { + api.groupBuyCall(this.data.noticeId).then(res => { + console.log(res.data) + }) + }, + + //结束团购 + submit () { + if (this.data.lock) { + return false + } + const para = { + id: this.data.noticeId, + status: '5' + } + this.setData({ + lock: true + }) + api.updateStatus(para).then(() => { + this.setData({ + dialogVisible: true, + dialogTitle: '已结束团购', + lock: false + }) + }).catch(err => { + this.setData({ + lock: false + }) + }) + }, + + //报名 / 取消报名 + signupCall (e) { + if (this.verifyCompleteInfo()) { + return false + } + if (this.data.lock) { + return false + } + //状态0:进行中 5:已结束 10:已取消 + if (e.currentTarget.dataset.groupbuystatus != 0) { + return false + } + //提交 报名状态0:报名 10:取消报名 + let status = 0 + //当前 报名状态0:未报名 1:已报名 2:交易已确认 + if (e.currentTarget.dataset.status == 1) { + status = 10 + } else if (e.currentTarget.dataset.status == 2) { + return + } + const para = { + groupBuyId: this.data.noticeId, + status: status + } + this.setData({ + lock: true + }) + api.signUpOrCancel(para).then(res => { + let title = '' + if (status == 0) { + title = '报名成功' + } else { + title = '取消成功' + } + this.setData({ + dialogVisible: true, + dialogTitle: title, + evaluateList: [], + pageIndex: 1 + }) + setTimeout(() => { + this.setData({ + lock: false + }) + }, 500); + this.getNoticeDetail() + this.getEvaluationList() + }).catch(err => { + this.setData({ + lock: false + }) + }) + }, + // 关闭弹框 + closeDialog () { + this.setData({ + dialogVisible: false + }) + if (this.data.dialogTitle == "已结束团购") { + wx.navigateBack() + } + }, + // 检查 是否完善信息 + verifyCompleteInfo () { + if (this.data.infoCompleted == 0) { + this.setData({ + completeInfoDialogVisible: !this.data.completeInfoDialogVisible + }) + return true + } else { + return false + } + } +}) \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyDetail/groupBuyDetail.json b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.json new file mode 100644 index 0000000..180ef3b --- /dev/null +++ b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.json @@ -0,0 +1,9 @@ +{ + "navigationBarTitleText": "团购详情", + "usingComponents": { + "load-more": "/components/loadMore/loadMore", + "no-data": "/components/nodata/nodata", + "notice": "../../components/notice/notice", + "completeInfo-dialog": "/components/completeInfoDialog/completeInfoDialog" + } +} \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxml b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxml new file mode 100644 index 0000000..04d24d5 --- /dev/null +++ b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxml @@ -0,0 +1,82 @@ + + + + + {{details.groupBuyTitle}} + {{details.groupBuyContent}} + + + + + + 联系电话 + + {{details.groupBuyMobile}} + + + + + 价格 + + + 人数达到{{item.groupBuyNumber}}人团购价格为{{item.groupBuyPrice}}元/件 + + + + + 报名人数 + + {{details.groupBuyNumber}} + + + + + + + + + + + + 取消原因 + + {{details.cancelReason}} + + + + + + 结束团购 + + + + + 评价 + + + + + + {{item.nickname}} + {{item.evaluationTime}} + + + {{item.evaluationContent}} + + + + + + + + + + + + + + + + + diff --git a/subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxss b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxss new file mode 100644 index 0000000..23e40a3 --- /dev/null +++ b/subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxss @@ -0,0 +1,158 @@ +/* subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxss */ +page { + width: 100%; + height: auto; + overflow-y: auto; + background: #f7f7f7; +} +.notice-detail { + margin-bottom: 20rpx; +} +.notice-detail .apply-item { + width: 100%; + background-color: white; + display: flex; + flex-direction: column; + align-items: flex-start; + justify-content: center; + padding: 40rpx 30rpx; + margin-top: 16rpx; + box-sizing: border-box; +} +.notice-detail .apply-item .item-title { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #333333; +} +.notice-detail .apply-item .item-content { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 500; + color: #666666; + margin-top: 28rpx; +} +.notice-detail .apply-item .item-content .item-price { + margin-bottom: 10rpx; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 500; + color: #333333; +} +.notice-detail .apply-item .image-box { + width: 690rpx; + display: flex; + justify-content: flex-start; + align-items: center; + margin-top: 30rpx; +} +.notice-detail .apply-item .image-box image { + width: 226rpx; + height: 150rpx; + border-radius: 10rpx; + margin-right: 8rpx; +} +.notice-detail .apply-item .item-mobile { + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; +} +.notice-detail .apply-item .item-mobile .call-img { + width: 176rpx; + height: 76rpx; +} +.notice-detail .apply-item .item-mobile .call-img image{ + width: 100%; + height: 100%; +} +.notice-detail .apply-item .line { + width: 100%; + height: 1px; + background: #F2F2F2; + border-radius: 1px; + margin: 28rpx 0rpx; +} + +/* 评价列表 start */ +.evaluate-list { + background-color: #fff; + padding: 30rpx; + margin-bottom: 60rpx; +} +.evaluate-title { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: bold; + color: #333333; + margin-bottom: 28rpx; +} +.evaluate-line { + height: 1px; + background-color: #DCDCDC; + margin: 30rpx 0; +} +.userbox { + display: flex; + justify-content: flex-start; + align-items: center; +} +.userbox .headlogo { + width: 54rpx; + height: 54rpx; + border-radius: 50%; +} +.userbox .userinfo { + margin-left: 12rpx; +} +.userbox .userinfo .nickname { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 400; + color: #333333; +} +.userbox .userinfo .time { + font-size: 20rpx; + font-family: PingFang SC; + font-weight: 500; + color: #999999; +} +.evaluate-content { + margin: 20rpx 0; +} +.evaluate-image { + display: flex; + justify-content: flex-start; + align-items: center; +} +.evaluate-image image { + width: 226rpx; + height: 150rpx; + margin-right: 12rpx; + border-radius: 10rpx; +} +/* 评价列表 end */ + +/* 结束团购 start */ +.submit { + width: 592rpx; + height: 116rpx; + position: relative; + margin: 78rpx auto 0rpx; +} +.submit .submit-bk { + width: 100%; + height: 100%; + position: absolute; + z-index: -1; +} +.submit .submit-text { + font-size: 34rpx; + font-family: PingFang SC; + font-weight: 500; + color: #FFFFFF; + height: 100rpx; + line-height: 100rpx; + text-align: center; +} +/* 结束团购 end */ \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyList/groupBuyList.js b/subpages/heart/pages/groupBuyList/groupBuyList.js index a773f0e..93348f6 100644 --- a/subpages/heart/pages/groupBuyList/groupBuyList.js +++ b/subpages/heart/pages/groupBuyList/groupBuyList.js @@ -18,6 +18,7 @@ Page({ dialogContent: "", dialogConfirmText: "", dialogCancelText: "", + buttonInfo: {}, //发布按钮 }, /** @@ -28,6 +29,7 @@ Page({ title: options.title }) // this.getGroupBuyList() + this.getImgUrl() }, /** @@ -80,6 +82,7 @@ Page({ * 页面上拉触底事件的处理函数 */ onReachBottom: function () { + console.log('onreachbottom',this.data.loadMoreVisible,this.data.loadMoreType) this.setData({ loadMoreVisible: true }) @@ -90,10 +93,18 @@ Page({ this.getGroupBuyList() } }, + // 获取配置图片 + getImgUrl:function (){ + let that = this + api.getImgUrl("6").then(function (res) { + that.setData({ + buttonInfo: res.data[0] + }) + }) + }, getGroupBuyList () { const para = { - isMe: '0', pageIndex: this.data.pageIndex, pageSize: this.data.pageSize } @@ -126,6 +137,9 @@ Page({ // 跳转发布 toPublish () { console.log('发布') + if (this.data.buttonInfo.imgCode != 'button_bdh_fb') { + return + } api.getVolunteerVerify().then(res => { if (res.code == 0) { if (res.data && res.data.id) { @@ -146,12 +160,15 @@ Page({ console.log(err) }) }, - // 跳转我的发布 + // 跳转我的团购 toNoticeNewList () { - console.log('我的发布') + console.log('我的发布') wx.navigateTo({ - url: `/subpages/heart/pages/noticeNewList/noticeNewList?type=1` + url: `/subpages/heart/pages/groupBuyListMy/groupBuyListMy` }) + // wx.navigateTo({ + // url: `/subpages/heart/pages/noticeNewList/noticeNewList?type=1` + // }) }, //志愿者认证 @@ -159,5 +176,13 @@ Page({ wx.navigateTo({ url: "/subpages/heart/pages/volunteer/volunteer" }) - } + }, + + //前往详情 + toNoticeDetail (e) { + const id = e.currentTarget.dataset.id + wx.navigateTo({ + url: `/subpages/heart/pages/groupBuyDetail/groupBuyDetail?id=${id}` + }) + }, }) \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyList/groupBuyList.wxml b/subpages/heart/pages/groupBuyList/groupBuyList.wxml index cabbc3d..e762275 100644 --- a/subpages/heart/pages/groupBuyList/groupBuyList.wxml +++ b/subpages/heart/pages/groupBuyList/groupBuyList.wxml @@ -1,18 +1,33 @@ - + - + + + + + + + {{item.groupBuyTitle}} + + + 置顶 + {{item.groupBuyStatus == '0' ? '团购中' : '已结束'}} + {{item.groupBuyPublishTime}} + + + + { + console.log(res) + this.setData({ + groupbuylist: [...this.data.groupbuylist,...res.data], + loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', + loadMoreVisible: res.data.length === this.data.pageSize ? false : true, + nodata: false, + }) + if (this.data.groupbuylist.length == 0) { + this.setData({ + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + } + }).catch(err => { + this.setData({ + groupbuylist: [], + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + console.log(err) + }) + }, + + getMyGroupBuyJoin () { + const para = { + pageIndex: this.data.pageIndex, + pageSize: this.data.pageSize + } + api.getMyGroupBuyJoin(para).then(res => { + console.log(res) + this.setData({ + groupbuylist: [...this.data.groupbuylist,...res.data], + loadMoreType: res.data.length === this.data.pageSize ? 'loading' : 'none', + loadMoreVisible: res.data.length === this.data.pageSize ? false : true, + nodata: false, + }) + if (this.data.groupbuylist.length == 0) { + this.setData({ + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + } + }).catch(err => { + this.setData({ + groupbuylist: [], + nodata: true, + loadMoreType: 'none', + loadMoreVisible: false, + }) + console.log(err) + }) + }, + //取消/结束接口函数 + updateStatus () { + + }, + + // 跳转发布 + toPublish () { + console.log('发布') + api.getVolunteerVerify().then(res => { + if (res.code == 0) { + if (res.data && res.data.id) { + wx.navigateTo({ + url: `/subpages/heart/pages/dropByPublish/dropByPublish` + }) + } else { + this.setData({ + dialogVisible: !this.data.dialogVisible, + dialogTitle: "志愿者认证", + dialogContent: ["是否认证志愿者,完成发布"], + dialogConfirmText: "是", + dialogCancelText: "否" + }) + } + } + }).catch(err => { + console.log(err) + }) + }, + + //志愿者认证 + confirmDialog () { + wx.navigateTo({ + url: "/subpages/heart/pages/volunteer/volunteer" + }) + }, + //前往评价 + toEvaluate (e) { + const id = e.currentTarget.dataset.id + wx.navigateTo({ + url: `/subpages/heart/pages/evaluate/evaluate?id=${id}` + }) + }, + //前往 详情 + toNoticeDetail (e) { + const id = e.currentTarget.dataset.id + wx.navigateTo({ + url: `/subpages/heart/pages/groupBuyDetail/groupBuyDetail?id=${id}` + }) + }, + //修改 + toModify (e) { + if (e.currentTarget.dataset.edit == 0) { + return + } + const id = e.currentTarget.dataset.id + wx.navigateTo({ + url: `/subpages/heart/pages/groupBuyPublish/groupBuyPublish?id=${id}` + }) + }, + //取消 + toCancel (e) { + if (e.currentTarget.dataset.status != 0) { + return + } + this.setData({ + cancelSignupVisible: !this.data.cancelSignupVisible, + cancelSignupTipValue: ``, + cancelSignupTipVisible: true, + selectNoticeId: e.currentTarget.dataset.id + }) + }, + cancelSignupCallback (e) { + const para = { + id: this.data.selectNoticeId, + status: '10', + cancelReason: e.detail.data + } + api.updateStatus(para).then(() => { + this.setData({ + noticeVisible: !this.data.noticeVisible, + pageIndex: 1, + groupbuylist: [] + }) + this.getMyGroupBuyList() + }).catch(err => { + console.log(err) + }) + }, + // 关闭弹框 + closeDialog () { + // wx.navigateBack() + }, + //结束团购 + toFinish (e) { + if (e.currentTarget.dataset.status != 0) { + return + } + const id = e.currentTarget.dataset.id + wx.navigateTo({ + url: `/subpages/heart/pages/groupBuyDetail/groupBuyDetail?id=${id}&type=finish` + }) + }, + //确认交易 + toConfirm (e) { + if (e.currentTarget.dataset.status == 10) { + return + } + const id = e.currentTarget.dataset.id + wx.navigateTo({ + url: `/subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList?id=${id}` + }) + } +}) \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyListMy/groupBuyListMy.json b/subpages/heart/pages/groupBuyListMy/groupBuyListMy.json new file mode 100644 index 0000000..ed4d6ec --- /dev/null +++ b/subpages/heart/pages/groupBuyListMy/groupBuyListMy.json @@ -0,0 +1,10 @@ +{ + "navigationBarTitleText": "我的团购", + "usingComponents": { + "coverview-dialog": "../../components/coverViewDialog/coverViewDialog", + "load-more": "/components/loadMore/loadMore", + "no-data": "/components/nodata/nodata", + "notice": "../../components/notice/notice", + "cancel-signup-dialog": "../../components/cancelSignupDialog/cancelSignupDialog" + } +} \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxml b/subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxml new file mode 100644 index 0000000..0c2f57b --- /dev/null +++ b/subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxml @@ -0,0 +1,67 @@ + + + + + + 我的参与 + + + 我的发布 + + + + + + + + + + + + {{item.groupBuyTitle}} + + + {{item.groupBuyStatus == '0' ? '团购中' : item.groupBuyStatus == '5' ? '已结束' : '已取消'}} + {{item.groupBuyPublishTime}} + + 评价 + + + + + + + + {{item.groupBuyTitle}} + + + 查看 + + 修改 + + {{item.groupBuyStatus == 10 ? '已取消' : '取消'}} + + {{item.groupBuyStatus == 5 ? '已结束' : '结束'}} + + 确认交易 + + + + + + + + + + + + + + + + + + + diff --git a/subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxss b/subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxss new file mode 100644 index 0000000..90d6e8c --- /dev/null +++ b/subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxss @@ -0,0 +1,201 @@ +/* subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxss */ +page { + width: 100%; + height: auto; + overflow-y: auto; + background: #f7f7f7; +} +.drop-by-list { + position: relative; + overflow: hidden; +} + + /* tab start */ + .tab-all { + width: 100%; + height: 90rpx; + background-color: #fff; + } + + + .tab-bar { + width: 100%; + height: 90rpx; + background: #fff; + display: flex; + align-items: center; + position: relative; + } + .tab-bar-fixed { + position: fixed; + top: 0rpx; + } + .tab-bar .tab { + font-size: 34rpx; + font-weight: 500; + color: rgba(171, 171, 171, 1); + width: 50%; + height: 100%; + line-height: 92rpx; + /* text-indent: 20rpx; */ + text-align: center; + position: relative; + z-index: 10; + } + + .tab-bar .tab.select { + font-size: 36rpx; + font-weight: bold; + color: rgba(229, 15, 0, 1); + } + + .tab-bar .select-bar { + position: absolute; + left: 14rpx; + bottom: 0rpx; + width: 30rpx; + height: 8rpx; + border-radius: 4rpx; + background: #fc5555; + z-index: 1; + } + + .tab-bar .tab0.select-bar { + left: calc(25% - 15rpx); + transition: left 0.3s linear; + } + + .tab-bar .tab1.select-bar { + left: calc(75% - 15rpx); + transition: left 0.3s linear; + } + /* tab end */ + + /* list start */ + .notice { + width: 750rpx; + background-color: #fff; + margin-top: 14rpx; + padding: 30rpx 30rpx 10rpx 30rpx; + box-sizing: border-box; + display: flex; + justify-content: flex-start; + align-items: flex-start; + } + .notice-left { + width: 220rpx; + min-width: 220rpx; + height: 146rpx; + margin-right: 20rpx; + border-radius: 10rpx; + overflow: hidden; + } + .notice-left image { + width: 100%; + height: 100%; + } + .notice-right { + width: 100%; + height: 146rpx; + display: flex; + flex-direction: column; + justify-content: space-between; + } + .notice-title { + font-size: 34rpx; + font-family: PingFang SC; + font-weight: 500; + color: #333333; + overflow: hidden; + text-overflow: ellipsis; + word-wrap: break-word; + white-space: normal !important; + display: -webkit-box; + -webkit-line-clamp: 2; + -webkit-box-orient: vertical; + } + .notice-bottom { + display: flex; + align-items: flex-end; + justify-content: space-between; + margin-top: 8rpx; + } + .bottom-left { + display: flex; + align-items: flex-end; + justify-content: flex-start; + } + .notice-tag { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + margin-right: 10rpx; + white-space: nowrap; + } + .tag-0 { + color: #00A066; + } + .tag-5 { + color: #E30000; + } + .tag-10 { + color: #999999; + } + .notice-time { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #999999; + white-space: nowrap; + } + .evaluate { + font-size: 28rpx; + font-family: PingFang SC; + font-weight: 500; + color: #F2501B; + padding: 6rpx 12rpx; + border: 1rpx solid #F2501B; + border-radius: 32rpx; + width: 80rpx; + height: 32rpx; + line-height: 32rpx; + text-align: center; + } + .notice-detail { + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #F1551B; + width: 100rpx; + height: 80rpx; + line-height: 80rpx; + } + .notice-options { + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + font-size: 26rpx; + font-family: PingFang SC; + font-weight: 500; + color: #F1551B; + height: 50rpx; + line-height: 50rpx; + } + .notice-options .notice-btn { + text-align: center; + width: 120rpx; + } + .notice-options .notice-btn:first-child { + text-align: left; + width: 80rpx; + } + .notice-options .notice-btn-disabled { + color: #C1C1C1; + } + .notice-line { + width: 1px; + height: 30rpx; + background: #BFBFBF; + } + /* list end */ \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyPublish/groupBuyPublish.js b/subpages/heart/pages/groupBuyPublish/groupBuyPublish.js index 0c1c3b6..b93a34d 100644 --- a/subpages/heart/pages/groupBuyPublish/groupBuyPublish.js +++ b/subpages/heart/pages/groupBuyPublish/groupBuyPublish.js @@ -1,6 +1,8 @@ // subpages/heart/pages/groupBuyPublish/groupBuyPublish.js -const api = require("../../utils/api") +import { $wuxActionSheet } from "../../../../dist/index" import { getTimestamp } from '../../../../utils/common' +const api = require("../../utils/api") +const config = require("../../../../utils/config") Page({ @@ -11,15 +13,24 @@ Page({ dialogVisible: false, //提示框 showPicker: false, //是否显示底部时间选择器插件 dataForm: { - groupBuyTitle: '', //标题 - groupBuyContent: '', //内容 - groupBuyTime: '', //团购时间 - groupBuyMobile: '', //手机 - id: '', //主键 更新时携带 + id: '', //主键 更新时携带 + groupBuyTitle: '', //标题 + groupBuyContent: '', //内容 + // groupBuyTime: '', //团购时间 + groupBuyMobile: '', //手机 + groupBuyPriceNumber: [ + { + groupBuyNumber: '', + groupBuyPrice: '' + } + ], //groupBuyNumber, groupBuyPrice 团购价格人数(最多五条) + groupBuyImg: [], //团购图片(最多三张) }, violationsCount: 0, //内容审核计数 isConReview: false, //内容审核标志 lock: false, //锁定发布按钮状态,防止连击 + uploadImageList: [], + imageId: 0, }, /** @@ -88,6 +99,24 @@ Page({ 'dataForm.groupBuyTitle': e.detail.value }) }, + onInputGroupBuyNumber (e) { + let index = e.currentTarget.dataset.index + this.data.dataForm.groupBuyPriceNumber[index].groupBuyNumber = parseInt(e.detail.value) + this.setData({ + 'dataForm.groupBuyPriceNumber': this.data.dataForm.groupBuyPriceNumber + }) + }, + onInputGroupBuyPrice (e) { + let index = e.currentTarget.dataset.index + if (/^(\d?)+(\.\d{0,2})?$/.test(e.detail.value)) { + this.data.dataForm.groupBuyPriceNumber[index].groupBuyPrice = e.detail.value; + } else { + this.data.dataForm.groupBuyPriceNumber[index].groupBuyPrice = e.detail.value.substring(0, e.detail.value.length - 1); + } + this.setData({ + 'dataForm.groupBuyPriceNumber': this.data.dataForm.groupBuyPriceNumber + }) + }, onInputGroupBuyMobile (e) { this.setData({ 'dataForm.groupBuyMobile': e.detail.value @@ -98,32 +127,45 @@ Page({ 'dataForm.groupBuyContent': e.detail.value }) }, - pickerCancel () { - console.log('取消日期选择') + addPriceItem () { + this.data.dataForm.groupBuyPriceNumber.push({groupBuyNumber:'',groupBuyPrice:''}) this.setData({ - showPicker: false, - 'dataForm.groupBuyTime': '' + 'dataForm.groupBuyPriceNumber': this.data.dataForm.groupBuyPriceNumber }) }, - pickerConfirm (e) { - console.log('选择日期', e.detail.time) - if (e.detail.time < getTimestamp()) { - this.showToast("团购时间应该大于当前时间") - } else { - this.setData({ - showPicker: false, - 'dataForm.groupBuyTime': e.detail.time - }) - } - }, - //日期选择插件显示入口 - selectTime (e) { - this.data.showPicker = !this.data.showPicker + minusPriceItem (e) { + let index = e.currentTarget.dataset.index + this.data.dataForm.groupBuyPriceNumber.splice(index, 1) this.setData({ - showPicker: this.data.showPicker, - 'dataForm.groupBuyTime': this.data.dataForm.groupBuyTime || getTimestamp() + 'dataForm.groupBuyPriceNumber': this.data.dataForm.groupBuyPriceNumber }) }, + // pickerCancel () { + // console.log('取消日期选择') + // this.setData({ + // showPicker: false, + // 'dataForm.groupBuyTime': '' + // }) + // }, + // pickerConfirm (e) { + // console.log('选择日期', e.detail.time) + // if (e.detail.time < getTimestamp()) { + // this.showToast("团购时间应该大于当前时间") + // } else { + // this.setData({ + // showPicker: false, + // 'dataForm.groupBuyTime': e.detail.time + // }) + // } + // }, + // //日期选择插件显示入口 + // selectTime (e) { + // this.data.showPicker = !this.data.showPicker + // this.setData({ + // showPicker: this.data.showPicker, + // 'dataForm.groupBuyTime': this.data.dataForm.groupBuyTime || getTimestamp() + // }) + // }, //发布 submitApply () { if (this.data.lock) { @@ -137,10 +179,10 @@ Page({ this.showToast("标题限制在50字以内") return false } - if (!this.data.dataForm.groupBuyTime) { - this.showToast("请填写团购时间") - return false - } + // if (!this.data.dataForm.groupBuyTime) { + // this.showToast("请填写团购时间") + // return false + // } if (!this.data.dataForm.groupBuyContent) { this.showToast("请填写团购内容") return false @@ -149,6 +191,10 @@ Page({ this.showToast("团购内容限制在500字以内") return false } + if (!this.data.dataForm.groupBuyPriceNumber[0].groupBuyNumber || !this.data.dataForm.groupBuyPriceNumber[0].groupBuyPrice) { + this.showToast("至少填写一条价格说明") + return false + } if (!this.data.dataForm.groupBuyMobile) { this.showToast("请填写联系电话") return false @@ -160,11 +206,29 @@ Page({ wx.showLoading({ title: "发布中", }) + const imagesList = [] + if (this.data.uploadImageList.length > 0) { + const isUploadDown = this.data.uploadImageList.some(item => !item.uploaded) + if (isUploadDown) { + wx.showToast({ + title: "请等待图片上传完成", + icon: "none", + duration: 1000 + }) + return false + } + } + if (this.data.uploadImageList.length > 0) { + this.data.uploadImageList.forEach(item => { + imagesList.push(item.ossUrl) + }) + } this.setData({ lock: true }) const para = { ...this.data.dataForm } para.isConReview = this.data.isConReview + para.groupBuyImg = imagesList console.log('submit', para) let that = this api.groupBuyUpdate(para).then(res => { @@ -225,9 +289,20 @@ Page({ }) api.getGroupBuyDetail(this.data.dataForm.id).then(res => { wx.hideLoading() + res.data.groupBuyImg.forEach( (item, index) => { + let ob = { + imageId: index, + ossUrl: item, + imgUrl: item, + uploaded: true + } + this.data.uploadImageList.push(ob) + }) this.setData({ - dataForm: res.data + dataForm: res.data, + uploadImageList: this.data.uploadImageList }) + console.log(this.data.uploadImageList) }) }, @@ -252,4 +327,108 @@ Page({ delta: 1 }) }, + + // 删除选中的图片 + deleteImage (e) { + const index = this.data.uploadImageList.findIndex(item => item.imageId === e.currentTarget.dataset.imageid) + if (index > -1) { + this.data.uploadImageList.splice(index, 1) + this.setData({ + uploadImageList: this.data.uploadImageList + }) + } + }, + // 选择图片 上传弹窗 - 上传图片方式 - 选择图片 - 上传图片 - 回调赋值 + chooseImage () { + const _this = this + $wuxActionSheet().showSheet({ + buttons: [ + { text: "拍照" }, + { text: "从相册中获取" }, + ], + className: "dialog-class", + buttonClicked (index) { + if (index === 0) { + wx.chooseImage({ + count: 1, + sizeType: ["original", "compressed"], + sourceType: ["camera"], + success (res) { + const uploadImageList = [..._this.data.uploadImageList] + uploadImageList.push({ + uploaded: false, + ossUrl: "", + imgUrl: res.tempFilePaths[0], + imageId: ++_this.data.imageId + }) + _this.setData({ + uploadImageList + }) + wx.uploadFile({ + url: `${config.BASEURL()}group/topic/upload`, + filePath: res.tempFilePaths[0], + name: "file", + header: { + "Content-type": "multipart/form-data" + }, + success (fileRes){ + uploadImageList[uploadImageList.length - 1].uploaded = true + uploadImageList[uploadImageList.length - 1].ossUrl = JSON.parse(fileRes.data).data + _this.setData({ + uploadImageList + }) + } + }) + + } + }) + } else if (index === 1) { + wx.chooseImage({ + count: 3 - _this.data.uploadImageList.length, + sizeType: ["original", "compressed"], + sourceType: ["album"], + success (res) { + const uploadImageList = [] + const endIndex = _this.data.uploadImageList.length + res.tempFilePaths.forEach(item => { + uploadImageList.push({ + uploaded: false, + ossUrl: "", + imgUrl: item, + imageId: ++_this.data.imageId + }) + }) + _this.setData({ + uploadImageList: [..._this.data.uploadImageList,...uploadImageList] + }) + uploadImageList.forEach((item, index) => { + return (function (index) { + wx.uploadFile({ + url: `${config.BASEURL()}group/topic/upload`, + filePath: res.tempFilePaths[index], + name: "file", + header: { + "Content-type": "multipart/form-data" + }, + success (fileRes){ + uploadImageList[index].uploaded = true + uploadImageList[index].ossUrl = JSON.parse(fileRes.data).data + _this.data.uploadImageList = _this.data.uploadImageList.slice(0, endIndex) + _this.setData({ + uploadImageList: [..._this.data.uploadImageList, ...uploadImageList] + }) + } + }) + })(index) + }) + } + }) + } + return true + }, + cancelText: "取消", + cancel () {}, + destructiveButtonClicked () {}, + }) + }, }) \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyPublish/groupBuyPublish.json b/subpages/heart/pages/groupBuyPublish/groupBuyPublish.json index e5b8f4a..0f6a817 100644 --- a/subpages/heart/pages/groupBuyPublish/groupBuyPublish.json +++ b/subpages/heart/pages/groupBuyPublish/groupBuyPublish.json @@ -2,6 +2,7 @@ "navigationBarTitleText": "发布", "usingComponents": { "date-time-picker": "../../../../components/DateTimePicker/index", - "notice": "../../components/notice/notice" + "notice": "../../components/notice/notice", + "wux-actionsheet": "../../../../dist/actionsheet/index" } } \ No newline at end of file diff --git a/subpages/heart/pages/groupBuyPublish/groupBuyPublish.wxml b/subpages/heart/pages/groupBuyPublish/groupBuyPublish.wxml index c7b9ffd..756ac0f 100644 --- a/subpages/heart/pages/groupBuyPublish/groupBuyPublish.wxml +++ b/subpages/heart/pages/groupBuyPublish/groupBuyPublish.wxml @@ -5,14 +5,37 @@ 标题 - + 内容 - + + + + + + + + + + + 价格 + + 人数达到 + + 人团购价格为 + + 元/件 + + + + + 联系电话 @@ -24,8 +47,10 @@ - + + + diff --git a/subpages/heart/pages/groupBuyPublish/groupBuyPublish.wxss b/subpages/heart/pages/groupBuyPublish/groupBuyPublish.wxss index 1ebfacb..d0bcac5 100644 --- a/subpages/heart/pages/groupBuyPublish/groupBuyPublish.wxss +++ b/subpages/heart/pages/groupBuyPublish/groupBuyPublish.wxss @@ -41,6 +41,36 @@ page { color: #333333; margin-bottom: 28rpx; } +.content .apply-item .price-item { + display: flex; + margin-bottom: 20rpx; +} +.content .apply-item .price-item input { + width: 110rpx; + height: 44rpx; + line-height: 44rpx; + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 500; + color: #666666; + text-align: center; + border-bottom: 1px solid #BFBFBF; +} +.content .apply-item .price-item .add { + height: 42rpx; + width: 42rpx; + margin-left: 20rpx; +} +.content .apply-item .price-item .add image { + width: 100%; + height: 100%; +} +.content .apply-item .price-item .tip { + font-size: 32rpx; + font-family: PingFang SC; + font-weight: 500; + color: #333333; +} .content .apply-item .item-content, .select-time { width: 100%; height: 44rpx; @@ -53,7 +83,7 @@ page { .content .apply-item .text-content { font-weight: 400; height: 280rpx; - margin-bottom: 80rpx; + margin-bottom: 20rpx; } .text-length { position: absolute; @@ -110,4 +140,39 @@ page { height: 26rpx; opacity: 0.76; margin-right: 20rpx; +} + +.image-list { + width: 100%; + display: grid; + grid-template-columns: 214rpx 214rpx 214rpx; + grid-template-rows: 214rpx; + grid-gap: 17rpx; + height: 214rpx; + margin-bottom: 40rpx; +} +.image-list .image-item { + width: 100%; + height: 100%; + position: relative; +} +.image-list image { + width: 100%; + height: 100%; + object-fit: cover; + border-radius: 8rpx; +} +.image-list .image-item .loading { + position: absolute; + left: 25%; + top: 25%; + width: 50%; + height: 50%; +} +.image-list .image-item .close { + position: absolute; + top: -10rpx; + right: -10rpx; + width: 40rpx; + height: 40rpx; } \ No newline at end of file diff --git a/subpages/heart/pages/volunteer/volunteer.js b/subpages/heart/pages/volunteer/volunteer.js index dd5fe9c..e0cb081 100644 --- a/subpages/heart/pages/volunteer/volunteer.js +++ b/subpages/heart/pages/volunteer/volunteer.js @@ -256,10 +256,10 @@ Page({ this.showToast("请输入昵称") return false } - if(!this.data.volunteerSignature){ - this.showToast("请输入格言") - return false - } + // if(!this.data.volunteerSignature){ + // this.showToast("请输入格言") + // return false + // } if (!this.data.road) { this.showToast("请填写所在小区或所在道路") return false diff --git a/subpages/heart/utils/api.js b/subpages/heart/utils/api.js index 1913e5a..5c3e425 100644 --- a/subpages/heart/utils/api.js +++ b/subpages/heart/utils/api.js @@ -12,6 +12,14 @@ module.exports = { groupBuyCall, getImgUrl, getVolunteerVerify, + getMyGroupBuyJoin, + getMyGroupBuyPublish, + getEvaluationList, + evaluation, + updateStatus, + getGroupBuySignUpList, + tradeConfirmation, + signUpOrCancel, } //顺道捎-首页列表 @@ -44,9 +52,8 @@ function sdsCall (id) { } //拼团购-首页列表 -function getGroupBuyList ({ isMe, pageIndex, pageSize }) { +function getGroupBuyList ({ pageIndex, pageSize }) { return fly.get("custom/groupBuy/getGroupBuyList", { - isMe, pageIndex, pageSize }) @@ -80,4 +87,57 @@ function getImgUrl (imgType) { // 获取志愿者认证标志 function getVolunteerVerify () { return fly.get(`app-user/user/volunteerVerify`) +} + + +//拼团购-我的参与 +function getMyGroupBuyJoin ({ pageIndex, pageSize }) { + return fly.get("custom/groupBuy/getMyGroupBuyJoin", { + pageIndex, + pageSize + }) +} + +//拼团购-我的发布 +function getMyGroupBuyPublish ({ pageIndex, pageSize }) { + return fly.get("custom/groupBuy/getMyGroupBuyPublish", { + pageIndex, + pageSize + }) +} + +//拼团购-评价列表 +function getEvaluationList ({ groupBuyId, pageIndex, pageSize }) { + return fly.get("custom/groupBuy/getEvaluationList", { + groupBuyId, + pageIndex, + pageSize + }) +} +//拼团购-评价 +function evaluation (para) { + return fly.post("custom/groupBuy/evaluation", para) +} +//拼团购-我的发布取消/结束 +function updateStatus (para) { + return fly.post("custom/groupBuy/updateStatus", para) +} + +//拼团购-交易确认列表 +function getGroupBuySignUpList ({ id, pageIndex, pageSize }) { + return fly.get("custom/groupBuy/getGroupBuySignUpList", { + id, + pageIndex, + pageSize + }) +} + +//拼团购-交易确认 +function tradeConfirmation (para) { + return fly.post("custom/groupBuy/tradeConfirmation", para) +} + +//拼团购-报名/取消报名 +function signUpOrCancel (para) { + return fly.post("custom/groupBuy/signUpOrCancel", para) } \ No newline at end of file