From eb7366f400867d3f401fe60f06d848d6d1448457 Mon Sep 17 00:00:00 2001
From: riku <risaku@163.com>
Date: 星期一, 17 十月 2022 17:41:56 +0800
Subject: [PATCH] 2022.10.17
---
pages/m_user/base_c/c_company-info/c_company-info.js | 119 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 113 insertions(+), 6 deletions(-)
diff --git a/pages/m_user/base_c/c_company-info/c_company-info.js b/pages/m_user/base_c/c_company-info/c_company-info.js
index ef96e39..7788910 100644
--- a/pages/m_user/base_c/c_company-info/c_company-info.js
+++ b/pages/m_user/base_c/c_company-info/c_company-info.js
@@ -1,6 +1,16 @@
// pages/m_user/base_c/c_company-info/c_company-info.js
+import {companyLedger} from '../../../../data/sceneInfo'
+import userservice from '../../../../service/userservice'
+import authservice from '../../../../service/authservice'
+import ledgerservice from "../../../../service/ledgerservice"
+import b_inputCheck from '../../../../base/behaviors/b_inputCheck'
+import b_uploadLedger from '../../../m_ledger/behaviors/b_uploadLedger'
+import b_loadingToast from '../../../../base/behaviors/b_loadingToast'
+
+const app = getApp()
Component({
+ behaviors: [b_inputCheck, b_uploadLedger, b_loadingToast],
options: {
addGlobalClass: true,
},
@@ -11,6 +21,10 @@
submitText: {
type: String,
value: '鎻愪氦'
+ },
+ sceneType: {
+ type: String,
+ value: '1'
},
},
/**
@@ -29,47 +43,59 @@
sceneTypeIndex: 0,
msg: [{
name: "浼佷笟鍚嶇О",
- id: "department",
+ id: "ciName",
input: true,
value: '',
noValue: false,
},
{
name: "浼佷笟鍦板潃",
- id: "address",
+ id: "ciAddress",
input: true,
value: '',
noValue: false,
},
{
name: "淇$敤浠g爜",
- id: "code",
+ id: "ciOrgCode",
input: true,
value: "",
noValue: false,
},
{
name: "娉曚汉",
- id: "contract",
+ id: "ciJuridicalPerson",
input: true,
value: '',
noValue: false,
},
{
name: "鑱旂郴浜�",
- id: "contract",
+ id: "ciContactName",
input: true,
value: '',
noValue: false,
},
{
name: "鑱旂郴鏂瑰紡",
- id: "contract",
+ id: "ciTelephone",
input: true,
value: '',
noValue: false,
},
],
+ },
+
+ ready() {
+ this.setData({
+ loadingText: '涓婁紶涓�',
+ loadCompleteText: '涓婁紶瀹屾垚'
+ })
+
+ this.setData({
+ ledger: companyLedger[this.data.sceneType]
+ })
+ this.getCompanyInfo()
},
/**
@@ -83,6 +109,87 @@
})
},
+ //鑾峰彇浼佷笟淇℃伅
+ getCompanyInfo() {
+ var that = this
+ userservice.getBaseInfo(app.globalData.accessToken.userId, {
+ success(data) {
+ const msg = that.data.msg
+ if (data.company != null) {
+ const info = data.company
+ msg[0].value = info.ciName
+ msg[1].value = info.ciAddress
+ msg[2].value = info.ciOrgCode
+ msg[3].value = info.ciJuridicalPerson
+ msg[4].value = info.ciContactName
+ msg[5].value = info.ciTelephone
+ that.setData({
+ msg, info
+ })
+ }
+ }
+ }, app.globalData.accessToken.openId)
+ ledgerservice.getLedgerDetail(
+ app.globalData.accessToken.userId, that.data.ledger.ledgerSubTypeId, that.data.ledger.sceneType, undefined, {
+ success(res) {
+ if (res.length > 0) {
+ let detail = res[0]
+ if (detail.upLoad) {
+ let imgFiles = [{
+ url: detail.path1[0],
+ loading: false
+ }]
+ that.setData({
+ imgFiles
+ })
+ }
+ }
+ }
+ })
+ },
+
+ //鎻愪氦浼佷笟淇℃伅
+ _submit() {
+ var that = this
+ this.setData({loading: true})
+ authservice.authCompany(app.globalData.accessToken.openId, this.data.info, {
+ success(res) {
+ that.submintLedger()
+ },
+ })
+ },
+
+ //鎻愪氦鍥剧墖淇℃伅
+ submintLedger() {
+ if (this.data.imgFiles.length == 0) {
+ this.setData({
+ loading: false
+ })
+ wx.navigateBack({
+ delta: 1,
+ })
+ return
+ }
+ if (this.data.imgFiles[0].url.indexOf('http') != -1) {
+ wx.downloadFile({
+ url: this.data.imgFiles[0].url,
+ success: (res) => {
+ const imgPath = res.tempFilePath
+ this.data.imgFiles[0].url = imgPath
+ this._uploadLedger()
+ }
+ })
+ } else {
+ this._uploadLedger()
+ }
+ },
+
+ //涓婁紶瀹屾垚鍚庯紝鍥為��
+ _success(res) {
+ wx.navigateBack({
+ delta: 1,
+ })
+ }
}
})
\ No newline at end of file
--
Gitblit v1.9.3