订单和详情页面优化

This commit is contained in:
geng.tang@qq.com
2024-01-30 09:06:00 +08:00
parent 4a2f46cb2c
commit 4a2eff7d3d
2 changed files with 104 additions and 22 deletions

View File

@@ -511,11 +511,11 @@
<block v-if="order.payStatus == PayStatusEnum.SUCCESS.value">
<view class="btn-item" v-if="order.deliveryStatus <= 20 && order.receiptStatus == 10" @click="onReceipt(order.orderId)">确认收货</view>
<view class="btn-item" v-else-if="order.orderStatus == 30 && order.deliveryStatus == 20 && order.receiptStatus == 20" @click="onBind(item)">绑定设备</view>
<view class="btn-item" v-else-if="order.orderStatus == 30 && order.deliveryStatus == 20 && order.receiptStatus == 20" @click="onBind(order)">绑定设备</view>
<view class="btn-item" @click="handleRentingOut(order)"
v-if="order.equipmentGoods.equipmentCategory != '10' && order.receiptStatus != 21 && order.receiptStatus != 30">我要退租</view>
<view class="btn-item" @click="handleRentingOut(order)"
<view class="btn-item" @click="handleRentingOutCancel(order)"
v-if="order.equipmentGoods.equipmentCategory != '10' && order.receiptStatus == 21 && !orderEnd">取消退租</view>
<view class="btn-item" @click="handleHireEquipment(order.orderId)"
@@ -540,8 +540,8 @@
</view>
</view>
</u-popup>
<!-- 绑定设备码 -->
<u-popup v-model="showQRCodeBind" mode="center" border-radius="26" :closeable="true">
<!-- 更换设备码 -->
<u-popup v-model="showQRCodeChange" mode="center" border-radius="26" :closeable="true">
<view class="qrcode-bind">
<view class="title">请输入更换的新电池编号</view>
<view class="bind-content">
@@ -553,6 +553,19 @@
</view>
</view>
</u-popup>
<!-- 绑定设备码 -->
<u-popup v-model="showQRCodeBind" mode="center" border-radius="26" :closeable="true">
<view class="qrcode-bind">
<view class="title">请输入绑定电池编号</view>
<view class="bind-content">
<input v-model="bindValue" class="input" @confirm="onSearch" focus="true" placeholder="请输入设备编号"
type="text"></input>
</view>
<view class="submit">
<u-button type="error" @click="doBind()">确定</u-button>
</view>
</view>
</u-popup>
</view>
</template>
@@ -619,6 +632,7 @@
canReset: false,
equipment: {},
showQRCodeBind: false,
showQRCodeChange: false,
bindValue: '',
equipmentGoods: {},
equipmentId: null,
@@ -953,19 +967,15 @@
content: '是否退租',
success: (result) => {
if (result.confirm) {
const {
orderId,
equipmentId
} = order
EquipmentApi.rentingOut({
orderId,
equipmentId
orderId: order.orderId,
isRefund: 1
}).then(res => {
this.$success(res.message)
setTimeout(() => {
// 刷新当前订单数据
app.getOrderDetail(true)
}, 1500)
}, 1000)
}).catch(err => {
this.$success(err.message)
})
@@ -975,6 +985,30 @@
},
handleRentingOutCancel(order) {
const app = this
uni.showModal({
title: '提示',
content: "是否取消退租",
success: (result) => {
if (result.confirm) {
EquipmentApi.rentingOut({
orderId: order.orderId,
isRefund: 2
}).then(res => {
this.$success(res.message)
setTimeout(() => {
// 刷新当前订单数据
app.onRefreshList()
}, 1000)
}).catch(err => {
this.$success(err.message)
})
}
}
})
},
// 跳转到设备详情页
handleTargetEquipment(equipmentId) {
this.$navTo('pages/user/equipment/index', {
@@ -1034,7 +1068,37 @@
},
handleChangeEquipment() {
const app = this
app.showQRCodeChange = true
},
// 绑定设备页面
onBind(item) {
const app = this
const {
equipment
} = item
app.showQRCodeBind = true
app.equipment = item
// app.bindValue = equipment.equipmentCode
},
// 执行绑定
doBind() {
const app = this
const {
orderId,
bindValue
} = this
EquipmentApi.bindEquipment({
equipmentCode: bindValue,
orderId: equipment.orderId
}).then(result => {
app.$success(result.message)
app.showQRCodeBind = false
// 刷新订单列表
app.onRefreshList()
}).catch(err => {
app.$error(err.message)
})
},
// 换电
doEquipment(canReset = false) {
@@ -1050,7 +1114,7 @@
equipmentId
}).then(result => {
app.$success(result.message)
app.showQRCodeBind = false
app.showQRCodeChange = false
// 相应全局事件订阅: 刷新上级页面数据
canReset && uni.$emit('syncRefreshOrder', true, true)
}).catch(err => {

View File

@@ -103,7 +103,7 @@
<view class="btn-item" @click="handleRentingOut(item)"
v-if="item.equipmentGoods.equipmentCategory != '10' && item.receiptStatus != 21 && item.receiptStatus != 30">我要退租</view>
<view class="btn-item" @click="handleRentingOut(item)"
<view class="btn-item" @click="handleRentingOutCancel(item)"
v-if="item.equipmentGoods.equipmentCategory != '10' && item.receiptStatus == 21 && !orderEnd">取消退租</view>
<view class="btn-item" @click="handleHireEquipment(item.orderId)"
@@ -524,7 +524,7 @@
}
});
},
// 绑定设备
// 绑定设备页面
onBind(item) {
const app = this
const {
@@ -552,7 +552,6 @@
}).catch(err => {
app.$error(err.message)
})
console.log("this.bindValue: ", this.bindValue);
},
// 获取核销二维码
@@ -571,16 +570,12 @@
const app = this
uni.showModal({
title: '提示',
content: '是否退租',
content: "是否退租",
success: (result) => {
if (result.confirm) {
const {
orderId,
equipmentId
} = order
EquipmentApi.rentingOut({
orderId,
equipmentId
orderId: order.orderId,
isRefund: 1
}).then(res => {
this.$success(res.message)
setTimeout(() => {
@@ -593,7 +588,30 @@
}
}
})
},
handleRentingOutCancel(order) {
const app = this
uni.showModal({
title: '提示',
content: "是否取消退租",
success: (result) => {
if (result.confirm) {
EquipmentApi.rentingOut({
orderId: order.orderId,
isRefund: 2
}).then(res => {
this.$success(res.message)
setTimeout(() => {
// 刷新当前订单数据
app.onRefreshList()
}, 1000)
}).catch(err => {
this.$success(err.message)
})
}
}
})
},
// 点击去支付