| @@ -5,6 +5,10 @@ Component({ | |||||
| questionnaire: { | questionnaire: { | ||||
| type: Object, | type: Object, | ||||
| value: {} | value: {} | ||||
| }, | |||||
| questionId: { | |||||
| type: String, | |||||
| value: {} | |||||
| } | } | ||||
| }, | }, | ||||
| data: { | data: { | ||||
| @@ -22,23 +26,55 @@ Component({ | |||||
| this.queueClick(); | this.queueClick(); | ||||
| // 子组件向父组件传值 | // 子组件向父组件传值 | ||||
| // 传值到 coupon=>detail页面 | // 传值到 coupon=>detail页面 | ||||
| var myEvent = "questions"; | |||||
| var myEvent = "questions1"; | |||||
| this.triggerEvent('myevent', myEvent); | this.triggerEvent('myevent', myEvent); | ||||
| }, | }, | ||||
| /** | /** | ||||
| * 点击提交问题 | |||||
| * 点击提交问题单选 | |||||
| */ | */ | ||||
| formSubmit:function(e){ | formSubmit:function(e){ | ||||
| let that = this; | |||||
| console.log(e); | 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页面 | // 传值到 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 () { | queueClick: function () { | ||||
| let that = this; | let that = this; | ||||
| var animation = wx.createAnimation({}); | var animation = wx.createAnimation({}); | ||||
| @@ -1,14 +1,24 @@ | |||||
| <view class="b1" animation="{{alphaData}}"> | <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='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='ques_gou' mode='widthFix' src="./../../assets/img/ques_gou.png"></image> | ||||
| <image class='image' src="./../../assets/img/headbg.png" mode='widthFix'></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> | <image class='img image' src="./../../assets/img/ques_bg.png" mode='widthFix'></image> | ||||
| <view class='question'> | <view class='question'> | ||||
| <text class='title'>{{questionnaire.title}}</text> | <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> | </view> | ||||
| </view> | </view> | ||||
| @@ -6,21 +6,20 @@ | |||||
| right: 0px; | right: 0px; | ||||
| background: rgba(0, 0, 0, 0.8); | background: rgba(0, 0, 0, 0.8); | ||||
| overflow: hidden; | overflow: hidden; | ||||
| z-index: 1000000000000; | |||||
| z-index: 100; | |||||
| } | } | ||||
| .con { | .con { | ||||
| position: absolute; | position: absolute; | ||||
| top: 120rpx; | |||||
| top: 35rpx; | |||||
| right: 0; | right: 0; | ||||
| bottom: 0; | bottom: 0; | ||||
| left: 0; | left: 0; | ||||
| margin: auto; | margin: auto; | ||||
| width: 587rpx; | width: 587rpx; | ||||
| } | } | ||||
| .con .image { | |||||
| .con .image{ | |||||
| display: block; | display: block; | ||||
| width: 100%; | width: 100%; | ||||
| } | } | ||||
| @@ -28,7 +27,6 @@ | |||||
| .img { | .img { | ||||
| margin-top: -50rpx; | margin-top: -50rpx; | ||||
| } | } | ||||
| .question { | .question { | ||||
| display: block; | display: block; | ||||
| width: 587rpx; | width: 587rpx; | ||||
| @@ -39,16 +37,17 @@ | |||||
| } | } | ||||
| .ques { | .ques { | ||||
| display: block; | |||||
| width: 511rpx; | width: 511rpx; | ||||
| margin: 0 auto; | margin: 0 auto; | ||||
| height: 105rpx; | |||||
| line-height: 105rpx; | |||||
| text-align: center; | |||||
| height: 95rpx; | |||||
| line-height: 95rpx; | |||||
| font-size: 30rpx; | font-size: 30rpx; | ||||
| color: #333; | color: #333; | ||||
| border-bottom: 1rpx solid #eee; | border-bottom: 1rpx solid #eee; | ||||
| } | } | ||||
| .title { | .title { | ||||
| width: 511rpx; | width: 511rpx; | ||||
| display: block; | display: block; | ||||
| @@ -76,4 +75,10 @@ | |||||
| width: 20rpx; | width: 20rpx; | ||||
| top: 160rpx; | top: 160rpx; | ||||
| left: 23rpx; | left: 23rpx; | ||||
| } | |||||
| .btns{ | |||||
| color: #f8755b; | |||||
| font-weight: bold; | |||||
| font-size: 30rpx!important; | |||||
| text-align: center!important; | |||||
| } | } | ||||
| @@ -1,5 +1,5 @@ | |||||
| var config = { | 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://ciformall.youlane.cn/C/api", | ||||
| // url:"https://c.malls.iformall.com/C/api", | // url:"https://c.malls.iformall.com/C/api", | ||||
| // url: "http://31adc9ce.ngrok.io/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: { | weapp: { | ||||
| @@ -6,7 +6,8 @@ const util = require("../../../utils/util"); | |||||
| Page({ | Page({ | ||||
| data: { | data: { | ||||
| data: {}, | data: {}, | ||||
| questions:null, | |||||
| questions1:null, | |||||
| questions2:null, | |||||
| display:"none", | display:"none", | ||||
| carList: [], | carList: [], | ||||
| couponChannelId: null, | couponChannelId: null, | ||||
| @@ -22,12 +23,8 @@ Page({ | |||||
| result: [], | result: [], | ||||
| end_time: null, | end_time: null, | ||||
| clock: "已经截止", | clock: "已经截止", | ||||
| questionnaire: { | |||||
| title: "小主,您有娃吗 ?" , | |||||
| questions: [ | |||||
| { ques: "要你管" }, | |||||
| { ques: "有萌娃" }] | |||||
| }, | |||||
| questionnaire: {}, | |||||
| questionId:null | |||||
| }, | }, | ||||
| onShow:function(){ | onShow:function(){ | ||||
| this.setData({ | this.setData({ | ||||
| @@ -51,17 +48,62 @@ Page({ | |||||
| close: function (e) { | close: function (e) { | ||||
| console.log(e.detail); | console.log(e.detail); | ||||
| let that = this; | let that = this; | ||||
| if (e.detail == 'questions') { | |||||
| this.orderFunc("questions"); | |||||
| } | |||||
| that.setData({ | |||||
| questions1: e.detail, | |||||
| display:"none" | |||||
| }) | |||||
| }, | }, | ||||
| formSubmit:function(e){ | formSubmit:function(e){ | ||||
| console.log(e.detail); | console.log(e.detail); | ||||
| let that = this; | 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) { | countdown(end_time) { | ||||
| let that = this; | let that = this; | ||||
| var EndTime = end_time; | var EndTime = end_time; | ||||
| @@ -375,38 +417,23 @@ Page({ | |||||
| ///// end virtual pay | ///// end virtual pay | ||||
| }); | }); | ||||
| } else { | } else { | ||||
| // 免费券 | |||||
| /** | /** | ||||
| * @Meo | * @Meo | ||||
| * 功能:用户问卷调查功能 | * 功能:用户问卷调查功能 | ||||
| */ | */ | ||||
| console.log(that.data.data.type); | console.log(that.data.data.type); | ||||
| that.setData({ | |||||
| display:"block", | |||||
| }) | |||||
| that.payOrderUpdate(orderId, "0", 1); | that.payOrderUpdate(orderId, "0", 1); | ||||
| wx.setStorage({ | wx.setStorage({ | ||||
| key: 'couponNum', | key: 'couponNum', | ||||
| data: "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 | * @Meo | ||||
| * type | * type | ||||
| @@ -81,13 +81,13 @@ | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <view class="buy-view app-border-top"> | <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> | <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="{{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="{{endtime=='活动已结束'}}" style="background:#999;color: #fff;">活动已结束</button> | ||||
| <button class='buy' wx:if="{{total_micro_second<=0}}" style="background:#999;color: #fff;">活动已结束</button> | <button class='buy' wx:if="{{total_micro_second<=0}}" style="background:#999;color: #fff;">活动已结束</button> | ||||
| </view> | </view> | ||||
| </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-left-radius: 20rpx; | ||||
| border-top-right-radius: 20rpx; | border-top-right-radius: 20rpx; | ||||
| margin-top: -25rpx; | margin-top: -25rpx; | ||||
| z-index: 100000000; | |||||
| z-index: 10; | |||||
| } | } | ||||
| .fenxiang { | .fenxiang { | ||||
| @@ -272,7 +272,7 @@ page { | |||||
| right: 0; | right: 0; | ||||
| padding-bottom: 22rpx; | padding-bottom: 22rpx; | ||||
| padding-top: 22rpx; | padding-top: 22rpx; | ||||
| z-index: 1000; | |||||
| z-index: 100; | |||||
| } | } | ||||
| .buy { | .buy { | ||||
| @@ -81,10 +81,16 @@ Page({ | |||||
| }) | }) | ||||
| } | } | ||||
| var that = this; | 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(); | app.getLocation(); | ||||
| if (options.couponChannelId && options.couponId){ | if (options.couponChannelId && options.couponId){ | ||||
| that.userLogin(options.couponChannelId, options.couponId); | that.userLogin(options.couponChannelId, options.couponId); | ||||