Merge pull request '评论接口对接' (#69) from Brunch_DBK into main

pull/73/head
pikvyz67s 1 month ago
commit 40f0f6abd6

@ -88,4 +88,8 @@ export const uploadImageApi = (parm) => {
//头像昵称更新 //头像昵称更新
export const saveOrUpdateApi = (parm) => { export const saveOrUpdateApi = (parm) => {
return http.post("/wxapi/wxUser/saveOrUpdate", parm) return http.post("/wxapi/wxUser/saveOrUpdate", parm)
}
//新增评论
export const addCommentApi = (parm) => {
return http.post("/wxapi/comment/addComment", parm)
} }

@ -49,7 +49,8 @@
<view class="bottom"> <view class="bottom">
<view @click="cancel(res,index)" v-if="res.status == '0'" class="exchange btn"> <view @click="cancel(res,index)" v-if="res.status == '0'" class="exchange btn">
</view> </view>
<view @click="commentBtn" v-if="res.status == '2'" class="evaluate btn"></view> <view @click="commentBtn(res)" v-if="res.status == '2'" class="evaluate btn">
</view>
</view> </view>
</view> </view>
<u-loadmore :status="loadStatus[index]" bgColor="#f2f2f2"></u-loadmore> <u-loadmore :status="loadStatus[index]" bgColor="#f2f2f2"></u-loadmore>
@ -61,7 +62,7 @@
<u-modal confirm-color="#F3AF28" :content-style="{padding: '10px'}" :show-cancel-button='true' title="评论" <u-modal confirm-color="#F3AF28" :content-style="{padding: '10px'}" :show-cancel-button='true' title="评论"
:zoom="false" v-model="show" @confirm='confirmBtn' @cancel="cancelBtn"> :zoom="false" v-model="show" @confirm='confirmBtn' @cancel="cancelBtn">
<view style="height: 100px;"> <view style="height: 100px;">
<textarea placeholder="请输入评论" auto-height /> <textarea v-model="commentText" placeholder="请输入评论" auto-height />
</view> </view>
</u-modal> </u-modal>
</view> </view>
@ -75,14 +76,20 @@
getOrderListApi, getOrderListApi,
cancelOrderApi cancelOrderApi
} from '../../api/order.js' } from '../../api/order.js'
import {
addCommentApi
} from '../../api/user.js'
import { import {
ref, ref,
computed computed
} from 'vue' } from 'vue'
// //
const show = ref(false) const show = ref(false)
const orderId = ref('')
const commentText = ref('')
// //
const commentBtn = () => { const commentBtn = (item) => {
orderId.value = item.orderId;
show.value = true show.value = true
} }
const tabs = ref(null); const tabs = ref(null);
@ -211,9 +218,24 @@
}); });
} }
// //
const confirmBtn = () => { const confirmBtn = async () => {
console.log('确定') console.log('确定')
show.value = false if (!commentText.value) {
uni.showToast({
icon: 'none',
title: '请填写评论'
})
return;
}
let res = await addCommentApi({
orderId: orderId.value,
openid: uni.getStorageSync('openid'),
commentText: commentText.value
})
if (res && res.code == 200) {
show.value = false
}
} }
// //
const cancelBtn = () => { const cancelBtn = () => {

Loading…
Cancel
Save