|
@@ -789,6 +789,50 @@
|
|
|
>确认</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <!-- 导出字段选择对话框 -->
|
|
|
+ <el-dialog :title="exportFieldDialog.title" :visible.sync="exportFieldDialog.open" width="800px" append-to-body>
|
|
|
+ <div v-loading="exportFieldDialog.loading">
|
|
|
+ <div style="margin-bottom: 20px;">
|
|
|
+ <el-button type="primary" size="small" @click="selectAllFields">全选</el-button>
|
|
|
+ <el-button type="default" size="small" @click="unselectAllFields">全不选</el-button>
|
|
|
+ <el-button type="success" size="small" @click="selectDefaultFields">选择常用</el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="field-selection-container">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="8" v-for="field in exportFieldOptions" :key="field.key">
|
|
|
+ <el-checkbox
|
|
|
+ v-model="field.checked"
|
|
|
+ :label="field.label"
|
|
|
+ style="margin-bottom: 12px; width: 100%;"
|
|
|
+ >
|
|
|
+ {{ field.label }}
|
|
|
+ </el-checkbox>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="field-count-info" style="margin-top: 20px; padding: 10px; background: #f5f7fa; border-radius: 4px;">
|
|
|
+ <i class="el-icon-info"></i>
|
|
|
+ <span v-if="getSelectedFieldsCount() > 0">
|
|
|
+ 已选择 <span style="color: #409EFF; font-weight: bold;">{{ getSelectedFieldsCount() }}</span> 个字段
|
|
|
+ </span>
|
|
|
+ <span v-else style="color: #E6A23C; font-weight: bold;">
|
|
|
+ <i class="el-icon-warning"></i>
|
|
|
+ 未选择任何字段,将导出所有字段
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="cancelExportFieldDialog">取 消</el-button>
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ @click="confirmExportFields"
|
|
|
+ >确认导出</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -926,6 +970,69 @@ export default {
|
|
|
loading: true,
|
|
|
// 导出遮罩层
|
|
|
exportLoading: false,
|
|
|
+ // 导出字段选择弹窗
|
|
|
+ exportFieldDialog: {
|
|
|
+ open: false,
|
|
|
+ title: "选择导出字段",
|
|
|
+ loading: false
|
|
|
+ },
|
|
|
+ // 可选择的导出字段列表
|
|
|
+ exportFieldOptions: [
|
|
|
+ { key: 'orderCode', label: '订单号', checked: true },
|
|
|
+ { key: 'prescribeCode', label: '处方单号', checked: true },
|
|
|
+ { key: 'userId', label: '会员ID', checked: false },
|
|
|
+ { key: 'extendOrderId', label: '管易云订单号', checked: false },
|
|
|
+ { key: 'companyName', label: '所属公司', checked: true },
|
|
|
+ { key: 'companyUserNickName', label: '所属销售', checked: true },
|
|
|
+ { key: 'storeName', label: '店铺名称', checked: true },
|
|
|
+ { key: 'orderType', label: '订单类型', checked: false },
|
|
|
+ { key: 'userName', label: '收货人姓名', checked: true },
|
|
|
+ { key: 'userPhone', label: '收货人电话', checked: true },
|
|
|
+ { key: 'userAddress', label: '详细地址', checked: true },
|
|
|
+ { key: 'totalPrice', label: '商品金额', checked: true },
|
|
|
+ { key: 'totalNum', label: '商品数量', checked: true },
|
|
|
+ { key: 'payPrice', label: '应付金额', checked: true },
|
|
|
+ { key: 'payMoney', label: '实付金额', checked: true },
|
|
|
+ { key: 'payRemain', label: '物流代收金额', checked: false },
|
|
|
+ { key: 'discountMoney', label: '优惠金额', checked: false },
|
|
|
+ { key: 'createTime', label: '下单时间', checked: true },
|
|
|
+ { key: 'payTime', label: '支付时间', checked: true },
|
|
|
+ { key: 'payType', label: '支付方式', checked: true },
|
|
|
+ { key: 'status', label: '订单状态', checked: true },
|
|
|
+ { key: 'refundTime', label: '退款时间', checked: false },
|
|
|
+ { key: 'refundMoney', label: '退款金额', checked: false },
|
|
|
+ { key: 'deliveryCode', label: '快递公司编号', checked: false },
|
|
|
+ { key: 'deliveryName', label: '快递公司', checked: false },
|
|
|
+ { key: 'deliverySn', label: '快递单号', checked: false },
|
|
|
+ { key: 'remark', label: '备注', checked: false },
|
|
|
+ { key: 'deliveryPayStatus', label: '物流代收结算状态', checked: false },
|
|
|
+ { key: 'deliveryTime', label: '快递账单日期', checked: false },
|
|
|
+ { key: 'deliveryPayTime', label: '快递结算日期', checked: false },
|
|
|
+ { key: 'deliveryPayMoney', label: '物流结算费用', checked: false },
|
|
|
+ { key: 'deliveryStatus', label: '物流状态', checked: false },
|
|
|
+ { key: 'deliveryType', label: '物流跟踪状态', checked: false },
|
|
|
+ { key: 'packageName', label: '套餐名称', checked: true },
|
|
|
+ { key: 'packageSecondName', label: '套餐包别名', checked: false },
|
|
|
+ { key: 'orderBuyType', label: '订单购买类型', checked: false },
|
|
|
+ { key: 'channel', label: '公众号/渠道', checked: false },
|
|
|
+ { key: 'scheduleName', label: '档期归属', checked: false },
|
|
|
+ { key: 'tuiMoneyStatus', label: '推广佣金状态', checked: false },
|
|
|
+ { key: 'orderChannel', label: '渠道', checked: false },
|
|
|
+ { key: 'qwSubject', label: '企微主体', checked: false },
|
|
|
+ { key: 'cycle', label: '疗程天数', checked: false },
|
|
|
+ { key: 'followFrequency', label: '随访频率', checked: false },
|
|
|
+ { key: 'followCount', label: '随访次数', checked: false },
|
|
|
+ { key: 'patientName', label: '就诊人', checked: true },
|
|
|
+ { key: 'relation', label: '与本人关系', checked: false },
|
|
|
+ { key: 'user', label: '会员', checked: false },
|
|
|
+ { key: 'doctorName', label: '医生', checked: false },
|
|
|
+ { key: 'packageCateName', label: '套餐包分类', checked: false },
|
|
|
+ { key: 'age', label: '年龄', checked: false },
|
|
|
+ { key: 'sex', label: '性别', checked: false },
|
|
|
+ { key: 'source', label: '订单来源', checked: false }
|
|
|
+ ],
|
|
|
+ // 已选择的导出字段
|
|
|
+ selectedExportFields: [],
|
|
|
// 选中数组
|
|
|
ids: [],
|
|
|
// 非单个禁用
|
|
@@ -2113,7 +2220,77 @@ export default {
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleOrderExport() {
|
|
|
- var that=this;
|
|
|
+ // 打开字段选择对话框
|
|
|
+ this.exportFieldDialog.open = true;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 导出字段选择相关方法
|
|
|
+ // 全选字段
|
|
|
+ selectAllFields() {
|
|
|
+ this.exportFieldOptions.forEach(field => {
|
|
|
+ field.checked = true;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 全不选字段
|
|
|
+ unselectAllFields() {
|
|
|
+ this.exportFieldOptions.forEach(field => {
|
|
|
+ field.checked = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 选择常用字段
|
|
|
+ selectDefaultFields() {
|
|
|
+ // 先全不选
|
|
|
+ this.unselectAllFields();
|
|
|
+ // 然后选择常用字段
|
|
|
+ const defaultFields = ['orderCode', 'prescribeCode', 'companyName', 'companyUserNickName',
|
|
|
+ 'storeName', 'userName', 'userPhone', 'userAddress', 'totalPrice',
|
|
|
+ 'totalNum', 'payPrice', 'payMoney', 'createTime', 'payTime',
|
|
|
+ 'payType', 'status', 'packageName', 'patientName'];
|
|
|
+ this.exportFieldOptions.forEach(field => {
|
|
|
+ if (defaultFields.includes(field.key)) {
|
|
|
+ field.checked = true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ // 获取已选择字段数量
|
|
|
+ getSelectedFieldsCount() {
|
|
|
+ return this.exportFieldOptions.filter(field => field.checked).length;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 取消导出字段选择
|
|
|
+ cancelExportFieldDialog() {
|
|
|
+ this.exportFieldDialog.open = false;
|
|
|
+ },
|
|
|
+
|
|
|
+ // 确认导出字段
|
|
|
+ confirmExportFields() {
|
|
|
+ // 获取已选择的字段
|
|
|
+ const selectedFieldsArray = this.exportFieldOptions.filter(field => field.checked);
|
|
|
+
|
|
|
+ let selectedFields = '';
|
|
|
+ if (selectedFieldsArray.length === 0) {
|
|
|
+ // 如果没有选择任何字段,则导出全部字段(不传filter参数)
|
|
|
+ selectedFields = null;
|
|
|
+ } else {
|
|
|
+ // 如果选择了字段,则只导出选中的字段
|
|
|
+ selectedFields = selectedFieldsArray.map(field => field.key).join(',');
|
|
|
+ }
|
|
|
+
|
|
|
+ // 关闭弹窗
|
|
|
+ this.exportFieldDialog.open = false;
|
|
|
+
|
|
|
+ // 执行导出操作
|
|
|
+ this.doExportOrder(selectedFields);
|
|
|
+ },
|
|
|
+
|
|
|
+ // 执行导出操作
|
|
|
+ doExportOrder(selectedFields) {
|
|
|
+ var that = this;
|
|
|
+
|
|
|
+ // 处理查询参数
|
|
|
if(this.payTypeArr.length>0){
|
|
|
this.queryParams.payType=this.payTypeArr.toString();
|
|
|
}
|
|
@@ -2144,33 +2321,54 @@ export default {
|
|
|
else{
|
|
|
this.queryParams.qwSubject=null
|
|
|
}
|
|
|
+
|
|
|
const queryParams = this.queryParams;
|
|
|
- this.$confirm('是否确认导出所有订单数据项?', "警告", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- }).then(() => {
|
|
|
- this.exportLoading = true;
|
|
|
- return exportOrder2(queryParams);
|
|
|
- }).then(response => {
|
|
|
- console.log(response)
|
|
|
- if(response.code==200){
|
|
|
- console.log(response.msg)
|
|
|
- that.msgSuccess(response.msg);
|
|
|
- that.taskId=response.data;
|
|
|
- that.time=setInterval(function(){
|
|
|
- //查订单
|
|
|
- getTask(that.taskId).then(res => {
|
|
|
- if(res.data.status==1){
|
|
|
- that.exportLoading = false;
|
|
|
- clearTimeout(that.time)
|
|
|
- that.time=null;
|
|
|
- that.download(res.data.fileUrl);
|
|
|
- }
|
|
|
- });
|
|
|
- },10000);
|
|
|
- }
|
|
|
- }).catch(() => {});
|
|
|
+
|
|
|
+ // 根据是否选择字段显示不同的确认消息
|
|
|
+ let confirmMessage = '';
|
|
|
+ if (selectedFields === null) {
|
|
|
+ confirmMessage = '没有选择字段,将导出所有字段的订单数据,确认继续?';
|
|
|
+ } else {
|
|
|
+ const fieldCount = selectedFields.split(',').length;
|
|
|
+ confirmMessage = `确认导出选中的 ${fieldCount} 个字段的订单数据?`;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.$confirm(confirmMessage, "确认导出", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ this.exportLoading = true;
|
|
|
+
|
|
|
+ // 构建请求参数
|
|
|
+ const requestParams = {...queryParams};
|
|
|
+ // 只有当selectedFields不为null时才添加filter参数
|
|
|
+ if (selectedFields !== null) {
|
|
|
+ requestParams.filter = selectedFields;
|
|
|
+ }
|
|
|
+
|
|
|
+ return exportOrder2(requestParams);
|
|
|
+ }).then(response => {
|
|
|
+ console.log(response)
|
|
|
+ if(response.code==200){
|
|
|
+ console.log(response.msg)
|
|
|
+ that.msgSuccess(response.msg);
|
|
|
+ that.taskId=response.data;
|
|
|
+ that.time=setInterval(function(){
|
|
|
+ //查订单
|
|
|
+ getTask(that.taskId).then(res => {
|
|
|
+ if(res.data.status==1){
|
|
|
+ that.exportLoading = false;
|
|
|
+ clearTimeout(that.time)
|
|
|
+ that.time=null;
|
|
|
+ that.download(res.data.fileUrl);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },10000);
|
|
|
+ }
|
|
|
+ }).catch(() => {
|
|
|
+ this.exportLoading = false;
|
|
|
+ });
|
|
|
},
|
|
|
/** 查询部门下拉树结构 */
|
|
|
getTreeselect() {
|
|
@@ -2355,4 +2553,43 @@ export default {
|
|
|
gap: 8px;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+/* 导出字段选择弹窗样式 */
|
|
|
+.field-selection-container {
|
|
|
+ max-height: 400px;
|
|
|
+ overflow-y: auto;
|
|
|
+ border: 1px solid #e4e7ed;
|
|
|
+ border-radius: 4px;
|
|
|
+ padding: 16px;
|
|
|
+ background-color: #fafafa;
|
|
|
+}
|
|
|
+
|
|
|
+.field-selection-container .el-checkbox {
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-right: 0;
|
|
|
+ margin-bottom: 8px;
|
|
|
+ padding: 8px 12px;
|
|
|
+ border-radius: 4px;
|
|
|
+ transition: background-color 0.3s;
|
|
|
+}
|
|
|
+
|
|
|
+.field-selection-container .el-checkbox:hover {
|
|
|
+ background-color: #f0f2f5;
|
|
|
+}
|
|
|
+
|
|
|
+.field-selection-container .el-checkbox.is-checked {
|
|
|
+ background-color: #e6f7ff;
|
|
|
+ border: 1px solid #91d5ff;
|
|
|
+}
|
|
|
+
|
|
|
+.field-count-info {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #606266;
|
|
|
+}
|
|
|
+
|
|
|
+.field-count-info i {
|
|
|
+ margin-right: 8px;
|
|
|
+ color: #409EFF;
|
|
|
+}
|
|
|
</style>
|