Commit 9d6d606e by liangjianmin

feat(apply): standardize form field naming and integrate fee approval API

- Rename form fields to snake_case convention (applyType → apply_type, orderNo → order_no, customerName → customer_name, amount → apply_fee_amount, deductionType → relief_detail, reason → relief_reason)
- Add form validation method to check required fields before submission
- Implement fee approval API integration with handleSubmit method using request utility
- Add status field initialization (待处理) to form data
- Simplify field selection handlers to store only display names
- Update API base URL from scwms.ichunt.net to scv2.ichunt.net
- Import API and request utilities for backend communication
- Add success/error handling with user feedback via toast notifications
parent 2d17a9c7
Showing with 86 additions and 27 deletions
......@@ -2,14 +2,14 @@
<view class="apply-page">
<u-form :model="form" ref="formRef" labelWidth="210" labelPosition="left">
<view class="form-section">
<u-form-item label="申请类型" prop="applyType" required borderBottom @click="showTypePicker = true">
<u--input v-model="form.applyTypeName" disabled disabledColor="#ffffff" placeholder="请选择" border="none" inputAlign="right"></u--input>
<u-form-item label="申请类型" prop="apply_type" required borderBottom @click="showTypePicker = true">
<u--input v-model="form.apply_type" disabled disabledColor="#ffffff" placeholder="请选择" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-down" color="#c0c4cc"></u-icon>
</u-form-item>
<u-form-item label="订单号" prop="orderNo" required borderBottom>
<u--input v-model="form.orderNo" placeholder="请输入" border="none" inputAlign="right"></u--input>
<u-form-item label="订单号" prop="order_no" required borderBottom>
<u--input v-model="form.order_no" placeholder="请输入" border="none" inputAlign="right"></u--input>
</u-form-item>
<u-form-item label="客户名称" prop="customerName" required>
<u-form-item label="客户名称" prop="customer_name" required>
<view class="row verCenter boxFlex" style="justify-content: flex-end;">
<text class="link-text">关联订单号显示</text>
</view>
......@@ -18,21 +18,21 @@
<view class="form-section">
<view class="section-header">费用明细</view>
<u-form-item label="申请免收金额" prop="amount" required borderBottom>
<u--input v-model="form.amount" placeholder="请输入" border="none" inputAlign="right" type="number"></u--input>
<u-form-item label="申请免收金额" prop="apply_fee_amount" required borderBottom>
<u--input v-model="form.apply_fee_amount" placeholder="请输入" border="none" inputAlign="right" type="number"></u--input>
</u-form-item>
<view class="currency-hint">
<text>CNY-人民币元</text>
</view>
<u-form-item label="减免明细(单选)" prop="deductionType" required @click="showDeductionPicker = true">
<u--input v-model="form.deductionTypeName" disabled disabledColor="#ffffff" placeholder="请选择" border="none" inputAlign="right"></u--input>
<u-form-item label="减免明细(单选)" prop="relief_detail" required @click="showDeductionPicker = true">
<u--input v-model="form.relief_detail" disabled disabledColor="#ffffff" placeholder="请选择" border="none" inputAlign="right"></u--input>
<u-icon slot="right" name="arrow-down" color="#c0c4cc"></u-icon>
</u-form-item>
</view>
<view class="form-section">
<u-form-item label="免收原因" prop="reason" required labelPosition="top" customStyle="padding-top: 24rpx">
<u--textarea v-model="form.reason" placeholder="请输入" count maxlength="200" height="70" border="surround" customStyle="margin-top: 16rpx"></u--textarea>
<u-form-item label="免收原因" prop="relief_reason" required labelPosition="top" customStyle="padding-top: 24rpx">
<u--textarea v-model="form.relief_reason" placeholder="请输入" count maxlength="200" height="70" border="surround" customStyle="margin-top: 16rpx"></u--textarea>
</u-form-item>
</view>
</u-form>
......@@ -54,18 +54,20 @@
</template>
<script>
import { API } from '@/util/api.js';
import { request } from '@/util/util.js';
export default {
data() {
return {
form: {
applyType: '',
applyTypeName: '',
orderNo: '',
customerName: '',
amount: '',
deductionType: '',
deductionTypeName: '',
reason: ''
apply_type: '',
order_no: '',
customer_name: '',
apply_fee_amount: '',
relief_detail: '',
relief_reason: '',
status: 0 //待处理
},
errorMsg: '',
showTypePicker: false,
......@@ -85,8 +87,7 @@
* @return {void}
*/
onTypeSelect(item) {
this.form.applyType = item.value;
this.form.applyTypeName = item.name;
this.form.apply_type = item.name;
this.showTypePicker = false;
},
......@@ -96,17 +97,71 @@
* @return {void}
*/
onDeductionSelect(item) {
this.form.deductionType = item.value;
this.form.deductionTypeName = item.name;
this.form.relief_detail = item.name;
this.showDeductionPicker = false;
},
/**
* 表单校验
* @return {boolean} 校验是否通过
*/
validateForm() {
var { apply_type, order_no, apply_fee_amount, relief_detail, relief_reason } = this.form;
if (!apply_type) {
this.errorMsg = '请选择申请类型';
return false;
}
if (!order_no) {
this.errorMsg = '请输入订单号';
return false;
}
if (!apply_fee_amount) {
this.errorMsg = '请输入申请免收金额';
return false;
}
if (!relief_detail) {
this.errorMsg = '请选择减免明细';
return false;
}
if (!relief_reason) {
this.errorMsg = '请输入免收原因';
return false;
}
this.errorMsg = '';
return true;
},
/**
* 提交申请
* @return {void}
*/
handleSubmit() {
// 后续接入接口逻辑
if (!this.validateForm()) {
return;
}
request(API.addFeeApprove, 'POST', this.form, true).then(res => {
if (res.code === 0) {
uni.showToast({
title: '提交成功',
icon: 'success'
});
setTimeout(() => {
uni.navigateBack();
}, 1500);
} else {
this.errorMsg = res.msg || '提交失败';
}
}).catch(() => {
this.errorMsg = '网络异常,请稍后重试';
});
}
}
};
......
......@@ -8,7 +8,7 @@ var ENV_CONFIG = {
API_BASE_PUR: 'https://purchase.ichunt.net',
API_BASE_OSS: 'https://image.ichunt.net',
API_BASE_WMS: 'https://wms.ichunt.net',
API_BASE: 'http://scwms.ichunt.net',
API_BASE: 'http://scv2.ichunt.net',
API_BASE_ICHUNT: 'https://api.ichunt.com'
},
development: {
......@@ -16,7 +16,7 @@ var ENV_CONFIG = {
API_BASE_PUR: 'http://pur.liexindev.net',
API_BASE_OSS: 'http://image.liexindev.net',
API_BASE_WMS: 'http://wms.liexindev.net',
API_BASE: 'http://adminwms.liexindev.net',
API_BASE: 'http://adminsc.liexindev.net',
API_BASE_ICHUNT: 'http://api.liexin.com'
}
};
......@@ -46,7 +46,11 @@ const API = {
/**
* 上传文件
*/
upload: API_BASE_OSS + '/uploadImage'
upload: API_BASE_OSS + '/uploadImage',
/**
* 新增费用减免申请
*/
addFeeApprove: API_BASE + '/api/approve/addFeeApprove'
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment