Commit 25b37130 by zqm

MM-评价,倒计时优化

parent 12350e31
......@@ -412,7 +412,12 @@ Page({
* @returns
*/
onOrderEvaluate: function (event) {
console.log(event.currentTarget.dataset, '----------------event.currentTarget.dataset');
let item = JSON.stringify(event.currentTarget.dataset.item)
wx.navigateTo({
url: `/pages/pay/order-comment/order-comment?orderItem=${item}`,
})
},
/**
* 缓存用户信息
......
......@@ -3,37 +3,31 @@ let App = getApp()
Page({
data: {
imageBase: App.globalData.appImageBase,
scoreServe: 0, // 服务分数
scoreServe: 0, // 服务分数
scoreServeText: '0.0',
scoreProduct: 0, // 产品分数
scoreProduct: 0, // 产品分数
scoreProductText: '0.0',
scoreEnvironment: 0, // 环境分数
scoreEnvironmentText: '0.0',
content: '', // 评价内容,
imgUrls: [], // 评价图片本地路径
content: '', // 评价内容,
imgUrls: [], // 评价图片本地路径
orderInfo: {
orderId: '02aaa9a62d5645c59109218c27d2174a',
name: '精灵鸟理想国年卡',
price: '1680.00',
quantity: 4,
coverList: [
{
id: 0,
imgUrl: ''
},
{
id: 1,
imgUrl: ''
},
{
id: 2,
imgUrl: ''
}
]
id: '',
name: '',
amount: '',
commodity: []
},
},
onLoad: function (options) {
console.log(options, '----------options------');
let orderItem = JSON.parse(options.orderItem)
this.setData({
orderInfo: orderItem
})
},
/**
/**
* 评价分数
* @function
* @param
......@@ -41,14 +35,21 @@ Page({
*/
onChangeScore: function (event) {
// type 1: 服务评价 2: 产品评价 3: 环境评价
const { index, type } = event.currentTarget.dataset
const {
index,
type
} = event.currentTarget.dataset
console.log(index, type)
let { scoreServe, scoreProduct, scoreEnvironment } = this.data
let {
scoreServe,
scoreProduct,
scoreEnvironment
} = this.data
switch (type) {
case 1:
scoreServe = index + 1
break
case 2:
case 2:
scoreProduct = index + 1
break
case 3:
......@@ -76,7 +77,7 @@ Page({
content
})
},
/**
/**
* 新增评价图片
* @function
* @param
......@@ -114,8 +115,8 @@ Page({
filePath: funcFile,
name: 'file',
header: {
'Content-Type': 'multipart/form-data',
'token': App.globalData.token
'Content-Type': 'multipart/form-data',
'token': App.globalData.token
},
success: (res) => {
const data = JSON.parse(res.data)
......@@ -130,9 +131,9 @@ Page({
// fileUrls
// })
let formData = {}
formData.orderId = this.data.orderInfo.orderId
formData.orderId = this.data.orderInfo.id
formData.imgUrls = fileUrls,
formData.serviceEvaluation = this.data.scoreServeText
formData.serviceEvaluation = this.data.scoreServeText
formData.productEvaluation = this.data.scoreProductText
formData.environmentalEvaluation = this.data.scoreEnvironmentText
formData.content = this.data.content
......@@ -149,10 +150,13 @@ Page({
},
success: (response) => {
console.log(response)
wx.navigateBack({
delta: 0,
})
}
})
}
})
}
})
\ No newline at end of file
<navigation class="navigation" titleText="订单评价" background="#ffffff" backIcon="/image/back.png"></navigation>
<view class="container con-s">
<view class="order-wrapper">
<view class="order-title">
<text>购买商品</text>
</view>
<view class="row align-c">
<block wx:for="{{orderInfo.coverList}}" wx:key="id">
<view class="order-cover">
<image src="{{item.imgUrl}}"></image>
</view>
</block>
<view class="order-wrapper">
<view class="order-title">
<text>购买商品</text>
</view>
<view class="row align-c">
<block wx:for="{{orderInfo.commodity}}" wx:key="id">
<view class="order-cover">
<image src="{{item.cover}}"></image>
</view>
</block>
<view class="order-name" wx:if="{{orderInfo.coverList.length === 1}}">
<text>{{orderInfo.name}}</text>
</view>
<view class="order-price-wrapper col align-e">
<view class="order-price">
<text class="price-symbol">¥</text>
<text>{{orderInfo.price}}</text>
</view>
<view class="order-quantity">
<text>{{'共' + orderInfo.quantity + '件'}}</text>
</view>
</view>
</view>
</view>
<view class="order-name" wx:if="{{orderInfo.commodity.length === 1}}">
<text>{{orderInfo.name}}</text>
</view>
<view class="order-price-wrapper col align-e">
<view class="order-price">
<text class="price-symbol">¥</text>
<text>{{orderInfo.amount}}</text>
</view>
<view class="order-quantity">
<text>{{'共' + orderInfo.commodity.length + '件'}}</text>
</view>
</view>
</view>
</view>
<view class="order-comment-wrapper">
<view class="order-comment-title">
<text>订单评价</text>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>服务评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{1}}">
<image wx:if="{{scoreServe >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreServe < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreServeText + '星'}}</text>
</view>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>产品评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{2}}">
<image wx:if="{{scoreProduct >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreProduct < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreProductText + '星'}}</text>
</view>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>环境评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{3}}">
<image wx:if="{{scoreEnvironment >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreEnvironment < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreEnvironmentText + '星'}}</text>
</view>
</view>
<view class="order-comment">
<l-textarea placeholder="您的评价与建议,会让园区做的更好" placeholder-style="color: #C2C7CF" maxlength="200" l-class="l-textarea" border="{{false}}" bind:linblur="eventInputDone" />
<view class="order-picker">
<l-image-picker l-item-class="l-image-item" l-class="l-picker" count="9" size="3" size-type="compressed" custom="{{true}}" bind:linchange="eventImageAdd" bind:linremove="eventImageRemove">
<view class="col con-c align-c">
<image class="icon-img"></image>
<text>添加图片</text>
</view>
</l-image-picker>
</view>
</view>
</view>
<view class="footer-wrapper">
<view class="comment-btn" bindtap="onSubmitCommennt">
<text>提交评价</text>
</view>
</view>
<view class="order-comment-wrapper">
<view class="order-comment-title">
<text>订单评价</text>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>服务评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{1}}">
<image wx:if="{{scoreServe >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreServe < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreServeText + '星'}}</text>
</view>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>产品评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{2}}">
<image wx:if="{{scoreProduct >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreProduct < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreProductText + '星'}}</text>
</view>
</view>
<view class="score-wrapper row align-c">
<view class="score-left">
<text>环境评价</text>
</view>
<view class="score-star row">
<block wx:for="{{5}}" wx:key="index">
<view class="star" bindtap="onChangeScore" data-index="{{index}}" data-type="{{3}}">
<image wx:if="{{scoreEnvironment >= index + 1}}" src="{{imageBase + 'star-yellow.png'}}"></image>
<image wx:elif="{{scoreEnvironment < index + 1}}" src="{{imageBase + 'star-gray.png'}}"></image>
</view>
</block>
</view>
<view class="score">
<text>{{scoreEnvironmentText + '星'}}</text>
</view>
</view>
<view class="order-comment">
<l-textarea placeholder="您的评价与建议,会让园区做的更好" placeholder-style="color: #C2C7CF" maxlength="200" l-class="l-textarea" border="{{false}}" bind:linblur="eventInputDone" />
<view class="order-picker">
<l-image-picker l-item-class="l-image-item" l-class="l-picker" count="9" size="3" size-type="compressed" custom="{{true}}" bind:linchange="eventImageAdd" bind:linremove="eventImageRemove">
<view class="col con-c align-c">
<image class="icon-img"></image>
<text>添加图片</text>
</view>
</l-image-picker>
</view>
</view>
</view>
<view class="footer-wrapper">
<view class="comment-btn" bindtap="onSubmitCommennt">
<text>提交评价</text>
</view>
</view>
</view>
\ No newline at end of file
......@@ -142,6 +142,7 @@
padding: 30rpx 40rpx 0;
background-color: #fff;
border-top: 1px solid #E2E7EF;
z-index: 5;
}
.comment-btn {
width: 670rpx;
......
......@@ -14,8 +14,8 @@ Page({
codeInfo: {},
isFromUse: false,
winCode: false,
residuePayTime: "",//剩余支付时间
residuePayTime: "", //剩余支付时间
},
onLoad: function (options) {
......@@ -39,6 +39,7 @@ Page({
* @returns
*/
queryOrderDetail: function () {
let that = this
App.wxRequest({
url: '/api/v1/order/getOrderDetail',
data: {
......@@ -75,23 +76,30 @@ Page({
funcOrderInfo.commodity.push(funcCommodityItem)
}
// 倒计时
let that = this
if (funcOrderInfo.state == 0) {
// 待付款状态
let doTime = 1 * 60 * 1000
let timeInter = setInterval(() => {
let creatdTime = new Date(funcOrderInfo.tipTimeSubmit.replace(/-/g, '/')).getTime()
let doTime = 15 * 60 * 1000
let endTime = creatdTime + doTime
let now = new Date().getTime()
let residueStamp = endTime - now
let residuePayTime = App.modular.miment(residueStamp).format('mm:ss') // 57
let residuePayTime = App.modular.miment(residueStamp).format('mm:ss')
if (residueStamp > 0) {
that.setData({
residuePayTime: residuePayTime
})
} else {
that.queryOrderDetail()
console.log(residueStamp, 'residueStamp----------------');
clearInterval(timeInter)
// that.queryOrderDetail()
let state = `orderInfo.state`
that.setData({
[state]: -1
})
}
}, 1000)
......@@ -110,7 +118,7 @@ Page({
})
},
onCouponCode: function (event) {
let funcOrderInfo = event.currentTarget.dataset.item
......
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 sign in to comment