Преглед изворни кода

Merge branch 'feature/EK-3382' of guanli/ngds-backend-ele into master

bill001 пре 1 месец
родитељ
комит
74029bc685

+ 18 - 0
src/api/finance.js

@@ -174,4 +174,22 @@ export function postWithdrawStatus(query) {
   })
 }
 
+// 银行列表
+export function fetchRechargeTypeList() {
+  return request({
+    url: '/v1/finance/recharge-type',
+    method: 'get',
+    params: {}
+  })
+}
+
+// 保存充值类型
+export function saveRechargeType(data) {
+  return request({
+    url: '/v1/finance/recharge-type',
+    method: 'post',
+    data
+  })
+}
+
 

+ 32 - 0
src/api/shop.js

@@ -195,7 +195,39 @@ export function orderDetail(query) {
   })
 }
 
+export function getOrderInvoiceMethod() {
+  return request({
+    url: '/v1/shop/order-invoice-method',
+    method: 'get',
+    data: {},
+  })
+}
 
+export function updateOrderRemark(query) {
+  return request({
+    url: '/v1/shop/order-invoice-remark',
+    method: 'post',
+    data: query,
+    params: query
+  })
+}
+export function orderInvoiceExport(query) {
+  return request({
+    url: '/v1/shop/order-invoice-export/'+query,
+    method: 'get',
+    data: query,
+    params: query
+  })
+}
+
+export function orderInvoiceExportFile(query) {
+  return request({
+    url: '/v1/shop/order-invoice-export-file/'+query,
+    method: 'get',
+    data: query,
+    params: query
+  })
+}
 
 
 

+ 6 - 2
src/components/Tinymce/index.vue

@@ -1,7 +1,7 @@
 <template>
   <div :class="{fullscreen:fullscreen}" class="tinymce-container" :style="{width:containerWidth}">
     <textarea :id="tinymceId" class="tinymce-textarea" />
-    <div class="editor-custom-btn-container">
+    <div v-if="editorImageShow" class="editor-custom-btn-container">
       <editorImage color="#1890ff" class="editor-upload-btn" :request-route="uploadUri" @successCBK="imageSuccessCBK" />
     </div>
   </div>
@@ -60,7 +60,11 @@ export default {
     requestRoute: {
       type: String,
       default: ''
-    }
+    },
+      editorImageShow: {
+          type: Boolean,
+          default: true
+      }
   },
   data() {
     return {

+ 6 - 1
src/lang/en.js

@@ -777,6 +777,8 @@ export default {
     ecoinInsufficientNotice: 'Ecoin of member is insufficient, whether to continue to submit.',
     reviewRemberEcoinInfo: 'Review member Ecoin change information',
     statusManagement: 'Status management',
+    typeManagement: 'Type Management',
+    type: 'Type',
     viewVoucher: 'View voucher',
     checkRechargeVoucher: 'Check recharge voucher',
     rechargeStatusState: 'State',
@@ -860,7 +862,10 @@ export default {
     availableCountries: "Available countries",
     modifyAvailableCountries: "Modify available countries",
     imagePreview: 'Image Preview',
-    AutoMaintenance: 'Auto Maintenance'
+    preview: 'Preview',
+    method: 'Method',
+    AutoMaintenance: 'Auto Maintenance',
+    invoice: "Invoice"
   },
 
   // Administrator management

+ 6 - 1
src/lang/zh.js

@@ -767,6 +767,8 @@ export default {
     ecoinInsufficientNotice: '会员账户余额不足,是否继续提交',
     reviewRemberEcoinInfo: '审核会员余额变动信息',
     statusManagement: '状态管理',
+    typeManagement: '充值类型管理',
+    type: '充值类型',
     viewVoucher: '查看凭证',
     checkRechargeVoucher: '查看充值凭证',
     rechargeStatusState: '充值状态',
@@ -850,7 +852,10 @@ export default {
     availableCountries: "可购买国家",
     modifyAvailableCountries: "修改可购买国家",
     imagePreview: '图片预览',
-    AutoMaintenance: '自动分期'
+    preview: '预览',
+    method: '支付方式',
+    AutoMaintenance: '自动分期',
+    invoice: "发票"
   },
 
   // 管理员管理

+ 56 - 3
src/views/finance/recharge.vue

@@ -16,13 +16,19 @@
                         </template>
                     </template>
                 </el-table-column>
-                <el-table-column :label="$t('common.action')"> <!-- 操作 -->
+                <el-table-column min-width="150" :label="$t('common.action')"> <!-- 操作 -->
                     <template slot-scope="scope">
                     <el-button type="success" size="small" @click="handleGroupManage(scope.row)" >
                         {{  $t('financial.statusManagement')  }}<!-- 状态管理 -->
                     </el-button>
                 </template></el-table-column>
-                <el-table-column :label="$t('financial.viewVoucher')"><!-- 查看凭证 -->
+              <el-table-column min-width="150" :label="$t('financial.typeManagement')"> <!-- 操作 -->
+                <template slot-scope="scope">
+                  <el-button type="success" size="small" @click="handleTypeManagement(scope.row)" >
+                    {{  $t('financial.typeManagement')  }}<!-- 状态管理 -->
+                  </el-button>
+                </template></el-table-column>
+                <el-table-column min-width="150" :label="$t('financial.viewVoucher')"><!-- 查看凭证 -->
                     <template slot-scope="scope">
                         <el-button type="success" size="small" @click="handleInvoiceShow(scope.row)"
                            v-if="scope.row.AUDIT_STATUS!=='0'">{{  $t('financial.viewVoucher')  }}<!-- 查看凭证 -->
@@ -45,6 +51,19 @@
                     <el-button @click="dialogInvoiceVisible = false">{{ $t('common.confirm') }}</el-button> <!-- 确 定 -->
                 </div>
             </el-dialog>
+          <el-dialog width="30%" :title="$t('financial.typeManagement')" :visible.sync="dialogTypeVisible"> <!-- 查看充值凭证 -->
+            <el-form ref="form" :model="form">
+              <el-form-item :label="$t('financial.type')" prop="rechargeType">
+                <el-select v-model="form.rechargeType" clearable filterable style="width: 100%">
+                  <el-option v-for="(item,key) in typeList" :key="key" :label="item" :value="item" />
+                </el-select>
+              </el-form-item>
+            </el-form>
+            <div slot="footer" class="dialog-footer">
+              <el-button @click="onCancel">{{ $t('table.cancel') }}<!-- 取 消 --></el-button>
+              <el-button type="primary" @click.native="handleSave">{{ $t('common.save') }}<!-- 发货 --></el-button>
+            </div>
+          </el-dialog>
         </div>
     </div>
 </template>
@@ -55,13 +74,14 @@
     import permission from '@/utils/permission'
     import Pagination from '@/components/Pagination'
     import filterHelper from '@/utils/filterHelper'
-    import { rechargeList, rechargeExport } from '@/api/finance'
+    import {rechargeList, rechargeExport, fetchRechargeTypeList, saveRechargeType} from '@/api/finance'
 
     export default {
         name: 'recharge',
         components: {FilterUser,Pagination},
         mounted () {
             this.getData()
+            this.fetchRechargeTypeList()
         },
 
         data () {
@@ -82,7 +102,13 @@
                 selectedIds:'',
                 dialogInvoiceVisible: false,
                 dialogInvoiceLoading: false,
+                dialogTypeVisible: false,
+                typeList: [],
                 invoiceUrl:'',
+                form: {
+                  id: null,
+                  rechargeType: '',
+                },
                 urlimg:''
             }
         },
@@ -162,6 +188,33 @@
                 this.dialogInvoiceLoading = false
                 this.urlimg = tool.getArImage(row.BANK_PROVE, '/files/');
             },
+            fetchRechargeTypeList() {
+              fetchRechargeTypeList().then(response => {
+                this.typeList = response.data.type
+              })
+            },
+            onCancel() {
+              this.dialogTypeVisible = false
+              this.$refs['form'].resetFields()
+            },
+            handleTypeManagement(row) {
+              console.log(row)
+              this.form.id = row.ID
+              this.form.rechargeType = row.TYPE.value
+              this.dialogTypeVisible = true
+            },
+            handleSave() {
+              saveRechargeType(this.form).then(response => {
+                this.$message({
+                  message: response.data,
+                  type: 'success'
+                })
+                this.getData()
+              }).finally(() => {
+                this.dialogTypeVisible = false
+                this.$refs['form'].resetFields()
+              })
+            },
 
        /* handlestate(){
             this.$router.push({path: `/finance/recharge-status`})

+ 140 - 2
src/views/shop/order-list.vue

@@ -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&lt;!&ndash; 编辑订单 &ndash;&gt;</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&lt;!&ndash; 发货 &ndash;&gt;</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>