124 lines
3.2 KiB
JavaScript
124 lines
3.2 KiB
JavaScript
![]() |
import {url} from '../request'
|
||
|
Page({
|
||
|
data: {
|
||
|
|
||
|
},
|
||
|
onLoad(options) {
|
||
|
const businessName =options.businessName
|
||
|
const businessAvatar = options.businessAvatar
|
||
|
const manicuristName = options.manicuristName
|
||
|
const manicuristid = options.manicuristid
|
||
|
const manicuristAvatar = options.manicuristAvatar
|
||
|
const businessId =options.businessId
|
||
|
const orderid = options.orderid
|
||
|
console.log('======>jieshoude ',orderid,businessId,manicuristAvatar,businessAvatar,manicuristid,businessName,manicuristName,);
|
||
|
this.setData({
|
||
|
businessName:businessName,
|
||
|
businessAvatar:businessAvatar,
|
||
|
manicuristName:manicuristName,
|
||
|
manicuristid:manicuristid,
|
||
|
manicuristAvatar:manicuristAvatar,
|
||
|
businessId:businessId,
|
||
|
orderid:orderid,
|
||
|
})
|
||
|
console.log(this.data.manicuristAvatar,this.data.manicuristName);
|
||
|
},
|
||
|
bindTextAreaBlur(e) {
|
||
|
this.setData({
|
||
|
inputtext:e.detail.value
|
||
|
})
|
||
|
console.log(this.data.inputtext);
|
||
|
},
|
||
|
onUpload(file) {
|
||
|
return new Promise((resolve, reject) => {
|
||
|
console.log('上传文件路径:', file); // 确保文件路径正确
|
||
|
my.uploadFile({
|
||
|
url: url + '/api/file/upload/server/not_login',
|
||
|
fileType: 'image',
|
||
|
name: 'file',
|
||
|
filePath: file.path,
|
||
|
formData: {
|
||
|
biz: 'card',
|
||
|
},
|
||
|
success: res => {
|
||
|
resolve(file.path);
|
||
|
console.log('上传成功:', res);
|
||
|
const cunchu = JSON.parse(res.data)
|
||
|
this.setData({
|
||
|
zhengshu:`${'http://'}${cunchu.data}`,
|
||
|
})
|
||
|
console.log(this.data.zhengshu,'hhhhhhhhhhhhhhh');
|
||
|
},
|
||
|
fail: (err) => {
|
||
|
console.log('上传失败:', err);
|
||
|
reject();
|
||
|
},
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
// 星级改变
|
||
|
handleChange(value) {
|
||
|
console.log(value);
|
||
|
this.setData({
|
||
|
value:value,
|
||
|
});
|
||
|
},
|
||
|
handleChangem(value) {
|
||
|
console.log(value);
|
||
|
this.setData({
|
||
|
valuemeijiashi:value,
|
||
|
});
|
||
|
},
|
||
|
tijiao(){
|
||
|
my.getStorage({
|
||
|
key: 'userInfo',
|
||
|
success: (res) => {
|
||
|
const userInfo = res.data;
|
||
|
this.setData({
|
||
|
id: userInfo.id, // 获取 id
|
||
|
});
|
||
|
|
||
|
if (userInfo && userInfo.cookie) {
|
||
|
my.request({
|
||
|
url: url + '/api/level/add',
|
||
|
method: 'POST',
|
||
|
data: {
|
||
|
businessId: this.data.businessId,
|
||
|
manicuristId: this.data.manicuristid,
|
||
|
manicuristRating: this.data.valuemeijiashi,
|
||
|
orderId: this.data.orderid,
|
||
|
rating: this.data.value,
|
||
|
review: this.data.inputtext,
|
||
|
userId: this.data.id
|
||
|
},
|
||
|
headers: {
|
||
|
'content-type': 'application/json',
|
||
|
},
|
||
|
dataType: 'json',
|
||
|
success: (res) => {
|
||
|
console.log(res);
|
||
|
if (res.data.code === 0) {
|
||
|
console.log(res);
|
||
|
my.alert({content:'评价成功'})
|
||
|
my.navigateBack();
|
||
|
}
|
||
|
},
|
||
|
fail: (error) => {
|
||
|
my.alert({ content: '评价失败' });
|
||
|
},
|
||
|
});
|
||
|
} else {
|
||
|
my.alert({
|
||
|
content: '您未登录,请先登录。',
|
||
|
success: () => {
|
||
|
my.navigateTo({
|
||
|
url: '/pages/denglu/denglu',
|
||
|
});
|
||
|
},
|
||
|
});
|
||
|
}
|
||
|
},
|
||
|
});
|
||
|
},
|
||
|
});
|