|
|
@@ -25,7 +25,7 @@
|
|
|
{{ $t('common.action') }}<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
</el-button>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
- <el-dropdown-item command="remark" v-if="scope.row.COUNTRY.value === 'UAE'" @click.native="handleEditRemark(scope.row)" >{{ $t('table.remark') }}</el-dropdown-item>
|
|
|
+ <el-dropdown-item command="remark" v-if="scope.row.COUNTRY.value === 'UAE'" @click.native="handleEditRemark(scope.row)" >{{ $t('table.edit') }}</el-dropdown-item>
|
|
|
<el-dropdown-item command="edit" v-if="scope.row.COUNTRY.value === 'UAE'" @click.native="handleInvoiceExport(scope.row)">{{ $t('shop.invoice') }}</el-dropdown-item>
|
|
|
<el-dropdown-item command="edit" @click.native="handleDel(scope.row)" v-if="permission.hasPermission(`shop/edit`)">{{ $t('shop.deleteOrder') }}</el-dropdown-item>
|
|
|
<!-- <el-dropdown-item command="edit" @click.native="handleEdit(scope.row)" v-if="permission.hasPermission(`shop/edit`)">Edit order<!– 编辑订单 –></el-dropdown-item>
|
|
|
@@ -58,20 +58,31 @@
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
|
- <el-dialog :title="$t('table.remark')" :visible.sync="dialogRemark"><!-- 备注 -->
|
|
|
- <Tinymce
|
|
|
+ <el-dialog :title="$t('table.edit')" :visible.sync="dialogRemark"><!-- 备注 -->
|
|
|
+ <el-form label-position="top">
|
|
|
+ <el-form-item :label="$t('table.remark')">
|
|
|
+ <Tinymce
|
|
|
v-if="dialogRemark"
|
|
|
- v-model="orderRemark"
|
|
|
- :toolbar="['undo redo | bold italic underline | bullist numlist | removeformat']"
|
|
|
- :menubar="false"
|
|
|
- :editorImageShow="false"
|
|
|
- :height="300"
|
|
|
- />
|
|
|
+ v-model="orderRemark"
|
|
|
+ :toolbar="['undo redo | bold italic underline | bullist numlist | removeformat']"
|
|
|
+ :menubar="false"
|
|
|
+ :editorImageShow="false"
|
|
|
+ />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item :label="$t('shop.method')">
|
|
|
+ <el-select v-model="orderMethod">
|
|
|
+ <el-option v-for="item in methodList" :key="item" :label="item" :value="item"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button @click="dialogRemark = false">{{ $t('table.cancel') }}<!-- 取 消 --></el-button>
|
|
|
<el-button type="primary" @click.native="saveRemark">{{ $t('common.confirm') }}</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+ <el-dialog top="5vh" :title="$t('shop.preview')" :visible.sync="pdfVisible" @close="()=>{pdfVisible = false; pdfUrl = ''}"><!-- 备注 -->
|
|
|
+ <embed :src="pdfUrl" type="application/pdf" width="100%" height="950px">
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -88,7 +99,7 @@
|
|
|
orderListExportPdf,
|
|
|
deleteOrder,
|
|
|
updateOrderRemark,
|
|
|
- orderInvoiceExport
|
|
|
+ orderInvoiceExport, getOrderInvoiceMethod, orderInvoiceExportFile
|
|
|
} from '@/api/shop'
|
|
|
import Tinymce from '@/components/Tinymce'
|
|
|
|
|
|
@@ -104,6 +115,7 @@
|
|
|
// }
|
|
|
this.fixedColumn = getScreenWidth() < 500 ? false : 'right'
|
|
|
this.getData()
|
|
|
+ this.getMethodData()
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
@@ -127,8 +139,12 @@
|
|
|
expressCompany: '',
|
|
|
orderTrackNo: '',
|
|
|
},
|
|
|
+ methodList: [],
|
|
|
dialogRemark: false,
|
|
|
+ pdfVisible: false,
|
|
|
+ pdfUrl: 'false',
|
|
|
orderRemark: '',
|
|
|
+ orderMethod: '',
|
|
|
remarkOrderSn: '',
|
|
|
}
|
|
|
},
|
|
|
@@ -265,16 +281,18 @@
|
|
|
this.dialogRemark = true
|
|
|
this.remarkOrderSn = row.SN.value
|
|
|
this.orderRemark = row.INVOICE_REMARK != null || row.INVOICE_REMARK !== '' ? row.INVOICE_REMARK : ''
|
|
|
+ this.orderMethod = row.METHOD != null || row.METHOD !== '' ? row.METHOD : ''
|
|
|
this.$forceUpdate()
|
|
|
},
|
|
|
saveRemark(){
|
|
|
- updateOrderRemark({orderSn: this.remarkOrderSn, invoiceRemark: this.orderRemark}).then(response => {
|
|
|
+ updateOrderRemark({orderSn: this.remarkOrderSn, invoiceRemark: this.orderRemark, orderMethod: this.orderMethod}).then(response => {
|
|
|
this.$message({
|
|
|
message: response.data,
|
|
|
type: 'success'
|
|
|
})
|
|
|
this.dialogRemark = false
|
|
|
this.orderRemark = ''
|
|
|
+ this.orderMethod = ''
|
|
|
this.getData(this.currentPage, this.pageSize)
|
|
|
}).catch(err => {
|
|
|
this.$message({
|
|
|
@@ -283,13 +301,68 @@
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ getMethodData() {
|
|
|
+ getOrderInvoiceMethod().then(response => {
|
|
|
+ this.methodList = response.data.method
|
|
|
+ }).catch(err => {
|
|
|
+ this.$message({
|
|
|
+ message: err,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
handleInvoiceExport(row) {
|
|
|
orderInvoiceExport(row.SN.value).then(response => {
|
|
|
this.$message({
|
|
|
message: response.data,
|
|
|
type: 'success'
|
|
|
})
|
|
|
- console.log( response)
|
|
|
+ const loadingInstance = this.$loading({
|
|
|
+ lock: true,
|
|
|
+ text: this.$t('member.operationInProcess'), // 可以添加一个翻译文本表示"正在生成发票..."
|
|
|
+ spinner: 'el-icon-loading',
|
|
|
+ background: 'rgba(0, 0, 0, 0.7)'
|
|
|
+ });
|
|
|
+
|
|
|
+ // 轮询间隔时间(毫秒)
|
|
|
+ const pollInterval = 1500;
|
|
|
+ // 最大轮询次数
|
|
|
+ const maxPollCount = 10;
|
|
|
+ // 当前轮询次数
|
|
|
+ let pollCount = 0;
|
|
|
+
|
|
|
+ // 轮询函数
|
|
|
+ const pollInvoice = () => {
|
|
|
+ // 增加轮询计数
|
|
|
+ pollCount++;
|
|
|
+ // 如果超过最大轮询次数,停止轮询并提示失败
|
|
|
+ if (pollCount > maxPollCount) {
|
|
|
+ loadingInstance.close();
|
|
|
+ this.$message({
|
|
|
+ message: this.$t('shop.invoiceGenerateTimeout'),
|
|
|
+ type: 'error'
|
|
|
+ });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ orderInvoiceExportFile(row.SN.value).then(response => {
|
|
|
+ // 如果成功获取到文件路径
|
|
|
+ if (response.data && response.data.FILE_NAME) {
|
|
|
+ loadingInstance.close();
|
|
|
+ const pdfUrl = process.env.VUE_APP_BASE_DO_API + '/upload/excel_export' + response.data.FILE_NAME;
|
|
|
+ this.pdfUrl = pdfUrl;
|
|
|
+ this.pdfVisible = true;
|
|
|
+ } else {
|
|
|
+ // 没有获取到文件路径,继续轮询
|
|
|
+ setTimeout(pollInvoice, pollInterval);
|
|
|
+ }
|
|
|
+ }).catch(err => {
|
|
|
+ // 忽略错误,继续轮询
|
|
|
+ setTimeout(pollInvoice, pollInterval);
|
|
|
+ });
|
|
|
+ };
|
|
|
+ // 开始轮询
|
|
|
+ pollInvoice();
|
|
|
}).catch(err => {
|
|
|
this.$message({
|
|
|
message: err,
|