|
@@ -1,30 +1,42 @@
|
|
<!-- 企业新增 -->
|
|
<!-- 企业新增 -->
|
|
<template>
|
|
<template>
|
|
- <view>
|
|
|
|
- <view class="titleStyle">基本信息</view>
|
|
|
|
- <van-cell-group inset>
|
|
|
|
- <van-field input-align="right" label="招牌名称" v-model="newData.signboardName" placeholder="请输入" />
|
|
|
|
- <van-field input-align="right" label="统一社会信用代码" v-model="newData.creditCode" placeholder="请输入" />
|
|
|
|
- <van-field input-align="right" class="red-star" label="企业名称" v-model="newData.companyName" placeholder="请输入" :rules="[{ validator, message: '请输入' }]"/>
|
|
|
|
- <van-field input-align="right" label="注册资本" v-model="newData.registerCapital" placeholder="请输入" />
|
|
|
|
- <van-field input-align="right" class="red-star" v-model="newData.state" is-link readonly name="picker" label="经营状态" placeholder="请选择"
|
|
|
|
- @click="statePricker = true" />
|
|
|
|
- <van-popup v-model:show="statePricker" position="bottom" round>
|
|
|
|
- <van-picker :columns="columns" @confirm="onConfirm" @cancel="cancel" show-toolbar />
|
|
|
|
- </van-popup>
|
|
|
|
- <van-field input-align="right" label="备注" v-model="newData.remark" placeholder="请输入" />
|
|
|
|
- </van-cell-group>
|
|
|
|
- <view class="buttonStyle">
|
|
|
|
- <van-button color="#1989fa" @click="closeFn" size="small"
|
|
|
|
- style="width: 25%; border-radius: 8px;">取消</van-button>
|
|
|
|
- <van-button color="#1989fa" @click="submitFn" size="small"
|
|
|
|
- style="width: 25%; border-radius: 8px;">保存</van-button>
|
|
|
|
|
|
+ <view class="page-container">
|
|
|
|
+ <view class="container-center">
|
|
|
|
+ <view class="box">
|
|
|
|
+
|
|
|
|
+ <view class="title">
|
|
|
|
+ <text>
|
|
|
|
+ 基本信息
|
|
|
|
+ </text>
|
|
|
|
+ </view>
|
|
|
|
+ <van-form ref="searchFromRef" class="content">
|
|
|
|
+ <van-field input-align="right" label="招牌名称" v-model="newData.signboardName" placeholder="请输入" />
|
|
|
|
+ <van-field input-align="right" label="统一社会信用代码" v-model="newData.creditCode" placeholder="请输入"
|
|
|
|
+ label-width="8em" />
|
|
|
|
+ <van-field input-align="right" class="red-star" label="企业名称" v-model="newData.companyName"
|
|
|
|
+ placeholder="请输入" :rules="[{ message: '', required: true }]" />
|
|
|
|
+ <van-field input-align="right" label="注册资本" v-model="newData.registerCapital" placeholder="请输入" />
|
|
|
|
+ <van-field input-align="right" class="red-star" v-model="newData.state" is-link readonly
|
|
|
|
+ name="picker" label="经营状态" placeholder="请选择" @click="statePricker = true"
|
|
|
|
+ :rules="[{ message: '', required: true }]" />
|
|
|
|
+ <van-popup v-model:show="statePricker" position="bottom" round>
|
|
|
|
+ <van-picker :columns="columns" @confirm="onConfirm" @cancel="cancel" show-toolbar />
|
|
|
|
+ </van-popup>
|
|
|
|
+ <van-field input-align="right" label="备注" v-model="newData.remark" placeholder="请输入" />
|
|
|
|
+ </van-form>
|
|
|
|
+ </view>
|
|
|
|
+ </view>
|
|
|
|
+ <view class="container-footer">
|
|
|
|
+ <van-button @click="closeFn"
|
|
|
|
+ style="width: 25%; border-radius: 8px; border: 1px solid #1989fa; color: #1989fa;">取消</van-button>
|
|
|
|
+ <van-button color="#1989fa" @click="submitFn" style="width: 25%; border-radius: 8px;">保存</van-button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { NEWDATA } from "./data.jsx"
|
|
import { NEWDATA } from "./data.jsx"
|
|
|
|
+import { postCompanyBtAddCompany } from "@/api/company"
|
|
export default {
|
|
export default {
|
|
//import引入的组件需要注入到对象中才能使用
|
|
//import引入的组件需要注入到对象中才能使用
|
|
components: {},
|
|
components: {},
|
|
@@ -50,13 +62,36 @@ export default {
|
|
cancel() {
|
|
cancel() {
|
|
this.statePricker = false
|
|
this.statePricker = false
|
|
},
|
|
},
|
|
- validator(val) {
|
|
|
|
- if(val){
|
|
|
|
- return true
|
|
|
|
- }else{
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // 取消
|
|
|
|
+ closeFn() {
|
|
|
|
+ this.newData = { ...NEWDATA }
|
|
|
|
+ },
|
|
|
|
+ // 保存
|
|
|
|
+ submitFn() {
|
|
|
|
+ // 验证数据
|
|
|
|
+ if (this.$refs.searchFromRef.validate()) {
|
|
|
|
+ postCompanyBtAddCompany(this.newData)
|
|
|
|
+ .then(res => {
|
|
|
|
+ console.log(res)
|
|
|
|
+ if (res == "新增成功") {
|
|
|
|
+ Toast.success("添加成功")
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: "/subPages/pages/companyManage/search/list",
|
|
|
|
+ })
|
|
|
|
+ } else {
|
|
|
|
+ Toast.fail(err.msg);
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(err => {
|
|
|
|
+ console.log(err)
|
|
|
|
+ Toast.fail(err.msg);
|
|
|
|
+ })
|
|
|
|
+ // 验证通过,可以提交数据
|
|
|
|
+ console.log(this.newData)
|
|
|
|
+ } else {
|
|
|
|
+ // 验证不通过,可以做一些提示
|
|
|
|
+ }
|
|
|
|
+ },
|
|
},
|
|
},
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
//生命周期 - 创建完成(可以访问当前this实例)
|
|
created() {
|
|
created() {
|
|
@@ -81,11 +116,47 @@ export default {
|
|
margin: 10px 0 10px 18px;
|
|
margin: 10px 0 10px 18px;
|
|
color: #616161;
|
|
color: #616161;
|
|
}
|
|
}
|
|
|
|
+
|
|
.red-star {
|
|
.red-star {
|
|
- ::v-deep .van-field__label:before {
|
|
|
|
- content: '*';
|
|
|
|
- color: #ff0000;
|
|
|
|
- margin-right: 5px;
|
|
|
|
- }
|
|
|
|
|
|
+ ::v-deep .van-field__label:before {
|
|
|
|
+ content: '*';
|
|
|
|
+ color: #ff0000;
|
|
|
|
+ margin-right: 5px;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.page-container {
|
|
|
|
+ background-color: #f5f5f5;
|
|
|
|
+ height: 100%;
|
|
|
|
+ overflow: hidden;
|
|
|
|
+ display: flex;
|
|
|
|
+ flex-direction: column;
|
|
|
|
+ box-sizing: border-box;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.title {
|
|
|
|
+ margin: 10px 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.container-center {
|
|
|
|
+ flex: 1;
|
|
|
|
+ padding: 30rpx;
|
|
|
|
+ overflow: auto;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+.container-footer {
|
|
|
|
+ height: 100rpx;
|
|
|
|
+ display: flex;
|
|
|
|
+ gap: 40px;
|
|
|
|
+ justify-content: center;
|
|
|
|
+ align-items: center;
|
|
|
|
+ padding: 0 30rpx;
|
|
|
|
+ box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.2);
|
|
|
|
+ /* 只显示上方阴影 */
|
|
|
|
+
|
|
|
|
+ ::v-deep .van-button {
|
|
|
|
+ width: 30%;
|
|
|
|
+ height: 30px;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|