Browse Source

停车收费功能

xiao547607 4 years ago
parent
commit
fe13220b9d

+ 2 - 2
.env.development

@@ -1,9 +1,9 @@
 OUT_PUT_DIR=dist/jp-housekeeper-portal
 
 #VUE_APP_BACKEND_URL=http://127.0.0.1:7070/xpgj
-#VUE_APP_BACKEND_URL=http://127.0.0.1:8086/jp-housekeeper-server
+VUE_APP_BACKEND_URL=http://127.0.0.1:8086/jp-housekeeper-server
 #VUE_APP_BACKEND_URL=http://ykt-test.xiaoxinda.com/jp-housekeeper-server
-VUE_APP_BACKEND_URL=http://xpgjapi.xiaoxinda.com
+#VUE_APP_BACKEND_URL=http://xpgjapi.xiaoxinda.com
 #VUE_APP_BACKEND_URL=http://mirror.xiaoxinda.com/xpgjapi/
 
 #手机企业版

+ 46 - 0
src/api/base/parkingCoupon.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+import constant from '@/constant'
+
+function pageList(formData) {
+  return request.post(constant.serverUrl + "/base/parkingCoupon/pageList", formData);
+}
+
+function create() {
+  return request.get(constant.serverUrl + "/base/parkingCoupon/create");
+}
+
+function edit(id) {
+  return request.get(constant.serverUrl + "/base/parkingCoupon/edit/" + id);
+}
+
+function add(formModel) {
+  return request.post(constant.serverUrl + "/base/parkingCoupon/add", formModel, {
+    headers: {
+      "Content-Type": "application/json"
+    }
+  });
+}
+
+function update(formModel) {
+  return request.post(constant.serverUrl + "/base/parkingCoupon/update", formModel, {
+    headers: {
+      "Content-Type": "application/json"
+    }
+  });
+}
+
+function remove(id) {
+  return request.post(constant.serverUrl + "/base/parkingCoupon/delete/" + id);
+}
+
+function batchRemove(idList) {
+  return request.post(constant.serverUrl + "/base/parkingCoupon/batchDelete", idList, {
+    headers: {
+      "Content-Type": "application/json"
+    }
+  });
+}
+
+export default {
+  pageList, create, edit, add, update, remove, batchRemove
+}

+ 12 - 12
src/api/base/parkingInfo.js

@@ -1,50 +1,50 @@
 import request from '@/utils/request'
 import constant from '@/constant'
 
-function pageList(formData){
+function pageList(formData) {
   return request.post(constant.serverUrl + "/base/parkingInfo/pageList", formData);
 }
 
-function create(){
+function create() {
   return request.get(constant.serverUrl + "/base/parkingInfo/create");
 }
 
-function edit(id){
+function edit(id) {
   return request.get(constant.serverUrl + "/base/parkingInfo/edit/" + id);
 }
 
-function add(formModel){
-  return request.post(constant.serverUrl + "/base/parkingInfo/add", formModel,{
+function add(formModel) {
+  return request.post(constant.serverUrl + "/base/parkingInfo/add", formModel, {
     headers: {
       "Content-Type": "application/json"
     }
   });
 }
 
-function update(formModel){  
-  return request.post(constant.serverUrl + "/base/parkingInfo/update", formModel,{
+function update(formModel) {
+  return request.post(constant.serverUrl + "/base/parkingInfo/update", formModel, {
     headers: {
       "Content-Type": "application/json"
     }
   });
 }
 
-function remove(id){
+function remove(id) {
   return request.post(constant.serverUrl + "/base/parkingInfo/delete/" + id);
 }
 
-function batchRemove(idList){
-  return request.post(constant.serverUrl + "/base/parkingInfo/batchDelete",idList,{
+function batchRemove(idList) {
+  return request.post(constant.serverUrl + "/base/parkingInfo/batchDelete", idList, {
     headers: {
       "Content-Type": "application/json"
     }
   });
 }
 
-function query(){
+function query() {
   return request.post(constant.serverUrl + "/base/parkingInfo/query");
 }
 
 export default {
-  pageList,create,edit,add,update,remove,batchRemove,query
+  pageList, create, edit, add, update, remove, batchRemove, query
 }

+ 46 - 0
src/api/base/parkingMerchant.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+import constant from '@/constant'
+
+function pageList(formData) {
+  return request.post(constant.serverUrl + "/base/parkingMerchant/pageList", formData);
+}
+
+function create() {
+  return request.get(constant.serverUrl + "/base/parkingMerchant/create");
+}
+
+function edit(id) {
+  return request.get(constant.serverUrl + "/base/parkingMerchant/edit/" + id);
+}
+
+function add(formModel) {
+  return request.post(constant.serverUrl + "/base/parkingMerchant/add", formModel, {
+    headers: {
+      "Content-Type": "application/json"
+    }
+  });
+}
+
+function update(formModel) {
+  return request.post(constant.serverUrl + "/base/parkingMerchant/update", formModel, {
+    headers: {
+      "Content-Type": "application/json"
+    }
+  });
+}
+
+function remove(id) {
+  return request.post(constant.serverUrl + "/base/parkingMerchant/delete/" + id);
+}
+
+function batchRemove(idList) {
+  return request.post(constant.serverUrl + "/base/parkingMerchant/batchDelete", idList, {
+    headers: {
+      "Content-Type": "application/json"
+    }
+  });
+}
+
+export default {
+  pageList, create, edit, add, update, remove, batchRemove
+}

+ 26 - 0
src/routers/modules/base.js

@@ -631,6 +631,32 @@ var routers = [
                         title: '注册人员管理'
                 }
         },
+        {
+                //商户优惠卷管理
+                path: '/base/parkingCoupon/list',
+                name: 'baseParkingCouponList',
+                // route level code-splitting
+                // this generates a separate chunk (about.[hash].js) for this route
+                // which is lazy-loaded when the route is visited.
+                component: () => import('@/views/base/parkingCoupon-list.vue'),
+                meta: {
+                        roles: ["admin"],
+                        title: '商户优惠卷管理'
+                }
+        },
+        {
+                //商户管理
+                path: '/base/parkingMerchant/list',
+                name: 'baseParkingMerchantList',
+                // route level code-splitting
+                // this generates a separate chunk (about.[hash].js) for this route
+                // which is lazy-loaded when the route is visited.
+                component: () => import('@/views/base/parkingMerchant-list.vue'),
+                meta: {
+                        roles: ["admin"],
+                        title: '商户管理'
+                }
+        },
 ]
 
 export default routers;

+ 251 - 0
src/views/base/parkingCoupon-detail.vue

@@ -0,0 +1,251 @@
+
+<style scoped>
+.user-panel {
+  margin: 10px auto;
+}
+</style>
+<template>
+  <el-dialog
+    :visible.sync="showDialog"
+    :title="title"
+    :modal-append-to-body="false"
+    style="text-align: left"
+    @close="closeDialog"
+    :close-on-click-modal="false"
+  >
+    <div class="user-panel" v-loading="loading">
+      <el-form
+        ref="form"
+        :model="formModel"
+        :rules="ruleValidate"
+        :label-width="'100px'"
+      >
+        <el-form-item label="" prop="id">
+          <el-input
+            v-model="formModel.id"
+            placeholder="请输入"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="商户id" prop="merchantId">
+          <el-input
+            v-model="formModel.merchantId"
+            placeholder="请输入商户id"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item
+          label="优惠券类型(3:时长减免券,4:全免券,5:金额减免券)"
+          prop="type"
+        >
+          <el-input
+            v-model="formModel.type"
+            placeholder="请输入优惠券类型(3:时长减免券,4:全免券,5:金额减免券)"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="优惠额度" prop="reduce">
+          <el-input
+            v-model="formModel.reduce"
+            placeholder="请输入优惠额度"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="停车记录id" prop="parkingRecordId">
+          <el-input
+            v-model="formModel.parkingRecordId"
+            placeholder="请输入停车记录id"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="使用状态(0:未使用,1:使用)" prop="useStatus">
+          <el-input
+            v-model="formModel.useStatus"
+            placeholder="请输入使用状态(0:未使用,1:使用)"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="使用额度" prop="useQuote">
+          <el-input
+            v-model="formModel.useQuote"
+            placeholder="请输入使用额度"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="使用时间" prop="useTime">
+          <el-input
+            v-model="formModel.useTime"
+            placeholder="请输入使用时间"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="失效时间" prop="invalidTime">
+          <el-input
+            v-model="formModel.invalidTime"
+            placeholder="请输入失效时间"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="核销时间" prop="verifyTime">
+          <el-input
+            v-model="formModel.verifyTime"
+            placeholder="请输入核销时间"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+      </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 parkingCouponApi from "@/api/base/parkingCoupon";
+import dataDictionaryApi from "@/api/sys/dataDictionary";
+import companyInfoApi from "@/api/base/companyInfo";
+import SelectTree from "@/components/SelectTree";
+
+export default {
+  props: ["businessKey", "title"],
+  data() {
+    return {
+      formModel: {},
+      ruleValidate: {
+        id: [{ required: true, message: "不能为空", trigger: "blur" }],
+        merchantId: [
+          { required: true, message: "商户id不能为空", trigger: "blur" },
+        ],
+        type: [
+          {
+            required: true,
+            message:
+              "优惠券类型(3:时长减免券,4:全免券,5:金额减免券)不能为空",
+            trigger: "blur",
+          },
+        ],
+        reduce: [
+          { required: true, message: "优惠额度不能为空", trigger: "blur" },
+        ],
+        parkingRecordId: [
+          { required: true, message: "停车记录id不能为空", trigger: "blur" },
+        ],
+        useStatus: [
+          {
+            required: true,
+            message: "使用状态(0:未使用,1:使用)不能为空",
+            trigger: "blur",
+          },
+        ],
+        useQuote: [
+          { required: true, message: "使用额度不能为空", trigger: "blur" },
+        ],
+        useTime: [
+          { required: true, message: "使用时间不能为空", trigger: "blur" },
+        ],
+        invalidTime: [
+          { required: true, message: "失效时间不能为空", trigger: "blur" },
+        ],
+        verifyTime: [
+          { required: true, message: "核销时间不能为空", trigger: "blur" },
+        ],
+      },
+      showDialog: true,
+      loading: false,
+      submitting: false,
+      typeResult:[],
+      companyResult:[]
+    };
+  },
+  created() {
+    var self = this;
+
+    companyInfoApi.treeList().then(function (response) {
+      var jsonData = response.data;
+      if (jsonData.result) {
+        if (jsonData.data != null && jsonData.data != "") {
+          self.companyResult = jsonData.data;
+        }
+      }
+    });
+
+    dataDictionaryApi
+      .findByCatalogName({
+        catalogName: "优惠券类型",
+      })
+      .then((response) => {
+        var jsonData = response.data;
+        this.typeResult = jsonData.data;
+      });
+
+  },
+  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 parkingCouponApi.add(self.formModel);
+            } else {
+              return parkingCouponApi.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);
+            }
+          });
+        }
+      });
+    },
+  },
+  mounted: function () {
+    var self = this;
+
+    (function () {
+      if (self.businessKey.length == 0) {
+        return parkingCouponApi.create();
+      } else {
+        return parkingCouponApi.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 + "");
+      });
+  },
+};
+</script>

+ 347 - 0
src/views/base/parkingCoupon-list.vue

@@ -0,0 +1,347 @@
+<template>
+  <div>
+    <el-breadcrumb separator=">">
+      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
+      <el-breadcrumb-item>
+        <a href="#">系统管理</a>
+      </el-breadcrumb-item>
+      <el-breadcrumb-item>
+        <a href="/parkingCoupon">商户优惠卷管理</a>
+      </el-breadcrumb-item>
+    </el-breadcrumb>
+    <el-divider></el-divider>
+    <!--
+      要resetFields起作用,必须配置:model和prop
+    -->
+    <el-form
+      ref="queryForm"
+      :model="queryModel"
+      inline
+      class="demo-form-inline"
+    >
+      <el-form-item label="商户名称" prop="merchantName">
+        <el-input
+          type="text"
+          size="mini"
+          v-model="queryModel.merchantName"
+        ></el-input>
+      </el-form-item>
+      <el-form-item label="优惠券类型" prop="type">
+        <el-select
+          filterable
+          placeholder="请选择"
+          style="width: 180px"
+          v-model="queryModel.type"
+          size="mini"
+        >
+          <el-option
+            v-for="result in typeResult"
+            :key="result.value"
+            :label="result.name"
+            :value="result.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="primary"
+          size="mini"
+          icon="ios-search"
+          @click="changePage(1)"
+          :loading="loading"
+          >查询</el-button
+        >&nbsp;
+        <el-button
+          type="info"
+          size="mini"
+          style="margin-left: 8px"
+          @click="handleReset('queryForm')"
+          >重置</el-button
+        >&nbsp;
+      </el-form-item>
+    </el-form>
+    <el-divider></el-divider>
+    <el-row class="button-group">
+  
+    </el-row>
+    <el-table
+      :data="tableData"
+      style="min-height: 400px"
+      v-loading="loading"
+      stripe
+      @sort-change="sortChange"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55"></el-table-column>
+      <el-table-column
+        prop="merchantName"
+        label="商户名称"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="typeName"
+        label="优惠券类型"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="reduce"
+        label="优惠额度"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="parkingRecordId"
+        label="停车记录id"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="useStatus"
+        label="使用状态"
+        width="180"
+      >
+      <template slot-scope="{ row }">
+        <span v-if="row.useStatus">使用</span>
+        <span v-else>未使用</span>
+      </template>
+      </el-table-column>
+      <el-table-column
+        prop="useQuote"
+        label="使用额度"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="useTime"
+        label="使用时间"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="invalidTime"
+        label="失效时间"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="verifyTime"
+        label="核销时间"
+        width="180"
+      ></el-table-column>
+    </el-table>
+    <el-pagination
+      :current-page.sync="pageIndex"
+      :total="totalElements"
+      :page-sizes="pageSizeList"
+      @current-change="changePage"
+      @size-change="pageSizeChange"
+      layout="total, sizes, prev, pager, next, jumper"
+    ></el-pagination>
+    <parkingCoupon-detail
+      v-if="showModal"
+      :businessKey="businessKey"
+      :title="modalTitle"
+      @close="onDetailModalClose"
+    ></parkingCoupon-detail>
+  </div>
+</template>
+<script>
+import Constant from "@/constant";
+import ParkingCouponDetail from "./parkingCoupon-detail";
+import parkingCouponApi from "@/api/base/parkingCoupon";
+import dataDictionaryApi from "@/api/sys/dataDictionary";
+import NProgress from "nprogress"; // progress bar
+import "nprogress/nprogress.css"; // progress bar style
+
+export default {
+  name: "baseParkingCouponList",
+  data() {
+    var self = this;
+
+    return {
+      queryModel: {
+        id:"",
+        merchantName: "",
+        type:""
+      },
+      loading: false,
+      tableData: [],
+      pageIndex: 1,
+      pageSize: 10,
+      totalPages: 0,
+      totalElements: 0,
+      field: "",
+      direction: "",
+      pageSizeList: [10, 20, 30],
+      multipleSelection: [],
+      showModal: false,
+      modalTitle: "",
+      businessKey: "",
+      typeResult: [],
+    };
+  },
+  created() {
+    var self = this;
+
+    dataDictionaryApi
+      .findByCatalogName({
+        catalogName: "优惠券类型",
+      })
+      .then((response) => {
+        var jsonData = response.data;
+        this.typeResult = jsonData.data;
+      });
+  },
+  methods: {
+    changePage(pageIndex) {
+      var self = this;
+
+      self.loading = true;
+
+      self.pageIndex = pageIndex;
+      var formData = new FormData();
+
+      formData.append("pageIndex", self.pageIndex);
+      formData.append("pageSize", self.pageSize);
+
+      formData.append("id", self.queryModel.id);
+      formData.append("merchantName", self.queryModel.merchantName);
+      formData.append("type", self.queryModel.type);
+
+      if (this.field != null) {
+        formData.append("field", this.field);
+      }
+
+      if (this.direction != null) {
+        formData.append("direction", this.direction);
+      }
+
+      parkingCouponApi
+        .pageList(formData)
+        .then(function (response) {
+          self.loading = false;
+
+          var jsonData = response.data.data;
+
+          self.tableData = jsonData.data;
+          self.totalPages = jsonData.totalPages;
+          self.totalElements = jsonData.recordsTotal;
+        })
+        .catch((error) => {
+          self.loading = false;
+          // self.$message.error(error + "");
+        });
+    },
+    pageSizeChange(pageSize) {
+      this.pageSize = pageSize;
+
+      this.$nextTick(() => {
+        this.changePage(this.pageIndex);
+      });
+    },
+    sortChange(data) {
+      this.field = data.column.field;
+      this.direction = data.order;
+
+      this.changePage(this.pageIndex);
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    handleReset(name) {
+      this.$refs[name].resetFields();
+    },
+    handleAdd() {
+      this.modalTitle = "新增";
+      this.businessKey = "";
+      this.showModal = true;
+    },
+    handleEdit(record) {
+      this.modalTitle = "编辑";
+      this.businessKey = record.id;
+      this.showModal = true;
+    },
+    handleDelete(record) {
+      var self = this;
+
+      self
+        .$confirm("是否确认删除?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+        .then(() => {
+          parkingCouponApi.remove(record.id).then(function (response) {
+            var jsonData = response.data;
+
+            if (jsonData.result) {
+              // var index = self.tableData.indexOf(record);
+              // self.tableData.splice(index, 1);
+              self.changePage(self.pageIndex);
+
+              self.$message({
+                type: "success",
+                message: "删除成功!",
+              });
+            }
+          });
+        });
+    },
+    handleBatchDelete() {
+      var self = this;
+
+      var idList = this.multipleSelection.map((record) => {
+        return record.id;
+      });
+
+      this.$confirm("是否确认删除选中项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        parkingCouponApi.batchRemove(idList).then(function (response) {
+          var jsonData = response.data;
+
+          if (jsonData.result) {
+            self.changePage(self.pageIndex);
+
+            self.$message({
+              type: "success",
+              message: "删除成功!",
+            });
+          }
+        });
+      });
+    },
+    onDetailModalClose(refreshed) {
+      //保存成功后回调
+      this.showModal = false;
+
+      if (refreshed) {
+        this.changePage(this.pageIndex);
+      }
+    },
+  },
+  mounted: function () {
+    this.changePage(1);
+  },
+  components: {
+    "parkingCoupon-detail": ParkingCouponDetail,
+  },
+};
+</script>
+<style lang="scss" scoped>
+.el-breadcrumb {
+  margin: 10px;
+  line-height: 20px;
+}
+
+.el-divider {
+  margin: 5px 0;
+}
+
+.demo-form-inline {
+  margin-left: 10px;
+  text-align: left;
+}
+
+.button-group {
+  margin-left: 10px;
+  text-align: left;
+}
+</style>

+ 30 - 0
src/views/base/parkingInfo-detail.vue

@@ -27,6 +27,13 @@
             style="width: 300px"
           ></el-input>
         </el-form-item>
+        <el-form-item label="停车场编号" prop="parkId">
+          <el-input
+            v-model="formModel.parkId"
+            placeholder="请输入停车场编号"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
         <el-form-item label="上级" prop="parentId">
           <el-select-tree
             size="mini"
@@ -36,6 +43,15 @@
             height="200"
           ></el-select-tree>
         </el-form-item>
+        <el-form-item label="所属公司" prop="companyId">
+          <el-select-tree
+            :props="props"
+            :options="companyResult"
+            v-model="formModel.companyId"
+            height="200"
+            style="width: 230px"
+          ></el-select-tree>
+        </el-form-item>
       </el-form>
     </div>
     <span slot="footer" class="dialog-footer">
@@ -50,6 +66,7 @@
 import Constant from "@/constant";
 import parkingInfoApi from "@/api/base/parkingInfo";
 import SelectTree from "@/components/SelectTree";
+import companyInfoApi from "@/api/base/companyInfo";
 
 export default {
   props: ["businessKey", "title"],
@@ -60,6 +77,9 @@ export default {
         parkingName: [
           { required: true, message: "名称不能为空", trigger: "blur" },
         ],
+        parkId: [
+          { required: true, message: "停车场编号不能为空", trigger: "blur" },
+        ],
       },
       showDialog: true,
       loading: false,
@@ -69,6 +89,7 @@ export default {
         value: "id",
         label: "parkingName",
       },
+      companyResult: [],
     };
   },
   created() {
@@ -80,6 +101,15 @@ export default {
         self.parentResult = jsonData.data;
       }
     });
+
+    companyInfoApi.treeList().then(function (response) {
+      var jsonData = response.data;
+      if (jsonData.result) {
+        if (jsonData.data != null && jsonData.data != "") {
+          self.companyResult = jsonData.data;
+        }
+      }
+    });
   },
   methods: {
     closeDialog() {

+ 2 - 0
src/views/base/parkingInfo-list.vue

@@ -90,7 +90,9 @@
         label="名称"
         width="180"
       ></el-table-column>
+      <el-table-column prop="parkId" label="停车场编号" width="180"></el-table-column>
       <el-table-column prop="parentName" label="上级" width="180"></el-table-column>
+      <el-table-column prop="companyName" label="所属物业公司" width="180"></el-table-column>
       <el-table-column prop="createTime" label="创建时间" width="180"></el-table-column>
       <el-table-column prop="updateTime" label="更新时间" width="180"></el-table-column>
       <el-table-column label="操作">

+ 189 - 0
src/views/base/parkingMerchant-detail.vue

@@ -0,0 +1,189 @@
+
+<style scoped>
+.user-panel {
+  margin: 10px auto;
+}
+</style>
+<template>
+  <el-dialog
+    :visible.sync="showDialog"
+    :title="title"
+    :modal-append-to-body="false"
+    style="text-align: left"
+    @close="closeDialog"
+    :close-on-click-modal="false"
+  >
+    <div class="user-panel" v-loading="loading">
+      <el-form
+        ref="form"
+        :model="formModel"
+        :rules="ruleValidate"
+        :label-width="'120px'"
+      >
+        <el-form-item label="所属物业公司" prop="companyId">
+          <el-select-tree
+            :props="props"
+            :options="companyResult"
+            v-model="formModel.companyId"
+            height="200"
+            style="width: 330px"
+            size="large"
+          ></el-select-tree>
+        </el-form-item>
+        <el-form-item label="商户名称" prop="merchantName">
+          <el-input
+            v-model="formModel.merchantName"
+            placeholder="请输入商户名称"
+            style="width: 300px"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="优惠券类型" prop="type">
+          <el-select
+            filterable
+            placeholder="请选择"
+            style="width: 280px"
+            v-model="formModel.type"
+          >
+            <el-option
+              v-for="result in typeResult"
+              :key="result.value"
+              :label="result.name"
+              :value="result.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="优惠额度" prop="reduce">
+          <el-input-number
+            v-model="formModel.reduce"
+            placeholder="请输入优惠额度"
+            style="width: 180px"
+            min="0"
+          ></el-input-number>
+        </el-form-item>
+      </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 parkingMerchantApi from "@/api/base/parkingMerchant";
+import dataDictionaryApi from "@/api/sys/dataDictionary";
+import companyInfoApi from "@/api/base/companyInfo";
+import SelectTree from "@/components/SelectTree";
+
+export default {
+  components: {
+    "el-select-tree": SelectTree,
+  },
+  props: ["businessKey", "title"],
+  data() {
+    return {
+      formModel: {},
+      ruleValidate: {
+        merchantName: [
+          { required: true, message: "商户名称不能为空", trigger: "blur" },
+        ],
+        companyId: [
+          { required: true, message: "所属物业公司不能为空", trigger: "blur" },
+        ],
+      },
+      showDialog: true,
+      loading: false,
+      submitting: false,
+      typeResult: [],
+      companyResult: [],
+    };
+  },
+  created() {
+    var self = this;
+
+    companyInfoApi.treeList().then(function (response) {
+      var jsonData = response.data;
+      if (jsonData.result) {
+        if (jsonData.data != null && jsonData.data != "") {
+          self.companyResult = jsonData.data;
+        }
+      }
+    });
+
+    dataDictionaryApi
+      .findByCatalogName({
+        catalogName: "优惠券类型",
+      })
+      .then((response) => {
+        var jsonData = response.data;
+        this.typeResult = jsonData.data;
+      });
+  },
+  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 parkingMerchantApi.add(self.formModel);
+            } else {
+              return parkingMerchantApi.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);
+            }
+          });
+        }
+      });
+    },
+  },
+  mounted: function () {
+    var self = this;
+
+    (function () {
+      if (self.businessKey.length == 0) {
+        return parkingMerchantApi.create();
+      } else {
+        return parkingMerchantApi.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 + "");
+      });
+  },
+};
+</script>

+ 385 - 0
src/views/base/parkingMerchant-list.vue

@@ -0,0 +1,385 @@
+<template>
+  <div>
+    <el-breadcrumb separator=">">
+      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
+      <el-breadcrumb-item>
+        <a href="#">系统管理</a>
+      </el-breadcrumb-item>
+      <el-breadcrumb-item>
+        <a href="/parkingMerchant">商户管理</a>
+      </el-breadcrumb-item>
+    </el-breadcrumb>
+    <el-divider></el-divider>
+    <!--
+      要resetFields起作用,必须配置:model和prop
+    -->
+    <el-form
+      ref="queryForm"
+      :model="queryModel"
+      inline
+      class="demo-form-inline"
+    >
+      <el-form-item label="所属物业公司" prop="companyId">
+        <el-select-tree
+          :props="props"
+          :options="companyResult"
+          v-model="queryModel.companyId"
+          height="200"
+          style="width: 230px"
+          size="mini"
+        ></el-select-tree>
+      </el-form-item>
+      <el-form-item label="商户名称" prop="merchantName">
+        <el-input
+          type="text"
+          size="mini"
+          v-model="queryModel.merchantName"
+        ></el-input>
+      </el-form-item>
+      <el-form-item label="优惠券类型" prop="type">
+        <el-select
+          filterable
+          placeholder="请选择"
+          style="width: 180px"
+          v-model="queryModel.type"
+          size="mini"
+        >
+          <el-option
+            v-for="result in typeResult"
+            :key="result.value"
+            :label="result.name"
+            :value="result.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button
+          type="primary"
+          size="mini"
+          icon="ios-search"
+          @click="changePage(1)"
+          :loading="loading"
+          >查询</el-button
+        >&nbsp;
+        <el-button
+          type="info"
+          size="mini"
+          style="margin-left: 8px"
+          @click="handleReset('queryForm')"
+          >重置</el-button
+        >&nbsp;
+      </el-form-item>
+    </el-form>
+    <el-divider></el-divider>
+    <el-row class="button-group">
+      <el-button
+        type="primary"
+        size="small"
+        plain
+        icon="el-icon-circle-plus"
+        @click="handleAdd"
+        >新增</el-button
+      >
+      <el-button
+        type="primary"
+        size="small"
+        plain
+        icon="el-icon-circle-plus"
+        :disabled="multipleSelection.length == 0"
+        @click="handleBatchDelete"
+        >删除选中项</el-button
+      >
+    </el-row>
+    <el-table
+      :data="tableData"
+      style="min-height: 400px"
+      v-loading="loading"
+      stripe
+      @sort-change="sortChange"
+      @selection-change="handleSelectionChange"
+    >
+      <el-table-column type="selection" width="55"></el-table-column>
+      <el-table-column
+        prop="companyName"
+        label="所属物业公司"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="merchantName"
+        label="商户名称"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="merchantNo"
+        label="商户编号"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="operatorNo"
+        label="商户生成的操作者编号"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="operatorPassword"
+        label="操作者密码"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="typeName"
+        label="优惠券类型"
+        width="180"
+      ></el-table-column>
+      <el-table-column
+        prop="reduce"
+        label="优惠额度"
+        width="180"
+      ></el-table-column>
+      <el-table-column label="操作" width="150">
+        <template slot-scope="{ row }">
+          <el-button size="mini" type="warning" @click="handleEdit(row)"
+            >编辑</el-button
+          >
+          <el-button size="mini" type="danger" @click="handleDelete(row)"
+            >删除</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
+    <el-pagination
+      :current-page.sync="pageIndex"
+      :total="totalElements"
+      :page-sizes="pageSizeList"
+      @current-change="changePage"
+      @size-change="pageSizeChange"
+      layout="total, sizes, prev, pager, next, jumper"
+    ></el-pagination>
+    <parkingMerchant-detail
+      v-if="showModal"
+      :businessKey="businessKey"
+      :title="modalTitle"
+      @close="onDetailModalClose"
+    ></parkingMerchant-detail>
+  </div>
+</template>
+<script>
+import Constant from "@/constant";
+import ParkingMerchantDetail from "./parkingMerchant-detail";
+import parkingMerchantApi from "@/api/base/parkingMerchant";
+import dataDictionaryApi from "@/api/sys/dataDictionary";
+import companyInfoApi from "@/api/base/companyInfo";
+import SelectTree from "@/components/SelectTree";
+import NProgress from "nprogress"; // progress bar
+import "nprogress/nprogress.css"; // progress bar style
+
+export default {
+  name: "baseParkingMerchantList",
+  data() {
+    var self = this;
+
+    return {
+      queryModel: {
+        id: "",
+        merchantName: "",
+        companyId: "",
+        type: "",
+      },
+      loading: false,
+      tableData: [],
+      pageIndex: 1,
+      pageSize: 10,
+      totalPages: 0,
+      totalElements: 0,
+      field: "",
+      direction: "",
+      pageSizeList: [10, 20, 30],
+      multipleSelection: [],
+      showModal: false,
+      modalTitle: "",
+      businessKey: "",
+      typeResult: [],
+      companyResult: [],
+    };
+  },
+  created() {
+    var self = this;
+
+    companyInfoApi.treeList().then(function (response) {
+      var jsonData = response.data;
+      if (jsonData.result) {
+        if (jsonData.data != null && jsonData.data != "") {
+          self.companyResult = jsonData.data;
+        }
+      }
+    });
+
+    dataDictionaryApi
+      .findByCatalogName({
+        catalogName: "优惠券类型",
+      })
+      .then((response) => {
+        var jsonData = response.data;
+        this.typeResult = jsonData.data;
+      });
+  },
+  methods: {
+    changePage(pageIndex) {
+      var self = this;
+
+      self.loading = true;
+
+      self.pageIndex = pageIndex;
+      var formData = new FormData();
+
+      formData.append("pageIndex", self.pageIndex);
+      formData.append("pageSize", self.pageSize);
+
+      formData.append("id", self.queryModel.id);
+      formData.append("merchantName", self.queryModel.merchantName);
+      if(self.queryModel.companyId != null){
+        formData.append("companyId", self.queryModel.companyId);
+      }
+      formData.append("type", self.queryModel.type);
+
+      if (this.field != null) {
+        formData.append("field", this.field);
+      }
+
+      if (this.direction != null) {
+        formData.append("direction", this.direction);
+      }
+
+      parkingMerchantApi
+        .pageList(formData)
+        .then(function (response) {
+          self.loading = false;
+
+          var jsonData = response.data.data;
+
+          self.tableData = jsonData.data;
+          self.totalPages = jsonData.totalPages;
+          self.totalElements = jsonData.recordsTotal;
+        })
+        .catch((error) => {
+          self.loading = false;
+          // self.$message.error(error + "");
+        });
+    },
+    pageSizeChange(pageSize) {
+      this.pageSize = pageSize;
+
+      this.$nextTick(() => {
+        this.changePage(this.pageIndex);
+      });
+    },
+    sortChange(data) {
+      this.field = data.column.field;
+      this.direction = data.order;
+
+      this.changePage(this.pageIndex);
+    },
+    handleSelectionChange(val) {
+      this.multipleSelection = val;
+    },
+    handleReset(name) {
+      this.$refs[name].resetFields();
+    },
+    handleAdd() {
+      this.modalTitle = "新增";
+      this.businessKey = "";
+      this.showModal = true;
+    },
+    handleEdit(record) {
+      this.modalTitle = "编辑";
+      this.businessKey = record.id;
+      this.showModal = true;
+    },
+    handleDelete(record) {
+      var self = this;
+
+      self
+        .$confirm("是否确认删除?", "提示", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning",
+        })
+        .then(() => {
+          parkingMerchantApi.remove(record.id).then(function (response) {
+            var jsonData = response.data;
+
+            if (jsonData.result) {
+              // var index = self.tableData.indexOf(record);
+              // self.tableData.splice(index, 1);
+              self.changePage(self.pageIndex);
+
+              self.$message({
+                type: "success",
+                message: "删除成功!",
+              });
+            }
+          });
+        });
+    },
+    handleBatchDelete() {
+      var self = this;
+
+      var idList = this.multipleSelection.map((record) => {
+        return record.id;
+      });
+
+      this.$confirm("是否确认删除选中项?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        parkingMerchantApi.batchRemove(idList).then(function (response) {
+          var jsonData = response.data;
+
+          if (jsonData.result) {
+            self.changePage(self.pageIndex);
+
+            self.$message({
+              type: "success",
+              message: "删除成功!",
+            });
+          }
+        });
+      });
+    },
+    onDetailModalClose(refreshed) {
+      //保存成功后回调
+      this.showModal = false;
+
+      if (refreshed) {
+        this.changePage(this.pageIndex);
+      }
+    },
+  },
+  mounted: function () {
+    this.changePage(1);
+  },
+  components: {
+    "parkingMerchant-detail": ParkingMerchantDetail,
+    "el-select-tree": SelectTree,
+  },
+};
+</script>
+<style lang="scss" scoped>
+.el-breadcrumb {
+  margin: 10px;
+  line-height: 20px;
+}
+
+.el-divider {
+  margin: 5px 0;
+}
+
+.demo-form-inline {
+  margin-left: 10px;
+  text-align: left;
+}
+
+.button-group {
+  margin-left: 10px;
+  text-align: left;
+}
+</style>