瀏覽代碼

新加菜单

zhangdan 4 年之前
父節點
當前提交
e508801738

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

@@ -89,6 +89,7 @@ export const asyncRouterMap = [{
       }
       ]
     },
+	
     {
       path: '/shop/goods',
       redirect: '/shop/goods/list',
@@ -157,6 +158,37 @@ export const asyncRouterMap = [{
     }
     ]
   },
+  {
+    path: '/businessManage',
+    redirect: '/businessManag/userManage',
+    component: PageView,
+    meta: {
+      title: '商户管理',
+      icon: 'appstore'
+      // permission: 'M_appSetting'
+    },
+    children: [{
+      path: '/businessManage/userManage',
+      name: 'userManage',
+      component: () => import(/* webpackChunkName: "tenants" */ '@/views/businessManage/userManage/userManage.vue'),
+      meta: {
+        title: '用户管理',
+        icon: 'folder'
+        // permission: 'M_tenants_list'
+      }
+    },
+    {
+      path: '/businessManage/partnerManage',
+      name: 'partnerManage',
+      component: () => import(/* webpackChunkName: "tenants" */ '@/views/businessManage/partnerManage/partnerManage.vue'),
+      meta: {
+        title: '合作商管理',
+        icon: 'solution'
+        // permission: 'M_tenants_list'
+      }
+    }
+    ]
+  },
   {
     path: '/equipmentManage',
     redirect: '/equipmentManage/network',

+ 169 - 0
src/views/businessManage/partnerManage/addPartnerModal.vue

@@ -0,0 +1,169 @@
+<template>
+  <div>
+    <!-- 弹窗 -->
+    <a-modal
+      v-model="isShow"
+      @cancle="isShow=false"
+      :footer="null"
+      width="60%"
+      :centered="true"
+      :title="titleText">
+      <a-form id="components-form-demo-validate-other" ref="form" :form="form" v-bind="formItemLayout" @submit="handleSubmit">
+        <a-form-item label="供应商名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+          <a-input
+            id="addSupplierModal-name"
+            :maxLength="30"
+            v-decorator="['formData.name', { initialValue: formData.name,getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入供应商名称(最多30个字符)!' }] }]"
+            placeholder="请输入供应商名称(最多30个字符)"
+            allowClear />
+        </a-form-item>
+        <a-form-item label="供应商简称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+          <a-input
+            id="addSupplierModal-simpleName"
+            :maxLength="30"
+            v-decorator="['formData.simpleName', { initialValue: formData.simpleName,getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入供应商简称(最多30个字符)!' }] }]"
+            placeholder="请输入供应商简称(最多30个字符)"
+            allowClear />
+        </a-form-item>
+        <a-form-item label="联系人" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+          <a-input
+            id="addSupplierModal-contactName"
+            :maxLength="30"
+            v-decorator="['formData.contactName', { initialValue: formData.contactName,getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入联系人!' }] }]"
+            placeholder="请输入联系人"
+            allowClear />
+        </a-form-item>
+        <a-form-item label="手机号码" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+          <a-input
+            id="addSupplierModal-contactPhone"
+            :maxLength="11"
+            v-decorator="['formData.contactPhone', { initialValue: formData.contactPhone,getValueFromEvent: $filterEmpty, rules: [{ required: true, message: '请输入手机号码!' }] }]"
+            placeholder="请输入手机号码"
+            allowClear />
+        </a-form-item>
+        <a-form-item label="备注" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+          <a-textarea
+            :maxLength="500"
+            v-decorator="['formData.remarks', { initialValue: formData.remarks, rules: [{ required: false, message: '请输入备注内容(最多500个字符)!' }] }]"
+            id="addSupplierModal-remarks"
+            placeholder="请输入备注内容(最多500个字符)"
+            allowClear />
+        </a-form-item>
+        <a-form-item :wrapper-col="{ span: 12, offset: 6}" style="text-align: center;">
+          <a-button type="primary" html-type="submit" id="addSupplierModal-submit" style="margin-right: 15px">保存</a-button>
+          <a-button @click="isShow=false" style="margin-left: 15px" id="addSupplierModal-close">取消</a-button>
+        </a-form-item>
+      </a-form>
+    </a-modal>
+  </div>
+</template>
+
+<script>
+import {
+  supplierDetails,
+  saveSupplier
+} from '@/api/shopSetting.js'
+export default {
+  name: 'AddPartnerModal',
+  props: {
+    openSupplierModal: {
+      type: Boolean,
+      default: false
+    },
+    itemId: {
+      type: String,
+      default: ''
+    },
+    itemData: {
+	  type: Object,
+	  default: function () {
+	    return {}
+	  }
+    }
+  },
+  data () {
+    return {
+      formItemLayout: {
+        labelCol: {
+          span: 6
+        },
+        wrapperCol: {
+          span: 14
+        }
+      },
+	  titleText: '新增',
+      isShow: this.openSupplierModal,
+      form: this.$form.createForm(this, { name: 'addSupplierModal' }),
+      formData: {
+        name: '', // 名称
+        simpleName: '', // 简称
+        contactName: '', // 联系人
+        remarks: '', // 备注
+        contactPhone: '' // 手机号码
+      }
+    }
+  },
+  methods: {
+    // 查看详情
+    getPageInfo () {
+      supplierDetails({
+        id: this.itemId
+      }).then(res => {
+        if (res.status == 200) {
+          // this.form.setFieldsValue({ 'formData': res.data })
+          this.form.setFieldsValue({ 'formData.name': res.data.name })
+          this.form.setFieldsValue({ 'formData.contactName': res.data.contactName })
+          this.form.setFieldsValue({ 'formData.simpleName': res.data.simpleName })
+          this.form.setFieldsValue({ 'formData.contactPhone': res.data.contactPhone })
+          this.form.setFieldsValue({ 'formData.remarks': res.data.remarks })
+        }
+      })
+    },
+    // 点击保存;
+    handleSubmit (e) {
+      e.preventDefault()
+      const _this = this
+      this.form.validateFields((err, values) => {
+        if (!err) {
+          const formData = Object.assign({}, this.itemData, this.formData, values.formData)
+          formData.id = _this.itemId
+          saveSupplier(formData).then(res => {
+            console.log(res, 'rrrrrrrrr')
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('refresh')
+              setTimeout(function () {
+                _this.isShow = false
+              }, 300)
+            }
+          })
+        }
+      })
+    }
+  },
+  watch: {
+    openSupplierModal (newValue, oldValue) {
+      this.isShow = newValue
+    },
+    isShow (val) {
+      if (!val) {
+        this.$emit('close')
+      } else {
+   	  this.form.resetFields()
+      }
+    },
+    itemId (newValue, oldValue) {
+      console.log(newValue, '----------id')
+      if (newValue && this.isShow) {
+        this.titleText = '编辑'
+        this.getPageInfo(newValue)
+      } else {
+   	  this.titleText = '新增'
+      }
+    }
+  }
+}
+</script>
+
+<style>
+</style>

+ 223 - 0
src/views/businessManage/partnerManage/partnerManage.vue

@@ -0,0 +1,223 @@
+<template>
+  <a-card :bordered="false">
+    <!-- 搜索框 -->
+    <div class="table-page-search-wrapper" style="margin-bottom: 15px;">
+      <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="48">
+          <a-col :md="6" :sm="24">
+            <a-form-item label="供应商名称"><a-input allowClear v-model.trim="searchData.name" :maxLength="30" placeholder="请输入" id="OperateJournal-name"/></a-form-item>
+          </a-col>
+          <a-col :md="6" :sm="24">
+            <a-button style="margin-right: 10px;" type="primary" @click="$refs.table.refresh(true)" id="OperateJournal-refreshTable">查询</a-button>
+            <a-button type="" @click="resetForm" id="OperateJournal-resetForm">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <div class="add"><a-button type="primary" icon="plus" class="addBtn" @click="showModal" id="bannerSetting-showModal">新增</a-button></div>
+    <!-- table列表 -->
+    <s-table
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <span slot="action" slot-scope="text, record">
+        <a-icon
+          v-if="record.state==0"
+          type="edit"
+          id="bannerSetting-handleEdit"
+          title="编辑"
+          class="actionBtn icon-blues"
+          @click="handleEdit(record)" />
+        <span v-if="record.state==1">--</span>
+      </span>
+      <span slot="state" slot-scope="text, record">
+        <a-switch
+          checkedChildren="启用"
+          unCheckedChildren="禁用"
+          id="bannerSetting-changeFlagHandle"
+          :checked="record.state == 1 ? true : false"
+          @change="changeFlagHandle(text, record)"
+        />
+      </span>
+    </s-table>
+    <!-- 新增编辑弹窗 -->
+    <add-partner-modal :itemId="itemId" :itemData="itemData" :openSupplierModal="openSupplierModal" @refresh="$refs.table.refresh(true)" @close="cancel"></add-partner-modal>
+  </a-card>
+</template>
+
+<script>
+import { Upload, STable, VSelect } from '@/components'
+import { getSupplierList, changeSupplierStatus } from '@/api/shopSetting.js'
+import addPartnerModal from './addPartnerModal.vue'
+export default {
+  components: {
+    STable,
+    Upload,
+    VSelect,
+    addPartnerModal
+  },
+  data () {
+    return {
+      searchData: { name: '' },
+	  openSupplierModal: false, // 默认关闭弹窗
+	  itemId: null, // 编辑行id
+	  itemData: {}, // 编辑行数据
+      // 表头
+      columns: [
+        {
+          title: '序号',
+          dataIndex: 'no',
+          width: 60,
+          align: 'center'
+        },
+        {
+          title: '供应商名称',
+          width: 200,
+          dataIndex: 'name',
+          align: 'center'
+        },
+        {
+          title: '供应商简称',
+          width: 100,
+          dataIndex: 'simpleName',
+          align: 'center'
+        },
+        {
+		  title: '联系人',
+		  width: 100,
+		  dataIndex: 'contactName',
+		  align: 'center'
+        },
+        {
+		  title: '手机号码',
+		  width: 100,
+		  dataIndex: 'contactPhone',
+		  align: 'center',
+		  scopedSlots: {
+		    customRender: 'position'
+		  }
+        },
+        {
+          title: '状态',
+          width: 100,
+          dataIndex: 'state',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'state'
+          }
+        },
+        {
+		  title: '备注',
+		  width: 200,
+		  dataIndex: 'remarks',
+		  align: 'center',
+		  customRender: (text) => {
+		    return text || '--'
+		  }
+        },
+        {
+          title: '操作',
+          align: 'center',
+          width: 100,
+          scopedSlots: {
+            customRender: 'action'
+          }
+        }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        return getSupplierList(
+          Object.assign(parameter, this.searchData)
+        ).then(res => {
+          const no = (res.data.pageNo - 1) * res.data.pageSize
+		   if (res.status == 200) {
+            for (let i = 0; i < res.data.list.length; i++) {
+			  const _item = res.data.list[i]
+			   _item.no = no + i + 1
+            }
+            return res.data
+		   }
+        })
+      },
+      formLayout: 'horizontal',
+      hideRequiredMark: false, // 是否显示必填的* 默认显示
+      form: this.$form.createForm(this),
+      formItemLayout: {
+        labelCol: {
+          span: 6
+        },
+        wrapperCol: {
+          span: 14
+        }
+      }
+    }
+  },
+  methods: {
+    showModal () {
+      this.itemId = null
+	  this.itemData = {}
+      this.openSupplierModal = true
+    },
+    // 编辑
+    handleEdit (record) {
+	  this.itemId = record.id
+	  this.itemData = record
+	  console.log(this.itemId, '-------编辑')
+	  this.openSupplierModal = true
+    },
+    cancel () {
+	  this.itemId = null
+	  this.openSupplierModal = false
+    },
+    // 重置
+    resetForm () {
+      this.searchData.name = ''
+      this.$refs.table.refresh(true)
+    },
+    // 更改启用禁用状态
+    changeFlagHandle (text, record) {
+      console.log(text)
+      const _this = this
+      const _data = {
+    	  id: record.id,
+    	  flag: record.state == 1 ? '0' : '1'
+      }
+      if (record.state == 1) {
+    	  this.$confirm({
+    		  title: '提示',
+    		  centered: true,
+    		  content: '确定禁用该供货商吗?',
+    		  okText: '确定',
+    		  cancelText: '取消',
+    		  onOk () {
+    	      changeSupplierStatus(_data).then(res => {
+    			 if (res.status == 200) {
+                _this.$message.success(res.message)
+                _this.$refs.table.refresh()
+    			  }
+    	      })
+    	     }
+    	  })
+      } else {
+        changeSupplierStatus(_data).then(res => {
+    	  if (res.status == 200) {
+            _this.$message.success(res.message)
+            _this.$refs.table.refresh()
+    	  } else {
+            record.state = !record.state
+    	  }
+        })
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+.addBtn {
+  margin-bottom: 20px;
+}
+</style>

+ 8 - 0
src/views/businessManage/userManage/userManage.vue

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