Browse Source

接口对接

zhangdan 3 years ago
parent
commit
c322300bd0

+ 12 - 4
src/api/boundRecord.js

@@ -15,8 +15,8 @@ export const bondRecordByPage = params => {
 // 保证金详情
 // 保证金详情
 export const bondRecordDetail = params => {
 export const bondRecordDetail = params => {
   return axios({
   return axios({
-    url: `//shelf/bondRecord/queryBySn/${params.bondRecordSn}`,
-    data: {},
+    url: `/shelf/bondRecord/queryBySn/${params.bondRecordSn}`,
+    data: params,
     method: 'post'
     method: 'post'
   })
   })
 }
 }
@@ -32,10 +32,18 @@ export const saveBondRecord = params => {
 
 
 // 保证金列表(无分页)
 // 保证金列表(无分页)
 export const bondRecordList = params => {
 export const bondRecordList = params => {
-  const url = `/shelf/bondRecord/queryList`
+  const url = `/shelf/bondRecord/queryListByShelfSn/${params.shelfSn}`
   return axios({
   return axios({
     url: url,
     url: url,
+    data: {},
+    method: 'get'
+  })
+}
+// 删除保证金
+export const bondRecordDel = params => {
+  return axios({
+    url: `/shelf/bondRecord/deleteBySn/${params.bondRecordSn}`,
     data: params,
     data: params,
-    method: 'POST'
+    method: 'post'
   })
   })
 }
 }

+ 32 - 0
src/api/merchantAccount.js

@@ -0,0 +1,32 @@
+import { axios } from '@/utils/request'
+
+// 获取配件经销商列表数据
+export const merchantAccountByPage = params => {
+  const url = `/merchantAccount/queryPage/${params.pageNo}/${params.pageSize}`
+  delete params.pageNo
+  delete params.pageSize
+  return axios({
+    url: url,
+    data: params,
+    method: 'POST'
+  })
+}
+
+// 新增/编辑接口
+export const saveMerchantAccount = params => {
+  return axios({
+    url: '/merchantAccount/save',
+    data: params,
+    method: 'POST'
+  })
+}
+
+// 详情
+export const merchantAccountDetail = params => {
+  const url = `/merchantAccount/queryBySnType/${params.merchantSn}/${params.merchantType}`
+  return axios({
+    url: url,
+    data: {},
+    method: 'get'
+  })
+}

+ 35 - 0
src/api/shelf.js

@@ -99,3 +99,38 @@ export const settleRuleDetail = params => {
     method: 'get'
     method: 'get'
   })
   })
 }
 }
+
+// 导入货位
+export const exportExcelData = params => {
+  return axios({
+    url: `/shelf/place/readExcel`,
+    data: params,
+    method: 'post'
+  })
+}
+
+// 保存货位
+export const saveBatchExcel = params => {
+  return axios({
+    url: `/shelf/place/saveBatchExcel`,
+    data: params,
+    method: 'post'
+  })
+}
+// 单个保存货位
+export const saveHw = params => {
+  return axios({
+    url: `/shelf/place/save`,
+    data: params,
+    method: 'post'
+  })
+}
+
+/* 货位删除 */
+export const delHw = params => {
+  return axios({
+    url: `/shelf/place/deleteBySn/${params.shelfPlaceSn}`,
+    data: params,
+    method: 'post'
+  })
+}

+ 12 - 21
src/components/UploadFile/index.vue

@@ -10,7 +10,6 @@
       :remove="handleRemove"
       :remove="handleRemove"
       :beforeUpload="beforeUpload"
       :beforeUpload="beforeUpload"
       :data="params"
       :data="params"
-      :headers="headers"
       :value="comVal"
       :value="comVal"
     >
     >
       <div v-if="fileList.length < maxNums && listType=='picture-card'">
       <div v-if="fileList.length < maxNums && listType=='picture-card'">
@@ -45,7 +44,9 @@ export default {
     },
     },
     previewFile: {
     previewFile: {
       type: Function,
       type: Function,
-      default: function () {}
+      default: function () {
+
+      }
     },
     },
     action: {
     action: {
       type: String,
       type: String,
@@ -93,10 +94,7 @@ export default {
       previewImage: '',
       previewImage: '',
       fileList: [],
       fileList: [],
       comVal: this.value,
       comVal: this.value,
-      params: this.uploadParams,
-      headers: {
-        'access-token': this.$store.getters.token
-      }
+      params: this.uploadParams
     }
     }
   },
   },
   methods: {
   methods: {
@@ -152,6 +150,11 @@ export default {
     },
     },
     handleChange ({ file, fileList }) {
     handleChange ({ file, fileList }) {
       // console.log(file, fileList, '-----change')
       // console.log(file, fileList, '-----change')
+      // if (file.status == 'error' || (file.response && (file.response.status == 500 || file.response.status == 900))) {
+      //   this.$message.error('上传失败,请重试!')
+      //   this.$emit('remove')
+      //   return
+      // }
       if (file.response && (file.response.status == 500 || file.response.status == 900)) {
       if (file.response && (file.response.status == 500 || file.response.status == 900)) {
         if (file.status == 'error' || file.status == 'done') {
         if (file.status == 'error' || file.status == 'done') {
           this.$message.error(file.response.message || '上传失败,请重试!')
           this.$message.error(file.response.message || '上传失败,请重试!')
@@ -165,7 +168,6 @@ export default {
     },
     },
     // 格式化文件列表数据,给表单
     // 格式化文件列表数据,给表单
     formatFile () {
     formatFile () {
-      const _this = this
       const a = this.fileList
       const a = this.fileList
       let temp = []
       let temp = []
       let obj = null
       let obj = null
@@ -180,11 +182,7 @@ export default {
         } else if (this.uploadType == 'attach') { // 附件    将接口的返回数据返回页面
         } else if (this.uploadType == 'attach') { // 附件    将接口的返回数据返回页面
           a.map(item => {
           a.map(item => {
             if (item.response && item.status == 'done') {
             if (item.response && item.status == 'done') {
-              if (_this.maxNums == 1) {
-                temp = [item.response.data]
-              } else {
-                temp = [...temp, ...item.response.data]
-              }
+              temp = [...temp, ...item.response.data]
             }
             }
           })
           })
           obj = JSON.stringify(temp)
           obj = JSON.stringify(temp)
@@ -219,19 +217,12 @@ export default {
         return true
         return true
       }
       }
       const isType = this.fileType.indexOf(file.type) >= 0 && file.type != ''
       const isType = this.fileType.indexOf(file.type) >= 0 && file.type != ''
-      // 文件格式限制为.xls、.xlsx时,上传.csv文件的type为application/vnd.ms-excel,与.xls一致,无法限制,因此更改为:
-      if (!isType || file.name.indexOf('.csv') >= 0) {
+      if (!isType) {
         if (tip != 0) {
         if (tip != 0) {
           this.$message.error('请上传正确的格式!')
           this.$message.error('请上传正确的格式!')
         }
         }
-        return isType && !(file.name.indexOf('.csv') >= 0)
+        return isType
       }
       }
-      // if (!isType) {
-      //   if (tip != 0) {
-      //     this.$message.error('请上传正确的格式!')
-      //   }
-      //   return isType
-      // }
 
 
       // 文件大小
       // 文件大小
       const isLt2M = file.size / 1024 / 1024 < this.fileSize
       const isLt2M = file.size / 1024 / 1024 < this.fileSize

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

@@ -107,12 +107,22 @@ export const asyncRouterMap = [
           {
           {
             path: '/numsGoodsShelves/bondManagement',
             path: '/numsGoodsShelves/bondManagement',
             name: 'bondManagementList',
             name: 'bondManagementList',
-            component: () => import(/* webpackChunkName: "auth" */ '@/views/numsGoodsShelves/bondManagement/list.vue'),
+            component: () => import('@/views/numsGoodsShelves/bondManagement/list.vue'),
             meta: {
             meta: {
               title: '保证金管理',
               title: '保证金管理',
               icon: 'user'
               icon: 'user'
               // permission: 'M_powerMD_user_list'
               // permission: 'M_powerMD_user_list'
             }
             }
+          },
+          {
+            path: '/numsGoodsShelves/partsDealerManagement',
+            name: 'partsDealerManagementList',
+            component: () => import('@/views/numsGoodsShelves/partsDealerManagement/list.vue'),
+            meta: {
+              title: '配件经销商管理',
+              icon: 'user'
+              // permission: 'M_powerMD_user_list'
+            }
           }
           }
         ]
         ]
       },
       },

+ 48 - 0
src/libs/exportExcel.js

@@ -0,0 +1,48 @@
+import notification from 'ant-design-vue/es/notification'
+import moment from 'moment'
+
+// 导出excel
+/*
+  *url: 数据请求接口
+  *params: 请求参数
+  *fileName: 导出文件名称
+  *callback: 回调函数
+*/
+export const hdExportExcel = function (url, params, fileName, callback) {
+  url(params).then(res => {
+    if (res.type == 'application/json') {
+      var reader = new FileReader()
+      reader.addEventListener('loadend', function () {
+        const obj = JSON.parse(reader.result)
+        notification.error({
+          message: '提示',
+          description: obj.message
+        })
+      })
+      reader.readAsText(res)
+    } else {
+      downloadExcel(res, fileName)
+    }
+    callback()
+  })
+}
+// 导出下载excel
+export const downloadExcel = function (data, fileName) {
+  if (!data) { return }
+  const a = moment().format('YYYYMMDDHHmmss')
+  const fname = fileName + a
+  const blob = new Blob([data], { type: 'application/vnd.ms-excel' })
+  if (window.navigator && window.navigator.msSaveOrOpenBlob) {
+    navigator.msSaveBlob(blob, fname + '.xlsx')
+  } else {
+    const link = document.createElement('a')
+    link.style.display = 'none'
+    var href = URL.createObjectURL(blob)
+    link.href = href
+    link.setAttribute('download', fname + '.xlsx')
+    document.body.appendChild(link)
+    link.click()
+    document.body.removeChild(link)
+    window.URL.revokeObjectURL(href) // 释放掉blob对象
+  }
+}

+ 12 - 0
src/libs/tools.js

@@ -13,6 +13,18 @@ export const forEach = (arr, fn) => {
   }
   }
 }
 }
 
 
+// 处理数字千位分隔符(带小数)
+export const toThousands = (num, decimal) => {
+  if (decimal) {
+    num = formatDecimal(num, decimal)
+  }
+  return num.toString().replace(/\d+/, function (n) { // 先提取整数部分
+    return n.replace(/(\d)(?=(\d{3})+$)/g, function ($1) {
+      return $1 + ','
+    })
+  })
+}
+
 /**
 /**
  * @param {Array} arr1
  * @param {Array} arr1
  * @param {Array} arr2
  * @param {Array} arr2

+ 1 - 1
src/utils/request.js

@@ -76,7 +76,7 @@ service.interceptors.response.use((response) => {
       description: response.data.code
       description: response.data.code
     })
     })
   }
   }
-  return response
+  return response.data
 }, err)
 }, err)
 
 
 const installer = {
 const installer = {

+ 7 - 0
src/views/common/dealerList.vue

@@ -4,6 +4,7 @@
     show-search
     show-search
     label-in-value
     label-in-value
     :value="dealerName"
     :value="dealerName"
+    :disabled="disabled"
     placeholder="请输入名称搜索"
     placeholder="请输入名称搜索"
     style="width: 100%"
     style="width: 100%"
     :filter-option="false"
     :filter-option="false"
@@ -20,6 +21,12 @@
 import debounce from 'lodash/debounce'
 import debounce from 'lodash/debounce'
 import { dealerListByPage } from '@/api/dealer'
 import { dealerListByPage } from '@/api/dealer'
 export default {
 export default {
+  props: {
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
   data () {
   data () {
     this.lastFetchId = 0
     this.lastFetchId = 0
     this.fetchUser = debounce(this.fetchUser, 800)
     this.fetchUser = debounce(this.fetchUser, 800)

+ 93 - 0
src/views/common/shelfList.vue

@@ -0,0 +1,93 @@
+<template>
+  <!-- 货架 -->
+  <a-select
+    show-search
+    label-in-value
+    :value="shelfName"
+    :disabled="disabled"
+    placeholder="请输入名称搜索"
+    style="width: 100%"
+    :filter-option="false"
+    :dropdownMatchSelectWidth="false"
+    :not-found-content="fetching ? undefined : null"
+    @blur="blurSelect"
+    @search="fetchUser"
+    @change="handleChange"
+    allowClear>
+    <a-spin v-if="fetching" slot="notFoundContent" size="small" />
+    <a-select-option v-for="item in data" :key="item.shelfSn" :value="item.shelfSn">{{ item.shelfName }}</a-select-option>
+  </a-select>
+</template>
+<script>
+import debounce from 'lodash/debounce'
+import { getShelfList } from '@/api/shelf'
+export default {
+  props: {
+    itemSn: {
+      type: String || Number,
+      default: undefined
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      shelfName: undefined,
+      fetching: false
+    }
+  },
+  methods: {
+    fetchUser (shelfName) {
+      console.log('fetching user', shelfName)
+      if (shelfName == '') return
+      this.lastFetchId += 1
+      const fetchId = this.lastFetchId
+      this.data = []
+      this.fetching = true
+      getShelfList({ shelfName: shelfName, pageNo: 1, pageSize: 20 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data && res.data.list ? res.data.list : []
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      // if (value && value.key) {
+      //   const ind = this.data.findIndex(item => item.customerSn == value.key)
+      //   value.row = ind != -1 ? this.data[ind] : undefined
+      // }
+      Object.assign(this, {
+        shelfName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value || { key: undefined, label: '' })
+    },
+    resetForm () {
+      this.shelfName = undefined
+    },
+    setData (value) {
+      Object.assign(this, {
+        shelfName: value,
+        data: [],
+        fetching: false
+      })
+    },
+    blurSelect () {
+      this.data = []
+    }
+  },
+  mounted () {
+    if (this.itemSn) {
+      this.fetchUser(this.itemSn)
+      this.setData({ key: this.itemSn })
+    }
+  }
+}
+</script>

+ 9 - 2
src/views/common/storeList.vue

@@ -6,6 +6,7 @@
     :value="name"
     :value="name"
     placeholder="请输入名称搜索"
     placeholder="请输入名称搜索"
     style="width: 100%"
     style="width: 100%"
+    :disabled="disabled"
     :filter-option="false"
     :filter-option="false"
     :dropdownMatchSelectWidth="false"
     :dropdownMatchSelectWidth="false"
     :not-found-content="fetching ? undefined : null"
     :not-found-content="fetching ? undefined : null"
@@ -13,13 +14,19 @@
     @change="handleChange"
     @change="handleChange"
     allowClear>
     allowClear>
     <a-spin v-if="fetching" slot="notFoundContent" size="small" />
     <a-spin v-if="fetching" slot="notFoundContent" size="small" />
-    <a-select-option v-for="item in data" :key="item.tenantId" :value="item.tenantId">{{ item.name }}</a-select-option>
+    <a-select-option v-for="item in data" :key="item.storeSn" :value="item.storeSn">{{ item.name }}</a-select-option>
   </a-select>
   </a-select>
 </template>
 </template>
 <script>
 <script>
 import debounce from 'lodash/debounce'
 import debounce from 'lodash/debounce'
 import { storeListByPage } from '@/api/store'
 import { storeListByPage } from '@/api/store'
 export default {
 export default {
+  props: {
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
   data () {
   data () {
     this.lastFetchId = 0
     this.lastFetchId = 0
     this.fetchUser = debounce(this.fetchUser, 800)
     this.fetchUser = debounce(this.fetchUser, 800)
@@ -37,7 +44,7 @@ export default {
       const fetchId = this.lastFetchId
       const fetchId = this.lastFetchId
       this.data = []
       this.data = []
       this.fetching = true
       this.fetching = true
-      storeListByPage({ name: name, pageNo: 1, pageSize: 20 }).then(res => {
+      storeListByPage({ name: name, pageNo: 1, pageSize: 20, enableFlag: 1 }).then(res => {
         if (fetchId !== this.lastFetchId) {
         if (fetchId !== this.lastFetchId) {
           return
           return
         }
         }

+ 239 - 0
src/views/numsGoodsShelves/bondManagement/addGoodsShelve.vue

@@ -0,0 +1,239 @@
+<template>
+  <div>
+    <a-spin :spinning="spinning" tip="Loading...">
+      <a-modal
+        centered
+        wrapClassName="addGoodsShelve-modal"
+        :footer="null"
+        :maskClosable="false"
+        :title="titleText"
+        v-model="isshow"
+        @cancle="isshow=false"
+        :width="650">
+        <a-form-model
+          id="userEdit-form"
+          ref="ruleForm"
+          :model="form"
+          :rules="rules"
+          :label-col="formItemLayout.labelCol"
+          :wrapper-col="formItemLayout.wrapperCol"
+        >
+          <a-row :gutter="24">
+            <a-col :span="20">
+              <a-form-model-item label="货架名称" prop="shelfSn" >
+                <shelfList ref="shelfList" @change="shelfChange" v-if="!nowData"></shelfList>
+                <span v-if="nowData">{{ form.shelfName||'--' }}</span>
+              </a-form-model-item>
+            </a-col>
+            <a-col :span="20" v-if="form.shelfSn||nowData">
+              <a-form-model-item label="配件经销商" prop="dealerSn" >
+                <span>{{ dealerName||'' }}</span>
+              </a-form-model-item>
+            </a-col>
+            <a-col :span="20" v-if="form.shelfSn||nowData">
+              <a-form-model-item label="汽车修理厂" prop="storeSn">
+                <span>{{ storeName ||'' }}</span>
+              </a-form-model-item>
+            </a-col>
+          </a-row>
+          <a-row :gutter="24">
+            <a-col :span="20">
+              <a-form-model-item label="保证金缴纳金额" prop="bondAmount" >
+                <a-input-number
+                  id="shelfSet-bindProduct-bondAmount"
+                  v-model="form.bondAmount"
+                  :precision="2"
+                  :min="0.01"
+                  :max="999999"
+                  placeholder="请输入正数(最多允许两位小数)"
+                  style="width: 100%;display: inline-block;" />
+              </a-form-model-item>
+            </a-col>
+            <a-col :span="2"> <span style="display: inline-block; padding-top: 10px;">元</span></a-col>
+          </a-row>
+          <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
+            <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '8px' }">保存</a-button>
+            <a-button :style="{ marginLeft: '8px' }" @click="isshow=false">取消</a-button>
+          </a-form-model-item>
+        </a-form-model>
+      </a-modal>
+    </a-spin>
+  </div>
+</template>
+
+<script>
+import { STable, VSelect, Upload } from '@/components'
+import { shelfDetail } from '@/api/shelf.js'
+import { bondRecordDetail, saveBondRecord } from '@/api/boundRecord.js'
+import dealerList from '@/views/common/dealerList.vue'
+import storeList from '@/views/common/storeList.vue'
+import shelfList from '@/views/common/shelfList.vue'
+export default {
+  name: 'AddGoodsShelve',
+  components: { STable, VSelect, Upload, dealerList, storeList, shelfList },
+  props: {
+    visible: {
+      type: Boolean,
+      default: false
+    },
+    nowData: {
+      type: Object,
+      default: function () {
+        return null
+      }
+    }
+  },
+
+  data () {
+    return {
+      spinning: false,
+      titleText: '新增保证金',
+      isshow: this.visible,
+      roleList: [],
+      pageInfo: null,
+      formItemLayout: {
+        labelCol: { span: 10 },
+        wrapperCol: { span: 14 }
+      },
+      dealerName: '',
+      shelfName: '',
+      storeName: '',
+      form: {
+        dealerSn: undefined, // 经销商sn
+        bondAmount: '', // 保证金金额
+        storeSn: undefined, // 汽车修理厂sn
+        shelfSn: '' // 货架名称
+      },
+      rules: {
+        shelfSn: [ { required: true, message: '请选择货架名称', trigger: 'change' } ],
+        dealerSn: [ { required: true, message: '请选择配件经销商', trigger: 'change' } ],
+        storeSn: [ { required: true, message: '请选择汽车修理厂', trigger: 'change' } ],
+        bondAmount: [ { required: true, message: '请输入保证金金额', trigger: 'blur' } ]
+      }
+    }
+  },
+  methods: {
+    // 过滤空格
+    filterEmpty () {
+      let str = this.form.name
+      str = str.replace(/\ +/g, '')
+      str = str.replace(/[ ]/g, '')
+      str = str.replace(/[\r\n]/g, '')
+      this.form.name = str
+    },
+    // 货架名称 change
+    shelfChange (obj) {
+      this.spinning = true
+      this.form.shelfSn = obj.key || undefined
+      if (this.form.shelfSn) {
+        setTimeout(() => {
+          this.getShelfDetail(this.form.shelfSn)
+        }, 300)
+      }
+    },
+    // 经销商 change
+    dealerChange (obj) {
+      this.form.dealerSn = obj.key || undefined
+    },
+    // 汽车修理厂 change
+    storeChange (obj) {
+      this.form.storeSn = obj.key || undefined
+    },
+    // 查询货架详情
+    getShelfDetail (val) {
+      this.spinning = true
+      shelfDetail({ shelfSn: val }).then(res => {
+        if (res.status == 200) {
+          this.dealerName = res.data.dealerEntity ? res.data.dealerEntity.dealerName : ''
+          this.shelfName = res.data.shelfName
+          this.storeName = res.data.storeName
+          this.form = Object.assign({}, res.data)
+          console.log(this.dealerName, this.storeName, this.form, 'this.form ')
+        } else {
+          this.form = { }
+        }
+        this.spinning = false
+      })
+    },
+    // 保证金详情
+    getBoundDetail () {
+      this.spinning = true
+      bondRecordDetail({ bondRecordSn: this.nowData.bondRecordSn }).then(res => {
+        if (res.status == 200) {
+          this.dealerName = res.data.dealerName
+          // console.log(this.form.dealerEntity.dealerName, ' this.form.dealerEntity.dealerName')/
+          this.shelfName = res.data.shelfName
+          this.storeName = res.data.storeName
+          this.form.bondAmount = res.data.bondAmount
+          this.form = Object.assign({}, res.data)
+        } else {
+        }
+        this.spinning = false
+      })
+    },
+    // 保存提交
+    handleSubmit () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = JSON.parse(JSON.stringify(_this.form))
+          params.id = _this.nowData && _this.nowData.id ? _this.nowData.id : null
+          _this.spinning = true
+          saveBondRecord(params).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('refresh')
+              setTimeout(function () {
+                _this.isshow = false
+                _this.spinning = false
+              }, 300)
+            } else {
+              _this.spinning = false
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    visible (newValue, oldValue) {
+      this.isshow = newValue
+    },
+    isshow (newValue, oldValue) {
+      if (!newValue) {
+        this.form = {}
+        this.dealerName = ''
+        this.shelfName = ''
+        this.storeName =
+        this.$emit('close')
+        this.$refs.ruleForm.resetFields()
+        this.titleText = '新增保证金'
+      }
+    },
+    nowData: {
+      handler (newValue, oldValue) {
+        if (this.isshow && newValue) {
+          if (this.nowData.id) { //  编辑
+            this.titleText = '编辑保证金'
+            this.getBoundDetail()
+          } else {
+            this.getShelfDetail()
+            this.titleText = '新增保证金'
+          }
+        }
+      },
+      deep: true
+    }
+  }
+}
+</script>
+<style lang="less">
+.addGoodsShelve-modal{
+  .ant-select-disabled .ant-select-selection{
+    background-color: none !important;
+  }
+}
+</style>

+ 61 - 60
src/views/numsGoodsShelves/bondManagement/list.vue

@@ -6,23 +6,23 @@
           <a-row :gutter="15">
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
               <a-form-item label="货架名称">
               <a-form-item label="货架名称">
-                <a-input id="userList-name" allowClear v-model.trim="queryParam.name" placeholder="请输入货架名称"/>
+                <a-input id="userList-name" allowClear v-model.trim="queryParam.shelfName" placeholder="请输入货架名称"/>
               </a-form-item>
               </a-form-item>
             </a-col>
             </a-col>
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
               <a-form-item label="配件经销商">
               <a-form-item label="配件经销商">
-                <a-input id="userList-phone" allowClear v-model.trim="queryParam.phone" placeholder="请输入手机号码"/>
+                <dealerList ref="dealerList" @change="dealerChange" :itemSn="queryParam.dealerSn"></dealerList>
               </a-form-item>
               </a-form-item>
             </a-col>
             </a-col>
             <a-col :md="6" :sm="24">
             <a-col :md="6" :sm="24">
               <a-form-item label="汽车修理厂">
               <a-form-item label="汽车修理厂">
-                <a-input id="userList-phone" allowClear v-model.trim="queryParam.phone" placeholder="请输入手机号码"/>
+                <storeList ref="storeList" @change="storeChange" :itemSn="queryParam.storeSn"></storeList>
               </a-form-item>
               </a-form-item>
             </a-col>
             </a-col>
             <template v-if="advanced">
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
               <a-col :md="6" :sm="24">
                 <a-form-item label="状态">
                 <a-form-item label="状态">
-                  <v-select id="userList-loginFlag" code="ENABLE_FLAG" v-model="queryParam.loginFlag" allowClear placeholder="请选择状态"></v-select>
+                  <v-select id="userList-loginFlag" code="BOND_RECORD_STATE" v-model="queryParam.bondRecordState" allowClear placeholder="请选择状态"></v-select>
                 </a-form-item>
                 </a-form-item>
               </a-col>
               </a-col>
             </template>
             </template>
@@ -38,7 +38,7 @@
         </a-form>
         </a-form>
       </div>
       </div>
       <div class="table-operator">
       <div class="table-operator">
-        <a-button v-if="$hasPermissions('B_powerMD_user_add')" type="primary" class="button-error" @click="openModal">新增保证金</a-button>
+        <a-button size="small" type="primary" class="button-error" @click="handleEdit()">新增保证金</a-button>
       </div>
       </div>
       <s-table
       <s-table
         class="sTable fixPagination"
         class="sTable fixPagination"
@@ -51,33 +51,29 @@
         :scroll="{ y: tableHeight }"
         :scroll="{ y: tableHeight }"
         :defaultLoadData="false"
         :defaultLoadData="false"
         bordered>
         bordered>
-        <template slot="phone" slot-scope="text">
-          <a-statistic :precision="2" :value="112893" :valueStyle="{fontSize:'12px'}"/>
-        </template>
-        <template slot="status" slot-scope="text, record">
-          <!-- <a-switch checkedChildren="启用" unCheckedChildren="禁用" v-model="record.loginFlag" @change="changeFlagHandle(text, record)"/> -->
-        </template>
-        <template slot="action" slot-scope="text, record">
-          <a-button type="link" @click="handleEdit(record)">编辑</a-button>
-          <a-button type="link" @click="handleDel(record)">删除</a-button>
-          <!-- <span v-if="!($hasPermissions('B_powerMD_user_edit') && record.superAdmin!=1) && !(record.loginFlag==1 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_restPwd')) && !(record.loginFlag==0 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_del'))">--</span> -->
+        <template slot="action" slot-scope="text, record" >
+          <a-button size="small" type="link" class="button-info" @click="handleEdit(record)" v-if="record.state=='WAIT'">编辑</a-button>
+          <a-button size="small" type="link" class="button-info" @click="handleDel(record)" v-if="record.state=='WAIT'">删除</a-button>
+          <span style="display:inline-block;padding-left:7px" v-if="record.state=='FINISH'">--</span>
+          <!-- <span v-if="!($hasPermissions('B_powerMD_user_edit') && record.superAdmin!=1) && !(record.loginFlag==1 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_restPwd')) && !(record.loginFlag==0 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_del'))" style="display:inline-block;padding-left:7px">--</span> -->
         </template>
         </template>
       </s-table>
       </s-table>
     </a-spin>
     </a-spin>
     <!--新增/编辑数字货架 -->
     <!--新增/编辑数字货架 -->
-    <!-- <addGoodsShelve :visible="showModal" @refresh="$refs.table.refresh(true)" :nowData="itemData" @close="handleUserCancel"></addGoodsShelve> -->
+    <addGoodsShelve :visible="showModal" @refresh="$refs.table.refresh(true)" :nowData="itemData" @close="handleUserCancel"></addGoodsShelve>
   </a-card>
   </a-card>
 </template>
 </template>
 
 
 <script>
 <script>
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
-// import addGoodsShelve from './addGoodsShelve.vue'
-import { updateEnableStatus, getPowerUserList } from '@/api/power-user.js'
+import addGoodsShelve from './addGoodsShelve.vue'
+import { bondRecordByPage, bondRecordDel } from '@/api/boundRecord.js'
+import dealerList from '@/views/common/dealerList.vue'
+import storeList from '@/views/common/storeList.vue'
+import { toThousands } from '@/libs/tools.js'
 export default {
 export default {
   name: 'UserList',
   name: 'UserList',
-  components: {
-    STable, VSelect
-  },
+  components: { STable, VSelect, dealerList, storeList, addGoodsShelve },
   data () {
   data () {
     return {
     return {
       spinning: false,
       spinning: false,
@@ -85,28 +81,27 @@ export default {
       tableHeight: 0,
       tableHeight: 0,
       // 查询参数
       // 查询参数
       queryParam: {
       queryParam: {
-        name: '',
-        phone: '',
-        loginFlag: undefined
+        shelfName: '',
+        bondRecordState: undefined
       },
       },
       showModal: false,
       showModal: false,
       itemData: null, // 编辑行数据
       itemData: null, // 编辑行数据
       openStatusModal: false, // 货架状态弹窗初始状态
       openStatusModal: false, // 货架状态弹窗初始状态
       // 表头
       // 表头
       columns: [
       columns: [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '货架名称', dataIndex: 'createDate', width: '11%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '配件经销商', dataIndex: 'org.name', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '汽车修理厂', dataIndex: 'name', width: '18%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '保证金金额', dataIndex: 'phone', width: '12%', align: 'center', scopedSlots: { customRender: 'phone' } },
-        { title: '状态', dataIndex: 'phone', width: '12%', align: 'center', scopedSlots: { customRender: 'status' } },
-        { title: '创建时间', dataIndex: 'loginName', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', width: '10%', align: 'center', scopedSlots: { customRender: 'action' } }
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '货架名称', dataIndex: 'shelfName', width: '15%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '配件经销商', dataIndex: 'dealerName', width: '15%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '汽车修理厂', dataIndex: 'storeName', width: '15%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '保证金金额', dataIndex: 'bondAmount', width: '10%', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } },
+        { title: '状态', dataIndex: 'stateDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '创建时间', dataIndex: 'createDate', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', width: '10%', align: 'left', scopedSlots: { customRender: 'action' } }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.spinning = true
         this.spinning = true
-        return getPowerUserList(Object.assign(parameter, this.queryParam)).then(res => {
+        return bondRecordByPage(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           let data
           if (res.status == 200) {
           if (res.status == 200) {
             data = res.data
             data = res.data
@@ -114,7 +109,6 @@ export default {
             for (let i = 0; i < data.list.length; i++) {
             for (let i = 0; i < data.list.length; i++) {
               const _item = data.list[i]
               const _item = data.list[i]
               _item.no = no + i + 1
               _item.no = no + i + 1
-              _item.loginFlag = _item.loginFlag + '' === '1'
             }
             }
           }
           }
           this.spinning = false
           this.spinning = false
@@ -126,10 +120,23 @@ export default {
     }
     }
   },
   },
   methods: {
   methods: {
-    // 新增
-    openModal () {
-      this.itemData = null
+    // 经销商 change
+    dealerChange (obj) {
+      this.queryParam.dealerSn = obj.key || undefined
+    },
+    // 汽车修理厂 change
+    storeChange (obj) {
+      this.queryParam.storeSn = obj.key || undefined
+    },
+    // 新增/编辑
+    handleEdit (row) {
+      if (row) {
+        this.itemData = row
+      } else {
+        this.itemData = null
+      }
       this.showModal = true
       this.showModal = true
+      console.log(this.itemData, 'this.itemData')
     },
     },
     // 关闭弹框
     // 关闭弹框
     handleUserCancel () {
     handleUserCancel () {
@@ -138,19 +145,13 @@ export default {
     },
     },
     // 重置
     // 重置
     reset () {
     reset () {
-      this.queryParam.name = ''
-      this.queryParam.phone = ''
-      this.queryParam.loginFlag = undefined
-      this.$refs.table.refresh(true)
-    },
-    // 编辑
-    handleEdit (row) {
-      this.itemData = row
-      if (row.ownerOrgFlag == 1) { //  自建
-        this.showModal = true
-      } else { //  同步过来的,非自建
-        this.showSyncModal = true
+      this.queryParam = {
+        shelfName: '',
+        bondRecordState: undefined
       }
       }
+      this.$refs.dealerList.resetForm()
+      this.$refs.storeList.resetForm()
+      this.$refs.table.refresh(true)
     },
     },
     // 删除
     // 删除
     handleDel (row) {
     handleDel (row) {
@@ -161,17 +162,17 @@ export default {
         centered: true,
         centered: true,
         onOk () {
         onOk () {
           _this.spinning = true
           _this.spinning = true
-          // delectRolePower({
-          //   id: row.id
-          // }).then(res => {
-          //   if (res.status == 200) {
-          //     _this.$message.success(res.message)
-          //     _this.$refs.table.refresh()
-          //     _this.spinning = false
-          //   } else {
-          //     _this.spinning = false
-          //   }
-          // })
+          bondRecordDel({
+            bondRecordSn: row.bondRecordSn
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+              _this.spinning = false
+            } else {
+              _this.spinning = false
+            }
+          })
         }
         }
       })
       })
     },
     },

+ 43 - 40
src/views/numsGoodsShelves/goodsShelvesAdministration/addGoodsShelve.vue

@@ -1,15 +1,15 @@
 <template>
 <template>
   <div>
   <div>
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-modal
-        centered
-        wrapClassName="addGoodsShelve-modal"
-        :footer="null"
-        :maskClosable="false"
-        :title="titleText"
-        v-model="isshow"
-        @cancle="isshow=false"
-        :width="800">
+    <a-modal
+      centered
+      wrapClassName="addGoodsShelve-modal"
+      :footer="null"
+      :maskClosable="false"
+      :title="titleText"
+      v-model="isshow"
+      @cancle="isshow=false"
+      :width="800">
+      <a-spin :spinning="spinning" tip="Loading...">
         <a-form-model
         <a-form-model
           id="userEdit-form"
           id="userEdit-form"
           ref="ruleForm"
           ref="ruleForm"
@@ -21,12 +21,14 @@
           <a-row :gutter="24">
           <a-row :gutter="24">
             <a-col :span="12">
             <a-col :span="12">
               <a-form-model-item label="配件经销商" prop="dealerSn">
               <a-form-model-item label="配件经销商" prop="dealerSn">
-                <dealerList ref="dealerList" @change="dealerChange" :itemSn="form.dealerSn"></dealerList>
+                <dealerList ref="dealerList" @change="dealerChange" v-if="!nowData"></dealerList>
+                <span v-else>{{ form.dealerName }}</span>
               </a-form-model-item>
               </a-form-model-item>
             </a-col>
             </a-col>
             <a-col :span="12">
             <a-col :span="12">
               <a-form-model-item label="汽车修理厂" prop="storeSn">
               <a-form-model-item label="汽车修理厂" prop="storeSn">
-                <storeList ref="storeList" @change="storeChange" :itemSn="form.storeSn"></storeList>
+                <storeList ref="storeList" @change="storeChange" v-if="!nowData"></storeList>
+                <span v-else>{{ form.storeName }}</span>
               </a-form-model-item>
               </a-form-model-item>
             </a-col>
             </a-col>
           </a-row>
           </a-row>
@@ -53,9 +55,9 @@
               <a-form-model-item label="产品图片" help="说明:请上传清晰、完整的图片,支持jpg/jpeg/png格式,不超过500KB(最多5张)。" :label-col="{span:3}" :wrapper-col="{span:20}">
               <a-form-model-item label="产品图片" help="说明:请上传清晰、完整的图片,支持jpg/jpeg/png格式,不超过500KB(最多5张)。" :label-col="{span:3}" :wrapper-col="{span:20}">
                 <Upload
                 <Upload
                   class="upload"
                   class="upload"
-                  id="productInfoEdit-productMsg"
+                  id="addGoodsShelve-images"
                   v-model="form.images"
                   v-model="form.images"
-                  ref="productMsg"
+                  ref="images"
                   @change="changeImage"
                   @change="changeImage"
                   :maxNums="5"
                   :maxNums="5"
                   :beforeUpload="beforeUpload"
                   :beforeUpload="beforeUpload"
@@ -75,8 +77,9 @@
             <a-button :style="{ marginLeft: '8px' }" @click="isshow=false">取消</a-button>
             <a-button :style="{ marginLeft: '8px' }" @click="isshow=false">取消</a-button>
           </a-form-model-item>
           </a-form-model-item>
         </a-form-model>
         </a-form-model>
-      </a-modal>
-    </a-spin>
+      </a-spin>
+    </a-modal>
+
   </div>
   </div>
 </template>
 </template>
 
 
@@ -86,7 +89,7 @@ import { saveShelf, shelfDetail } from '@/api/shelf.js'
 import dealerList from '@/views/common/dealerList.vue'
 import dealerList from '@/views/common/dealerList.vue'
 import storeList from '@/views/common/storeList.vue'
 import storeList from '@/views/common/storeList.vue'
 export default {
 export default {
-  name: 'UserModal',
+  name: 'AddGoodsShelve',
   components: { STable, VSelect, Upload, dealerList, storeList },
   components: { STable, VSelect, Upload, dealerList, storeList },
   props: {
   props: {
     visible: {
     visible: {
@@ -112,7 +115,6 @@ export default {
         labelCol: { span: 6 },
         labelCol: { span: 6 },
         wrapperCol: { span: 16 }
         wrapperCol: { span: 16 }
       },
       },
-
       form: {
       form: {
         dealerSn: undefined, // 经销商sn
         dealerSn: undefined, // 经销商sn
         ownerType: '1', // 平台
         ownerType: '1', // 平台
@@ -148,7 +150,10 @@ export default {
     },
     },
     // 产品图片上传
     // 产品图片上传
     changeImage (file) {
     changeImage (file) {
-      this.form.productMsg = file
+      this.form.images = file
+    },
+    beforeUpload () {
+
     },
     },
     // 改变货架归属
     // 改变货架归属
     changeRadio (e) {
     changeRadio (e) {
@@ -162,15 +167,14 @@ export default {
         if (res.status == 200) {
         if (res.status == 200) {
           this.form = Object.assign({}, res.data)
           this.form = Object.assign({}, res.data)
           this.form.ownerType = Number(this.form.ownerType)
           this.form.ownerType = Number(this.form.ownerType)
-        } else {
-          this.form = {
-            dealerSn: undefined, // 经销商sn
-            ownerType: 1, // 平台
-            storeSn: undefined, // 汽车修理厂sn
-            shelfName: '', // 货架名称
-            images: '', // 图片
-            remarks: ''// 备注
+          if (this.form.ownerType == 0) {
+            this.$nextTick(() => {
+              this.$refs.images.setFileList(this.form.images)
+            })
           }
           }
+        } else {
+          this.form = {}
+          this.$refs.images.setFileList('')
         }
         }
         this.spinning = false
         this.spinning = false
       })
       })
@@ -181,7 +185,12 @@ export default {
       this.$refs.ruleForm.validate(valid => {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
         if (valid) {
           const params = JSON.parse(JSON.stringify(_this.form))
           const params = JSON.parse(JSON.stringify(_this.form))
-          params.id = _this.nowData && _this.nowData.id ? _this.nowData.id : null
+          if (params.images == '') {
+            delete params.images
+          }
+          if (_this.nowData && _this.nowData.id) {
+            params.id = _this.nowData.id
+          }
           _this.spinning = true
           _this.spinning = true
           saveShelf(params).then(res => {
           saveShelf(params).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
@@ -189,11 +198,9 @@ export default {
               _this.$emit('refresh')
               _this.$emit('refresh')
               setTimeout(function () {
               setTimeout(function () {
                 _this.isshow = false
                 _this.isshow = false
-                _this.spinning = false
               }, 300)
               }, 300)
-            } else {
-              _this.spinning = false
             }
             }
+            _this.spinning = false
           })
           })
         } else {
         } else {
           console.log('error submit!!')
           console.log('error submit!!')
@@ -208,17 +215,13 @@ export default {
     },
     },
     isshow (newValue, oldValue) {
     isshow (newValue, oldValue) {
       if (!newValue) {
       if (!newValue) {
-        this.$emit('close')
+        this.form = {}
         this.$refs.ruleForm.resetFields()
         this.$refs.ruleForm.resetFields()
-        this.form = {
-          dealerSn: undefined, // 经销商sn
-          ownerType: 1, // 平台
-          storeSn: undefined, // 汽车修理厂sn
-          shelfName: '', // 货架名称
-          images: '', // 图片
-          remarks: ''// 备注
-        }
+        this.$emit('close')
         this.titleText = '新增数字货架'
         this.titleText = '新增数字货架'
+      } else {
+        this.titleText = '编辑数字货架'
+        // this.getShelfDetail()
       }
       }
     },
     },
     nowData: {
     nowData: {

+ 39 - 48
src/views/numsGoodsShelves/goodsShelvesAdministration/addHWModal.vue

@@ -1,15 +1,15 @@
 <template>
 <template>
   <div>
   <div>
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-modal
-        centered
-        wrapClassName="addGoodsShelve-modal"
-        :footer="null"
-        :maskClosable="false"
-        :title="titleText"
-        v-model="isshow"
-        @cancle="isshow=false"
-        :width="500">
+    <a-modal
+      centered
+      wrapClassName="addGoodsShelve-modal"
+      :footer="null"
+      :maskClosable="false"
+      :title="textTitle"
+      v-model="isshow"
+      @cancle="isshow=false"
+      :width="500">
+      <a-spin :spinning="spinning" tip="Loading...">
         <a-form-model
         <a-form-model
           id="userEdit-form"
           id="userEdit-form"
           ref="ruleForm"
           ref="ruleForm"
@@ -18,8 +18,8 @@
         >
         >
           <a-row :gutter="20">
           <a-row :gutter="20">
             <a-col :span="24">
             <a-col :span="24">
-              <a-form-model-item label="货架名称" prop="shelfName" :label-col="{span: 5}" :wrapper-col="{span: 18}">
-                <a-input id="userEdit-shelfName" v-model.trim="form.shelfName" :maxLength="30" allowClear placeholder="请输入货架名称(最多30个字符)"/>
+              <a-form-model-item label="货位号" prop="shelfPlaceCode" :label-col="{span: 5}" :wrapper-col="{span: 18}">
+                <a-input id="userEdit-shelfPlaceCode" v-model.trim="form.shelfPlaceCode" allowClear placeholder="请输入货位号"/>
               </a-form-model-item>
               </a-form-model-item>
             </a-col>
             </a-col>
           </a-row>
           </a-row>
@@ -28,40 +28,42 @@
             <a-button :style="{ marginLeft: '8px' }" @click="isshow=false">取消</a-button>
             <a-button :style="{ marginLeft: '8px' }" @click="isshow=false">取消</a-button>
           </a-form-model-item>
           </a-form-model-item>
         </a-form-model>
         </a-form-model>
-      </a-modal>
-    </a-spin>
+      </a-spin>
+    </a-modal>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
-import { saveShelf, shelfDetail } from '@/api/shelf.js'
+import { saveHw, shelfHWDetail } from '@/api/shelf.js'
 export default {
 export default {
-  name: 'UserModal',
+  name: 'AddHWModal',
   props: {
   props: {
     openHWModal: {
     openHWModal: {
       type: Boolean,
       type: Boolean,
       default: false
       default: false
     },
     },
-    nowData: {
-      type: Object,
-      default: function () {
-        return {}
-      }
+    shelfSn: {
+      type: [String, Number],
+      default: ''
+    },
+    shelfPlaceSn: {
+      type: [String, Number],
+      default: ''
     }
     }
   },
   },
 
 
   data () {
   data () {
     return {
     return {
       spinning: false,
       spinning: false,
-      titleText: '新增货位',
       isshow: this.openHWModal,
       isshow: this.openHWModal,
+      textTitle: '新增货位',
       roleList: [],
       roleList: [],
       pageInfo: null,
       pageInfo: null,
       form: {
       form: {
-        shelfName: '' // 货架名称
+        shelfPlaceCode: '' // 货位号
       },
       },
       rules: {
       rules: {
-        shelfName: [ { required: true, message: '请输入用户名称', trigger: 'blur' }, { pattern: '^[^<|>]{1,30}$', message: '请输入不含<或>的字符,最多30个字符' } ]
+        shelfPlaceCode: [ { required: true, message: '请输入货位编号', trigger: 'blur' }]
       }
       }
     }
     }
   },
   },
@@ -74,17 +76,12 @@ export default {
       str = str.replace(/[\r\n]/g, '')
       str = str.replace(/[\r\n]/g, '')
       this.form.name = str
       this.form.name = str
     },
     },
-    // 查询货详情
-    getShelfDetail () {
+    // 查询货详情
+    getShelfHWDetail () {
       this.spinning = true
       this.spinning = true
-      shelfDetail({ shelfSn: this.nowData.shelfSn }).then(res => {
+      shelfHWDetail({ shelfPlaceSn: this.shelfPlaceSn }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           this.form = Object.assign({}, res.data)
           this.form = Object.assign({}, res.data)
-          this.form.ownerType = Number(this.form.ownerType)
-        } else {
-          this.form = {
-            shelfName: '' // 货架名称
-          }
         }
         }
         this.spinning = false
         this.spinning = false
       })
       })
@@ -95,9 +92,10 @@ export default {
       this.$refs.ruleForm.validate(valid => {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
         if (valid) {
           const params = JSON.parse(JSON.stringify(_this.form))
           const params = JSON.parse(JSON.stringify(_this.form))
-          params.id = _this.nowData && _this.nowData.id ? _this.nowData.id : null
+          params.shelfSn = _this.shelfSn ? _this.shelfSn : null
+          console.log(params.id, params.shelfSn, '------------编辑新增')
           _this.spinning = true
           _this.spinning = true
-          saveShelf(params).then(res => {
+          saveHw(params).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$message.success(res.message)
               _this.$emit('refresh')
               _this.$emit('refresh')
@@ -123,25 +121,18 @@ export default {
     },
     },
     isshow (newValue, oldValue) {
     isshow (newValue, oldValue) {
       if (!newValue) {
       if (!newValue) {
-        this.$emit('close')
         this.$refs.ruleForm.resetFields()
         this.$refs.ruleForm.resetFields()
-        this.form = {
-          shelfName: '' // 货架名称
-        }
-        this.titleText = '新增货位'
+        this.form = {}
+        this.textTitle = '新增货位'
+        this.$emit('close')
       }
       }
     },
     },
-    nowData: {
+    shelfPlaceSn: {
       handler (newValue, oldValue) {
       handler (newValue, oldValue) {
         if (this.isshow && newValue) {
         if (this.isshow && newValue) {
-          if (this.nowData.id) { //  编辑
-            this.titleText = '编辑货位'
-            this.getShelfDetail()
-          } else {
-            this.titleText = '新增货位'
-            this.form = {
-              shelfName: '' // 货架名称
-            }
+          if (this.shelfPlaceSn) { //  编辑
+            this.textTitle = '编辑货位'
+            this.getShelfHWDetail()
           }
           }
         }
         }
       },
       },

+ 21 - 21
src/views/numsGoodsShelves/goodsShelvesAdministration/changeStatusModal.vue

@@ -1,21 +1,21 @@
 <template>
 <template>
   <div>
   <div>
-    <a-spin :spinning="spinning" tip="Loading...">
-      <a-modal
-        centered
-        wrapClassName="addGoodsShelve-modal"
-        :footer="null"
-        :maskClosable="false"
-        :title="titleText"
-        v-model="isshow"
-        @cancle="isshow=false"
-        :width="600">
+    <a-modal
+      centered
+      wrapClassName="addGoodsShelve-modal"
+      :footer="null"
+      :maskClosable="false"
+      :title="titleText"
+      v-model="isshow"
+      @cancle="isshow=false"
+      :width="600">
+      <a-spin :spinning="spinning" tip="Loading...">
         <div style="text-align: center;">
         <div style="text-align: center;">
-          <h3 style="padding: 15px 0; font-weight: bold;">{{ nowData.shelfName }}</h3>
+          <h3 style="padding: 15px 0; font-weight: bold;">{{ nowData?nowData.shelfName:'' }}</h3>
           <div style="padding-bottom: 15px">
           <div style="padding-bottom: 15px">
-            <p>此数字货架当前状态为<span style="display:inline-block;padding:0 3px">"{{ nowData.state }}"</span>,确定流转到下一个状态<span style="display:inline-block;padding:0 3px;color:red">"{{ nextState }}"</span>吗?</p>
-            <p v-if="nowData.state=='已启用'">暂停后汽车修理厂无法再使用数字货架</p>
-            <p v-if="nowData.state=='已暂停'">关闭后,该数字货架的所有数据都不可见</p>
+            <p>此数字货架当前状态为<span style="display:inline-block;padding:0 3px">"{{ nowData&&nowData.stateDictValue }}"</span>,确定流转到下一个状态<span style="display:inline-block;padding:0 3px;color:red">"{{ nextState }}"</span>吗?</p>
+            <p v-if="nowData&&nowData.state=='ENABLE'">暂停后汽车修理厂无法再使用数字货架</p>
+            <p v-if="nowData&&nowData.state=='SUSPEND'">关闭后,该数字货架的所有数据都不可见</p>
             <p>状态流转后无法再回退,请谨慎操作!</p>
             <p>状态流转后无法再回退,请谨慎操作!</p>
           </div>
           </div>
           <div>
           <div>
@@ -23,15 +23,15 @@
             <a-button :style="{ marginLeft: '8px' }" @click="isshow=false">取消</a-button>
             <a-button :style="{ marginLeft: '8px' }" @click="isshow=false">取消</a-button>
           </div>
           </div>
         </div>
         </div>
-      </a-modal>
-    </a-spin>
+      </a-spin>
+    </a-modal>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import { updateEnableStatus } from '@/api/shelf.js'
 import { updateEnableStatus } from '@/api/shelf.js'
 export default {
 export default {
-  name: 'UserModal',
+  name: 'ChangeStatusModal',
   props: {
   props: {
     openStatusModal: {
     openStatusModal: {
       type: Boolean,
       type: Boolean,
@@ -57,7 +57,7 @@ export default {
     handleSubmit () {
     handleSubmit () {
       const _this = this
       const _this = this
       _this.spinning = true
       _this.spinning = true
-      updateEnableStatus({ shelfSn: this.nowData.shelfSn, state: this.nextState }).then(res => {
+      updateEnableStatus({ shelfSn: this.nowData.shelfSn }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           _this.$message.success(res.message)
           _this.$message.success(res.message)
           _this.$emit('refresh')
           _this.$emit('refresh')
@@ -84,11 +84,11 @@ export default {
       handler (newValue, oldValue) {
       handler (newValue, oldValue) {
         if (this.isshow && newValue) {
         if (this.isshow && newValue) {
           if (this.nowData.id) { //  编辑
           if (this.nowData.id) { //  编辑
-            if (this.nowData.state == '未启用') {
+            if (this.nowData.state == 'NOT_ENABLE') {
               this.nextState = '已启用'
               this.nextState = '已启用'
-            } else if (this.nowData.state == '已启用') {
+            } else if (this.nowData.state == 'ENABLE') {
               this.nextState = '已暂停'
               this.nextState = '已暂停'
-            } else {
+            } else if (this.nowData.state == 'SUSPEND') {
               this.nextState = '已关闭'
               this.nextState = '已关闭'
             }
             }
           }
           }

+ 33 - 24
src/views/numsGoodsShelves/goodsShelvesAdministration/chooseImportModal.vue

@@ -68,7 +68,7 @@
 
 
 <script>
 <script>
 // import { hdExportExcel } from '@/libs/exportExcel'
 // import { hdExportExcel } from '@/libs/exportExcel'
-// import { sparePartsDetailParseProducts, sparePartsDetailFailExcel } from '@/api/spareParts'
+import { saveBatchExcel, exportExcelData } from '@/api/shelf'
 export default {
 export default {
   name: 'ChooseImportModal',
   name: 'ChooseImportModal',
   props: {
   props: {
@@ -88,13 +88,13 @@ export default {
       isShow: this.openModal, //  是否打开弹框
       isShow: this.openModal, //  是否打开弹框
       nowColumns: [
       nowColumns: [
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
-        { title: '货位号', dataIndex: 'productCode', width: '90%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '90%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       ],
       loadData: [],
       loadData: [],
       nowUnColumns: [
       nowUnColumns: [
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '10%', align: 'center' },
-        { title: '货位号', dataIndex: 'productCode', width: '40%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '错误原因', dataIndex: 'productName', width: '50%', align: 'center', customRender: function (text) { return text || '--' } }
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '40%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '错误原因', dataIndex: 'remarks', width: '50%', align: 'center', customRender: function (text) { return text || '--' } }
       ],
       ],
       unLoadData: [],
       unLoadData: [],
       loading: false
       loading: false
@@ -105,34 +105,43 @@ export default {
       const _this = this
       const _this = this
       this.loading = true
       this.loading = true
       const params = {
       const params = {
-        sparePartsSn: this.paramsData.sparePartsSn,
+        shelfSn: this.paramsData.shelfSn,
         path: this.paramsData.path
         path: this.paramsData.path
       }
       }
-      // sparePartsDetailParseProducts(params).then(res => {
-      //   this.loading = false
-      //   if (res.status == 200) {
-      //     if (res.data.okList && res.data.okList.length > 0) {
-      //       res.data.okList.map((item, index) => {
-      //         item.no = index + 1
-      //       })
-      //     }
-      //     if (res.data.failList && res.data.failList.length > 0) {
-      //       res.data.failList.map((item, index) => {
-      //         item.no = index + 1
-      //       })
-      //     }
-      //     _this.loadData = res.data.okList || []
-      //     _this.unLoadData = res.data.failList || []
-      //   }
-      // })
+      exportExcelData(params).then(res => {
+        this.loading = false
+        if (res.status == 200) {
+          console.log(res, '-------货位')
+          if (res.data.successList && res.data.successList.length > 0) {
+            res.data.successList.map((item, index) => {
+              item.no = index + 1
+            })
+          }
+          if (res.data.failList && res.data.failList.length > 0) {
+            res.data.failList.map((item, index) => {
+              item.no = index + 1
+            })
+          }
+          _this.loadData = res.data.successList || []
+          _this.unLoadData = res.data.failList || []
+        }
+      })
     },
     },
     // 确认导入
     // 确认导入
     handleSubmit () {
     handleSubmit () {
       if (this.loadData.length == 0) {
       if (this.loadData.length == 0) {
         this.$message.warning('无可导入产品!')
         this.$message.warning('无可导入产品!')
       } else {
       } else {
-        this.$emit('ok', this.loadData)
-        this.isShow = false
+        // this.$emit('ok', this.loadData)
+        // this.isShow = false
+        // const params = this.loadData
+        saveBatchExcel(this.loadData).then(res => {
+          if (res.status == 200) {
+            console.log(res, '----------huoweo')
+            this.$emit('ok', this.loadData)
+            this.isShow = false
+          }
+        })
       }
       }
     },
     },
     // 导出
     // 导出

+ 140 - 53
src/views/numsGoodsShelves/goodsShelvesAdministration/goodsAllocationSet.vue

@@ -6,49 +6,51 @@
           <a href="javascript:;" @click="handleBack">
           <a href="javascript:;" @click="handleBack">
             <a-icon type="left"></a-icon> 返回列表
             <a-icon type="left"></a-icon> 返回列表
           </a>
           </a>
-          <span style="margin: 0 15px;color: #666;font-weight: bold;">货架名称:{{ pageInfo.shelfName||'--' }}</span>
+          <span style="margin: 0 15px;color: #666;font-weight: bold;">{{ pageInfo&&pageInfo.shelfName?pageInfo.shelfName:'--' }}</span>
         </template>
         </template>
       </a-page-header>
       </a-page-header>
       <a-card :bordered="false" size="small" class="goodsAllocationSet-baseInfo">
       <a-card :bordered="false" size="small" class="goodsAllocationSet-baseInfo">
         <a-collapse :activeKey="['1']">
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1" header="基础信息">
           <a-collapse-panel key="1" header="基础信息">
             <a-descriptions size="small" :column="3">
             <a-descriptions size="small" :column="3">
-              <a-descriptions-item label="配件经销商">{{ pageInfo.dealerSn||'--' }}</a-descriptions-item>
-              <a-descriptions-item label="汽车修理厂">{{ pageInfo.storeSn||'--' }}</a-descriptions-item>
-              <a-descriptions-item label="货架归属">{{ pageInfo.ownerType==1?'自有':'平台' }}</a-descriptions-item>
-              <a-descriptions-item label="货架图片">{{ pageInfo.dealerSn||'--' }}</a-descriptions-item>
-              <a-descriptions-item label="备注">{{ pageInfo.remarks||'--' }}</a-descriptions-item>
+              <a-descriptions-item label="配件经销商">{{ pageInfo&&pageInfo.dealerName?pageInfo.dealerName:'--' }}</a-descriptions-item>
+              <a-descriptions-item label="汽车修理厂">{{ pageInfo&&pageInfo.storeName?pageInfo.storeName:'--' }}</a-descriptions-item>
+              <a-descriptions-item label="货架归属">{{ pageInfo&&pageInfo.ownerType==1?'自有':'平台' }}</a-descriptions-item>
+              <a-descriptions-item label="货架图片" v-if="pageInfo&&pageInfo.ownerType==1">
+                <div v-if="pageInfo && pageInfo.images&&pageInfo.images.length>0">
+                  <img :src="pageInfo.images[0]|| ''" width="30" height="30" class="imageUrl" @click="inited(pageInfo.images)" /> {{ '共'+pageInfo?pageInfo.images.length+'张':'' }}
+                </div>
+                <span v-else>--</span>
+              </a-descriptions-item>
+              <a-descriptions-item label="备注">{{ pageInfo&&pageInfo.remarks?pageInfo.remarks:'--' }}</a-descriptions-item>
             </a-descriptions>
             </a-descriptions>
           </a-collapse-panel>
           </a-collapse-panel>
         </a-collapse>
         </a-collapse>
       </a-card>
       </a-card>
       <a-card :bordered="false" size="small" class="pages-wrap">
       <a-card :bordered="false" size="small" class="pages-wrap">
         <div class="goodsAllocationSet-baseInfo">
         <div class="goodsAllocationSet-baseInfo">
-          <a-button @click="pageInfo.state=='未启用'? addHW(0):addHW(1)" type="primary">{{ pageInfo.state=='未启用'? '批量导入货位':'新增' }}</a-button>
+          <a-button @click="pageInfo&&pageInfo.state=='NOT_ENABLE'? addHW(0,pageInfo):addHW(1,pageInfo)" type="primary">{{ pageInfo&&pageInfo.state=='NOT_ENABLE'? '批量导入货位':'新增' }}</a-button>
         </div>
         </div>
-        <s-table
+        <a-table
           class="sTable fixPagination"
           class="sTable fixPagination"
           ref="table"
           ref="table"
           size="small"
           size="small"
-          rowKey="id"
-          :showPagination="false"
-          :columns="columns"
-          :data="loadData"
-          :defaultLoadData="false"
+          :pagination="false"
+          :columns="pageInfo&&pageInfo.state=='NOT_ENABLE'?columns:columnsDat"
+          :data-source="loadData"
           bordered>
           bordered>
-          <template slot="no" ,slot-scope="text, record,index">
-            <span>{{ index+1 }}</span>
-          </template>
           <template slot="status" slot-scope="text, record">
           <template slot="status" slot-scope="text, record">
-            <a-button type="link" @click="handleEdit(record)">编辑</a-button>
+            <a-button size="small" type="link" @click="handleEdit(record)" v-if="pageInfo&&pageInfo.state=='NOT_ENABLE' && !record.productCode">编辑</a-button>
+            <a-button size="small" type="link" @click="handleDel(record)" v-if="pageInfo&&pageInfo.state=='NOT_ENABLE' && !record.productCode">删除</a-button>
+            <span v-if="pageInfo&&pageInfo.state!='NOT_ENABLE'" style="display: inline-block;padding-left: 7px;">--</span>
             <!-- <span v-if="!($hasPermissions('B_powerMD_user_edit') && record.superAdmin!=1) && !(record.loginFlag==1 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_restPwd')) && !(record.loginFlag==0 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_del'))">--</span> -->
             <!-- <span v-if="!($hasPermissions('B_powerMD_user_edit') && record.superAdmin!=1) && !(record.loginFlag==1 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_restPwd')) && !(record.loginFlag==0 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_del'))">--</span> -->
           </template>
           </template>
-        </s-table>
+        </a-table>
       </a-card>
       </a-card>
       <!-- 导入货位模板 -->
       <!-- 导入货位模板 -->
-      <importHuoweiModal :openModal="openModal" @close="openModal=false" @refresh="$refs.table.refresh(true)"></importHuoweiModal>
+      <importHuoweiModal :openModal="openModal" @close="openModal=false" @refresh="getHwList" :shelfSn="shelfSn" @ok="handleOk"></importHuoweiModal>
       <!-- 新增货位 -->
       <!-- 新增货位 -->
-      <addHWModal :openHWModal="openHWModal" @refresh="$refs.table.refresh(true)" :nowData="itemData" @close="openHWModal=false"></addHWModal>
+      <addHWModal :openHWModal="openHWModal" @refresh="getHwList" :shelfSn="shelfSn" :shelfPlaceSn="shelfPlaceSn" @close="openHWModal=false"></addHWModal>
     </a-spin>
     </a-spin>
   </div>
   </div>
 </template>
 </template>
@@ -57,7 +59,7 @@
 import {
 import {
   STable
   STable
 } from '@/components'
 } from '@/components'
-import { shelfDetail, shelfHWList } from '@/api/shelf.js'
+import { shelfDetail, shelfHWList, delHw } from '@/api/shelf.js'
 import importHuoweiModal from './importHuoweiModal.vue'
 import importHuoweiModal from './importHuoweiModal.vue'
 import addHWModal from './addHWModal.vue'
 import addHWModal from './addHWModal.vue'
 export default {
 export default {
@@ -70,13 +72,15 @@ export default {
       openHWModal: false, // 新增货位初始弹窗
       openHWModal: false, // 新增货位初始弹窗
       pageInfo: null,
       pageInfo: null,
       itemData: null,
       itemData: null,
+      shelfSn: '', // 货架sn
+      shelfPlaceSn: '', // 当前行huoweisn
       // 表头
       // 表头
       columns: [{
       columns: [{
         title: '序号',
         title: '序号',
         width: '4%',
         width: '4%',
         align: 'center',
         align: 'center',
-        scopedSlots: {
-          customRender: 'no'
+        customRender: function (text, record, index) {
+          return index + 1
         }
         }
       },
       },
       {
       {
@@ -116,42 +120,128 @@ export default {
         }
         }
       }
       }
       ],
       ],
-      // 加载数据方法 必须为 Promise 对象
-      loadData: parameter => {
-        this.spinning = true
-        return shelfHWList(Object.assign({
-          shelfSn: this.$route.params.shelfSn
-        })).then(res => {
-          console.log(res)
-          let data
-          if (res.status == 200) {
-            data = res.data
+      columnsDat: [
+        {
+          title: '序号',
+          width: '4%',
+          align: 'center',
+          customRender: function (text, record, index) {
+            return index + 1
           }
           }
-          this.spinning = false
-          return data
-        })
-      }
+        },
+        {
+          title: '货位号',
+          dataIndex: 'shelfPlaceCode',
+          width: '11%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
+        {
+          title: '绑定产品编码',
+          dataIndex: 'productCode',
+          width: '13%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
+        {
+          title: '绑定产品',
+          dataIndex: 'productName',
+          width: '13%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          }
+        },
+        {
+          title: '创建时间',
+          dataIndex: 'createDate',
+          width: '18%',
+          align: 'center',
+          customRender: function (text) {
+            return text || '--'
+          },
+          ellipsis: true
+        },
+        {
+          title: '操作',
+          width: '9%',
+          align: 'left',
+          scopedSlots: {
+            customRender: 'status'
+          }
+        }
+      ],
+      loadData: []
     }
     }
   },
   },
   methods: {
   methods: {
     handleBack () {
     handleBack () {
       this.$router.go(-1)
       this.$router.go(-1)
     },
     },
-    addHW (type) {
-      console.log(type, '=========val')
+    // 查看图片
+    inited (viewer) {
+      if (viewer) {
+        const imageUrl = []
+        viewer.map(item => {
+          imageUrl.push(item.imageUrl)
+        })
+        this.$viewerApi({
+          images: imageUrl
+        })
+      }
+    },
+    // 导入或新增
+    addHW (type, val) {
+      console.log(type, val, '=========val')
+      this.shelfSn = val.shelfSn
       if (type == 0) {
       if (type == 0) {
         this.openModal = true
         this.openModal = true
       } else {
       } else {
         this.openHWModal = true
         this.openHWModal = true
       }
       }
     },
     },
-    handleExport () {
-      console.log('=========导入货位')
+    // 获取货位列表
+    getHwList () {
+      this.spinning = true
+      shelfHWList(Object.assign({ shelfSn: this.$route.params.shelfSn, shelfProductEntity: {} })).then(res => {
+        if (res.status == 200) {
+          this.loadData = res.data
+        }
+        this.spinning = false
+      })
+    },
+    // 删除
+    handleDel (row) {
+      const _this = this
+      this.$confirm({
+        title: '警告',
+        content: '删除后无法恢复,确认删除?',
+        centered: true,
+        onOk () {
+          _this.spinning = true
+          delHw({
+            shelfPlaceSn: row.shelfPlaceSn
+          }).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.getHwList()
+            }
+            _this.spinning = false
+          })
+        }
+      })
     },
     },
+    // 编辑
     handleEdit (row) {
     handleEdit (row) {
-      this.itemData = row
+      this.shelfPlaceSn = row.shelfPlaceSn
+      this.shelfSn = row.shelfSn
       this.openHWModal = true
       this.openHWModal = true
     },
     },
+    // 货架详情
     getShelfDetail () {
     getShelfDetail () {
       this.spinning = true
       this.spinning = true
       shelfDetail({
       shelfDetail({
@@ -159,26 +249,23 @@ export default {
       }).then(res => {
       }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           this.pageInfo = Object.assign({}, res.data)
           this.pageInfo = Object.assign({}, res.data)
+          if (this.pageInfo.ownerType == 1 && this.pageInfo.images) {
+            this.pageInfo.images = this.pageInfo.images.split(',')
+          }
         } else {
         } else {
           this.pageInfo = null
           this.pageInfo = null
         }
         }
         this.spinning = false
         this.spinning = false
       })
       })
     },
     },
-    handleSave (row, type) {
-      if (type == 0) {
-        console.log('====保存')
-      } else {
-        console.log('=====取消')
-      }
-      this.$nextTick(() => {
-        this.isEdit = false
-        this.$refs.table.refresh()
-      })
+    // 货位导入成功
+    handleOk (obj) {
+      console.log(obj, 'obj')
+      this.getHwList()
     },
     },
     pageInit () {
     pageInit () {
       this.getShelfDetail()
       this.getShelfDetail()
-      this.$refs.table.refresh()
+      this.getHwList()
     }
     }
   },
   },
   mounted () {
   mounted () {

+ 24 - 18
src/views/numsGoodsShelves/goodsShelvesAdministration/importHuoweiModal.vue

@@ -14,7 +14,10 @@
           <div class="explain-tit">
           <div class="explain-tit">
             <span>1</span>下载导入模板
             <span>1</span>下载导入模板
             <p>请按照下载的Excel模板填写数据</p>
             <p>请按照下载的Excel模板填写数据</p>
-            <a-button type="link" icon="download" style="padding: 0 0 0 23px;" @click="handleExport">下载导入模板</a-button>
+            <a :href="filePath" style="padding: 5px 0 0 23px;display: block;">
+              <a-icon type="download" style="padding-right: 5px;" />下载导入模板
+            </a>
+            <!-- <a-button type="link" icon="download" style="padding: 0 0 0 23px;" @click="handleExport">下载导入模板</a-button> -->
           </div>
           </div>
         </div>
         </div>
         <div class="explain-item">
         <div class="explain-item">
@@ -72,8 +75,8 @@
 <script>
 <script>
 import ChooseImportModal from './chooseImportModal.vue'
 import ChooseImportModal from './chooseImportModal.vue'
 import { Upload } from '@/components'
 import { Upload } from '@/components'
-// import { hdExportExcel } from '@/libs/exportExcel'
-// import { sparePartsDetailDownload } from '@/api/spareParts'
+import { hdExportExcel } from '@/libs/exportExcel'
+import { shelfHWExport } from '@/api/shelf'
 export default {
 export default {
   name: 'ImportGuideModal',
   name: 'ImportGuideModal',
   components: { ChooseImportModal, Upload },
   components: { ChooseImportModal, Upload },
@@ -81,16 +84,17 @@ export default {
     openModal: { //  弹框显示状态
     openModal: { //  弹框显示状态
       type: Boolean,
       type: Boolean,
       default: false
       default: false
+    },
+    shelfSn: {
+      type: [String, Number],
+      default: ''
     }
     }
-    // params: {
-    //   type: Object,
-    //   default: null
-    // }
   },
   },
   data () {
   data () {
     return {
     return {
       isShow: this.openModal, //  是否打开弹框
       isShow: this.openModal, //  是否打开弹框
       openImportModal: false, //  导入
       openImportModal: false, //  导入
+      filePath: 'https://jg-ocs-test.oss-cn-beijing.aliyuncs.com/test/%E6%95%B0%E5%AD%97%E8%B4%A7%E6%9E%B6%E8%B4%A7%E4%BD%8D%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xlsx',
       attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
       attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
       paramsData: null,
       paramsData: null,
       uploadParams: {
       uploadParams: {
@@ -102,23 +106,25 @@ export default {
     // 下一步
     // 下一步
     handlerNextStep () {
     handlerNextStep () {
       this.openImportModal = true
       this.openImportModal = true
-      // if (this.paramsData) {
-      //   this.openImportModal = true
-      // } else {
-      //   this.$message.warning('添加文件后再进行下一步操作!')
-      // }
+      if (this.paramsData) {
+        this.openImportModal = true
+      } else {
+        this.$message.warning('添加文件后再进行下一步操作!')
+      }
     },
     },
     // 上传文件  change
     // 上传文件  change
     changeImport (file) {
     changeImport (file) {
       if (file) {
       if (file) {
         this.paramsData = {
         this.paramsData = {
-          sparePartsSn: this.params.sparePartsSn || '',
+          shelfSn: this.shelfSn || '',
           path: file
           path: file
         }
         }
+        console.log(this.paramsData, 'this.paramsData')
       }
       }
     },
     },
     // 导入
     // 导入
     hanldeOk (obj) {
     hanldeOk (obj) {
+      console.log(obj, 'obj2222222222222')
       if (obj && obj.length > 0) {
       if (obj && obj.length > 0) {
         this.$emit('ok', obj)
         this.$emit('ok', obj)
         this.isShow = false
         this.isShow = false
@@ -132,13 +138,13 @@ export default {
     //  导出
     //  导出
     handleExport () {
     handleExport () {
       // const _this = this
       // const _this = this
-      // const params = { grabFlag: this.params.grabFlag }
+      const params = { }
       // this.exportLoading = true
       // this.exportLoading = true
       // this.spinning = true
       // this.spinning = true
-      // hdExportExcel(sparePartsDetailDownload, params, '散件入库导入模板', function () {
-      //   _this.exportLoading = false
-      //   _this.spinning = false
-      // })
+      hdExportExcel(shelfHWExport, params, '货位导入模板', function () {
+        // _this.exportLoading = false
+        // _this.spinning = false
+      })
     }
     }
   },
   },
   watch: {
   watch: {

+ 39 - 47
src/views/numsGoodsShelves/goodsShelvesAdministration/list.vue

@@ -22,12 +22,12 @@
             <template v-if="advanced">
             <template v-if="advanced">
               <a-col :md="6" :sm="24">
               <a-col :md="6" :sm="24">
                 <a-form-item label="货架状态">
                 <a-form-item label="货架状态">
-                  <v-select id="userList-loginFlag" code=" SHELF_STATE" v-model="queryParam.shelfState" allowClear placeholder="请选择状态"></v-select>
+                  <v-select id="userList-loginFlag" code="SHELF_STATE" v-model="queryParam.shelfState" allowClear placeholder="请选择状态"></v-select>
                 </a-form-item>
                 </a-form-item>
               </a-col>
               </a-col>
               <a-col :md="6" :sm="24">
               <a-col :md="6" :sm="24">
                 <a-form-item label="结算状态">
                 <a-form-item label="结算状态">
-                  <v-select id="userList-loginFlag" code="SETTLE_TYPE" v-model="queryParam.settleType" allowClear placeholder="请选择状态"></v-select>
+                  <v-select id="userList-loginFlag" code="SHELF_SETTLE_TYPE" v-model="queryParam.settleType" allowClear placeholder="请选择状态"></v-select>
                 </a-form-item>
                 </a-form-item>
               </a-col>
               </a-col>
             </template>
             </template>
@@ -43,7 +43,7 @@
         </a-form>
         </a-form>
       </div>
       </div>
       <div class="table-operator">
       <div class="table-operator">
-        <a-button v-if="$hasPermissions('B_powerMD_user_add')" type="primary" class="button-error" @click="handleEdit()">新增数字货架</a-button>
+        <a-button size="small" type="primary" class="button-error" @click="handleEdit()">新增数字货架</a-button>
       </div>
       </div>
       <s-table
       <s-table
         class="sTable fixPagination"
         class="sTable fixPagination"
@@ -57,12 +57,12 @@
         :defaultLoadData="false"
         :defaultLoadData="false"
         bordered>
         bordered>
         <template slot="state" slot-scope="text, record">
         <template slot="state" slot-scope="text, record">
-          <div @click="changeFlagHandle(record)" style="cursor:pointer;">{{ record.state }}<a-icon v-if="record.state!='已关闭'" type="edit" title="编辑" :style="{color:' #1890FF',paddingLeft: '5px'}"/></div>
+          <div @click="changeFlagHandle(record)" style="cursor:pointer;">{{ record.stateDictValue }}<a-icon v-if="record.state!='CLOSE'" type="edit" title="编辑" :style="{color:' #1890FF',paddingLeft: '5px'}"/></div>
         </template>
         </template>
         <template slot="action" slot-scope="text, record">
         <template slot="action" slot-scope="text, record">
-          <a-button type="link" class="button-info" @click="handleEdit(record)">编辑</a-button>
-          <a-button type="link" class="button-info" @click="handleSet(record)">货位设置</a-button>
-          <a-button type="link" class="button-info" @click="handleSettlement(record)">结算设置</a-button>
+          <a-button size="small" type="link" class="button-info" @click="handleEdit(record)">编辑</a-button>
+          <a-button size="small" type="link" class="button-info" @click="handleSet(record)">货位设置</a-button>
+          <a-button size="small" type="link" class="button-info" @click="handleSettlement(record)">结算设置</a-button>
           <!-- <span v-if="!($hasPermissions('B_powerMD_user_edit') && record.superAdmin!=1) && !(record.loginFlag==1 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_restPwd')) && !(record.loginFlag==0 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_del'))">--</span> -->
           <!-- <span v-if="!($hasPermissions('B_powerMD_user_edit') && record.superAdmin!=1) && !(record.loginFlag==1 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_restPwd')) && !(record.loginFlag==0 && record.ownerOrgFlag==1 && $hasPermissions('B_powerMD_user_del'))">--</span> -->
         </template>
         </template>
       </s-table>
       </s-table>
@@ -105,11 +105,11 @@ export default {
       columns: [
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
         { title: '货架名称', dataIndex: 'shelfName', width: '17%', align: 'left', customRender: function (text) { return text || '--' } },
         { title: '货架名称', dataIndex: 'shelfName', width: '17%', align: 'left', customRender: function (text) { return text || '--' } },
-        { title: '配件经销商', dataIndex: 'org.name', width: '17%', align: 'left', customRender: function (text) { return text || '--' } },
-        { title: '汽车修理厂', dataIndex: 'name', width: '17%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '配件经销商', dataIndex: 'dealerEntity.dealerName', width: '17%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '汽车修理厂', dataIndex: 'storeName', width: '17%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
         { title: '货位数量', dataIndex: 'shelfPlaceNum', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '货位数量', dataIndex: 'shelfPlaceNum', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '结算方式', dataIndex: 'phone', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: <div>货架状态&nbsp;<a-tooltip placement='top' title='货架状态'><a-icon type="question-circle" /></a-tooltip></div>, dataIndex: 'state', width: '7%', align: 'center', scopedSlots: { customRender: 'state' } },
+        { title: '结算方式', dataIndex: 'settleTypeDictValue', width: '7%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: <div>货架状态&nbsp;<a-tooltip placement='top' title='货架状态'><a-icon type="question-circle" /></a-tooltip></div>, width: '7%', align: 'center', scopedSlots: { customRender: 'state' } },
         { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '创建时间', dataIndex: 'createDate', width: '8%', align: 'center', customRender: function (text) { return text || '--' } },
         { title: '操作', width: '15%', align: 'left', scopedSlots: { customRender: 'action' } }
         { title: '操作', width: '15%', align: 'left', scopedSlots: { customRender: 'action' } }
       ],
       ],
@@ -124,15 +124,12 @@ export default {
             for (let i = 0; i < data.list.length; i++) {
             for (let i = 0; i < data.list.length; i++) {
               const _item = data.list[i]
               const _item = data.list[i]
               _item.no = no + i + 1
               _item.no = no + i + 1
-              // _item.loginFlag = _item.loginFlag + '' === '1'
             }
             }
           }
           }
           this.spinning = false
           this.spinning = false
           return data
           return data
         })
         })
-      },
-      optionAlertShow: false,
-      showSyncModal: false //  同步账号编辑弹框
+      }
     }
     }
   },
   },
   methods: {
   methods: {
@@ -164,10 +161,13 @@ export default {
         storeSn: undefined, // 汽车修理厂
         storeSn: undefined, // 汽车修理厂
         state: undefined// 货架状态
         state: undefined// 货架状态
       }
       }
+      this.$refs.dealerList.resetForm()
+      this.$refs.storeList.resetForm()
       this.$refs.table.refresh(true)
       this.$refs.table.refresh(true)
     },
     },
     // 编辑
     // 编辑
     handleEdit (row) {
     handleEdit (row) {
+      console.log(row, 'row')
       this.showModal = true
       this.showModal = true
       if (row) { //  编辑
       if (row) { //  编辑
         this.itemData = row
         this.itemData = row
@@ -181,37 +181,17 @@ export default {
     handleSettlement (row) {
     handleSettlement (row) {
       this.$router.push({ name: 'settlementSet', params: { shelfSn: row.shelfSn } })
       this.$router.push({ name: 'settlementSet', params: { shelfSn: row.shelfSn } })
     },
     },
-    // 关闭弹框 同步账号
-    handleCancel () {
-      this.itemData = null
-      this.showSyncModal = false
-    },
     // 修改状态
     // 修改状态
     changeFlagHandle (row) {
     changeFlagHandle (row) {
       console.log(row, '------------状态')
       console.log(row, '------------状态')
       this.itemData = row
       this.itemData = row
-      if (row.state != '已关闭') {
+      if (row.state != 'CLOSE') {
         this.openStatusModal = true
         this.openStatusModal = true
       }
       }
-
-      // const _data = {
-      //   id: record.id,
-      //   flag: record.loginFlag ? '1' : '0'
-      // }
-      // this.spinning = true
-      // updateEnableStatus(_data).then(res => {
-      //   if (res.status == 200) {
-      //     this.$message.success(res.message)
-      //     this.$refs.table.refresh()
-      //     this.spinning = false
-      //   } else {
-      //     this.$refs.table.refresh()
-      //     this.spinning = false
-      //   }
-      // })
     },
     },
     pageInit () {
     pageInit () {
       const _this = this
       const _this = this
+      _this.$refs.table.refresh()
       this.$nextTick(() => { // 页面渲染完成后的回调
       this.$nextTick(() => { // 页面渲染完成后的回调
         _this.setTableH()
         _this.setTableH()
       })
       })
@@ -227,17 +207,29 @@ export default {
     }
     }
   },
   },
   mounted () {
   mounted () {
-    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
-      this.pageInit()
-      this.reset()
-    }
+    this.pageInit()
+    // this.reset()
+    // if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+    //   this.pageInit()
+    //   this.reset()
+    // }
   },
   },
-  activated () {
-    // 如果是新页签打开,则重置当前页面
-    if (this.$store.state.app.isNewTab) {
-      this.pageInit()
-      this.reset()
-    }
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.$refs.table.refresh()
+    })
   }
   }
+  // activated () {
+  //   // 如果是新页签打开,则重置当前页面
+  //   if (this.$store.state.app.isNewTab) {
+  //     this.pageInit()
+  //     this.resetSearchForm()
+  //   }
+  //   // 仅刷新列表,不重置页面
+  //   if (this.$store.state.app.updateList) {
+  //     this.pageInit()
+  //     this.$refs.table.refresh()
+  //   }
+  // }
 }
 }
 </script>
 </script>

+ 99 - 97
src/views/numsGoodsShelves/goodsShelvesAdministration/settlementModifyModal.vue

@@ -6,10 +6,10 @@
         wrapClassName="addGoodsShelve-modal"
         wrapClassName="addGoodsShelve-modal"
         :footer="null"
         :footer="null"
         :maskClosable="false"
         :maskClosable="false"
-        :title="titleText"
+        title="修改结算方式"
         v-model="isshow"
         v-model="isshow"
         @cancle="isshow=false"
         @cancle="isshow=false"
-        :width="800">
+        :width="650">
         <a-form-model
         <a-form-model
           id="userEdit-form"
           id="userEdit-form"
           ref="ruleForm"
           ref="ruleForm"
@@ -19,75 +19,82 @@
           :wrapper-col="formItemLayout.wrapperCol"
           :wrapper-col="formItemLayout.wrapperCol"
         >
         >
           <a-row :gutter="24">
           <a-row :gutter="24">
-            <a-col :span="24">
+            <a-col :span="20">
               <a-form-model-item label="当前结算方式">
               <a-form-model-item label="当前结算方式">
-                {{ settlementType=='1'?'授信结算':'按月结算' }}
+                {{ shelfInfo&&shelfInfo.settleType=='CREDIT'?'授信结算':'按月结算' }}
               </a-form-model-item>
               </a-form-model-item>
             </a-col>
             </a-col>
-            <a-col :span="24">
-              <a-form-model-item label="结算方式" prop="name">
+            <a-col :span="20">
+              <a-form-model-item label="结算方式" prop="settleType">
                 <a-select
                 <a-select
                   style="background-color: none;"
                   style="background-color: none;"
                   placeholder="请选择结算方式"
                   placeholder="请选择结算方式"
-                  id="isEnable"
+                  id="settleType"
                   allowClear
                   allowClear
-                  v-model="form.isEnable"
+                  v-model="form.settleType"
                 >
                 >
-                  <a-select-option v-for="item in settlementTypeList" :key="item.code" :value="item.code" :disabled="settlementType==item.code?true:false">{{ item.name }}</a-select-option>
+                  <a-select-option v-for="item in settlementTypeList" :key="item.code" :value="item.code" :disabled="shelfInfo&&shelfInfo.settleType==item.code?true:false">{{ item.name }}</a-select-option>
                 </a-select>
                 </a-select>
-                <!-- <v-select
-                  code="ENABLE_FLAG"
-                  v-model="form.isEnable"
-                  allowClear
-                  placeholder="请选择结算方式"
-                  @change="changeJStype"
-                ></v-select> -->
               </a-form-model-item>
               </a-form-model-item>
             </a-col>
             </a-col>
-            <a-col :span="24">
-              <a-form-model-item label="授信额度" prop="name" v-if="form.isEnable==1">
-                <a-input
-                  id="userEdit-loginName"
-                  v-model.trim="form.name"
-                  allowClear
-                  placeholder="请输入授信额度"
-                  suffix="元"/>
-              </a-form-model-item>
-              <a-form-model-item label="结算日期" prop="phone" v-if="form.isEnable==0">
+            <a-row v-if="form.settleType=='CREDIT'">
+              <a-col :span="20">
+                <a-form-model-item label="授信额度" prop="creditLimit">
+                  <a-input-number
+                    id="shelfSet-bindProduct-creditLimit"
+                    v-model="form.creditLimit"
+                    :precision="2"
+                    :min="0.01"
+                    :max="999999"
+                    placeholder="请输入正数(最多允许两位小数)"
+                    style="width: 100%;display: inline-block;" />
+                </a-form-model-item>
+              </a-col>
+              <a-col :span="4"> <span style="display: inline-block; padding: 10px;">元</span></a-col>
+            </a-row>
+            <a-col :span="20" v-if="form.settleType=='MONTH'">
+              <a-form-model-item label="结算日期(每月)" prop="settleDay" >
                 <a-select
                 <a-select
                   style="background-color: none;"
                   style="background-color: none;"
                   placeholder="请选择结算日期"
                   placeholder="请选择结算日期"
-                  id="userSyncEdit-roleNames"
+                  id="userSyncEdit-settleDay"
                   allowClear
                   allowClear
-                  v-model="form.roleNames"
+                  v-model="form.settleDay"
                 >
                 >
                   <a-select-option v-for="item in dateList" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
                   <a-select-option v-for="item in dateList" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
                 </a-select>
                 </a-select>
               </a-form-model-item>
               </a-form-model-item>
             </a-col>
             </a-col>
-            <a-col :span="24">
-              <a-form-model-item label="结算提醒金额" prop="loginName" v-if="form.isEnable==1">
-                <a-input
-                  id="userEdit-loginName"
-                  v-model.trim="form.loginName"
-                  allowClear
-                  placeholder="请输入结算提醒金额"
-                  suffix="元"/>
-              </a-form-model-item>
-              <a-form-model-item label="结算提醒日期" prop="loginName" v-if="form.isEnable==0">
+            <a-row v-if="form.settleType=='CREDIT'">
+              <a-col :span="20">
+                <a-form-model-item label="结算提醒金额" prop="creditWarnLimit" >
+                  <a-input-number
+                    id="shelfSet-bindProduct-creditWarnLimit"
+                    v-model="form.creditWarnLimit"
+                    :precision="2"
+                    :min="0.01"
+                    :max="form.creditLimit-0.1"
+                    placeholder="请输入正数(最多允许两位小数)"
+                    style="width: 100%;display: inline-block;" />
+                </a-form-model-item>
+              </a-col>
+              <a-col :span="4"> <span style="display: inline-block; padding: 10px;">元</span></a-col>
+            </a-row>
+            <a-col :span="20" v-if="form.settleType=='MONTH'">
+              <a-form-model-item label="结算提醒(每月提醒提前的天数)" prop="warnBeforeDays" >
                 <a-select
                 <a-select
                   style="background-color: none;"
                   style="background-color: none;"
                   placeholder="请选择结算提醒日期"
                   placeholder="请选择结算提醒日期"
-                  id="userSyncEdit-roleNames"
+                  id="userSyncEdit-warnBeforeDays"
                   allowClear
                   allowClear
-                  v-model="form.roleNames"
+                  v-model="form.warnBeforeDays"
                 >
                 >
-                  <a-select-option v-for="item in dateList" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
+                  <a-select-option v-for="item in dateTXList" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
                 </a-select>
                 </a-select>
               </a-form-model-item>
               </a-form-model-item>
             </a-col>
             </a-col>
-            <a-col :span="24">
-              <a-form-model-item :label="form.isEnable==1?'超过授信额度':'超期未结算'" prop="loginName" v-if="form.isEnable==1">
+            <a-col :span="20">
+              <a-form-model-item :label="form.settleType=='CREDIT'?'超过授信额度':'超期未结算'" v-if="form.settleType">
                 <a-checkbox @change="onChange">
                 <a-checkbox @change="onChange">
                   限制汽车修理厂无法使用数字货架
                   限制汽车修理厂无法使用数字货架
                 </a-checkbox>
                 </a-checkbox>
@@ -106,9 +113,9 @@
 
 
 <script>
 <script>
 import { STable, VSelect, Upload } from '@/components'
 import { STable, VSelect, Upload } from '@/components'
-import { getRoleList, saveUserPower } from '@/api/power-user.js'
+import { shelfSettleRuleSave } from '@/api/shelf.js'
 export default {
 export default {
-  name: 'UserModal',
+  name: 'SettlementModifyModal',
   components: {
   components: {
     STable, VSelect, Upload
     STable, VSelect, Upload
   },
   },
@@ -117,45 +124,45 @@ export default {
       type: Boolean,
       type: Boolean,
       default: false
       default: false
     },
     },
-    nowData: {
+    shelfInfo: {
       type: Object,
       type: Object,
       default: function () {
       default: function () {
         return {}
         return {}
       }
       }
     },
     },
-    settlementType: {
-      type: [Number, String],
-      default: ''
+    settleInfo: {
+      type: Object,
+      default: function () {
+        return {}
+      }
     }
     }
   },
   },
   data () {
   data () {
     return {
     return {
       spinning: false,
       spinning: false,
-      titleText: '修改结算方式',
       isshow: this.visible,
       isshow: this.visible,
       roleList: [],
       roleList: [],
       formItemLayout: {
       formItemLayout: {
-        labelCol: { span: 6 },
-        wrapperCol: { span: 16 }
+        labelCol: { span: 10 },
+        wrapperCol: { span: 14 }
       },
       },
-      settlementTypeList: [{ code: 0, name: '按月结算' }, { code: 1, name: '授信结算' }],
+      settlementTypeList: [{ code: 'MONTH', name: '按月结算' }, { code: 'CREDIT', name: '授信结算' }],
+      dateList: [{ id: 1, name: 1 }, { id: 2, name: 2 }, { id: 3, name: 3 }, { id: 4, name: 4 }, { id: 5, name: 5 }, { id: 6, name: 6 }, { id: 7, name: 7 }, { id: 8, name: 8 }, { id: 9, name: 9 }, { id: 10, name: 10 }, { id: 11, name: 11 }, { id: 12, name: 12 }, { id: 13, name: 13 }, { id: 14, name: 14 }, { id: 15, name: 15 }, { id: 16, name: 16 }, { id: 17, name: 17 }, { id: 18, name: 18 }, { id: 19, name: 19 }, { id: 20, name: 20 }, { id: 21, name: 21 }, { id: 22, name: 22 }, { id: 23, name: 23 }, { id: 24, name: 24 }, { id: 25, name: 25 }],
+      dateTXList: [{ id: 1, name: 1 }, { id: 2, name: 2 }, { id: 3, name: 3 }, { id: 4, name: 4 }, { id: 5, name: 5 }, { id: 6, name: 6 }, { id: 7, name: 7 }, { id: 8, name: 8 }, { id: 9, name: 9 }, { id: 10, name: 10 }],
       form: {
       form: {
-        name: '',
-        phone: '',
-        loginName: '',
-        sex: undefined,
-        loginFlag: '', // 状态
-        roleNames: undefined, // 角色
-        productMsg: '', // 图片
-        remarks: ''
+        settleType: undefined, // 结算方式
+        creditLimit: '', // 授信额度
+        creditWarnLimit: '', // 结算提醒金额
+        settleDay: '', // 每月结算日
+        warnBeforeDays: '', // 结算提醒提前天数
+        limitFlag: '' // 是否限制使用
       },
       },
       rules: {
       rules: {
-        name: [ { required: true, message: '请输入用户名称', trigger: 'blur' }, { pattern: '^[^<|>]{1,30}$', message: '请输入不含<或>的字符,最多30个字符' } ],
-        phone: [ { required: true, message: '请输入手机号码', trigger: 'blur' }, { pattern: /^[1][0-9]{10}$/, message: '请输入正确的手机号码!' } ],
-        loginName: [ { required: true, message: '请输入用户账号', trigger: 'blur' }, { pattern: /^[0-9A-Za-z]+$/, message: '用户账号为数字或大小写字母组成!' } ],
-        sex: [ { required: true, message: '请选择性别', trigger: 'change' } ],
-        loginFlag: [ { required: true, message: '请选择状态', trigger: 'change' } ],
-        roleNames: [ { required: true, message: '请选择角色', trigger: 'change' } ]
+        settleType: [ { required: true, message: '请选择结算方式', trigger: 'change' } ],
+        creditLimit: [ { required: true, message: '请输入授信额度', trigger: 'blur' } ],
+        creditWarnLimit: [{ required: true, message: '请输入结算提醒金额', trigger: 'blur' }],
+        settleDay: [ { required: true, message: '请选择每月结算日期', trigger: 'change' } ],
+        warnBeforeDays: [ { required: true, message: '请选择每月结算提醒提前的日期', trigger: 'change' } ]
       }
       }
     }
     }
   },
   },
@@ -169,8 +176,13 @@ export default {
       this.form.name = str
       this.form.name = str
     },
     },
     // 产品图片上传
     // 产品图片上传
-    changeImage (file) {
-      this.form.productMsg = file
+    onChange (e) {
+      console.log(e.target.checked)
+      if (e.target.checked) {
+        this.form.limitFlag = 1
+      } else {
+        this.form.limitFlag = 0
+      }
     },
     },
     // 改变货架归属
     // 改变货架归属
     changeRadio (e) {
     changeRadio (e) {
@@ -183,14 +195,25 @@ export default {
       this.$refs.ruleForm.validate(valid => {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
         if (valid) {
           const params = JSON.parse(JSON.stringify(_this.form))
           const params = JSON.parse(JSON.stringify(_this.form))
-          params.roleNames = _this.form.roleNames.join(',')
-          params.id = _this.nowData && _this.nowData.id ? _this.nowData.id : null
-          params.ownerOrgFlag = _this.nowData && _this.nowData.ownerOrgFlag
+          if (params.limitFlag == '') {
+            params.limitFlag = 0
+          }
+          if (this.shelfInfo) {
+            console.log(this.shelfInfo, 'this.nowData')
+            params.shelfSn = this.shelfInfo.shelfSn
+            params.storeSn = this.shelfInfo.storeSn
+            params.dealerSn = this.shelfInfo.dealerSn
+          }
+          if (this.settleInfo) {
+            params.bondAmount = this.settleInfo.bondAmount
+            params.bondFlag = this.settleInfo.bondFlag
+            params.id = this.settleInfo.id
+          }
           _this.spinning = true
           _this.spinning = true
-          saveUserPower(params).then(res => {
+          shelfSettleRuleSave(params).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$message.success(res.message)
-              _this.$emit('refresh')
+              _this.$emit('close', params.settleType)
               setTimeout(function () {
               setTimeout(function () {
                 _this.isshow = false
                 _this.isshow = false
                 _this.spinning = false
                 _this.spinning = false
@@ -215,31 +238,10 @@ export default {
     },
     },
     isshow (newValue, oldValue) {
     isshow (newValue, oldValue) {
       if (!newValue) {
       if (!newValue) {
-        this.$emit('close')
         this.$refs.ruleForm.resetFields()
         this.$refs.ruleForm.resetFields()
-        this.form.name = ''
-        this.form.phone = ''
-        this.form.loginName = ''
-        this.form.sex = undefined
-        this.form.loginFlag = ''
-        this.form.roleNames = undefined
-        this.form.remarks = ''
+        this.form = {}
+        this.$emit('close')
       }
       }
-    },
-    nowData: {
-      handler (newValue, oldValue) {
-        if (this.isshow && newValue) {
-          if (this.nowData.id) { //  编辑
-            this.titleText = '编辑数字货架'
-            this.form = Object.assign({}, this.nowData)
-            if (this.nowData.roleIds) {
-              this.form.roleNames = this.nowData.roleIds.split(',')
-            }
-            this.form.loginFlag = Number(this.nowData.loginFlag)
-          }
-        }
-      },
-      deep: true
     }
     }
   }
   }
 }
 }

+ 194 - 131
src/views/numsGoodsShelves/goodsShelvesAdministration/settlementSet.vue

@@ -6,22 +6,27 @@
           <a href="javascript:;" @click="handleBack">
           <a href="javascript:;" @click="handleBack">
             <a-icon type="left"></a-icon> 返回列表
             <a-icon type="left"></a-icon> 返回列表
           </a>
           </a>
-          <span style="margin: 0 15px;color: #666;font-weight: bold;">货架名称:{{ pageInfo&&pageInfo.shelfName?pageInfo.shelfName:'--' }}</span>
+          <span style="margin: 0 15px;color: #666;font-weight: bold;">{{ pageInfo&&pageInfo.shelfName?pageInfo.shelfName:'--' }}</span>
         </template>
         </template>
       </a-page-header>
       </a-page-header>
       <a-card :bordered="false" size="small" class="goodsAllocationSet-baseInfo">
       <a-card :bordered="false" size="small" class="goodsAllocationSet-baseInfo">
         <a-collapse :activeKey="['1']">
         <a-collapse :activeKey="['1']">
           <a-collapse-panel key="1" header="基础信息">
           <a-collapse-panel key="1" header="基础信息">
             <a-descriptions size="small" :column="3">
             <a-descriptions size="small" :column="3">
-              <a-descriptions-item label="配件经销商">{{ pageInfo&&pageInfo.dealerSn?pageInfo.dealerSn:'--' }}</a-descriptions-item>
-              <a-descriptions-item label="汽车修理厂">{{ pageInfo&&pageInfo.storeSn?pageInfo.storeSn:'--' }}</a-descriptions-item>
+              <a-descriptions-item label="配件经销商">{{ pageInfo&&pageInfo.dealerName?pageInfo.dealerName:'--' }}</a-descriptions-item>
+              <a-descriptions-item label="汽车修理厂">{{ pageInfo&&pageInfo.storeName?pageInfo.storeName:'--' }}</a-descriptions-item>
               <a-descriptions-item label="货架归属">{{ pageInfo&&pageInfo.ownerType==1?'自有':'平台' }}</a-descriptions-item>
               <a-descriptions-item label="货架归属">{{ pageInfo&&pageInfo.ownerType==1?'自有':'平台' }}</a-descriptions-item>
-              <a-descriptions-item label="货架图片">{{ pageInfo&& pageInfo.dealerSn?pageInfo.dealerSn:'--' }}</a-descriptions-item>
+              <a-descriptions-item label="货架图片" v-if="pageInfo&&pageInfo.ownerType==1">
+                <div v-if="pageInfo && pageInfo.images&&pageInfo.images.length>0">
+                  <img :src="pageInfo.images[0]|| ''" width="30" height="30" class="imageUrl" @click="inited(pageInfo.images)" /> {{ '共'+pageInfo.images.length+'张' }}
+                </div>
+                <span v-else>--</span>
+              </a-descriptions-item>
               <a-descriptions-item label="备注">{{ pageInfo&&pageInfo.remarks?pageInfo.remarks:'--' }}</a-descriptions-item>
               <a-descriptions-item label="备注">{{ pageInfo&&pageInfo.remarks?pageInfo.remarks:'--' }}</a-descriptions-item>
             </a-descriptions>
             </a-descriptions>
           </a-collapse-panel>
           </a-collapse-panel>
         </a-collapse>
         </a-collapse>
-        <a-collapse :activeKey="['1']" class="bzj-collapse">
+        <a-collapse :activeKey="['1']" class="bzj-collapse" v-if="pageInfo&&pageInfo.settleType">
           <a-collapse-panel key="1" header="保证金 ( 保证金的新增/编辑/删除请在左侧菜单“保证金管理”功能中操作 )">
           <a-collapse-panel key="1" header="保证金 ( 保证金的新增/编辑/删除请在左侧菜单“保证金管理”功能中操作 )">
             <s-table
             <s-table
               class="sTable fixPagination"
               class="sTable fixPagination"
@@ -31,7 +36,7 @@
               :showPagination="false"
               :showPagination="false"
               :columns="columns"
               :columns="columns"
               :data="loadData"
               :data="loadData"
-              :defaultLoadData="false"
+              :defaultLoadData="true"
               bordered>
               bordered>
               <template slot="status" slot-scope="text, record">
               <template slot="status" slot-scope="text, record">
                 <a-button type="link" @click="handleEdit(record)">编辑</a-button>
                 <a-button type="link" @click="handleEdit(record)">编辑</a-button>
@@ -53,112 +58,125 @@
             :wrapper-col="formItemLayout.wrapperCol"
             :wrapper-col="formItemLayout.wrapperCol"
           >
           >
             <a-row :gutter="24">
             <a-row :gutter="24">
-              <a-col :span="24">
-                <a-form-model-item label="结算方式" prop="name">
-                  <div style="display: flex;">
-                    <v-select code="ENABLE_FLAG" v-model="form.isEnable" allowClear placeholder="请选择结算方式" @change="changeJStype"></v-select>
-                    <a-button type="link" @click="handleModify">修改</a-button>
-                  </div>
-
-                </a-form-model-item>
-              </a-col>
-              <a-col :span="24">
-                <a-form-model-item label="授信额度" prop="name" v-if="form.isEnable==1">
-                  <a-input
-                    id="userEdit-loginName"
-                    v-model.trim="form.name"
-                    allowClear
-                    placeholder="请输入授信额度"
-                    suffix="元"/>
-                </a-form-model-item>
-                <a-form-model-item label="结算日期" prop="phone" v-if="form.isEnable==0">
+              <a-row>
+                <a-col :span="15">
+                  <a-form-model-item label="结算方式" prop="settleType">
+                    <v-select
+                      code="SHELF_SETTLE_TYPE"
+                      v-model="form.settleType"
+                      allowClear
+                      placeholder="请选择结算方式"
+                      :disabled="pageInfo&&pageInfo.settleType?true:false">
+                    </v-select>
+                  </a-form-model-item>
+                </a-col>
+                <a-col :span="1"><a-button size="small" type="link" @click="handleModify(pageInfo,settleInfo)" v-if="pageInfo&&pageInfo.settleType" style="padding-top: 10px;">修改</a-button></a-col>
+              </a-row>
+              <a-row v-if="form.settleType=='CREDIT'">
+                <a-col :span="15">
+                  <a-form-model-item label="授信额度" prop="creditLimit">
+                    <a-input-number
+                      id="shelfSet-bindProduct-creditLimit"
+                      v-model="form.creditLimit"
+                      :precision="2"
+                      :min="0.01"
+                      :max="999999"
+                      placeholder="请输入正数(最多允许两位小数)"
+                      style="width: 100%;display: inline-block;" />
+                  </a-form-model-item>
+                </a-col>
+                <a-col :span="1"> <span style="display: inline-block; padding: 10px;">元</span></a-col>
+              </a-row>
+              <a-col :span="15">
+                <a-form-model-item label="结算日期(每月)" prop="settleDay" v-if="form.settleType=='MONTH'">
                   <a-select
                   <a-select
                     style="background-color: none;"
                     style="background-color: none;"
                     placeholder="请选择结算日期"
                     placeholder="请选择结算日期"
-                    id="userSyncEdit-roleNames"
+                    id="userSyncEdit-settleDay"
                     allowClear
                     allowClear
-                    v-model="form.roleNames"
+                    v-model="form.settleDay"
                   >
                   >
                     <a-select-option v-for="item in dateList" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
                     <a-select-option v-for="item in dateList" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
                   </a-select>
                   </a-select>
                 </a-form-model-item>
                 </a-form-model-item>
               </a-col>
               </a-col>
-              <!-- </a-row>
-            <a-row :gutter="24"> -->
-              <a-col :span="24">
-                <a-form-model-item label="结算提醒金额" prop="loginName" v-if="form.isEnable==1">
-                  <a-input
-                    id="userEdit-loginName"
-                    v-model.trim="form.loginName"
-                    allowClear
-                    placeholder="请输入结算提醒金额"
-                    suffix="元"/>
-                </a-form-model-item>
-                <a-form-model-item label="结算提醒日期" prop="loginName" v-if="form.isEnable==0">
+              <a-row v-if="form.settleType=='CREDIT'">
+                <a-col :span="15">
+                  <a-form-model-item label="结算提醒金额" prop="creditWarnLimit" >
+                    <a-input-number
+                      id="shelfSet-bindProduct-creditWarnLimit"
+                      v-model="form.creditWarnLimit"
+                      :precision="2"
+                      :min="0.01"
+                      :max="form.creditLimit-0.1"
+                      placeholder="请输入正数(最多允许两位小数)"
+                      style="width: 100%;display: inline-block;" />
+                  </a-form-model-item>
+                </a-col>
+                <a-col :span="1"> <span style="display: inline-block; padding: 10px;">元</span></a-col>
+              </a-row>
+              <a-col :span="15">
+                <a-form-model-item label="结算提醒(每月提醒提前的天数)" prop="warnBeforeDays" v-if="form.settleType=='MONTH'">
                   <a-select
                   <a-select
                     style="background-color: none;"
                     style="background-color: none;"
                     placeholder="请选择结算提醒日期"
                     placeholder="请选择结算提醒日期"
-                    id="userSyncEdit-roleNames"
+                    id="userSyncEdit-warnBeforeDays"
                     allowClear
                     allowClear
-                    v-model="form.roleNames"
+                    v-model="form.warnBeforeDays"
                   >
                   >
-                    <a-select-option v-for="item in dateList" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
+                    <a-select-option v-for="item in dateTXList" :key="item.id" :value="item.id">{{ item.name }}</a-select-option>
                   </a-select>
                   </a-select>
                 </a-form-model-item>
                 </a-form-model-item>
               </a-col>
               </a-col>
-              <a-col :span="24">
-                <a-form-model-item :label="form.isEnable==1?'超过授信额度':'超期未结算'" prop="loginName" v-if="form.isEnable==1">
-                  <a-checkbox @change="onChange">
+              <a-col :span="15" v-if="form.settleType">
+                <a-form-model-item :label="form.settleType=='CREDIT'?'超过授信额度':'超期未结算'">
+                  <a-checkbox @change="onChange" >
                     限制汽车修理厂无法使用数字货架
                     限制汽车修理厂无法使用数字货架
                   </a-checkbox>
                   </a-checkbox>
-                  <!-- <a-radio-group v-model="value" @change="onChange">
-                    <a-radio :value="1"></a-radio>
-                  </a-radio-group> -->
                 </a-form-model-item>
                 </a-form-model-item>
               </a-col>
               </a-col>
-              <!-- </a-row>
-            <a-row :gutter="24"> -->
-              <a-col :span="24">
-                <a-form-model-item label="是否需要缴纳保证金" prop="loginFlag" v-if="form.isEnable==1">
-                  <a-radio-group name="radioGroup" v-model="form.loginFlag">
+              <a-col :span="15" v-if="pageInfo&&!pageInfo.settleType &&form.settleType ">
+                <a-form-model-item label="是否需要缴纳保证金" prop="bondFlag" >
+                  <a-radio-group name="radioGroup" v-model="form.bondFlag" @change="changeRadio">
                     <a-radio :value="1">是</a-radio>
                     <a-radio :value="1">是</a-radio>
                     <a-radio :value="0">否</a-radio>
                     <a-radio :value="0">否</a-radio>
                   </a-radio-group>
                   </a-radio-group>
                 </a-form-model-item>
                 </a-form-model-item>
               </a-col>
               </a-col>
-              <!-- 状态 -->
-              <a-col :span="24">
-                <a-form-model-item label="保证金缴纳金额" prop="loginName" v-if="form.isEnable==1">
-                  <a-input
-                    id="userEdit-loginName"
-                    v-model.trim="form.loginName"
-                    allowClear
-                    placeholder="请输入保证金缴纳金额"
-                    suffix="元"/>
-                </a-form-model-item>
-              </a-col>
-              <!-- </a-row>
-            <a-row :gutter="24"> -->
+              <a-row v-if="form.settleType&&form.bondFlag&&isEdit">
+                <a-col :span="15">
+                  <a-form-model-item label="保证金缴纳金额" prop="bondAmount" >
+                    <a-input-number
+                      id="shelfSet-bindProduct-bondAmount"
+                      v-model="form.bondAmount"
+                      :precision="2"
+                      :min="0.01"
+                      :max="999999"
+                      placeholder="请输入正数(最多允许两位小数)"
+                      style="width: 100%;display: inline-block;" />
+                  </a-form-model-item>
+                </a-col>
+                <a-col :span="1"> <span style="display: inline-block; padding: 10px;">元</span></a-col>
+              </a-row>
             </a-row>
             </a-row>
             <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
             <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
-              <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '8px' }">保存</a-button>
-              <a-button :style="{ marginLeft: '8px' }" @click="handleBack">取消</a-button>
+              <a-button type="primary" @click="handleSubmit" >保存</a-button>
             </a-form-model-item>
             </a-form-model-item>
           </a-form-model>
           </a-form-model>
         </div>
         </div>
-
       </a-card>
       </a-card>
       <!-- 修改结算方式弹窗 -->
       <!-- 修改结算方式弹窗 -->
-      <settlementModifyModal :visible="openModal" :settlementType="settlementType" @close="openModal=false"></settlementModifyModal>
+      <settlementModifyModal :visible="openModal" :settleInfo="settleInfo" :shelfInfo="pageInfo" @close="close"></settlementModifyModal>
     </a-spin>
     </a-spin>
   </div>
   </div>
 </template>
 </template>
 
 
 <script>
 <script>
 import { STable, VSelect } from '@/components'
 import { STable, VSelect } from '@/components'
-import { shelfDetail } from '@/api/shelf.js'
+import { shelfDetail, shelfSettleRuleSave, settleRuleDetail } from '@/api/shelf.js'
 import { bondRecordList } from '@/api/boundRecord.js'
 import { bondRecordList } from '@/api/boundRecord.js'
 import settlementModifyModal from './settlementModifyModal.vue'
 import settlementModifyModal from './settlementModifyModal.vue'
+import { toThousands } from '@/libs/tools.js'
 export default {
 export default {
   components: { STable, settlementModifyModal, VSelect },
   components: { STable, settlementModifyModal, VSelect },
   data () {
   data () {
@@ -167,53 +185,54 @@ export default {
       isEdit: false, // 货位号是否为编辑
       isEdit: false, // 货位号是否为编辑
       openModal: false, // 货位模板弹窗初始状态
       openModal: false, // 货位模板弹窗初始状态
       formItemLayout: {
       formItemLayout: {
-        labelCol: { span: 8 },
-        wrapperCol: { span: 10 }
+        labelCol: { span: 13 },
+        wrapperCol: { span: 11 }
       },
       },
-      value: '',
+      settleInfo: null, // 结算详情
+      // shelfInfo: null, // 数字货架详情
       settlementType: '', // 结算方式
       settlementType: '', // 结算方式
       pageInfo: null,
       pageInfo: null,
       form: {
       form: {
-        isEnable: '',
-        name: '',
-        phone: '',
-        loginName: '',
-        sex: undefined,
-        loginFlag: '', // 状态
-        roleNames: undefined, // 角色
-        productMsg: '', // 图片
-        remarks: ''
+        settleType: '', // 结算方式
+        creditLimit: '', // 授信额度
+        creditWarnLimit: '', // 结算提醒金额
+        settleDay: '', // 每月结算日
+        warnBeforeDays: '', // 结算提醒提前天数
+        limitFlag: '', // 是否限制使用
+        bondFlag: '', // 是否缴纳保证金
+        bondAmount: '' // 保证金金额
       },
       },
       dateList: [{ id: 1, name: 1 }, { id: 2, name: 2 }, { id: 3, name: 3 }, { id: 4, name: 4 }, { id: 5, name: 5 }, { id: 6, name: 6 }, { id: 7, name: 7 }, { id: 8, name: 8 }, { id: 9, name: 9 }, { id: 10, name: 10 }, { id: 11, name: 11 }, { id: 12, name: 12 }, { id: 13, name: 13 }, { id: 14, name: 14 }, { id: 15, name: 15 }, { id: 16, name: 16 }, { id: 17, name: 17 }, { id: 18, name: 18 }, { id: 19, name: 19 }, { id: 20, name: 20 }, { id: 21, name: 21 }, { id: 22, name: 22 }, { id: 23, name: 23 }, { id: 24, name: 24 }, { id: 25, name: 25 }],
       dateList: [{ id: 1, name: 1 }, { id: 2, name: 2 }, { id: 3, name: 3 }, { id: 4, name: 4 }, { id: 5, name: 5 }, { id: 6, name: 6 }, { id: 7, name: 7 }, { id: 8, name: 8 }, { id: 9, name: 9 }, { id: 10, name: 10 }, { id: 11, name: 11 }, { id: 12, name: 12 }, { id: 13, name: 13 }, { id: 14, name: 14 }, { id: 15, name: 15 }, { id: 16, name: 16 }, { id: 17, name: 17 }, { id: 18, name: 18 }, { id: 19, name: 19 }, { id: 20, name: 20 }, { id: 21, name: 21 }, { id: 22, name: 22 }, { id: 23, name: 23 }, { id: 24, name: 24 }, { id: 25, name: 25 }],
+      dateTXList: [{ id: 1, name: 1 }, { id: 2, name: 2 }, { id: 3, name: 3 }, { id: 4, name: 4 }, { id: 5, name: 5 }, { id: 6, name: 6 }, { id: 7, name: 7 }, { id: 8, name: 8 }, { id: 9, name: 9 }, { id: 10, name: 10 }],
       rules: {
       rules: {
-        name: [ { required: true, message: '请输入授信额度', trigger: 'blur' }, { pattern: '/^0\.([1-9]|\d[1-9])$|^[1-9]\d{0,8}\.\d{0,2}$|^[1-9]\d{0,8}$/', message: '授信额度最多2位小数且最大为999999' } ],
-        phone: [ { required: true, message: '请输入手机号码', trigger: 'blur' }, { pattern: /^[1][0-9]{10}$/, message: '请输入正确的手机号码!' } ],
-        loginName: [ { required: true, message: '请输入用户账号', trigger: 'blur' }, { pattern: /^[0-9A-Za-z]+$/, message: '用户账号为数字或大小写字母组成!' } ],
-        isEnable: [ { required: true, message: '请选择结算方式', trigger: 'change' } ],
-        loginFlag: [ { required: true, message: '请选择结算日期', trigger: 'change' } ],
-        roleNames: [ { required: true, message: '请选择结算提醒日期', trigger: 'change' } ]
+        settleType: [ { required: true, message: '请选择结算方式', trigger: 'change' } ],
+        creditLimit: [ { required: true, message: '请输入授信额度', trigger: 'blur' } ],
+        creditWarnLimit: [{ required: true, message: '请输入结算提醒金额', trigger: 'blur' }],
+        settleDay: [ { required: true, message: '请选择每月结算日期', trigger: 'change' } ],
+        warnBeforeDays: [ { required: true, message: '请选择每月结算提醒提前的日期', trigger: 'change' } ],
+        bondFlag: [ { required: true, message: '请选择是否缴纳保证金', trigger: 'change' }],
+        bondAmount: [ { required: true, message: '请输入保证金金额', trigger: 'blur' }]
       },
       },
       // 表头
       // 表头
       columns: [
       columns: [
-        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '创建时间', dataIndex: 'createDate', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '保证金金额', dataIndex: 'bondAmount', width: '11%', align: 'center', scopedSlots: { customRender: 'name' } },
-        { title: '状态', dataIndex: 'state', width: '18%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '支付时间', width: '9%', align: 'center', dataIndex: 'payPersonDate' }
+        { title: '序号', dataIndex: 'no', width: '10%', align: 'center', customRender: function (text, record, index) { return index + 1 || '--' } },
+        { title: '创建时间', dataIndex: 'createDate', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '保证金金额', dataIndex: 'bondAmount', width: '30%', align: 'right', customRender: function (text) { return toThousands(text, 2) || '--' } },
+        { title: '状态', dataIndex: 'stateDictValue', width: '20%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '支付时间', width: '20%', align: 'center', dataIndex: 'payDate' }
       ],
       ],
       // 加载数据方法 必须为 Promise 对象
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
       loadData: parameter => {
         this.spinning = true
         this.spinning = true
-        return bondRecordList(Object.assign({})).then(res => {
+        return bondRecordList(Object.assign({ shelfSn: this.$route.params.shelfSn })).then(res => {
           let data
           let data
           if (res.status == 200) {
           if (res.status == 200) {
             data = res.data
             data = res.data
-            // const no = (data.pageNo - 1) * data.pageSize
-            // for (let i = 0; i < data.list.length; i++) {
-            //   const _item = data.list[i]
-            //   _item.no = no + i + 1
-            //   _item.loginFlag = _item.loginFlag + '' === '1'
-            // }
+            const no = (data.pageNo - 1) * data.pageSize
+            for (let i = 0; i < data.length; i++) {
+              const _item = data[i]
+              _item.no = no + i + 1
+            }
           }
           }
           this.spinning = false
           this.spinning = false
           return data
           return data
@@ -223,8 +242,36 @@ export default {
   },
   },
   methods: {
   methods: {
     handleBack () {
     handleBack () {
-      this.$router.go(-1)
+      this.$refs.ruleForm.resetFields()
+      this.form = {}
+      this.$router.push({ path: '/numsGoodsShelves/goodsShelvesAdministration/list' })
+      // this.$router.go(-1)
+    },
+    // 查看图片
+    inited (viewer) {
+      if (viewer) {
+        const imageUrl = []
+        viewer.map(item => {
+          imageUrl.push(item.imageUrl)
+        })
+        this.$viewerApi({
+          images: imageUrl
+        })
+      }
+    },
+    onChange (e) {
+      console.log(e.target.checked)
+      if (e.target.checked) {
+        this.form.limitFlag = 1
+      } else {
+        this.form.limitFlag = 0
+      }
+    },
+    //
+    changeRadio (e) {
+      this.isEdit = e.target.value
     },
     },
+    // 数字货架详情
     getShelfDetail () {
     getShelfDetail () {
       this.spinning = true
       this.spinning = true
       shelfDetail({
       shelfDetail({
@@ -232,57 +279,73 @@ export default {
       }).then(res => {
       }).then(res => {
         if (res.status == 200) {
         if (res.status == 200) {
           this.pageInfo = Object.assign({}, res.data)
           this.pageInfo = Object.assign({}, res.data)
+          if (this.pageInfo.ownerType == 1 && this.pageInfo.images) {
+            this.pageInfo.images = this.pageInfo.images.split(',')
+          }
+          this.settlementType = this.pageInfo.settleType
+          console.log(this.form, 'this.form')
+          this.$nextTick(() => {
+            this.getSettleDetail()
+          })
         } else {
         } else {
           this.pageInfo = null
           this.pageInfo = null
         }
         }
         this.spinning = false
         this.spinning = false
       })
       })
     },
     },
-    handleExport () {
-      console.log('=========导入货位')
+    // 结算详情
+    getSettleDetail () {
+      if (this.settlementType) {
+        console.log(this.settlementType, 'this.settlementType')
+        settleRuleDetail({ shelfSn: this.pageInfo.shelfSn, settleType: this.settlementType }).then(res => {
+          if (res.status == 200) {
+            this.form = Object.assign({}, res.data)
+            this.settleInfo = res.data
+          } else {
+            this.form = {}
+          }
+        })
+      }
+    },
+    close (type) {
+      console.log(type, 'type')
+      this.settlementType = type
+      this.openModal = false
+      this.getSettleDetail()
+      console.log(this.settlementType, 'this.settlementType')
     },
     },
     handleEdit (row) {
     handleEdit (row) {
       this.isEdit = true
       this.isEdit = true
     },
     },
-    handleSave (row, type) {
-      if (type == 0) {
-        console.log('====保存')
-      } else {
-        console.log('=====取消')
-      }
-      this.$nextTick(() => {
-        this.isEdit = false
-        this.$refs.table.refresh()
-      })
-    },
-    // 修改结算方式
-    changeJStype (val, option) {
-      console.log(val, option, 'val')
-    },
-    handleModify () {
-      this.settlementType = this.form.isEnable
+    // 修改
+    handleModify (shelfVal, settleVal) {
+      console.log(shelfVal, settleVal, '----------修改')
+      this.pageInfo = shelfVal
+      this.settleInfo = settleVal
       this.openModal = true
       this.openModal = true
       console.log('----------修改')
       console.log('----------修改')
     },
     },
-    onChange (e) {
-      console.log(e.target.checked)
-    },
     handleSubmit () {
     handleSubmit () {
       const _this = this
       const _this = this
       this.$refs.ruleForm.validate(valid => {
       this.$refs.ruleForm.validate(valid => {
         if (valid) {
         if (valid) {
           const params = JSON.parse(JSON.stringify(_this.form))
           const params = JSON.parse(JSON.stringify(_this.form))
-          params.roleNames = _this.form.roleNames.join(',')
-          params.id = _this.nowData && _this.nowData.id ? _this.nowData.id : null
-          params.ownerOrgFlag = _this.nowData && _this.nowData.ownerOrgFlag
+          if (params.limitFlag == '') {
+            params.limitFlag = 0
+          }
+          if (this.pageInfo) {
+            params.shelfSn = this.pageInfo.shelfSn
+            params.storeSn = this.pageInfo.storeSn
+            params.dealerSn = this.pageInfo.dealerSn
+          }
           _this.spinning = true
           _this.spinning = true
-          saveUserPower(params).then(res => {
+          shelfSettleRuleSave(params).then(res => {
             if (res.status == 200) {
             if (res.status == 200) {
               _this.$message.success(res.message)
               _this.$message.success(res.message)
-              _this.$emit('refresh')
               setTimeout(function () {
               setTimeout(function () {
                 _this.isshow = false
                 _this.isshow = false
                 _this.spinning = false
                 _this.spinning = false
+                _this.handleBack()
               }, 300)
               }, 300)
             } else {
             } else {
               _this.spinning = false
               _this.spinning = false
@@ -296,7 +359,6 @@ export default {
     },
     },
     pageInit () {
     pageInit () {
       this.getShelfDetail()
       this.getShelfDetail()
-      this.$refs.table.refresh()
     }
     }
   },
   },
   mounted () {
   mounted () {
@@ -311,7 +373,8 @@ export default {
     }
     }
   },
   },
   beforeRouteEnter (to, from, next) {
   beforeRouteEnter (to, from, next) {
-    next(vm => {})
+    next(vm => {
+    })
   }
   }
 }
 }
 </script>
 </script>

+ 159 - 0
src/views/numsGoodsShelves/partsDealerManagement/list.vue

@@ -0,0 +1,159 @@
+<template>
+  <a-card size="small" :bordered="false">
+    <a-spin :spinning="spinning" tip="Loading...">
+      <div ref="tableSearch" 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="配件经销商">
+                <dealerList ref="dealerList" @change="dealerChange"></dealerList>
+              </a-form-item>
+            </a-col>
+            <a-col :md="6" :sm="24">
+              <a-form-item label="平台商户号">
+                <a-input id="userList-name" allowClear v-model.trim="queryParam.merchantNo" placeholder="请输入货架名称"/>
+              </a-form-item>
+            </a-col>
+            <a-col :md="4" :sm="24" style="margin-bottom: 10px;">
+              <a-button type="primary" @click="$refs.table.refresh(true)" id="userList-search">查询</a-button>
+              <a-button type="" @click="reset" id="userList-reset" style="margin-left: 10px;">重置</a-button>
+            </a-col>
+          </a-row>
+        </a-form>
+      </div>
+      <s-table
+        class="sTable fixPagination"
+        ref="table"
+        :style="{ height: tableHeight+84.5+'px', wordBreak: 'break-all' }"
+        size="small"
+        rowKey="id"
+        :columns="columns"
+        :data="loadData"
+        :scroll="{ y: tableHeight }"
+        :defaultLoadData="false"
+        bordered>
+        <template slot="action" slot-scope="text, record" >
+          <a-button size="small" type="link" class="button-info" @click="handleEdit(record)">设置结算账户</a-button>
+          <!-- <span style="display:inline-block;padding-left:7px">--</span> -->
+        </template>
+      </s-table>
+    </a-spin>
+    <!--新增/编辑数字货架 -->
+    <setSHModal :visible="showModal" @refresh="$refs.table.refresh(true)" :nowData="itemData" @close="showModal=false"></setSHModal>
+  </a-card>
+</template>
+
+<script>
+import { STable, VSelect } from '@/components'
+import setSHModal from './setSHModal.vue'
+import { merchantAccountByPage } from '@/api/merchantAccount.js'
+import dealerList from '@/views/common/dealerList.vue'
+import storeList from '@/views/common/storeList.vue'
+export default {
+  name: 'UserList',
+  components: { STable, VSelect, dealerList, storeList, setSHModal },
+  data () {
+    return {
+      spinning: false,
+      tableHeight: 0,
+      // 查询参数
+      queryParam: {
+        merchantNo: '',
+        bondRecordState: undefined
+      },
+      showModal: false,
+      itemData: null, // 编辑行数据
+      openStatusModal: false, // 货架状态弹窗初始状态
+      // 表头
+      columns: [
+        { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
+        { title: '配件经销商(商户名称)', dataIndex: 'dealerName', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '联系人', dataIndex: 'contact', width: '20%', align: 'left', customRender: function (text) { return text || '--' } },
+        { title: '联系电话', dataIndex: 'dealerTelephone', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '合作状态', dataIndex: 'cooperateFlagDictValue', width: '10%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '平台商户号', dataIndex: 'merchantNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '操作', width: '10%', align: 'left', scopedSlots: { customRender: 'action' } }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        this.spinning = true
+        return merchantAccountByPage(Object.assign(parameter, this.queryParam)).then(res => {
+          let data
+          if (res.status == 200) {
+            data = res.data
+            const no = (data.pageNo - 1) * data.pageSize
+            for (let i = 0; i < data.list.length; i++) {
+              const _item = data.list[i]
+              _item.no = no + i + 1
+            }
+          }
+          this.spinning = false
+          return data
+        })
+      }
+    }
+  },
+  methods: {
+    // 经销商 change
+    dealerChange (obj) {
+      this.queryParam.dealerSn = obj.key || undefined
+    },
+    // 汽车修理厂 change
+    storeChange (obj) {
+      this.queryParam.storeSn = obj.key || undefined
+    },
+    // 新增/编辑
+    handleEdit (row) {
+      if (row) {
+        this.itemData = row
+      } else {
+        this.itemData = null
+      }
+      this.showModal = true
+      console.log(this.itemData, 'this.itemData')
+    },
+    // 重置
+    reset () {
+      this.queryParam = {
+        shelfName: '',
+        bondRecordState: undefined
+      }
+      this.$refs.dealerList.resetForm()
+      this.$refs.table.refresh(true)
+    },
+    pageInit () {
+      const _this = this
+      this.$nextTick(() => { // 页面渲染完成后的回调
+        _this.setTableH()
+      })
+    },
+    setTableH () {
+      const tableSearchH = this.$refs.tableSearch.offsetHeight
+      this.tableHeight = window.innerHeight - tableSearchH - 215
+    }
+  },
+  watch: {
+    '$store.state.app.winHeight' (newValue, oldValue) { //  窗口变更时,需同时更改表格高度
+      this.setTableH()
+    }
+  },
+  mounted () {
+    if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.pageInit()
+      this.reset()
+    }
+  },
+  activated () {
+    // 如果是新页签打开,则重置当前页面
+    if (this.$store.state.app.isNewTab) {
+      this.pageInit()
+      this.reset()
+    }
+  }
+}
+</script>
+<style lang="less">
+  .ant-statistic-content-value-decimal{
+    font-size: 12px;
+  }
+</style>

+ 170 - 0
src/views/numsGoodsShelves/partsDealerManagement/setSHModal.vue

@@ -0,0 +1,170 @@
+<template>
+  <div>
+    <a-modal
+      centered
+      wrapClassName="addGoodsShelve-modal"
+      :footer="null"
+      :maskClosable="false"
+      title="设置结算账户"
+      v-model="isshow"
+      @cancle="close"
+      :width="450">
+      <a-spin :spinning="spinning" tip="Loading...">
+        <a-alert :message="message" type="info" />
+        <a-form-model
+          id="userEdit-form"
+          ref="ruleForm"
+          :model="form"
+          :rules="rules"
+          :label-col="formItemLayout.labelCol"
+          :wrapper-col="formItemLayout.wrapperCol"
+        >
+          <a-row :gutter="24">
+            <a-col :span="24">
+              <a-form-model-item label="配件经销商" prop="shelfSn" >
+                <span>{{ form.dealerEntity?form.dealerEntity.dealerName:'--' }}</span>
+              </a-form-model-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-model-item label="平台商户号" prop="merchantNo" >
+                <a-input id="userList-name" allowClear v-model.trim="form.merchantNo" placeholder="请输入平台商户号"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-model-item label="结算账户名" prop="merchantNo">
+                <a-input id="userList-name" allowClear v-model.trim="form.merchantNo" placeholder="请输入结算账户名"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-model-item label="结算账户号" prop="merchantNo">
+                <a-input id="userList-name" allowClear v-model.trim="form.merchantNo" placeholder="请输入结算账户号"/>
+              </a-form-model-item>
+            </a-col>
+            <a-col :span="24">
+              <a-form-model-item label="开户银行" prop="merchantNo">
+                <a-input id="userList-name" allowClear v-model.trim="form.merchantNo" placeholder="请输入开户银行"/>
+              </a-form-model-item>
+            </a-col>
+          </a-row>
+          <a-form-model-item :label-col="{span: 0}" :wrapper-col="{span: 24}" style="text-align: center;">
+            <a-button type="primary" @click="handleSubmit()" :style="{ marginRight: '8px' }">保存</a-button>
+            <a-button :style="{ marginLeft: '8px' }" @click="close">取消</a-button>
+          </a-form-model-item>
+        </a-form-model>
+      </a-spin>
+    </a-modal>
+  </div>
+</template>
+
+<script>
+import { saveMerchantAccount, merchantAccountDetail } from '@/api/merchantAccount.js'
+export default {
+  name: 'AddGoodsShelve',
+  props: {
+    visible: {
+      type: Boolean,
+      default: false
+    },
+    nowData: {
+      type: Object,
+      default: function () {
+        return null
+      }
+    }
+  },
+
+  data () {
+    return {
+      spinning: false,
+      isshow: this.visible,
+      message: '以下结算账户信息需要与进件时填写的资料保持一直否则将无法体现成功',
+      pageInfo: null,
+      formItemLayout: {
+        labelCol: { span: 6 },
+        wrapperCol: { span: 16 }
+      },
+      form: {
+        dealerEntity: {
+          dealerName: ''
+        },
+        merchantNo: '' // 保证金金额
+      },
+      rules: {
+        merchantNo: [ { required: true, message: '请输入保证金金额', trigger: 'blur' } ]
+      }
+    }
+  },
+  methods: {
+    close (e) {
+      this.$refs.ruleForm.resetFields()
+      this.$emit('close')
+    },
+    // 详情
+    getMerchantAccountDetail () {
+      this.spinning = true
+      merchantAccountDetail({ merchantSn: this.nowData.merchantSn, merchantType: this.nowData.merchantType }).then(res => {
+        if (res.status == 200) {
+          this.form = Object.assign({}, res.data)
+        } else {
+        }
+        this.spinning = false
+      })
+    },
+    // 保存提交
+    handleSubmit () {
+      const _this = this
+      this.$refs.ruleForm.validate(valid => {
+        if (valid) {
+          const params = JSON.parse(JSON.stringify(_this.form))
+          params.id = _this.nowData && _this.nowData.id ? _this.nowData.id : null
+          _this.spinning = true
+          saveMerchantAccount(params).then(res => {
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$emit('refresh')
+              setTimeout(function () {
+                _this.isshow = false
+                _this.spinning = false
+              }, 300)
+            } else {
+              _this.spinning = false
+            }
+          })
+        } else {
+          console.log('error submit!!')
+          return false
+        }
+      })
+    }
+  },
+  watch: {
+    visible (newValue, oldValue) {
+      this.isshow = newValue
+    },
+    isshow (newValue, oldValue) {
+      if (!newValue) {
+        this.form = {}
+        this.close()
+        this.$refs.ruleForm.resetFields()
+      }
+    },
+    nowData: {
+      handler (newValue, oldValue) {
+        if (this.isshow && newValue) {
+          if (this.nowData.id) { //  编辑
+            this.getMerchantAccountDetail()
+          }
+        }
+      },
+      deep: true
+    }
+  }
+}
+</script>
+<style lang="less">
+.addGoodsShelve-modal{
+  .ant-select-disabled .ant-select-selection{
+    background-color: none !important;
+  }
+}
+</style>

+ 2 - 1
vue.config.js

@@ -108,7 +108,8 @@ const vueConfig = {
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     // If you want to turn on the proxy, please remove the mockjs /src/main.jsL11
     proxy: {
     proxy: {
       '/api': {
       '/api': {
-        target: ' http://192.168.16.107:7300/mock/61aeb88e4b9f94168035f9e0/xprh-admin',
+        // target: ' http://192.168.16.107:7300/mock/61aeb88e4b9f94168035f9e0/xprh-admin',
+        target: 'http://192.168.16.151:8701//xprh-admin',
         // target: 'https://t.qpls.360arrow.com/qpls-md', //  Á·Ï°
         // target: 'https://t.qpls.360arrow.com/qpls-md', //  Á·Ï°
         // target: 'http://p.iscm.360arrow.com/qpls-md', //  Ô¤·¢²¼
         // target: 'http://p.iscm.360arrow.com/qpls-md', //  Ô¤·¢²¼
         // target: 'http://qpls-md.360arrow.com/qpls-md', //  Éú²ú
         // target: 'http://qpls-md.360arrow.com/qpls-md', //  Éú²ú