瀏覽代碼

中心店/配送店绑定

chenrui 4 年之前
父節點
當前提交
39b264233d
共有 3 個文件被更改,包括 347 次插入0 次删除
  1. 38 0
      src/config/router.config.js
  2. 168 0
      src/views/storeManagement/bind/editModal.vue
  3. 141 0
      src/views/storeManagement/bind/list.vue

+ 38 - 0
src/config/router.config.js

@@ -1530,6 +1530,44 @@ export const asyncRouterMap = [
           }
         ]
       },
+      // 中心店/配送店管理
+      {
+        path: '/storeManagement',
+        redirect: '/storeManagement/bind',
+        component: PageView,
+        meta: {
+          title: '中心店/配送店管理',
+          icon: 'bank'
+          // permission: 'M_basicData'
+        },
+        children: [
+          {
+            path: '/storeManagement/bind',
+            redirect: '/storeManagement/bind/list',
+            name: 'storeManagementBind',
+            component: RouteView,
+            meta: {
+              title: '中心店/配送店绑定',
+              icon: 'link'
+              // permission: 'M_goodsManage_list'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'storeManagementBindList',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/storeManagement/bind/list.vue'),
+                meta: {
+                  title: '中心店/配送店绑定列表',
+                  icon: 'link',
+                  hidden: true
+                  // permission: 'M_goodsManage_list'
+                }
+              }
+            ]
+          }
+        ]
+      },
       // 权限管理
       {
         path: '/auth',

+ 168 - 0
src/views/storeManagement/bind/editModal.vue

@@ -0,0 +1,168 @@
+<template>
+  <a-modal
+    centered
+    class="bindEdit-modal"
+    :footer="null"
+    :maskClosable="false"
+    title="设置绑定"
+    v-model="isShow"
+    @cancle="isShow=false"
+    :width="800">
+    <!-- 表单 -->
+    <div>
+      <a-form-model
+        id="bindEdit-form"
+        ref="ruleForm"
+        :model="form"
+        :rules="rules"
+        :label-col="formItemLayout.labelCol"
+        :wrapper-col="formItemLayout.wrapperCol"
+      >
+        <a-form-model-item label="选择中心店(单选)" prop="name">
+          <a-select
+            placeholder="请选择"
+            id="bindEdit-name"
+            allowClear
+            v-model="form.name"
+            :showSearch="true"
+            option-filter-prop="children"
+            :filter-option="filterOption">
+            <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+          </a-select>
+        </a-form-model-item>
+        <a-form-model-item label="选择配送店(多选)" prop="namse">
+          <a-select
+            placeholder="请选择"
+            id="bindEdit-name"
+            allowClear
+            mode="multiple"
+            v-model="form.namse"
+            :showSearch="true"
+            option-filter-prop="children"
+            :filter-option="filterOption">
+            <a-select-option v-for="item in productBrandList" :key="item.brandSn" :value="item.brandSn">{{ item.brandName }}</a-select-option>
+          </a-select>
+        </a-form-model-item>
+      </a-form-model>
+      <div class="btn-cont">
+        <a-button type="primary" id="bindEdit-modal-save" @click="handleSave">保存</a-button>
+        <a-button id="bindEdit-modal-back" @click="isShow = false" style="margin-left: 15px;">返回列表</a-button>
+      </div>
+    </div>
+  </a-modal>
+</template>
+
+<script>
+import { STable } from '@/components'
+import { warehouseSave } from '@/api/warehouse'
+export default {
+  name: 'BindEditModal',
+  components: { STable },
+  props: {
+    openModal: { //  弹框显示状态
+      type: Boolean,
+      default: false
+    },
+    itemSn: {
+      type: [Number, String],
+      default: ''
+    },
+    nowData: {
+      type: Object,
+      default: null
+    }
+  },
+  data () {
+    return {
+      isShow: this.openModal, //  是否打开弹框
+      formItemLayout: {
+        labelCol: { span: 6 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        name: '',
+        namse: ''
+      },
+      rules: {
+        name: [
+          { required: true, message: '请输入仓库名称', trigger: 'blur' }
+        ]
+      },
+      productBrandList: []
+    }
+  },
+  methods: {
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    //  详情
+    getDetail () {
+      this.form = {
+        name: this.nowData && this.nowData.name ? this.nowData.name : ''
+      }
+    },
+    //  保存
+    handleSave () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = {
+            warehouseSn: this.itemSn ? this.itemSn : undefined,
+            name: this.form.name //  仓库名称
+          }
+          warehouseSave(params).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('ok')
+              setTimeout(function () {
+                _this.isShow = false
+                _this.$refs.ruleForm.resetFields()
+              }, 300)
+            } else {
+
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+      } else {
+        this.form = {
+          name: ''
+        }
+      }
+    },
+    itemSn (newValue, oldValue) {
+      if (this.isShow && newValue) {
+        this.getDetail()
+      }
+    }
+  }
+}
+</script>
+
+<style lang="less">
+  .bindEdit-modal{
+    .ant-modal-body {
+    	padding: 40px 40px 24px;
+    }
+    .btn-cont {
+    	text-align: center;
+    	margin: 35px 0 10px;
+    }
+  }
+</style>

+ 141 - 0
src/views/storeManagement/bind/list.vue

@@ -0,0 +1,141 @@
+<template>
+  <a-card size="small" :bordered="false" class="bindList-wrap">
+    <!-- 搜索条件 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="15">
+          <a-col :md="6" :sm="24">
+            <a-form-item label="中心店名称">
+              <a-input id="bindList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入中心店名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="配送店名称">
+              <a-input id="bindList-name" v-model.trim="queryParam.name" allowClear placeholder="请输入配送店名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="bindList-refresh">查询</a-button>
+            <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="bindList-reset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 操作按钮 -->
+    <div class="table-operator">
+      <a-button id="bindList-add" type="primary" class="button-error" @click="handleEdit()">新增</a-button>
+    </div>
+    <!-- 列表 -->
+    <s-table
+      class="sTable"
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      :scroll="{ y: tableHeight }"
+      bordered>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-button
+          size="small"
+          type="link"
+          class="button-info"
+          @click="handleEdit(record)"
+          id="bindList-edit-btn">编辑</a-button>
+        <a-button
+          size="small"
+          type="link"
+          class="button-error"
+          @click="handleDel(record)"
+          id="bindList-del-btn">删除</a-button>
+      </template>
+    </s-table>
+    <!-- 新增/编辑 -->
+    <storeManagement-bind-edit-modal :openModal="openModal" :nowData="nowData" :itemSn="itemSn" @ok="handleOk" @close="closeModal" />
+  </a-card>
+</template>
+
+<script>
+import { warehouseList, warehouseDel } from '@/api/warehouse'
+import { STable } from '@/components'
+import storeManagementBindEditModal from './editModal.vue'
+export default {
+  components: { STable, storeManagementBindEditModal },
+  data () {
+    return {
+      queryParam: { //  查询条件
+        name: '' //  仓库名称
+      },
+      tableHeight: 0,
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '中心店名称', dataIndex: 'name', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '已绑配送店', dataIndex: 'names', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '操作', scopedSlots: { customRender: 'action' }, align: 'center' }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.disabled = true
+        if (this.tableHeight == 0) {
+          this.tableHeight = window.innerHeight - 380
+        }
+        return warehouseList(Object.assign(parameter, this.queryParam)).then(res => {
+          const data = res.data
+          const no = (data.pageNo - 1) * data.pageSize
+          for (var i = 0; i < data.list.length; i++) {
+            data.list[i].no = no + i + 1
+          }
+          this.disabled = false
+          return data
+        })
+      },
+      openModal: false, //  新增编辑  弹框
+      itemSn: '', //  当前sn
+      nowData: null //  当前记录数据
+    }
+  },
+  methods: {
+    //  重置
+    resetSearchForm () {
+      this.queryParam.name = ''
+      this.$refs.table.refresh(true)
+    },
+    //  新增/编辑
+    handleEdit (row) {
+      this.itemSn = row ? row.warehouseSn : null
+      this.nowData = row || null
+      this.openModal = true
+    },
+    //  新增/编辑  成功
+    handleOk () {
+      this.$refs.table.refresh(true)
+    },
+    //  关闭弹框
+    closeModal () {
+      this.itemSn = ''
+      this.openModal = false
+    },
+    //  删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后会直接解除原有的绑定关系及用户授权,确定删除吗?',
+        centered: true,
+        onOk () {
+          // warehouseDel({
+          //   sn: row.warehouseSn
+          // }).then(res => {
+          //   if (res.status == 200) {
+          //     _this.$message.success(res.message)
+          //     _this.$refs.table.refresh()
+          //   }
+          // })
+        }
+      })
+    }
+  }
+}
+</script>