浏览代码

[我的活动][修改]:[增加我的活动列表以及详情]

tags/C.7.1.0
meo 6 年前
父节点
当前提交
2b75eba33d
共有 12 个文件被更改,包括 658 次插入60 次删除
  1. +1
    -0
      app.json
  2. +4
    -1
      config/config.js
  3. +9
    -1
      pages/radetail/index.js
  4. +10
    -0
      pages/radetail/index.wxss
  5. +111
    -50
      pages/radetail/joinActivity/edit.js
  6. +6
    -0
      pages/radetail/joinActivity/edit.wxml
  7. +29
    -0
      pages/radetail/joinActivity/edit.wxss
  8. +1
    -8
      pages/user/index.wxml
  9. +168
    -0
      pages/user/myactivity/index.js
  10. +7
    -0
      pages/user/myactivity/index.json
  11. +29
    -0
      pages/user/myactivity/index.wxml
  12. +283
    -0
      pages/user/myactivity/index.wxss

+ 1
- 0
app.json 查看文件

@@ -29,6 +29,7 @@
"pages/phoneinput/phoneinput",
"pages/market/index",
"pages/user/index",
"pages/user/myactivity/index",
"pages/coupon/detail/index",
"pages/rushToBuy/index",
"pages/couponorder/index/index",


+ 4
- 1
config/config.js 查看文件

@@ -301,7 +301,10 @@ var config = {
acfindById:"/wxActivity/findById",
acPrintHtmlById:"/wxActivity/printHtmlById",
//参与活动
activityJoin:"/wxActivityJoin/join"
activityJoin:"/wxActivityJoin/join",
//签到
activitySign:"/wxActivityJoin/sign",
activityList: "/wxActivityJoin/list"
},
weapp: {
AppId: weappId


+ 9
- 1
pages/radetail/index.js 查看文件

@@ -4,12 +4,15 @@ const Http = require("../../utils/HttpBasics");
const util = require("../../utils/util");
var WxParse = require('../../wxParse/wxParse.js');
const imgurl = require("../../utils/imgurl");
const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
let configUrls = extConfig.attr.configUrl;
Page({
data: {
data: {},
status:1,
couponId: null,
orderId: "",
question:[],
day: "",
hour: "",
activityId:"",
@@ -33,9 +36,14 @@ Page({
that.setData({
data: res.data.activity
})
if (res.data && res.data.activity && res.data.activity.question){
that.setData({
question: JSON.parse(res.data.activity.question)
})
}
if (res.data.activity.type == 2) {
wx.request({
url: 'https://ciformall.youlane.cn/C/api' + config.api.acPrintHtmlById,
url: configUrls + config.api.acPrintHtmlById,
data: {
id: options.id,
date: new Date(),


+ 10
- 0
pages/radetail/index.wxss 查看文件

@@ -1140,4 +1140,14 @@ button::after{ border: none; }
.time{
font-size: 30rpx;
line-height: 50rpx;
}
.ques{
display: block;
text-align: center;
}
.questionTitle{
width: 180rpx;
font-size: 40rpx;
border-top:6rpx solid orange;
margin: 20rpx auto 0;
}

+ 111
- 50
pages/radetail/joinActivity/edit.js 查看文件

@@ -8,22 +8,30 @@ Page({
data: {
date: '1988-03-12',
flag: 1,
answerflag: "",
flagsex: 0,
items: [
{ name: 1, value: '男', checked: false },
{ name: 2, value: '女', checked: false },
items: [{
name: 1,
value: '男',
checked: false
},
{
name: 2,
value: '女',
checked: false
},
],
username: "",
array: ['上班族', '学生', '企业高管', '个体户', '自由职业', '其他'],
array1: ['附近住户', '距离2km', '距离3km', '更远'],
index: 0,
index1: 0,
showPage:false
showPage: false
},
/**
* 获得生日
*/
bindDateChange: function (e) {
bindDateChange: function(e) {
this.setData({
date: e.detail.value,
flag: 2
@@ -32,7 +40,7 @@ Page({
/**
* 职业
*/
bindPickerChange: function (e) {
bindPickerChange: function(e) {
this.setData({
index: e.detail.value
})
@@ -40,29 +48,32 @@ Page({
/**
* 生活半径
*/
bindPickerChange1: function (e) {
bindPickerChange1: function(e) {
this.setData({
index1: e.detail.value
})
},
address: function () {
address: function() {
let that = this;
wx.chooseLocation({
success: function (res) {
success: function(res) {
that.setData({
address: res.name + '(' + res.address + ')',
addressStr: JSON.stringify(res)
})
},
fail: function (error) {
fail: function(error) {
console.log(error)
},
complete: function (data) {
}
complete: function(data) {}
})
},
formSubmit: function (e) {
change(value){
console.log(value)
},
formSubmit: function(e) {
let that = this;
console.log(e)
/**
* sex
* 0 保密
@@ -76,17 +87,14 @@ Page({
}
if (that.data.addressStr) {
var address = that.data.addressStr;
}
else {
} else {
var address = null;
}
if (e.detail.value.username) {
var username = e.detail.value.username;
}
else if (that.data.username) {
} else if (that.data.username) {
var username = that.data.username;
}
else {
} else {
var username = null;
}
if (that.data.flag == 2 && that.data.date) {
@@ -94,44 +102,72 @@ Page({
} else {
var birthday = null;
}

//获得答案
delete e.detail.value.username;
let obj = e.detail.value;
if (that.data&&that.data.question&&that.data.question.length>0){
let valArr22;
valArr22 = Object.keys(obj).map(function (item,index) {
if (!obj[item]){
wx.showToast({
title: '问卷调查回答不完整,请补充',
duration:2000,
icon:"none"
})
that.setData({
answerflag:"noanswer"
})
}else{
that.setData({
answerflag: "answer"
})
return { ques: that.data.question[index].ques, answer: obj[item] }
}
});
this.setData({
answer:valArr22
});
}

if (username == null || address == null || sex == 0 || birthday == null) {
wx.showToast({
title: '请输入完整的用户信息',
icon:"none"
icon: "none"
})
} else {
Http.post({
url: config.api.activityJoin,
data: {
sex: sex,
address: address,
name: username,
birthday: birthday,
activityId: that.data.activityId
}
})
.then(res => {
wx.showToast({
title: "提交成功",
icon: 'none',
duration: 2000,
mask: false
console.log(that.data.answer)
if (this.data.answerflag == 'noanswer'){

}else{
Http.post({
url: config.api.activityJoin,
data: {
sex: sex,
address: address,
name: username,
birthday: birthday,
answer: JSON.stringify(that.data.answer),
activityId: that.data.activityId
}
})
wx.navigateTo({
url: '/pages/radetail/success/index',
.then(res => {
wx.redirectTo({
url: '/pages/radetail/success/index',
})
})
.catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
})
})
})
.catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
})
})
}
}
},
radioChange: function (e) {
radioChange: function(e) {
this.setData({
sex: e.detail.value,
flagsex: 1
@@ -140,12 +176,37 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
onLoad: function(options) {
let that = this;
if (options && options.activityId){
if (options && options.activityId) {
that.setData({
activityId: options.activityId
})
that.getDetail(options.activityId);
}
},
getDetail(activityId) {
let that = this;
Http.get({
url: config.api.acfindById,
data: {
id: activityId
}
}).then(res => {
if (res && res.data && res.data.activity) {
if (res.data && res.data.activity && res.data.activity.question) {
that.setData({
question: JSON.parse(res.data.activity.question)
})
}
}
}).catch(err => {
wx.showToast({
title: err.errMsg,
icon: 'none',
duration: 2000,
mask: false
})
})
}
})

+ 6
- 0
pages/radetail/joinActivity/edit.wxml 查看文件

@@ -24,5 +24,11 @@
<view class='names' wx:if="{{address}}">{{address}}</view>
<view class='names' wx:if="{{!address}}">请选择地址</view>
</view>
<view class='ques' wx:if="{{question&&question.length>0}}">
<text class='questionTitle'>调查问卷</text>
<view class='answer' wx:for="{{question}}" wx:key="index">{{index+1}}.{{item.ques}}
<textarea name="answer{{index}}" bindinput='change' type="textarea" placeholder='请填写您的回答?'></textarea>
</view>
</view>
<button class='btn' formType="submit" hover-class='active'>提交</button>
</form>

+ 29
- 0
pages/radetail/joinActivity/edit.wxss 查看文件

@@ -64,6 +64,7 @@ radio {
border-radius:60rpx;
background: orange;
font-size: 32rpx;
z-index: 1000;
}
.active{
opacity: .6;
@@ -84,4 +85,32 @@ radio {
font-size: 26rpx;
line-height: 46rpx;
color: #999;
}
.ques{
padding-left: 20rpx;
margin-bottom:140rpx;
}
.ques text{
display: block;
text-align: center;
}
.questionTitle{
width: 180rpx;
font-size: 40rpx;
border-top:6rpx solid orange;
border-bottom:6rpx solid orange;
margin: 40rpx auto 0;
}
.ques text{
display: block;
}
.answer{
margin-bottom: 20rpx;
}
.answer textarea{
border: 1rpx solid #efefef;
border-radius: 10rpx;
padding: 10rpx 0;
margin-top: 10rpx;
padding-left: 10rpx;
}

+ 1
- 8
pages/user/index.wxml 查看文件

@@ -78,19 +78,12 @@
<image class='icons' src="{{wmspellgroup}}" mode='widthFix'></image>我的拼团</view>
</view>
</navigator>
<navigator url="/pages/spellGroup/spellGroup?from=myhtml" open-type="navigate">
<navigator url="/pages/user/myactivity/index" open-type="navigate">
<view class="user-btn app-border-bottom">
<view>
<image class='icons' src="{{myactivity}}" mode='widthFix'></image>我的活动</view>
</view>
</navigator>
<navigator open-type="navigate">
<view class="user-btn app-border-bottom">
<view>
<image class='icons' src="{{myactivitygift}}" mode='widthFix'></image>我的奖品
</view>
</view>
</navigator>
</view>
</view>
<view class="margin"></view>


+ 168
- 0
pages/user/myactivity/index.js 查看文件

@@ -0,0 +1,168 @@
let config = require("../../../config/config.js");
let Http = require("../../../utils/HttpBasics");
const util = require("../../../utils/util");
let app = getApp();
const imgurl = require("../../../utils/imgurl");
Page({
data: {
dingdanUrl: imgurl.dingdan.url,
loadingUrl: imgurl.loading.url,
wmhome: imgurl.wmhome.url,
wmdiscount: imgurl.wmdiscount.url,
wmgive: imgurl.wmgive.url,
tabs: [
{
key: 0,
name: "参与中"
},
{
key: 1,
name: "已过期"
}
],
list: [],
current: "",
loading: true, //"上拉加载"的变量,默认false,隐藏
current_scroll: "0",
allow_load: true,
page: 1,
content: "",
},
goback: function () {
wx.switchTab({
url: '/pages/main/index',
})
},
onLoad(options) {
this.getList(0, 1);
this.setData({
current_scroll: 0
});
},
//活动详情
gotoDetail:function(e){
wx.navigateTo({
url: `/pages/radetail/index?id=${e.currentTarget.dataset.id}`
})
},
gotopay: function (e) {
wx.navigateTo({
url: `/pages/order/detail/index?orderId=${e.currentTarget.dataset.id}&flag='pay'`
})
},
getList(key, pageNum) {
let that = this;
let variable;
if(key == 0){
variable = {
pageNum: pageNum,
pageSize: 15,
statusStr:"0,1,2"
};
}else if(key == 1){
variable = {
pageNum: pageNum,
pageSize: 15,
status: 3
};
}
if (that.data.allow_load) {
that.setData({
loading: true,
content: '小主,我在玩命加载中...'
})

Http.get({
url: config.api.activityList,
data: variable
}).then(res => {
if (pageNum >= res.data.pages) {
that.setData({
allow_load: false
});
setTimeout(function () {
that.setData({
loading: false,
})
}, 1400);
}
setTimeout(function () {
that.setData({
loading: false,
})
}, 1400);
if (pageNum == 1) {
that.setData({
list: []
})
}
var tmpArr = that.data.list;
tmpArr.push.apply(tmpArr, res.data.list);
// 将砍价的状态过滤出来
console.log(tmpArr)
that.setData({
list: tmpArr
})
for (let i = 0; i < that.data.list.length; i++) {
var activityStartTime1 = util.formatTime(that.data.list[i].activityStartTime, "yyyy-MM-dd hh:mm:ss");
var activityEndTime1 = util.formatTime(that.data.list[i].activityEndTime, "yyyy-MM-dd hh:mm:ss");
/**
* 修改list的endtime
* 渲染到页面
*/
var activityStartTime = 'list[' + i + '].activityStartTime'
var activityEndTime = 'list[' + i + '].activityEndTime'
that.setData({
[activityStartTime]: activityStartTime1,
[activityEndTime]: activityEndTime1,
});
}
})
.catch(err => {
wx.showToast({
title: err.errMsg,
icon:"none",
duration:2000
})
})
}
else {
that.setData({
loading: true,
content: "——— 再拉裤子就掉了啦 ———"
})
setTimeout(function () {
that.setData({
loading: false,
})
}, 1400)
}
},
handleChange({
detail
}) {
this.setData({
current: detail.key
});
},
handleChangeScroll({
detail
}) {
this.setData({
list: [],
allow_load: true,
current_scroll: detail.key,
page: 1
})
this.getList(detail.key, 1);
},
onReachBottom: function () {
var that = this;
that.data.page++;
that.setData({
page: that.data.page
});
that.getList(that.data.current_scroll, that.data.page);
},
});

+ 7
- 0
pages/user/myactivity/index.json 查看文件

@@ -0,0 +1,7 @@
{
"usingComponents": {
"i-tab": "../../../dist/tab/index",
"i-tabs": "../../../dist/tabs/index"
},
"navigationBarTitleText": "我的活动"
}

+ 29
- 0
pages/user/myactivity/index.wxml 查看文件

@@ -0,0 +1,29 @@
<view class="market">
<i-tabs class='tabs' current="{{ current_scroll }}" scroll bindchange="handleChangeScroll">
<i-tab class='i-tab' wx:for="{{tabs}}" wx:key="unique" key="{{item.key}}" title="{{item.name}}"></i-tab>
</i-tabs>
<view style='padding-top:114rpx;'>
<view wx:for='{{list}}' wx:if="{{list.length!=0}}" class='section' wx:key='{{index}}'>
<view class='detail_msg' bindtap="gotoDetail" data-id='{{item.id}}'>
<view class='logo'>
<image src='{{item.coverImg}}'></image>
</view>
<view class='info'>
<view>{{item.title}}</view>
<view>
<text>活动开始日期:{{item.activityStartTime}}</text>
<text>活动结束日期:{{item.activityEndTime}}</text>
</view>
</view>
</view>
</view>
<view class="dingdan" wx:if="{{list.length==0}}">
<image src="{{dingdanUrl}}" mode="widthFix"></image>
<text>您还没有参加活动</text>
<button class='goback' bindtap='goback'>返回首页</button>
</view>
</view>
<view class="loading" wx:if="{{loading}}">
<image src="{{loadingUrl}}" mode="widthFix"></image>{{content}}
</view>
</view>

+ 283
- 0
pages/user/myactivity/index.wxss 查看文件

@@ -0,0 +1,283 @@
.market {
width: 100%;
height: 100%;
}

.tabs {
position: fixed;
width: 100% !important;
height: 88rpx;
top: 0;
left: 0;
right: 0;
text-align: center;
z-index: 10000000;
}

.i-tab {
width: 30% !important;
display: inline-block;
}

.detail_msg {
position: relative;
background: #fff;
margin: 0 30rpx;
border-radius: 16rpx;
overflow: hidden;
}
.sendImg{
position: absolute;
width: 100rpx;
top: 100rpx;
right: 6rpx;
}

.logo {
display: block;
width: 100%;
border-radius: 16rpx;
}

.logo image {
display: block;
width: 100%;
height: 260rpx;
border-radius: 16rpx;
}
.section{
margin-bottom: 25rpx;
}
.info view:nth-child(1) {
font-size: 32rpx;
margin-top: 40rpx;
margin-bottom: 23rpx;
justify-content: space-between;
padding: 0 0 0 4%;
}
.info text,view{
font-size: 26rpx;
text-align: center;
display: block;
color: #efefef;
}
.info {
width: 100%;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
text-align: center;
color: #fff;
background: rgba(0, 0, 0, 0.5)
}

.sub {
font-size: 24rpx !important;
color: #919191 !important;
letter-spacing: 0;
line-height: 33rpx;
padding-left: 4%;
height: 66rpx;
overflow: hidden;
white-space: wrap;
text-overflow: ellipsis;
}

.info view:nth-child(1) text {
display: inline-block;
width: 300rpx;
font-size: 30rpx;
letter-spacing: 0;
height: 42rpx;
overflow: hidden;
line-height: 42rpx;
white-space: nowrap;
text-overflow: ellipsis;
}
.discount{
position: absolute;
width: 100rpx;
top:86rpx;
right:2rpx;
}
.info .sucess {
display: inline-block;
width: 123rpx !important;
/* overflow: hidden; */
font-size: 26rpx;
color: #02c0ff;
letter-spacing: 0;
text-align: right;
line-height: 26px;
}

.wait {
display: inline-block;
width: 123rpx !important;
overflow: visible!important;
font-size: 28rpx;
color: #ff4949;
letter-spacing: 0;
text-align: right;
line-height: 28rpx!important;
}

.close {
display: inline-block;
width: 123rpx !important;
overflow: hidden;
font-size: 28rpx;
color: #999;
letter-spacing: 0;
text-align: right;
line-height: 28rpx;
}

/*
.info view:nth-child(2),
.info view:nth-child(3),
.info view:nth-child(4) {
color: #333;
font-size: 24rpx;
} */

.value {
font-size: 24rpx;
color: #999;
letter-spacing: 0;
padding-left: 4%;
line-height: 33rpx;
}

.value text {
font-size: 24rpx;
color: #333;
letter-spacing: 0;
line-height: 33rpx;
}

/* .info view:nth-child(2) text, .info view:nth-child(3) text {
font-size: 22rpx;
} */

.info view:nth-child(3) {
margin-top: 20rpx;
}

.payment {
position: relative;
width: 92%;
height: 88rpx;
line-height: 88rpx;
padding: 0 4%;
display: flex;
justify-content: space-between;
}

.payment view:nth-child(1) text:nth-child(1) {
font-size: 24rpx;
color: #1f2d3d;
letter-spacing: 0;
}

.payment view:nth-child(1) text:nth-child(2) {
font-size: 28rpx;
color: #ff4949;
letter-spacing: 0;
margin-left: 10rpx;
}

.payment view:nth-child(1) text:nth-child(3) {
font-size: 24rpx;
color: #b4b4b4;
padding-left: 18rpx;
text-decoration: line-through;
}

.btn {
position: absolute;
top: 0;
bottom: 0;
margin: auto;
right: 20rpx;
width: 160rpx;
height: 52rpx;
line-height: 52rpx;
text-align: center;
color: #fff;
float: right;
font-size: 28rpx;
border: 2rpx solid #02c0ff;
border-radius: 10rpx;
}

.payment view:nth-child(2) text {
font-size: 30rpx;
color: #02c0ff;
}

.dingdan {
margin-top: 33rpx;
}

.dingdan text:nth-of-type(1) {
display: block;
font-size: 34rpx;
color: #333;
letter-spacing: 0;
text-align: center;
}

.dingdan text:nth-of-type(2) {
display: block;
font-size: 28rpx;
color: #999;
letter-spacing: 0;
text-align: center;
}

.dingdan image {
display: block;
width: 300rpx;
height: 300rpx;
margin: 0 auto 16rpx;
}

.loading {
text-align: center;
height: 80rpx;
line-height: 80rpx;
font-size: 26rpx;
color: #999;
}

.loading image {
width: 60rpx;
height: 60rpx;
vertical-align: middle;
margin-right: 10rpx;
}
button::after{ border: none; }
.goback{
width:400rpx!important;
height:80rpx;
line-height: 80rpx;
border-radius:10rpx;
background: orange;
color: #fff;
font-size: 32rpx;
margin-top: 20rpx;
}
.goback image{
position: absolute;
width: 60rpx;
left: 0;
right: 0;
top: 0;
bottom: 0;
margin: auto;
}

正在加载...
取消
保存