完善订单列表、选择师傅

This commit is contained in:
TOP糯米 2023-03-16 14:17:15 +08:00
parent 9fff9695b3
commit 03af516279
4 changed files with 98 additions and 37 deletions

View File

@ -15,14 +15,16 @@
<text class="text">{{ order.orderId }}</text> <text class="text">{{ order.orderId }}</text>
<text class="copy" @click.stop="copyOrderId(order.orderId)">复制</text> <text class="copy" @click.stop="copyOrderId(order.orderId)">复制</text>
</view> </view>
<view class="order-desc-row"> <block v-if="order.listType != 't3'">
<text class="title">服务分类</text> <view class="order-desc-row">
<text class="text">{{ order.cate }}</text> <text class="title">服务分类</text>
</view> <text class="text">{{ order.cate }}</text>
<view class="order-desc-row limit-line clamp-1"> </view>
<text class="title">需求内容</text> <view class="order-desc-row limit-line clamp-1">
<text class="text">{{ order.content }}</text> <text class="title">需求内容</text>
</view> <text class="text">{{ order.content }}</text>
</view>
</block>
<view class="order-desc-row"> <view class="order-desc-row">
<text class="title">下单时间</text> <text class="title">下单时间</text>
<text class="text">{{ order.createTime }}</text> <text class="text">{{ order.createTime }}</text>

View File

@ -199,6 +199,11 @@ export default {
t3: { t3: {
url: "" url: ""
}, },
},
chooseWorker: {
url: "/wxapp/orderb/chooseshifu",
showLoading: true,
auth: true,
} }
} }
} }

View File

@ -121,9 +121,9 @@ export default {
name: item.shifu.name, name: item.shifu.name,
avatar: item.shifu.avatar, avatar: item.shifu.avatar,
type: item.shifu.status, type: item.shifu.status,
times: item.shifu_date.count, times: item.shifu.shifu_date.count,
favorableRate: item.shifu_date.good, favorableRate: item.shifu.shifu_date.good,
grade: item.shifu_date.score, grade: item.shifu.shifu_date.score,
price: item.money, price: item.money,
} }
} }
@ -200,9 +200,9 @@ export default {
if (prototype.$utils.isType(data.shifu, "object")) { if (prototype.$utils.isType(data.shifu, "object")) {
order.worker = { order.worker = {
id: data.shifu.id, id: data.shifu.id,
uid: data.shifu.uid,
name: data.shifu.name, name: data.shifu.name,
avatar: data.shifu.avatar, avatar: data.shifu.avatar,
type: data.shifu.status,
price: data.money, price: data.money,
} }
} }
@ -211,6 +211,7 @@ export default {
data.shifus.forEach(worker => { data.shifus.forEach(worker => {
order.workerList.push({ order.workerList.push({
id: worker.id, id: worker.id,
uid: worker.uid,
name: worker.name, name: worker.name,
avatar: worker.avatar, avatar: worker.avatar,
price: worker.money, price: worker.money,
@ -243,4 +244,23 @@ export default {
}); });
}); });
}, },
/**
* 选择师傅
*/
chooseWorker(id, workerId) {
return new Promise((resolve, reject) => {
prototype.$request({
api: "order.chooseWorker",
data: {
id: id,
worker: workerId,
}
}).then(response => {
if (response.code == 1) {
return resolve(response.msg);
}
return reject(response.msg);
}).catch(e => { });
});
},
} }

View File

@ -24,27 +24,47 @@
> >
<swiper-item> <swiper-item>
<view class="detail-tab tab0"> <view class="detail-tab tab0">
<block v-if="listType == 't2' && order.orderType == 2 && order.workerList.length == 0"> <!-- 不存在具体师傅时判断服务师傅展示方式 -->
<view class="no-worker"> 暂无师傅报价 </view> <block v-if="utils.isType(order.worker, 'object') && !utils.isType(order.worker.id, 'number')">
</block> <!-- 报价订单如果列表不为空则展示师傅列表 -->
<!-- 报价订单未选择师傅展示师傅列表 --> <block v-if="order.listType == 't2' && order.orderType == 2">
<block v-if="utils.isType(order.workerList, 'array') && order.workerList.length > 0"> <view
<view class="worker-group"> v-if="utils.isType(order.workerList, 'array') && order.workerList.length > 0"
<view class="worker-item" v-for="(item, index) in order.workerList" :key="index"> class="worker-group"
<view class="datetime">{{ item.createTime }}</view> >
<view class="price"> <view class="worker-item" v-for="(item, index) in order.workerList" :key="index">
<text class="title">报价金额</text> <view class="datetime">{{ item.createTime }}</view>
<text class="number">¥ {{ utils.formatNumber(item.price, 2) }}</text> <view class="price">
</view> <text class="title">报价金额</text>
<view class="detail" @click="workerDetail(item.id)"> <text class="number">¥ {{ utils.formatNumber(item.price, 2) }}</text>
<worker-item :data="item" :showPrice="false" /> </view>
</view> <view class="detail" @click="workerDetail(item.id)">
<view class="action"> <worker-item :data="item" :showPrice="false" />
<view class="btn" @click="chooseWorker(item.id)">选择师傅</view> </view>
<view class="action">
<view class="btn" @click="chooseWorker(item.uid)">选择师傅</view>
</view>
</view> </view>
</view> </view>
<view
v-if="utils.isType(order.workerList, 'array') && order.workerList.length == 0"
class="desc-text"
>
当前暂无师傅报价
</view>
</block>
<!-- 购买订单一口价订单展示暂无师傅 -->
<view
v-if="(order.listType == 't1' || order.listType == 't2') && order.orderType == 1"
class="desc-text"
>
当前暂无师傅接单
</view> </view>
</block> </block>
<!-- 存在师傅信息展示师傅详情 -->
<block v-if="utils.isType(order.worker, 'object') && utils.isType(order.worker.id, 'number')">
<view class="desc-text">{{ order.worker.id }}-{{ order.worker.name }}</view>
</block>
</view> </view>
</swiper-item> </swiper-item>
<swiper-item> <swiper-item>
@ -148,6 +168,8 @@ export default {
order: { order: {
address: {}, address: {},
}, },
showDetail: false,
showList: false,
}; };
}, },
components: { components: {
@ -156,7 +178,7 @@ export default {
ServiceInsurance, ServiceInsurance,
OrderAction, OrderAction,
}, },
onLoad(e) { async onLoad(e) {
this.pageConfig = getApp().globalData.pageConfig; this.pageConfig = getApp().globalData.pageConfig;
if (e.id && e.id > 0) { if (e.id && e.id > 0) {
@ -174,7 +196,7 @@ export default {
} else { } else {
this.switchTab(0); this.switchTab(0);
} }
this.loadDetail(); await this.loadDetail();
}, },
onShow() {}, onShow() {},
onReady() {}, onReady() {},
@ -222,13 +244,22 @@ export default {
/** /**
* 选择师傅 * 选择师傅
*/ */
chooseWorker(id) { chooseWorker(uid) {
const that = this; const that = this;
uni.showModal({ uni.showModal({
title: "确认选择该师傅?", title: "确认选择该师傅?",
complete(res) { complete(res) {
if (res.confirm) { if (res.confirm) {
that.$utils.toast("你选择了师傅" + id); that.$models.order
.chooseWorker(that.id, uid)
.then((msg) => {
that.$utils.toast(msg).then(() => {
that.loadDetail();
});
})
.catch((e) => {
that.$utils.toast(e);
});
} }
}, },
}); });
@ -236,8 +267,8 @@ export default {
/** /**
* 加载详情 * 加载详情
*/ */
loadDetail() { async loadDetail() {
this.$models.order await this.$models.order
.orderDetail({ .orderDetail({
request: { request: {
api: "order.detail." + this.listType, api: "order.detail." + this.listType,
@ -256,7 +287,10 @@ export default {
this.stateText = stateText; this.stateText = stateText;
this.stateDesc = stateDesc; this.stateDesc = stateDesc;
this.stateTextColor = stateTextColor; this.stateTextColor = stateTextColor;
this.order = detail; this.order = {
...detail,
listType: this.listType,
};
this.$nextTick(() => { this.$nextTick(() => {
this.setTabHeight(); this.setTabHeight();
}); });
@ -326,7 +360,7 @@ export default {
} }
.detail-tab { .detail-tab {
width: 100%; width: 100%;
.no-worker { .desc-text {
color: #999999; color: #999999;
font-size: 28rpx; font-size: 28rpx;
line-height: 200rpx; line-height: 200rpx;