123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298 |
- <template>
- <el-dialog
- :visible.sync="showDialog"
- :title="title"
- :modal-append-to-body="false"
- style="text-align: left"
- @close="closeDialog"
- width="1000px"
- :close-on-click-modal="false"
- >
- <div class="user-panel" v-loading="loading">
- <el-form
- ref="form"
- :model="formModel"
- :rules="ruleValidate"
- :label-width="'160px'"
- inline
- >
- <el-row>
- <el-col :span="12">
- <el-form-item label="所属公司" prop="companyId">
- <el-select-tree
- :props="props"
- :options="treeData"
- v-model="formModel.companyId"
- height="200"
- style="width: 300px"
- ></el-select-tree>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="账户名称" prop="name">
- <el-input
- v-model="formModel.name"
- placeholder="请输入账户名称"
- style="width: 300px"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="微信商户号" prop="mchId">
- <el-input
- v-model="formModel.mchId"
- placeholder="请输入微信mchId"
- style="width: 300px"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item label="app_id" prop="appId">
- <el-input
- v-model="formModel.appId"
- placeholder="请输入app_id"
- style="width: 300px"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <el-form-item label="微信支付" prop="isOpenWechat">
- <el-switch
- v-model="formModel.isOpenWechat"
- active-color="#13ce66"
- inactive-color="#ff4949"
- >
- </el-switch>
- </el-form-item>
- <el-form-item label="支付宝支付" prop="isOpenAlipay">
- <el-switch
- v-model="formModel.isOpenAlipay"
- active-color="#13ce66"
- inactive-color="#ff4949"
- >
- </el-switch>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="微信子商户号" prop="subMchId">
- <el-input
- v-model="formModel.subMchId"
- placeholder="请输入微信subMchId"
- style="width: 300px"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="12">
- <el-form-item label="微信子公众号app_id" prop="subAppId">
- <el-input
- v-model="formModel.subAppId"
- placeholder="请输入服务商模式下子公众号APPID"
- style="width: 300px"
- ></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="12">
- <el-form-item
- label="微信子公众号sub_app_secret"
- prop="subAppSecret"
- >
- <el-input
- v-model="formModel.subAppSecret"
- placeholder="请输入sub_app_secret"
- style="width: 300px"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <el-form-item label="微信的回调地址" prop="wechatNotifyUrl">
- <el-input
- v-model="formModel.wechatNotifyUrl"
- placeholder="请输入微信的回调地址"
- style="width: 450px"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <el-form-item label="支付宝令牌" prop="appAuthToken">
- <el-input
- v-model="formModel.appAuthToken"
- placeholder="请输入支付宝appAuthToken"
- style="width: 450px"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="24">
- <el-form-item label="支付宝的回调地址" prop="alipayNotifyUrl">
- <el-input
- v-model="formModel.alipayNotifyUrl"
- placeholder="请输入支付宝的回调地址"
- style="width: 450px"
- ></el-input>
- </el-form-item>
- </el-col>
- </el-row>
- </el-form>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button @click="closeDialog">取 消</el-button>
- <el-button type="primary" @click="handleSubmit" :loading="submitting"
- >确 定</el-button
- >
- </span>
- </el-dialog>
- </template>
- <script>
- import Constant from "@/constant";
- import paymentInfoApi from "@/api/base/paymentInfo";
- import companyInfoApi from "@/api/bus/companyInfo";
- import pageUtil from "@/utils/page";
- import SelectTree from "@/components/SelectTree";
- import NProgress from "nprogress"; // progress bar
- import "nprogress/nprogress.css"; // progress bar style
- export default {
- props: ["businessKey", "title"],
- data() {
- return {
- ruleValidate: {
- companyId: [
- { required: true, message: "物业公司不能为空", trigger: "change" },
- ],
- name: [
- { required: true, message: "账户名称不能为空", trigger: "blur" },
- ],
- cycle: [
- { required: true, message: "结算周期不能为空", trigger: "blur" },
- ],
- },
- formModel: {
- companyId: "",
- name: "",
- mchId: "",
- subMchId: "",
- appAuthToken: "",
- financePersonId: "",
- financeUserId: "",
- },
- treeData: [],
- personList: [],
- userList: [],
- companyList: [],
- showDialog: true,
- loading: false,
- submitting: false,
- props: {
- // 配置项(必选)
- value: "id",
- label: "name",
- children: "children",
- },
- };
- },
- created() {
- this.loadTree();
- },
- methods: {
- closeDialog() {
- this.$emit("close", false);
- },
- handleSubmit() {
- var self = this;
- this.$refs["form"].validate((valid) => {
- if (valid) {
- (function () {
- var id = self.formModel.id;
- if (id == null || id.length == 0) {
- return paymentInfoApi.add(self.formModel);
- } else {
- return paymentInfoApi.update(self.formModel);
- }
- })().then(function (response) {
- var jsonData = response.data;
- if (jsonData.result) {
- self.$message({
- message: "保存成功!",
- type: "success",
- });
- self.$emit("close", true);
- } else {
- self.$message({
- message: jsonData.message + "",
- type: "warning",
- });
- self.$emit("close", false);
- }
- });
- }
- });
- },
- loadTree() {
- companyInfoApi.treeList().then((resp) => {
- var jsonData = resp.data;
- if (jsonData.result) {
- this.treeData = jsonData.data;
- } else {
- this.$message.error(jsonData.message + "");
- }
- });
- },
- },
- mounted: function () {
- var self = this;
- companyInfoApi.treeList().then((resp) => {
- var jsonData = resp.data;
- this.companyList = jsonData.data;
- });
- (function () {
- if (self.businessKey.length == 0) {
- return paymentInfoApi.create();
- } else {
- return paymentInfoApi.edit(self.businessKey);
- }
- })()
- .then((response) => {
- var jsonData = response.data;
- self.loading = false;
- if (jsonData.result) {
- self.formModel = jsonData.data;
- } else {
- self.$message.error(jsonData.message + "");
- }
- })
- .catch((error) => {
- self.$message.error(error + "");
- });
- },
- components: {
- "el-select-tree": SelectTree,
- },
- };
- </script>
- <style scoped>
- .user-panel {
- margin: 10px auto;
- }
- </style>
|