Feat(订单列表):未支付订单修改地址

This commit is contained in:
linxi
2024-09-10 16:03:10 +08:00
parent 2033fb7ed7
commit c015eb9dff
2 changed files with 53 additions and 4 deletions
+9
View File
@@ -169,4 +169,13 @@ export function orderDelay(uni) {
*/
export function aginConfirm(params) {
return request.post('/order/buyAgainConfirm', params)
}
/**
* 修改地址
* @param {*} params
* @returns
*/
export function editAddress(params) {
return request.post('/order/editAddress', params)
}
+44 -4
View File
@@ -129,7 +129,7 @@
<view class="flex">
<template v-if="order._status._type == 0">
<view class="bnt cancelBnt v12-dark-text v12-dark-border" @click="cancelOrder(order)">取消订单</view>
<!-- <view class="bnt cancelBnt v12-dark-text v12-dark-border" @click="addressTap()">修改地址</view> -->
<view class="bnt cancelBnt v12-dark-text v12-dark-border" @click="addressTap(order)">修改地址</view>
<view class="bnt bg-color-lightred v12-white v12-primary-text v12-primary-border v12-radius-40" @click="goOrderDetails(order)">立即付款</view>
</template>
<template v-if="(order._status._type == 1 || order._status._type == 9) && order.isTickets==0">
@@ -172,7 +172,7 @@
</view>
</template>
<script>
import {getOrderData, getOrderList, orderDelay} from "@/api/order";
import {getOrderData, getOrderList, orderDelay, editAddress} from "@/api/order";
import {cancelOrderHandle, payOrderHandle, takeOrderHandle} from "@/libs/order";
import Loading from "@/components/Loading";
import Payment from "@/components/Payment";
@@ -227,7 +227,9 @@ export default {
showExtend: false,
delayId: null,
pageKeyId: Object.freeze('userOrderIndex'),
keyword: ''
keyword: '',
_orderId: '',
addressId: ''
};
},
components: {
@@ -240,6 +242,9 @@ export default {
this.changeType(this.type);
this.getOrderData();
this.getOrderListReq();
uni.$on('chooseAddress', (res) => {
this.addressId = res.id
})
},
onHide: function () {
this.orderList = [];
@@ -248,8 +253,43 @@ export default {
this.loaded = false;
this.loading = false;
},
watch: {
addressId(val) {
if(val) {
const params = {
addressId: this.addressId,
orderId: this._orderId
}
uni.showModal({
title:'确定修改地址吗?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success:(success)=>{
if(success.confirm) {
uni.showLoading()
editAddress(params).then(res => {
uni.showToast({
icon: 'success',
title: '修改成功!'
})
}).finally(() => {
uni.hideLoading()
})
}
},
complete:(complete)=>{
this.addressId = ''
this._orderId = ''
},
})
}
}
},
methods: {
addressTap() {
addressTap(order) {
this._orderId = order.orderId
this.$yrouter.push({
path: "/pages/user/address/AddressManagement/index",
query: {