|
@@ -4,13 +4,14 @@
|
|
|
<div
|
|
|
v-for="(item, index) in actionList"
|
|
|
:key="index"
|
|
|
+ @click="item.action"
|
|
|
>
|
|
|
<div
|
|
|
- :class="{ 'order-action-item-active': item.active }"
|
|
|
+ :class="{ 'order-action-item-active': item.active, 'disabled': item.disabled }"
|
|
|
class="order-action-item"
|
|
|
v-if="item.show"
|
|
|
>
|
|
|
- <div class="order-action-text" @click="item.action">{{ item.text }}</div>
|
|
|
+ <div class="order-action-text">{{ item.text }}</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
<!-- 管理后台功能 -->
|
|
@@ -77,14 +78,51 @@
|
|
|
confirm-button-text="我知道了"
|
|
|
center
|
|
|
width="360px"
|
|
|
- @confirm="downloadProtocolConfirm"
|
|
|
- @cancel="downloadProtocolCancel"
|
|
|
+ @confirm="downloadProtocolVisible = false"
|
|
|
>
|
|
|
<div class="cancel-order-content">
|
|
|
- <span>该订单不支持下载电子协议</span>
|
|
|
+ <span>原因如下:</span>
|
|
|
+ <p v-for="(item, index) in noDownloadMsg" :key="index">
|
|
|
+ {{ index + 1}}. {{ item }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </Dialog>
|
|
|
+ <Dialog
|
|
|
+ ref="wxAliDialog"
|
|
|
+ customClass="wx-ali-dialog"
|
|
|
+ title="不支持生成微信/支付宝付款码"
|
|
|
+ :visible.sync="wxAliDialogVisible"
|
|
|
+ :show-cancel-button="false"
|
|
|
+ confirm-button-text="我知道了"
|
|
|
+ center
|
|
|
+ width="360px"
|
|
|
+ @confirm="wxAliDialogVisible = false"
|
|
|
+ >
|
|
|
+ <div class="cancel-order-content">
|
|
|
+ <span>原因如下:</span>
|
|
|
+ <p v-for="(item, index) in noWxAliMsg" :key="index">
|
|
|
+ {{ index + 1}}. {{ item }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </Dialog>
|
|
|
+ <Dialog
|
|
|
+ ref="scanNoteDialog"
|
|
|
+ customClass="scan-note-dialog"
|
|
|
+ title="不支持客户自助扫码开票"
|
|
|
+ :visible.sync="scanNoteDialogVisible"
|
|
|
+ :show-cancel-button="false"
|
|
|
+ confirm-button-text="我知道了"
|
|
|
+ center
|
|
|
+ width="360px"
|
|
|
+ @confirm="scanNoteDialogVisible = false"
|
|
|
+ >
|
|
|
+ <div class="cancel-order-content">
|
|
|
+ <span>原因如下:</span>
|
|
|
+ <p v-for="(item, index) in noScanMsg" :key="index">
|
|
|
+ {{ index + 1}}. {{ item }}
|
|
|
+ </p>
|
|
|
</div>
|
|
|
</Dialog>
|
|
|
-
|
|
|
<!-- 客户扫码自助开票 -->
|
|
|
<new-set-order-info
|
|
|
:title="setDialogStatus.setTitle"
|
|
@@ -137,7 +175,8 @@ import iInvoice from '@/views/order/components/uploadInvoice.vue'
|
|
|
import SealDialog from "@/views/order/components/sealDialog.vue";
|
|
|
import CreateOrder from '../create.vue'
|
|
|
import newSetOrderInfo from '../newSetOrderInfo.vue'
|
|
|
-import newDetailModel from '../nweDetailModel.vue'
|
|
|
+import newDetailModel from '../newDetailModel.vue'
|
|
|
+import { signUnitOptions } from '@/views/create-order/data/index.js'
|
|
|
|
|
|
export default {
|
|
|
name: 'OrderActions',
|
|
@@ -163,18 +202,24 @@ export default {
|
|
|
return {
|
|
|
cancelOrderVisible: false,
|
|
|
downloadProtocolVisible: false,
|
|
|
+ wxAliDialogVisible: false,
|
|
|
+ scanNoteDialogVisible: false,
|
|
|
editdialogVisible: false,
|
|
|
dialogSubmitLoading: false,
|
|
|
orderCode: '',
|
|
|
showDialog: false,
|
|
|
showInvoiceDialog: false,
|
|
|
orderDetailInfo: {},
|
|
|
+ invoiceData: {}, // 发票信息
|
|
|
selectInvoice: {},
|
|
|
setDialogStatus: {
|
|
|
showDialog: false,
|
|
|
setTitle: '客户自助扫码开票',
|
|
|
- showContent: 1
|
|
|
+ showContent: 2
|
|
|
},
|
|
|
+ noDownloadMsg: [],
|
|
|
+ noWxAliMsg: [],
|
|
|
+ noScanMsg: [],
|
|
|
}
|
|
|
},
|
|
|
created () {
|
|
@@ -185,7 +230,8 @@ export default {
|
|
|
orderDetail: {
|
|
|
handler(newVal) {
|
|
|
if (newVal && newVal.orderData) {
|
|
|
- this.orderDetailInfo = newVal.orderData
|
|
|
+ this.orderDetailInfo = newVal?.orderData || {}
|
|
|
+ this.invoiceData = newVal?.invoiceData || {}
|
|
|
}
|
|
|
},
|
|
|
deep: true,
|
|
@@ -199,6 +245,9 @@ export default {
|
|
|
orDetails () {
|
|
|
return this.orderDetail?.orderData
|
|
|
},
|
|
|
+ orderAuditStatus () {
|
|
|
+ return this.orderDetailInfo?.audit_status <= 0
|
|
|
+ },
|
|
|
newActionList () {
|
|
|
const actions = {
|
|
|
'回款': true,
|
|
@@ -224,21 +273,25 @@ export default {
|
|
|
showDetailModel() {
|
|
|
return Object.keys(this.orderDetailInfo).length > 0
|
|
|
},
|
|
|
+ setSigningSubject() {
|
|
|
+ return signUnitOptions.find(item => item.value === this.orderDetail?.orderData?.signing_subject)?.label || '-';
|
|
|
+ },
|
|
|
actionList () {
|
|
|
return [
|
|
|
{
|
|
|
text: '编辑订单',
|
|
|
active: true,
|
|
|
action: () => {
|
|
|
- this.editOrder()
|
|
|
+ this.doAction('编辑订单')
|
|
|
},
|
|
|
- show: true
|
|
|
+ show: true,
|
|
|
+ disabled: !this.orderAuditStatus
|
|
|
},
|
|
|
{
|
|
|
text: '作废订单',
|
|
|
active: false,
|
|
|
action: () => {
|
|
|
- this.cancelOrder()
|
|
|
+ this.doAction('作废订单')
|
|
|
},
|
|
|
show: this.showCancelButton()
|
|
|
},
|
|
@@ -246,7 +299,7 @@ export default {
|
|
|
text: '下载电子协议',
|
|
|
active: false,
|
|
|
action: () => {
|
|
|
- this.downloadProtocol()
|
|
|
+ this.doAction('下载电子协议')
|
|
|
},
|
|
|
show: true
|
|
|
},
|
|
@@ -254,15 +307,15 @@ export default {
|
|
|
text: '微信/支付宝付款码',
|
|
|
active: false,
|
|
|
action: () => {
|
|
|
- this.wxAliPay()
|
|
|
+ this.doAction('微信/支付宝付款码')
|
|
|
},
|
|
|
- show: this.isShowPayBtn()
|
|
|
+ show: true
|
|
|
},
|
|
|
{
|
|
|
text: '客户自助扫码开票',
|
|
|
active: false,
|
|
|
action: () => {
|
|
|
- this.scanCodeInvoice()
|
|
|
+ this.doAction('客户自助扫码开票')
|
|
|
},
|
|
|
show: true
|
|
|
},
|
|
@@ -278,11 +331,8 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions('order', ['resetPageInfo']),
|
|
|
- // 编辑订单相关逻辑开始
|
|
|
+ // 编辑订单相关逻辑
|
|
|
|
|
|
- editOrder() {
|
|
|
- this.editdialogVisible = true;
|
|
|
- },
|
|
|
doCloseCreateModel(type = 'close') {
|
|
|
switch (type) {
|
|
|
case 'close':
|
|
@@ -307,9 +357,7 @@ export default {
|
|
|
break;
|
|
|
}
|
|
|
},
|
|
|
- // 编辑订单相关逻辑结束
|
|
|
-
|
|
|
- // 作废订单相关逻辑开始
|
|
|
+ // 作废订单相关逻辑
|
|
|
showCancelButton () {
|
|
|
const status = !this.orderDetailInfo.order_status || this.orderDetailInfo.order_status === 0
|
|
|
const order_channel = this.orderDetailInfo.order_channel === 'xdqd04'
|
|
@@ -319,10 +367,6 @@ export default {
|
|
|
console.log('showCancelButton', Bool)
|
|
|
return status && (order_channel || is_backstage_order)
|
|
|
},
|
|
|
- cancelOrder() {
|
|
|
- console.log('cancelOrder')
|
|
|
- this.cancelOrderVisible = true
|
|
|
- },
|
|
|
|
|
|
async cancelOrderConfirm() {
|
|
|
this.cancelOrderVisible = false
|
|
@@ -337,45 +381,33 @@ export default {
|
|
|
cancelOrderCancel() {
|
|
|
this.cancelOrderVisible = false
|
|
|
},
|
|
|
- // 作废订单相关逻辑结束
|
|
|
|
|
|
- // 下载电子协议相关逻辑开始
|
|
|
- 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
|
|
|
- },
|
|
|
- downloadProtocolCancel() {
|
|
|
- this.downloadProtocolVisible = false
|
|
|
- },
|
|
|
- // 下载电子协议相关逻辑结束
|
|
|
- // 微信/支付宝付款码相关逻辑开始
|
|
|
- wxAliPay() {
|
|
|
- this.$refs.detailModelRef.paymentCodeShow = true;
|
|
|
- },
|
|
|
- // 是否展示微信/支付宝按钮
|
|
|
+ // 微信/支付宝付款码相关逻辑
|
|
|
isShowPayBtn() {
|
|
|
- // 后台创建的订单
|
|
|
- const backendOrder = this.orderDetailInfo.is_backstage_order === 1
|
|
|
- // 汇款状态为不是全部回款的
|
|
|
- const returnStatus = this.orderDetailInfo.return_status !== 1
|
|
|
- // 订单审核状态为已通过
|
|
|
- const auditStatus = this.orderDetailInfo.audit_status === 3
|
|
|
- // 订单状态为“未完成”或“已完成”
|
|
|
- const orderStatus = this.orderDetailInfo.order_status === 0 || this.orderDetailInfo.order_status === 1
|
|
|
- // 有操作订单权限
|
|
|
- // const authSttatus = this.orDetails
|
|
|
- return backendOrder && returnStatus && auditStatus && orderStatus
|
|
|
+ const REASONS = {
|
|
|
+ NOT_BACKEND_ORDER: '非后台人员手动创建订单',
|
|
|
+ AUDIT_NOT_PASSED: '"订单审核状态"不是"已通过"',
|
|
|
+ ALL_PAID: '已全部回款',
|
|
|
+ ORDER_CANCELED: '订单状态为"已取消"'
|
|
|
+ }
|
|
|
+ const reasons = []
|
|
|
+ const {
|
|
|
+ is_backstage_order,
|
|
|
+ audit_status,
|
|
|
+ return_status,
|
|
|
+ order_status
|
|
|
+ } = this.orderDetailInfo
|
|
|
+
|
|
|
+ if (is_backstage_order !== 1) reasons.push(REASONS.NOT_BACKEND_ORDER)
|
|
|
+ if (audit_status !== 3) reasons.push(REASONS.AUDIT_NOT_PASSED)
|
|
|
+ if (return_status === 1) reasons.push(REASONS.ALL_PAID)
|
|
|
+ if (order_status !== 0 && order_status !== 1) reasons.push(REASONS.ORDER_CANCELED)
|
|
|
+
|
|
|
+ return reasons.length ? reasons : false
|
|
|
+
|
|
|
},
|
|
|
|
|
|
- // 微信/支付宝付款码相关逻辑结束
|
|
|
- // 客户扫码自助开票相关逻辑开始
|
|
|
+ // 客户扫码自助开票相关逻辑
|
|
|
/**
|
|
|
* 扫描发票二维码的方法
|
|
|
*/
|
|
@@ -384,13 +416,8 @@ export default {
|
|
|
this.showInvoiceDialog = false
|
|
|
this.setDialogStatus.showDialog = false
|
|
|
},
|
|
|
- scanCodeInvoice() {
|
|
|
- console.log('scanCodeInvoice')
|
|
|
- console.log('scanCodeInvoice')
|
|
|
- this.scanCodeVote(1)
|
|
|
- },
|
|
|
scanCodeVote(data) {
|
|
|
- if (data === 1) {
|
|
|
+ if (data === 1 || data === 2) {
|
|
|
this.setDialogStatus.setTitle = '客户自助扫码开票'
|
|
|
} else if (data === 3) {
|
|
|
this.setDialogStatus.setTitle = '录入线下发票链接/物流信息'
|
|
@@ -398,15 +425,76 @@ export default {
|
|
|
this.setDialogStatus.showContent = data
|
|
|
this.setDialogStatus.showDialog = true
|
|
|
},
|
|
|
- // archiveProtocol() {
|
|
|
- // console.log('archiveProtocol')
|
|
|
- // },
|
|
|
+ isShowScanCodeVote () {
|
|
|
+ const reasonList = []
|
|
|
+ // 未开票金额大于0元
|
|
|
+ const orderStatus = this.invoiceData?.remainingMoney > 0
|
|
|
+ if(!orderStatus) reasonList.push('已全额开票')
|
|
|
+ // 非线下开发票
|
|
|
+
|
|
|
+ // 不存在发票状态为“已申请”的发票信息
|
|
|
+ const invoiceType = this.invoiceData?.invoiceInfo.map(
|
|
|
+ item => item.invoice_status === '1'
|
|
|
+ )
|
|
|
+ if(invoiceType.length) reasonList.push('存在发票状态为“已申请”的发票信息')
|
|
|
+ // 签约主体为“北京剑鱼信息技术有限公司”
|
|
|
+ const signCompany = this.setSigningSubject === '北京剑鱼信息技术有限公司'
|
|
|
+ if(!signCompany) reasonList.push('签约主体不是“北京剑鱼信息技术有限公司”,请联系财务线下开发票。')
|
|
|
+
|
|
|
+ return reasonList.length ? reasonList : false
|
|
|
+ },
|
|
|
doRefresh (type = '') {
|
|
|
this.$emit('refresh', type)
|
|
|
},
|
|
|
- doAction (type) {
|
|
|
- console.log('tttt', type)
|
|
|
+ async doAction (type) {
|
|
|
switch (type) {
|
|
|
+ case '编辑订单': {
|
|
|
+ if(!this.orderAuditStatus) {
|
|
|
+ this.$message.error('仅当订单审核状态为“待提交”或“已退回”,才允许编辑')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.editdialogVisible = true;
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case '作废订单': {
|
|
|
+ this.cancelOrderVisible = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case '下载电子协议': {
|
|
|
+ const { error_code: code, error_msg: msg, data} = await ajaxGetContractPdf({ orderCode: this.orderCode })
|
|
|
+ if (code === 0) {
|
|
|
+ console.log('downloadProtocol', data)
|
|
|
+ } else {
|
|
|
+ this.downloadProtocolVisible = true
|
|
|
+ if(msg.indexOf(',') > -1) {
|
|
|
+ this.noDownloadMsg = msg.split(',')
|
|
|
+ } else {
|
|
|
+ this.noDownloadMsg = [msg]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case '微信/支付宝付款码': {
|
|
|
+ const reasonList = this.isShowPayBtn()
|
|
|
+ if (!reasonList) {
|
|
|
+ this.$refs.detailModelRef.paymentCodeShow = true;
|
|
|
+ } else {
|
|
|
+ this.wxAliDialogVisible = true
|
|
|
+ this.noWxAliMsg = reasonList
|
|
|
+ }
|
|
|
+
|
|
|
+ break
|
|
|
+ }
|
|
|
+ case '客户自助扫码开票': {
|
|
|
+ const reasonList = this.isShowScanCodeVote()
|
|
|
+ if (!reasonList) {
|
|
|
+ this.scanCodeVote(2)
|
|
|
+ } else {
|
|
|
+ this.scanNoteDialogVisible = true
|
|
|
+ this.noScanMsg = reasonList
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
case '回款': {
|
|
|
this.$refs.batchModel.asdShow = true
|
|
|
break
|
|
@@ -536,6 +624,12 @@ export default {
|
|
|
border: 1px solid #2ABED1;
|
|
|
color: #2ABED1;
|
|
|
}
|
|
|
+ &.disabled {
|
|
|
+ background-color: #F5F5F5;
|
|
|
+ color: #C0C4CC;
|
|
|
+ border: 1px solid #E0E0E0;
|
|
|
+ cursor: not-allowed;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.cancel-order-dialog {
|
|
@@ -545,22 +639,41 @@ export default {
|
|
|
color: #686868;
|
|
|
}
|
|
|
}
|
|
|
- .button-group {
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
|
|
|
-::v-deep {
|
|
|
- .download-protocol-dialog.el-dialog {
|
|
|
- .dialog-footer {
|
|
|
- display: flex;
|
|
|
- justify-content: center;
|
|
|
+ ::v-deep {
|
|
|
+ .download-protocol-dialog.el-dialog, .wx-ali-dialog.el-dialog {
|
|
|
+ .dialog-footer {
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ }
|
|
|
+ .action-button.confirm {
|
|
|
+ flex: none;
|
|
|
+ width: 120px;
|
|
|
+ }
|
|
|
}
|
|
|
- .action-button.confirm {
|
|
|
- flex: none;
|
|
|
- width: 120px;
|
|
|
+ }
|
|
|
+ .edit-dialog {
|
|
|
+ ::v-deep {
|
|
|
+ .el-dialog__footer {
|
|
|
+ box-shadow: 0px -4px 8px 0px rgba(0, 0, 0, 0.05);
|
|
|
+ }
|
|
|
+ .button-group {
|
|
|
+ text-align: center;
|
|
|
+ .submit-button {
|
|
|
+ width: 132px;
|
|
|
+ border-radius: 6px;
|
|
|
+ font-size: 16px;
|
|
|
+ & + .submit-button {
|
|
|
+ margin-left: 24px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .el-dialog__body {
|
|
|
+ max-height: 75vh;
|
|
|
+ padding: 32px;
|
|
|
+ overflow-y: scroll;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-}
|
|
|
</style>
|