浏览代码

middle 素材大盘 内容迭代

jiayufei 3 年之前
父节点
当前提交
05f2efea3d
共有 2 个文件被更改,包括 69 次插入18 次删除
  1. 67 16
      src/views/modules/Statistics/materialReport/materialReport.vue
  2. 2 2
      vue.config.js

+ 67 - 16
src/views/modules/Statistics/materialReport/materialReport.vue

@@ -130,25 +130,25 @@
 							</a-tooltip>
 						</span>
 						<div class="report-card-result">
-							<div class="report-card-money">¥{{ materialReportCardList.costTotal || 0 }}</div>
+							<div class="report-card-money">{{ materialReportCardList.costTotal ? '¥' + materialReportCardList.costTotal : '-' }}</div>
 							<div class="report-card-msg">
 								<span>
 									同比
-									<a-icon v-if="materialReportCardList.yearOnYearCompare >= 0" type="caret-down" style="color: green"/>
-									<a-icon v-else type="caret-up" style="color: #f00"/>
+									<a-icon v-if="materialReportCardList.yearOnYearCompare >= 0" type="caret-up" style="color: #f00"/>
+									<a-icon v-else type="caret-down" style="color: green"/>
 									{{ Number(materialReportCardList.yearOnYearCompare * 100).toFixed(2) }}%
 								</span>
 								<span>
 									日环比
-									<a-icon v-if="materialReportCardList.chainCompare >= 0" type="caret-down" style="color: green"/>
-									<a-icon v-else type="caret-up" style="color: #f00"/>
+									<a-icon v-if="materialReportCardList.chainCompare >= 0" type="caret-up" style="color: #f00"/>
+									<a-icon v-else type="caret-down" style="color: green"/>
 									{{ Number(materialReportCardList.chainCompare * 100).toFixed(2) }}%
 								</span>
 							</div>
 						</div>
 						<div class="report-card-line"></div>
 						<div class="report-card-radio">
-							<span>昨日消耗:{{ materialReportCardList.yesterdayCost }}</span>
+							<span>昨日消耗:{{ materialReportCardList.yesterdayCost ? '¥' + materialReportCardList.yesterdayCost : '-' }}</span>
 						</div>
 					</a-card>
 				</a-col>
@@ -160,7 +160,7 @@
 							</a-tooltip>
 						</span>
 						<div class="report-card-result">
-							<div class="report-card-money">{{ accountIndexList.videoTotal || 0 }}</div>
+							<div class="report-card-money">{{ accountIndexList.videoTotal | formatCurrency }}</div>
 							<div
 								v-if="timeShowEchartsStatus"
 								id="accountIndexEchart"
@@ -184,7 +184,7 @@
 							</a-tooltip>
 						</span>
 						<div class="report-card-result">
-							<div class="report-card-money">{{ accountIndexList.effectiveTotal || 0 }}</div>
+							<div class="report-card-money">{{ accountIndexList.effectiveTotal | formatCurrency }}</div>
 							<div
 								v-if="timeShowEchartsStatus"
                                 class="accountIndexEchart"
@@ -208,7 +208,7 @@
 							</a-tooltip>
 						</span>
 						<div class="report-card-result">
-							<div class="report-card-money">{{ popularVideoList.hotTotal }}</div>
+							<div class="report-card-money">{{ popularVideoList.hotTotal | formatCurrency }}</div>
 							<div
 								v-if="timeShowEchartsStatus"
                                 class="accountIndexEchart"
@@ -222,14 +222,14 @@
 						<div class="report-card-radio">
 							<span>
 								同比
-								<a-icon v-if="popularVideoList.hotYearOnYearCompare >= 0" type="caret-down" style="color: green"/>
-								<a-icon v-else type="caret-up" style="color: #f00"/>
+								<a-icon v-if="popularVideoList.hotYearOnYearCompare >= 0" type="caret-up" style="color: #f00"/>
+								<a-icon v-else type="caret-down" style="color: green"/>
 								{{ Number(popularVideoList.hotYearOnYearCompare * 100).toFixed(2) }}%
 							</span>
 							<span>
 								日环比
-								<a-icon v-if="popularVideoList.hostCompare >= 0" type="caret-down" style="color: green"/>
-								<a-icon v-else type="caret-up" style="color: #f00"/>
+								<a-icon v-if="popularVideoList.hostCompare >= 0" type="caret-up" style="color: #f00"/>
+								<a-icon v-else type="caret-down" style="color: green"/>
 								{{ Number(popularVideoList.hostCompare * 100).toFixed(2) }}%
 							</span>
 						</div>
@@ -746,16 +746,67 @@ export default {
 				});
 			});
 		},
+		decimalsHandle(val, num) {
+			if (val && typeof val != 'string') {
+				if (val >= 0) {
+					val = parseFloat(val).toFixed(num);
+					let numberStr = val.toString();
+					let str = numberStr.split('.');
+					let str0 = str[0].split('').reverse();
+					for (let i = 0; i < str0.length; i++) {
+						if ((i + 1) % 4 === 0) {
+							str0.splice(i, 0, ',');
+						}
+					}
+					str0.reverse();
+					let handleResult = '';
+					for (let j = 0; j < str0.length; j++) {
+						handleResult += str0[j];
+					}
+					return handleResult + '.' + str[1];
+				}
+				else {
+					val = parseFloat(val).toFixed(num);
+					let numberStr = val.toString();
+					let str = numberStr.split('.');
+					let str0 = str[0].substr(1).split('').reverse();
+					for (let i = 0; i < str0.length; i++) {
+						if ((i + 1) % 4 === 0) {
+							str0.splice(i, 0, ',');
+						}
+					}
+					str0.reverse();
+					let handleResult = '';
+					for (let j = 0; j < str0.length; j++) {
+						handleResult += str0[j];
+					}
+					return '-' + handleResult + '.' + str[1];
+				}
+			}
+			else if (typeof val == 'string') {
+				return val;
+			}
+			else {
+				return 0;
+			}
+		},
 		getSumData() {
 			let that = this;
 			return new Promise((resolve, reject) => {
 				that.postDataAction('/overView/sumData', {
-					mediaId: this.mediaDimension == 'a' ? 1 : 2,
-					startDate: this.dateValue.length == 2 ? moment(this.dateValue[0]).format('YYYY-MM-DD') : null,
-					endDate: this.dateValue.length == 2 ? moment(this.dateValue[1]).format('YYYY-MM-DD') : null,
+					mediaId: this.mediaDimension === 'a' ? 1 : 2,
+					startDate: this.dateValue.length === 2 ? moment(this.dateValue[0]).format('YYYY-MM-DD') : null,
+					endDate: this.dateValue.length === 2 ? moment(this.dateValue[1]).format('YYYY-MM-DD') : null,
 					projects: this.dataDimensionValue
 				}).then(res => {
 					if (res.success) {
+						let defaultList = res.result;
+						if (this.mediaDimension === 'b') {
+							defaultList.costTotal = this.decimalsHandle(defaultList.costTotal, 3);
+						}
+						else {
+							defaultList.costTotal = this.decimalsHandle(defaultList.costTotal, 2);
+						}
 						this.materialReportCardList = res.result;
 						resolve(res.result);
 					}

+ 2 - 2
vue.config.js

@@ -86,9 +86,9 @@ module.exports = {
 				//  target: 'http://adsp.tjyourong.com.cn/', //请求本地 需要jeecg-boot后台项目
 				// target: 'http://192.168.1.251/', //请求本地 需要jeecg-boot后台项目
 				// target:'http://118.24.244.213:8804',
-				// target: 'http://192.168.1.43:9090', // 子安
+				target: 'http://192.168.1.43:9090', // 子安
 				// target: 'http://192.168.1.8:8806', // 学超
-				target:'http://139.186.165.84:8806', //测试
+				// target:'http://139.186.165.84:8806', //测试
 				// target:'http://apipre.tjyourong.com.cn', //预生产
 
 				ws: false,