@@ -5,6 +5,10 @@ Component({ | |||
questionnaire: { | |||
type: Object, | |||
value: {} | |||
}, | |||
questionId: { | |||
type: String, | |||
value: {} | |||
} | |||
}, | |||
data: { | |||
@@ -22,23 +26,55 @@ Component({ | |||
this.queueClick(); | |||
// 子组件向父组件传值 | |||
// 传值到 coupon=>detail页面 | |||
var myEvent = "questions"; | |||
var myEvent = "questions1"; | |||
this.triggerEvent('myevent', myEvent); | |||
}, | |||
/** | |||
* 点击提交问题 | |||
* 点击提交问题单选 | |||
*/ | |||
formSubmit:function(e){ | |||
let that = this; | |||
console.log(e); | |||
console.log(e.target.dataset.questitle) | |||
console.log(e.target.dataset.question) | |||
this.alphaClick(); | |||
this.queueClick(); | |||
/** | |||
* 多选 | |||
*/ | |||
if (e.currentTarget.dataset.flags =='multi'){ | |||
if (that.data.anwserId.length==0){ | |||
var answserIs = "" | |||
}else{ | |||
var answserIs = that.data.anwserId.join(","); | |||
} | |||
} | |||
else{ | |||
var answserIs = e.target.dataset.answerid; | |||
} | |||
Http.post({ | |||
url: config.api.answerQuestion, | |||
data: { | |||
answer: answserIs, | |||
questionId: e.currentTarget.dataset.questionid | |||
} | |||
}) | |||
.then(res => { | |||
console.log(res); | |||
this.alphaClick(); | |||
this.queueClick(); | |||
}) | |||
// 子组件向父组件传值 | |||
// 传值到 coupon=>detail页面 | |||
var myEvent1 = "questions"; | |||
this.triggerEvent('myevent1', myEvent1); | |||
var myEvent1 = "questions2"; | |||
this.triggerEvent('myevent', myEvent1); | |||
}, | |||
/** | |||
* 多选 | |||
*/ | |||
checkboxChange:function(e){ | |||
console.log(e); | |||
this.setData({ | |||
anwserId:e.detail.value | |||
}) | |||
}, | |||
queueClick: function () { | |||
let that = this; | |||
var animation = wx.createAnimation({}); | |||
@@ -1,14 +1,24 @@ | |||
<view class="b1" animation="{{alphaData}}"> | |||
<view class='con' animation="{{queueData}}"> | |||
<view id='con' class='con' animation="{{queueData}}"> | |||
<image class='close' mode='widthFix' src="./../../assets/img/closed.png" bindtap="close"></image> | |||
<image class='ques_gou' mode='widthFix' src="./../../assets/img/ques_gou.png"></image> | |||
<image class='image' src="./../../assets/img/headbg.png" mode='widthFix'></image> | |||
<image class='img image' src="./../../assets/img/ques_bg.png" mode='widthFix'></image> | |||
<view class='question'> | |||
<text class='title'>{{questionnaire.title}}</text> | |||
<view class='quessss' bindtap="formSubmit"> | |||
<view class='ques' wx:for="{{questionnaire.questions}}" data-question='{{item.ques}}' data-questitle='{{questionnaire.title}}' wx:key="{{index}}">{{item.ques}}</view> | |||
</view> | |||
<!-- 单选 --> | |||
<radio-group class="radio-group" wx:if="{{questionnaire.flag=='single'}}" data-flags="sigle" bindtap="formSubmit" data-questionId="{{questionId}}"> | |||
<radio class="radio ques" wx:for="{{questionnaire.answers}}" wx:key="{{index}}" value="{{item.id}}" data-answer="{{item.name}}" data-answerId="{{item.id}}"> | |||
<view>{{item.name}}</view> | |||
</radio> | |||
</radio-group> | |||
<!-- 多选 --> | |||
<checkbox-group bindchange="checkboxChange" wx:if="{{questionnaire.flag=='multi'}}" bindchange="checkboxChange"> | |||
<label class="radio ques" wx:for="{{questionnaire.answers}}" wx:key=""> | |||
<checkbox value="{{item.id}}"/>{{item.name}} | |||
</label> | |||
</checkbox-group> | |||
<view class='ques btns' wx:if="{{questionnaire.flag=='multi'}}" data-flags='multi' bindtap='formSubmit' data-questionId="{{questionId}}">确定</view> | |||
</view> | |||
</view> | |||
</view> |
@@ -6,21 +6,20 @@ | |||
right: 0px; | |||
background: rgba(0, 0, 0, 0.8); | |||
overflow: hidden; | |||
z-index: 1000000000000; | |||
z-index: 100; | |||
} | |||
.con { | |||
position: absolute; | |||
top: 120rpx; | |||
top: 35rpx; | |||
right: 0; | |||
bottom: 0; | |||
left: 0; | |||
margin: auto; | |||
width: 587rpx; | |||
} | |||
.con .image { | |||
.con .image{ | |||
display: block; | |||
width: 100%; | |||
} | |||
@@ -28,7 +27,6 @@ | |||
.img { | |||
margin-top: -50rpx; | |||
} | |||
.question { | |||
display: block; | |||
width: 587rpx; | |||
@@ -39,16 +37,17 @@ | |||
} | |||
.ques { | |||
display: block; | |||
width: 511rpx; | |||
margin: 0 auto; | |||
height: 105rpx; | |||
line-height: 105rpx; | |||
text-align: center; | |||
height: 95rpx; | |||
line-height: 95rpx; | |||
font-size: 30rpx; | |||
color: #333; | |||
border-bottom: 1rpx solid #eee; | |||
} | |||
.title { | |||
width: 511rpx; | |||
display: block; | |||
@@ -76,4 +75,10 @@ | |||
width: 20rpx; | |||
top: 160rpx; | |||
left: 23rpx; | |||
} | |||
.btns{ | |||
color: #f8755b; | |||
font-weight: bold; | |||
font-size: 30rpx!important; | |||
text-align: center!important; | |||
} |
@@ -1,5 +1,5 @@ | |||
var config = { | |||
// url: "http://10.11.205.51:7000/C/api", | |||
// url: "http://10.11.207.233:7000/C/api", | |||
url: "https://ciformall.youlane.cn/C/api", | |||
// url:"https://c.malls.iformall.com/C/api", | |||
// url: "http://31adc9ce.ngrok.io/C/api", | |||
@@ -155,7 +155,15 @@ var config = { | |||
/** | |||
* 用户更新信息 | |||
*/ | |||
updateInfo: "/user/updateUserInfo" | |||
updateInfo: "/user/updateUserInfo", | |||
/** | |||
* 查询问卷 | |||
*/ | |||
getQuestion:"/wxQuestion/getQuestion", | |||
/** | |||
* 提交问卷 | |||
*/ | |||
answerQuestion:"/wxQuestion/answerQuestion" | |||
}, | |||
weapp: { | |||
@@ -6,7 +6,8 @@ const util = require("../../../utils/util"); | |||
Page({ | |||
data: { | |||
data: {}, | |||
questions:null, | |||
questions1:null, | |||
questions2:null, | |||
display:"none", | |||
carList: [], | |||
couponChannelId: null, | |||
@@ -22,12 +23,8 @@ Page({ | |||
result: [], | |||
end_time: null, | |||
clock: "已经截止", | |||
questionnaire: { | |||
title: "小主,您有娃吗 ?" , | |||
questions: [ | |||
{ ques: "要你管" }, | |||
{ ques: "有萌娃" }] | |||
}, | |||
questionnaire: {}, | |||
questionId:null | |||
}, | |||
onShow:function(){ | |||
this.setData({ | |||
@@ -51,17 +48,62 @@ Page({ | |||
close: function (e) { | |||
console.log(e.detail); | |||
let that = this; | |||
if (e.detail == 'questions') { | |||
this.orderFunc("questions"); | |||
} | |||
that.setData({ | |||
questions1: e.detail, | |||
display:"none" | |||
}) | |||
}, | |||
formSubmit:function(e){ | |||
console.log(e.detail); | |||
let that = this; | |||
if (e.detail == 'questions') { | |||
this.orderFunc("questions"); | |||
that.setData({ | |||
questions2: e.detail, | |||
display:"none" | |||
}) | |||
}, | |||
/** | |||
* gotopay | |||
*/ | |||
gotopay:function(){ | |||
let that = this; | |||
console.log(that.data.questions1) | |||
if (that.data.questions1 == 'questions1' || that.data.questions2 == 'questions2'){ | |||
that.setData({ | |||
display: "none", | |||
}) | |||
that.orderFunc(); | |||
}else{ | |||
Http.get({ | |||
url: config.api.getQuestion, | |||
data: { | |||
couponType: JSON.stringify(that.data.data.type) | |||
} | |||
}) | |||
.then(res => { | |||
if (res.data == undefined) { | |||
that.setData({ | |||
display: "none", | |||
}) | |||
that.orderFunc(); | |||
} | |||
else if (res.data) { | |||
that.setData({ | |||
display: "block", | |||
questionnaire: JSON.parse(res.data.content), | |||
questionId:res.data.id | |||
}); | |||
console.log(that.data.questionnaire); | |||
} | |||
}) | |||
.catch(error=>{ | |||
console.log(error) | |||
}) | |||
} | |||
}, | |||
countdown(end_time) { | |||
let that = this; | |||
var EndTime = end_time; | |||
@@ -375,38 +417,23 @@ Page({ | |||
///// end virtual pay | |||
}); | |||
} else { | |||
// 免费券 | |||
/** | |||
* @Meo | |||
* 功能:用户问卷调查功能 | |||
*/ | |||
console.log(that.data.data.type); | |||
that.setData({ | |||
display:"block", | |||
}) | |||
that.payOrderUpdate(orderId, "0", 1); | |||
wx.setStorage({ | |||
key: 'couponNum', | |||
data: "couponNum" | |||
}) | |||
if (flag =='questions'){ | |||
setTimeout(function () { | |||
wx.navigateTo({ | |||
url: `/pages/order/detail/index?orderId=${ | |||
that.data.orderId | |||
}` | |||
}); | |||
}, 1500) | |||
}else{ | |||
// setTimeout(function () { | |||
// wx.navigateTo({ | |||
// url: `/pages/order/detail/index?orderId=${ | |||
// that.data.orderId | |||
// }` | |||
// }); | |||
// }, 1000) | |||
} | |||
setTimeout(function () { | |||
wx.navigateTo({ | |||
url: `/pages/order/detail/index?orderId=${ | |||
that.data.orderId | |||
}` | |||
}); | |||
}, 1000) | |||
/** | |||
* @Meo | |||
* type | |||
@@ -81,13 +81,13 @@ | |||
</view> | |||
</view> | |||
<view class="buy-view app-border-top"> | |||
<button bindtap='orderFunc' hover-class='active' class='buy' wx:if="{{data.salePriceStr!=0&&data.remainInventory!=0&&endtime!='活动已结束'}}"> | |||
<button bindtap='gotopay' hover-class='active' class='buy' wx:if="{{data.salePriceStr!=0&&data.remainInventory!=0&&endtime!='活动已结束'}}"> | |||
<text class='txt'>{{data.salePriceStr}}元</text>马上购买</button> | |||
<button bindtap='orderFunc' class='buy' wx:if="{{data.salePriceStr==0&&data.remainInventory!=0&&endtime!='活动已结束'}}">免费领取</button> | |||
<button bindtap='gotopay' class='buy' wx:if="{{data.salePriceStr==0&&data.remainInventory!=0&&endtime!='活动已结束'}}">免费领取</button> | |||
<button class='buy' wx:if="{{data.remainInventory==0&&endtime!='活动已结束'}}" style="background:#999;color: #fff;">已售罄</button> | |||
<button class='buy' wx:if="{{endtime=='活动已结束'}}" style="background:#999;color: #fff;">活动已结束</button> | |||
<button class='buy' wx:if="{{total_micro_second<=0}}" style="background:#999;color: #fff;">活动已结束</button> | |||
</view> | |||
</view> | |||
<!-- 问卷调查 --> | |||
<questionnaire wx:if="{{display=='block'}}" questionnaire="{{questionnaire}}" bind:myevent="close" bind:myevent1="formSubmit" /> | |||
<questionnaire wx:if="{{display=='block'}}" questionnaire="{{questionnaire}}" questionId="{{questionId}}" bind:myevent="close" bind:myevent1="formSubmit" /> |
@@ -30,7 +30,7 @@ page { | |||
border-top-left-radius: 20rpx; | |||
border-top-right-radius: 20rpx; | |||
margin-top: -25rpx; | |||
z-index: 100000000; | |||
z-index: 10; | |||
} | |||
.fenxiang { | |||
@@ -272,7 +272,7 @@ page { | |||
right: 0; | |||
padding-bottom: 22rpx; | |||
padding-top: 22rpx; | |||
z-index: 1000; | |||
z-index: 100; | |||
} | |||
.buy { | |||
@@ -81,10 +81,16 @@ Page({ | |||
}) | |||
} | |||
var that = this; | |||
var scene = decodeURIComponent(options.scene); | |||
that.setData({ | |||
scene:scene | |||
}); | |||
if (decodeURIComponent(options.scene)=="undefined"){ | |||
that.setData({ | |||
scene: 0 | |||
}); | |||
}else{ | |||
that.setData({ | |||
scene: decodeURIComponent(options.scene) | |||
}); | |||
} | |||
console.log(that.data.scene); | |||
app.getLocation(); | |||
if (options.couponChannelId && options.couponId){ | |||
that.userLogin(options.couponChannelId, options.couponId); | |||