Commit 25b37130 by zqm

MM-评价,倒计时优化

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