增加订单评价

This commit is contained in:
TOP糯米 2023-03-28 22:40:31 +08:00
parent aae15d1ed0
commit 1f578d6095
5 changed files with 83 additions and 16 deletions

View File

@ -43,11 +43,16 @@
<text>确认完成</text>
</view>
</block>
<block v-if="order.state == 6">
<block v-if="order.state == 6 && order.needAppraise">
<view class="btn" @click.stop="appraiseOrder">
<text>评价师傅</text>
</view>
</block>
<block v-if="order.state == 6 && !order.needAppraise">
<view class="btn normal">
<text>已评价</text>
</view>
</block>
<block v-if="order.state == 7">
<view class="btn" @click.stop="cancelRefund">
<text>取消申请</text>
@ -178,7 +183,8 @@ export default {
* 评价
*/
appraiseOrder() {
this.$utils.toPage("/pages/worker/appraise?id=" + this.order.id + "&orderId=" + this.order.orderId);
let params = "?list=" + this.order.listType + "&id=" + this.order.id + "&orderId=" + this.order.orderId;
this.$utils.toPage("/pages/order/appraise" + params);
},
/**
* 退款

View File

@ -266,6 +266,21 @@ export default {
url: ""
}
},
appraise: {
t1: {
url: "/wxapp/order/evaluationorder",
showLoading: true,
auth: true,
},
t2: {
url: "/wxapp/orderb/evaluationorder",
showLoading: true,
auth: true,
},
t3: {
url: ""
}
},
chooseWorker: {
url: "/wxapp/orderb/chooseshifu",
showLoading: true,

View File

@ -195,6 +195,7 @@ export default {
orderType: data.types,
state: data.status,
retainageMoney: data.moneyb,
needAppraise: data.message > 0,
worker: {},
workerList: [],
};
@ -253,6 +254,7 @@ export default {
unloadAddress: data.addressb,
state: data.status,
price: data.money,
needAppraise: false,
worker: {},
};
// 师傅
@ -328,5 +330,18 @@ export default {
return reject(response.msg);
}).catch(e => { });
});
},
/**
* 评价订单
*/
appraiseOrder(options) {
return new Promise((resolve, reject) => {
prototype.$request(options.request).then(response => {
if (response.code == 1) {
return resolve(response);
}
return reject(response.msg);
}).catch(e => { });
});
}
}

View File

@ -68,9 +68,9 @@
}
},
{
"path": "pages/worker/appraise",
"path": "pages/order/appraise",
"style": {
"navigationBarTitleText": "评价师傅"
"navigationBarTitleText": "评价订单"
}
},
{

View File

@ -33,7 +33,7 @@
<view class="upload-item">
<block v-for="(item, index) in images" :key="index">
<view class="image-box">
<image class="image" :src="item.src" mode="aspectFill" />
<image class="image" :src="item" mode="aspectFill" />
</view>
</block>
<view class="image-box upload" @click="chooseImage">
@ -44,7 +44,7 @@
</view>
</view>
<view class="common-save-form-btn">
<view class="btn" @click="save">提交</view>
<view class="btn" @click="submit">提交</view>
</view>
</app-layout>
</template>
@ -58,7 +58,9 @@ export default {
return {
utils: this.$utils,
tags: ["技术专业", "礼貌热情", "认真负责", "快速完工", "按时上门"],
orderId: "xxgfdkgn1223",
listType: "",
id: 0,
orderId: "",
grade: 0,
content: "",
chooseTags: [],
@ -71,7 +73,16 @@ export default {
AppLayout,
UniRate,
},
onLoad() {},
onLoad(e) {
if (!e.id || !e.orderId || !e.list) {
return this.$utils.toast("参数错误").then(() => {
this.$utils.toPage("", "", "back");
});
}
this.id = e.id;
this.orderId = e.orderId;
this.listType = e.list;
},
onShow() {},
onReady() {},
onReachBottom() {},
@ -85,16 +96,36 @@ export default {
}
},
chooseImage() {
uni.chooseImage({
sizeType: ["compressed"],
sourceType: ["album"],
success(res) {
console.log(JSON.stringify(res.tempFilePaths));
},
this.$utils.chooseImage(1).then((tempFiles) => {
tempFiles.forEach((item) => {
this.$models.system.upload(item.path).then((response) => {
this.images.push(response.img);
});
});
});
},
save() {
console.log("提交表单");
submit() {
this.$models.order
.appraiseOrder({
request: {
api: "order.appraise." + this.listType,
data: {
id: this.id,
desc: this.content,
msg: this.chooseTags.join(),
img: this.images,
score: this.grade,
},
},
})
.then((message) => {
this.$utils.toast(message).then(() => {
this.$utils.toPage("", "", "back");
});
})
.catch((e) => {
this.$utils.toast(e);
});
},
},
};