Commit 8e00cfa1 authored by 刘殿昕's avatar 刘殿昕

购物车。。。

parent 5135c3d8
......@@ -82,8 +82,9 @@
<span>计次收费规格:</span>
<span
v-if="
data.serviceRequestSpcs.spcs_type_1 &&
data.serviceRequestSpcs.spcs_type_1.length == 0
(data.serviceRequestSpcs.spcs_type_1 &&
data.serviceRequestSpcs.spcs_type_1.length == 0) ||
!data.serviceRequestSpcs.spcs_type_1
"
class="commodity_text"
>暂无</span
......@@ -103,8 +104,9 @@
<span>时长收费规格:</span>
<span
v-if="
data.serviceRequestSpcs.spcs_type_2 &&
data.serviceRequestSpcs.spcs_type_2.length == 0
(data.serviceRequestSpcs.spcs_type_2 &&
data.serviceRequestSpcs.spcs_type_2.length == 0) ||
!data.serviceRequestSpcs.spcs_type_2
"
class="commodity_text"
>暂无</span
......@@ -185,7 +187,7 @@ export default {
},
data: () => ({
types: [],
type: 0, // 购买方式 1:按月,2:按年
type: 1, // 购买方式 1:按月,2:按年
specification: {}, // 规格
duration: 1, // 时长
showTime: false,
......@@ -193,7 +195,13 @@ export default {
computed: {
actionDisabled() {
let a = this.data.serviceRequestSpcs;
return a.spcs_type_1.length == 0 && a.spcs_type_2.length == 0;
return (
a &&
a.spcs_type_1 &&
a.spcs_type_1.length == 0 &&
a.spcs_type_2 &&
a.spcs_type_2.length == 0
);
},
},
watch: {},
......@@ -294,9 +302,17 @@ export default {
}
// 初始化规格
if (this.data.serviceRequestSpcs.spcs_type_1.length > 0) {
if (
this.data.serviceRequestSpcs &&
this.data.serviceRequestSpcs.spcs_type_1 &&
this.data.serviceRequestSpcs.spcs_type_1.length > 0
) {
this.specification = this.data.serviceRequestSpcs.spcs_type_1[0];
} else if (this.data.serviceRequestSpcs.spcs_type_2.length > 0) {
} else if (
this.data.serviceRequestSpcs &&
this.data.serviceRequestSpcs.spcs_type_2 &&
this.data.serviceRequestSpcs.spcs_type_2.length > 0
) {
this.specification = this.data.serviceRequestSpcs.spcs_type_2[0];
}
},
......
......@@ -639,7 +639,7 @@
<div class="btn_footer fyzj_item">
<div class="fyzj">
<p class="fyzj_p">
<span v-if="getSumCoin > 20000" class="yebz">
<span v-if="getSumCoin > userInfo.account_balance" class="yebz">
余额不足,请联系超级管理员进行充值
</span>
费用总计:<span class="fyzj_span">
......@@ -651,12 +651,12 @@
<span @click="dialogFymx = true" class="ckfymx_a">
查看费用明细
</span>
<span class="ckfymx_qian">账户余额:20,000 金币</span>
<span class="ckfymx_qian">账户余额:{{ userInfo.account_balance }} 金币</span>
</p>
</div>
<el-button
:class="getSumCoin <= 20000 ? 'submit' : 'nosubmit'"
:disabled="getSumCoin > 20000"
:class="getSumCoin <= userInfo.account_balance ? 'submit' : 'nosubmit'"
:disabled="getSumCoin > userInfo.account_balance"
@click="submitApp"
>
提交申请
......@@ -951,11 +951,11 @@
<div class="fyzj_dia">
<div class="fyzj_dia_init">
<p v-if="activeName == '1'" class="fyzj_2">
升级费用:<span class="fyzj_2_num">2000000000 金币</span>
升级费用:<span class="fyzj_2_num">{{ amounts_payable }} 金币</span>
</p>
<p v-if="activeName == '1'" class="fyzj_2">
<!-- <p v-if="activeName == '1'" class="fyzj_2">
原规格抵扣费用:<span class="fyzj_2_num">2000 金币</span>
</p>
</p> -->
<div class="fyzj_1">
费用总计:
<p>
......@@ -964,7 +964,7 @@
</p>
</div>
<p class="fyzj_2">
账户余额:<span class="fyzj_2_num">2000 金币</span>
账户余额:<span class="fyzj_2_num">{{ userInfo.account_balance }} 金币</span>
</p>
</div>
<div class="clear_xxx"></div>
......@@ -995,7 +995,7 @@
:datas="jifeiList1"
:maxheight="260"
></table-um>
<div v-if="activeName == '1'" class="sjfy_title">
<!-- <div v-if="activeName == '1'" class="sjfy_title">
原规格抵扣费用
<el-tooltip
class="tool_item"
......@@ -1014,7 +1014,7 @@
:stripe="true"
:datas="jifeiList2"
:maxheight="260"
></table-um>
></table-um> -->
</el-dialog>
<ApassDialog
ref="dialog"
......@@ -1031,6 +1031,7 @@ import TableUm from "@/components/table/table-um";
import InfoList from "@/components/infoList";
import ApassDialog from "@/components/apass-dialog";
import helper from "@/services/helper.js";
import { mapState } from "vuex";
export default {
components: {
......@@ -1144,9 +1145,10 @@ export default {
}个月`;
}
this.amounts_payable = sumCM + sumDisk;
this.total_money = sumCM + sumDisk - a_deductions;
return this.total_money;
// this.total_money = sumCM + sumDisk - a_deductions;
return this.amounts_payable;
},
...mapState(["userInfo"]),
},
data() {
var checkName = (rule, value, callback) => {
......@@ -1439,7 +1441,7 @@ export default {
name: "数据盘",
num: "0个数据盘,每个数据盘0GB",
time: "0个月",
sum: "2000金币",
sum: "金币",
},
],
};
......@@ -1565,7 +1567,7 @@ export default {
sum: "2000金币",
},
];
this.deductions = 20000;
this.deductions = this.userInfo.account_balance;
} else {
this.formShow = false;
}
......
......@@ -75,10 +75,25 @@
</div>
</el-col>
<el-col :span="5">
<div v-if="cellItems.service_id != 0 && cellItems.service.request_spcs_info.spcs_type_1 && cellItems.service.request_spcs_info.spcs_type_1.length != 0" class="shopping_cell_specification">
<div
v-if="
cellItems.service_id != 0 &&
cellItems.service.request_spcs_info.spcs_type_1 &&
cellItems.service.request_spcs_info.spcs_type_1.length != 0
"
class="shopping_cell_specification"
>
<div class="shopping_cell_specification_val">
<div class="shopping_cell_specification_val_specification">
计次收费:{{ getSpecification }}
{{
cellItems.service.spcs_info.spcs_type == 1
? "计次收费"
: "时长收费"
}}{{ cellItems.service.spcs_info.money }}金币/{{
cellItems.service.spcs_info.spcs_type == 1
? cellItems.service.spcs_info.spcs_count + ""
: ""
}}
</div>
<div class="shopping_cell_specification_edit">
<el-popover
......@@ -93,7 +108,9 @@
<div
v-if="
cellItems.service.request_spcs_info &&
cellItems.service.request_spcs_info.length != 0
cellItems.service.request_spcs_info.spcs_type_1 &&
cellItems.service.request_spcs_info.spcs_type_1
.length != 0
"
>
<el-button
......@@ -101,15 +118,28 @@
.request_spcs_info.spcs_type_1"
:key="'specification' + index"
:class="
specificationPop == item.id
specificationPop.id == item.id
? 'shopping_cell_specification_btn active'
: 'shopping_cell_specification_btn'
"
size="mini"
@click="changeSpecification(item.id)"
@click="changeSpecification(item)"
>
{{ item.money }}金币/{{ item.spcs_count }}
</el-button>
<el-button
:class="
specificationPop.spcs_type == 2
? 'shopping_cell_specification_btn active'
: 'shopping_cell_specification_btn'
"
size="mini"
@click="changeSpecification(cellItems.service.request_spcs_info.spcs_type_2[0])"
>{{
cellItems.service.request_spcs_info.spcs_type_2[0]
.money
}}金币/月</el-button
>
</div>
<div class="no_option" v-else>暂无规格</div>
</div>
......@@ -138,11 +168,22 @@
</div>
</div>
</div>
<div v-else-if="cellItems.app_id != 0" class="shopping_cell_num">{{ cellItems.application.price }}金币/月</div>
<div v-else class="shopping_cell_num">{{ cellItems.service.request_spcs_info.spcs_type_2.single_money }}金币/月</div>
<div v-else-if="cellItems.app_id != 0" class="shopping_cell_num">
{{ cellItems.application.price }}金币/月
</div>
<div v-else class="shopping_cell_num">
{{
cellItems.service.request_spcs_info.spcs_type_2 &&
cellItems.service.request_spcs_info.spcs_type_2.length != 0
? cellItems.service.request_spcs_info.spcs_type_2[0].money
: 0
}}金币/月
</div>
</el-col>
<el-col :span="3" class="shopping_cell_num">
<div v-if="cellIsService && specificationPop.spec_type == 1">不限时长</div>
<div v-if="cellIsService && cellItems.service.spcs_info.spcs_type == 1">
不限时长
</div>
<div v-else>
<el-input-number
:disabled="readOnly"
......@@ -152,9 +193,16 @@
:min="1"
></el-input-number>
</div>
</el-col>
<el-col :span="3" class="shopping_cell_num"> {{ getSumMoney }}金币 </el-col>
<el-col :span="3" class="shopping_cell_num">
{{
cellItems.service_id != 0
? (cellItems.service.spcs_info.money * cellItems.duration).toFixed(
2
)
: (cellItems.application.price * cellItems.duration).toFixed(2)
}}金币
</el-col>
<el-col :span="3" class="shopping_cell_options">
<el-checkbox
v-if="!readOnly"
......@@ -220,7 +268,7 @@ export default {
specificationEdit: require("../../assets/imgs/ic_edit.png"),
checkedSubscription: false,
visible: false,
specificationPop: 1,
specificationPop: {},
specificationApplicationPop: 1,
appSpecificationBtns: [
{ id: 1, value: "部署" },
......@@ -233,18 +281,32 @@ export default {
}),
computed: {
getSpecification() {
console.log()
console.log();
},
getSumMoney() {
let sum = 0;
if (this.cellItems.app_id != 0) {
this.cellItems.application.price * this.cellItems.duration
sum += this.cellItems.application.price * this.cellItems.duration;
} else if (this.cellItems.service_id != 0) {
}
}
return sum;
},
},
mounted() {},
methods: {
getState(val) {
this.$emit("changeState", { state: val, index: this.cellIndex });
if (
this.cellItems.service_id != 0 &&
!this.cellItems.service.spcs_info.id
) {
this.$message({
message: "该服务暂不支持购买",
type: "error",
});
this.checkedItem = false;
} else {
this.$emit("changeState", { state: val, index: this.cellIndex });
}
},
changeSpecification(val) {
this.specificationPop = val;
......@@ -253,15 +315,19 @@ export default {
this.specificationApplicationPop = val;
},
submitPop() {
this.cellItems.spec_id = this.specificationPop;
this.cellItems.duration_method = this.specificationApplicationPop;
this.visible = false;
this.changeCellItem();
this.cellItems.service.spcs_info =
this.specificationPop.spcs_type == 1
? this.cellItems.service.request_spcs_info.spcs_type_1[val]
: this.specificationPop.spcs_type == 2
? this.cellItems.service.request_spcs_info.spcs_type_2[val]
: "";
this.updateShoppingCart();
this.updateShoppingCart();
},
setSpecificationPop() {
this.specificationPop = this.cellItems.spec_id;
this.specificationApplicationPop = this.cellItems.duration_method;
this.specificationPop = this.cellItems.service.spcs_info;
console.log(this.specificationPop)
// this.specificationApplicationPop = this.cellItems.duration_method;
},
changeSubscription(val) {
this.changeCellItem();
......@@ -269,7 +335,6 @@ export default {
},
changeNum(val) {
this.changeCellItem();
this.updateShoppingCart();
},
changeCellItem() {
this.$emit("changeCellMsg", {
......
......@@ -60,7 +60,7 @@
<el-col :span="15" class="shopping_cart_options_num">
<div class="fyzj">
<p class="fyzj_p">
<span v-if="getSumCoin > 20000" class="yebz">
<span v-if="getSumCoin > userInfo.account_balance" class="yebz">
余额不足,请联系超级管理员进行充值
</span>
费用总计:<span class="fyzj_span">
......@@ -72,22 +72,24 @@
<p class="ckfymx_a">
{{ list.length }} 项服务,已选择
<span class="dwa_djf">{{ getNum }}</span>
<span class="ckfymx_qian">账户余额:20,000 金币</span>
<span class="ckfymx_qian"
>账户余额:{{ userInfo.account_balance }} 金币</span
>
</p>
</div>
</div>
</el-col>
<el-col :span="4" class="shopping_cart_options_cell">
<el-button
v-if="getNum == 0"
:disabled="true"
class="shopping_cart_options_cell_btn"
v-if="getNum != 0 && getSumCoin <= userInfo.account_balance"
@click="oneClickApplication"
class="shopping_cart_options_cell_btn_act"
>一键申请</el-button
>
<el-button
v-else
@click="oneClickApplication"
class="shopping_cart_options_cell_btn_act"
:disabled="true"
class="shopping_cart_options_cell_btn"
>一键申请</el-button
>
</el-col>
......@@ -99,6 +101,8 @@
<script>
import ShoppingCartList from "@/components/shopping-cart/shopping-cart-list";
import { mapState } from "vuex";
export default {
components: {
ShoppingCartList,
......@@ -124,10 +128,14 @@ export default {
},
getSumCoin() {
let sum = 0;
console.log(this.checkList)
console.log(this.checkList);
this.checkList.forEach((item, index) => {
if (item) {
sum += this.list[index].total_money;
if (this.list[index].service_id != 0) {
sum += (this.list[index].service.spcs_info.money * this.list[index].duration).toFixed(2);
} else {
sum += (this.list[index].application.price * this.list[index].duration).toFixed(2);
}
}
});
return sum;
......@@ -135,6 +143,7 @@ export default {
getCartState() {
return this.$store.state.cartState;
},
...mapState(["userInfo"]),
},
watch: {
getCartState(newVal) {
......@@ -342,6 +351,11 @@ export default {
left: -10px;
top: 2px;
}
.yebz {
color: #e15260;
font-size: 18px;
margin-right: 20px;
}
</style>
<style>
.shopping_cart_options_cell .el-checkbox {
......
......@@ -89,6 +89,7 @@ export default {
descript: datas.descript,
serviceRequestSpcs: specificationData,
scoreDetail: datas.scoreDetail,
month_sale: data.month_sale,
};
this.detailData = [
......
......@@ -75,6 +75,7 @@ export default {
descript: datas.descript,
serviceRequestSpcs: datas.serviceRequestSpcs,
scoreDetail: datas.scoreDetail,
month_sale: data.month_sale,
};
this.detailData = [
......
......@@ -95,6 +95,7 @@ export default {
descript: datas.descript,
serviceRequestSpcs: specificationData,
scoreDetail: datas.scoreDetail,
month_sale: data.month_sale,
};
this.detailData = [
......
......@@ -90,6 +90,7 @@ export default {
descript: datas.descript,
serviceRequestSpcs: specificationData,
scoreDetail: datas.scoreDetail,
month_sale: data.month_sale,
};
this.detailData = [
{
......
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