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

购物车。。。

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