You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

496 lines
27 KiB

<?php
include "../header.php";
require_once('./conn.php');
//買賣1、2、3,安裝5、6 (4跟7很少有)
if(isset($_GET['id']) && $_GET['id']!=""){
try{
$id = $_GET['id'];
$sql_str = "SELECT pricereview_main.*, pricereview_pay.*, pricereview_item.note, pricereview_item.item_qty, account.name as accountname, account.id as accountid
FROM pricereview_main
JOIN pricereview_pay ON pricereview_main.id = pricereview_pay.mid
JOIN pricereview_item ON pricereview_main.id = pricereview_item.mid
JOIN account ON pricereview_main.person = account.accountid
WHERE pricereview_main.id = :id AND pricereview_item.item_group = 'A' ORDER BY pay_kind ASC";
// $stmt = $conn->prepare($sql_str);
// $stmt->bindParam(':id',$id);
// $stmt->execute();
// $contracts = $stmt->fetchAll(PDO::FETCH_ASSOC);
$sql_str = "SELECT contract_new_apply.*,
contract_new_apply_pays.pay_kind, contract_new_apply_pays.pay_scale, contract_new_apply_pays.pay_amount, contract_new_apply_pays.pay_period, contract_new_apply_pays.condition_date
FROM contract_new_apply
JOIN contract_new_apply_pays ON contract_new_apply.id = contract_new_apply_pays.contract_apply_id
WHERE contract_new_apply.mid = :id";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':id', $id);
$stmt->execute();
$contracts = $stmt->fetchAll(PDO::FETCH_ASSOC);
$contract = $contracts[0];
$contract_apply_id = $contract['id'];
if(($contract['status'] !== "YY" && $user_id != 'M0107') && $user_id != 'M0174'){
echo '<script type="text/javascript">
alert("非法訪問。");
window.history.back();
</script>';
exit;
}
$sql_str = "SELECT * FROM hope_elevator_customer WHERE vol_no = :vol_no";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':vol_no', $contract['contractno']);
$stmt->execute();
$customer = $stmt->fetchAll(PDO::FETCH_ASSOC);
if(count($customer) <= 0 ){
echo "<script>
alert('資料不齊或合約書已生成過。');
window.history.back();
</script>";
exit;
}
$buyArr = [];
$buyNo2Pay = false;
$buy_total_price = 0;
$installArr = [];
$install_total_price = 0;
// $noteArr = explode(",", $contracts[0]['note']);
$noteArr = array(1,1,1,1,1);
$qty = $contracts[0]['total_items'];
foreach($contracts as $idx=>$amount){
$isset = false;
if($amount['pay_kind']==5 || $amount['pay_kind']==6){
if($amount['pay_scale'] >= 0){
$install_total_price = $install_total_price + $amount['pay_amount'];
$installArr[] = ['installment'=> $amount['pay_kind'], 'scale'=> $amount['pay_scale'], 'amount'=> $amount['pay_amount'], 'pay_period'=>$amount['pay_period']];
}
}
if($amount['pay_kind']==1 || $amount['pay_kind']==2 || $amount['pay_kind']==3){
if($amount['pay_scale'] > 0){
$buy_total_price = $buy_total_price + $amount['pay_amount'];
foreach($buyArr as $buy){
if($buy['installment'] == $amount['pay_kind']){
$isset = true;
}
}
if(!$isset){{
$buyArr[] = ['installment'=>$amount['pay_kind'], 'scale'=>$amount['pay_scale'], 'amount'=>$amount['pay_amount'], 'pay_period'=>$amount['pay_period']];
}
if($amount['pay_kind'] == 2){
$buyNo2Pay = true;
}
}
}
}
}
$sql_str = "SELECT file_name FROM contract_apply_files WHERE contract_id = :contract_id AND deleted_at IS NULL";
$sql_str = "SELECT contract_apply_files.*, contract_new_apply.id as apply_id FROM contract_apply_files LEFT JOIN contract_new_apply ON contract_apply_files.contract_id = contract_new_apply.id WHERE contract_new_apply.mid = :mid AND contract_apply_files.deleted_at IS NULL";
$stmt = $conn->prepare($sql_str);
$stmt->bindParam(':mid', $id);
$stmt->execute();
$files = $stmt->fetchAll(PDO::FETCH_ASSOC);
$files_count = count($files);
}
catch (PDOException $e ){
die("ERROR!!!: ". $e->getMessage());
}
}
?>
<link rel="stylesheet" href="./styles/style.css">
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.5.0/axios.min.js" integrity="sha512-aoTNnqZcT8B4AmeCFmiSnDlc4Nj/KPaZyB5G7JnOnUEkdNpCZs1LCankiYi01sLTyWy+m2P+W4XM+BuQ3Q4/Dg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.3.3/purify.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/1.3.3/html2canvas.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
<main x-data="contractDownload">
<div class="sidebar">
<ul>
<button :class="isbuyShow ? 'active' : ''" @click="isbuyShow = true">電梯買賣合約書</button>
<button :class="!isbuyShow ?'active' : ''" @click="isbuyShow = false">電梯安裝合約書</button>
<a href="../mkt/pricereview-index.php?function_name=pricereview&<?php echo $token_link; ?>">回列表</a>
</ul>
</div>
<div class="inputDiv" x-show="isbuyShow && isBuyInputIng">
<!-- <label for="">
<p>交貨期限(日)</p>
<input type="number" x-model="buyfill1" @keyup="sendBuyInputKeyupFn($event)" />
</label> -->
<?php if($buyNo2Pay){ ?>
<!-- <label for="">
<p>第二期款交貨期限(日)</p>
<input type="number" x-model="buyfill2">
</label> -->
<?php } ?>
<!-- <label for="">
<p>附件數</p>
<select x-model="buyAffix">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</label> -->
<label for="">
<button @click="sendBuyInputFn()">生成買賣合約書</button>
</label>
</div>
<div class="contract-material-component" x-show="isbuyShow && !isBuyInputIng">
<div class="btn-list">
<label for="standardBuyBtn">
<p>制式合約</p>
<input type="checkbox" class="scorll" x-model="toggleBuyStandard">
<!-- <input type="radio" checked id="standardBuyBtn" name="standardBuyBtn" @change="toggleBuyStandard = true" /> -->
</label>
<!-- <label for="noStandardBuyBtn">
<input type="radio" id="noStandardBuyBtn" name="standardBuyBtn" @change="toggleBuyStandard = false" />
非制式合約
</label> -->
</div>
<button @click="isBuyInputIng = true" class="rebtn">重新輸入</button>
<button @click="exportFn(1)" class="prviewbtn">預覽</button>
<div class="contract" id="noStandardBuyContract" x-show="!toggleBuyStandard">
<table class="my-2 contract" x-ref="contract1" id="contract1">
<tr >
<td class="center"><h2 style="text-align:center">電梯買賣合約書</h2></td>
</tr>
<tr >
<td colspan="1">
合約書編號:<article x-html="onstandardViewData.partyAcontractno.plaintext"></article>
</td>
</tr>
<tr>
<td><div style="margin-left: 100px"><p x-html="onstandardViewData.partyA.plaintext">一二營造有限公司 </p></div><div style="margin-left: auto;margin-right:200px">(即買方,以下簡稱為甲方)</div></td>
</tr>
<tr>
<td >立合約書人</td>
</tr>
<tr>
<td ><div style="margin-left: 100px"><p>永佳捷科技股份有限公司 </p></div><div style="margin-left: auto;margin-right:200px">(即賣方,以下簡稱為乙方)</div></td>
</tr>
<tr :class="buyonstandardViewData.illustrate.editshow ? 'mouseover' : '' " x-on:mouseover="mouseover('illustrate', false)" x-on:mouseout="mouseout('illustrate')">
<td>
<span x-html='buydata.illustrate.plaintext'></span>
<div class="buttons" x-show="buyonstandardViewData.illustrate.editshow" x-cloak>
<button class="edit" @click="modelshowEditFn('更新合約書內容', 'illustrate', false, false)"><i class="glyphicon glyphicon-pencil"></i></button>
<button class="delete"><i class="glyphicon glyphicon-trash"></i></button>
</div>
</td>
</tr>
<template x-for="(item, idx) in buyonstandardViewData.list.plaintext" :key="item.id">
<tr :class="buyonstandardViewData.list.plaintext[idx].editshow ? 'mouseover' : '' " @mouseover="mouseoverlist(idx, false)" @mouseout="mouseoutlist(idx)">
<td class="list">
<div class="buttons" x-show="buyonstandardViewData.list.plaintext[idx].editshow" x-cloak>
<button class="edit" @click="modelshowEditFn('update contract list', idx, true, false)"><i class="glyphicon glyphicon-pencil"></i></button>
<button class="add" @click="modelshowAddUpFn(idx, false)"><i class="glyphicon glyphicon-arrow-up"></i></button>
<button class="add" @click="modelshowAddDownFn(idx, false)"><i class="glyphicon glyphicon-arrow-down"></i></button>
<button class="delete" @click="deleteEditor(idx, false)"><i class="glyphicon glyphicon-trash"></i></button>
</div>
<span x-text="'第' + chineseNumbers(idx+1) + '條'"></span><article x-html="buyonstandardViewData.list.plaintext[idx].text"></article>
</td>
</tr>
</template>
</table>
</div>
<div class="contract" id="standardBuyContract" x-show="toggleBuyStandard">
<table class="my-2 contract" id="contract0">
<tr >
<td class="center"><h2 style="text-align:center">電梯買賣合約書</h2></td>
</tr>
<tr >
<td colspan="1">
合約書編號:<article x-html="data.partyAcontractno.plaintext"></article>
</td>
</tr>
<tr>
<td><div style="margin-left: 100px"><p x-html="data.partyA.plaintext"> </p></div><div style="margin-left: auto;margin-right:200px">(即買方,以下簡稱為甲方)</div></td>
</tr>
<tr>
<td >立合約書人</td>
</tr>
<tr>
<td ><div style="margin-left: 100px"><p>永佳捷科技股份有限公司 </p></div><div style="margin-left: auto;margin-right:200px">(即賣方,以下簡稱為乙方)</div></td>
</tr>
<tr :class="buystandardData.illustrate.editshow ? 'mouseover' : '' ">
<td>
<span x-html='buystandardData.illustrate.plaintext'></span>
</td>
</tr>
<template x-for="(item, idx) in buystandardData.list.plaintext" :key="item.id">
<tr :class="buystandardData.list.plaintext[idx].editshow ? 'mouseover' : '' " >
<td class="list">
<span x-text="'第' + chineseNumbers(idx+1) + '條'"></span>
<article x-html="buystandardData.list.plaintext[idx].text"></article>
</td>
</tr>
</template>
</table>
</div>
</div>
<div class="contract-model" x-show="modelshow" x-cloak>
<div class="contract-back"></div>
<div class="contract-content">
<div class="model-header"><span x-text='modelText'></span><i @click='modelcloseFn()' class="glyphicon glyphicon-remove"></i></div>
<div class="content">
<textarea name="content" id="editor" x-ref="editor" ></textarea>
<input type="submit" value="update" @click='updateEditor()' />
</div>
</div>
</div>
<div class="inputDiv" x-show="!isbuyShow && isInstallInputIng">
<!-- <label for="">
<p>安裝試車期限(日)</p>
<input type="number" x-model="installfill1" @keyup="sendInstallInputKeyupFn($event)" />
</label>
<label for="">
<p>免費保養月數(月)</p>
<input type="number" x-model="installfill2" @keyup="sendInstallInputKeyupFn($event)" />
</label> -->
<!-- <label for="">
<p>附件數</p>
<select x-model="installAffix" @keyup="sendInstallInputKeyupFn($event)">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select>
</label> -->
<label for="">
<button @click="sendInstallInputFn()">生成安裝合約書</button>
</label>
</div>
<div class="contract-install-component" x-show="!isbuyShow && !isInstallInputIng" x-cloak >
<div class="btn-list">
<label for="standardBtn">
<p>制式合約</p>
<input type="checkbox" class="scorll" x-model="toggleBuyStandard">
<!-- <input type="radio" checked id="standardBtn" name="standardBtn" @change="toggleInstallStandard = true" /> -->
</label>
<!-- <label for="noStandardBtn">
<input type="radio" id="noStandardBtn" name="standardBtn" @change="toggleInstallStandard = false" />
非制式合約
</label> -->
</div>
<button @click="isInstallInputIng = true" class="rebtn">重新輸入</button>
<button @click="exportFn(2)" class="prviewbtn">預覽</button>
<div class="contract" id="noStandardContract" x-show="!toggleInstallStandard">
<table class="my-2 contract" x-ref="contract1" id="contract1">
<tr >
<td class="center"><h2 style="text-align:center">電梯安裝合約書</h2></td>
</tr>
<tr >
<td colspan="1">
合約書編號:<article x-html="onstandardViewData.partyAcontractno.plaintext"></article>
</td>
</tr>
<tr>
<td><div style="margin-left: 100px"><p x-html="onstandardViewData.partyA.plaintext">一二營造有限公司 </p></div><div style="margin-left: auto;margin-right:200px">(即買方,以下簡稱為甲方)</div></td>
</tr>
<tr>
<td >立合約書人</td>
</tr>
<tr>
<td ><div style="margin-left: 100px"><p>永佳捷科技股份有限公司 </p></div><div style="margin-left: auto;margin-right:200px">(即賣方,以下簡稱為乙方)</div></td>
</tr>
<tr :class="onstandardViewData.illustrate.editshow ? 'mouseover' : '' " x-on:mouseover="mouseover('illustrate')" x-on:mouseout="mouseout('illustrate')">
<td>
<span x-html='onstandardViewData.illustrate.plaintext'></span>
<div class="buttons" x-show="onstandardViewData.illustrate.editshow" x-cloak>
<button class="edit" @click="modelshowEditFn('更新合約書內容', 'illustrate', false, true)"><i class="glyphicon glyphicon-pencil"></i></button>
<button class="delete"><i class="glyphicon glyphicon-trash"></i></button>
</div>
</td>
</tr>
<template x-for="(item, idx) in onstandardViewData.list.plaintext" :key="item.text">
<tr :class="onstandardViewData.list.plaintext[idx].editshow ? 'mouseover' : '' " @mouseover="mouseoverlist(idx)" @mouseout="mouseoutlist(idx)">
<td class="list">
<div class="buttons" x-show="onstandardViewData.list.plaintext[idx].editshow" x-cloak>
<button class="edit" @click="modelshowEditFn('update contract list', idx, true, true)"><i class="glyphicon glyphicon-pencil"></i></button>
<button class="add" @click="modelshowAddUpFn(idx)"><i class="glyphicon glyphicon-arrow-up"></i></button>
<button class="add" @click="modelshowAddDownFn(idx)"><i class="glyphicon glyphicon-arrow-down"></i></button>
<button class="delete" @click="deleteEditor(idx)"><i class="glyphicon glyphicon-trash"></i></button>
</div>
<span x-text="'第' + chineseNumbers(idx+1) + '條'"></span><article x-html="onstandardViewData.list.plaintext[idx].text"></article>
</td>
</tr>
</template>
</table>
</div>
<div class="contract" id="standardContract" x-show="toggleInstallStandard">
<table class="my-2 contract" id="contract0">
<tr >
<td class="center"><h2 style="text-align:center">電梯安裝合約書</h2></td>
</tr>
<tr >
<td colspan="1">
合約書編號:<article x-html="data.partyAcontractno.plaintext"></article>
</td>
</tr>
<tr>
<td><div style="margin-left: 100px"><p x-html="data.partyA.plaintext">一二營造有限公司 </p></div><div style="margin-left: auto;margin-right:200px">(即買方,以下簡稱為甲方)</div></td>
</tr>
<tr>
<td >立合約書人</td>
</tr>
<tr>
<td ><div style="margin-left: 100px"><p>永佳捷科技股份有限公司 </p></div><div style="margin-left: auto;margin-right:200px">(即賣方,以下簡稱為乙方)</div></td>
</tr>
<tr :class="standardData.illustrate.editshow ? 'mouseover' : '' ">
<td>
<span x-html='standardData.illustrate.plaintext'></span>
</td>
</tr>
<template x-for="(item, idx) in standardData.list.plaintext">
<tr :class="standardData.list.plaintext[idx].editshow ? 'mouseover' : '' " >
<td class="list">
<span x-text="'第' + chineseNumbers(idx+1) + '條'"></span>
<article x-html="standardData.list.plaintext[idx].text"></article>
</td>
</tr>
</template>
</table>
</div>
<form action="prviewPdf.php?id=<?php echo $id; ?>&<?php echo $token_link; ?>" id="form" method="post" x-ref="form" style="display:none">
<input type="hidden" name="contract_apply_id" id="contract_apply_id" value="<?php echo $contract_apply_id; ?>" />
<input type="hidden" name="list" id="prview-list" />
<input type="hidden" name="prviewType" id="prview-type" />
<input type="hidden" name="standardList" id="standard-prview-list" />
<input type="hidden" name="illustrate" id="illustrate" />
<input type="hidden" name="standardIllustrate" id="standard-illustrate" />
<input type="hidden" name="partyA" id="partyA" />
<input type="hidden" name="partyAcontractno" id="partyAcontractno" />
<input type="hidden" name="buystandard" x-model="toggleBuyStandard" />
<input type="hidden" name="installstandard" x-model="toggleInstallStandard" />
<input type="hidden" name="total_price" x-model="total_price" id="total_price" />
<input type="hidden" name="person" id="person" value="<?php echo $contract['accountname']; ?>" />
<input type="hidden" name="personid" id="personid" value="<?php echo $contract['accountid']; ?>" />
<input type="hidden" name="delivery_term" id="delivery_term" x-model="buyfill1" />
<input type="hidden" name="install_period" id="install_period" x-model="installfill1" />
<input type="hidden" name="free_maintainance" id="free_maintainance" x-model="installfill2" />
</form>
</div>
</main>
<!-- <script src="../ckeditor4/ckeditor.js"></script> -->
<script>
const partyAcompany = <?php echo json_encode($contract['customer']); ?>;
const partyAcontractno = <?php echo json_encode($contract['contractno']); ?>;
const partyAaddress = <?php echo json_encode($contract['contact_address']); ?>;
const totalPrice = <?php echo $contract['total_price']; ?>;
const totalInstallPrice = <?php echo $install_total_price; ?>;
const totalBuyPrice = <?php echo $buy_total_price; ?>;
const secondPayDeadline = <?php echo $contract['secondPayDeadline']; ?>;
const buyfill1 = <?php echo $contract['tradedeadline']; ?>;
const installfill1 = "<?php echo $contract['test_time']; ?>";
const installfill2 = "<?php echo $contract['freedeadline']; ?>";
const buyArr = [...<?php echo json_encode($buyArr); ?>];
const installArr = [...<?php echo json_encode($installArr); ?>];
let install_pay_text = '付款方式:<br> ';
let buy_pay_text = ''
const chineseArr = ['零','一','二','三','四','五','六','七']
const bigChineseArr = ['零','壹','貳','參','肆','伍','陸','柒','捌','玖','拾'];
const num = <?php echo $qty; ?>;
const people = <?php echo $noteArr[1]; ?>;
const floor = <?php echo $noteArr[2]; ?>;
const speed = <?php echo $noteArr[3]; ?>;
const buyAffix =' <?php echo $files_count; ?>';
console.log(buyAffix);
console.log(installArr);
buyArr.forEach((item, idx) => {
if(item.scale > 0){
if(item.installment == 1){
buy_pay_text = `${buy_pay_text}第${chineseArr[idx+1]}期款:合約簽定時,甲方應付合約定金新台幣&nbsp;${numberToChinese(item.amount)}&nbsp;元整(&nbsp;${numberWithCommas(item.amount)}&nbsp;)(含5%加值型營業稅)(${item.pay_period}天期票)。<br>`
}else if(item.installment == 2){
buy_pay_text = `${buy_pay_text}第${chineseArr[idx+1]}期款:合約簽訂後&nbsp;____&nbsp;天付第二期款新台幣&nbsp;${numberToChinese(item.amount)}&nbsp;元整(&nbsp;${numberWithCommas(item.amount)}&nbsp;)(含5%加值型營業稅)(${item.pay_period}天期票)。<br>`
}else if(item.installment == 3){
buy_pay_text = `${buy_pay_text}第${chineseArr[idx+1]}期款:產品貨到工地時應付新台幣&nbsp;${numberToChinese(item.amount)}&nbsp;元整(&nbsp;${numberWithCommas(item.amount)}&nbsp;)(&nbsp;含5%加值型營業稅)(${item.pay_period}天期票)。<br>`
}
}
});;
buy_pay_text += '以上期款若以票據支付時,發票人需為本合約甲方,票面金額同於各期應付款項,票期於各期付款日三十日內,票據須屬有效並得兌現。<br>乙方收款帳戶名稱:永佳捷科技股份有限公司;收款銀行:兆豐國際商業銀行(桃興分行);帳戶號碼:207-09-08688-2。'
buy_pay_text = buy_pay_text.replace(/\n/g, "").replace(/\s+/g, '').trim();
installArr.forEach((item,idx)=>{
if(item.scale > 0){
if(item.installment == 5){
install_pay_text = `${install_pay_text}第${chineseArr[idx+1]}期款:甲方應於安裝及試車完成後給付安裝費用&nbsp;${numberToChinese(item.amount)}&nbsp;元整(&nbsp;${numberWithCommas(item.amount)}&nbsp;)(含5%加值型營業稅)(${item.pay_period}天期票)。<br>`
}else if(item.installment == 6){
install_pay_text = `${install_pay_text}第二期款:甲方應於交車後給付&nbsp;${numberToChinese(item.amount)}&nbsp;元整(&nbsp;${numberWithCommas(item.amount)}&nbsp;)(含5%加值型營業稅)(${item.pay_period}天期票)。<br>`
}
}
})
install_pay_text += '以上期款若以票據支付時,發票人需為本合約甲方,票面金額同於各期應付款項,票期於各期付款日三十日內,票據須屬有效並得兌現。<br> 乙方收款帳戶名稱:永佳捷科技股份有限公司;收款銀行:兆豐國際商業銀行(桃興分行);帳戶號碼:207-09-08688-2。'
install_pay_text = install_pay_text.replace(/\n/g, "").replace(/\s+/g, '').trim();
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function numberToChinese(n) {
if (!/^(0|[1-9]\d*)(\.\d+)?$/.test(n)) return "Invalid number.";
let unit = "仟佰拾億仟佰拾萬仟佰拾元角分";
let str = "";
n += "00";
let pos = n.indexOf('.');
if (pos >= 0) {
n = n.substring(0, pos) + n.substr(pos + 1, 2);
}
unit = unit.substr(unit.length - n.length);
for (let i = 0; i < n.length; i++) {
str += '零壹貳參肆伍陸柒捌玖'.charAt(n.charAt(i)) + unit.charAt(i);
}
str = ('_' + str + '_');
return str.replace(/零(仟|佰|拾|角)/g, "零").replace(/(零)+/g, "零").replace(/零(萬|億|元)/g, "$1").replace(/(億)萬|壹(拾)/g, "$1$2").replace(/^元零?|零分/g, "").replace(/元$/g, "").replace("元", "").replace(/^\s+|\s+$/g, '');
}
function numberToSmallChinese(num) {
const chineseNumbers = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
const chineseUnits = ['', '十', '百', '千'];
const numStr = num.toString();
const numLength = numStr.length;
let chineseStr = '';
for (let i = 0; i < numLength; i++) {
const digit = parseInt(numStr.charAt(i));
const unitPos = numLength - i - 1;
if (digit !== 0) {
chineseStr += chineseNumbers[digit] + chineseUnits[unitPos];
} else {
// 处理连续的零,只添加一个零到结果中
if (i < numLength - 1 && parseInt(numStr.charAt(i + 1)) !== 0) {
chineseStr += chineseNumbers[digit];
}
}
}
return chineseStr;
}
</script>
<script src="./js/alpine.js"></script>
<script>
const axiosClient = axios.create({
baseURL : './',
});
axiosClient.interceptors.request.use( (config)=> {
config.headers.Authorization = 'Bearer <?php echo $token?>'
return config;
}, (error)=> {
return Promise.reject(error);
});
axiosClient.interceptors.response.use( (response)=> {
return response;
}, (error)=>{
if(error.response.status === 401){
console.error(error);
}
throw error;
});
</script>
<script>
</script>