Browse Source

no message

aXin-0810 1 năm trước cách đây
mục cha
commit
cad2266324

+ 37 - 9
src/views/salesPurchasing/merchandisePurchaseReturn/index.vue

@@ -42,9 +42,10 @@
               </zj-form-container>
             </div>
           </zj-page-fill>
-          <div style="text-align: right; box-sizing: border-box; padding: 16px 20px">
-            <el-button size="mini">取消</el-button>
-            <el-button size="mini" type="primary">确定</el-button>
+          <div v-if="activeName == 'goodsInfo'" style="text-align: right; box-sizing: border-box; padding: 16px 20px">
+            <el-button v-if="formDialogType == 0" size="mini" type="primary" @click="save">保存</el-button>
+            <el-button v-if="formDialogType == 1" size="mini" type="primary" @click="submit">提交</el-button>
+            <el-button v-if="formDialogType == 3" size="mini" type="primary" @click="examine">审核通过</el-button>
           </div>
         </zj-page-container>
       </el-dialog>
@@ -65,10 +66,11 @@ import {
   goodsPurchaseRetCodeListExport
 } from '@/api/merchandisePurchaseReturn.js'
 import form_ty from '../mixins/form_ty'
-import storage_table from '../mixins/storage_table'
+import out_storage_table from '../mixins/out_storage_table'
+import out_storage_goods from '../mixins/out_storage_goods'
 export default {
   components: { TemplatePage },
-  mixins: [import_mixin, operation_mixin, form_ty, storage_table],
+  mixins: [import_mixin, operation_mixin, form_ty, out_storage_table, out_storage_goods],
   data() {
     return {
       pageType: 'list',
@@ -86,14 +88,29 @@ export default {
       recordSelected: [],
       /** 表单变量 */
       formDialogType: 0,
-      formDialogTitles: ['新增退货单', '编辑退货单', '退货单详情'],
+      formDialogTitles: ['新增退货单', '编辑退货单', '退货单详情', '审核退货单'],
       formDialog: false,
       appraise_status: '',
       formData: {
+        companyWechatId: '',
+        companyWechatName: '',
+        examineBy: '',
+        examineTime: '',
         fileUrl: [],
-        items: []
+        goodsPurchaseId: '',
+        items: [],
+        remark: '',
+        status: '',
+        submitBy: '',
+        submitTime: '',
+        totalAmount: 0,
+        totalQty: 0,
+        venderId: '',
+        venderName: '',
+        codeInfoList: []
       },
-      activeName: 'goodsInfo'
+      activeName: 'goodsInfo',
+      goods_material_id: ''
     }
   },
   computed: {
@@ -106,6 +123,7 @@ export default {
               this.optionsEvensAuth('add', {
                 click: () => {
                   this.formDialog = true
+                  this.openForm()
                 }
               })
             ]
@@ -160,10 +178,20 @@ export default {
     selectionChange(data) {
       this.recordSelected = data
     },
+    // 打开创建弹窗
+    openForm() {
+      this.getGysList()
+    },
     changePageType() {},
     handleClose() {
       this.formDialog = false
-    }
+    },
+    // 保存
+    save() {},
+    // 提交
+    submit() {},
+    // 审核
+    examine() {}
   }
 }
 </script>

+ 73 - 6
src/views/salesPurchasing/mixins/form_ty.js

@@ -1,10 +1,12 @@
-import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
-import ImageUpload from '@/components/file-upload'
+import { required } from '@/components/template/rules_verify.js'
 import { listPageV2 } from '@/api/auxiliaryFittings/supplier'
+import { goodsPurchaseList, goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
+import ImageUpload from '@/components/file-upload'
 export default {
   data() {
     return {
-      gysList: []
+      gysList: [],
+      cgrkOrder: []
     }
   },
   computed: {
@@ -62,8 +64,18 @@ export default {
                           onChange={val => {
                             if (val) {
                               this.formData['venderName'] = this.gysList.find(item => item.venderId == val).venderName
+                              if (!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)) {
+                                this.cgrkOrder = []
+                                this.formData.items = []
+                                this.getCgrkOrder()
+                              }
                             } else {
                               this.formData['venderName'] = ''
+                              if (!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name)) {
+                                this.cgrkOrder = []
+                                this.formData.items = []
+                                this.formData.goodsPurchaseId = ''
+                              }
                             }
                           }}
                         >
@@ -77,7 +89,7 @@ export default {
                   {!!~['merchandisePurchaseReturn'].indexOf(this?.$route?.name) ? (
                     <el-descriptions-item label="采购入库单">
                       <div class="redbordererr">
-                        <el-form-item label="" lebel-width="0px" prop={`venderId`} rules={required}>
+                        <el-form-item label="" lebel-width="0px" prop={`goodsPurchaseId`} rules={required}>
                           <el-select
                             style="width:100%"
                             value={this.formData.goodsPurchaseId}
@@ -86,9 +98,52 @@ export default {
                             }}
                             placeholder="请选择"
                             disabled={!!~['SAVE', 'WAIT', 'OK', 'FAIL'].indexOf(this.formData.status)}
+                            filterable={true}
+                            clearable={true}
+                            onChange={val => {
+                              this.formData.items = []
+                              if (val) {
+                                goodsPurchaseDetail({ id: val }).then(res => {
+                                  this.formData.items = res.data.items.map(item => ({
+                                    brandId: item.brandId,
+                                    brandName: item.brandName,
+                                    mainId: item.mainId,
+                                    mainName: item.mainName,
+                                    smallId: item.smallId,
+                                    smallName: item.smallName,
+                                    goodsMaterialId: item.goodsMaterialId,
+                                    goodsMaterialName: item.goodsMaterialName,
+                                    specsName: item.specsName,
+                                    unit: item.unit,
+                                    insideQty: item.insideQty,
+                                    outQty: item.outQty,
+                                    partsQty: item.partsQty,
+                                    qty: item.qty,
+                                    price: item.price,
+                                    amount: item.amount,
+                                    stockQty: item.stockQty,
+                                    retQty: '',
+                                    retInsideQty: '',
+                                    retOutQty: '',
+                                    retPartsQty: '',
+                                    insideCodeQty: '',
+                                    outCodeQty: '',
+                                    partsCodeQty: '',
+                                    retAmount: '',
+                                    details: {}
+                                  }))
+                                })
+                              }
+                            }}
                           >
-                            {[].map(item => (
-                              <el-option key={item.id} label={item.label} value={item.id}></el-option>
+                            {this.cgrkOrder.map(item => (
+                              <el-option
+                                key={item.id}
+                                label={`${item.id} | 销售金额:${item.totalAmount || '-'} | 入库时间:${
+                                  item.examineTime || '-'
+                                }`}
+                                value={item.id}
+                              ></el-option>
                             ))}
                           </el-select>
                         </el-form-item>
@@ -183,6 +238,18 @@ export default {
       }).then(res => {
         this.gysList = res.data.records
       })
+    },
+    getCgrkOrder() {
+      if (this.formData.venderId) {
+        goodsPurchaseList({
+          pageNum: 1,
+          pageSize: -1,
+          params: [{ param: 'a.vender_id', compare: '=', value: this.formData.venderId }]
+        }).then(res => {
+          this.cgrkOrder = res.data.records
+          console.log(res.data.records)
+        })
+      }
     }
   }
 }

+ 228 - 0
src/views/salesPurchasing/mixins/out_storage_goods.js

@@ -0,0 +1,228 @@
+import { required } from '@/components/template/rules_verify.js'
+export default {
+  data() {
+    return {}
+  },
+  computed: {
+    storage_goods() {
+      return [
+        {
+          columnAttributes: {
+            label: '品牌',
+            prop: 'brandName',
+            width: 160
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品大类',
+            prop: 'mainName',
+            width: 160
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品小类',
+            prop: 'smallName',
+            width: 160
+          }
+        },
+        {
+          columnAttributes: {
+            label: '商品名称',
+            prop: 'goodsMaterialName',
+            width: 160
+          }
+        },
+        {
+          columnAttributes: {
+            label: '规格型号',
+            prop: 'specsName',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '单位',
+            prop: 'unit'
+          },
+          render: (h, { row, column, index }) => {
+            return <div style="padding:0 6px">{{ C: '整套', I: '单个' }[row[column.columnAttributes.prop]] || ''}</div>
+          }
+        },
+        // --------------------
+        {
+          columnAttributes: {
+            label: '退货数量',
+            prop: 'retQty',
+            width: 160
+          },
+          render: (h, { row, column, index }) => {
+            return this.formDialogType == 0 ? (
+              <div class="redbordererr">
+                <el-form-item
+                  label=""
+                  lebel-width="0px"
+                  prop={`items.${index}.${column.columnAttributes.prop}`}
+                  rules={required}
+                >
+                  <el-input
+                    value={row[column.columnAttributes.prop]}
+                    onInput={val => {
+                      if (Number(val) > Number(row.qty)) {
+                        row[column.columnAttributes.prop] = Number(row.qty)
+                      } else {
+                        row[column.columnAttributes.prop] = val ? Number(val) : ''
+                      }
+                      row.retAmount = (row[column.columnAttributes.prop] * Number(row.price)).toFixed(2)
+                      row.retInsideQty =
+                        parseInt(Number(row.insideQty) / Number(row.qty)) * Number(row[column.columnAttributes.prop])
+                      row.retOutQty =
+                        parseInt(Number(row.outQty) / Number(row.qty)) * Number(row[column.columnAttributes.prop])
+                      row.retPartsQty =
+                        parseInt(Number(row.partsQty) / Number(row.qty)) * Number(row[column.columnAttributes.prop])
+                    }}
+                    type="number"
+                    placeholder="请输入"
+                  ></el-input>
+                </el-form-item>
+              </div>
+            ) : (
+              <div style="padding:0 6px">{row[column.columnAttributes.prop]}</div>
+            )
+          }
+        },
+        {
+          columnAttributes: {
+            label: '退货内机数量',
+            prop: 'retInsideQty',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '退货外机数量',
+            prop: 'retOutQty',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '退货配件数量',
+            prop: 'retPartsQty',
+            width: 120
+          }
+        },
+
+        {
+          columnAttributes: {
+            label: '导入内机条码数量',
+            prop: 'insideCodeQty',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '导入外机条码数量',
+            prop: 'outCodeQty',
+            width: 120
+          }
+        },
+        {
+          columnAttributes: {
+            label: '导入配件条码数量',
+            prop: 'partsCodeQty',
+            width: 120
+          }
+        },
+
+        {
+          columnAttributes: {
+            label: '退款金额',
+            prop: 'retAmount',
+            width: 160
+          }
+        },
+        // ------------------
+        {
+          columnAttributes: {
+            label: '采购数量',
+            prop: 'qty',
+            width: 160
+          }
+        },
+        {
+          columnAttributes: {
+            label: '内机数量',
+            prop: 'insideQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '外机数量',
+            prop: 'outQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '配件数量',
+            prop: 'partsQty'
+          }
+        },
+        {
+          columnAttributes: {
+            label: '采购价格',
+            prop: 'price',
+            width: 160
+          }
+        },
+        {
+          columnAttributes: {
+            label: '采购金额',
+            prop: 'amount',
+            width: 160
+          }
+        },
+        {
+          columnAttributes: {
+            label: '库存数量',
+            prop: 'stockQty'
+          }
+        },
+        ...(() => {
+          if (this.formDialogType < 2) {
+            return [
+              {
+                columnAttributes: {
+                  label: '操作',
+                  fixed: 'right',
+                  width: 140
+                },
+                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(goodsPurchaseItemImportCode, '导入条码', { purchaseItemId: row.id })
+                      ) : null}
+                    </div>
+                  )
+                }
+              }
+            ]
+          }
+          return []
+        })()
+      ]
+    }
+  },
+  methods: {}
+}

+ 102 - 0
src/views/salesPurchasing/mixins/out_storage_table.js

@@ -0,0 +1,102 @@
+import { goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
+import { commonTemplateDownload } from '@/api/common.js'
+export default {
+  data() {
+    return {}
+  },
+  computed: {
+    formItems2() {
+      return [
+        {
+          md: 24,
+          isShow: true,
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '',
+            prop: '',
+            'label-width': '0px'
+          },
+          render: (h, { props, onInput }) => {
+            var { value } = props
+            return (
+              <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 ? (
+                        <div style="margin-bottom:10px">
+                          <el-button type="primary" onClick={this.addCodeInfo} disabled={this.isEditIndex != -1}>
+                            添加
+                          </el-button>
+                        </div>
+                      ) : null,
+                      <zj-table
+                        columns={[]}
+                        tableData={this.formData.codeInfoList}
+                        tableAttributes={{
+                          size: 'mini',
+                          border: true
+                        }}
+                      />
+                    ]
+                  : null}
+              </div>
+            )
+          }
+        }
+      ]
+    }
+  },
+  watch: {
+    activeName(newVal) {
+      this.isEditIndex = -1
+      if (newVal == 'codeInfo') {
+        // 获取单据下的条码
+        // this.getGoodsPurchaseCodeList()
+      } else {
+        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: {} }))
+          //   })
+          // })
+        }
+        // 清空条码数据列表
+        this.formData.codeInfoList = []
+      }
+    }
+  },
+  methods: {
+    domlMban() {
+      // commonTemplateDownload({ name: '商品采购条码模板.xlsx' }, `${this.$route.meta.title}`)
+      //   .then(res => {
+      //     this.$message({
+      //       message: '下载成功',
+      //       type: 'success'
+      //     })
+      //   })
+      //   .catch(err => {
+      //     this.$message.error('下载失败')
+      //   })
+    }
+  }
+}

+ 1 - 1
src/views/salesPurchasing/mixins/storage_codes.js

@@ -1,4 +1,4 @@
-import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import { required } from '@/components/template/rules_verify.js'
 import {
   goodsPurchaseItemAddCode,
   goodsPurchaseCodeList,

+ 5 - 3
src/views/salesPurchasing/mixins/storage_goods.js

@@ -1,8 +1,8 @@
-import { required, mobileRequired, mobile } from '@/components/template/rules_verify.js'
+import { required } from '@/components/template/rules_verify.js'
 import { getBrandList } from '@/api/miniapp'
 import { getClassifyList } from '@/api/goods'
 import { goodsMaterialList, goodsMaterialDetail } from '@/api/commercialMaterial.js'
-import { goodsPurchaseDetail, goodsPurchaseItemImportCode } from '@/api/goodsPurchasedStored.js'
+import { goodsPurchaseItemImportCode } from '@/api/goodsPurchasedStored.js'
 export default {
   data() {
     return {
@@ -444,7 +444,9 @@ export default {
         pageSize: -1,
         params: []
       }).then(res => {
-        this.goodsMaterialList = res.data.records.map(item => ({ ...item, details: {} }))
+        this.goodsMaterialList = res.data.records
+          .filter(item => item.isVirtyual !== 'YES')
+          .map(item => ({ ...item, details: {} }))
       })
     },
     shanchujichu(row, num) {

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

@@ -1,4 +1,4 @@
-import { goodsPurchaseDetail, goodsPurchaseItemImportCode } from '@/api/goodsPurchasedStored.js'
+import { goodsPurchaseDetail } from '@/api/goodsPurchasedStored.js'
 import { commonTemplateDownload } from '@/api/common.js'
 export default {
   data() {