Commit aa862dbe authored by 华国豪's avatar 华国豪 🙄

新增问券调查、游记

parent 08277374
{
"pages": [
"pages/Voucher/write/write",
"pages/Voucher/Voucher",
"pages/Voucher/VoucherDetails/VoucherDetails",
"pages/Voucher/rating/rating",
"pages/freeTravel/free",
"pages/Home/home",
"pages/product/product",
......
// pages/Voucher/Voucher.js
let app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
telPhone: '',
tcId: null,
orderId: null
},
//问券详情跳转
Details: function (e) {
if (!this.data.telPhone) {
wx.showToast({
title: '请输入手机号',
icon: 'none',
duration: 1000
})
} else {
let data = {
guestMobile: this.data.telPhone,
TCID: this.data.tcId
}
app.$api('miniProgram_price_GetGuestByPhone', data).then(res => {
if (res.Id === 0) {
wx.showToast({
title: '旅客信息有误,请检查手机号',
icon: 'none',
duration: 1000
})
return
}
let _this = this;
let nameID = res.SurName + (res.Sex === 1 ? '先生' : '女士');
wx.setStorage({
key: "info",
data: {
nameID: nameID,
ID: res.Id,
}
})
wx.navigateTo({
url: '/pages/Voucher/VoucherDetails/VoucherDetails?&orderId=' + _this.data.orderId + '&tcId=' + _this.data.tcId
})
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 1000
})
})
}
},
//输入手机号
TelPhone: function (e) {
console.log(e.detail.value)
this.setData({
telPhone: e.detail.value
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let tcId = options.hasOwnProperty('tcId') ? options.tcId : '3037',
orderId = options.hasOwnProperty('orderId') ? options.orderId : '20914';
this.setData({
tcId: tcId,
orderId: orderId
})
//修改title
wx.setNavigationBarTitle({
title: '意见调查'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class='page-Voucher'>
<text class='text'>身份确认</text>
<input bindinput='TelPhone' placeholder='请输入手机号以确认身份'></input>
<button class='next' type="default" size="mini" bindtap="Details">确认</button>
</view>
\ No newline at end of file
page{
height: 100%
}
.page-Voucher{
padding: 162rpx 49rpx;
height: 100%;
background-color: white;
}
.page-Voucher .text{
font-size: 48rpx;
font-weight:500;
}
.page-Voucher input{
font-size: 40rpx;
height: 3.4rem;
box-sizing: border-box;
border-bottom: 2px solid #DEDEDE;
color: #999999;
margin-top: 70rpx;
}
.page-Voucher input::-webkit-input-placeholder{
color:#999999;
}
.page-Voucher input::-moz-placeholder{ /* Mozilla Firefox 19+ */
color:#999999;
}
.page-Voucher input:-moz-placeholder{ /* Mozilla Firefox 4 to 18 */
color:#999999;
}
.page-Voucher input:-ms-input-placeholder{ /* Internet Explorer 10-11 */
color:#999999;
}
button.next{
width: 350rpx;
height: 84rpx;
background-color: #DEDEDE;
line-height:84rpx;
margin-top: 106rpx;
border-color: #DEDEDE;
color: #666666;
font-size: 32rpx;
}
button.next:active{
background:rgba(238,68,84,1);
border-color: rgba(238,68,84,1);
color: white;
}
\ No newline at end of file
// pages/Voucher/VoucherDetails/VoucherDetails.js
let app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
nameID: '',
orderId: null,
tcId: null,
GuestId: null,
leaderData: {},
voucherData: {},
rating: '',
Message: '',
showYouJi: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
console.log(options)
let info = wx.getStorageSync('info'),
orderId = options.orderId,
tcId = options.tcId;
this.setData({
nameID: info.nameID,
GuestId: info.ID,
orderId: orderId,
tcId: tcId
})
this.getinfo()
this.getVoucher()
},
// 保存数据
saveMessage: function () {
console.log(this.data.voucherData)
let data = JSON.parse(JSON.stringify(this.data.voucherData)),
showYouJi = false;
data.forEach(x=>{
x.TCID = this.tcId;
x.OrderID = this.orderId;
x.GuestId = this.GuestId;
if (x.SurveyType === 2 || x.SurveyType === 3) {
x.SurveyOptionsList.forEach(y=>{
y.IsCheck = y.IsCheckS ? '1' : '0'
})
}
if (x.SurveyType === 1) {
if (x.ScoreNum >= 3) {
showYouJi = true
} else {
showYouJi = false
}
}
})
if (this.data.Message === '') {
wx.showToast({
title: '请填写留言',
icon: 'none',
duration: 1000
})
return
}
app.$api('survey_post_SetGuestSurvey', data).then(res => {
if (showYouJi) {
this.setData({
showYouJi: true
})
}
wx.showToast({
title: '提交成功!',
icon: 'none',
duration: 1000
})
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 1000
})
})
},
//写游记
goWrite: function () {
wx.navigateTo({
url: '/pages/Voucher/write/write?GuestId=' + _this.data.GuestId + '&orderId=' + _this.data.orderId + '&tcId=' + _this.data.tcId
})
},
//评分
handleChange: function (e) {
console.log(e.detail.value)
let index = e.target.id
this.data.voucherData[index].ScoreNum = e.detail.value
this.setData({
voucherData: this.data.voucherData,
rating: e.detail.value
})
},
// 输入留言
inputMessage: function (e) {
console.log(e.detail.value)
let index = e.target.id
this.data.voucherData[index].TextContent = e.detail.value
this.setData({
voucherData: this.data.voucherData,
Message: e.detail.value
})
},
//获取领队导游信息
getinfo: function () {
let data = {
tcid: this.data.tcId
}
app.$api('miniProgram_post_GetBasePrice', data).then(res => {
console.log(res)
this.setData({
leaderData: res
})
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 1000
})
})
},
checkboxChange: function (e) {
let ID = [];
let checkd = e.detail.value
let index = e.target.id
for (let i = 0; i < checkd.length ; i++) {
ID.push(Number(checkd[i]))
}
this.data.voucherData[index].SurveyOptionsList.forEach(o=>{
o.IsCheckS = false
ID.forEach(i=>{
if (i === o.ID) {
o.IsCheckS = true
}
})
})
this.setData({
voucherData: this.data.voucherData
})
},
radioChange: function (e) {
let ID = Number(e.detail.value)
let index = e.target.id
this.data.voucherData[index].SurveyOptionsList.forEach(o => {
if (ID === o.ID) {
o.IsCheckS = true
} else {
o.IsCheckS = false
}
})
this.setData({
voucherData: this.data.voucherData
})
},
// 获取问券列表
getVoucher: function () {
let data = {
IsShow: 1,
SurveyType: -1
}
app.$api('survey_post_GetSurveyShowList', data).then(res => {
console.log(res)
res.map(item => {
if (item.SurveyType === 2) {
item.SurveyOptionsList.map((cItem, cIndex) => {
// if (cIndex === 0) {
// cItem.IsCheckS = true
// } else {
cItem.IsCheckS = false
// }
})
}
if (item.SurveyType === 3) {
item.SurveyOptionsList.map((cItem, cIndex) => {
cItem.IsCheckS = false
})
}
if (item.SurveyType === 1) {
item.ScoreNum = 5;
}
})
this.setData({
voucherData: res
})
}).catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 1000
})
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {
"com-rating": "/pages/Voucher/rating/rating"
}
}
\ No newline at end of file
<view class='page-details'>
<view>
<text class='text'>感谢{{nameID}}参与意见调查</text>
</view>
<view class='leader-info'>
<view class='top'>
<text>领队:{{leaderData.LeaderName}}</text>
<text>导游:{{leaderData.GuideName}}</text>
</view>
<view>
<text>团期:{{leaderData.StartDateStr}}-{{leaderData.EndDateStr}}</text>
</view>
</view>
<view wx:for="{{voucherData}}" wx:for-item="item" wx:for-index="index" wx:key="index" class='pingfen-item'>
<view>
<text>{{index+1}}、{{item.Title}}</text>
</view>
<com-rating max="5" rating='5' bindchange='handleChange' wx:if="{{item.SurveyType === 1}}" id="{{index}}"/>
<radio-group wx:elif="{{item.SurveyType === 2}}" class="radio-group" bindchange="radioChange" id="{{index}}">
<label class="radio" wx:for="{{item.SurveyOptionsList}}" wx:for-item="CItem" wx:for-index="CIndex" wx:key="CIndex">
<radio value="{{CItem.ID}}" checked="{{CItem.IsCheckS}}"/>{{CItem.OptionsName}}
</label>
</radio-group>
<checkbox-group wx:elif="{{item.SurveyType === 3}}" bindchange="checkboxChange" id="{{index}}">
<label class="checkbox" wx:for="{{item.SurveyOptionsList}}" wx:for-item="CItem" wx:for-index="CIndex" wx:key="CIndex">
<checkbox value="{{CItem.ID}}" checked="{{CItem.IsCheckS}}"/>{{CItem.OptionsName}}
</label>
</checkbox-group>
<textarea wx:elif="{{item.SurveyType === 4}}" bindinput='inputMessage' id="{{index}}" placeholder='点击输入'></textarea>
</view>
<view class='btn'>
<button class='next' type="default" size="mini" bindtap="saveMessage">确认</button>
</view>
<view class='dialog' wx:if="{{showYouJi}}">
<view class='box'>
<view class='tit'>感谢参与调查</view>
<image src='../../../images/voucher/xieyouji_icon.png'></image>
<view class='btn'>
<button class='next' type="default" size="mini" bindtap="goWrite">写游记,领奖品</button>
</view>
<view class='tips'>
根据自身经历写游记,还可获得奖品
</view>
</view>
</view>
</view>
\ No newline at end of file
page{
height: 100%;
width: 100%;
}
.page-details{
padding: 34rpx 49rpx 0 ;
height: 100%;
background-color: white;
}
.page-details .text{
font-size:42rpx;
font-weight:500;
color:rgba(0,0,0,1);
}
.page-details .leader-info{
margin: 30rpx 0;
padding: 30rpx;
background-color: #F5F5F5;
font-size: 28rpx;
color: #000000
}
.page-details .leader-info .top text {
display: inline-block;
width: 50%;
}
.pingfen-item{
margin-bottom: 40rpx;
}
.pingfen-item label{
font-size: 28rpx;
padding-right: 30rpx;
display:flex;
align-items:center;
}
.pingfen-item .radio-group,.pingfen-item checkbox-group{
display: flex;
margin-top: 10rpx;
padding-left: 10rpx;
}
.pingfen-item textarea{
padding: 27rpx 34rpx;
font-size: 32rpx;
background-color: #F5F5F5;
box-sizing: border-box;
width: 100%;
margin: 10rpx 0 0 10rpx;
}
.btn{
text-align: center;
}
button.next{
width: 350rpx;
height: 84rpx;
background-color: #DEDEDE;
line-height:84rpx;
margin-top: 50rpx;
border-color: #DEDEDE;
color: #666666;
font-size: 32rpx;
}
button.next:active{
background:rgba(238,68,84,1);
border-color: rgba(238,68,84,1);
color: white;
}
.dialog{
height: 100%;
width: 100%;
position: fixed;
left: 0;
top: 0;
z-index: 2;
background:rgba(44,44,44,.5);
display: flex;
align-items: center;
justify-content: center;
}
.dialog .box{
padding: 54rpx;
border-radius:20rpx;
height: 694rpx;
box-sizing: border-box;
background-color: white;
width: 634rpx;
text-align: center;
}
.dialog .box .tit{
font-size: 36rpx;
margin-bottom: 75rpx;
}
.dialog .box image{
width: 278rpx;
height: 218rpx;
}
.dialog .box .btn button.next{
background:rgba(238,68,84,1) !important;
border-color: rgba(238,68,84,1) !important;
color: white;
}
.dialog .box .tips{
font-size: 28rpx;
color: #999999;
margin-top: 25rpx;
}
\ No newline at end of file
Component({
// 声明组件属性及默认值
properties: {
rating: {
type: Number, // 必需 指定属性类型 [String, Number, Boolean, Object, Array, null(任意类型)]
value: 5
},
max: {
type: Number,
value: 5
},
disabled: {
type: Boolean,
value: false
}
},
// 组件私有和公开的方法,组件所使用的方法需在此声明
methods: {
_handleTap: function (e) {
if (this.data.disabled) return;
const { max } = this.data;
const { num } = e.currentTarget.dataset;
this.setData({
rating: max / 5 * num
})
// 自定义组件事件
this.triggerEvent('change', { value: max / 5 * num }, e);
}
}
})
\ No newline at end of file
{
"usingComponents": {},
"component": true
}
\ No newline at end of file
<view class='com-rating'>
<text class='pingfen'>评分</text>
<view class='rating-icon' wx:for='{{[1,2,3,4,5]}}' wx:key='*this'
bindtap='_handleTap' data-num='{{item}}'>
<view class='rating-on' style='width:{{rating >= (max/5)*item ? 1 : rating < (max/5)*(item-1) ? 0 : (rating*10)%(max/5*10)/(max/5*10)}}em'>
<image src='../../../images/voucher/rating_on_icon.png' mode='widthFix' style='width:1em' />
</view>
<view class='rating-off' style='width:1em;'>
<image src='../../../images/voucher/rating_off_icon.png' mode='widthFix' style='width:1em' />
</view>
</view>
<view class='pingfen-tips'>
<text wx:if="{{rating === 1}}">非常不满意</text>
<text wx:elif="{{rating === 2}}">不满意</text>
<text wx:elif="{{rating === 3}}">感觉一般</text>
<text wx:elif="{{rating === 4}}">满意</text>
<text wx:elif="{{rating === 5}}">非常满意</text>
</view>
</view>
\ No newline at end of file
.com-rating {
letter-spacing: .3em;
position: relative;
display:flex;
align-items:center;
padding-left: 10rpx;
}
.com-rating .rating-icon,
.com-rating .rating-on,
.com-rating .rating-off {
display: inline-block;
}
.com-rating .rating-icon:not(:last-child) {
margin-right: .2em;
}
.com-rating .rating-on {
color: black;
position: absolute;
overflow: hidden;
padding: 0;
margin: 0;
}
.com-rating .rating-off {
color: #DBDBDB;
padding: 0;
margin: 0;
}
.pingfen,.pingfen-tips{
font-size: 28rpx;
padding-right: 28rpx;
}
.pingfen-tips{
padding-left: 28rpx;
padding-right: 0;
}
\ No newline at end of file
// pages/Voucher/write/write.js
Page({
/**
* 页面的初始数据
*/
data: {
orderId: null,
tcId: null,
GuestId: null,
list: [],
imgList: [],
tag: [
{
id: 0,
name: '交通攻略',
content: '',
},{
id: 1,
name: '营业时间',
content: '',
}, {
id: 2,
name: '详细地址',
content: '',
}, {
id: 3,
name: '人均消费',
content: '',
}, {
id: 4,
name: '特色推荐',
content: '',
}, {
id: 5,
name: '行程路线',
content: '',
}, {
id: 6,
name: '玩法推荐',
content: '',
}, {
id: 7,
name: '实用提示',
content: '',
}, {
id: 8,
name: '行程路线',
content: '',
}
]
},
//选择标签
clickTag: function (e) {
let index = e.target.id
},
// 删除图片
deleteImg: function (e) {
let index = e.target.id
this.data.imgList.splice(index, 1)
let _this = this;
console.log(this.data.imgList)
this.setData({
imgList: _this.data.imgList
})
},
// 选择图片
chooseImage: function () {
let _this = this;
wx.chooseImage({
count: 9,
sizeType: ['original', 'compressed'],
sourceType: ['album', 'camera'],
success(res) {
let arr = _this.data.imgList
const tempFilePaths = res.tempFilePaths
res.tempFilePaths.map(x=>{
if (arr.length >= 9) {
wx.showToast({
title: '最多上传9张图片!',
icon: 'none',
duration: 1000
})
return
}
arr.push(x)
})
_this.setData({
imgList: arr
})
console.log(arr)
}
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
//修改title
wx.setNavigationBarTitle({
title: '写游记,领奖品'
})
this.setData({
orderId: options.orderId,
tcId: options.tcId,
GuestId: options.GuestId,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
<view class='page-write'>
<view class='content'>
<view class='top'>
<view class='top-content'>
<view wx:if='{{list.length < 1}}' class='no-list'>
<textarea placeholder='我来说说在这里游玩的感受吧~'></textarea>
</view>
<view wx:else>
阿萨德
</view>
<view class='btn'>
<button class='next' type="default" size="mini" bindtap="goWrite">发送</button>
</view>
</view>
<view class='upload'>
<view wx:for="{{imgList}}" wx:for-item="item" wx:for-index="index" wx:key="index" class='item-box'>
<image src='{{item}}'></image>
<text class='delete-img' bindtap='deleteImg' id='{{index}}'>x</text>
</view>
<view class='upload_btn' bindtap='chooseImage'>+</view>
</view>
</view>
</view>
<view class='tag'>
<view class='tag-tit'>
<image src='../../../images/voucher/tag_icon.png'></image>
<text>游记标签</text>
</view>
<view class='tag-list'>
<text wx:for="{{tag}}" wx:for-item="item" wx:for-index="index" wx:key="key" bindtap='clickTag' id="{{index}}">{{item.name}}</text>
</view>
</view>
</view>
\ No newline at end of file
page{
height: 100%;
background-color: white;
}
.content{
padding: 30rpx 40rpx;
}
.content .top .top-content{
min-height: 310rpx;
background: rgba(245,245,245,1);
box-sizing: border-box;
padding: 23rpx 20rpx;
position: relative;
}
.no-list{
font-size: 28rpx;
color: #666666;
}
.no-list textarea{
width: 100%;
}
.btn button.next{
background: rgba(238,68,84,1);
box-shadow: 0px 1px 2px 0px rgba(167,11,26,0.63);
border-radius: 10px;
color: white;
position: absolute;
right: 20rpx;
bottom: 20rpx;
z-index: 2;
}
.upload{
height: 120rpx;
margin: 20rpx 0;
display: flex;
flex-wrap:wrap;
}
.upload .item-box{
position: relative;
}
.upload .item-box image{
width: 120rpx;
height: 120rpx;
border-radius: 20rpx;
margin-right: 20rpx;
}
.upload .item-box text{
position: absolute;
right:15rpx;
top:-15rpx;
display: inline-block;
width:30rpx;
height:30rpx;
line-height: 20rpx;
font-size: 28rpx;
text-align: center;
color: white;
border-radius: 50%;
background-color: rgba(238,68,84,1);
}
.upload_btn{
width: 120rpx;
height: 120rpx;
border: 1px solid #8D8D8D;
border-radius: 20rpx;
font-size: 40px;
font-weight: bold;
line-height: 105rpx;
text-align: center;
}
.tag{
margin-top: 70rpx;
box-shadow: 0px -2px 8px 0px rgba(187, 187, 187, 0.63);
}
.tag-tit{
padding: 15rpx 40rpx;
display: flex;
align-items: center;
border-bottom: 1px solid #E0E2E6;
}
.tag-tit image{
width: 50rpx;
height: 50rpx;
display: inline-block;
margin-right: 30rpx;
}
.tag-tit text{
width: 132rpx;
height: 45rpx;
background:rgba(238,68,84,1);
border-radius:20px;
font-size: 24rpx;
color: rgba(255,255,255,1);
line-height: 23px;
display: inline-block;
text-align: center;
}
.tag-list{
padding: 56rpx 38rpx;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
}
.tag-list text{
width: 180rpx;
height: 53rpx;
background: rgba(247,247,247,1);
border-radius: 27px;
display: inline-block;
font-size: 24rpx;
text-align: center;
line-height: 53rpx;
margin-bottom: 57rpx;
}
\ No newline at end of file
......@@ -37,7 +37,7 @@
"list": []
},
"miniprogram": {
"current": 4,
"current": 5,
"list": [
{
"id": 0,
......@@ -77,6 +77,12 @@
"query": "configId=102",
"scene": "1036",
"referrerInfo": {}
},
{
"id": -1,
"name": "写游记",
"pathName": "pages/Voucher/write/write",
"scene": null
}
]
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment