小程序完善

This commit is contained in:
Vinjor 2024-10-14 18:06:55 +08:00
parent c39ae9419e
commit 6ad7a2ea20
8 changed files with 158 additions and 39 deletions

View File

@ -59,6 +59,7 @@
import VNavigationBar from '@/components/VNavigationBar.vue'
import request from "../../utils/request";
import config from "@/config";
import {setJSONData} from '@/utils/auth'
export default {
components: {
tabBarVue,
@ -149,9 +150,10 @@
})
},
gotoShopDetail(row) {
setJSONData("shopInfo",row)
//
uni.navigateTo({
url: '/pages-shop/shopDetail/shopDetail?info=' + encodeURIComponent(JSON.stringify(row))
url: '/pages-shop/shopDetail/shopDetail?id='+row.id
})
},
gotoPage(menu) {

View File

@ -3,24 +3,26 @@
<v-navigation-bar background-color="#fff" title-color="#333" title="我的评价"></v-navigation-bar>
<view class="body">
<view v-for="(item, index) in evaluateList" :key="index" class="item">
<view class="date">07-06</view>
<view class="date">{{ item.commentTime }}</view>
<view class="message">
<!-- 这家修理厂的喷漆工艺非常不错特别均匀师傅也很细心如果您需要做喷漆或者维修服务不要错过这里-->
{{item.commentDesc}}
</view>
<view class="rate">
<!-- 设置尺寸大小 -->
<uni-rate allow-half :value="item.commentStar"/>
<uni-rate :readonly="true" allow-half :value="item.commentStar"/>
</view>
<view class="shopInfo">
<image class="shopImg" :src="item.image" mode="aspectFill"></image>
<view class="shopInfo_content">
<!-- <view class="shopName">顺捷汽车维修搭电救援补胎中心</view>-->
<view class="shopName">{{ item.tenantName }}</view>
<!-- <view class="shopAddress">济南市历下区福瑞达历下护理院东南门旁</view>-->
<view class="shopAddress">{{ item.goodsTitle }}</view>
</view>
</view>
</view>
<view class="no-data" v-if="evaluateList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
</view>
</view>
</template>
@ -47,6 +49,26 @@
this.getAppraisePage()
},
methods:{
/**
* 时间戳转文字
* */
timestampToDate(timestamp) {
let date = new Date(timestamp); // Date
let year = date.getFullYear(); //
let month = date.getMonth() + 1; // +10
let day = date.getDate(); //
let hours = date.getHours(); //
let minutes = date.getMinutes(); //
let seconds = date.getSeconds(); //
//
month = month < 10 ? '0' + month : month;
day = day < 10 ? '0' + day : day;
hours = hours < 10 ? '0' + hours : hours;
minutes = minutes < 10 ? '0' + minutes : minutes;
seconds = seconds < 10 ? '0' + seconds : seconds;
// yyyy-MM-dd HH:mm:ss
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; //
},
async getAppraisePage(){
const res = await request({
url: "/userClient/repair/order/getAppraise",
@ -58,6 +80,7 @@
})
this.evaluateList = res.data.records
this.evaluateList.forEach(item => {
item.commentTime = this.timestampToDate(item.commentTime)
item.image = require("../static/inImage.jpg")
})
}
@ -130,5 +153,8 @@
color: #666666;
}
}
.no-data{
text-align: center;
}
}
</style>

View File

@ -15,7 +15,7 @@
<text>服务评价</text>
<uni-rate allow-half="true" v-model="formData.commentStar"></uni-rate>
</view>
<textarea class="message" v-model="formData.commentDesc" placeholder="可在此输入当前维修厂的服务评价" />
<textarea class="message" v-model="formData.commentDesc" placeholder="请输入本次服务的评价或建议!" />
<view class="submit" @click="submit">提交评价</view>
</view>
</view>
@ -46,14 +46,34 @@
},
methods: {
submit() {
this.formData['id'] = this.info.id
request({
url: "/userClient/repair/order/appraise",
method: "post",
data: this.formData
}).then(res => {
uni.navigateBack()
}).catch(()=>{})
if(null==this.formData.commentStar || ""==this.formData.commentStar){
uni.showToast({
title: '请对本次服务打分!',
icon: 'none'
})
}else if(null==this.formData.commentDesc || ""==this.formData.commentDesc){
uni.showToast({
title: '请输入本次服务的评价或建议!',
icon: 'none'
})
}else{
this.formData['id'] = this.info.id
request({
url: "/userClient/repair/order/appraise",
method: "post",
data: this.formData
}).then(res => {
uni.showToast({
title: '评价成功!',
icon: 'none'
})
setTimeout(()=>{
uni.navigateBack()
},500)
}).catch(()=>{
uni.navigateBack()
})
}
}
}
}
@ -113,6 +133,7 @@
.message {
padding: 30rpx 0;
height: 400rpx;
width: 100%;
}
.submit {
width: 510rpx;

View File

@ -39,10 +39,12 @@
<view class="line3">
<view v-if="item.orderStatus == '0'" @click="goPay(item)" class="showOrder">支付</view>
<view v-if="item.goodsType == '2'" @click="gotoDetail(item)" class="showOrder">查看订单</view>
<view @click="gotoEvaluate(item)" class="evaluate" v-if="item.goodsType == '2' && item.orderStatus === '1' && !item.commentDesc">评价订单</view>
<view @click="gotoEvaluate(item)" class="evaluate" v-if="item.orderStatus === '1' && !item.commentDesc">评价订单</view>
</view>
</view>
<view class="no-data" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
</view>
<uni-popup ref="popup" type="center" border-radius="10px 10px 0 0" @change="popupChange">
@ -382,5 +384,8 @@ export default {
}
}
}
.no-data{
text-align: center;
}
}
</style>

View File

@ -66,21 +66,37 @@
</view>
</view>
<view class="footer">
<view class="btn" @click="gotoReservation">开始预约</view>
<view class="btn" @click="toggle('bottom')">开始预约</view>
</view>
<view>
<!-- 普通弹窗 -->
<uni-popup ref="popup" background-color="#fff">
<view :class="{ 'popup-height': type === 'left' || type === 'right' }">
<view class="popup-content">
<text class="text">{{info.corpName}}申请获取您的个人信息车辆信息</text>
</view>
<view class="popup-button">
<button type="default" @click="cancelReservation">取消</button>
<button type="primary" @click="gotoReservation">授权</button>
</view>
</view>
</uni-popup>
</view>
</view>
</template>
<script>
import VNavigationBar from '@/components/VNavigationBar.vue'
import request from "../../utils/request";
import {getToken} from '@/utils/auth.js'
import {getJSONData,getToken} from '@/utils/auth'
export default {
components: {
VNavigationBar
},
data() {
return {
type: 'center',
shopName:"",
// busiList: [{
// title: '',
// desc: '',
@ -103,24 +119,58 @@
};
},
onLoad(data) {
this.info = JSON.parse(decodeURIComponent(data.info))
if(data.id){
this.info = getJSONData("shopInfo")
}
},
onShow() {
this.getServer()
},
methods: {
/**
* 弹出层
* @param type 位置
*/
toggle(type) {
this.type = type
// open uni-popup type
this.$refs.popup.open(type)
},
/**
* 取消授权
*/
cancelReservation(){
this.$refs.popup.close()
},
//
gotoReservation() {
if(getToken()){
uni.navigateTo({
url: '/pages/myReservation/addReservation?info=' + encodeURIComponent(JSON.stringify(this.info))
})
//
uni.showLoading();
request({
url: "/app-api/base/user-car/empowerUserInfo",
method: 'get',
tenantIdFlag: false,
params:{tenantId:this.info.tenantId}
}).then(res=>{
uni.hideLoading();
if(res.code==200){
uni.navigateTo({
url: '/pages/myReservation/addReservation?id=' + this.info.id
})
}else{
uni.showToast({
title: '授权失败,请联系客户经理!',
icon: 'none'
})
}
})
}else{
//
uni.navigateTo({
url: '/pages/login/login'
})
}
},
//
async getServer() {
@ -360,3 +410,21 @@
}
}
</style>
<style lang="scss">
.popup-content {
@include flex;
align-items: center;
justify-content: center;
padding: 15px;
height: 50px;
background-color: #fff;
}
.popup-button {
@include flex;
align-items: center;
justify-content: center;
padding: 15px;
height: 50px;
background-color: #fff;
}
</style>

View File

@ -29,8 +29,8 @@
import VNavigationBar from '@/components/VNavigationBar.vue';
import request from "../../utils/request";
import config from "config";
import {getUserInfoRequest} from "@/utils/common.js";
import {getToken,setJSONData} from '@/utils/auth.js'
import {getUserInfoRequest} from "@/utils/common";
import {getToken,setJSONData} from '@/utils/auth'
export default {
computed: {

View File

@ -102,8 +102,7 @@
import request from '../../utils/request';
import VNavigationBar from '@/components/VNavigationBar.vue'
import config from "@/config";
import {getUserInfoRequest} from "@/utils/common.js";
import {getToken,getUserInfo} from '@/utils/auth.js'
import {getToken,getUserInfo,getJSONData} from '@/utils/auth'
export default {
components: {
@ -139,7 +138,7 @@
// }, ],
dateList:[],
chooseDate: '06-06',
chooseTime: '11:00',
chooseTime: '09:00',
timeList: [{
time: '09:00',
disabled: false
@ -183,28 +182,20 @@
};
},
onLoad(data){
this.info = JSON.parse(decodeURIComponent(data.info))
this.info = getJSONData("shopInfo")
this.formData.corpId = this.info.id
this.getServer(this.info.id)
this.initCarList()
this.initDateList()
},
onShow() {
if(!getToken()){
uni.reLaunch({
url: '/pages/login/login'
})
}else{
console.log("已登录")
this.getUserInfos()
}
this.initCarList()
this.initDateList()
},
methods: {
//
async getUserInfos() {
console.log("获取用户信息")
getUserInfo()
},
initDateList(){
const daysOfWeek = ['周日', '周一', '周二', '周三', '周四', '周五', '周六'];
const currentDate = new Date();

View File

@ -8,6 +8,9 @@
<reservationOrderVue v-for="(item, index) in orderList" :key="index" :orderInfo="item">
</reservationOrderVue>
</view>
<view class="no-data" v-if="orderList.length==0">
<image class="" src="@/static/images/nothing.png" ></image>
</view>
</scroll-view>
</view>
</view>
@ -119,5 +122,8 @@
flex-direction: column;
row-gap: 20rpx;
}
.no-data{
text-align: center;
}
}
</style>