Просмотр исходного кода

Signed-off-by: 1004749546@qq.com <1004749546@qq.com>
增加 修改

1004749546@qq.com 4 лет назад
Родитель
Сommit
de09fef542

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

@@ -186,6 +186,26 @@ export const asyncRouterMap = [{
         // permission: 'M_tenants_list'
       }
     },
+    {
+	  path: '/equipmentManage/boxSetting',
+	  name: 'boxSetting',
+	  component: () => import(/* webpackChunkName: "tenants" */ '@/views/equipmentManage/boxSetting/boxSetting.vue'),
+	  meta: {
+	    title: '箱体类型设置',
+	    icon: 'profile'
+	    // permission: 'M_tenants_list'
+	  }
+    },
+    {
+	  path: '/equipmentManage/exchangeSetting',
+	  name: 'exchangeSetting',
+	  component: () => import(/* webpackChunkName: "tenants" */ '@/views/equipmentManage/exchangeSetting/ExchangeSetting.vue'),
+	  meta: {
+	    title: '兑换规则设置',
+	    icon: 'profile'
+	    // permission: 'M_tenants_list'
+	  }
+    },
     {
       path: '/equipmentManage/openTimeSetting',
       name: 'openTimeSetting',

+ 16 - 1
src/utils/util.js

@@ -70,4 +70,19 @@ export function oneOf (value, validList) {
     }
   }
   return false
-}
+}
+// 数字校验 val:文本框值 num:保留位数 max:最大值
+export const numberToFixed = function (val, num, max) {
+  const maxNums = max || 999999
+  let _value = val
+  _value = _value.replace(/[^\d.]/g, '')// 清楚数字和.以外的字数
+  _value = _value.replace(/^\./g, '')
+  _value = _value.replace(/\.{2,}/g, '')// 保留第一个,清楚多余的
+  if (num == 1)_value = _value.replace(/^(\-)*(\d+)\.(\d).*$/, '$1$2.$3')
+  else if (num == 3)_value = _value.replace(/^(\-)*(\d+)\.(\d\d\d).*$/, '$1$2.$3')
+  else if (num == 4)_value = _value.replace(/^(\-)*(\d+)\.(\d\d\d\d).*$/, '$1$2.$3')
+  else if (num == 5)_value = _value.replace(/^(\-)*(\d+)\.(\d\d\d\d\d).*$/, '$1$2.$3')
+  else if (num == 0)_value = _value.indexOf('.') >= 0 ? _value.split('.')[0] : _value
+  else _value = _value.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3')
+  return Number(_value > maxNums ? maxNums : _value)
+}

+ 295 - 0
src/views/equipmentManage/boxSetting/AddBoxModal.vue

@@ -0,0 +1,295 @@
+<template>
+  <div>
+    <a-modal
+      class="modalBox"
+      :title="titleText"
+      v-model="isshow"
+      :footer="null"
+      @cancle="cancel"
+      :width="800"
+      :centered="true">
+      <a-form :form="form" @submit="handleSubmit">
+        <!-- 箱体类型名称 -->
+        <a-form-item label="箱体类型" :label-col="{ span: 5 }" :wrapper-col="{ span: 16 }">
+          <a-input
+            placeholder="请输入箱体类型名称(最多30个字符)"
+            allowClear
+            :maxLength="30"
+            id="roleModal-name"
+            v-decorator="['formData.name', {
+              initialValue: formData.name,getValueFromEvent: $filterEmpty,
+              rules: [{ required: true, message: '请输入箱体类型名称(最多30个字符)!' }] }]" />
+        </a-form-item>
+        <!-- 内置箱体数量 -->
+        <a-form-item
+          label="内置箱体数量"
+          :label-col="{ span: 5 }"
+          :wrapper-col="{ span: 16 }"
+        >
+          <a-select
+            allowClear
+            @change="handleNumChange"
+            placeholder="请选择"
+            v-decorator="['formData.num', {
+              initialValue: formData.num,
+              rules: [{ required: true, message: '请选择箱体类型!' }] }]">
+            <a-select-option v-for="item in numList" :value="item" :key="item">
+              {{ item }}
+            </a-select-option>
+          </a-select>
+        </a-form-item>
+        <!-- 箱体限投 -->
+        <a-row
+          type="flex"
+          align="middle"
+          v-for="(k, index) in keys"
+          :key="k">
+          <a-col span="12">
+            <!-- 投放开始时间 -->
+            <a-form-item
+              :label=" '内置'+(index+1)+'号箱限投(kg)'"
+              :required="true"
+              :label-col=" { span: 10 }"
+              :wrapper-col=" { span: 14 }"
+            >
+              <a-input
+                type="number"
+                placeholder="请输入数字(最大1000)"
+                v-decorator="[
+                  `formData.settings[${k}].limitNum`,
+                  {
+                    validateTrigger: ['change', 'blur'],
+                    rules: [
+                      {
+                        required: true, message: '请输入限投数量(最大1000)!'
+                      },
+                      {
+                        validator: limitNumChange
+                      },
+                    ],
+                  },
+                ]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-form-item ><span class="linenums">至</span></a-form-item>
+          <a-col span="9">
+            <!-- 请选择分类 -->
+            <a-form-item
+              :label="''"
+              :required="false"
+              :wrapper-col="{ span: 18 }">
+              <v-select
+                ref="orderStatus"
+                id="addBoxModal-status"
+                code="SETTLE_STATUS_ALL"
+                placeholder="请选择分类"
+                allowClear
+                v-decorator="[
+                  `formData.settings[${k}].type`,
+                  {
+                    validateTrigger: ['change', 'blur'],
+                    rules: [
+                      {
+                        required: true, message: '请选择分类!'
+                      },
+                    ],
+                  },
+                ]">
+              </v-select>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-form-item :wrapper-col="{ span: 24, offset: 10 }">
+          <a-button type="primary" @click="handleSubmit()" id="roleModal-handleSubmit" :style="{ marginRight: '15px' }">
+            保存
+          </a-button>
+          <a-button :style="{ marginLeft: '15px' }" @click="handleCancel()" id="roleModal-handleCancel">
+            取消
+          </a-button>
+        </a-form-item>
+      </a-form>
+
+    </a-modal>
+  </div>
+</template>
+
+<script>
+import {
+  STable,
+  VSelect
+} from '@/components'
+import {
+  saveRolePower
+} from '@/api/power-role.js'
+import moment from 'moment'
+import numberToFixed from '@/utils/util.js'
+export default {
+  name: 'RoleModal',
+  components: {
+    STable,
+    VSelect
+  },
+  props: {
+    visible: {
+      type: Boolean,
+      default: false
+    },
+    data: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      id: 0,
+      titleText: '新增',
+      isshow: this.visible,
+      formLayout: 'horizontal',
+      form: this.$form.createForm(this, {
+        name: 'AddBoxModal'
+      }),
+	  numList: [2, 4, 5], // 内置箱体数量选择
+      formData: {
+        name: '',
+        num: '',
+        settings: []
+      },
+      keys: []
+    }
+  },
+  methods: {
+    numberToFixed,
+    cancel (e) {
+      this.clear()
+      this.$emit('close')
+    },
+    // 校验
+    limitNumChange (rule, value, callback) {
+	  console.log('value', value, rule)
+	  const times = this.form.getFieldValue('times')
+	  if ((value <= 0 || value > 1000) && value !== '') {
+	    callback(new Error('请输入1到1000以内的数字'))
+	  }
+	  callback()
+    },
+    handleChange (e) {
+      console.log(e, e.target.value, 'eeeeeee')
+	  const value = e.target.value
+	  const ret = this.numberToFixed(value, 2, 1000)
+	  this.$nextTick(() => {
+	    this.formData.settings[num][key] = Number(ret)
+	  })
+	  // this.value = this.numberToFixed(value, 2, this.max)
+	  // this.$emit('change', this.value)
+    },
+    // 内置箱体选择修改
+    handleNumChange (v) {
+      console.log(v, 'vvvvvvvvvv')
+	  const arr = []
+	  const setting = []
+	  for (let x = 0; x < v; x++) {
+		  arr.push(x)
+		  const p = {
+			  limitNum: '',
+			  type: ''
+		  }
+		  setting.push(p)
+	  }
+	  this.formData.settings = setting
+	  this.keys = arr
+	  console.log(this.keys, 'this.keys')
+    },
+    // 小数点后两位
+    //  numberToFixed (key, index) {
+    //    console.log(index, key, 'eeeeeeeee')
+	  // const val = this.form.getFieldValue('settings')
+	  // console.log(val, 'val')
+	  // const ret = numberToFixed(val, 2, 1000)
+	  // this.$nextTick(() => {
+    //      this.formData.settings[num][key] = Number(ret)
+	  // })
+    //  },
+    // 保存提交
+    handleSubmit () {
+      const _this = this
+      this.form.validateFields((err, values) => {
+		  console.log(values, ' formData.type222222222')
+        if (!err) {
+          saveRolePower(Object.assign(this.formData, values.formData)).then(res => {
+            console.log(res, 'res--save')
+            if (res.status + '' === '200') {
+              this.$message.success(res.message ? res.message : '保存成功')
+              this.$emit('refresh')
+              setTimeout(function () {
+                _this.cancel()
+              }, 300)
+            } else {
+              // this.$message.error(res.message)
+            }
+          })
+        }
+      })
+    },
+    // 取消
+    handleCancel () {
+      this.cancel()
+    },
+    clear () {
+      this.form.resetFields()
+      delete this.formData.id
+      this.formData.name = ''
+      this.formData.isEnable = ''
+      this.formData.remarks = ''
+    }
+
+  },
+  mounted () {},
+  beforeCreate () {
+    this.form = this.$form.createForm(this, {
+      name: 'AddBoxModal'
+    })
+  },
+  watch: {
+    visible (newValue, oldValue) {
+      this.isshow = newValue
+    },
+    isshow (newValue, oldValue) {
+      if (newValue) {
+        this.form.getFieldDecorator('keys', {
+          initialValue: [],
+          preserve: true
+        })
+        this.id = 0
+        if (this.data.id) { // 编辑
+          this.titleText = '编辑'
+          this.formData = Object.assign({}, this.data)
+          delete this.formData.no
+          this.formData.isEnable = Number(this.formData.isEnable)
+          console.log(this.formData, 'this.formData')
+        } else {
+          this.titleText = '新增'
+        }
+      } else {
+        this.cancel()
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+	.modalBox {}
+
+	.ant-modal-footer {
+		display: none;
+	}
+	.dynamic-delete-button {
+		margin-right: 20px;
+	}
+	.linenums{
+		padding: 0 20px;
+	}
+</style>

+ 352 - 0
src/views/equipmentManage/boxSetting/boxSetting.vue

@@ -0,0 +1,352 @@
+<template>
+  <a-card :bordered="false" class="network-table-page-search-wrapper">
+    <div class="network-searchForm">
+      <a-form layout="inline" :form="form" ref="form" v-bind="formItemLayout" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="48">
+          <a-col :span="6">
+            <a-form-item label="箱体类型" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <a-input
+                id="boxSetting-name"
+                allowClear
+                :maxLength="30"
+                v-model="queryParam.name"
+                placeholder="请输入箱体类型" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-button class="handle-btn serach-btn" id="boxSetting-btn-serach" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+            <a-button class="handle-btn" type="" id="boxSetting-btn-reset" @click="handleReset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <div class="table-operator">
+      <a-button type="primary" icon="plus" @click="openModal" id="roleList-openModal">新增</a-button>
+    </div>
+    <s-table
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-icon type="setting" title="设置兑换规则" class="actionBtn icon-orange" @click="openSettingModal(record)" />
+        <a-icon type="edit" title="编辑" class="actionBtn icon-blues" @click="handleEdit(record)" />
+        <a-icon
+          type="delete"
+          title="删除"
+          class="actionBtn icon-red"
+          v-if="!record.isEnable"
+          @click="delect(record)" />
+      </template>
+    </s-table>
+    <!-- 新增/编辑 弹窗 -->
+    <add-box-modal :visible="openBoxModal" :data="itemData" @refresh="refreshTable" @close="openBoxModal = false"></add-box-modal>
+  </a-card>
+</template>
+
+<script>
+import {
+  STable,
+  VSelect
+} from '@/components'
+import AddBoxModal from './AddBoxModal.vue'
+export default {
+  name: 'Equipment',
+  components: {
+    STable,
+    VSelect,
+    AddBoxModal
+  },
+  data () {
+    return {
+      form: this.$form.createForm(this),
+      formItemLayout: {
+        labelCol: {
+          span: 7
+        },
+        wrapperCol: {
+          span: 17
+        }
+      },
+      // 查询参数
+      queryParam: {
+        name: '' // 箱体类型
+      },
+	  openBoxModal: false, // 新增/编辑弹窗
+	  boxId: '', //  箱体id
+      // 表头
+      columns: [{
+        title: '序号',
+        dataIndex: 'no',
+        width: 80,
+        align: 'center'
+      },
+      {
+        title: '创建时间',
+        dataIndex: 'networkName',
+        width: 200,
+        align: 'center'
+      },
+      {
+        title: '箱体类型',
+        dataIndex: 'address',
+        width: 200,
+        align: 'center'
+      },
+      {
+        title: '内置箱体数量(个)',
+        dataIndex: 'equipmentNo',
+        width: 200,
+        align: 'center'
+      },
+      {
+        title: '内置箱体投放限重(kg)',
+        children: [{
+          title: '1号箱',
+          dataIndex: 'oProportion',
+          width: 100,
+          align: 'center'
+        },
+        {
+          title: '2号箱',
+          dataIndex: 'tProportion',
+          width: 100,
+          align: 'center'
+        },
+        {
+		  title: '3号箱',
+		  dataIndex: 'tProportion',
+		  width: 100,
+		  align: 'center',
+		  customRender: (record, index) => {
+			  return record.tProportion || '--'
+		  }
+        },
+        {
+		  title: '4号箱',
+		  dataIndex: 'tProportion',
+		  width: 100,
+		  align: 'center',
+		  customRender: (record, index) => {
+			  return record.tProportion || '--'
+		  }
+        },
+        {
+		  title: '5号箱',
+		  dataIndex: 'tProportion',
+		  width: 100,
+		  align: 'center',
+		  customRender: (record, index) => {
+			  return record.tProportion || '--'
+		  }
+        }
+        ]
+      },
+      {
+        title: '操作',
+        scopedSlots: {
+          customRender: 'action'
+        },
+        width: 240,
+        align: 'center'
+      }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        // return getTenantsList(Object.assign(parameter, this.queryParam)).then(res => {
+        //   if (res.status == 200) {
+        //     const no = (res.data.pageNo - 1) * res.data.pageSize
+        //     for (let i = 0; i < res.data.list.length; i++) {
+        //       const _item = res.data.list[i]
+        //       _item.no = no + i + 1
+        //       _item.status = _item.status + '' === '1'
+        //     }
+        //     return res.data
+        //   }
+        // })
+        return new Promise((resolve) => {
+          const data = [{
+            id: 1,
+            no: 1,
+            networkName: '网点1',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 2,
+            no: 2,
+            networkName: '网点2',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '晚高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 3,
+            no: 3,
+            networkName: '网点3',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 4,
+            no: 4,
+            networkName: '网点4',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 5,
+            no: 5,
+            networkName: '网点5',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 6,
+            no: 6,
+            networkName: '网点6',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 7,
+            no: 7,
+            networkName: '网点7',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          }
+          ]
+          resolve(data)
+        })
+      }
+
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.handleReset()
+    })
+  },
+  methods: {
+    // 重置
+    handleReset () {
+      console.log('重置', this.queryParam)
+      this.form.resetFields()
+      this.$refs.table.refresh(true)
+    },
+    // 新建
+    openModal () {
+      this.openBoxModal = true
+      this.itemData = {}
+    },
+    // 删除
+    delect (row) {
+      const _this = this
+      this.$confirm({
+        title: '警告',
+        centered: true,
+        content: '删除后无法恢复,确认删除?',
+        okText: '确定',
+        cancelText: '取消',
+        onOk () {
+          delectRolePower({
+            id: row.id
+          }).then(res => {
+            console.log(res, 'res1111')
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
+        }
+      })
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+	.network-table-page-search-wrapper {
+		.network-searchForm {
+			.ant-form-inline .ant-form-item {
+				width: 100%;
+			}
+
+			// 搜索框的下间距
+			.ant-form-item {
+				margin-bottom: 10px;
+			}
+
+			.handle-btn {
+				margin-top: 4px;
+			}
+
+			.serach-btn {
+				margin-right: 10px;
+			}
+		}
+
+		.actionBtn {
+			font-size: 20px;
+			padding: 0 10px;
+		}
+
+		// 合计
+		.total {
+			margin: 15px 0 25px;
+			width: 100%;
+			background-color: #e6f7ff;
+			border: 1px solid #91d5ff;
+			padding: 8px 15px 8px 27px;
+			border-radius: 4px;
+
+			.iconImg {
+				color: #1890FF;
+				margin-right: 10px;
+			}
+		}
+	}
+</style>

+ 295 - 0
src/views/equipmentManage/exchangeSetting/AddBoxModal.vue

@@ -0,0 +1,295 @@
+<template>
+  <div>
+    <a-modal
+      class="modalBox"
+      :title="titleText"
+      v-model="isshow"
+      :footer="null"
+      @cancle="cancel"
+      :width="800"
+      :centered="true">
+      <a-form :form="form" @submit="handleSubmit">
+        <!-- 箱体类型名称 -->
+        <a-form-item label="箱体类型" :label-col="{ span: 5 }" :wrapper-col="{ span: 16 }">
+          <a-input
+            placeholder="请输入箱体类型名称(最多30个字符)"
+            allowClear
+            :maxLength="30"
+            id="roleModal-name"
+            v-decorator="['formData.name', {
+              initialValue: formData.name,getValueFromEvent: $filterEmpty,
+              rules: [{ required: true, message: '请输入箱体类型名称(最多30个字符)!' }] }]" />
+        </a-form-item>
+        <!-- 内置箱体数量 -->
+        <a-form-item
+          label="内置箱体数量"
+          :label-col="{ span: 5 }"
+          :wrapper-col="{ span: 16 }"
+        >
+          <a-select
+            allowClear
+            @change="handleNumChange"
+            placeholder="请选择"
+            v-decorator="['formData.num', {
+              initialValue: formData.num,
+              rules: [{ required: true, message: '请选择箱体类型!' }] }]">
+            <a-select-option v-for="item in numList" :value="item" :key="item">
+              {{ item }}
+            </a-select-option>
+          </a-select>
+        </a-form-item>
+        <!-- 箱体限投 -->
+        <a-row
+          type="flex"
+          align="middle"
+          v-for="(k, index) in keys"
+          :key="k">
+          <a-col span="12">
+            <!-- 投放开始时间 -->
+            <a-form-item
+              :label=" '内置'+(index+1)+'号箱限投(kg)'"
+              :required="true"
+              :label-col=" { span: 10 }"
+              :wrapper-col=" { span: 14 }"
+            >
+              <a-input
+                type="number"
+                placeholder="请输入数字(最大1000)"
+                v-decorator="[
+                  `formData.settings[${k}].limitNum`,
+                  {
+                    validateTrigger: ['change', 'blur'],
+                    rules: [
+                      {
+                        required: true, message: '请输入限投数量(最大1000)!'
+                      },
+                      {
+                        validator: limitNumChange
+                      },
+                    ],
+                  },
+                ]"
+              />
+            </a-form-item>
+          </a-col>
+          <a-form-item ><span class="linenums">至</span></a-form-item>
+          <a-col span="9">
+            <!-- 请选择分类 -->
+            <a-form-item
+              :label="''"
+              :required="false"
+              :wrapper-col="{ span: 18 }">
+              <v-select
+                ref="orderStatus"
+                id="addBoxModal-status"
+                code="SETTLE_STATUS_ALL"
+                placeholder="请选择分类"
+                allowClear
+                v-decorator="[
+                  `formData.settings[${k}].type`,
+                  {
+                    validateTrigger: ['change', 'blur'],
+                    rules: [
+                      {
+                        required: true, message: '请选择分类!'
+                      },
+                    ],
+                  },
+                ]">
+              </v-select>
+            </a-form-item>
+          </a-col>
+        </a-row>
+        <a-form-item :wrapper-col="{ span: 24, offset: 10 }">
+          <a-button type="primary" @click="handleSubmit()" id="roleModal-handleSubmit" :style="{ marginRight: '15px' }">
+            保存
+          </a-button>
+          <a-button :style="{ marginLeft: '15px' }" @click="handleCancel()" id="roleModal-handleCancel">
+            取消
+          </a-button>
+        </a-form-item>
+      </a-form>
+
+    </a-modal>
+  </div>
+</template>
+
+<script>
+import {
+  STable,
+  VSelect
+} from '@/components'
+import {
+  saveRolePower
+} from '@/api/power-role.js'
+import moment from 'moment'
+import numberToFixed from '@/utils/util.js'
+export default {
+  name: 'RoleModal',
+  components: {
+    STable,
+    VSelect
+  },
+  props: {
+    visible: {
+      type: Boolean,
+      default: false
+    },
+    data: {
+      type: Object,
+      default: function () {
+        return {}
+      }
+    }
+  },
+  data () {
+    return {
+      id: 0,
+      titleText: '新增',
+      isshow: this.visible,
+      formLayout: 'horizontal',
+      form: this.$form.createForm(this, {
+        name: 'AddBoxModal'
+      }),
+	  numList: [2, 4, 5], // 内置箱体数量选择
+      formData: {
+        name: '',
+        num: '',
+        settings: []
+      },
+      keys: []
+    }
+  },
+  methods: {
+    numberToFixed,
+    cancel (e) {
+      this.clear()
+      this.$emit('close')
+    },
+    // 校验
+    limitNumChange (rule, value, callback) {
+	  console.log('value', value, rule)
+	  const times = this.form.getFieldValue('times')
+	  if ((value <= 0 || value > 1000) && value !== '') {
+	    callback(new Error('请输入1到1000以内的数字'))
+	  }
+	  callback()
+    },
+    handleChange (e) {
+      console.log(e, e.target.value, 'eeeeeee')
+	  const value = e.target.value
+	  const ret = this.numberToFixed(value, 2, 1000)
+	  this.$nextTick(() => {
+	    this.formData.settings[num][key] = Number(ret)
+	  })
+	  // this.value = this.numberToFixed(value, 2, this.max)
+	  // this.$emit('change', this.value)
+    },
+    // 内置箱体选择修改
+    handleNumChange (v) {
+      console.log(v, 'vvvvvvvvvv')
+	  const arr = []
+	  const setting = []
+	  for (let x = 0; x < v; x++) {
+		  arr.push(x)
+		  const p = {
+			  limitNum: '',
+			  type: ''
+		  }
+		  setting.push(p)
+	  }
+	  this.formData.settings = setting
+	  this.keys = arr
+	  console.log(this.keys, 'this.keys')
+    },
+    // 小数点后两位
+    //  numberToFixed (key, index) {
+    //    console.log(index, key, 'eeeeeeeee')
+	  // const val = this.form.getFieldValue('settings')
+	  // console.log(val, 'val')
+	  // const ret = numberToFixed(val, 2, 1000)
+	  // this.$nextTick(() => {
+    //      this.formData.settings[num][key] = Number(ret)
+	  // })
+    //  },
+    // 保存提交
+    handleSubmit () {
+      const _this = this
+      this.form.validateFields((err, values) => {
+		  console.log(values, ' formData.type222222222')
+        if (!err) {
+          saveRolePower(Object.assign(this.formData, values.formData)).then(res => {
+            console.log(res, 'res--save')
+            if (res.status + '' === '200') {
+              this.$message.success(res.message ? res.message : '保存成功')
+              this.$emit('refresh')
+              setTimeout(function () {
+                _this.cancel()
+              }, 300)
+            } else {
+              // this.$message.error(res.message)
+            }
+          })
+        }
+      })
+    },
+    // 取消
+    handleCancel () {
+      this.cancel()
+    },
+    clear () {
+      this.form.resetFields()
+      delete this.formData.id
+      this.formData.name = ''
+      this.formData.isEnable = ''
+      this.formData.remarks = ''
+    }
+
+  },
+  mounted () {},
+  beforeCreate () {
+    this.form = this.$form.createForm(this, {
+      name: 'AddBoxModal'
+    })
+  },
+  watch: {
+    visible (newValue, oldValue) {
+      this.isshow = newValue
+    },
+    isshow (newValue, oldValue) {
+      if (newValue) {
+        this.form.getFieldDecorator('keys', {
+          initialValue: [],
+          preserve: true
+        })
+        this.id = 0
+        if (this.data.id) { // 编辑
+          this.titleText = '编辑'
+          this.formData = Object.assign({}, this.data)
+          delete this.formData.no
+          this.formData.isEnable = Number(this.formData.isEnable)
+          console.log(this.formData, 'this.formData')
+        } else {
+          this.titleText = '新增'
+        }
+      } else {
+        this.cancel()
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+	.modalBox {}
+
+	.ant-modal-footer {
+		display: none;
+	}
+	.dynamic-delete-button {
+		margin-right: 20px;
+	}
+	.linenums{
+		padding: 0 20px;
+	}
+</style>

+ 352 - 0
src/views/equipmentManage/exchangeSetting/ExchangeSetting.vue

@@ -0,0 +1,352 @@
+<template>
+  <a-card :bordered="false" class="network-table-page-search-wrapper">
+    <div class="network-searchForm">
+      <a-form layout="inline" :form="form" ref="form" v-bind="formItemLayout" @keyup.enter.native="$refs.table.refresh(true)">
+        <a-row :gutter="48">
+          <a-col :span="6">
+            <a-form-item label="箱体类型" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
+              <a-input
+                id="boxSetting-name"
+                allowClear
+                :maxLength="30"
+                v-model="queryParam.name"
+                placeholder="请输入箱体类型" />
+            </a-form-item>
+          </a-col>
+          <a-col :span="6">
+            <a-button class="handle-btn serach-btn" id="boxSetting-btn-serach" type="primary" @click="$refs.table.refresh(true)">查询</a-button>
+            <a-button class="handle-btn" type="" id="boxSetting-btn-reset" @click="handleReset">重置</a-button>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <div class="table-operator">
+      <a-button type="primary" icon="plus" @click="openModal" id="roleList-openModal">新增</a-button>
+    </div>
+    <s-table
+      ref="table"
+      size="default"
+      :rowKey="(record) => record.id"
+      :columns="columns"
+      :data="loadData"
+      bordered>
+      <!-- 操作 -->
+      <template slot="action" slot-scope="text, record">
+        <a-icon type="setting" title="设置兑换规则" class="actionBtn icon-orange" @click="openSettingModal(record)" />
+        <a-icon type="edit" title="编辑" class="actionBtn icon-blues" @click="handleEdit(record)" />
+        <a-icon
+          type="delete"
+          title="删除"
+          class="actionBtn icon-red"
+          v-if="!record.isEnable"
+          @click="delect(record)" />
+      </template>
+    </s-table>
+    <!-- 新增/编辑 弹窗 -->
+    <add-box-modal :visible="openBoxModal" :data="itemData" @refresh="refreshTable" @close="openBoxModal = false"></add-box-modal>
+  </a-card>
+</template>
+
+<script>
+import {
+  STable,
+  VSelect
+} from '@/components'
+import AddBoxModal from './AddBoxModal.vue'
+export default {
+  name: 'Equipment',
+  components: {
+    STable,
+    VSelect,
+    AddBoxModal
+  },
+  data () {
+    return {
+      form: this.$form.createForm(this),
+      formItemLayout: {
+        labelCol: {
+          span: 7
+        },
+        wrapperCol: {
+          span: 17
+        }
+      },
+      // 查询参数
+      queryParam: {
+        name: '' // 箱体类型
+      },
+	  openBoxModal: false, // 新增/编辑弹窗
+	  boxId: '', //  箱体id
+      // 表头
+      columns: [{
+        title: '序号',
+        dataIndex: 'no',
+        width: 80,
+        align: 'center'
+      },
+      {
+        title: '创建时间',
+        dataIndex: 'networkName',
+        width: 200,
+        align: 'center'
+      },
+      {
+        title: '箱体类型',
+        dataIndex: 'address',
+        width: 200,
+        align: 'center'
+      },
+      {
+        title: '内置箱体数量(个)',
+        dataIndex: 'equipmentNo',
+        width: 200,
+        align: 'center'
+      },
+      {
+        title: '内置箱体投放限重(kg)',
+        children: [{
+          title: '1号箱',
+          dataIndex: 'oProportion',
+          width: 100,
+          align: 'center'
+        },
+        {
+          title: '2号箱',
+          dataIndex: 'tProportion',
+          width: 100,
+          align: 'center'
+        },
+        {
+		  title: '3号箱',
+		  dataIndex: 'tProportion',
+		  width: 100,
+		  align: 'center',
+		  customRender: (record, index) => {
+			  return record.tProportion || '--'
+		  }
+        },
+        {
+		  title: '4号箱',
+		  dataIndex: 'tProportion',
+		  width: 100,
+		  align: 'center',
+		  customRender: (record, index) => {
+			  return record.tProportion || '--'
+		  }
+        },
+        {
+		  title: '5号箱',
+		  dataIndex: 'tProportion',
+		  width: 100,
+		  align: 'center',
+		  customRender: (record, index) => {
+			  return record.tProportion || '--'
+		  }
+        }
+        ]
+      },
+      {
+        title: '操作',
+        scopedSlots: {
+          customRender: 'action'
+        },
+        width: 240,
+        align: 'center'
+      }
+      ],
+      // 加载数据方法 必须为 Promise 对象
+      loadData: parameter => {
+        // return getTenantsList(Object.assign(parameter, this.queryParam)).then(res => {
+        //   if (res.status == 200) {
+        //     const no = (res.data.pageNo - 1) * res.data.pageSize
+        //     for (let i = 0; i < res.data.list.length; i++) {
+        //       const _item = res.data.list[i]
+        //       _item.no = no + i + 1
+        //       _item.status = _item.status + '' === '1'
+        //     }
+        //     return res.data
+        //   }
+        // })
+        return new Promise((resolve) => {
+          const data = [{
+            id: 1,
+            no: 1,
+            networkName: '网点1',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 2,
+            no: 2,
+            networkName: '网点2',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '晚高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 3,
+            no: 3,
+            networkName: '网点3',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 4,
+            no: 4,
+            networkName: '网点4',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 5,
+            no: 5,
+            networkName: '网点5',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 6,
+            no: 6,
+            networkName: '网点6',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          },
+          {
+            id: 7,
+            no: 7,
+            networkName: '网点7',
+            equipmentNo: '陕西省',
+            type: '西安市',
+            boxNum: '未央区',
+            address: '凤城十二路',
+            oProportion: '早高峰期',
+            tProportion: '23%',
+            edition: '1.2.1',
+            status: '1'
+          }
+          ]
+          resolve(data)
+        })
+      }
+
+    }
+  },
+  beforeRouteEnter (to, from, next) {
+    next(vm => {
+      vm.handleReset()
+    })
+  },
+  methods: {
+    // 重置
+    handleReset () {
+      console.log('重置', this.queryParam)
+      this.form.resetFields()
+      this.$refs.table.refresh(true)
+    },
+    // 新建
+    openModal () {
+      this.openBoxModal = true
+      this.itemData = {}
+    },
+    // 删除
+    delect (row) {
+      const _this = this
+      this.$confirm({
+        title: '警告',
+        centered: true,
+        content: '删除后无法恢复,确认删除?',
+        okText: '确定',
+        cancelText: '取消',
+        onOk () {
+          delectRolePower({
+            id: row.id
+          }).then(res => {
+            console.log(res, 'res1111')
+            if (res.status == 200) {
+              _this.$message.success(res.message)
+              _this.$refs.table.refresh()
+            }
+          })
+        }
+      })
+    }
+  }
+}
+</script>
+<style lang="less" scoped>
+	.network-table-page-search-wrapper {
+		.network-searchForm {
+			.ant-form-inline .ant-form-item {
+				width: 100%;
+			}
+
+			// 搜索框的下间距
+			.ant-form-item {
+				margin-bottom: 10px;
+			}
+
+			.handle-btn {
+				margin-top: 4px;
+			}
+
+			.serach-btn {
+				margin-right: 10px;
+			}
+		}
+
+		.actionBtn {
+			font-size: 20px;
+			padding: 0 10px;
+		}
+
+		// 合计
+		.total {
+			margin: 15px 0 25px;
+			width: 100%;
+			background-color: #e6f7ff;
+			border: 1px solid #91d5ff;
+			padding: 8px 15px 8px 27px;
+			border-radius: 4px;
+
+			.iconImg {
+				color: #1890FF;
+				margin-right: 10px;
+			}
+		}
+	}
+</style>

+ 1 - 0
src/views/equipmentManage/openTimeSetting/OpenTimeSetting.vue

@@ -22,6 +22,7 @@
           @click="delect(record)" />
       </span>
     </s-table>
+    <!-- 新增/编辑 弹窗 -->
     <add-time-modal :visible="showModal" :data="itemData" @refresh="refreshTable" @close="showModal = false"></add-time-modal>
   </a-card>
 </template>

+ 8 - 3
src/views/shop/goodsShelves.vue

@@ -77,7 +77,7 @@ export default {
       {
         title: '商品价格(乐豆)',
         width: 200,
-        dataIndex: 'price',
+        dataIndex: 'originalGold',
         align: 'center'
       },
       {
@@ -103,8 +103,13 @@ export default {
       loadData: parameter => {
         console.log(parameter, 'parameter')
         if (this.selectedKeys.length) {
-          return goodsList(Object.assign(parameter, { goodsTypeNo: this.selectedKeys[0] })).then(res => {
+          const queryParams = {
+            goodsTypeNo: this.selectedKeys[0],
+            state: 1
+          }
+          return goodsList(Object.assign(parameter, queryParams)).then(res => {
 			  const no = (res.data.pageNo - 1) * res.data.pageSize
+			  this.list = res.data.list || []
 			  for (let i = 0; i < res.data.list.length; i++) {
 			    const _item = res.data.list[i]
 			    _item.no = no + i + 1
@@ -135,7 +140,7 @@ export default {
     },
     // 获取分类数据
     getGoodsType () {
-      goodsType({}).then(res => {
+      goodsType({ state: 1 }).then(res => {
 		  console.log(res, 'rrrrrrrrrr')
         if (res.status == 200) {
           this.menuList = res.data