上传代码
This commit is contained in:
123
uniapp04/unpackage/dist/dev/mp-weixin/pages/orderEvaluation/orderEvaluation.js
vendored
Normal file
123
uniapp04/unpackage/dist/dev/mp-weixin/pages/orderEvaluation/orderEvaluation.js
vendored
Normal file
@ -0,0 +1,123 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const API_api = require("../../API/api.js");
|
||||
if (!Array) {
|
||||
const _easycom_uni_rate2 = common_vendor.resolveComponent("uni-rate");
|
||||
_easycom_uni_rate2();
|
||||
}
|
||||
const _easycom_uni_rate = () => "../../uni_modules/uni-rate/components/uni-rate/uni-rate.js";
|
||||
if (!Math) {
|
||||
_easycom_uni_rate();
|
||||
}
|
||||
const _sfc_main = {
|
||||
__name: "orderEvaluation",
|
||||
setup(__props) {
|
||||
const orderData = common_vendor.ref(null);
|
||||
common_vendor.ref(common_vendor.index.getStorageSync("userId"));
|
||||
const getOrder = () => {
|
||||
common_vendor.index.request({
|
||||
url: API_api.apiImageUrl + "/api/orders/get/my",
|
||||
method: "GET",
|
||||
data: {
|
||||
id: common_vendor.index.getStorageSync("evaluationOrderID")
|
||||
},
|
||||
success(res) {
|
||||
console.log(res.data.data);
|
||||
orderData.value = res.data.data;
|
||||
common_vendor.index.setStorageSync("orderData", orderData.value);
|
||||
showBusinessReview.value = true;
|
||||
showDeliveryReview.value = !!orderData.value.errandId;
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
}
|
||||
});
|
||||
};
|
||||
common_vendor.onMounted(() => {
|
||||
getOrder();
|
||||
});
|
||||
const rateValueBusiness = common_vendor.ref(0);
|
||||
const rateValueDelivery = common_vendor.ref(0);
|
||||
const reviewContentBusiness = common_vendor.ref("");
|
||||
const reviewContentDelivery = common_vendor.ref("");
|
||||
const showBusinessReview = common_vendor.ref(false);
|
||||
const showDeliveryReview = common_vendor.ref(false);
|
||||
const onChangeBusiness = (e) => {
|
||||
rateValueBusiness.value = e.value;
|
||||
};
|
||||
const onChangeDelivery = (e) => {
|
||||
rateValueDelivery.value = e.value;
|
||||
};
|
||||
const orderEvaluation = (isDelivery) => {
|
||||
const baseData = {
|
||||
orderId: orderData.value.id,
|
||||
// 订单ID
|
||||
userId: orderData.value.userId,
|
||||
// 用户ID
|
||||
rating: isDelivery ? rateValueDelivery.value : rateValueBusiness.value,
|
||||
review: isDelivery ? reviewContentDelivery.value : reviewContentBusiness.value
|
||||
};
|
||||
const requestData = {
|
||||
...baseData,
|
||||
ratedEntityId: isDelivery === 1 ? orderData.value.errandId : orderData.value.businessId,
|
||||
ratedEntityType: isDelivery ? 1 : 0
|
||||
};
|
||||
common_vendor.index.request({
|
||||
url: API_api.apiImageUrl + "/api/level/add",
|
||||
method: "POST",
|
||||
data: requestData,
|
||||
success(res) {
|
||||
console.log(res);
|
||||
if (res.data.code === 0) {
|
||||
common_vendor.index.showToast({
|
||||
title: "评价成功",
|
||||
icon: "success"
|
||||
});
|
||||
setTimeout(() => {
|
||||
common_vendor.index.navigateBack();
|
||||
}, 1500);
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: res.description,
|
||||
icon: "fail"
|
||||
});
|
||||
}
|
||||
},
|
||||
fail(err) {
|
||||
console.log(err);
|
||||
common_vendor.index.showToast({
|
||||
title: "提交失败",
|
||||
icon: "error"
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
return (_ctx, _cache) => {
|
||||
var _a, _b;
|
||||
return common_vendor.e({
|
||||
a: showBusinessReview.value
|
||||
}, showBusinessReview.value ? {
|
||||
b: common_vendor.o(onChangeBusiness),
|
||||
c: common_vendor.o(($event) => rateValueBusiness.value = $event),
|
||||
d: common_vendor.p({
|
||||
modelValue: rateValueBusiness.value
|
||||
}),
|
||||
e: reviewContentBusiness.value,
|
||||
f: common_vendor.o(($event) => reviewContentBusiness.value = $event.detail.value),
|
||||
g: common_vendor.o(($event) => orderEvaluation(0))
|
||||
} : {}, {
|
||||
h: showDeliveryReview.value && ((_a = orderData.value) == null ? void 0 : _a.errandId)
|
||||
}, showDeliveryReview.value && ((_b = orderData.value) == null ? void 0 : _b.errandId) ? {
|
||||
i: common_vendor.o(onChangeDelivery),
|
||||
j: common_vendor.o(($event) => rateValueDelivery.value = $event),
|
||||
k: common_vendor.p({
|
||||
modelValue: rateValueDelivery.value
|
||||
}),
|
||||
l: reviewContentDelivery.value,
|
||||
m: common_vendor.o(($event) => reviewContentDelivery.value = $event.detail.value),
|
||||
n: common_vendor.o(($event) => orderEvaluation(1))
|
||||
} : {});
|
||||
};
|
||||
}
|
||||
};
|
||||
wx.createPage(_sfc_main);
|
7
uniapp04/unpackage/dist/dev/mp-weixin/pages/orderEvaluation/orderEvaluation.json
vendored
Normal file
7
uniapp04/unpackage/dist/dev/mp-weixin/pages/orderEvaluation/orderEvaluation.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"navigationBarTitleText": "订单评价",
|
||||
"enablePullDownRefresh": false,
|
||||
"usingComponents": {
|
||||
"uni-rate": "../../uni_modules/uni-rate/components/uni-rate/uni-rate"
|
||||
}
|
||||
}
|
1
uniapp04/unpackage/dist/dev/mp-weixin/pages/orderEvaluation/orderEvaluation.wxml
vendored
Normal file
1
uniapp04/unpackage/dist/dev/mp-weixin/pages/orderEvaluation/orderEvaluation.wxml
vendored
Normal file
@ -0,0 +1 @@
|
||||
<view class="viewport"><view wx:if="{{a}}" class="center"><view class="title">评价商家</view><uni-rate wx:if="{{d}}" bindchange="{{b}}" class="rate" u-i="332c8fe4-0" bind:__l="__l" bindupdateModelValue="{{c}}" u-p="{{d}}"/><block wx:if="{{r0}}"><textarea class="review-content" placeholder="请输入商家评价内容" value="{{e}}" bindinput="{{f}}"></textarea></block><button class="submit-button" bindtap="{{g}}">提交商家评价</button></view><view wx:if="{{h}}" class="center"><view class="title">评价跑腿</view><uni-rate wx:if="{{k}}" bindchange="{{i}}" class="rate" u-i="332c8fe4-1" bind:__l="__l" bindupdateModelValue="{{j}}" u-p="{{k}}"/><block wx:if="{{r0}}"><textarea class="review-content" placeholder="请输入跑腿评价内容" value="{{l}}" bindinput="{{m}}"></textarea></block><button class="submit-button" bindtap="{{n}}">提交跑腿评价</button></view></view>
|
96
uniapp04/unpackage/dist/dev/mp-weixin/pages/orderEvaluation/orderEvaluation.wxss
vendored
Normal file
96
uniapp04/unpackage/dist/dev/mp-weixin/pages/orderEvaluation/orderEvaluation.wxss
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
page {
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background-color: #4095e5;
|
||||
}
|
||||
.active {
|
||||
float: left;
|
||||
width: 30%;
|
||||
height: 100%;
|
||||
}
|
||||
.img {
|
||||
margin: 15px;
|
||||
}
|
||||
.aboutMessage {
|
||||
float: right;
|
||||
width: 240px;
|
||||
height: 100%;
|
||||
}
|
||||
.aboutMessage .title {
|
||||
font-size: 20px;
|
||||
padding: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.aboutMessage .total {
|
||||
color: #999;
|
||||
padding-left: 10px;
|
||||
}
|
||||
.aboutMessage .money {
|
||||
color: #4095e5;
|
||||
padding: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.message {
|
||||
width: 90%;
|
||||
height: 100px;
|
||||
border-radius: 25px;
|
||||
background-color: #fff;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.viewport {
|
||||
width: 90%;
|
||||
height: 100vh;
|
||||
border-radius: 15px;
|
||||
background-color: #fff;
|
||||
margin: 0 auto;
|
||||
}
|
||||
.center {
|
||||
width: 80%;
|
||||
height: 350px;
|
||||
margin: 0 auto;
|
||||
padding-top: 20px;
|
||||
}
|
||||
.center .title {
|
||||
font-size: 20px;
|
||||
padding: 10px;
|
||||
font-weight: 700;
|
||||
}
|
||||
.review-content {
|
||||
margin-top: 20px;
|
||||
resize: none;
|
||||
height: 100px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.submit-button {
|
||||
background-color: #4095e5;
|
||||
color: white;
|
||||
padding: 8px 16px;
|
||||
border: none;
|
||||
line-height: 30px;
|
||||
border-radius: 30px;
|
||||
}
|
Reference in New Issue
Block a user