Fix:【商城小程序】待付款订单详情页补上修改地址的按钮

This commit is contained in:
linxi
2024-09-20 15:53:51 +08:00
parent fafd862f99
commit 088c1be6f9
+48 -4
View File
@@ -21,7 +21,7 @@
</div>
<div class="v12-font-28 v12-secondary-dark-text v12-justify-between">
<text class=" more-t" style="flex: 2;">{{ orderInfo.userAddress }}</text>
<!-- <view @click="goAddress" class="v12-btn cancel v12-dark-text v12-dark-border v12-radius-40" v-if="status.type == -2 || status.type == -3">修改地址</view> -->
<view v-if="getStatus(orderInfo) === '待付款'" @click="goAddress" class="v12-btn cancel v12-dark-text v12-dark-border v12-radius-40" >修改地址</view>
</div>
</view>
</view>
@@ -421,7 +421,7 @@
<script>
import passkeyborad from '@/components/yzc-paykeyboard/yzc-paykeyboard'
import OrderGoods from "@/components/OrderGoods";
import {orderDetail, orderDelay, aginConfirm, express} from "@/api/order";
import {orderDetail, orderDelay, aginConfirm, express, editAddress} from "@/api/order";
import Payment from "@/components/Payment";
import DataFormat from "@/components/DataFormat";
import {copyClipboard} from "@/utils";
@@ -455,6 +455,7 @@ export default {
mixins: [pageListenMixins],
data: function () {
return {
addressId: null,
showExtend: false,
delayId: '',
showMore: false,
@@ -489,6 +490,46 @@ export default {
onShow() {
this.id = this.$yroute.query.id;
this.getDetail();
uni.$on('chooseAddress', (res) => {
this.addressId = res.id
})
},
watch: {
addressId(val) {
if(val) {
const params = {
addressId: this.addressId,
orderId: this.orderInfo.orderId
}
setTimeout(() => {
uni.showModal({
title:'确定修改地址吗?',
content: '',
showCancel: true,
cancelText: '取消',
confirmText: '确认',
success:(success)=>{
if(success.confirm) {
uni.showLoading()
editAddress(params).then(res => {
uni.showToast({
icon: 'success',
title: '修改成功!'
})
this.getDetail();
}).finally(() => {
uni.hideLoading()
})
}
},
complete:(complete)=>{
uni.hideLoading()
this.addressId = ''
},
})
}, 1000)
}
}
},
// inject: ["app"],
mounted: function () {
@@ -541,8 +582,11 @@ export default {
})
},
goAddress() {
uni.navigateTo({
url:'/pages/user/address/AddressManagement/index'
this.$yrouter.push({
path:'/pages/user/address/AddressManagement/index',
query: {
choosMode: 1
}
})
},
toDelay(id) {