Commit d90f8f65 authored by 徐一鸣's avatar 徐一鸣

服务申请

parent 8e00cfa1
...@@ -258,6 +258,7 @@ export default { ...@@ -258,6 +258,7 @@ export default {
query: { query: {
service_id: parseFloat(this.data.service_id), service_id: parseFloat(this.data.service_id),
spec_id: this.specification.id, spec_id: this.specification.id,
spcs_type: this.specification.spcs_type,
duration: this.duration, duration: this.duration,
duration_unit: this.type, duration_unit: this.type,
}, },
......
...@@ -37,8 +37,8 @@ export default { ...@@ -37,8 +37,8 @@ export default {
preson: "", preson: "",
phone: "", phone: "",
}, },
all_cost:'', all_cost: 0,
now_money:'', now_money: 0,
module_arr: [ module_arr: [
{ {
title: "服务申请", title: "服务申请",
...@@ -122,7 +122,7 @@ export default { ...@@ -122,7 +122,7 @@ export default {
} else if (this.$route.query.app_id) { } else if (this.$route.query.app_id) {
this.get_one_app(this.$route.query); this.get_one_app(this.$route.query);
} else { } else {
console.log(JSON.parse(window.sessionStorage.getItem("shoppingCart"))); // console.log(JSON.parse(window.sessionStorage.getItem("shoppingCart")));
var temp_arr = []; var temp_arr = [];
JSON.parse(window.sessionStorage.getItem("shoppingCart")).forEach((e) => { JSON.parse(window.sessionStorage.getItem("shoppingCart")).forEach((e) => {
temp_arr.push(e.id); temp_arr.push(e.id);
...@@ -136,9 +136,8 @@ export default { ...@@ -136,9 +136,8 @@ export default {
get_account_money(){ get_account_money(){
this.$http this.$http
.get(`/apaas/backmgt/user/myAccount`).then(res=>{ .get(`/apaas/backmgt/user/myAccount`).then(res=>{
console.log(res);
if(res.data.success){ if(res.data.success){
this.now_money = res.data.data.account_balance this.now_money = res.data.data.account_balance || 0
} }
}) })
}, },
...@@ -201,21 +200,26 @@ export default { ...@@ -201,21 +200,26 @@ export default {
}, },
]; ];
this.service_arr[0]["auth"] = data.organization_name; this.service_arr[0]["auth"] = data.organization_name;
this.service_arr[0]["size"] = "规格:"; this.service_arr[0]["size"] = "";
this.service_arr[0]["count"] = "";
data.request_spcs_info.forEach((el) => { data.request_spcs_info.forEach((el) => {
if (service_data.spec_id == el.id) { if (service_data.spec_id == el.id) {
this.service_arr[0]["size"] = let size = "";
this.service_arr[0]["size"] +
"访问次数:" + if (el.spcs_type==1) {
el.count + size = `${el.money}金币/${el.spcs_count}次`
",访问量:" + this.service_arr[0]["num"] = "不限时长"
el.pv + } else {
","; size = `${el.money}金币/${el.duration_unit == 1 ? "" : ""}`
this.service_arr[0]["num"] = service_data.duration;
}
this.service_arr[0]["size"] = size;
this.service_arr[0]["count"] = service_data.duration*el.money+'金币';
} }
}); });
this.service_arr[0]["applytype"] = this.service_arr[0]["applytype"] =
"申请方式:" + (service_data.duration_unit == 1 ? "" : ""); "申请方式:" + (service_data.duration_unit == 1 ? "" : "");
this.service_arr[0]["num"] = service_data.duration;
this.service_arr[0]["isMg"] = data.openness == 3; this.service_arr[0]["isMg"] = data.openness == 3;
this.service_arr[0]["data"] = JSON.parse(data.res_fields); this.service_arr[0]["data"] = JSON.parse(data.res_fields);
console.log(this.service_arr[0]["data"]); console.log(this.service_arr[0]["data"]);
...@@ -377,7 +381,7 @@ export default { ...@@ -377,7 +381,7 @@ export default {
this.service_arr[l]["count"] = e.duration*parseFloat(e.application.price)+'金币'; this.service_arr[l]["count"] = e.duration*parseFloat(e.application.price)+'金币';
this.service_arr[l]["isMg"] = false; this.service_arr[l]["isMg"] = false;
this.service_arr[l]["isapp"] = true; this.service_arr[l]["isapp"] = true;
temp_cost = temp_cost + e.duration*parseFloat(e.application.price) temp_cost = this.floatAdd(temp_cost, e.duration*parseFloat(e.application.price))
} else { } else {
//服务 //服务
this.service_arr[l]["img"] = e.service.cover; this.service_arr[l]["img"] = e.service.cover;
...@@ -390,21 +394,30 @@ export default { ...@@ -390,21 +394,30 @@ export default {
}, },
]; ];
this.service_arr[l]["auth"] = e.service.organization_name; this.service_arr[l]["auth"] = e.service.organization_name;
this.service_arr[l]["size"] = "规格:"; this.service_arr[l]["size"] = "";
e.service.request_spcs_info.forEach((el) => { this.service_arr[l]["count"] = "";
let spcs_type_1 = e.service.request_spcs_info.spcs_type_1 || [];
let spcs_type_2 = e.service.request_spcs_info.spcs_type_2 || [];
spcs_type_1.forEach((el,ind) => {
if (e.spec_id == el.id) { if (e.spec_id == el.id) {
this.service_arr[l]["size"] = this.service_arr[l]["size"] = `时长收费:${el.money}金币/${el.spcs_count}次 * ${e.duration}`;
this.service_arr[l]["size"] + this.service_arr[l]["num"] = "不限时长";
"访问次数:" + this.service_arr[l]["count"] = e.duration*el.money+'金币';
el.count + temp_cost = this.floatAdd(temp_cost, e.duration*el.money);
",访问量:" +
el.pv +
",";
} }
}); });
spcs_type_2.forEach((el,ind) => {
if (e.spec_id == el.id) {
this.service_arr[l]["size"] = `应用镜像部署权限:${el.money}金币/${el.duration_unit == 1 ? "" : ""}`;
this.service_arr[l]["num"] = e.duration;
this.service_arr[l]["count"] = e.duration*el.money+'金币';
temp_cost = this.floatAdd(temp_cost, e.duration*el.money);
}
});
this.service_arr[l]["applytype"] = this.service_arr[l]["applytype"] =
"申请方式:" + (e.duration_method == 1 ? "" : ""); "申请方式:" + (e.duration_method == 1 ? "" : "");
this.service_arr[l]["num"] = e.duration;
this.service_arr[l]["isMg"] = e.service.openness == 3; this.service_arr[l]["isMg"] = e.service.openness == 3;
this.service_arr[l]["data"] = e.service.res_fields this.service_arr[l]["data"] = e.service.res_fields
? JSON.parse(e.service.res_fields) ? JSON.parse(e.service.res_fields)
...@@ -418,7 +431,39 @@ export default { ...@@ -418,7 +431,39 @@ export default {
}) })
.catch((response) => {}); .catch((response) => {});
}, },
}, floatAdd(arg1, arg2) {
let r1, r2, m, c;
try {
r1 = arg1.toString().split(".")[1].length;
} catch (e) {
r1 = 0;
}
try {
r2 = arg2.toString().split(".")[1].length;
} catch (e) {
r2 = 0;
}
c = Math.abs(r1 - r2);
m = Math.pow(10, Math.max(r1, r2));
if (c > 0) {
let cm = Math.pow(10, c);
if (r1 > r2) {
arg1 = Number(arg1.toString().replace(".", ""));
arg2 = Number(arg2.toString().replace(".", "")) * cm;
} else {
arg1 = Number(arg1.toString().replace(".", "")) * cm;
arg2 = Number(arg2.toString().replace(".", ""));
}
} else {
arg1 = Number(arg1.toString().replace(".", ""));
arg2 = Number(arg2.toString().replace(".", ""));
}
return (arg1 + arg2) / m;
},
}
}; };
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment