|
@@ -353,7 +353,7 @@
|
|
|
>导出发货单
|
|
>导出发货单
|
|
|
</el-button>
|
|
</el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
|
|
|
|
+ <!-- <el-col :span="1.5">
|
|
|
<el-button
|
|
<el-button
|
|
|
icon="el-icon-upload2"
|
|
icon="el-icon-upload2"
|
|
|
plain
|
|
plain
|
|
@@ -364,6 +364,16 @@
|
|
|
@click="openDeliveryNote"
|
|
@click="openDeliveryNote"
|
|
|
>{{ orderUpload.isUploading ? '导入中...' : '导入发货单' }}
|
|
>{{ orderUpload.isUploading ? '导入中...' : '导入发货单' }}
|
|
|
</el-button>
|
|
</el-button>
|
|
|
|
|
+ </el-col> -->
|
|
|
|
|
+ <el-col :span="1.5">
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ icon="el-icon-truck"
|
|
|
|
|
+ plain
|
|
|
|
|
+ size="mini"
|
|
|
|
|
+ type="warning"
|
|
|
|
|
+ @click="handleBatchDelivery"
|
|
|
|
|
+ >一键自提
|
|
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
<el-button
|
|
@@ -920,7 +930,7 @@
|
|
|
<span slot="footer" class="dialog-footer">
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<!-- 小程序Appid选择 -->
|
|
<!-- 小程序Appid选择 -->
|
|
|
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" class="demo-ruleForm" label-width="120px">
|
|
<el-form ref="ruleForm" :model="ruleForm" :rules="rules" class="demo-ruleForm" label-width="120px">
|
|
|
- <el-form-item label="小程序:" prop="miniAppId">
|
|
|
|
|
|
|
+ <!-- <el-form-item label="小程序:" prop="miniAppId">
|
|
|
<el-select
|
|
<el-select
|
|
|
v-model="ruleForm.miniAppId"
|
|
v-model="ruleForm.miniAppId"
|
|
|
clearable
|
|
clearable
|
|
@@ -934,7 +944,7 @@
|
|
|
:value="item.appId"
|
|
:value="item.appId"
|
|
|
/>
|
|
/>
|
|
|
</el-select>
|
|
</el-select>
|
|
|
- </el-form-item>
|
|
|
|
|
|
|
+ </el-form-item> -->
|
|
|
<el-form-item label="发货类型:" prop="shipmentType">
|
|
<el-form-item label="发货类型:" prop="shipmentType">
|
|
|
<el-radio-group v-model="ruleForm.shipmentType">
|
|
<el-radio-group v-model="ruleForm.shipmentType">
|
|
|
<el-radio :label="1">线上发货</el-radio>
|
|
<el-radio :label="1">线上发货</el-radio>
|
|
@@ -1149,6 +1159,94 @@
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
+ <!-- 导出发货单对话框 -->
|
|
|
|
|
+ <el-dialog
|
|
|
|
|
+ :title="exportShippingDialog.title"
|
|
|
|
|
+ :visible.sync="exportShippingDialog.open"
|
|
|
|
|
+ width="500px"
|
|
|
|
|
+ append-to-body
|
|
|
|
|
+ :close-on-click-modal="false"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-form label-width="120px">
|
|
|
|
|
+ <el-form-item label="发货时间范围" required>
|
|
|
|
|
+ <el-date-picker
|
|
|
|
|
+ v-model="exportShippingDialog.deliverySendTimeRange"
|
|
|
|
|
+ type="daterange"
|
|
|
|
|
+ range-separator="至"
|
|
|
|
|
+ start-placeholder="开始日期"
|
|
|
|
|
+ end-placeholder="结束日期"
|
|
|
|
|
+ value-format="yyyy-MM-dd"
|
|
|
|
|
+ :clearable="true"
|
|
|
|
|
+ style="width: 100%"
|
|
|
|
|
+ :picker-options="{
|
|
|
|
|
+ shortcuts: [
|
|
|
|
|
+ {
|
|
|
|
|
+ text: '今天',
|
|
|
|
|
+ onClick(picker) {
|
|
|
|
|
+ const end = new Date();
|
|
|
|
|
+ const start = new Date();
|
|
|
|
|
+ picker.$emit('pick', [start, end]);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ text: '昨天',
|
|
|
|
|
+ onClick(picker) {
|
|
|
|
|
+ const end = new Date();
|
|
|
|
|
+ const start = new Date();
|
|
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24);
|
|
|
|
|
+ end.setTime(end.getTime() - 3600 * 1000 * 24);
|
|
|
|
|
+ picker.$emit('pick', [start, end]);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ text: '最近7天',
|
|
|
|
|
+ onClick(picker) {
|
|
|
|
|
+ const end = new Date();
|
|
|
|
|
+ const start = new Date();
|
|
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
|
|
|
|
|
+ picker.$emit('pick', [start, end]);
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ text: '最近30天',
|
|
|
|
|
+ onClick(picker) {
|
|
|
|
|
+ const end = new Date();
|
|
|
|
|
+ const start = new Date();
|
|
|
|
|
+ start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
|
|
|
|
|
+ picker.$emit('pick', [start, end]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }"
|
|
|
|
|
+ />
|
|
|
|
|
+ </el-form-item>
|
|
|
|
|
+
|
|
|
|
|
+ <el-alert
|
|
|
|
|
+ title="提示"
|
|
|
|
|
+ type="info"
|
|
|
|
|
+ :closable="false"
|
|
|
|
|
+ show-icon
|
|
|
|
|
+ style="margin-bottom: 15px;"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div style="line-height: 1.6;">
|
|
|
|
|
+ <p style="margin: 5px 0;">• 默认导出<strong>已发货(待收货)</strong>状态的订单</p>
|
|
|
|
|
+ <p style="margin: 5px 0;">• 可以选择快捷时间范围:今天、昨天、最近7天等</p>
|
|
|
|
|
+ <p style="margin: 5px 0;">• 不选择时间将导出所有已发货订单</p>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-alert>
|
|
|
|
|
+ </el-form>
|
|
|
|
|
+
|
|
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
|
|
+ <el-button @click="cancelExportShippingDialog">取 消</el-button>
|
|
|
|
|
+ <el-button
|
|
|
|
|
+ type="primary"
|
|
|
|
|
+ @click="confirmExportShippingOrder"
|
|
|
|
|
+ :loading="exportShippingDialog.loading"
|
|
|
|
|
+ icon="el-icon-download"
|
|
|
|
|
+ >导出发货单</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-dialog>
|
|
|
|
|
+
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -1167,7 +1265,8 @@ import {
|
|
|
queryErpPhone,
|
|
queryErpPhone,
|
|
|
saveErpPhone,editErpPhone,batchCreateErpOrder,batchSetErpOrder,
|
|
saveErpPhone,editErpPhone,batchCreateErpOrder,batchSetErpOrder,
|
|
|
importShippingOrderTemplate,
|
|
importShippingOrderTemplate,
|
|
|
- getMiniProgramList
|
|
|
|
|
|
|
+ getMiniProgramList,
|
|
|
|
|
+ batchDeliveryAllPendingOrders
|
|
|
} from '@/api/hisStore/storeOrder'
|
|
} from '@/api/hisStore/storeOrder'
|
|
|
import { getUserList } from '@/api/hisStore/user'
|
|
import { getUserList } from '@/api/hisStore/user'
|
|
|
import { getAddressList } from '@/api/hisStore/userAddress'
|
|
import { getAddressList } from '@/api/hisStore/userAddress'
|
|
@@ -1463,6 +1562,9 @@ export default {
|
|
|
miniAppId: null,
|
|
miniAppId: null,
|
|
|
shipmentType: 4
|
|
shipmentType: 4
|
|
|
},
|
|
},
|
|
|
|
|
+ batchDeliveryForm: {
|
|
|
|
|
+ shipmentType: 2
|
|
|
|
|
+ },
|
|
|
productQuery: {
|
|
productQuery: {
|
|
|
pageNum:1,
|
|
pageNum:1,
|
|
|
pageSize:10,
|
|
pageSize:10,
|
|
@@ -1470,6 +1572,13 @@ export default {
|
|
|
},
|
|
},
|
|
|
options:[],
|
|
options:[],
|
|
|
showFinanceTableField: false,
|
|
showFinanceTableField: false,
|
|
|
|
|
+ // 导出发货单对话框
|
|
|
|
|
+ exportShippingDialog: {
|
|
|
|
|
+ open: false,
|
|
|
|
|
+ title: '导出发货单',
|
|
|
|
|
+ loading: false,
|
|
|
|
|
+ deliverySendTimeRange: [] // 发货时间范围
|
|
|
|
|
+ },
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
@@ -2563,41 +2672,102 @@ export default {
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
handleExportShippingOrder() {
|
|
handleExportShippingOrder() {
|
|
|
- if (this.queryParams.status == '00') {
|
|
|
|
|
- this.queryParams.status = null
|
|
|
|
|
|
|
+ console.log('=== 点击导出发货单按钮 ===')
|
|
|
|
|
+ console.log('exportShippingDialog:', this.exportShippingDialog)
|
|
|
|
|
+ // 打开导出发货单对话框
|
|
|
|
|
+ this.exportShippingDialog.open = true
|
|
|
|
|
+ console.log('exportShippingDialog.open 设置为:', this.exportShippingDialog.open)
|
|
|
|
|
+ // 默认使用筛选表单中的发货时间
|
|
|
|
|
+ this.exportShippingDialog.deliverySendTimeRange = this.deliverySendTimeRange ? [...this.deliverySendTimeRange] : []
|
|
|
|
|
+ console.log('deliverySendTimeRange:', this.exportShippingDialog.deliverySendTimeRange)
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // 确认导出发货单
|
|
|
|
|
+ confirmExportShippingOrder() {
|
|
|
|
|
+ // 构建导出参数
|
|
|
|
|
+ const params = { ...this.queryParams }
|
|
|
|
|
+
|
|
|
|
|
+ // 处理状态参数:默认导出已发货订单(status=2)
|
|
|
|
|
+ if (params.status == '00') {
|
|
|
|
|
+ params.status = '2' // 默认导出待收货/已发货状态
|
|
|
|
|
+ } else if (!params.status) {
|
|
|
|
|
+ params.status = '2' // 如果没有选择状态,默认为待收货
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 处理下单时间范围
|
|
|
if (this.createTimeRange != null && this.createTimeRange.length == 2) {
|
|
if (this.createTimeRange != null && this.createTimeRange.length == 2) {
|
|
|
- this.queryParams.createTimeRange = this.createTimeRange[0] + '--' + this.createTimeRange[1]
|
|
|
|
|
|
|
+ params.createTimeRange = this.createTimeRange[0] + '--' + this.createTimeRange[1]
|
|
|
} else {
|
|
} else {
|
|
|
- this.queryParams.createTimeRange = null
|
|
|
|
|
|
|
+ params.createTimeRange = null
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 处理支付时间范围
|
|
|
if (this.payTimeRange != null && this.payTimeRange.length == 2) {
|
|
if (this.payTimeRange != null && this.payTimeRange.length == 2) {
|
|
|
- this.queryParams.payTimeRange = this.payTimeRange[0] + '--' + this.payTimeRange[1]
|
|
|
|
|
|
|
+ params.payTimeRange = this.payTimeRange[0] + '--' + this.payTimeRange[1]
|
|
|
} else {
|
|
} else {
|
|
|
- this.queryParams.payTimeRange = null
|
|
|
|
|
|
|
+ params.payTimeRange = null
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 处理导入时间范围(回单时间)
|
|
|
if (this.deliveryImportTimeRange != null && this.deliveryImportTimeRange.length == 2) {
|
|
if (this.deliveryImportTimeRange != null && this.deliveryImportTimeRange.length == 2) {
|
|
|
- this.queryParams.deliveryImportTimeRange = this.deliveryImportTimeRange[0] + '--' + this.deliveryImportTimeRange[1]
|
|
|
|
|
|
|
+ params.deliveryImportTimeRange = this.deliveryImportTimeRange[0] + '--' + this.deliveryImportTimeRange[1]
|
|
|
} else {
|
|
} else {
|
|
|
- this.queryParams.deliveryImportTimeRange = null
|
|
|
|
|
|
|
+ params.deliveryImportTimeRange = null
|
|
|
}
|
|
}
|
|
|
- if (this.deliverySendTimeRange != null && this.deliverySendTimeRange.length == 2) {
|
|
|
|
|
- this.queryParams.deliverySendTimeRange = this.deliverySendTimeRange[0] + '--' + this.deliverySendTimeRange[1]
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 处理发货时间范围 - 使用对话框中输入的时间,转换为后端需要的格式 yyyyMMdd--yyyyMMdd
|
|
|
|
|
+ if (this.exportShippingDialog.deliverySendTimeRange != null && this.exportShippingDialog.deliverySendTimeRange.length == 2) {
|
|
|
|
|
+ // 将 yyyy-MM-dd 格式转换为 yyyyMMdd 格式
|
|
|
|
|
+ const startDate = this.exportShippingDialog.deliverySendTimeRange[0].replace(/-/g, '')
|
|
|
|
|
+ const endDate = this.exportShippingDialog.deliverySendTimeRange[1].replace(/-/g, '')
|
|
|
|
|
+ params.deliverySendTimeRange = startDate + '--' + endDate
|
|
|
} else {
|
|
} else {
|
|
|
- this.queryParams.deliverySendTimeRange = null
|
|
|
|
|
|
|
+ params.deliverySendTimeRange = null
|
|
|
}
|
|
}
|
|
|
- const queryParams = this.addDateRange(this.queryParams, this.dateRange)
|
|
|
|
|
- this.$confirm('是否确认导出所有订单明细数据项?', '警告', {
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 移除空值参数
|
|
|
|
|
+ Object.keys(params).forEach(key => {
|
|
|
|
|
+ if (params[key] === '' || params[key] === undefined || params[key] === null) {
|
|
|
|
|
+ delete params[key]
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ // 构建确认消息
|
|
|
|
|
+ let confirmMessage = '是否确认导出发货单数据?'
|
|
|
|
|
+ if (params.deliverySendTimeRange) {
|
|
|
|
|
+ const dateRange = this.exportShippingDialog.deliverySendTimeRange[0] + ' 至 ' + this.exportShippingDialog.deliverySendTimeRange[1]
|
|
|
|
|
+ confirmMessage = `是否确认导出 ${dateRange} 期间的发货单数据?`
|
|
|
|
|
+ } else {
|
|
|
|
|
+ confirmMessage = '未选择发货时间,将导出所有已发货订单,是否确认?'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.$confirm(confirmMessage, '导出发货单', {
|
|
|
confirmButtonText: '确定',
|
|
confirmButtonText: '确定',
|
|
|
cancelButtonText: '取消',
|
|
cancelButtonText: '取消',
|
|
|
type: 'warning'
|
|
type: 'warning'
|
|
|
- }).then(function() {
|
|
|
|
|
- return exportShippingOrder(queryParams)
|
|
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ this.exportShippingDialog.loading = true
|
|
|
|
|
+ return exportShippingOrder(params)
|
|
|
}).then(response => {
|
|
}).then(response => {
|
|
|
this.download(response.msg)
|
|
this.download(response.msg)
|
|
|
- }).catch(function() {
|
|
|
|
|
|
|
+ this.$modal.msgSuccess('发货单导出成功')
|
|
|
|
|
+ // 关闭对话框
|
|
|
|
|
+ this.exportShippingDialog.open = false
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ if (error !== 'cancel') {
|
|
|
|
|
+ console.error('导出发货单失败:', error)
|
|
|
|
|
+ this.$modal.msgError('导出发货单失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ this.exportShippingDialog.loading = false
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+
|
|
|
|
|
+ // 取消导出发货单
|
|
|
|
|
+ cancelExportShippingDialog() {
|
|
|
|
|
+ this.exportShippingDialog.open = false
|
|
|
|
|
+ this.exportShippingDialog.deliverySendTimeRange = []
|
|
|
|
|
+ },
|
|
|
handleImport() {
|
|
handleImport() {
|
|
|
this.upload.title = '导入银行回单'
|
|
this.upload.title = '导入银行回单'
|
|
|
this.upload.open = true
|
|
this.upload.open = true
|
|
@@ -2842,6 +3012,47 @@ export default {
|
|
|
this.$refs.upload.clearFiles()
|
|
this.$refs.upload.clearFiles()
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
|
|
+ // 一键发货功能
|
|
|
|
|
+ async handleBatchDelivery() {
|
|
|
|
|
+ this.$confirm(
|
|
|
|
|
+ '此操作将把所有待发货订单标记为已发货并同步到微信物流,操作不可逆,是否继续?',
|
|
|
|
|
+ '确认一键发货',
|
|
|
|
|
+ {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ dangerouslyUseHTMLString: true,
|
|
|
|
|
+ customClass: 'batch-delivery-confirm'
|
|
|
|
|
+ }
|
|
|
|
|
+ ).then(async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ this.loading = true;
|
|
|
|
|
+ const response = await batchDeliveryAllPendingOrders(this.batchDeliveryForm.shipmentType);
|
|
|
|
|
+
|
|
|
|
|
+ if (response.code === 200) {
|
|
|
|
|
+ this.$message.success(`一键发货成功:${response.msg || '已成功处理待发货订单'}`);
|
|
|
|
|
+ // 刷新数据
|
|
|
|
|
+ this.getList();
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$message.error(`一键发货失败:${response.msg || '服务器返回错误'}`);
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (error) {
|
|
|
|
|
+ console.error('一键发货失败:', error);
|
|
|
|
|
+ let errorMessage = '一键发货失败,请稍后重试';
|
|
|
|
|
+ if (error.response && error.response.data && error.response.data.msg) {
|
|
|
|
|
+ errorMessage = error.response.data.msg;
|
|
|
|
|
+ } else if (error.message) {
|
|
|
|
|
+ errorMessage = error.message;
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$message.error(errorMessage);
|
|
|
|
|
+ } finally {
|
|
|
|
|
+ this.loading = false;
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(() => {
|
|
|
|
|
+ // 用户取消操作
|
|
|
|
|
+ this.$message.info('已取消一键发货');
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
getProduct(value){
|
|
getProduct(value){
|
|
|
//获取商品列表
|
|
//获取商品列表
|
|
|
this.productQuery.productName = value;
|
|
this.productQuery.productName = value;
|