From 8520c76a40d6bbe4952233b1a538b5b037fa6227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=AE=BF=E6=98=95?= Date: Tue, 9 Mar 2021 12:02:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E8=B5=84=E6=BA=90=E4=BB=B7=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/service-header.vue | 6 +- src/components/shop-cloud/shop-cloud-new.vue | 54 +-- src/pages/workbench/yygl/app_detail.vue | 346 ++++++++++--------- 3 files changed, 219 insertions(+), 187 deletions(-) diff --git a/src/components/service-header.vue b/src/components/service-header.vue index eee023b..657b374 100644 --- a/src/components/service-header.vue +++ b/src/components/service-header.vue @@ -27,7 +27,7 @@ | @@ -88,9 +88,9 @@ 取消发布 - +

diff --git a/src/components/shop-cloud/shop-cloud-new.vue b/src/components/shop-cloud/shop-cloud-new.vue index d7977c9..bc45baf 100644 --- a/src/components/shop-cloud/shop-cloud-new.vue +++ b/src/components/shop-cloud/shop-cloud-new.vue @@ -1030,6 +1030,7 @@ export default { let sumCM = 0; let sumDisk = 0; let a_deductions = 0; + let arrJifei = JSON.parse(JSON.stringify(this.jifeiList1)); if (this.activeName == "0") { a_deductions = this.deductions; if (this.cpu_memory && this.cpu_memory.length != 0) { @@ -1065,9 +1066,9 @@ export default { } sumCM = sumCM * Number(this.formNew.appDuration); if ( - this.formNew.dataDisk >= 1 && - this.formNew.perDataDisk >= 1 && - this.formNew.appDuration >= 1 + this.formNew.dataDisk >= 0 && + this.formNew.perDataDisk >= 0 && + this.formNew.appDuration >= 0 ) { if (this.hard_disk && this.hard_disk.length != 0) { this.disk_single_money = Number(this.hard_disk[0].price); @@ -1077,26 +1078,26 @@ export default { Number(this.formNew.appDuration) * Number(this.hard_disk[0].price); } - this.jifeiList1[2] = { + arrJifei[2] = { name: "数据盘", num: `${this.formNew.dataDisk}个数据盘,每个数据盘${this.formNew.perDataDisk}GB`, time: `${this.formNew.appDuration}个月`, sum: `${sumDisk}金币`, }; } else { - this.jifeiList1.splice(2); + arrJifei.splice(2); } - this.jifeiList1[0].num = `${ - this.formNew.cpu >= 1 ? this.formNew.cpu : 0 - }核+${this.formNew.memory >= 1 ? this.formNew.memory : 0}G`; - this.jifeiList1[0].time = `${ + arrJifei[0].num = `${this.formNew.cpu >= 1 ? this.formNew.cpu : 0}核+${ + this.formNew.memory >= 1 ? this.formNew.memory : 0 + }G`; + arrJifei[0].time = `${ this.formNew.appDuration >= 1 ? this.formNew.appDuration : 0 }个月`; - this.jifeiList1[0].sum = `${sumCM}金币`; - this.jifeiList1[1].num = `${ + arrJifei[0].sum = `${sumCM}金币`; + arrJifei[1].num = `${ this.formNew.containerGroup >= 1 ? this.formNew.containerGroup : 0 }个`; - this.jifeiList1[1].time = `${ + arrJifei[1].time = `${ this.formNew.appDuration >= 1 ? this.formNew.appDuration : 0 }个月`; } else if (this.activeName == "1") { @@ -1134,9 +1135,9 @@ export default { } sumCM = sumCM * Number(this.formOld.appDuration); if ( - this.formOld.dataDisk >= 1 && - this.formOld.perDataDisk >= 1 && - this.formOld.appDuration >= 1 + this.formOld.dataDisk >= 0 && + this.formOld.perDataDisk >= 0 && + this.formOld.appDuration >= 0 ) { if (this.hard_disk && this.hard_disk.length != 0) { this.disk_single_money = Number(this.hard_disk[0].price); @@ -1146,29 +1147,32 @@ export default { Number(this.formOld.appDuration) * Number(this.hard_disk[0].price); } - this.jifeiList1[2] = { + arrJifei[2] = { name: "数据盘", num: `${this.formOld.dataDisk}个数据盘,每个数据盘${this.formOld.perDataDisk}GB`, time: `${this.formOld.appDuration}个月`, sum: `${sumDisk}金币`, }; } else { - this.jifeiList1.splice(2); + arrJifei.splice(2); } - this.jifeiList1[0].num = `${ - this.formOld.cpu >= 1 ? this.formOld.cpu : 0 - }核+${this.formOld.memory >= 1 ? this.formOld.memory : 0}G`; - this.jifeiList1[0].time = `${ + arrJifei[0].num = `${this.formOld.cpu >= 1 ? this.formOld.cpu : 0}核+${ + this.formOld.memory >= 1 ? this.formOld.memory : 0 + }G`; + arrJifei[0].time = `${ this.formOld.appDuration >= 1 ? this.formOld.appDuration : 0 }个月`; - this.jifeiList1[0].sum = `${sumCM}金币`; - this.jifeiList1[1].num = `${ + arrJifei[0].sum = `${sumCM}金币`; + arrJifei[1].num = `${ this.formOld.containerGroup >= 1 ? this.formOld.containerGroup : 0 }个`; - this.jifeiList1[1].time = `${ + arrJifei[1].time = `${ this.formOld.appDuration >= 1 ? this.formOld.appDuration : 0 }个月`; } + this.$nextTick(() => { + this.jifeiList1 = arrJifei; + }); // console.log(sumCM, sumDisk) this.amounts_payable = Number( (Number(sumCM) + Number(sumDisk)).toFixed(2) @@ -1629,7 +1633,7 @@ export default { name: "数据盘", num: `${this.dataDiskList.length}个数据盘,共计${this.dataDiskList.length}GB"`, time: "0个月", - sum: "2000金币", + sum: "0金币", }, ]; } else { diff --git a/src/pages/workbench/yygl/app_detail.vue b/src/pages/workbench/yygl/app_detail.vue index da090a9..685a3e9 100644 --- a/src/pages/workbench/yygl/app_detail.vue +++ b/src/pages/workbench/yygl/app_detail.vue @@ -38,16 +38,26 @@ :defaultOpen="preview" :editable="false" /> --> -

{{appcode}}
+
+ {{ appcode }} +
-

镜像列表:

+

镜像列表:

-

+

加载中...

-

+

没有更多了

@@ -115,21 +131,21 @@
-

压缩包:

+

压缩包:

{{ oldpag_name }} 下载原压缩包

-

上传新的压缩包:

+

上传新的压缩包:

-

+

压缩包上传提示:

@@ -181,8 +197,8 @@ v-if=" (service_arr[now_user][now_service] == '评分及评论' && now_user == 0) || - (service_arr[now_user][now_service] == '评分及评论' && - now_user !== 0) + (service_arr[now_user][now_service] == '评分及评论' && + now_user !== 0) " >

-
-

应用规格:

+
+

应用规格:

规格设置:

@@ -232,30 +248,30 @@
-
+
- +

应用收益总额

-

{{trans_all_obj.all}}

+

{{ trans_all_obj.all }}

金币
- +

交易总数

-

{{trans_all_obj.times}}

+

{{ trans_all_obj.times }}

- +

本月交易总数

-

{{trans_all_obj.month}}

+

{{ trans_all_obj.month }}

@@ -310,35 +326,35 @@ export default { serviceTabComments, apassTable, imageDetail, - ListPagination + ListPagination, }, data() { var checkname = (rule, value, callback) => { - var reg = /^[a-z\-_]+$/ - setTimeout(() => { - if (reg.test(value)) { - callback(); - } else { - callback(new Error('只支持小写字母 - _')); - } - }, 100); - }; + var reg = /^[a-z\-_]+$/; + setTimeout(() => { + if (reg.test(value)) { + callback(); + } else { + callback(new Error("只支持小写字母 - _")); + } + }, 100); + }; var checktag = (rule, value, callback) => { - var reg = /^[a-zA-Z0-9|.]+$/ - setTimeout(() => { - if (reg.test(value)) { - callback(); - } else { - callback(new Error('只支持小写字母 数字 .')); - } - }, 100); - }; + var reg = /^[a-zA-Z0-9|.]+$/; + setTimeout(() => { + if (reg.test(value)) { + callback(); + } else { + callback(new Error("只支持小写字母 数字 .")); + } + }, 100); + }; return { now_user: 0, //0:普通用户,1:组织管理员,2:超级管理员 buy_style: 0, image_loading: false, image_noMore: false, - sizeset_flag:false, + sizeset_flag: false, translistTotal: 0, transcurrentPage: 1, transpageSize: 10, @@ -346,7 +362,7 @@ export default { preview: "preview", subfield: false, image_arr: [], - size_arr_down:[], + size_arr_down: [], now_page: 1, total: 0, anotherData: {}, @@ -367,7 +383,7 @@ export default { taps: "", }, fileList: [], - trans_log_header:[ + trans_log_header: [ { prop: "department_name", label: "申请单位", @@ -411,29 +427,29 @@ export default { align: "center", }, ], - trans_log_data:[], - trans_log_arr:[ + trans_log_data: [], + trans_log_arr: [ { title: "应用交易概览", info: "", - prop:'title', + prop: "title", type: "solt", solt_name: "trans_all", }, { title: "应用交易记录", info: "", - prop:'title', + prop: "title", type: "solt", solt_name: "trans_log", }, ], - trans_all_obj:{ - all:0, - times:0, - month:0, + trans_all_obj: { + all: 0, + times: 0, + month: 0, }, - service_size_data:[], + service_size_data: [], service_size_arr: [ { prop: "type", @@ -460,13 +476,13 @@ export default { align: "left", }, ], - edit_size_arr:[ + edit_size_arr: [ { prop: "type", label: "规格类别", width: "250px", align: "left", - type:'input' + type: "input", }, { prop: "price", @@ -486,17 +502,18 @@ export default { label: "规格说明", minWidth: "33.33%", align: "left", - type:'input' - } + type: "input", + }, ], rules: { - name: [{ required: true, message: "请输入镜像名称", trigger: "blur" }, - { max:20, message: "应小于20个字符", trigger: 'blur' }, - {validator: checkname, trigger: 'blur' } - ], + name: [ + { required: true, message: "请输入镜像名称", trigger: "blur" }, + { max: 20, message: "应小于20个字符", trigger: "blur" }, + { validator: checkname, trigger: "blur" }, + ], taps: [ { required: true, message: "请输入镜像版本", trigger: "blur" }, - { max:10, message: "应小于10个字符", trigger: 'blur' }, + { max: 10, message: "应小于10个字符", trigger: "blur" }, { validator: checktag, trigger: "blur" }, ], }, @@ -632,100 +649,109 @@ export default { ]; }, methods: { - get_app_size(){ + get_app_size() { this.$http .get( `/apaas/hubApi/market/appSpecification?id=${this.$route.params.id}` - ).then((res)=>{ + ) + .then((res) => { console.log(res); - if(res.data.success){ - var data = res.data.data - var temp = [{ - id:data.id, - type:'申请获取应用镜像部署权限', - time:'按月', - price:data.price, - des:data.specifications - }] - - this.service_size_data = temp - this.size_arr_down = temp + if (res.data.success) { + var data = res.data.data; + var temp = [ + { + id: data.id, + type: "申请获取应用镜像部署权限", + time: "按月", + price: data.price, + des: data.specifications, + }, + ]; + + this.service_size_data = temp; + this.size_arr_down = temp; } - }) + }); }, transchangePageSize(value) { this.transpageSize = value; this.transcurrentPage = 1; - this.get_app_trans_data() + this.get_app_trans_data(); }, transchangeCurrentPage(value) { this.transcurrentPage = value; - this.get_app_trans_data() + this.get_app_trans_data(); }, - change_service_size(){ + change_service_size() { console.log(this.size_arr_down); - this.$http - .put( - `/apaas/hubApi/market/appSpecification`,{ - "id":parseInt(this.$route.params.id), -     "price":this.size_arr_down[0].price, -     "price_style":0, -     "specification_category":"申请获取应用镜像部署权限", -     "specifications":this.size_arr_down[0].des - } - ).then(res=>{ - if(res.data.success){ - this.$message.success('修改成功') - this.sizeset_flag = false - this.get_app_size() - }else{ - this.$message.error(this.data.errMsg) - } - }) - + if ( + this.size_arr_down[0].price != "" && + this.size_arr_down[0].des != "" + ) { + this.$http + .put(`/apaas/hubApi/market/appSpecification`, { + id: parseInt(this.$route.params.id), + price: this.size_arr_down[0].price, + price_style: 0, + specification_category: "申请获取应用镜像部署权限", + specifications: this.size_arr_down[0].des, + }) + .then((res) => { + if (res.data.success) { + this.$message.success("修改成功"); + this.sizeset_flag = false; + this.get_app_size(); + } else { + this.$message.error(res.data.errMsg); + } + }); + } else { + this.$message.error("请完善规格信息"); + } }, - get_app_trans_all(){ + get_app_trans_all() { this.$http .get( `/apaas/hubApi/market/incomeStatistics?id=${this.$route.params.id}&limit=${this.transpageSize}&page=${this.transcurrentPage}` - ).then(res=>{ - if(res.data.success){ - var data = res.data.data - this.trans_all_obj={ - all:data.sum, - times:data.count, - month:data.month_count, - } + ) + .then((res) => { + if (res.data.success) { + var data = res.data.data; + this.trans_all_obj = { + all: data.sum, + times: data.count, + month: data.month_count, + }; } - }) + }); }, - get_app_trans_data(){ + get_app_trans_data() { this.$http .get( `/apaas/hubApi/market/transactionRecord?app_id=${this.$route.params.id}&limit=${this.transpageSize}&page=${this.transcurrentPage}` - ).then(res=>{ + ) + .then((res) => { console.log(res); - if(res.data.success){ - res.data.data.forEach(e => { - e.add_time_name = helper.dateStringTransform(e.add_time) + if (res.data.success) { + res.data.data.forEach((e) => { + e.add_time_name = helper.dateStringTransform(e.add_time); }); - this.trans_log_data = res.data.data - this.translistTotal = res.data.total + this.trans_log_data = res.data.data; + this.translistTotal = res.data.total; } - }) - + }); }, - now_size_data(val){ - val.forEach(e=>{ - e.type = '申请获取应用镜像部署权限' - e.time = '按月' - }) - this.size_arr_down = val + now_size_data(val) { + val.forEach((e) => { + e.type = "申请获取应用镜像部署权限"; + e.time = "按月"; + }); + this.size_arr_down = val; }, showImageDetail(item) { this.$refs.imageDetail.showDialog({ ...item, - app_id: this.$route.params.id + app_id: this.$route.params.id, }); }, getCurrentUser() { @@ -817,10 +843,10 @@ export default { this.$message.error(response.errMsg); } }, - change_file_state(file,fileList){ - console.log(file,fileList); - if(fileList.length>=2){ - this.fileList = [file] + change_file_state(file, fileList) { + console.log(file, fileList); + if (fileList.length >= 2) { + this.fileList = [file]; } }, upload_error() { @@ -868,7 +894,9 @@ export default { }, delete_data(name) { this.$http - .delete(`/apaas/hubApi/image/del/${name}?app_id=${this.$route.params.id}`) + .delete( + `/apaas/hubApi/image/del/${name}?app_id=${this.$route.params.id}` + ) .then((response) => { if (response.data.success == 1) { this.$message.success("删除成功"); @@ -1080,16 +1108,17 @@ export default { data.up_platform_status == 0 ) { this.service_arr[this.now_user].push("评分及评论"); - if(this.$route.query.source == "apply"){ - - }else{ - this.get_app_size() - this.get_app_trans_data() - this.get_app_trans_all() - this.service_arr[this.now_user].push(...["应用计费规则","应用交易记录"]); + if (this.$route.query.source == "apply") { + } else { + this.get_app_size(); + this.get_app_trans_data(); + this.get_app_trans_all(); + this.service_arr[this.now_user].push( + ...["应用计费规则", "应用交易记录"] + ); } } - + if (this.now_user == 0) { temp_info.fxdetail = true; } @@ -1108,7 +1137,7 @@ export default { this.service_header_arr = temp_info; } }) - .catch(function(response) {}); + .catch(function (response) {}); }, getServiceBaseInfo() { @@ -1120,7 +1149,7 @@ export default { this.$set(this.list_arr[1], "info", data.gnjj); this.$set(this.list_arr[2], "info", data.cjsl); }) - .catch(function(response) {}); + .catch(function (response) {}); }, get_app_code() { this.$http @@ -1129,13 +1158,13 @@ export default { let data = response.data.data; this.appcode = data; }) - .catch(function(response) {}); + .catch(function (response) {}); }, refreshImageList() { this.now_page = 1; this.image_arr = []; this.get_image_list(); - } + }, }, }; @@ -1256,13 +1285,13 @@ export default { height: 284px; overflow-y: auto; } -.trans_all{ +.trans_all { width: 100%; height: 128px; - background-color: #fbfcfe; - border-radius: 12px; + background-color: #fbfcfe; + border-radius: 12px; } -.trans_all .trans_box{ +.trans_all .trans_box { width: 33.3%; float: left; height: 65px; @@ -1270,10 +1299,10 @@ export default { margin-top: 30px; border-right: 2px solid #e6ebfe; } -.trans_all .trans_box:nth-last-of-type(1){ +.trans_all .trans_box:nth-last-of-type(1) { border: 0; } -.trans_middle{ +.trans_middle { width: 200px; height: 65px; line-height: 65px; @@ -1281,33 +1310,32 @@ export default { position: relative; text-align: right; } -.trans_middle img{ +.trans_middle img { position: absolute; left: 0; top: 15px; } -.trans_middle span{ +.trans_middle span { position: absolute; right: -20px; top: 18px; font-size: 16px; - color: #242c43; + color: #242c43; } -.trans_middle p{ +.trans_middle p { font-size: 16px; line-height: 32px; - color: #58617a; + color: #58617a; } -.trans_middle p:nth-of-type(2){ +.trans_middle p:nth-of-type(2) { font-size: 24px; - font-weight: bold; - color: #242c43; + font-weight: bold; + color: #242c43; } -.trans_all .trans_box:nth-of-type(1) .trans_middle span{ +.trans_all .trans_box:nth-of-type(1) .trans_middle span { right: -40px; } -.trans_log{ +.trans_log { width: 100%; - } -- 2.26.0