chenrui 3 роки тому
батько
коміт
9fa53833dd

+ 24 - 0
src/api/shelf.js

@@ -11,3 +11,27 @@ export const shelfList = (params) => {
     method: 'post'
   })
 }
+//  货架  详情
+export const shelfDetail = (params) => {
+  return axios({
+    url: `/shelf/queryBySn/${params.sn}`,
+    data: params,
+    method: 'post'
+  })
+}
+//  货架  货位产品 列表 不分页
+export const shelfProductList = (params) => {
+  return axios({
+    url: `/shelf/placeProduct/queryList`,
+    data: params,
+    method: 'post'
+  })
+}
+//  货架  货位产品 详情
+export const shelfProductDetail = (params) => {
+  return axios({
+    url: `/shelf/placeProduct/queryByPlaceSnProductSn/${params.shelfPlaceSn}/${params.productSn}`,
+    data: params,
+    method: 'get'
+  })
+}

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

@@ -37,6 +37,10 @@ export default {
     itemSn: {
       type: String || Number,
       default: undefined
+    },
+    isEnabled: { // 是否只查启用状态
+      type: Boolean,
+      default: false
     }
   },
   data () {
@@ -62,6 +66,9 @@ export default {
       } else {
         params.queryWord = dealerName
       }
+      if (this.isEnabled) {
+        params.enabledFlag = 1
+      }
       custList(params).then(res => {
         if (fetchId !== this.lastFetchId) {
           return

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

@@ -0,0 +1,70 @@
+<template>
+  <!-- 货架 -->
+  <a-select
+    show-search
+    label-in-value
+    :value="shelfName"
+    placeholder="请输入名称搜索"
+    style="width: 100%"
+    :filter-option="false"
+    :dropdownMatchSelectWidth="false"
+    :not-found-content="fetching ? undefined : null"
+    @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 { shelfList } from '@/api/shelf'
+export default {
+  props: {
+    verify: { //  当前输入客户名称是否是卫星仓客户 提示信息
+      type: Boolean,
+      default: false
+    }
+  },
+  data () {
+    this.lastFetchId = 0
+    this.fetchUser = debounce(this.fetchUser, 800)
+    return {
+      data: [],
+      shelfName: [],
+      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
+      shelfList({ shelfName: shelfName, pageNo: 1, pageSize: 20 }).then(res => {
+        if (fetchId !== this.lastFetchId) {
+          return
+        }
+        this.data = res.data && res.data.list ? res.data.list : []
+        if (this.verify && this.data.length == 0) {
+          this.$message.info('货架不存在')
+        }
+        this.fetching = false
+      })
+    },
+    handleChange (value) {
+      Object.assign(this, {
+        shelfName: value,
+        data: [],
+        fetching: false
+      })
+      this.$emit('change', value || { key: undefined, label: '' })
+    },
+    resetForm () {
+      this.shelfName = []
+    }
+  }
+}
+</script>

+ 9 - 2
src/views/numsGoodsShelves/shelfSet/bindProductModal.vue

@@ -16,8 +16,8 @@
         :rules="rules"
         :label-col="formItemLayout.labelCol"
         :wrapper-col="formItemLayout.wrapperCol">
-        <a-form-model-item label="货架名称">货架名称</a-form-model-item>
-        <a-form-model-item label="货位号">货位号</a-form-model-item>
+        <a-form-model-item label="货架名称">{{ nowData&&nowData.shelfName || '--' }}</a-form-model-item>
+        <a-form-model-item label="货位号">{{ nowData&&nowData.shelfPlaceCode || '--' }}</a-form-model-item>
         <a-form-model-item label="绑定产品" prop="customerSn">
           <custList ref="custList" @change="custChange"></custList>
         </a-form-model-item>
@@ -90,6 +90,12 @@ export default {
     type: {
       type: String,
       default: ''
+    },
+    nowData: {
+      type: Object,
+      default: () => {
+        return {}
+      }
     }
   },
   data () {
@@ -164,6 +170,7 @@ export default {
     },
     //  重定义的弹框状态
     isShow (newValue, oldValue) {
+      console.log(this.nowData)
       if (!newValue) {
         this.$emit('close')
         this.$refs.ruleForm.resetFields()

+ 43 - 25
src/views/numsGoodsShelves/shelfSet/list.vue

@@ -7,21 +7,21 @@
           <a-row :gutter="15">
             <a-col :md="6" :sm="24">
               <a-form-item label="货架名称">
-                <custList ref="custList" @change="custChange" :itemSn="queryParam.customerSn"></custList>
+                <shelfSList ref="shelfList" @change="shelfChange" :itemSn="queryParam.shelfSn"></shelfSList>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="关联客户">
-                <custList ref="custList" @change="custChange" :itemSn="queryParam.customerSn"></custList>
+                <custList ref="custList" @change="custChange" :itemSn="queryParam.customerSn" :isEnabled="true"></custList>
               </a-form-item>
             </a-col>
             <a-col :md="6" :sm="24">
               <a-form-item label="是否设置完成">
                 <v-select
-                  v-model="queryParam.billStatus"
-                  ref="billStatus"
-                  id="shelfSetList-billStatus"
-                  code="SALES_BILL_STATUS"
+                  v-model="queryParam.finishFlag"
+                  ref="finishFlag"
+                  id="shelfSetList-finishFlag"
+                  code="FLAG"
                   placeholder="请选择"
                   allowClear></v-select>
               </a-form-item>
@@ -49,13 +49,19 @@
         :scroll="{ y: tableHeight }"
         :defaultLoadData="false"
         bordered>
+        <!-- 货位数量 -->
+        <template slot="shelfPlaceNum" slot-scope="text, record">
+          <p v-if="record.shelfPlaceBindNum && record.shelfPlaceNum && record.shelfPlaceBindNum != record.shelfPlaceNum" style="margin: 0;"><span style="color: red;">{{ record.shelfPlaceBindNum }}</span> / {{ record.shelfPlaceNum }}</p>
+          <p v-else style="margin: 0;">{{ record.shelfPlaceNum }}</p>
+        </template>
+        <!-- 是否设置完成 -->
+        <template slot="finishFlag" slot-scope="text, record">
+          <span v-if="record.finishFlagDictValue" :style="{color: record.finishFlagDictValue=='否' ? 'red':''}">{{ record.finishFlagDictValue }}</span>
+          <span v-else>--</span>
+        </template>
         <!-- 操作 -->
         <template slot="action" slot-scope="text, record">
-          <a-button
-            size="small"
-            type="link"
-            class="button-primary"
-            @click="handleSet(record)">设置</a-button>
+          <a-button size="small" type="link" class="button-primary" @click="handleSet(record)">{{ record.finishFlag?'修改':'设置' }}</a-button>
         </template>
       </s-table>
     </a-spin>
@@ -68,10 +74,11 @@
 import { commonMixin } from '@/utils/mixin'
 import { STable, VSelect } from '@/components'
 import custList from '@/views/common/custList.vue'
+import shelfSList from '@/views/common/shelfList.vue'
 import basicInfoModal from './basicInfoModal.vue'
-import { giftsDetailList } from '@/api/dealerProduct'
+import { shelfList } from '@/api/shelf'
 export default {
-  components: { STable, VSelect, custList, basicInfoModal },
+  components: { STable, VSelect, custList, shelfSList, basicInfoModal },
   mixins: [commonMixin],
   data () {
     return {
@@ -79,23 +86,24 @@ export default {
       tableHeight: 0,
       disabled: false, //  查询、重置按钮是否可操作
       queryParam: {
+        shelfSn: undefined,
         customerSn: undefined,
-        billStatus: undefined
+        finishFlag: undefined
       },
       columns: [
         { title: '序号', dataIndex: 'no', width: '5%', align: 'center' },
-        { title: '货架名称', dataIndex: 'dealerProductEntity.name', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '关联客户', dataIndex: 'dealerProductEntity.origCode', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '临配运费', dataIndex: 'qsty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '货位数量', dataIndex: 'qty', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '是否设置完成', dataIndex: 'salesBillNo', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'center' }
+        { title: '货架名称', dataIndex: 'shelfName', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '关联客户', dataIndex: 'customerName', width: '25%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '临配运费', dataIndex: 'tempFreight', width: '10%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '货位数量', scopedSlots: { customRender: 'shelfPlaceNum' }, width: '10%', align: 'center' },
+        { title: '是否设置完成', scopedSlots: { customRender: 'finishFlag' }, width: '15%', align: 'center' },
+        { title: '操作', scopedSlots: { customRender: 'action' }, width: '10%', align: 'left' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return giftsDetailList(Object.assign(parameter, this.queryParam)).then(res => {
+        return shelfList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
@@ -115,18 +123,28 @@ export default {
   methods: {
     // 设置/修改
     handleSet (row) {
-      this.openModal = true
+      if (row.customerSn && row.tempFreight) {
+        this.$router.push({ path: `/numsGoodsShelves/shelfSet/set/${row.shelfSn}` })
+      } else {
+        this.openModal = true
+      }
     },
     handleOk () {},
     // 客户 change
     custChange (obj) {
-      this.queryParam.buyerSn = obj.key || undefined
+      this.queryParam.customerSn = obj.key || undefined
+    },
+    // 货架  change
+    shelfChange (obj) {
+      this.queryParam.shelfSn = obj.key || undefined
     },
     // 重置
     resetSearchForm () {
-      this.$refs.custList.resetForm()
+      this.queryParam.shelfSn = undefined
+      this.$refs.shelfList.resetForm()
       this.queryParam.customerSn = undefined
-      this.queryParam.billStatus = undefined
+      this.$refs.custList.resetForm()
+      this.queryParam.finishFlag = undefined
       this.$refs.table.refresh(true)
     },
     setTableH () {

+ 40 - 20
src/views/numsGoodsShelves/shelfSet/set.vue

@@ -5,7 +5,7 @@
         <!-- 自定义的二级文字标题 -->
         <template slot="subTitle">
           <a id="shelfSet-back-btn" href="javascript:;" @click="handleBack"><a-icon type="left" /> 返回列表</a>
-          <span class="store-info">西安车领主常青二路数字货架——货位号A01</span>
+          <span class="store-info">{{ (basicInfoData&&basicInfoData.shelfName) || '--' }}</span>
         </template>
       </a-page-header>
       <!-- 内容 -->
@@ -17,8 +17,8 @@
               <a-button icon="edit" size="small" type="link" style="margin-left: 20px;color: #39f;" @click.stop="handleInfoEdit">编辑</a-button>
             </template>
             <a-descriptions :column="3">
-              <a-descriptions-item label="关联客户">{{ (basicInfoData&&basicInfoData.outWarehouseName) || '--' }}</a-descriptions-item>
-              <a-descriptions-item label="临配运费">{{ (basicInfoData&&basicInfoData.putWarehouseName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="关联客户">{{ (basicInfoData&&basicInfoData.customerName) || '--' }}</a-descriptions-item>
+              <a-descriptions-item label="临配运费">{{ (basicInfoData&&(basicInfoData.tempFreight || basicInfoData.tempFreight==0)) ? basicInfoData.tempFreight : '--' }}</a-descriptions-item>
             </a-descriptions>
           </a-collapse-panel>
         </a-collapse>
@@ -48,7 +48,7 @@
           </a-form>
         </div>
         <!-- 操作按钮 -->
-        <div class="table-operator">
+        <div class="table-operator" v-if="!(basicInfoData&&basicInfoData.finishFlag)">
           <a-button id="shelfSet-import" type="primary" class="button-error" @click="openGuideModal=true">导入绑定产品</a-button>
           <a-tooltip placement="top">
             <template slot="title">
@@ -65,6 +65,8 @@
           :rowKey="(record) => record.id"
           :columns="columns"
           :data="loadData"
+          :showPagination="false"
+          :defaultLoadData="false"
           bordered>
           <!-- 操作 -->
           <template slot="action" slot-scope="text, record">
@@ -72,30 +74,33 @@
               size="small"
               type="link"
               class="button-primary"
+              v-if="!!record.productSn"
               @click="handleProduct(record, 'edit')"
               id="shelfMonitoringList-edit-btn">修改信息</a-button>
             <a-button
               size="small"
               type="link"
               class="button-primary"
+              v-if="!!record.productSn"
               @click="handleReplace(record)"
               id="shelfMonitoringList-replace-btn">更换产品</a-button>
             <a-button
               size="small"
               type="link"
               class="button-primary"
+              v-if="!record.productSn"
               @click="handleProduct(record, 'bind')"
               id="shelfMonitoringList-bind-btn">绑定产品</a-button>
           </template>
         </s-table>
       </a-card>
     </a-spin>
-    <!-- 修改信息/绑定产品 -->
+    <!-- 修改信息/绑定产品/更换产品 -->
     <bind-product-modal :openModal="openModal" :type="modalType" :nowData="nowData" @ok="handleOk" @close="handleCancel" />
     <!-- 更换产品 -->
     <common-modal
       :openModal="openTipsModal"
-      modalHtml="只有当前库存为0时,才能更换产品您可以在“货架监控”功能中将产品调回"
+      modalHtml="只有当前库存为0时,才能更换产品<br/>您可以在“货架监控”功能中将产品调回"
       okText="好的"
       :isCancel="false"
       @ok="openTipsModal=false"
@@ -111,7 +116,7 @@ import { STable, VSelect } from '@/components'
 import commonModal from '@/views/common/commonModal.vue'
 import bindProductModal from './bindProductModal.vue'
 import ImportGuideModal from './importGuideModal.vue'
-import { storeCallOutList } from '@/api/storeCallOut'
+import { shelfDetail, shelfProductList } from '@/api/shelf'
 export default {
   name: 'ShelfMonitoringWarehousing',
   components: { STable, VSelect, commonModal, bindProductModal, ImportGuideModal },
@@ -126,26 +131,25 @@ export default {
       },
       columns: [
         { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
-        { title: '货位号', dataIndex: 'createDate', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '绑定产品编码', dataIndex: 'allocationLinkagePutNo', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
-        { title: '绑定产品名称', dataIndex: 'outTenantName', width: '23%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
-        { title: '销售价', dataIndex: 'allocatione', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '结算价', dataIndex: 'alloeDictValue', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '最大库容', dataIndex: 'allocatialue', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
-        { title: '当前库存', dataIndex: 'allolue', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '货位号', dataIndex: 'shelfPlaceCode', width: '15%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '绑定产品编码', dataIndex: 'productCode', width: '16%', align: 'center', customRender: function (text) { return text || '--' } },
+        { title: '绑定产品名称', dataIndex: 'productName', width: '23%', align: 'left', customRender: function (text) { return text || '--' }, ellipsis: true },
+        { title: '销售价', dataIndex: 'price', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '结算价', dataIndex: 'cost', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '最大库容', dataIndex: 'maxQty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
+        { title: '当前库存', dataIndex: 'qty', width: '9%', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
         { title: '操作', scopedSlots: { customRender: 'action' }, width: '15%', align: 'center' }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        return storeCallOutList(Object.assign(parameter, this.queryParam)).then(res => {
+        return shelfProductList(Object.assign(parameter, this.queryParam, { shelfSn: this.$route.params.sn })).then(res => {
           let data
           if (res.status == 200) {
             data = res.data
-            const no = (data.pageNo - 1) * data.pageSize
-            for (var i = 0; i < data.list.length; i++) {
-              data.list[i].no = no + i + 1
+            for (var i = 0; i < data.length; i++) {
+              data[i].no = i + 1
             }
             this.disabled = false
           }
@@ -164,13 +168,27 @@ export default {
   methods: {
     // 编辑基本信息
     handleInfoEdit () {},
+    // 基本信息
+    getDetail () {
+      shelfDetail({ sn: this.$route.params.sn }).then(res => {
+        if (res.status == 200) {
+          this.basicInfoData = res.data
+        } else {
+          this.basicInfoData = null
+        }
+      })
+    },
     // 更换产品
     handleReplace (row) {
-      this.openTipsModal = true
-      // this.handleProduct(row, 'replace')
+      if (row.qty) {
+        this.handleProduct(row, 'replace')
+      } else {
+        this.openTipsModal = true
+      }
     },
     // 更换产品/绑定产品/修改信息
     handleProduct (row, type) {
+      this.nowData = row || null
       this.modalType = type
       this.openModal = true
     },
@@ -199,12 +217,14 @@ export default {
   },
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      this.getDetail()
       this.resetSearchForm()
     }
   },
   activated () {
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+      this.getDetail()
       this.resetSearchForm()
     }
   }