更改需求订单类型标识

This commit is contained in:
TOP糯米 2023-03-15 11:53:18 +08:00
parent 7199cb6e23
commit deb30c1c40
5 changed files with 53 additions and 68 deletions

View File

@ -1,11 +1,11 @@
<template> <template>
<view class="component-get-action"> <view class="component-get-action">
<block v-if="order.listType == 't1' || order.listType == 't3' || (order.listType == 't2' && order.orderType == 2)"> <block v-if="order.listType == 't1' || order.listType == 't3' || (order.listType == 't2' && order.orderType == 1)">
<view class="btn active" @click.stop="getOrder"> <view class="btn active" @click.stop="getOrder">
<text>立即抢单</text> <text>立即抢单</text>
</view> </view>
</block> </block>
<block v-if="order.listType == 't2' && order.orderType == 1"> <block v-if="order.listType == 't2' && order.orderType == 2">
<view class="btn active" @click.stop="postPrice"> <view class="btn active" @click.stop="postPrice">
<text>立即报价</text> <text>立即报价</text>
</view> </view>

View File

@ -38,7 +38,49 @@ export default {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
prototype.$request(options.request).then(response => { prototype.$request(options.request).then(response => {
if (response.code == 1) { if (response.code == 1) {
return resolve(response.data); let order = {};
if (options.listType == "t1" || options.listType == "t2") {
order = {
listType: options.listType,
id: response.data.id,
orderId: response.data.order,
username: "用户名称",
cate: "待返数据",
content: response.data.desc,
createTime: response.data.time,
serviceTime: response.data.times,
orderType: response.data.types,
state: response.data.status,
price: response.data.money,
orderId: response.data.order,
address: {
address: response.data.address.address,
detail: response.data.address.doorplate,
name: response.data.address.name,
mobile: response.data.address.mobil,
},
};
if (options.listType == "t1") {
order.images = response.data.goods.map((item) => item.thumbnail);
} else {
order.images = response.data.img;
}
} else if (options.listType == "t3") {
order = {
listType: options.listType,
id: response.data.id,
orderId: response.data.order,
username: "用户名称",
cate: "待返数据",
createTime: response.data.times,
serviceTime: response.data.starttime,
pickupAddress: response.data.address,
unloadAddress: response.data.addressb,
state: response.data.status,
price: response.data.money,
};
}
return resolve(order);
} }
return reject(response.msg); return reject(response.msg);
}).catch(e => { }); }).catch(e => { });

View File

@ -7,9 +7,9 @@ export default {
case "t1": return ["购买服务", "#3ABCF6"]; case "t1": return ["购买服务", "#3ABCF6"];
case "t2": case "t2":
if (orderType == 2) { if (orderType == 2) {
return ["一口价", "#3ABCF6"]; return ["报价"];
} }
return ["报价"]; return ["一口价", "#3ABCF6"];
case "t3": return ["货运", "#628BE7"]; case "t3": return ["货运", "#628BE7"];
} }
}, },

View File

@ -104,7 +104,7 @@
</view> </view>
</view> </view>
</block> </block>
<block v-if="listType == 't1' || (listType == 't2' && order.orderType == 2)"> <block v-if="listType == 't1' || (listType == 't2' && order.orderType == 1)">
<view class="detail-section"> <view class="detail-section">
<text class="price-box">¥ {{ utils.formatNumber(order.price, 2) }}</text> <text class="price-box">¥ {{ utils.formatNumber(order.price, 2) }}</text>
</view> </view>
@ -236,70 +236,13 @@ export default {
id: this.id, id: this.id,
}, },
}, },
listType: this.listType,
}) })
.then((response) => { .then((order) => {
if (this.listType == "t1") { let [typeText, typeTextBg] = this.$models.order.orderTypeText(this.listType, order.orderType);
this.order = {
listType: this.listType,
id: response.id,
orderId: response.order,
username: "用户名称",
cate: "待返数据",
content: response.desc,
createTime: response.time,
serviceTime: response.times,
orderType: response.types,
state: response.status,
price: response.money,
orderId: response.order,
images: response.goods.map((item) => item.thumbnail),
address: {
address: response.address.address,
detail: response.address.doorplate,
name: response.address.name,
mobile: response.address.mobil,
},
};
} else if (this.listType == "t2") {
this.order = {
listType: this.listType,
id: response.id,
orderId: response.order,
username: "用户名称",
cate: "待返数据",
content: response.desc,
createTime: response.time,
serviceTime: response.times,
orderType: response.types,
state: response.status,
price: response.money,
orderId: response.order,
images: response.img,
address: {
address: response.address.address,
detail: response.address.doorplate,
name: response.address.name,
mobile: response.address.mobil,
},
};
} else if (this.listType == "t3") {
this.order = {
listType: this.listType,
id: response.id,
orderId: response.order,
username: "用户名称",
cate: "待返数据",
createTime: response.times,
serviceTime: response.starttime,
pickupAddress: response.address,
unloadAddress: response.addressb,
state: response.status,
price: response.money,
};
}
let [typeText, typeTextBg] = this.$models.order.orderTypeText(this.listType, this.order.orderType);
this.typeText = typeText; this.typeText = typeText;
this.typeTextBg = typeTextBg ? typeTextBg : "#8b9beb"; this.typeTextBg = typeTextBg ? typeTextBg : "#8b9beb";
this.order = order;
}); });
}, },
}, },

View File

@ -27,7 +27,7 @@
v-if=" v-if="
v.listType == 't1' || v.listType == 't1' ||
v.listType == 't3' || v.listType == 't3' ||
(v.listType == 't2' && v.orderType == 2) (v.listType == 't2' && v.orderType == 1)
" "
class="price" class="price"
>¥ {{ v.price }}</view >¥ {{ v.price }}</view