浏览代码

添加是否关联条码逻辑

linwenxin 1 年之前
父节点
当前提交
34365b9acf

+ 12 - 22
src/views/salesPurchasing/goodsPurchasedStored/index.vue

@@ -1,17 +1,7 @@
 <template>
-  <template-page
-    v-if="pageShow"
-    ref="pageRef"
-    :get-list="getList"
-    :table-attributes="tableAttributes"
-    :table-events="tableEvents"
-    :options-evens-group="optionsEvensGroup"
-    :moreParameters="moreParameters"
-    :column-parsing="columnParsing"
-    :exportList="exportList"
-    :operation="operation()"
-    key="pageType"
-  >
+  <template-page v-if="pageShow" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes"
+    :table-events="tableEvents" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
+    :column-parsing="columnParsing" :exportList="exportList" :operation="operation()" key="pageType">
     <div slot="moreSearch">
       <el-radio-group v-model="pageType" size="mini" @input="changePageType">
         <el-radio-button label="list">列表</el-radio-button>
@@ -21,13 +11,8 @@
       <br /><br />
     </div>
     <div class="cartographer_big">
-      <el-dialog
-        :title="formDialogTitles[formDialogType]"
-        width="100%"
-        :modal="false"
-        :visible.sync="formDialog"
-        :before-close="handleClose"
-      >
+      <el-dialog :title="formDialogTitles[formDialogType]" width="100%" :modal="false" :visible.sync="formDialog"
+        :before-close="handleClose">
         <zj-page-container>
           <zj-page-fill>
             <div style="box-sizing: border-box; padding: 20px 20px 0 20px">
@@ -37,7 +22,7 @@
                 <zj-form-module title="" label-width="100px" :form-data="formData" :form-items="formItems2">
                   <el-tabs slot="header" v-model="activeName">
                     <el-tab-pane label="商品信息" name="goodsInfo"></el-tab-pane>
-                    <el-tab-pane v-if="formDialogType > 0" label="条码信息" name="codeInfo"></el-tab-pane>
+                    <el-tab-pane v-if="formDialogType > 0 && joinCode" label="条码信息" name="codeInfo"></el-tab-pane>
                   </el-tabs>
                 </zj-form-module>
               </zj-form-container>
@@ -120,7 +105,8 @@ export default {
         codeInfoList: []
       },
       activeName: 'goodsInfo',
-      goods_material_id: ''
+      goods_material_id: '',
+      joinCode: false
     }
   },
   computed: {
@@ -134,6 +120,7 @@ export default {
                 click: () => {
                   this.openForm()
                   this.formDialog = true
+                  this.joinCode = JSON.parse(localStorage.getItem('greemall_user')).joinCode
                 }
               })
             ]
@@ -210,6 +197,7 @@ export default {
           fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
           items: res.data.items.map(item => ({ ...item, details: {} }))
         })
+        this.joinCode = res.data.joinCode
         this.formDialogType = type
         this.openForm()
         this.formDialog = true
@@ -222,6 +210,7 @@ export default {
       this.formDialog = false
       this.formDialogType = 0
       this.activeName = 'goodsInfo'
+      this.joinCode = false
     },
     // 操作按钮
     operation() {
@@ -334,6 +323,7 @@ export default {
 .tab {
   padding: 20px 20px 0 20px;
 }
+
 ::v-deep .teshudeshangchuananniu {
   color: #409eff !important;
 }

+ 10 - 22
src/views/salesPurchasing/merchandisePurchaseReturn/index.vue

@@ -1,17 +1,7 @@
 <template>
-  <template-page
-    v-if="pageShow"
-    ref="pageRef"
-    :get-list="getList"
-    :table-attributes="tableAttributes"
-    :table-events="tableEvents"
-    :options-evens-group="optionsEvensGroup"
-    :moreParameters="moreParameters"
-    :column-parsing="columnParsing"
-    :exportList="exportList"
-    :operation="operation()"
-    key="pageType"
-  >
+  <template-page v-if="pageShow" ref="pageRef" :get-list="getList" :table-attributes="tableAttributes"
+    :table-events="tableEvents" :options-evens-group="optionsEvensGroup" :moreParameters="moreParameters"
+    :column-parsing="columnParsing" :exportList="exportList" :operation="operation()" key="pageType">
     <div slot="moreSearch">
       <el-radio-group v-model="pageType" size="mini" @change="changePageType">
         <el-radio-button label="list">列表</el-radio-button>
@@ -21,13 +11,8 @@
       <br /><br />
     </div>
     <div class="cartographer_big">
-      <el-dialog
-        :title="formDialogTitles[formDialogType]"
-        width="100%"
-        :modal="false"
-        :visible.sync="formDialog"
-        :before-close="handleClose"
-      >
+      <el-dialog :title="formDialogTitles[formDialogType]" width="100%" :modal="false" :visible.sync="formDialog"
+        :before-close="handleClose">
         <zj-page-container>
           <zj-page-fill>
             <div style="box-sizing: border-box; padding: 20px 20px 0 20px">
@@ -37,7 +22,7 @@
                 <zj-form-module title="" label-width="100px" :form-data="formData" :form-items="formItems2">
                   <el-tabs slot="header" v-model="activeName">
                     <el-tab-pane label="商品信息" name="goodsInfo"></el-tab-pane>
-                    <el-tab-pane v-if="formDialogType > 0" label="条码信息" name="codeInfo"></el-tab-pane>
+                    <el-tab-pane v-if="formDialogType > 0 && joinCode" label="条码信息" name="codeInfo"></el-tab-pane>
                   </el-tabs>
                 </zj-form-module>
               </zj-form-container>
@@ -118,7 +103,8 @@ export default {
         codeInfoList: []
       },
       activeName: 'goodsInfo',
-      goods_material_id: ''
+      goods_material_id: '',
+      joinCode: false
     }
   },
   computed: {
@@ -219,6 +205,7 @@ export default {
       this.formDialog = false
       this.formDialogType = 0
       this.activeName = 'goodsInfo'
+      this.joinCode = false
     },
     // 操作按钮
     operation() {
@@ -331,6 +318,7 @@ export default {
 .tab {
   padding: 20px 20px 0 20px;
 }
+
 ::v-deep .teshudeshangchuananniu {
   color: #409eff !important;
 }

+ 17 - 10
src/views/salesPurchasing/mixins/common_form.js

@@ -100,6 +100,7 @@ export default {
                               this.formData.items = []
                               if (val) {
                                 goodsPurchaseDetail({ id: val, isQuery: true }).then(res => {
+                                  this.joinCode = res.data.joinCode
                                   this.formData.items = res.data.items.map(item => ({
                                     brandId: item.brandId,
                                     brandName: item.brandName,
@@ -135,9 +136,8 @@ export default {
                             {this.cgrkOrder.map(item => (
                               <el-option
                                 key={item.id}
-                                label={`${item.id} | 销售金额:${item.totalAmount || '-'} | 入库时间:${
-                                  item.examineTime || '-'
-                                }`}
+                                label={`${item.id} | 销售金额:${item.totalAmount || '-'} | 入库时间:${item.examineTime || '-'
+                                  }`}
                                 value={item.id}
                               ></el-option>
                             ))}
@@ -160,11 +160,11 @@ export default {
                 >
                   {!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)
                     ? [
-                        <el-descriptions-item label="退货数量">{this.formData.totalQty}</el-descriptions-item>,
-                        <el-descriptions-item label="退款金额">{this.formData.totalAmount}</el-descriptions-item>,
-                        <el-descriptions-item label=""></el-descriptions-item>,
-                        <el-descriptions-item label=""></el-descriptions-item>
-                      ]
+                      <el-descriptions-item label="退货数量">{this.formData.totalQty}</el-descriptions-item>,
+                      <el-descriptions-item label="退款金额">{this.formData.totalAmount}</el-descriptions-item>,
+                      <el-descriptions-item label=""></el-descriptions-item>,
+                      <el-descriptions-item label=""></el-descriptions-item>
+                    ]
                     : null}
                   <el-descriptions-item label="制单人">{this.formData.createBy}</el-descriptions-item>
                   <el-descriptions-item label="制单时间">{this.formData.createTime}</el-descriptions-item>
@@ -240,10 +240,17 @@ export default {
         goodsPurchaseList({
           pageNum: 1,
           pageSize: -1,
-          params: [{ param: 'a.vender_id', compare: '=', value: this.formData.venderId }]
+          params: [
+            { param: 'a.vender_id', compare: '=', value: this.formData.venderId },
+            { "param": "a.status", "compare": "=", "value": "OK" }
+          ]
         }).then(res => {
           this.cgrkOrder = res.data.records
-          console.log(res.data.records)
+          if (this.formData.goodsPurchaseId) {
+            goodsPurchaseDetail({ id: this.formData.goodsPurchaseId, isQuery: true }).then(res => {
+              this.joinCode = res.data.joinCode
+            })
+          }
         })
       }
     }

+ 35 - 22
src/views/salesPurchasing/mixins/out_storage_goods.js

@@ -189,7 +189,7 @@ export default {
           }
         },
         ...(() => {
-          if (this.formDialogType < 2) {
+          if (this.formDialogType < 2 && !~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)) {
             return [
               {
                 columnAttributes: {
@@ -200,28 +200,41 @@ export default {
                 render: (h, { row, column, index }) => {
                   return (
                     <div style="padding:0 6px" class="operation-btns">
-                      {!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status) ? (
-                        <el-button
-                          type="text"
-                          onClick={() => {
-                            this.formData?.items?.splice(index, 1)
-                          }}
-                        >
-                          删除
-                        </el-button>
-                      ) : !!~['SAVE'].indexOf(this.formData.status) ? (
-                        this.importButton(goodsPurchaseRetItemImportCode, '导入条码', { purchaseRetItemId: row.id }, () => { }, () => {
-                          if (this.formData.id) {
-                            // 更新表单信息
-                            goodsPurchaseRetDetail({ id: this.formData.id }).then(res => {
-                              Object.assign(this.formData, res.data, {
-                                fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
-                                items: res.data.items.map(item => ({ ...item, details: {} }))
-                              })
+                      <el-button
+                        type="text"
+                        onClick={() => {
+                          this.formData?.items?.splice(index, 1)
+                        }}
+                      >
+                        删除
+                      </el-button>
+                    </div>
+                  )
+                }
+              }
+            ]
+          } else if (this.formDialogType < 2 && !!~['SAVE'].indexOf(this.formData.status) && this.joinCode) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  fixed: 'right',
+                  width: 140
+                },
+                render: (h, { row, column, index }) => {
+                  return (
+                    <div style="padding:0 6px" class="operation-btns">
+                      {this.importButton(goodsPurchaseRetItemImportCode, '导入条码', { purchaseRetItemId: row.id }, () => { }, () => {
+                        if (this.formData.id) {
+                          // 更新表单信息
+                          goodsPurchaseRetDetail({ id: this.formData.id }).then(res => {
+                            Object.assign(this.formData, res.data, {
+                              fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
+                              items: res.data.items.map(item => ({ ...item, details: {} }))
                             })
-                          }
-                        })
-                      ) : null}
+                          })
+                        }
+                      })}
                     </div>
                   )
                 }

+ 19 - 19
src/views/salesPurchasing/mixins/out_storage_table.js

@@ -22,24 +22,24 @@ export default {
               <div>
                 {this.activeName == 'goodsInfo'
                   ? [
-                      this.formDialogType == 1 ? (
-                        <div style="margin-bottom:10px">
-                          <el-button type="primary" onClick={this.domlMban}>
-                            下载导入模板
-                          </el-button>
-                        </div>
-                      ) : null,
-                      <zj-table
-                        columns={this.storage_goods}
-                        tableData={this.formData.items}
-                        tableAttributes={{
-                          size: 'mini',
-                          border: true
-                        }}
-                      />
-                    ]
-                  : this.activeName == 'codeInfo'
-                  ? [
+                    this.formDialogType == 1 && this.joinCode ? (
+                      <div style="margin-bottom:10px">
+                        <el-button type="primary" onClick={this.domlMban}>
+                          下载导入模板
+                        </el-button>
+                      </div>
+                    ) : null,
+                    <zj-table
+                      columns={this.storage_goods}
+                      tableData={this.formData.items}
+                      tableAttributes={{
+                        size: 'mini',
+                        border: true
+                      }}
+                    />
+                  ]
+                  : this.activeName == 'codeInfo' && this.joinCode
+                    ? [
                       this.formDialogType == 1 ? (
                         <div style="margin-bottom:10px">
                           <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
@@ -56,7 +56,7 @@ export default {
                         }}
                       />
                     ]
-                  : null}
+                    : null}
               </div>
             )
           }

+ 58 - 44
src/views/salesPurchasing/mixins/storage_goods.js

@@ -390,7 +390,8 @@ export default {
           }
         },
         ...(() => {
-          if (this.formDialogType < 2) {
+
+          if (this.formDialogType < 2 && !~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)) {
             return [
               {
                 columnAttributes: {
@@ -401,57 +402,70 @@ export default {
                 render: (h, { row, column, index }) => {
                   return (
                     <div style="padding:0 6px" class="operation-btns">
-                      {!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)
-                        ? [
-                          this.isEditIndex == index ? (
-                            <el-button
-                              type="text"
-                              onClick={() => {
-                                this.$refs.formRef.validateField(
-                                  this.getVfyKey(this.isEditIndex),
-                                  (valid, invalidFields, errLabels) => {
-                                    if (valid && this.eidtItems()) {
-                                      this.isEditIndex = -1
-                                    }
+                      {[
+                        this.isEditIndex == index ? (
+                          <el-button
+                            type="text"
+                            onClick={() => {
+                              this.$refs.formRef.validateField(
+                                this.getVfyKey(this.isEditIndex),
+                                (valid, invalidFields, errLabels) => {
+                                  if (valid && this.eidtItems()) {
+                                    this.isEditIndex = -1
                                   }
-                                )
-                              }}
-                            >
-                              保存
-                            </el-button>
-                          ) : null,
-                          this.isEditIndex == -1 ? (
-                            <el-button
-                              type="text"
-                              onClick={() => {
-                                this.isEditIndex = index
-                              }}
-                            >
-                              编辑
-                            </el-button>
-                          ) : null,
+                                }
+                              )
+                            }}
+                          >
+                            保存
+                          </el-button>
+                        ) : null,
+                        this.isEditIndex == -1 ? (
                           <el-button
                             type="text"
                             onClick={() => {
-                              this.delGoodsInfo(row, index)
+                              this.isEditIndex = index
                             }}
                           >
-                            删除
+                            编辑
                           </el-button>
-                        ]
-                        : !!~['SAVE'].indexOf(this.formData.status)
-                          ? this.importButton(goodsPurchaseItemImportCode, '导入条码', { purchaseItemId: row.id }, () => { }, () => {
-                            if (this.formData.id) {
-                              // 更新表单信息
-                              goodsPurchaseDetail({ id: this.formData.id }).then(res => {
-                                Object.assign(this.formData, res.data, {
-                                  fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
-                                  items: res.data.items.map(item => ({ ...item, details: {} }))
-                                })
-                              })
-                            }
+                        ) : null,
+                        <el-button
+                          type="text"
+                          onClick={() => {
+                            this.delGoodsInfo(row, index)
+                          }}
+                        >
+                          删除
+                        </el-button>
+                      ]}
+                    </div>
+                  )
+                }
+              }
+            ]
+          } else if (this.formDialogType < 2 && !!~['SAVE'].indexOf(this.formData.status) && this.joinCode) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  fixed: 'right',
+                  width: 140
+                },
+                render: (h, { row, column, index }) => {
+                  return (
+                    <div style="padding:0 6px" class="operation-btns">
+                      {this.importButton(goodsPurchaseItemImportCode, '导入条码', { purchaseItemId: row.id }, () => { }, () => {
+                        if (this.formData.id) {
+                          // 更新表单信息
+                          goodsPurchaseDetail({ id: this.formData.id }).then(res => {
+                            Object.assign(this.formData, res.data, {
+                              fileUrl: res.data.fileUrl ? [{ url: res.data.fileUrl }] : [],
+                              items: res.data.items.map(item => ({ ...item, details: {} }))
+                            })
                           })
-                          : null}
+                        }
+                      })}
                     </div>
                   )
                 }

+ 25 - 25
src/views/salesPurchasing/mixins/storage_table.js

@@ -22,30 +22,30 @@ export default {
               <div>
                 {this.activeName == 'goodsInfo'
                   ? [
-                      this.formDialogType == 0 ? (
-                        <div style="margin-bottom:10px">
-                          <el-button type="primary" onClick={this.addGoodsInfo}>
-                            添加
-                          </el-button>
-                        </div>
-                      ) : this.formDialogType == 1 ? (
-                        <div style="margin-bottom:10px">
-                          <el-button type="primary" onClick={this.domlMban}>
-                            下载导入模板
-                          </el-button>
-                        </div>
-                      ) : null,
-                      <zj-table
-                        columns={this.storage_goods}
-                        tableData={this.formData.items}
-                        tableAttributes={{
-                          size: 'mini',
-                          border: true
-                        }}
-                      />
-                    ]
-                  : this.activeName == 'codeInfo'
-                  ? [
+                    this.formDialogType == 0 ? (
+                      <div style="margin-bottom:10px">
+                        <el-button type="primary" onClick={this.addGoodsInfo}>
+                          添加
+                        </el-button>
+                      </div>
+                    ) : this.formDialogType == 1 && this.joinCode ? (
+                      <div style="margin-bottom:10px">
+                        <el-button type="primary" onClick={this.domlMban}>
+                          下载导入模板
+                        </el-button>
+                      </div>
+                    ) : null,
+                    <zj-table
+                      columns={this.storage_goods}
+                      tableData={this.formData.items}
+                      tableAttributes={{
+                        size: 'mini',
+                        border: true
+                      }}
+                    />
+                  ]
+                  : this.activeName == 'codeInfo' && this.joinCode
+                    ? [
                       this.formDialogType == 1 ? (
                         <div style="margin-bottom:10px">
                           <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
@@ -62,7 +62,7 @@ export default {
                         }}
                       />
                     ]
-                  : null}
+                    : null}
               </div>
             )
           }