You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

194 lines
4.3 KiB

<template>
<view class="modify-page">
<!-- 顶部导航 -->
<u-navbar title="修改订单" :is-back="true" back-icon-color="#fff" :background="{'background':'#1479ff'}"
title-color="#fff" :border-bottom="false"></u-navbar>
<view class="b-border"></view>
<!-- 修改表单 -->
<view class="modify-form">
<!-- 金额修改 -->
<view class="form-card">
<view class="card-title">修改总金额</view>
<view class="amount-input">
<text class="symbol">¥</text>
<u-input placeholder="请输入修改后的总金额" v-model="form.price" type="number" :border="false" font-size="40">
</u-input>
<u-icon name="pan"></u-icon>
</view>
<view class="original-price">原价格 ¥{{orderInfo.from_price}}</view>
</view>
<!-- 修改原因 -->
<view class="form-card">
<view class="card-title">修改原因</view>
<u-input v-model="form.update_price_reason" placeholder="请输入修改原因" height="200" :border="false"
type="textarea"></u-input>
</view>
<!-- 底部按钮 -->
<view class="bottom-btns">
<u-button size="mini" shape="circle" type="primary" :custom-style="normalStyle"
@click="cancel">取消</u-button>
<u-button type="primary" @click="confirm" size="mini" shape="circle"
:custom-style="parStyle" :throttle-time="2000"></u-button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
orderId: '',
orderInfo:{},
form:{
update_price_reason:'',
price:''
},
normalStyle: {
'background': '#969da7',
'color': '#fff',
'font-size': '28rpx',
'padding': '0 30rpx',
'margin-left': '15rpx'
},
parStyle: {
'background': 'linear-gradient(to right, #476de4, #7bb9f7)',
'color': '#fff',
'font-size': '28rpx',
'padding': '10rpx 30rpx',
'margin-left': '15rpx'
},
}
},
onLoad(options) {
if (options.id) {
this.orderId = options.id;
this.getOrderInfo(options.id);
}
},
methods: {
async getOrderInfo(id) {
// 获取订单信息
const res = await this.$u.api.orderDetail({
id: id
})
this.orderInfo = res
},
cancel() {
uni.navigateBack();
},
async confirm() {
if (!this.form.price) {
uni.showToast({
title: '请输入修改金额',
icon: 'none'
});
return;
}
if(parseFloat(this.form.price)<parseFloat(this.orderInfo.price)){
uni.showToast({
title: '',
icon: 'none'
});
return;
}
if (!this.form.update_price_reason) {
uni.showToast({
title: '',
icon: 'none'
});
return;
}
//
let that = this
that.$u.api.saveOrder({
id: that.orderId,
price:that.form.price,
update_price_reason:that.form.update_price_reason,
status:3
}).then(res => {
that.base.toast("修改成功", 1500, function() {
setTimeout(function() {
uni.switchTab({
url:'/pages/index/index'
})
}, 1500)
})
})
}
}
}
</script>
<style lang="scss" scoped>
.modify-page {
min-height: 100vh;
background: #f5f5f5;
::v-deep .u-navbar-fixed{
background-color: #1479ff!important;
}
.b-border {
width: 100%;
height: 30rpx;
border-radius: 0 0 120rpx 120rpx;
background-color: #1479ff;
}
.form-card {
background: #fff;
border-radius: 20rpx;
margin: 30rpx;
box-shadow: 0 4rpx 16rpx #e6eaf1;
padding: 30rpx;
.card-title {
font-size: 28rpx;
color: #333;
margin-bottom: 30rpx;
}
.amount-input {
display: flex;
align-items: center;
justify-content: center;
.symbol {
font-size: 40rpx;
color: #333;
margin-right: 10rpx;
}
// .u-input {
// flex: 1;
// }
}
.original-price {
font-size: 24rpx;
color: #999;
margin-top: 20rpx;
text-align: center;
}
}
.bottom-btns {
// position: fixed;
// left: 0;
// right: 0;
// bottom: 0;
padding: 20rpx;
// background: #fff;
display: flex;
justify-content: flex-end;
.u-button {
width: 45%;
}
}
}
</style>