chenrui 4 years ago
parent
commit
3b2bfbdab0

+ 46 - 0
src/api/jxsorg.js

@@ -0,0 +1,46 @@
+import { axios } from '@/utils/request'
+
+//  经销商 中心店/配送店绑定 列表 有分页
+export const jxsorgRelationList = (params) => {
+  const url = `/jxsorg/relation/queryOrgPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}
+// 经销商  中心店/配送店绑定  保存
+export const jxsorgRelationSave = (params) => {
+  return axios({
+    url: `/jxsorg/relation/saveOrg`,
+    data: params,
+    method: 'post'
+  })
+}
+// 经销商  中心店/配送店绑定  删除
+export const jxsorgRelationDel = (params) => {
+  return axios({
+    url: `/jxsorg/relation/deleteOrg/${params.sn}`,
+    method: 'get'
+  })
+}
+// 经销商  中心店/配送店绑定  详情
+export const jxsorgRelationDetail = (params) => {
+  return axios({
+    url: `/jxsorg/relation/findOrgBySn/${params.sn}`,
+    method: 'get'
+  })
+}
+//  经销商机构 列表 有分页
+export const jsxorgList = (params) => {
+  const url = `/jsxorg/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'post'
+  })
+}

+ 85 - 1
src/config/router.config.js

@@ -77,7 +77,8 @@ export const asyncRouterMap = [
                 component: () => import(/* webpackChunkName: "salesManagement" */ '@/views/salesManagement/salesQuery/list.vue'),
                 meta: {
                   title: '销售单列表',
-                  icon: 'monitor'
+                  icon: 'monitor',
+                  hidden: true
                   // permission: 'M_salesQueryList'
                 }
               },
@@ -750,6 +751,51 @@ export const asyncRouterMap = [
               // permission: 'M_goodsShelves_0'
             }
           },
+          {
+            path: '/inventoryManagement/intelligentReplenishment',
+            redirect: '/inventoryManagement/intelligentReplenishment/list',
+            name: 'intelligentReplenishment',
+            component: RouteView,
+            meta: {
+              title: '智能补货',
+              icon: 'monitor'
+              // permission: 'M_inventory_inventoryQuery_list'
+            },
+            hideChildrenInMenu: true,
+            children: [
+              {
+                path: 'list',
+                name: 'intelligentReplenishmentList',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/intelligentReplenishment/list.vue'),
+                meta: {
+                  title: '智能补货列表',
+                  icon: 'monitor',
+                  hidden: true
+                  // permission: 'M_inventory_inventoryQuery_list'
+                }
+              },
+              {
+                path: 'add/:sn',
+                name: 'intelligentReplenishmentAdd',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/intelligentReplenishment/add.vue'),
+                meta: {
+                  title: '新增智能补货',
+                  icon: 'monitor',
+                  hidden: true
+                }
+              },
+              {
+                path: 'set/:sn',
+                name: 'intelligentReplenishmentSet',
+                component: () => import(/* webpackChunkName: "shop" */ '@/views/inventoryManagement/intelligentReplenishment/basicInfoSettings.vue'),
+                meta: {
+                  title: '新增智能补货',
+                  icon: 'monitor',
+                  hidden: true
+                }
+              }
+            ]
+          },
           // {
           //   path: '/inventoryManagement/satelliteWarehouseInventory',
           //   name: 'satelliteWarehouseInventoryList',
@@ -1587,6 +1633,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: '/basicData',

+ 8 - 0
src/views/inventoryManagement/intelligentReplenishment/add.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

+ 8 - 0
src/views/inventoryManagement/intelligentReplenishment/basicInfoSettings.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

+ 8 - 0
src/views/inventoryManagement/intelligentReplenishment/list.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

+ 1 - 1
src/views/salesManagement/salesReturn/salesReturnEdit.vue

@@ -400,7 +400,7 @@ export default {
         'salesBillSn': row.salesBillSn,
         'salesBillNo': row.salesBillNo,
         'salesBillDetailSn': row.salesBillDetailSn,
-        'price': row.salePrice,
+        'price': type == 'edit' ? row.price : row.salePrice,
         'cost': row.putCost,
         'productSn': row.productSn,
         'celQty': row.celQty,

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

@@ -0,0 +1,156 @@
+<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="orgSn">
+          <orgList ref="orgList" :disabled="itemSn?'*':''" @change="orgChange" />
+        </a-form-model-item>
+        <a-form-model-item label="选择配送店" prop="childSnList">
+          <orgList ref="orgLists" type="childOrg" :disabled="itemSn?'':form.orgSn" @change="orgsChange" />
+        </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 orgList from './orgList.vue'
+import { jxsorgRelationSave, jxsorgRelationDetail } from '@/api/jxsorg'
+export default {
+  name: 'BindEditModal',
+  components: { STable, orgList },
+  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: {
+        orgSn: undefined,
+        childSnList: undefined
+      },
+      rules: {
+        orgSn: [ { required: true, message: '请选择中心店', trigger: 'change' } ],
+        childSnList: [ { required: true, message: '请选择配送店', trigger: 'change' } ]
+      }
+    }
+  },
+  methods: {
+    // 中心店 change
+    orgChange (obj) {
+      console.log(obj)
+      this.form.orgSn = obj.key || undefined
+    },
+    orgsChange (obj) {
+      console.log(obj)
+      const _this = this
+      this.form.childSnList = []
+      obj.map(item => {
+        _this.form.childSnList.push(item.key || undefined)
+      })
+    },
+    filterOption (input, option) {
+      return (
+        option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
+      )
+    },
+    //  详情
+    getDetail () {
+      jxsorgRelationDetail({ sn: this.itemSn }).then(res => {
+        if (res.status == 200) {
+          console.log(res.data, '+++++++')
+        }
+      })
+    },
+    //  保存
+    handleSave () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          jxsorgRelationSave(_this.form).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('ok')
+              setTimeout(function () {
+                _this.isShow = false
+              }, 300)
+            } else {
+
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    //  父页面传过来的弹框状态
+    openModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    //  重定义的弹框状态
+    isShow (newValue, oldValue) {
+      if (!newValue) {
+        this.$emit('close')
+        this.$refs.ruleForm.resetFields()
+      }
+    },
+    itemSn (newValue, oldValue) {
+      if (this.isShow && newValue) {
+        console.log(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>

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

@@ -0,0 +1,139 @@
+<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-orgName" v-model.trim="queryParam.orgName" allowClear placeholder="请输入中心店名称"/>
+            </a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-form-item label="配送店名称">
+              <a-input id="bindList-childName" v-model.trim="queryParam.childName" 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.orgSn"
+      :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="$refs.table.refresh(true)" @close="closeModal" />
+  </a-card>
+</template>
+
+<script>
+import { STable } from '@/components'
+import storeManagementBindEditModal from './editModal.vue'
+import { jxsorgRelationList, jxsorgRelationDel } from '@/api/jxsorg'
+export default {
+  components: { STable, storeManagementBindEditModal },
+  data () {
+    return {
+      queryParam: { //  查询条件
+        orgName: '',
+        childName: ''
+      },
+      tableHeight: 0,
+      disabled: false, //  查询、重置按钮是否可操作
+      columns: [
+        { title: '序号', dataIndex: 'no', width: 80, align: 'center' },
+        { title: '中心店名称', dataIndex: 'orgName', align: 'center', ellipsis: true, customRender: function (text) { return text || '--' } },
+        { title: '已绑配送店', dataIndex: 'allChildName', 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 jxsorgRelationList(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.orgName = ''
+      this.queryParam.childName = ''
+      this.$refs.table.refresh(true)
+    },
+    //  新增/编辑
+    handleEdit (row) {
+      this.itemSn = row ? row.orgSn : null
+      this.nowData = row || null
+      this.openModal = true
+    },
+    //  关闭弹框
+    closeModal () {
+      this.itemSn = ''
+      this.openModal = false
+    },
+    //  删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '提示',
+        content: '删除后会直接解除原有的绑定关系及用户授权,确定删除吗?',
+        centered: true,
+        onOk () {
+          jxsorgRelationDel({
+            sn: row.orgSn
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
+        }
+      })
+    }
+  }
+}
+</script>

+ 74 - 0
src/views/storeManagement/bind/orgList.vue

@@ -0,0 +1,74 @@
+<template>
+  <a-select
+    show-search
+    label-in-value
+    :value="dealerName"
+    placeholder="请输入名称搜索"
+    style="width: 100%"
+    :filter-option="false"
+    :not-found-content="fetching ? undefined : null"
+    :mode="type=='childOrg'?'multiple':'default'"
+    @search="fetchUser"
+    @change="handleChange"
+    :disabled="type=='childOrg'&&!disabled"
+    allowClear
+  >
+    <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+    <a-select-option v-for="item in data" :key="item.sn" :value="item.sn" :disabled="disabled==item.sn || item.status=='0'">
+      {{ item.name }}
+    </a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import { jsxorgList } from '@/api/jxsorg'
+export default {
+  props: {
+    disabled: {
+      type: [String, Number],
+      default: ''
+    },
+    type: {
+      type: String,
+      default: 'default'
+    }
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      dealerName: [],
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (dealerName) {
+      console.log('fetching user', dealerName)
+      if (dealerName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      jsxorgList({ 'name': dealerName, pageNo: 1, pageSize: 20 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data.list || []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      Object.assign(this, {
+        dealerName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value || { key: undefined })
+    },
+    resetForm () {
+      this.dealerName = []
+    }
+  }
+}
+</script>