From 31871ca836e6fcbea9b1c54e2ec15f49667bf093 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 23 十二月 2022 14:14:04 +0800
Subject: [PATCH] 2022-12-23

---
 src/tabviews/custom/components/module/voucher/index.jsx |   98 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 88 insertions(+), 10 deletions(-)

diff --git a/src/tabviews/custom/components/module/voucher/index.jsx b/src/tabviews/custom/components/module/voucher/index.jsx
index 0abd8f6..2fafcd4 100644
--- a/src/tabviews/custom/components/module/voucher/index.jsx
+++ b/src/tabviews/custom/components/module/voucher/index.jsx
@@ -1,32 +1,52 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
+import { Button, Select, Input, DatePicker } from 'antd'
 // import { EditOutlined, ToolOutlined, DeleteOutlined, FontColorsOutlined } from '@ant-design/icons'
 
+import Api from '@/api'
+import asyncComponent from '@/utils/asyncComponent'
 // import MKEmitter from '@/utils/events.js'
-
 import './index.scss'
+
+const VoucherTable = asyncComponent(() => import('./voucherTable'))
 
 class VoucherModule extends Component {
   static propTpyes = {
-    BID: PropTypes.any,              // 鐖剁骇Id
     config: PropTypes.object,        // 缁勪欢閰嶇疆淇℃伅
   }
 
   state = {
-    BID: '',                   // 涓昏〃ID
-    config: null,              // 鍥捐〃閰嶇疆淇℃伅
-    loading: false,            // 鏁版嵁鍔犺浇鐘舵��
-    data: null,                // 鏁版嵁
-    searchkey: null,           // 杩囨护鏉′欢
+    BID: '',
+    type: '',
+    config: null,
+    loading: false,
+    data: null,
+    searchkey: null,
+    disableAdd: true,
+    disableSave: true,
+    typeOptions: []
   }
 
   UNSAFE_componentWillMount () {
-    const { config, BID } = this.props
+    const { config } = this.props
+
+    let BID = ''
+    let BData = ''
+
+    if (config.wrap.supModule) {
+      BData = window.GLOB.CacheData.get(config.wrap.supModule)
+    } else {
+      BData = window.GLOB.CacheData.get(config.$pageId)
+    }
+    if (BData) {
+      BID = BData.$BID || ''
+    }
 
     this.setState({
       config: fromJS(config).toJS(),
       BID: BID || '',
+      type: config.wrap.type
     }, () => {
       this.loadData()
     })
@@ -50,15 +70,73 @@
   }
 
   loadData = () => {
+    let param = {
+      func: 's_get_fcc_account_data'
+    }
+    Api.genericInterface(param)
+  }
+
+  triggeradd = () => {
+    
+  }
+
+  triggersave = () => {
+
+  }
+
+  triggerprint = () => {
 
   }
 
   render() {
-    const { config } = this.state
+    const { config, disableSave, disableAdd, typeOptions, data, type } = this.state
 
     return (
       <div className="menu-voucher-wrap" style={config.style}>
-        
+        <div className="voucher-header">
+          <Button className="system-background header-btn" disabled={disableAdd} onClick={this.triggeradd}>鏂板</Button>
+          <Button className="system-background header-btn" disabled={disableSave} onClick={this.triggersave}>淇濆瓨</Button>
+          <Button className="system-background header-btn" disabled={disableSave} onClick={this.triggerprint}>鎵撳嵃</Button>
+          <Button className="system-background header-btn" disabled={disableSave} onClick={this.triggerprint}>瀵煎叆</Button>
+          <Button className="system-background header-btn" disabled={disableSave} onClick={this.triggerprint}>瀵煎嚭</Button>
+        </div>
+        {type === 'edit' ? <div className="voucher-body">
+          <div className="pre-wrap">
+            <div className="voucher-code">
+              <Select>
+                {typeOptions.map(option =>
+                  <Select.Option value={option.value}>{option.label}</Select.Option>
+                )}
+              </Select>
+              <Input autoComplete="off" /> 鍙�
+            </div>
+            <div className="voucher-date">
+              鏃ユ湡锛�<DatePicker onChange={this.onChange}/>
+            </div>
+            <div className="voucher-affix">
+              闄勫崟鎹� <Input autoComplete="off" /> 寮�
+              <Button type="link" className="" onClick={this.triggerprint}>闄勪欢</Button>
+              <Button type="link" className="" onClick={this.triggerprint}>澶囨敞</Button>
+            </div>
+          </div>
+          <VoucherTable config={config} data={data}/>
+        </div> : null}
+        {type === 'check' ? <div className="voucher-body">
+          <div className="pre-wrap">
+            <div className="voucher-code">
+              璁� 1 鍙�
+            </div>
+            <div className="voucher-date">
+              鏃ユ湡锛�2022-02-24
+            </div>
+            <div className="voucher-affix">
+              闄勫崟鎹� 2 寮�
+              <Button type="link" className="" onClick={this.triggerprint}>闄勪欢</Button>
+              <Button type="link" className="" onClick={this.triggerprint}>澶囨敞</Button>
+            </div>
+          </div>
+          <VoucherTable config={config} data={data}/>
+        </div> : null}
       </div>
     )
   }

--
Gitblit v1.8.0