|
|
@@ -25,6 +25,8 @@
|
|
|
{{ $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.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>
|
|
|
<el-dropdown-item command="delivery" @click.native="handleShowDeliveryDialog(scope.row)" v-if="permission.hasPermission(`shop/order-delivery`) && scope.row['STATUS'] === '1' && scope.row['DELIVERY_STATUS'] === '0' ">deliver goods<!– 发货 –></el-dropdown-item>
|
|
|
@@ -55,6 +57,32 @@
|
|
|
<el-button type="primary" @click.native="handleDelivery">{{ $t('shop.deliverGoods') }}<!-- 发货 --></el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
+
|
|
|
+ <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"
|
|
|
+ />
|
|
|
+ </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>
|
|
|
|
|
|
@@ -65,11 +93,19 @@
|
|
|
import permission from '@/utils/permission'
|
|
|
import Pagination from '@/components/Pagination'
|
|
|
import filterHelper from '@/utils/filterHelper'
|
|
|
- import { orderList, orderListExport, orderListExportPdf, deleteOrder } from '@/api/shop'
|
|
|
+ import {
|
|
|
+ orderList,
|
|
|
+ orderListExport,
|
|
|
+ orderListExportPdf,
|
|
|
+ deleteOrder,
|
|
|
+ updateOrderRemark,
|
|
|
+ orderInvoiceExport, getOrderInvoiceMethod, orderInvoiceExportFile
|
|
|
+ } from '@/api/shop'
|
|
|
+ import Tinymce from '@/components/Tinymce'
|
|
|
|
|
|
export default {
|
|
|
name: 'shop_order-list',
|
|
|
- components: {FilterUser, Pagination},
|
|
|
+ components: {FilterUser, Pagination, Tinymce},
|
|
|
mounted () {
|
|
|
// let system = getOperatingSystem()
|
|
|
// if (system == "Android" || system == 'ios') {
|
|
|
@@ -79,6 +115,7 @@
|
|
|
// }
|
|
|
this.fixedColumn = getScreenWidth() < 500 ? false : 'right'
|
|
|
this.getData()
|
|
|
+ this.getMethodData()
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
@@ -102,6 +139,13 @@
|
|
|
expressCompany: '',
|
|
|
orderTrackNo: '',
|
|
|
},
|
|
|
+ methodList: [],
|
|
|
+ dialogRemark: false,
|
|
|
+ pdfVisible: false,
|
|
|
+ pdfUrl: 'false',
|
|
|
+ orderRemark: '',
|
|
|
+ orderMethod: '',
|
|
|
+ remarkOrderSn: '',
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -232,6 +276,100 @@
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
+ handleEditRemark(row) {
|
|
|
+ this.orderRemark = ''
|
|
|
+ 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, 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({
|
|
|
+ message: err,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ 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'
|
|
|
+ })
|
|
|
+ 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,
|
|
|
+ type: 'error'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|