shish 16 hours ago
parent
commit
12c514b93f

+ 8 - 0
ghs/src/service/order/index.js

@@ -63,6 +63,10 @@ export class OrderService extends BaseService {
 		});
 	}
 
+	/**
+	 * 客户业绩:对应 OrderController::actionYj
+	 * timeType=bill 按 payTime,=send 按 sendTime
+	 */
 	getYj(data) {
 		return this.request({
 			url: '/yj',
@@ -77,6 +81,10 @@ export class OrderService extends BaseService {
 		});
 	}
 
+	/**
+	 * 应收统计:对应 OrderController::actionAccountList
+	 * timeType=bill 按 payTime,=send 按 sendTime
+	 */
 	getAccountList(data) {
 		return this.request({
 			url: '/account-list',

+ 4 - 0
ghs/src/service/purchase-order/index.js

@@ -17,6 +17,10 @@ export class PurchaseOrderService extends BaseService {
 		});		
 	}
 
+	/**
+	 * 应付统计:对应 PurchaseOrderController::actionDueList
+	 * timeType=bill 按 entryTime,=send 按 sendTime
+	 */
 	dueList(data){
 		return this.request({
 			url: '/due-list',

+ 4 - 0
ghs/src/service/stat-cg-ghs/index.js

@@ -2,6 +2,10 @@ import { BaseService, Service } from '@/cool';
 @Service('stat-cg-ghs')
 export class StatCgGhsService extends BaseService {
 
+	/**
+	 * 供货业绩:对应 StatCgGhsController::actionProfile
+	 * timeType=bill 按 entryTime,=send 按 sendTime
+	 */
 	getProfile(data) {
 		return this.request({
 			url: '/profile',

+ 4 - 0
ghs/src/service/stat-cg/index.js

@@ -2,6 +2,10 @@ import { BaseService, Service } from '@/cool';
 @Service('stat-cg')
 export class StatCgService extends BaseService {
 
+	/**
+	 * 采购花材排行:对应 StatCgClass::statCg
+	 * timeType=bill 按 entryTime,=send 按 sendTime
+	 */
 	getProfit(data) {
 		return this.request({
 			url: '/profit',

+ 4 - 0
ghs/src/service/stat-item/index.js

@@ -2,6 +2,10 @@ import { BaseService, Service } from '@/cool';
 @Service('stat-item')
 export class StatItemService extends BaseService {
 
+	/**
+	 * 花材销售排行:对应 StatItemController::actionShow
+	 * includeNextDay=1 计入跨天售后扣减,=0 只统计当日净销
+	 */
 	getShow(data) {
 		return this.request({
 			url: '/show',

+ 8 - 0
ghs/src/service/stat/index.js

@@ -9,6 +9,10 @@ export class StatService extends BaseService {
 		});
 	}
 
+	/**
+	 * 收支分类:对应 StatSaleClass::classProfile
+	 * timeType=bill 记账日 / send 发货日
+	 */
 	getClassProfit(data) {
 		return this.request({
 			url: '/class-profit',
@@ -16,6 +20,10 @@ export class StatService extends BaseService {
 		});
 	}
 
+	/**
+	 * 花材收支明细:对应 StatSaleClass::incomeOutItem
+	 * timeType=bill 记账日 / send 发货日
+	 */
 	getIncomeOutItem(data) {
 		return this.request({
 			url: '/income-out-item',

+ 23 - 2
ghs/src/views/assets/cgItem.vue

@@ -1,16 +1,20 @@
 <!--
   PC 采购花材排行:与小程序 admin/stat/cgItem 同源 /stat-cg/profit。
-  入库日净量 + 跨天通过日扣数量/金额(可为负);请求参数与小程序对齐
+  timeType 切换记账时间(bill) / 发货时间(send);入库日净量 + 跨天通过日扣减
 -->
 <template>
 	<div class="shop-list">
 		<x-crud @load="onLoad">
 			<template #slot-date-select>
+				<el-button-group style="margin-right:12px;">
+					<el-button size="mini" :type="timeType === 'bill' ? 'primary' : 'default'" @click="changeTimeType('bill')">记账时间</el-button>
+					<el-button size="mini" :type="timeType === 'send' ? 'primary' : 'default'" @click="changeTimeType('send')">发货时间</el-button>
+				</el-button-group>
                 <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getDate" value-format="yyyy-MM-dd"
                 end-placeholder="结束日期" :picker-options="pickerOptions" size="mini"> </el-date-picker>
 			</template>
 			<template #slot-export-due>
-				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出数据</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出{{ timeTypeName }}</el-button>
 			</template>
 
             <template #slot-total-amount>
@@ -73,6 +77,8 @@ export default {
             startTime:'',
             endTime:'',
             searchTime:'',
+			// bill=记账 entryTime(默认) / send=发货 sendTime
+			timeType: 'bill',
 			/** 与小程序 cgItem 一致:默认按数量排序 */
 			sort: 'num',
             totalAmount:0,
@@ -82,6 +88,10 @@ export default {
 	},
 	computed: {
 		...mapGetters(['shopInfo']),
+		/** 当前筛选口径文案,导出按钮与提示共用 */
+		timeTypeName() {
+			return this.timeType === 'send' ? '发货时间' : '记账时间'
+		},
 	},
 	methods: {
 		/** 数字展示:不用 truthy,避免负数被当成空 */
@@ -100,9 +110,20 @@ export default {
 				startTime: this.startTime,
 				endTime: this.endTime,
 				sort: this.sort,
+				timeType: this.timeType,
 				...(extra || {})
 			};
 		},
+		/** 切换记账时间 / 发货时间并刷新 */
+		changeTimeType(type) {
+			if (this.timeType === type) {
+				return
+			}
+			this.timeType = type
+			if (this.app) {
+				this.app.refresh(this.queryParams())
+			}
+		},
 		/** 接口未返回合计时,按列表汇总数量/金额(含负数行) */
 		sumListTotals(list) {
 			let totalNum = 0;

+ 23 - 2
ghs/src/views/assets/incomeClass.vue

@@ -1,16 +1,20 @@
 <!--
   PC 收支分类:与小程序 classProfit 同源 /stat/class-profit(StatSaleClass::classProfile)。
-  采购成本、销售收入已含跨天售后通过日扣减;仅退款含跨天通过日金额
+  timeType 切换记账时间(bill) / 发货时间(send);采购成本、销售收入已含跨天售后通过日扣减。
 -->
 <template>
 	<div class="shop-list">
 		<x-crud @load="onLoad">
 			<template #slot-date-select>
+				<el-button-group style="margin-right:12px;">
+					<el-button size="mini" :type="timeType === 'bill' ? 'primary' : 'default'" @click="changeTimeType('bill')">记账时间</el-button>
+					<el-button size="mini" :type="timeType === 'send' ? 'primary' : 'default'" @click="changeTimeType('send')">发货时间</el-button>
+				</el-button-group>
                 <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getDate" value-format="yyyy-MM-dd"
                 end-placeholder="结束日期" :picker-options="pickerOptions" size="mini"> </el-date-picker>
 			</template>
 			<template #slot-export-due>
-				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出数据</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出{{ timeTypeName }}</el-button>
 			</template>
 			<template #table-column-income="{scope}">
 				<div :style="negStyle(scope.row.income)">{{ formatNum(scope.row.income) }}</div>
@@ -67,11 +71,17 @@ export default {
             startTime:'',
             endTime:'',
             searchTime:'',
+			// bill=销售 payTime / 采购 entryTime(默认);send=均按 sendTime
+			timeType: 'bill',
             totalAmount:0
 		}
 	},
 	computed: {
 		...mapGetters(['shopInfo']),
+		/** 当前筛选口径文案,导出按钮与提示共用 */
+		timeTypeName() {
+			return this.timeType === 'send' ? '发货时间' : '记账时间'
+		},
 	},
 	methods: {
 		/** 数字展示:避免 undefined / NaN */
@@ -90,9 +100,20 @@ export default {
 				searchTime: this.searchTime,
 				startTime: this.startTime,
 				endTime: this.endTime,
+				timeType: this.timeType,
 				...(extra || {})
 			};
 		},
+		/** 切换记账时间 / 发货时间并刷新 */
+		changeTimeType(type) {
+			if (this.timeType === type) {
+				return
+			}
+			this.timeType = type
+			if (this.app) {
+				this.app.refresh(this.queryParams())
+			}
+		},
 		exportData(){
 			this.$service.stat.getClassProfit(this.queryParams({export:1})).then(res => {
 				if(res.file){

+ 23 - 2
ghs/src/views/assets/incomeOutItem.vue

@@ -1,16 +1,20 @@
 <!--
   PC 花材收支明细:与 /stat/income-out-item(StatSaleClass::incomeOutItem)对齐。
-  销售/采购均按跨天售后通过日扣减(数量与金额可为负);仅退款含跨天通过日金额
+  timeType 切换记账时间(bill) / 发货时间(send);销售/采购均按跨天售后通过日扣减。
 -->
 <template>
 	<div class="shop-list">
 		<x-crud @load="onLoad">
 			<template #slot-date-select>
+				<el-button-group style="margin-right:12px;">
+					<el-button size="mini" :type="timeType === 'bill' ? 'primary' : 'default'" @click="changeTimeType('bill')">记账时间</el-button>
+					<el-button size="mini" :type="timeType === 'send' ? 'primary' : 'default'" @click="changeTimeType('send')">发货时间</el-button>
+				</el-button-group>
                 <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getDate" value-format="yyyy-MM-dd"
                 end-placeholder="结束日期" :picker-options="pickerOptions" size="mini"> </el-date-picker>
 			</template>
 			<template #slot-export-due>
-				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出数据</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出{{ timeTypeName }}</el-button>
 			</template>
 			<template #table-column-income="{scope}">
 				<div :style="negStyle(scope.row.income)">{{ formatNum(scope.row.income) }}</div>
@@ -67,11 +71,17 @@ export default {
             startTime:'',
             endTime:'',
             searchTime:'',
+			// bill=销售 payTime / 采购 entryTime(默认);send=均按 sendTime
+			timeType: 'bill',
             totalAmount:0
 		}
 	},
 	computed: {
 		...mapGetters(['shopInfo']),
+		/** 当前筛选口径文案,导出按钮与提示共用 */
+		timeTypeName() {
+			return this.timeType === 'send' ? '发货时间' : '记账时间'
+		},
 	},
 	methods: {
 		formatNum(val) {
@@ -87,9 +97,20 @@ export default {
 				searchTime: this.searchTime,
 				startTime: this.startTime,
 				endTime: this.endTime,
+				timeType: this.timeType,
 				...(extra || {})
 			};
 		},
+		/** 切换记账时间 / 发货时间并刷新 */
+		changeTimeType(type) {
+			if (this.timeType === type) {
+				return
+			}
+			this.timeType = type
+			if (this.app) {
+				this.app.refresh(this.queryParams())
+			}
+		},
 		exportData(){
 			this.$service.stat.getIncomeOutItem(this.queryParams({export:1})).then(res => {
 				if(res.file){

+ 47 - 4
ghs/src/views/assets/itemSale.vue

@@ -1,18 +1,27 @@
 <!--
   PC 花材销量:与小程序 productSale 同源 /stat-item/show。
-  支付日净销量 + 跨天通过日扣数量/金额(可为负);仅退款只扣金额
+  timeType 切换记账/发货;includeNextDay 切换是否计入跨天售后(售后历史)
 -->
 <template>
 	<div class="shop-list">
 		<x-crud @load="onLoad">
 
 			<template #slot-date-select>
+				<el-button-group style="margin-right:12px;">
+					<el-button size="mini" :type="timeType === 'bill' ? 'primary' : 'default'" @click="changeTimeType('bill')">记账时间</el-button>
+					<el-button size="mini" :type="timeType === 'send' ? 'primary' : 'default'" @click="changeTimeType('send')">发货时间</el-button>
+				</el-button-group>
+				<!-- 与小程序 productSale 一致:包含=通过日扣跨天售后,不含=只看当日净销 -->
+				<el-button-group style="margin-right:12px;">
+					<el-button size="mini" :type="includeNextDay === 1 ? 'primary' : 'default'" @click="changeIncludeNextDay(1)">包含售后历史</el-button>
+					<el-button size="mini" :type="includeNextDay === 0 ? 'primary' : 'default'" @click="changeIncludeNextDay(0)">不含售后历史</el-button>
+				</el-button-group>
                 <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getDate" value-format="yyyy-MM-dd"
                 end-placeholder="结束日期" :picker-options="pickerOptions" size="mini"> </el-date-picker>
 			</template>
 
 			<template #slot-export-due>
-				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出数据</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出{{ exportBtnName }}</el-button>
 			</template>
 
             <template #slot-total-amount>
@@ -23,7 +32,7 @@
 							¥<span :style="negStyle(totalAmount)">{{ formatNum(totalAmount) }}</span>
 							总毛利 <span :style="negStyle(totalMl)">{{ formatNum(totalMl) }}</span>
 						</span>
-						<span v-if="Number(nextDayDeduct) > 0" style="font-size:15px;font-weight:bold;margin-left:15px;color:#e67e22;">跨天售后扣减:¥{{ formatNum(nextDayDeduct) }}</span>
+						<span v-if="includeNextDay === 1 && Number(nextDayDeduct) > 0" style="font-size:15px;font-weight:bold;margin-left:15px;color:#e67e22;">跨天售后扣减:¥{{ formatNum(nextDayDeduct) }}</span>
 					</div>
 				</div>
 			</template>
@@ -84,6 +93,10 @@ export default {
             startTime:'',
             endTime:'',
             searchTime:'',
+			// bill=记账 payTime(默认) / send=发货 sendTime
+			timeType: 'bill',
+			// 1=包含跨天售后扣减(默认,与原口径一致) / 0=不含售后历史
+			includeNextDay: 1,
             totalAmount:0,
 			totalNum:0,
 			totalMl:0,
@@ -92,6 +105,14 @@ export default {
 	},
 	computed: {
 		...mapGetters(['shopInfo']),
+		/** 当前筛选口径文案,导出按钮与提示共用 */
+		timeTypeName() {
+			return this.timeType === 'send' ? '发货时间' : '记账时间'
+		},
+		/** 导出按钮带上当前口径,避免和列表筛选项对不上 */
+		exportBtnName() {
+			return this.timeTypeName + (this.includeNextDay === 1 ? '-含售后历史' : '-不含售后历史')
+		},
 	},
 	methods: {
 		/** 数字展示:不用 truthy,避免负数被当成空 */
@@ -103,15 +124,37 @@ export default {
 			const n = Number(val);
 			return (!isNaN(n) && n < 0) ? 'color:#e74c3c;font-weight:bold;' : '';
 		},
-		/** 与小程序 productSale 对齐的查询参数 */
+		/** 与小程序 productSale 对齐:includeNextDay=1 计入跨天售后,=0 只统计当日净销 */
 		queryParams(extra) {
 			return {
 				searchTime: this.searchTime,
 				startTime: this.startTime,
 				endTime: this.endTime,
+				timeType: this.timeType,
+				includeNextDay: this.includeNextDay,
 				...(extra || {})
 			};
 		},
+		/** 切换记账时间 / 发货时间并刷新 */
+		changeTimeType(type) {
+			if (this.timeType === type) {
+				return
+			}
+			this.timeType = type
+			if (this.app) {
+				this.app.refresh(this.queryParams())
+			}
+		},
+		/** 切换是否计入跨天售后并刷新列表 */
+		changeIncludeNextDay(flag) {
+			if (this.includeNextDay === flag) {
+				return
+			}
+			this.includeNextDay = flag
+			if (this.app) {
+				this.app.refresh(this.queryParams())
+			}
+		},
 		exportData(){
 			this.$service.statItem.getShow(this.queryParams({export:1})).then(res => {
 				if(res.file){

+ 37 - 6
ghs/src/views/custom/account.vue

@@ -1,10 +1,14 @@
 <!--
-  PC 应收统计:未扣跨天金额 / 跨天售后金额 / 已扣跨天金额 三分列,便于对照
+  PC 应收统计:timeType 切换记账时间(bill) / 发货时间(send);未扣跨天 / 跨天售后 / 已扣跨天 三分列。
 -->
 <template>
 	<div class="shop-list">
 		<x-crud @load="onLoad">
 			<template #slot-date-select>
+				<el-button-group style="margin-right:12px;">
+					<el-button size="mini" :type="timeType === 'bill' ? 'primary' : 'default'" @click="changeTimeType('bill')">记账时间</el-button>
+					<el-button size="mini" :type="timeType === 'send' ? 'primary' : 'default'" @click="changeTimeType('send')">发货时间</el-button>
+				</el-button-group>
                 <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getSearchDate" value-format="yyyy-MM-dd"
                 end-placeholder="结束日期" :picker-options="pickerOptions" size="mini"> </el-date-picker>
 			</template>
@@ -31,7 +35,7 @@
 			</template>
 
 			<template #slot-export-due>
-				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportDue()">导出数据</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportDue()">导出{{ timeTypeName }}</el-button>
 			</template>
 
 			<template #table-column-amount="{scope}">
@@ -82,6 +86,8 @@ export default {
             startTime:'',
             endTime:'',
             searchTime:'',
+			// bill=记账 payTime(默认) / send=发货 sendTime
+			timeType: 'bill',
             totalOriginAmount:0,
             totalAmount:0,
 			nextDayDeduct:0,
@@ -90,6 +96,10 @@ export default {
 	},
 	computed: {
 		...mapGetters(['shopInfo']),
+		/** 当前筛选口径文案,导出按钮与提示共用 */
+		timeTypeName() {
+			return this.timeType === 'send' ? '发货时间' : '记账时间'
+		},
 	},
 	methods: {
 		formatNum(val) {
@@ -108,8 +118,29 @@ export default {
 			const n = Number(val);
 			return (!isNaN(n) && n < 0) ? 'color:#e74c3c;font-weight:bold;' : '';
 		},
+		/** 应收统计查询参数:timeType 切记账/发货 */
+		queryParams(extra) {
+			return {
+				searchTime: this.searchTime,
+				startTime: this.startTime,
+				endTime: this.endTime,
+				debt: this.debt,
+				timeType: this.timeType,
+				...(extra || {})
+			};
+		},
+		/** 切换记账时间 / 发货时间并刷新 */
+		changeTimeType(type) {
+			if (this.timeType === type) {
+				return
+			}
+			this.timeType = type
+			if (this.app) {
+				this.app.refresh(this.queryParams())
+			}
+		},
 		exportDue(){
-			this.$service.order.getAccountList({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt,export:1}).then(res => {
+			this.$service.order.getAccountList(this.queryParams({export:1})).then(res => {
 				if(res.file){
 					window.location.href = res.file
 				}
@@ -119,7 +150,7 @@ export default {
                 this.app = app;
                 ctx.service({
                     page: () => {
-                        return this.$service.order.getAccountList({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt}).then((res) => {
+                        return this.$service.order.getAccountList(this.queryParams()).then((res) => {
                             this.totalOriginAmount = this.formatNum(res.totalOriginAmount)
                             this.totalAmount = this.formatNum(res.totalAmount)
 							this.nextDayDeduct = this.formatNum(res.nextDayDeduct)
@@ -190,11 +221,11 @@ export default {
             this.searchTime = 'custom'
             this.startTime = this.currentDateList[0]
             this.endTime = this.currentDateList[1]
-            this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt});
+            this.app.refresh(this.queryParams());
         },
     	changeDebt(e){
 			this.debt = e
-			this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt})
+			this.app.refresh(this.queryParams())
 		},
 	},
 };

+ 38 - 7
ghs/src/views/custom/yj.vue

@@ -1,11 +1,15 @@
 <!--
-  PC 客户业绩:按记账时间汇总开单;跨天售后按通过日扣实际金额并计入退款(与小程序 customSale 对齐)。
+  PC 客户业绩:timeType 切换记账时间(bill) / 发货时间(send);跨天售后按通过日扣实际金额并计入退款(与小程序 customSale 对齐)。
 -->
 <template>
 	<div class="shop-list">
 		<x-crud @load="onLoad">
 			<template #slot-date-select>
-                记账时间:<el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getSearchDate" value-format="yyyy-MM-dd"
+				<el-button-group style="margin-right:12px;">
+					<el-button size="mini" :type="timeType === 'bill' ? 'primary' : 'default'" @click="changeTimeType('bill')">记账时间</el-button>
+					<el-button size="mini" :type="timeType === 'send' ? 'primary' : 'default'" @click="changeTimeType('send')">发货时间</el-button>
+				</el-button-group>
+                <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getSearchDate" value-format="yyyy-MM-dd"
                 end-placeholder="结束日期" :picker-options="pickerOptions" size="mini"> </el-date-picker>
 			</template>
 
@@ -40,7 +44,7 @@
 			</template>
 
 			<template #slot-export-data>
-				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportDue()">导出数据</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportDue()">导出{{ timeTypeName }}</el-button>
 			</template>
 
 			<template #slot-column-option="{scope}">
@@ -95,6 +99,8 @@ export default {
             startTime:'',
             endTime:'',
             searchTime:'',
+			// bill=记账 payTime(默认) / send=发货 sendTime
+			timeType: 'bill',
             totalActPrice:0,
 			totalOrderPrice:0,
 			totalCarton:0,
@@ -110,6 +116,10 @@ export default {
 	},
 	computed: {
 		...mapGetters(['shopInfo']),
+		/** 当前筛选口径文案,导出按钮与提示共用 */
+		timeTypeName() {
+			return this.timeType === 'send' ? '发货时间' : '记账时间'
+		},
 	},
 	methods: {
 		/** 金额展示:空当 0 */
@@ -126,6 +136,27 @@ export default {
 			}
 			return neg ? 'color:#e74c3c;font-weight:bold;' : '';
 		},
+		/** 与小程序 customSale 对齐的查询参数 */
+		queryParams(extra) {
+			return {
+				searchTime: this.searchTime,
+				startTime: this.startTime,
+				endTime: this.endTime,
+				debt: this.debt,
+				timeType: this.timeType,
+				...(extra || {})
+			};
+		},
+		/** 切换记账时间 / 发货时间并刷新 */
+		changeTimeType(type) {
+			if (this.timeType === type) {
+				return
+			}
+			this.timeType = type
+			if (this.app) {
+				this.app.refresh(this.queryParams())
+			}
+		},
 		goChange(data){
 			let query = {};
 			query.customName = data.name
@@ -139,7 +170,7 @@ export default {
 			this.$router.push({ path: '/order/refund-list', query });
 		},
 		exportDue(){
-			this.$service.order.getYj({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt,export:1}).then(res => {
+			this.$service.order.getYj(this.queryParams({export:1})).then(res => {
 				if(res.file){
 					window.location.href = res.file
 				}
@@ -149,7 +180,7 @@ export default {
                 this.app = app;
                 ctx.service({
                     page: () => {
-                        return this.$service.order.getYj({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt}).then((res) => {
+                        return this.$service.order.getYj(this.queryParams()).then((res) => {
                             this.totalActPrice = res.totalActPrice ? res.totalActPrice : 0
 							this.totalOrderPrice = res.totalOrderPrice ? res.totalOrderPrice : 0
 							this.totalCarton = res.totalCarton ? res.totalCarton : 0
@@ -251,11 +282,11 @@ export default {
             this.searchTime = 'custom'
             this.startTime = this.currentDateList[0]
             this.endTime = this.currentDateList[1]
-            this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt});
+            this.app.refresh(this.queryParams());
         },
     	changeDebt(e){
 			this.debt = e
-			this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt})
+			this.app.refresh(this.queryParams())
 		},
 	},
 };

+ 37 - 6
ghs/src/views/in/due.vue

@@ -1,10 +1,14 @@
 <!--
-  PC 应付统计:未扣跨天金额 / 跨天售后金额 / 已扣跨天金额 三分列,便于对照
+  PC 应付统计:timeType 切换记账时间(bill) / 发货时间(send);未扣跨天 / 跨天售后 / 已扣跨天 三分列。
 -->
 <template>
 	<div class="shop-list">
 		<x-crud @load="onLoad">
 			<template #slot-date-select>
+				<el-button-group style="margin-right:12px;">
+					<el-button size="mini" :type="timeType === 'bill' ? 'primary' : 'default'" @click="changeTimeType('bill')">记账时间</el-button>
+					<el-button size="mini" :type="timeType === 'send' ? 'primary' : 'default'" @click="changeTimeType('send')">发货时间</el-button>
+				</el-button-group>
                 <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getSearchDate" value-format="yyyy-MM-dd"
                 end-placeholder="结束日期" :picker-options="pickerOptions" size="mini"> </el-date-picker>
 			</template>
@@ -31,7 +35,7 @@
 			</template>
 
 			<template #slot-export-due>
-				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportDue()">导出数据</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportDue()">导出{{ timeTypeName }}</el-button>
 			</template>
 
 			<template #table-column-amount="{scope}">
@@ -82,6 +86,8 @@ export default {
             startTime:'',
             endTime:'',
             searchTime:'',
+			// bill=记账 entryTime(默认) / send=发货 sendTime
+			timeType: 'bill',
             totalOriginAmount:0,
             totalAmount:0,
 			nextDayDeduct:0,
@@ -90,6 +96,10 @@ export default {
 	},
 	computed: {
 		...mapGetters(['shopInfo']),
+		/** 当前筛选口径文案,导出按钮与提示共用 */
+		timeTypeName() {
+			return this.timeType === 'send' ? '发货时间' : '记账时间'
+		},
 	},
 	methods: {
 		formatNum(val) {
@@ -108,8 +118,29 @@ export default {
 			const n = Number(val);
 			return (!isNaN(n) && n < 0) ? 'color:#e74c3c;font-weight:bold;' : '';
 		},
+		/** 应付统计查询参数:timeType 切记账/发货 */
+		queryParams(extra) {
+			return {
+				searchTime: this.searchTime,
+				startTime: this.startTime,
+				endTime: this.endTime,
+				debt: this.debt,
+				timeType: this.timeType,
+				...(extra || {})
+			};
+		},
+		/** 切换记账时间 / 发货时间并刷新 */
+		changeTimeType(type) {
+			if (this.timeType === type) {
+				return
+			}
+			this.timeType = type
+			if (this.app) {
+				this.app.refresh(this.queryParams())
+			}
+		},
 		exportDue(){
-			this.$service.purchaseOrder.dueList({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt,export:1}).then(res => {
+			this.$service.purchaseOrder.dueList(this.queryParams({export:1})).then(res => {
 				if(res.file){
 					window.location.href = res.file
 				}
@@ -119,7 +150,7 @@ export default {
                 this.app = app;
                 ctx.service({
                     page: () => {
-                        return this.$service.purchaseOrder.dueList({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt}).then((res) => {
+                        return this.$service.purchaseOrder.dueList(this.queryParams()).then((res) => {
                             this.totalOriginAmount = this.formatNum(res.totalOriginAmount)
                             this.totalAmount = this.formatNum(res.totalAmount)
 							this.nextDayDeduct = this.formatNum(res.nextDayDeduct)
@@ -190,11 +221,11 @@ export default {
             this.searchTime = 'custom'
             this.startTime = this.currentDateList[0]
             this.endTime = this.currentDateList[1]
-            this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt});
+            this.app.refresh(this.queryParams());
         },
     	changeDebt(e){
 			this.debt = e
-			this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt})
+			this.app.refresh(this.queryParams())
 		},
 	},
 };

+ 37 - 6
ghs/src/views/in/yj.vue

@@ -1,11 +1,15 @@
 <!--
   PC 供货业绩:与小程序 cgStat 同源 /stat-cg-ghs/profile;
-  跨天采购售后按通过日扣实际金额(可为负,订单数不减)
+  timeType 切换记账时间(bill) / 发货时间(send);跨天采购售后按通过日扣实际金额。
 -->
 <template>
 	<div class="shop-list">
 		<x-crud @load="onLoad">
 			<template #slot-date-select>
+				<el-button-group style="margin-right:12px;">
+					<el-button size="mini" :type="timeType === 'bill' ? 'primary' : 'default'" @click="changeTimeType('bill')">记账时间</el-button>
+					<el-button size="mini" :type="timeType === 'send' ? 'primary' : 'default'" @click="changeTimeType('send')">发货时间</el-button>
+				</el-button-group>
                 <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getSearchDate" value-format="yyyy-MM-dd"
                 end-placeholder="结束日期" :picker-options="pickerOptions" size="mini"> </el-date-picker>
 			</template>
@@ -39,7 +43,7 @@
 			</template>
 
 			<template #slot-export-data>
-				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportDue()">导出数据</el-button>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportDue()">导出{{ timeTypeName }}</el-button>
 			</template>
 
 			<template #slot-column-option="{scope}">
@@ -94,6 +98,8 @@ export default {
             startTime:'',
             endTime:'',
             searchTime:'',
+			// bill=记账 entryTime(默认) / send=发货 sendTime
+			timeType: 'bill',
             totalActPrice:0,
 			totalOrderPrice:0,
 			totalCarton:0,
@@ -108,6 +114,10 @@ export default {
 	},
 	computed: {
 		...mapGetters(['shopInfo']),
+		/** 当前筛选口径文案,导出按钮与提示共用 */
+		timeTypeName() {
+			return this.timeType === 'send' ? '发货时间' : '记账时间'
+		},
 	},
 	methods: {
 		/** 数字展示:不用 truthy,避免 0/负数被当成空 */
@@ -124,6 +134,27 @@ export default {
 			}
 			return neg ? 'color:#e74c3c;font-weight:bold;' : '';
 		},
+		/** 与小程序 cgStat 对齐的查询参数 */
+		queryParams(extra) {
+			return {
+				searchTime: this.searchTime,
+				startTime: this.startTime,
+				endTime: this.endTime,
+				debt: this.debt,
+				timeType: this.timeType,
+				...(extra || {})
+			};
+		},
+		/** 切换记账时间 / 发货时间并刷新 */
+		changeTimeType(type) {
+			if (this.timeType === type) {
+				return
+			}
+			this.timeType = type
+			if (this.app) {
+				this.app.refresh(this.queryParams())
+			}
+		},
 		getTkDetail(info){
 			let query = {ghsId:info.id,ghsName:info.name,searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,status:1};
 			this.$router.push({ path: '/in/refund-list', query })
@@ -138,7 +169,7 @@ export default {
 			this.$router.push({ path: '/in/list', query });
 		},
 		exportDue(){
-			this.$service.statCgGhs.getProfile({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt,export:1}).then(res => {
+			this.$service.statCgGhs.getProfile(this.queryParams({export:1})).then(res => {
 				if(res.file){
 					window.location.href = res.file
 				}
@@ -148,7 +179,7 @@ export default {
                 this.app = app;
                 ctx.service({
                     page: () => {
-                        return this.$service.statCgGhs.getProfile({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt}).then((res) => {
+                        return this.$service.statCgGhs.getProfile(this.queryParams()).then((res) => {
                             this.totalActPrice = this.formatNum(res.totalActPrice)
 							this.totalOrderPrice = this.formatNum(res.totalOrderPrice)
 							this.totalCarton = this.formatNum(res.totalCarton)
@@ -239,11 +270,11 @@ export default {
             this.searchTime = 'custom'
             this.startTime = this.currentDateList[0]
             this.endTime = this.currentDateList[1]
-            this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt});
+            this.app.refresh(this.queryParams());
         },
     	changeDebt(e){
 			this.debt = e
-			this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt})
+			this.app.refresh(this.queryParams())
 		},
 	},
 };