After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 5.1 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 12 KiB |
@ -0,0 +1,346 @@ |
|||
import { $wuxActionSheet } from "../../../../dist/index" |
|||
import { evaluation } from "../../utils/api" |
|||
// const QQMapWX = require("../../utils/qqmap-wx-jssdk")
|
|||
const config = require("../../../../utils/config") |
|||
|
|||
Page({ |
|||
data: { |
|||
evaluateValue: "", |
|||
imageList: [], |
|||
imageId: 1, |
|||
// qqmapsdk: "",
|
|||
// addressValue: "",
|
|||
// location: {
|
|||
// latitude: "",
|
|||
// longitude: ""
|
|||
// },
|
|||
groupBuyId: "", |
|||
violationsCount: 0, |
|||
isConReview: false, |
|||
lock: false, //锁定发布按钮状态,防止连击
|
|||
dialogVisible: false, //提示框
|
|||
dialogTitle: '', //提示内容
|
|||
}, |
|||
onShow () { |
|||
|
|||
}, |
|||
onLoad (options) { |
|||
// const qqmapsdk = new QQMapWX({
|
|||
// key: "CMJBZ-4DECI-JXGGN-5B4WU-QLV2H-B5BEJ"
|
|||
// })
|
|||
// this.setData({
|
|||
// qqmapsdk,
|
|||
// partyGroupId: options.partyGroupId,
|
|||
// })
|
|||
// this.getLocation()
|
|||
this.setData({ |
|||
groupBuyId: options.id |
|||
}) |
|||
}, |
|||
// 话题内容框 值双向绑定
|
|||
bindTopicValue (e) { |
|||
this.setData({ |
|||
evaluateValue: e.detail.value |
|||
}) |
|||
console.log(this.data.evaluateValue) |
|||
}, |
|||
// 地址框 值双向绑定
|
|||
bindAddressValue (e) { |
|||
this.setData({ |
|||
addressValue: e.detail.value |
|||
}) |
|||
console.log(this.data.addressValue) |
|||
}, |
|||
// 选择图片
|
|||
chooseImage () { |
|||
const that = this |
|||
$wuxActionSheet().showSheet({ |
|||
buttons: [{ |
|||
text: "拍照" |
|||
}, |
|||
{ |
|||
text: "从相册中获取" |
|||
}, |
|||
], |
|||
buttonClicked (index) { |
|||
if (index === 0) { |
|||
wx.chooseImage({ |
|||
count: 1, |
|||
sizeType: ["original", "compressed"], |
|||
sourceType: ["camera"], |
|||
success (res) { |
|||
const imageList = [...that.data.imageList] |
|||
imageList.push({ |
|||
img: res.tempFilePaths[0], |
|||
upload: true, |
|||
id: that.data.imageId++, |
|||
ossUrl: "" |
|||
}) |
|||
that.setData({ |
|||
imageList |
|||
}) |
|||
wx.uploadFile({ |
|||
url: config.BASEURL() + "group/topic/upload", |
|||
filePath: res.tempFilePaths[0], |
|||
name: "file", |
|||
header: { |
|||
"Content-Type": "multipart/form-data" |
|||
}, |
|||
success (fileres) { |
|||
const data = JSON.parse(fileres.data) |
|||
if (data.code === 0 && data.msg === "success") { |
|||
imageList[imageList.length - 1].ossUrl = data.data |
|||
imageList[imageList.length - 1].upload = false |
|||
} else { |
|||
imageList.pop() |
|||
wx.showToast({ |
|||
title: "上传图片失败,请重试", |
|||
icon: "none", |
|||
duration: 2000 |
|||
}) |
|||
} |
|||
that.setData({ |
|||
imageList |
|||
}) |
|||
}, |
|||
fail (err) { |
|||
console.log(err) |
|||
imageList.pop() |
|||
wx.showToast({ |
|||
title: "上传图片失败,请重试", |
|||
icon: "none", |
|||
duration: 2000 |
|||
}) |
|||
that.setData({ |
|||
imageList |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
} else if (index === 1) { |
|||
wx.chooseImage({ |
|||
count: 3 - that.data.imageList.length, |
|||
sizeType: ["original", "compressed"], |
|||
sourceType: ["album"], |
|||
success (res) { |
|||
let imageList = [] |
|||
res.tempFilePaths.forEach(item => { |
|||
imageList.push({ |
|||
img: item, |
|||
upload: true, |
|||
id: that.data.imageId++, |
|||
ossUrl: "" |
|||
}) |
|||
}) |
|||
that.setData({ |
|||
imageList: [...that.data.imageList, ...imageList] |
|||
}) |
|||
imageList.forEach((item, index) => { |
|||
(function (index) { |
|||
wx.uploadFile({ |
|||
url: `${config.BASEURL()}group/topic/upload`, |
|||
filePath: imageList[index].img, |
|||
name: "file", |
|||
header: { |
|||
"Content-Type": "multipart/form-data" |
|||
}, |
|||
success (fileRes) { |
|||
const data = JSON.parse(fileRes.data) |
|||
if (data.code === 0 && data.msg === "success") { |
|||
imageList[index].ossUrl = data.data |
|||
imageList[index].upload = false |
|||
|
|||
} else { |
|||
imageList.splice(index, 1) |
|||
wx.showToast({ |
|||
title: "上传图片失败,请重试", |
|||
icon: "none", |
|||
duration: 2000 |
|||
}) |
|||
} |
|||
that.data.imageList = that.data.imageList.slice(0, that.data.imageList.length - res.tempFilePaths.length) |
|||
that.setData({ |
|||
imageList: [...that.data.imageList, ...imageList] |
|||
}) |
|||
}, |
|||
fail (err) { |
|||
console.log(err) |
|||
imageList.splice(index, 1) |
|||
wx.showToast({ |
|||
title: "上传图片失败,请重试", |
|||
icon: "none", |
|||
duration: 2000 |
|||
}) |
|||
that.data.imageList = that.data.imageList.slice(0, that.data.imageList.length - res.tempFilePaths.length) |
|||
that.setData({ |
|||
imageList: [...that.data.imageList, ...imageList] |
|||
}) |
|||
} |
|||
}) |
|||
})(index) |
|||
}) |
|||
} |
|||
}) |
|||
} |
|||
return true |
|||
}, |
|||
cancelText: "取消", |
|||
cancel () {}, |
|||
destructiveButtonClicked () {}, |
|||
}) |
|||
}, |
|||
// 获取经纬度
|
|||
getLocation () { |
|||
wx.getLocation({ |
|||
type: "gcj02", |
|||
success: (res) => { |
|||
console.log("经纬度", res) |
|||
this.reverseGeocoder(res) |
|||
this.setData({ |
|||
location: { |
|||
latitude: res.latitude, |
|||
longitude: res.longitude |
|||
} |
|||
}) |
|||
} |
|||
}) |
|||
}, |
|||
// 逆地址解析
|
|||
reverseGeocoder ({latitude, longitude}) { |
|||
this.data.qqmapsdk.reverseGeocoder({ |
|||
location: { |
|||
latitude, |
|||
longitude |
|||
}, |
|||
success: (res) => { |
|||
console.log("逆地址解析", res) |
|||
if (res.message === "query ok") { |
|||
this.setData({ |
|||
addressValue: res.result.address |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
|
|||
// 提交评价
|
|||
addEvaluate () { |
|||
this.data.evaluateValue = this.data.evaluateValue.trim() |
|||
if (this.data.evaluateValue == "") { |
|||
wx.showToast({ |
|||
title: "请输入评价内容", |
|||
icon: "none", |
|||
duration: 2000 |
|||
}) |
|||
return false |
|||
} else if (this.data.evaluateValue.length > 50) { |
|||
wx.showToast({ |
|||
title: "超出50字数限制", |
|||
icon: "none", |
|||
duration: 2000 |
|||
}) |
|||
return false |
|||
// } else if (this.data.addressValue === "") {
|
|||
// wx.showToast({
|
|||
// title: "请输入-地址",
|
|||
// icon: "none",
|
|||
// duration: 2000
|
|||
// })
|
|||
// return false
|
|||
} |
|||
const imagesList = [] |
|||
if (this.data.imageList.length > 0) { |
|||
const isUploadingStatus = this.data.imageList.some(item => item.upload) |
|||
if (isUploadingStatus) { |
|||
wx.showToast({ |
|||
title: "请等待图片上传完成", |
|||
icon: "none", |
|||
duration: 2000 |
|||
}) |
|||
return false |
|||
} |
|||
this.data.imageList.forEach(item => { |
|||
imagesList.push(item.ossUrl) |
|||
}) |
|||
} |
|||
const para = { |
|||
groupBuyId: this.data.groupBuyId, |
|||
evaluationContent: this.data.evaluateValue, |
|||
evaluationImg: imagesList, |
|||
// isConReview: this.data.isConReview
|
|||
} |
|||
this.setData({ |
|||
lock: true |
|||
}) |
|||
wx.showLoading({ |
|||
title: "加载中", |
|||
}) |
|||
let that = this |
|||
evaluation(para).then(res => { |
|||
wx.hideLoading() |
|||
this.setData({ |
|||
lock: false |
|||
}) |
|||
// console.log(res)
|
|||
if (res.code == 0) { |
|||
this.setData({ |
|||
dialogVisible: true, |
|||
dialogTitle: '评价成功', |
|||
violationsCount: 0, |
|||
isConReview: false |
|||
}) |
|||
} else if (res.code == 533) { |
|||
this.data.violationsCount++ |
|||
console.log(this.data.violationsCount) |
|||
if (this.data.violationsCount == 1){ |
|||
wx.showToast({ |
|||
title: res.msg, |
|||
icon: "none", |
|||
duration: 2000 |
|||
}) |
|||
} else if (this.data.violationsCount == 2) { |
|||
wx.showModal({ |
|||
title: '提示', |
|||
content: '您提交的内容再次被判定为违规,您确定是否要提交?', |
|||
success (res) { |
|||
if (res.confirm) { |
|||
console.log('用户点击确定') |
|||
that.data.isConReview = true |
|||
that.addEvaluate() |
|||
} else if (res.cancel) { |
|||
console.log('用户点击取消') |
|||
that.setData({ |
|||
violationsCount: 0, |
|||
isConReview: false |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
}).catch(err => { |
|||
console.log('err',err) |
|||
wx.hideLoading() |
|||
this.setData({ |
|||
lock: false |
|||
}) |
|||
}) |
|||
}, |
|||
// 删除图片
|
|||
deleteImage (e) { |
|||
const index = this.data.imageList.findIndex((item,index) => index === e.currentTarget.dataset.index) |
|||
this.data.imageList.splice(index, 1) |
|||
const imageList = this.data.imageList |
|||
this.setData({ |
|||
imageList |
|||
}) |
|||
}, |
|||
// 关闭弹框
|
|||
closeDialog () { |
|||
this.setData({ |
|||
dialogVisible: false |
|||
}) |
|||
wx.navigateBack() |
|||
}, |
|||
}) |
@ -0,0 +1,7 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"wux-actionsheet": "../../../../dist/actionsheet/index", |
|||
"notice": "../../components/notice/notice" |
|||
}, |
|||
"navigationBarTitleText": "评价" |
|||
} |
@ -0,0 +1,36 @@ |
|||
<view class="add-evaluate"> |
|||
<view class="evaluate"> |
|||
<textarea value="{{evaluateValue}}" bindinput="bindTopicValue" maxlength="51" placeholder="请输入评价内容...."> |
|||
<!-- <view wx:if="{{evaluateValue.length == 0}}" class="placeholder-textarea"> |
|||
<view>请输入...</view> |
|||
</view> --> |
|||
</textarea> |
|||
<view class="picture"> |
|||
<view class="image-box" wx:for="{{imageList}}" wx:key="index" wx:for-item="item" wx:for-index="index"> |
|||
<image src="{{item.img}}" /> |
|||
<image wx:if="{{item.upload}}" class="loading" src="../../images/loading.gif" /> |
|||
<image bindtap="deleteImage" data-index="{{index}}" wx:else class="delete-image" src="../../images/icon_close.png" /> |
|||
</view> |
|||
<view class="image-box"> |
|||
<image bindtap="chooseImage" wx:if="{{imageList.length <= 2}}" src="../../images/ig_tianjiatupian@2x.png" /> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<!-- <view class="address"> |
|||
<textarea value="{{addressValue}}" bindinput="bindAddressValue" placeholder-class="placeholder-textarea" placeholder="请输入定位地址" /> |
|||
<view class="tip"> |
|||
<image src="../../images/ic_dingwei@2x.png" /> |
|||
<text>定位</text> |
|||
</view> |
|||
</view> --> |
|||
<view class="evaluate-button"> |
|||
<button bindtap="addEvaluate" type="default" size="defaultSize" hover-class="hover-button" disabled="{{lock}}"> |
|||
<image src="../../images/submit-bk.png" /> |
|||
<text >提交评价</text> |
|||
</button> |
|||
</view> |
|||
</view> |
|||
|
|||
<wux-actionsheet id="wux-actionsheet" /> |
|||
|
|||
<notice bind:close="closeDialog" bind:confirm="closeDialog" dialogVisible="{{dialogVisible}}" title="{{dialogTitle}}" content="" confirmText="知道了"></notice> |
@ -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; |
|||
} |
@ -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<this.data._checklist.length; i++) { |
|||
if (this.data._checklist[i].id == this.data.confirmlist[index].id) { |
|||
this.data._checklist[i].signUpStatus = this.data.confirmlist[index].signUpStatus |
|||
return |
|||
} |
|||
} |
|||
|
|||
let check = { |
|||
id: this.data.confirmlist[index].id, |
|||
signUpStatus: this.data.confirmlist[index].signUpStatus |
|||
} |
|||
this.data._checklist.push(check) |
|||
console.log(this.data._checklist) |
|||
}, |
|||
changeAllCheck () { |
|||
this.data._checklist = [] |
|||
this.data.allChecked = !this.data.allChecked |
|||
|
|||
this.data.confirmlist.forEach(item => { |
|||
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 |
|||
}) |
|||
}, |
|||
}) |
@ -0,0 +1,8 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"notice": "../../components/notice/notice", |
|||
"load-more": "/components/loadMore/loadMore", |
|||
"no-data": "/components/nodata/nodata" |
|||
}, |
|||
"navigationBarTitleText": "报名列表" |
|||
} |
@ -0,0 +1,34 @@ |
|||
<!--subpages/heart/pages/groupBuyConfirmList/groupBuyConfirmList.wxml--> |
|||
<view class="groupbuy-confirm-list"> |
|||
<view class="top-title"> |
|||
<view >微信名</view> |
|||
<view >联系电话</view> |
|||
<view >是否完成交易</view> |
|||
</view> |
|||
<view class="confirm-list"> |
|||
<view class="confirm-item" wx:for="{{confirmlist}}" wx:key="index"> |
|||
<view class="username">{{item.nickname}}</view> |
|||
<view class="userphone">{{item.mobile}}</view> |
|||
<view class="checkbox" data-id="{{item.id}}" data-status="{{item.signUpStatus}}" data-index="{{index}}" bindtap="changeCheckValue"> |
|||
<image mode="aspectFill" src="../../images/{{item.signUpStatus == 0 ? 'checkbox' : 'checkbox-checked'}}.png" /> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<view class="bottom-menu"> |
|||
<view class="checkbox" bindtap="changeAllCheck"> |
|||
<image mode="aspectFill" src="../../images/{{allChecked ? 'checkbox-checked' : 'checkbox'}}.png" /> |
|||
<view class="check-text">{{allChecked ? '取消全选' : '全选'}}</view> |
|||
</view> |
|||
<view class="submit" bindtap="submitConfirm"> |
|||
<image class="submit-bk" src="../../images/btnbk0.png" /> |
|||
<view class="submit-text">提交</view> |
|||
</view> |
|||
</view> |
|||
|
|||
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more> |
|||
|
|||
<no-data isShow="{{nodata}}"></no-data> |
|||
|
|||
<notice bind:close="closeDialog" bind:confirm="closeDialog" dialogVisible="{{dialogVisible}}" title="{{dialogTitle}}" content="" confirmText="知道了"></notice> |
@ -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; |
|||
} |
@ -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 |
|||
} |
|||
} |
|||
}) |
@ -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" |
|||
} |
|||
} |
@ -0,0 +1,82 @@ |
|||
<!--subpages/heart/pages/groupBuyDetail/groupBuyDetail.wxml--> |
|||
<view class="notice-new"> |
|||
<view class="notice-detail"> |
|||
<view class="apply-item"> |
|||
<view class="item-title">{{details.groupBuyTitle}}</view> |
|||
<view class="item-content">{{details.groupBuyContent}}</view> |
|||
<view class="image-box" wx:if="{{details.groupBuyImg.length > 0}}"> |
|||
<image catchtap="previewImage" data-src="{{item}}" data-imgArry="{{details.groupBuyImg}}" src="{{item}}" mode="aspectFill" wx:for="{{details.groupBuyImg}}" wx:key="index" wx:for-index="index" wx:for-item="item"/> |
|||
</view> |
|||
</view> |
|||
<view class="apply-item"> |
|||
<view class="item-title">联系电话</view> |
|||
<view class="item-content item-mobile"> |
|||
<view >{{details.groupBuyMobile}}</view> |
|||
<view class="call-img" bindtap="callNumber"><image src="../../images/call.png" /></view> |
|||
</view> |
|||
</view> |
|||
<view class="apply-item"> |
|||
<view class="item-title">价格</view> |
|||
<view class="item-content"> |
|||
<block wx:for="{{details.groupBuyPriceNumber}}" wx:key="index"> |
|||
<view class="item-price">人数达到{{item.groupBuyNumber}}人团购价格为{{item.groupBuyPrice}}元/件</view> |
|||
</block> |
|||
</view> |
|||
</view> |
|||
<view class="apply-item"> |
|||
<view class="item-title">报名人数</view> |
|||
<view class="item-content item-mobile"> |
|||
<view>{{details.groupBuyNumber}}</view> |
|||
<view class="call-img" data-status="{{details.signUpStatus}}" data-groupbuystatus="{{details.groupBuyStatus}}" bindtap="signupCall" wx:if="{{!detailType}}"> |
|||
<block wx:if="{{details.groupBuyStatus == 0}}"> |
|||
<image src="../../images/{{details.signUpStatus == 0 ? 'signup' : (details.signUpStatus == 1 ? 'unsignup' : 'signed2')}}.png"/> |
|||
</block> |
|||
<block wx:else> |
|||
<image src="../../images/signed2.png" wx:if="{{details.signUpStatus != 0}}"/> |
|||
</block> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="apply-item" wx:if="{{details.cancelReason}}"> |
|||
<view class="item-title">取消原因</view> |
|||
<view class="item-content"> |
|||
{{details.cancelReason}} |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="submit" bindtap="submit" wx:if="{{detailType}}"> |
|||
<image class="submit-bk" src="../../images/submit-bk.png" /> |
|||
<view class="submit-text">结束团购</view> |
|||
</view> |
|||
<!-- 评价 --> |
|||
<block wx:else> |
|||
<view class="evaluate-list" wx:if="{{evaluateList.length > 0}}"> |
|||
<view class="evaluate-title">评价</view> |
|||
<block wx:for="{{evaluateList}}" wx:key="index"> |
|||
<view class="evaluate"> |
|||
<view class="userbox"> |
|||
<image class="headlogo" src="{{item.faceImg || 'https://epdc-shibei.elinkservice.cn/epdcFile/M00/00/00/CgUipV3wgl6Afm4cAAAa8QfEb00266_big.png'}}" /> |
|||
<view class="userinfo"> |
|||
<view class="nickname">{{item.nickname}}</view> |
|||
<view class="time">{{item.evaluationTime}}</view> |
|||
</view> |
|||
</view> |
|||
<view class="evaluate-content">{{item.evaluationContent}}</view> |
|||
<view class="evaluate-image" wx:if="{{item.evaluationContent.length > 0}}"> |
|||
<image wx:for="{{item.evaluationImg}}" wx:key="imgIndex" wx:for-item="imgItem" src="{{imgItem}}" catchtap="previewImage" data-src="{{imgItem}}" data-imgArry="{{item.evaluationImg}}" mode="aspectFill"/> |
|||
</view> |
|||
</view> |
|||
<view class="evaluate-line" wx:if="{{index < evaluateList.length-1}}"></view> |
|||
</block> |
|||
</view> |
|||
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more> |
|||
<!-- <no-data isShow="{{nodata}}"></no-data> --> |
|||
</block> |
|||
</view> |
|||
|
|||
<completeInfo-dialog |
|||
completeInfoDialogVisible="{{completeInfoDialogVisible}}"> |
|||
</completeInfo-dialog> |
|||
|
|||
<notice bind:close="closeDialog" bind:confirm="closeDialog" dialogVisible="{{dialogVisible}}" title="{{dialogTitle}}" content="" confirmText="知道了"></notice> |
|||
|
@ -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 */ |
@ -0,0 +1,300 @@ |
|||
// subpages/heart/pages/groupBuyListMy/groupBuyListMy.js
|
|||
const api = require("../../utils/api") |
|||
|
|||
Page({ |
|||
|
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
pageIndex: 1, |
|||
pageSize: 10, |
|||
nodata: false, |
|||
loadMoreType: 'none', |
|||
loadMoreVisible: false, |
|||
groupbuylist: [], |
|||
selectedTab: "tab0", |
|||
dialogVisible: false, |
|||
dialogTitle: "", |
|||
dialogContent: "", |
|||
dialogConfirmText: "", |
|||
dialogCancelText: "", |
|||
noticeType: 3, //noticeNew 类型 3-我的参与 4-我的发布
|
|||
cancelSignupVisible: false, |
|||
cancelSignupTipValue: "", |
|||
cancelSignupTipVisible: false, |
|||
selectNoticeId: '', //当前选中id 取消
|
|||
noticeVisible: false, //提示框
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
// this.getMyGroupBuyPublish()
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
onReady: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面显示 |
|||
*/ |
|||
onShow: function () { |
|||
this.setData({ |
|||
pageIndex: 1, |
|||
groupbuylist: [] |
|||
}) |
|||
this.getMyGroupBuyList() |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
onHide: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面卸载 |
|||
*/ |
|||
onUnload: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 页面相关事件处理函数--监听用户下拉动作 |
|||
*/ |
|||
onPullDownRefresh: function () { |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* 用户点击右上角分享 |
|||
*/ |
|||
// onShareAppMessage: function () {
|
|||
|
|||
// }
|
|||
|
|||
/** |
|||
* 页面上拉触底事件的处理函数 |
|||
*/ |
|||
onReachBottom: function () { |
|||
this.setData({ |
|||
loadMoreVisible: true |
|||
}) |
|||
if (this.data.loadMoreType === "loading") { |
|||
this.setData({ |
|||
pageIndex: this.data.pageIndex + 1 |
|||
}) |
|||
this.getMyGroupBuyList() |
|||
} |
|||
}, |
|||
|
|||
// tab 切换
|
|||
tabBarChange (e) { |
|||
this.setData({ |
|||
loadMoreVisible: false, |
|||
loadMoreType: "none", |
|||
pageIndex: 1, |
|||
}) |
|||
if (e.currentTarget.dataset.tab == "tab0") { |
|||
this.setData({ |
|||
groupbuylist: [] |
|||
}) |
|||
this.getMyGroupBuyJoin() |
|||
} else if (e.currentTarget.dataset.tab == "tab1") { |
|||
this.setData({ |
|||
groupbuylist: [] |
|||
}) |
|||
this.getMyGroupBuyPublish() |
|||
} |
|||
this.setData({ |
|||
selectedTab: e.currentTarget.dataset.tab |
|||
}) |
|||
}, |
|||
getMyGroupBuyList () { |
|||
if (this.data.selectedTab == "tab0") { |
|||
this.getMyGroupBuyJoin() |
|||
} else { |
|||
this.getMyGroupBuyPublish() |
|||
} |
|||
}, |
|||
getMyGroupBuyPublish () { |
|||
const para = { |
|||
pageIndex: this.data.pageIndex, |
|||
pageSize: this.data.pageSize |
|||
} |
|||
api.getMyGroupBuyPublish(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) |
|||
}) |
|||
}, |
|||
|
|||
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}` |
|||
}) |
|||
} |
|||
}) |
@ -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" |
|||
} |
|||
} |
@ -0,0 +1,67 @@ |
|||
<!--subpages/heart/pages/groupBuyListMy/groupBuyListMy.wxml--> |
|||
<view class="drop-by-list"> |
|||
<view class="tab-all"> |
|||
<view class="tab-bar"> |
|||
<view class="tab tab0 {{selectedTab === 'tab0' ? 'select' : ''}}" data-tab="tab0" bindtap="tabBarChange"> |
|||
我的参与 |
|||
</view> |
|||
<view class="tab tab1 {{selectedTab === 'tab1' ? 'select' : ''}}" data-tab="tab1" bindtap="tabBarChange"> |
|||
我的发布 |
|||
</view> |
|||
<view class="select-bar {{selectedTab}}"></view> |
|||
</view> |
|||
</view> |
|||
<view class="item-list"> |
|||
<block wx:if="{{selectedTab === 'tab0'}}"> |
|||
<view class="notice" wx:for="{{groupbuylist}}" wx:key="index" data-id="{{item.id}}" bindtap="toNoticeDetail"> |
|||
<view class="notice-left" wx:if="{{item.groupBuyImg.length > 0}}"> |
|||
<image src="{{item.groupBuyImg[0]}}" /> |
|||
</view> |
|||
<view class="notice-right"> |
|||
<view class="notice-title">{{item.groupBuyTitle}}</view> |
|||
<view class="notice-bottom"> |
|||
<view class="bottom-left"> |
|||
<view class="notice-tag tag-{{item.groupBuyStatus}}">{{item.groupBuyStatus == '0' ? '团购中' : item.groupBuyStatus == '5' ? '已结束' : '已取消'}}</view> |
|||
<view class="notice-time">{{item.groupBuyPublishTime}}</view> |
|||
</view> |
|||
<view class="evaluate" wx:if="{{item.isEvaluation == '0'}}" data-id="{{item.id}}" catchtap="toEvaluate">评价</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</block> |
|||
<block wx:else> |
|||
<view class="notice" wx:for="{{groupbuylist}}" wx:key="index"> |
|||
<view class="notice-right"> |
|||
<view class="notice-title">{{item.groupBuyTitle}}</view> |
|||
<view class="notice-bottom"> |
|||
<view class="notice-options"> |
|||
<view class="notice-btn" data-id="{{item.id}}" catchtap="toNoticeDetail">查看</view> |
|||
<view class="notice-line"></view> |
|||
<view class="notice-btn {{item.isEdit == 0 ? 'notice-btn-disabled': ''}}" data-id="{{item.id}}" data-edit="{{item.isEdit}}" catchtap="toModify">修改</view> |
|||
<view class="notice-line"></view> |
|||
<view class="notice-btn {{item.groupBuyStatus != 0 ? 'notice-btn-disabled' : ''}}" data-id="{{item.id}}" data-status="{{item.groupBuyStatus}}" catchtap="toCancel">{{item.groupBuyStatus == 10 ? '已取消' : '取消'}}</view> |
|||
<view class="notice-line"></view> |
|||
<view class="notice-btn {{item.groupBuyStatus != 0 ? 'notice-btn-disabled' : ''}}" data-id="{{item.id}}" data-status="{{item.groupBuyStatus}}" catchtap="toFinish">{{item.groupBuyStatus == 5 ? '已结束' : '结束'}}</view> |
|||
<view class="notice-line"></view> |
|||
<view class="notice-btn {{item.groupBuyStatus == 10 ? 'notice-btn-disabled' : ''}}" data-id="{{item.id}}" data-status="{{item.groupBuyStatus}}" catchtap="toConfirm">确认交易</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</block> |
|||
</view> |
|||
</view> |
|||
|
|||
<cancel-signup-dialog title="取消原因" cancelText="取消" confirmText="确定" tipVisible="{{cancelSignupTipVisible}}" |
|||
tipValue="{{cancelSignupTipValue}}" bind:confirm="cancelSignupCallback" cancelSignupVisible="{{cancelSignupVisible}}"> |
|||
</cancel-signup-dialog> |
|||
|
|||
<notice bind:close="closeDialog" bind:confirm="closeDialog" dialogVisible="{{noticeVisible}}" title="取消成功" content="" confirmText="知道了"></notice> |
|||
|
|||
<coverview-dialog bind:confirm="confirmDialog" dialogVisible="{{dialogVisible}}" title="{{dialogTitle}}" |
|||
content="{{dialogContent}}" confirmText="{{dialogConfirmText}}" cancelText="{{dialogCancelText}}"> |
|||
</coverview-dialog> |
|||
|
|||
<load-more loadMoreType="{{loadMoreType}}" loadMoreVisible="{{loadMoreVisible}}"></load-more> |
|||
|
|||
<no-data isShow="{{nodata}}"></no-data> |
@ -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 */ |