장주현

예상 원화 가격 확인 기능 추가

......@@ -39,6 +39,7 @@ var cityE, stateE, streetE;
//app.use('/', indexRoute);
app.post('/', async function(req,res){
if(req.body.process == "주소 변환"){
console.log(req.body);
zipcode = req.body.zipcode;
addressK = req.body.addressK;
......@@ -100,6 +101,100 @@ app.post('/', async function(req,res){
if(req.body.os == "ebay"){
res.render('ebayaddr', { cityE : cityE, stateE : stateE, streetE : streetE, detailaddressE : detailaddressE, extraaddressE : extraaddressE, zipcode : zipcode, os : req.body.os});
}
}
else if(req.body.process == "환율 계산"){
var card = req.body.card;
var credit = req.body.credit;
var brand = req.body.brand;
var moneyU = Number(req.body.moneyU);
var addmoneyU = 0;
var addpersent = 0;
var exchange;
if(brand == "VISA"){
addpersent += 0.011;
}
else if(brand == "MASTER"){
addpersent += 0.01;
}
else if(brand == "American Express"){
addpersent += 0.01;
}
else if(brand == "JCB"){
}
else if(brand == "UnionPay"){
if(card == "KB국민카드"){
addpersent += 0.008;
}
}
if(card =="KB국민카드"){
addpersent += 0.0025;
}
else if(card =="NH농협카드"){
if(credit == "신용카드"){
addpersent += 0.0025;
}
else if(credit == "체크카드"){
addmoneyU += 0.5;
}
}
else if(card =="롯데카드"){
addpersent += 0.002;
}
else if(card =="삼성카드"){
addpersent += 0.002;
}
else if(card =="신한카드"){
if(credit == "신용카드"){
addpersent += 0.0018;
}
else if(credit == "체크카드"){
addpersent += 0.002;
}
}
else if(card =="씨티카드"){
addpersent += 0.0025;
}
else if(card =="우리카드"){
if(credit == "신용카드"){
addpersent += 0.003;
}
else if(credit == "체크카드"){
addmoneyU += 0.5;
}
}
else if(card =="현대카드"){
if(credit == "신용카드"){
addpersent += 0.0018;
}
else if(credit == "체크카드"){
}
}
else if(card =="하나카드"){
if(credit == "신용카드"){
addpersent += 0.002;
}
else if(credit == "체크카드"){
addmoneyU += 0.5;
}
}
else if(card =="BC카드"){
}
request({
encoding: "utf-8",
method: "GET",
uri : "https://api.exchangeratesapi.io/2020-06-10?base=USD&symbols=KRW"
}, function(err,res,html){
exchange = Number(html.substring(16,23));
})
setTimeout(function(){
var result = (moneyU + addmoneyU) * (1 + addpersent) * exchange;
console.log(result);
res.send("원화: "+ result + "원");
},300);
}
});
function trans(message, totrans){
......
......@@ -12,7 +12,35 @@
<p> 사용할 해외 쇼핑몰 선택 후 변환</p>
<input type="radio" name="os" value="amazon" checked="checked">Amazon
<input type="radio" name="os" value="ebay">Ebay
<input type="submit" value="주소 변환">
<input type="submit" name="process" value="주소 변환">
<br><br><br>
<p> 구매할 물품의 달러가격을 적은후 해당 조건에 맞게 설정후 검색</p>
<input type="text" name="moneyU" placeholder="물품 달러 가격">
<select name="card">
<option value="KB국민카드">KB국민카드</option>
<option value="NH농협카드">NH농협카드</option>
<option value="롯데카드">롯데카드</option>
<option value="삼성카드">삼성카드</option>
<option value="신한카드">신한카드</option>
<option value="씨티카드">씨티카드</option>
<option value="우리카드">우리카드</option>
<option value="현대카드">현대카드</option>
<option value="하나카드">하나카드</option>
<option value="BC카드">BC카드</option>
</select>
<select name="credit">
<option value="신용카드">신용카드</option>
<option value="체크카드">체크카드</option>
</select>
<select name="brand">
<option value="VISA">VISA</option>
<option value="MASTER">MASTER</option>
<option value="American Express">American Express</option>
<option value="JCB">JCB</option>
<option value="UnionPay">UnionPay</option>
</select>
<input type="submit" name="process" value="환율 계산">
</form>
<div id="wrap" style="display:none;border:1px solid;width:500px;height:300px;margin:5px 0;position:relative">
......