chenrui 2 gadi atpakaļ
vecāks
revīzija
c767b841ca
1 mainītis faili ar 21 papildinājumiem un 18 dzēšanām
  1. 21 18
      src/views/productManagement/productInfo/list.vue

+ 21 - 18
src/views/productManagement/productInfo/list.vue

@@ -30,10 +30,17 @@
                   <v-select code="ENABLE_FLAG" id="productInfoList-enabledFlag" v-model="queryParam.enabledFlag" allowClear placeholder="请选择状态"></v-select>
                 </a-form-item>
               </a-col>
-              <a-col :md="4" :sm="24" style="margin-top:6px;">
-                <a-checkbox @change="handleHasQty" :checked="queryParam.stockEmptyFlag == 0">
-                  只查看有库存
-                </a-checkbox>
+              <a-col :md="6" :sm="24">
+                <a-form-item label="查看库存">
+                  <a-select @change="handleHasQty" :value="queryParam.stockEmptyFlag" placeholder="请选择查看库存类型">
+                    <a-select-option value="0">
+                      有库存
+                    </a-select-option>
+                    <a-select-option value="1">
+                      无库存
+                    </a-select-option>
+                  </a-select>
+                </a-form-item>
               </a-col>
             </template>
             <a-col :md="6" :sm="24" style="margin-bottom: 10px;">
@@ -270,9 +277,6 @@ export default {
       loadData: parameter => {
         this.disabled = true
         this.spinning = true
-        if(this.queryParam.stockEmptyFlag && this.queryParam.stockEmptyFlag==1){
-          this.queryParam.stockEmptyFlag = undefined
-        }
         return dealerProductList(Object.assign(parameter, this.queryParam)).then(res => {
           let data
           if (res.status == 200) {
@@ -331,9 +335,9 @@ export default {
       this.rowSelectionInfo = null
       this.$refs.table.refresh(true)
     },
-    // 查看库存
-    handleHasQty (e) {
-      this.queryParam.stockEmptyFlag = e.target.checked ? 0:1
+    // 查看库存
+    handleHasQty (val) {
+      this.queryParam.stockEmptyFlag = val
     },
     //  新增/编辑
     handleEdit (row) {
@@ -368,7 +372,7 @@ export default {
     },
     // 启用 禁用
     changeStatus (record) {
-      if(record.currentStockQty!=0){
+      if (record.currentStockQty != 0) {
         this.$confirm({
           title: '提示',
           content: record.enabledFlag == '1' ? '当前产品存在可用库存,产品被禁用后,不能再销售,确定禁用吗?' : '确定启用吗?',
@@ -377,10 +381,10 @@ export default {
             this.setEnable(record.enabledFlag == 1 ? '0' : '1', [record.productSn])
           }
         })
-      }else{
-        if(record.enabledFlag==1){
+      } else {
+        if (record.enabledFlag == 1) {
           this.setEnable('0', [record.productSn])
-        }else{
+        } else {
           this.$confirm({
             title: '提示',
             content: '确定启用吗?',
@@ -391,7 +395,6 @@ export default {
           })
         }
       }
-      
     },
     // 启用 禁用
     setEnable (enabledFlag, snList) {
@@ -423,11 +426,11 @@ export default {
         this.$message.warning('请在列表勾选后再进行批量操作!')
         return
       }
-      //判断所选产品是否都是库存为0的产品
-      let isZero =this.rowSelectionInfo.selectedRows.every(item=>{return item.currentStockQty==0})
+      // 判断所选产品是否都是库存为0的产品
+      const isZero = this.rowSelectionInfo.selectedRows.every(item => { return item.currentStockQty == 0 })
       this.$confirm({
         title: '提示',
-        content: type == '2' ? (isZero ? '产品被禁用后,不能再销售,确定批量禁用吗?':'当前产品存在可用库存,产品被禁用后,不能再销售,确定禁用吗?') : '确定批量启用吗?',
+        content: type == '2' ? (isZero ? '产品被禁用后,不能再销售,确定批量禁用吗?' : '当前产品存在可用库存,产品被禁用后,不能再销售,确定禁用吗?') : '确定批量启用吗?',
         centered: true,
         onOk: () => {
           this.setEnable(type == '2' ? '0' : '1', this.rowSelectionInfo.selectedRowKeys)