Commit dcebc76b by 汪睦雄

完善小程序

parent 198ba9c5
import api from '../utils/Api.js'
module.exports = Behavior({
behaviors: [],
properties: {},
data: {},
attached: function() {},
methods: {
/**
* 跳转到活动/商家详情页
*/
__gotoProjectDetail: function(event) {
let pid = event.currentTarget.dataset.pid
wx.navigateTo({
url: '/pages/detail/index?id=' + pid,
})
}
}
})
\ No newline at end of file
// components/comment-stars/index.js
Component({
/**
* 组件的属性列表
*/
properties: {
star: {
type: Number,
value: 0
},
large: {
type: Boolean,
value: false
}
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
/**
* 点击事件
*/
_tapStar(event) {
this.triggerEvent('tap', { ...event.currentTarget })
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<!--components/comment-stars/index.wxml-->
<wxs src="../../pages/common.wxs" module="common"></wxs>
<view class='star-wrapper'>
<view class='stars-content'>
<block wx:if="{{common.numFixed(star, 1) > 4.5}}">
<block wx:for="{{[1, 2, 3, 4, 5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_full.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:elif="{{common.numFixed(star, 1) > 4.0 && common.numFixed(star, 1) <= 4.5}}">
<block wx:for="{{[1, 2, 3, 4]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_full.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_half.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:elif="{{common.numFixed(star, 1) > 3.5 && common.numFixed(star, 1) <= 4.0}}">
<block wx:for="{{[1, 2, 3, 4]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_full.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_blank.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:elif="{{common.numFixed(star, 1) > 3.0 && common.numFixed(star, 1) <= 3.5}}">
<block wx:for="{{[1, 2, 3]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_full.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[4]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_half.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_blank.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:elif="{{common.numFixed(star, 1) > 2.5 && common.numFixed(star, 1) <= 3.0}}">
<block wx:for="{{[1, 2, 3]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_full.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[4, 5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_blank.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:elif="{{common.numFixed(star, 1) > 2.0 && common.numFixed(star, 1) <= 2.5}}">
<block wx:for="{{[1, 2]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_full.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[3]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_half.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[4, 5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_blank.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:elif="{{common.numFixed(star, 1) > 1.5 && common.numFixed(star, 1) <= 2.0}}">
<block wx:for="{{[1, 2]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_full.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[3, 4, 5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_blank.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:elif="{{common.numFixed(star, 1) > 1.0 && common.numFixed(star, 1) <= 1.5}}">
<block wx:for="{{[1]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_full.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[2]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_half.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[3, 4, 5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_blank.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:elif="{{common.numFixed(star, 1) > 0.5 && common.numFixed(star, 1) <= 1.0}}">
<block wx:for="{{[1]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_full.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[2, 3, 4, 5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_blank.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:elif="{{common.numFixed(star, 1) > 0 && common.numFixed(star, 1) <= 0.5}}">
<block wx:for="{{[1]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_half.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
<block wx:for="{{[2, 3, 4, 5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_blank.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
<block wx:else>
<block wx:for="{{[1, 2, 3, 4 , 5]}}" wx:for-item="value" wx:key="{{index}}">
<image class="star-img {{large == true ? 'large' : ''}}" src='/images/star/icon_star_blank.png' mode='widthFix' data-v="{{value}}" catchtap='_tapStar'></image>
</block>
</block>
</view>
</view>
\ No newline at end of file
/* components/comment-stars/index.wxss */
.star-wrapper {
display: inline-block;
position: relative;
}
.stars-content {
display: -webkit-box;
display: -webkit-flex;
display: flex;
align-items: center;
}
.star-img {
height: 9px;
width: 9px;
margin: 0px 2px 0px 1px;
}
.star-img.large {
height: 12px;
width: 12px;
margin: 1px 5px 1px 0;
}
// components/comment/Index.js
import api from '../../utils/Api.js'
const Util = require('../../utils/Util.js')
Component({
/**
* 组件的属性列表
*/
properties: {
courseId: {
type: Number
}
},
/**
* 组件的初始数据
*/
data: {
star: 0,
content: ''
},
/**
* 组件的方法列表
*/
methods: {
/**
* 点击star
*/
tapStar(event) {
this.setData({
star: parseInt(event.detail.dataset.v)
})
},
/**
* 评论输入
*/
bindContentChange(event) {
this.setData({
content: event.detail.value
})
},
/**
* 取消
*/
_tapCancel(event) {
let that = this
that.triggerEvent('cancel', event)
},
/**
* 确定
*/
_tapConfirm(event) {
let that = this
let ret = that._verifyData()
if (ret.error) {
wx.showToast({
title: ret.msg,
})
return
}
that._postCommentData(function (res) {
that.triggerEvent('confirm', { ...event, data: res.data })
})
},
/**
* 验证数据
*/
_verifyData() {
let that = this
if (that.data.star <= 0) {
return { error: 1, msg: '请打分' }
}
if (!that.data.content || that.data.content.length <= 0) {
return { error: 1, msg: '请输入评论' }
}
return { error: 0 }
},
/**
* 提交评论数据
*/
_postCommentData(callback) {
let that = this
let params = {
order_id: that.data.courseId,
grade: that.data.star,
content: that.data.content
}
api.me.submitCommit(params).then(res => {
if (res.code) {
wx.showToast({
title: res.msg,
})
} else {
wx.showToast({
title: res.msg,
})
typeof callback == "function" && callback(res)
}
})
}
}
})
{
"component": true,
"usingComponents": {
"stars": "/components/comment-stars/index"
}
}
\ No newline at end of file
<!--components/comment/Index.wxml-->
<view class='modal-wrapper'>
<view class='modal-content'>
<view class='modal-hd'>
<view class='modal-hd__title'>撰写评价</view>
</view>
<view class='modal-bd modal-cells'>
<view class='modal-cell'>
<view class='modal-cell-bd'>
<text class='modal-cell-bd__text'>活动评分</text>
<stars class="modal-stars" large="{{true}}" bind:tap="tapStar" star="{{star}}" />
</view>
</view>
<view class='modal-cell'>
<view class='modal-cell-bd input'>
<textarea class='modal-cell-input' placeholder='说写下您对此次活动的评价和感受~' placeholder-class='modal-cell-placeholder' value="{{content}}" bindinput='bindContentChange'></textarea>
</view>
</view>
</view>
<view class='modal-ft'>
<view class='modal-ft-btn_wrapper'>
<button class='modal-ft-btn cancel' catchtap='_tapCancel'>取消</button>
</view>
<view class='modal-ft-btn_wrapper'>
<button class='modal-ft-btn sure' catchtap='_tapConfirm'>确定</button>
</view>
</view>
</view>
</view>
\ No newline at end of file
/* components/comment/Index.wxss */
.modal-wrapper {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.9);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
}
.modal-content {
position: relative;
top: -12%;
width: 86%;
background-color: #fff;
border-radius: 10px;
-webkit-transform: translateZ(0);
transform: translateZ(0);
-webkit-mask-image: -webkit-radial-gradient(circle, white 100%, black 100%);
}
.modal-hd {
background-color:rgb(41, 163, 215);
box-sizing: border-box;
padding: 17.5px 0;
text-align: center;
}
.modal-hd__title {
font-family: HiraginoSansGB-W3;
font-size: 16px;
font-weight: normal;
font-stretch: normal;
line-height: 16px;
letter-spacing: 0px;
color: #fff;
}
.modal-bd {
box-sizing: border-box;
padding: 5px 10px 0 10px;
}
.modal-cell {
display: flex;
align-items: center;
margin-top: 10px;
}
.modal-cell-bd {
flex: 1;
}
.modal-cell-bd__text {
font-family: HiraginoSansGB-W3;
font-size: 12px;
font-weight: normal;
font-stretch: normal;
line-height: 12px;
letter-spacing: 0px;
color: rgba(153, 153, 153, 0.9);
}
.modal-stars {
margin-left: 8px;
vertical-align: middle;
}
.modal-cell-bd.input {
border-radius: 6px;
box-sizing: border-box;
padding: 8px 10px;
border: solid 1px #e5e5e5;
}
.modal-cell-input, .modal-cell-placeholder {
font-family: HiraginoSansGB-W3;
font-size: 12px;
font-weight: normal;
font-stretch: normal;
line-height: 12px;
letter-spacing: 0px;
color: #999;
}
.modal-cell-input {
width: 100%;
height: 90px;
}
.modal-ft {
box-sizing: border-box;
padding: 15px 0;
display: flex;
align-items: center;
}
.modal-ft-btn_wrapper {
flex: 1;
text-align: left;
box-sizing: border-box;
padding: 0 20px;
}
.modal-ft .modal-ft-btn_wrapper:first-child {
text-align: right;
}
.modal-ft-btn {
box-sizing: border-box;
padding: 10px 36px;
display: inline-block;
font-family: HiraginoSansGB-W3;
font-size: 14px;
font-weight: normal;
font-stretch: normal;
line-height: 14px;
letter-spacing: 0px;
}
.modal-ft-btn.sure {
background-color: #1993D0;
color: #fff;
border: solid 1px #1993D0;
}
.modal-ft-btn.cancel {
background-color: #fff;
color: #1993D0;
border: solid 1px #1993D0;
}
// components/project-item/index.js
const projectBehavior = require('../../behaviors/project.js')
Component({
behaviors: [projectBehavior],
/**
* 组件的属性列表
*/
......
<!--components/project-item/index.wxml-->
<view class="project-item">
<view class="project-item" catchtap='__gotoProjectDetail' data-pid="{{projectItem.id}}">
<image class="prj-poster" src="{{projectItem.poster==''?'/images/personal_center/info_background.png':projectItem.poster}}" mode="scaleToFill"></image>
<view class="prj-info">
<text class='ptitle'>{{projectItem.title}}</text>
......
......@@ -192,5 +192,12 @@ Page({
}).then(res => {
console.log(res)
})
},
// 立即报名
enrollClick: function(){
wx.navigateTo({
url: '/pages/detail/enroll/index?id=' + this.data.id,
})
}
})
\ No newline at end of file
......@@ -70,7 +70,7 @@
<text class='title'>分享</text>
</button>
</view>
<view class='actions-section btn-wrapper'>立即报名</view>
<view class='actions-section btn-wrapper' catchtap='enrollClick'>立即报名</view>
</view>
</view>
<i-toast id="toast" />
......
// pages/guide/index.js
import api from '../../utils/Api.js'
import Config from '../../utils/Config.js'
import Schedule from '../../utils/Schedule.js'
Page({
......@@ -83,10 +84,18 @@ Page({
},
handleDetail: function(event) {
const url = event.currentTarget.dataset.url
// 查看攻略详情
handleGuideDetail: function(event) {
let type = event.currentTarget.dataset.type
let content = event.currentTarget.dataset.content
let url = Config.mobPath
if (type == '1') {
url = url + "Guide/read/id/" + content
} else {
url = content
}
wx.navigateTo({
url: '/pages/webview/index?url=' + url,
url: '/pages/webview/index?url=' + url + '&t=攻略详情',
})
},
......
<!--pages/guide/index.wxml-->
<view class='v-page'>
<view class='guides-container'>
<view class="guide-wrapper" wx:for="{{guides}}" wx:for-item="n" wx:key="n.id" catchtap='handleDetail' data-url="{{n.content}}">
<view class="guide-wrapper" wx:for="{{guides}}" wx:for-item="n" wx:key="n.id" catchtap='handleGuideDetail' data-content="{{n.type=='1'?n.id:n.content}}" data-type="{{n.type}}">
<image class='image' src="{{n.poster}}" mode='aspectFill'></image>
<view class='info'>
<view class='text-small intro'>{{n.intro ? n.intro : ''}}</view>
......
......@@ -40,6 +40,10 @@
.guide-wrapper .info .intro {
font-size: 14px;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
.guide-wrapper .info .tag {
......
// pages/index.js
import api from '../../utils/Api.js'
import Config from '../../utils/Config.js'
const app = getApp()
Page({
......@@ -121,5 +123,21 @@ Page({
wx.navigateTo({
url: '/pages/detail/index?id=' + id,
})
},
// 查看攻略详情
handleGuideDetail: function(event) {
let type = event.currentTarget.dataset.type
let content = event.currentTarget.dataset.content
let url = Config.mobPath
if (type == '1') {
url = url + "Guide/read/id/" + content
} else {
url = content
}
wx.navigateTo({
url: '/pages/webview/index?url=' + url + '&t=攻略详情',
})
}
})
\ No newline at end of file
<!--pages/index.wxml-->
<wxs src="../common.wxs" module="common"></wxs>
<view class='v-page'>
<banner banners="{{banners}}" />
<navs />
......@@ -13,8 +15,8 @@
<image class='image' src="{{n.poster}}" mode='aspectFill'></image>
<view class='title'>{{n.title}}</view>
<view class='info'>
<text class='text-red text-small mergin-right-2'>¥ {{n.price}}</text>
<text>/{{n.night_num}}晚</text>
<text class='text-red text-small mergin-right-2'>¥{{common.numFixed(n.vip_price, 0)}}</text>
<text>/{{n.night_num}}晚</text>
</view>
</view>
</i-col>
......@@ -31,8 +33,8 @@
<image class='image' src="{{n.poster}}" mode='aspectFill'></image>
<view class='title'>{{n.title}}</view>
<view class='info'>
<text class='text-red text-small mergin-right-2'>¥ {{n.price}}</text>
<text>/{{n.night_num}}晚</text>
<text class='text-red text-small mergin-right-2'>¥{{common.numFixed(n.vip_price, 0)}}</text>
<text>/{{n.night_num}}晚</text>
</view>
</view>
</i-col>
......@@ -49,8 +51,8 @@
<image class='image' src="{{n.poster}}" mode='aspectFill'></image>
<view class='title'>{{n.title}}</view>
<view class='info'>
<text class='text-red text-small mergin-right-2'>¥ {{n.price}}</text>
<text>/{{n.night_num}}晚</text>
<text class='text-red text-small mergin-right-2'>¥{{common.numFixed(n.vip_price, 0)}}</text>
<text>/{{n.night_num}}晚</text>
</view>
</view>
</i-col>
......@@ -62,7 +64,7 @@
<text slot="footer" class='text-gray text-small'>更多</text>
</i-cell>
<view class="guides-wrapper">
<view class='guide-item' wx:for="{{guides}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id">
<view class='guide-item' wx:for="{{guides}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id" data-content="{{n.type=='1'?n.id:n.content}}" data-type="{{n.type}}" catchtap='handleGuideDetail'>
<image class='image' src="{{n.poster}}" mode='aspectFill'></image>
<view class='info'>
<view class='text-small intro'>{{n.intro ? n.intro : ''}}</view>
......
......@@ -91,4 +91,8 @@ page {
.guide-item .info .intro {
font-size: 14px;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
}
......@@ -57,5 +57,13 @@ Page({
wx.navigateTo({
url: '/pages/webview/index?url=' + Config.shopJoinPath,
})
},
// 我的订单
handleOrderClick: function (event) {
let status = event.currentTarget.dataset.status
wx.navigateTo({
url: '/pages/me/order/index?status=' + status,
})
}
})
\ No newline at end of file
......@@ -6,8 +6,8 @@
<view class='avatar_box'>
<image src='{{user.avatar}}' bindtap="toUrl" data-url='/pages/me/profile/index'></image>
</view>
<view class='user-info-box' >
<image wx-if="{{user.is_vip==1}}" src='/images/personal_center/vip.png' ></image>
<view class='user-info-box'>
<image wx-if="{{user.is_vip==1}}" src='/images/personal_center/vip.png'></image>
<text>{{user.nickname}}</text>
</view>
</view>
......@@ -19,19 +19,19 @@
</i-cell>
<i-row i-class="order-status-box">
<i-col span="8" i-class="col-class">
<view class='order-item'>
<view class='order-item' catchtap='handleOrderClick' data-status='1'>
<image src='/images/personal_center/icon_be_in_progress.png'></image>
<text>进行中</text>
</view>
</i-col>
<i-col span="8" i-class="col-class">
<view class='order-item'>
<view class='order-item' catchtap='handleOrderClick' data-status='2'>
<image src='/images/personal_center/icon_to_be_evaluated.png'></image>
<text>待评价</text>
</view>
</i-col>
<i-col span="8" i-class="col-class">
<view class='order-item'>
<view class='order-item' catchtap='handleOrderClick' data-status='3'>
<image src='/images/personal_center/icon_completed.png'></image>
<text>已完成</text>
</view>
......
// pages/me/order/index.js
Page({
// pages/prjlist/list.js
import api from '../../../utils/Api.js'
import Wx from '../../../utils/Wx.js'
import Schedule from '../../../utils/Schedule.js'
const {
$Toast
} = require('../../../iview/base/index');
Page({
/**
* 页面的初始数据
*/
data: {
orders: [],
currentPage: 1,
loading: true,
hasMore: true,
status: 1,
cur_oid: 0,
// 评论Modal
commentModal: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let _status = options.status
if (_status != null && _status.length > 0) {
this.setData({
status: _status
})
}
this.getListData()
},
/**
* 加载
*/
getListData: function (callback) {
const p = this.data.currentPage
let params = {
p: p,
status: this.data.status
}
// 请求数据接口
api.me.orders(params).then(res => {
if (res.code) {
this.setData({
hasMore: false,
loading: false,
currentPage: 2
})
} else {
let _orders = this.data.orders
this.setData({
orders: _orders.concat(res.data),
loading: false,
hasMore: res.data && res.data.length > 0 ? true : false,
currentPage: res.data && res.data.length > 0 ? p : (p - 1)
})
typeof callback == "function" && callback()
}
})
},
/**
......@@ -47,14 +98,39 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
orders: [],
loading: true,
hasMore: true,
currentPage: 1
})
wx.showNavigationBarLoading()
wx.showLoading({
title: '加载中...',
})
new Schedule().task(this.getListData).delay(500).task(() => {
wx.hideNavigationBarLoading()
wx.stopPullDownRefresh()
wx.hideLoading()
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let that = this
if (that.data.loading || !that.data.hasMore) {
return;
} else {
let page = that.data.currentPage + 1
new Schedule().task(() => {
that.setData({
loading: true,
currentPage: page
})
}).delay(1000).task(that.getListData)
}
},
/**
......@@ -62,5 +138,118 @@ Page({
*/
onShareAppMessage: function () {
},
/**
* 点击进入项目详情页
*/
handleProjectClick: function(event){
let pid = event.currentTarget.dataset.pid
wx.navigateTo({
url: '/pages/detail/index?id=' + pid,
})
},
/**
* 切换Tab
*/
handleChange: function (event) {
let status = event.detail.key.replace('status-', '')
this.setData({
status: status.replace('status-', '')
})
wx.startPullDownRefresh()
},
/**
* 申请退款
*/
_applyRefund: function (id) {
wx.showLoading({
title: '申请中...',
})
let params = {
id: id
}
// 请求数据接口
api.me.applyRefund(params).then(res => {
wx.hideLoading()
if (res.code) {
$Toast({
content: res.msg,
type: 'error'
});
} else {
wx.startPullDownRefresh()
$Toast({
content: res.msg,
type: 'success'
});
}
})
},
/**
* 按钮点击事件
*/
handleBtnClick: function (event) {
let that = this
let isrefund = event.currentTarget.dataset.isrefund
let iscomment = event.currentTarget.dataset.iscomment
let oid = event.currentTarget.dataset.oid
let status = this.data.status
console.log(oid, status, isrefund, iscomment)
if(status==1){
// 进行中
if(isrefund==0){
wx.showModal({
title: '提示',
content: '申请退款后需要官方审核成功才能退款,退款则表示取消此次订单,确定退款吗?',
success: function (res){
if(res.confirm){
// 提交退款申请,然后刷新列表
that._applyRefund(oid)
}
}
})
}
}else if(status=2){
// 待评价
if (iscomment == 0) {
this.setData({
commentModal: true,
cur_oid:oid
})
}
} else if (status = 3) {
// 已完成
}
},
/**
* 评论Modal取消事件
*/
commentCancel() {
this.setData({
commentModal: false
})
},
/**
* 评论Modal确定事件
*/
commentConfirm(event) {
// 设置页面滚动到顶部,防止触发 onReachBottom 事件
wx.pageScrollTo({
scrollTop: 0,
duration: 0
})
this.setData({
commentModal: false,
currentPage: 1
})
wx.startPullDownRefresh()
}
})
\ No newline at end of file
{
"navigationBarTitleText": "我的订单",
"backgroundColor": "#f5f5f5",
"enablePullDownRefresh": true,
"usingComponents": {
"i-tabs": "/iview/tabs/index",
"i-tab": "/iview/tab/index",
"i-row": "/iview/row/index",
"i-col": "/iview/col/index",
"i-button": "/iview/button/index"
"i-toast": "/iview/toast/index",
"i-button": "/iview/button/index",
"more": "/components/more/index",
"comment": "/components/comment/index"
}
}
\ No newline at end of file
<view class='v-page'>
<i-tabs current="tab1" bindchange="handleChange" i-class='margin-bottom'>
<i-tab key="tab1" title="进行中"></i-tab>
<i-tab key="tab2" title="待评价"></i-tab>
<i-tab key="tab3" title="已完成"></i-tab>
<i-tabs current="status-{{status}}" bindchange="handleChange" i-class='margin-bottom'>
<i-tab key="status-1" title="进行中" data-status="1"></i-tab>
<i-tab key="status-2" title="待评价" data-status="1"></i-tab>
<i-tab key="status-3" title="已完成" data-status="1"></i-tab>
</i-tabs>
<view class='order-box'>
<view class='order-item'>
<view class='order-item' wx:for="{{orders}}" wx:for-index="idx" wx:for-item="item" wx:key="item.id">
<i-row>
<i-col span="24" offset='2' i-class="col-class text">
<text>2018-08-9 12:30</text>
<text>{{item.created_at}}</text>
</i-col>
<i-col span="20" offset='2' i-class="col-class text order-content">
<i-row>
<view catchtap="handleProjectClick" data-pid="{{item.id}}">
<i-col span="8" offset='1' i-class='order-info'>
<image class='order-image' src='/images/personal_center/info_background.png'></image>
<image class='order-image' src='{{item.project.poster}}'></image>
</i-col>
<i-col span="9" offset='1' i-class='order-info'>
<view>亲子游泳体验</view>
<view>¥420.00</view>
<view>{{item.title}}</view>
<view>¥{{item.total_fee}}0</view>
</i-col>
<i-col span="2" offset='2' i-class='order-info'>
<image class='order-right' src='/images/icon_right.png'></image>
</i-col>
</i-row>
</i-col>
<i-col span="5" offset='17' i-class="col-class text order-button">
<button class='button button-orange'>申请退款</button>
</i-col>
</i-row>
</view>
<view class='order-item'>
<i-row>
<i-col span="24" offset='2' i-class="col-class text">
<text>2018-08-9 12:30</text>
</i-col>
<i-col span="20" offset='2' i-class="col-class text order-content">
<i-row>
<i-col span="8" offset='1' i-class='order-info'>
<image class='order-image' src='/images/personal_center/info_background.png'></image>
</i-col>
<i-col span="9" offset='1' i-class='order-info'>
<view>亲子游泳体验</view>
<view>¥420.00</view>
</i-col>
<i-col span="2" offset='2' i-class='order-info'>
<image class='order-right' src='/images/icon_right.png'></image>
</i-col>
</i-row>
</i-col>
<i-col span="6" offset='16' i-class="col-class text order-button">
<button class='button button-gray'>退款申请中</button>
<i-col span="5" offset='17' i-class="col-class text order-button">
<button class='button {{item.is_refund!="0"?"button-gray":"button-orange"}} {{item.is_comment!="0"?"button-gray":"button-orange"}}' catchtap='handleBtnClick' data-isrefund="{{item.is_refund}}" data-iscomment="{{item.is_comment}}" data-oid="{{item.id}}">{{item.status_text}}</button>
</i-col>
</i-row>
</view>
</view>
<comment wx:if="{{commentModal}}" course-id="{{cur_oid}}" bind:confirm="commentConfirm" bind:cancel="commentCancel" />
<more hasMore="{{hasMore}}" loading="{{loading}}" page="{{currentPage}}" />
</view>
<i-toast id="toast" />
\ No newline at end of file
......@@ -32,10 +32,11 @@ page {
}
.button {
font-size: 20rpx;
font-size: 24rpx;
border-radius: 50rpx;
background-color: #fff;
line-height: 60rpx;
padding: 0 0;
}
.order-info{
......
......@@ -8,7 +8,6 @@ const {
const app = getApp()
Page({
/**
* 页面的初始数据
*/
......@@ -16,7 +15,7 @@ Page({
user: {},
nickname: '',
genders: ["未知", "男", "女"],
genders: ["", "男", "女"],
gender: 0,
phone: ''
},
......
<!--pages/prjlist/list.wxml-->
<view class="page-wrapper">
<view class="projects-wrapper">
<project-item wx:for="{{projects}}" wx:for-index="idx" wx:for-item="item" wx:key="n.id" project-item="{{item}}" />
<project-item wx:for="{{projects}}" wx:for-index="idx" wx:for-item="item" wx:key="item.id" project-item="{{item}}" />
</view>
<i-toast id="toast" />
</view>
......
......@@ -78,10 +78,6 @@ Page({
loading: false,
currentPage: 2
})
$Toast({
content: res.msg,
type: 'error'
})
} else {
let _projects = this.data.projects
this.setData({
......
......@@ -2,7 +2,7 @@
<view class="page-wrapper">
<view class="projects-wrapper">
<project-item wx:for="{{projects}}" wx:for-index="idx" wx:for-item="item" wx:key="n.id" project-item="{{item}}" />
<project-item wx:for="{{projects}}" wx:for-index="idx" wx:for-item="item" wx:key="item.id" project-item="{{item}}" />
</view>
<i-toast id="toast" />
</view>
......
......@@ -37,7 +37,7 @@
"list": []
},
"miniprogram": {
"current": 16,
"current": 3,
"list": [
{
"id": 0,
......@@ -60,7 +60,7 @@
{
"id": 3,
"name": "搜索",
"pathName": "pages/search/search/search",
"pathName": "pages/search/index",
"query": ""
},
{
......@@ -140,6 +140,12 @@
"name": "预约下次",
"pathName": "pages/detail/appoint/index",
"query": "id=1"
},
{
"id": -1,
"name": "我的订单",
"pathName": "pages/me/order/index",
"query": ""
}
]
}
......
......@@ -46,6 +46,15 @@ export const me = {
collections: params => {
return req.post('user/userCollections', params).then(res => res.data)
},
orders: params => {
return req.post('order/index', params).then(res => res.data)
},
applyRefund: params => {
return req.post('order/refundSubmit', params).then(res => res.data)
},
submitCommit: params => {
return req.post('Comment/insert', params).then(res => res.data)
},
vipPrice: params => {
return req.post('order/getVipPrice', params).then(res => res.data)
},
......
export const Config = {
apiPath: "http://app.maveler.com/api/",
shopJoinPath: "http://app.maveler.com/mob/Index/index"
apiPath: "https://app.maveler.com/api/",
mobPath: "https://app.maveler.com/mob/",
shopJoinPath: "https://app.maveler.com/mob/Index/shopjoin"
}
export default Config
\ No newline at end of file
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