Forráskód Böngészése

feat: 编辑订单、作废订单、客户自助扫码开票

Signed-off-by: tangshizhe <48740614+tangshizhe@users.noreply.github.com>
tangshizhe 3 hónapja
szülő
commit
709bc4eb6c

+ 8 - 0
src/api/modules/index.js

@@ -84,5 +84,13 @@ export function ajaxGetOrderDetail(data) {
   })
 }
 
+// 下载电子协议
+export function ajaxGetContractPdf(data) {
+  return request({
+    url: '/jyOrderManager/order/getContractPdf',
+    method: 'post',
+    data,
+  }) 
+}
 
 

+ 3 - 3
src/views/create-order/components/newSetOrderInfo.vue

@@ -191,7 +191,7 @@ export default {
             // 否则是订单页进行客户自助开票,展示修改开票金额按钮,可开票金额为输入多个订单金额总价
             if (!this.showEditPrice) {
               this.checkOrderCode(this.orderInfo.order_code).then(res => {
-                if(res.status === 'success') {
+                if(res.error_code === 0) {
                   this.detailMoney = res.data.money / 100
                   this.comDialogParams.price = res.data.money / 100
                 }
@@ -331,7 +331,7 @@ export default {
         })
       }
       this.$jyRequest('/jyOrderManager/order/createQRCode').data(params).success((res) => {
-          if (res.status === 'success') {
+          if (res.error_code === 0) {
             this.QrCodeImage = res.data.url
           }
       }).post()
@@ -479,7 +479,7 @@ export default {
     },
     checkOrderCode (code) {
       return new Promise((resolve) => {
-        this.$jyRequest('/jyOrderManager/order/orderInfo').data({ orderCode: code }).success((res) => {
+        this.$jyRequest('/jyOrderManager/order/selfInvoice').data({ orderCode: code }).success((res) => {
           resolve(res)
         }).error((err) => {
           resolve(err)

+ 1 - 1
src/views/create-order/components/order-detail-submodule/ContractInfo.vue

@@ -54,7 +54,7 @@
             电子协议类型:{{ contractRes?.seal_type === 1 ? '有电子章' : '无电子章'}}
           </div>
           <div class="contract-info-card-item">
-            协议甲方类型:{{ contractRes?.partyA_type === 1? '企业' : '个人' }}
+            协议甲方类型:{{ contractRes?.partyA_type === 2 ? '企业' : '个人' }}
           </div>
         </div>
         <div class="contract-info-card-item">

+ 97 - 7
src/views/create-order/components/order-detail-submodule/OrderActions.vue

@@ -5,6 +5,19 @@
         <div class="order-action-text" @click="item.action">{{ item.text }}</div>
       </div>
     </div>
+    <el-dialog
+        class="edit-dialog"
+        title="编辑订单"
+        width="90%"
+        :close-on-click-modal="false"
+        :visible.sync="editdialogVisible">
+      <CreateOrder ref="editOrderRef" type="edit" :order-code="orderCode"/>
+      <div class="button-group" slot="footer">
+        <el-button size="medium" class="submit-button submit" type="primary" :loading="dialogSubmitLoading" @click="doCloseCreateModel('submit')">提交</el-button>
+        <el-button size="medium" class="submit-button stash" type="primary" plain :loading="dialogSubmitLoading" @click="doCloseCreateModel('stash')">暂存</el-button>
+        <el-button size="medium" class="submit-button cancel" plain @click="doCloseCreateModel('close')">取消</el-button>
+      </div>
+    </el-dialog>
     <Dialog
       ref="cancelOrderDialog"
       customClass="cancel-order-dialog"
@@ -35,19 +48,37 @@
         <span>该订单不支持下载电子协议</span>
       </div>
     </Dialog>
+    <!-- 客户扫码自助开票 -->
+    <new-set-order-info :show-content="2" :show-dialog="showDialog" :order-info="orderDetail?.orderData" title="客户自助扫码开票"
+        @close="closeComDialog">
+    </new-set-order-info>
+    <!-- 开票二维码 -->
+    <new-set-order-info ref="invoiceRef" :show-content="4" :show-dialog="showInvoiceDialog" :order-info="orderDetail"
+        title="开票二维码" @close="closeComDialog">
+        <div style="display:flex;flex-direction:column;" slot="content">
+            <span>订单编号:{{selectInvoice.invoice_order_code}}</span>
+            <span>开票金额合计:{{selectInvoice.invoice_money / 100}}元</span>
+        </div>
+    </new-set-order-info>
   </div>
 </template>
 
 <script>
+import { mapActions } from 'vuex'
 import Dialog from '@/components/Dialog'
+import CreateOrder from '../create.vue'
+import { ajaxGetContractPdf } from '@/api/modules/'
+import newSetOrderInfo from '../newSetOrderInfo.vue'
 
 export default {
   name: 'OrderActions',
   components: {
-    Dialog
+    Dialog,
+    CreateOrder,
+    newSetOrderInfo
   },
   props: { 
-    orders: {
+    orderDetail: {
       type: Object,
       default() {
         return {}
@@ -101,13 +132,54 @@ export default {
         // }
       ],
       cancelOrderVisible: false,
-      downloadProtocolVisible: false
+      downloadProtocolVisible: false,
+      editdialogVisible: false,
+      dialogSubmitLoading: false,
+      orderCode: '',
+      showDialog: false,
+      showInvoiceDialog: false,
+      orDetails: {},
+      selectInvoice: {}
+
     }
   },
+  created () {
+    const { id } = this.$route.params
+    this.orderCode = id
+  },
   computed: {},
   methods: {
+    ...mapActions('order', ['resetPageInfo']),
+    // 编辑订单相关逻辑开始
+
     editOrder() {
+      this.editdialogVisible = true;
+    },
+    doCloseCreateModel(type = 'close') {
+      switch (type) {
+        case 'close':
+          this.editdialogVisible = false;
+          this.resetPageInfo()
+          break;
+        case 'submit':
+        case 'stash':
+          this.dialogSubmitLoading = true;
+          const method = type === 'submit' ? 'submit' : 'stash';
+          this.$refs.editOrderRef[method]()
+              .then(() => {
+                this.editdialogVisible = false;
+              })
+              .catch(e => {
+                console.warn(e);
+                // 这里可以根据需要处理错误,例如显示错误信息
+              })
+              .finally(() => {
+                this.dialogSubmitLoading = false;
+              });
+          break;
+      }
     },
+    // 编辑订单相关逻辑结束
 
     // 作废订单相关逻辑开始
     cancelOrder() {
@@ -124,9 +196,13 @@ export default {
     // 作废订单相关逻辑结束
 
     // 下载电子协议相关逻辑开始
-    downloadProtocol() {
-      console.log('downloadProtocol') 
-      this.downloadProtocolVisible = true 
+    async downloadProtocol() {
+      const { error_code: code, data} = await ajaxGetContractPdf({ orderCode: this.orderCode })
+      if (code === 0) {
+        console.log('downloadProtocol', data)
+      } else {
+        this.downloadProtocolVisible = true 
+      }
     },
     downloadProtocolConfirm() {
       this.downloadProtocolVisible = false 
@@ -138,8 +214,18 @@ export default {
     wxAliPay() {
       console.log('wxAliPay')
     },
+    // 客户扫码自助开票相关逻辑开始
+    /**
+     * 扫描发票二维码的方法
+     */
+    // 关闭弹框
+    closeComDialog() {
+      this.showDialog = false
+      this.showInvoiceDialog = false
+    },
     scanCodeInvoice() {
-      console.log('scanCodeInvoice') 
+      console.log('scanCodeInvoice')
+      this.showDialog = true;
     },
     // archiveProtocol() {
     //   console.log('archiveProtocol') 
@@ -179,6 +265,10 @@ export default {
     color: #686868; 
   }
  }
+ .button-group {
+    text-align: center;
+  }
+
 ::v-deep {
   .download-protocol-dialog.el-dialog {
     .dialog-footer {

+ 1 - 1
src/views/create-order/order-detail.vue

@@ -11,7 +11,7 @@
           </el-tab-pane>
         </el-tabs>
         <div class="order-action-container">
-          <OrderActions :orders="orderDetail" />
+          <OrderActions :order-detail="orderDetail" />
         </div>
         <div class="order-desc-container">
           <OrderDescInfo :orderInfo="orderDetail?.orderData" />

+ 0 - 1
src/views/order/components/setOrderInfo.vue

@@ -1,4 +1,3 @@
-import commonDialog from '@/components/Dialog.vue';
 <template>
   <div class="set-order-info">
     <!-- 客户扫码自助开票 -->