diff --git a/env/index.js b/env/index.js
index a0bfcb1..bcf6a22 100644
--- a/env/index.js
+++ b/env/index.js
@@ -1,8 +1,8 @@
/**
* @description 唯一环境变量
*/
-const env = 'test'
+// const env = 'test'
// const env = 'dev'
-// const env = 'production'
+const env = 'production'
export default env
diff --git a/pages/order-detail/index.vue b/pages/order-detail/index.vue
index 30f3937..6dafc4d 100644
--- a/pages/order-detail/index.vue
+++ b/pages/order-detail/index.vue
@@ -229,6 +229,14 @@ export default {
}
}
},
+ onHide() {
+ console.log('hide')
+ this.redirect()
+ },
+ onUnload() {
+ console.log('unload')
+ this.redirect()
+ },
methods: {
go2,
back,
@@ -396,7 +404,6 @@ export default {
paySign: result.paySign
}
console.log('info', info)
- this.wxCode = null
this.wxPay(info)
})
})
@@ -420,9 +427,6 @@ export default {
icon: 'error',
duration: 2000
})
- setTimeout(() => {
- go2('mine', {}, true)
- }, 1000)
}
})
},
@@ -505,6 +509,15 @@ export default {
})
})
}
+ },
+ // 微信支付重定向
+ redirect() {
+ let url = window.location.href
+ if (url.indexOf('code=') > -1) {
+ let prefix = url.substring(0, url.indexOf('?'))
+ let param = url.substring(url.indexOf('#'))
+ window.location.href = prefix + param
+ }
}
}
}
diff --git a/pages/order-make/index.vue b/pages/order-make/index.vue
index 3821457..2286bb5 100644
--- a/pages/order-make/index.vue
+++ b/pages/order-make/index.vue
@@ -89,7 +89,7 @@
送货时间:
-
+
@@ -97,16 +97,16 @@
使用月结额度
- 剩余额度: {{ payMap['month'].availableCreditLine }}
+ 剩余额度: {{ payMap['month'].availableCreditLine }}
- 待申请
-
+ 待申请
+
余额不足
@@ -114,16 +114,16 @@
使用飞算资金
- 剩余额度: {{ payMap['fs'].availableCreditLine }}
+ 剩余额度: {{ payMap['fs'].availableCreditLine }}
- 待申请
-
+ 待申请
+
余额不足
@@ -156,30 +156,33 @@ import { go2, back, getCache } from '@/utils/hook.js'
import { getPreOrderInfo, getDefaultAddress, submitClientOrder, calcNotInvoiceOrderInfo } from '@/apis/orderApi'
import { getFsCredit, getMonthCredit } from '@/apis/commonApi'
import { isObject } from '@/utils/is'
-import { invoiceStatusEnum } from '@/enums/index'
+import { invoiceStatusEnum, paymentMethodEnum } from '@/enums/index'
export default {
data() {
return {
+ startTimeStamp: new Date().getTime(),
orderInfo: {
customerEnterpriseName: '',
receivedTime: null
},
invoiceInfo: {}, // 开票的订单详情
- noInvoiceInfo: null, // 不开票的订单详情
deliveryAddress: {},
currentPayType: null,
payMap: {
month: {
availableCreditLine: 0,
- value: 2
+ value: paymentMethodEnum.MONTHLY_PAY,
+ isShow: false
},
fs: {
availableCreditLine: 0,
- value: 4
+ value: paymentMethodEnum.FLY_PAY,
+ isShow: false
},
wxpay: {
- value: 1
+ value: paymentMethodEnum.WECHAT_PAY,
+ isShow: false
}
},
loading: false,
@@ -194,6 +197,7 @@ export default {
if (res) {
this.orderInfo = res
this.invoiceInfo = res
+ this.completePayment(res.paymentMethods)
}
})
} else {
@@ -209,7 +213,13 @@ export default {
}
},
created() {
- this.init()
+ // 获取默认地址
+ getDefaultAddress({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => {
+ if (res) {
+ this.deliveryAddress = res
+ this.deliveryAddress.addressId = res.id
+ }
+ })
},
onShow() {
let address = getCache('address')
@@ -227,21 +237,16 @@ export default {
selectInvoice(type) {
this.isInvoice = type
if (!type) {
- // 计算不开票的订单信息
- if (this.noInvoiceInfo) {
- this.orderInfo = this.noInvoiceInfo
- } else {
- // 请求后端获取价格信息
- calcNotInvoiceOrderInfo({
- customerOrderId: this.orderInfo.orderId,
- invoiceOrNot: invoiceStatusEnum.NO_INVOICE // 1: 不开票
- }).then((res) => {
- if (res) {
- this.noInvoiceInfo = res
- this.orderInfo = res
- }
- })
- }
+ // 请求后端获取价格信息
+ calcNotInvoiceOrderInfo({
+ customerOrderId: this.orderInfo.orderId,
+ invoiceOrNot: invoiceStatusEnum.NO_INVOICE, // 1: 不开票
+ paymentMethod: this.payMap[this.currentPayType].value
+ }).then((res) => {
+ if (res) {
+ this.orderInfo = res
+ }
+ })
} else {
this.orderInfo = this.invoiceInfo
}
@@ -287,7 +292,14 @@ export default {
icon: 'success',
success: () => {
setTimeout(() => {
- window.location.href = res.signUrl
+ // #ifdef APP-PLUS
+ go2('page-view', { title: '合同签署', url: encodeURIComponent(res.signUrl) }, true)
+ // #endif
+ // #ifdef H5
+ if (window) {
+ window.location.href = res.signUrl
+ }
+ // #endif
}, 1000)
}
})
@@ -297,37 +309,62 @@ export default {
this.loading = false
})
},
- init() {
- // 获取月结额度
+ completePayment(paymentMethods) {
+ let map = {
+ [paymentMethodEnum.MONTHLY_PAY]: 'month',
+ [paymentMethodEnum.FLY_PAY]: 'fs',
+ [paymentMethodEnum.WECHAT_PAY]: 'wxpay'
+ }
+ if (paymentMethods && paymentMethods.length > 0) {
+ for (let item of paymentMethods) {
+ // 飞算额度查询
+ if (item.value == this.payMap.fs.value) {
+ this.payMap.fs.isShow = true
+ this.completeFsCredit()
+ }
+ // 月结额度查询
+ if (item.value == this.payMap.month.value) {
+ this.payMap.month.isShow = true
+ this.completeMonthCredit()
+ }
+ // 微信支付
+ if (item.value == this.payMap.wxpay.value) {
+ this.payMap.wxpay.isShow = true
+ }
+ if (item.isDefault) {
+ this.currentPayType = map[item.value]
+ }
+ }
+ }
+ },
+ // 获取月结额度
+ completeMonthCredit() {
getMonthCredit({
enterpriseId: this.$store.state.companyInfo.id,
supplierId: this.$store.state.supplierId
}).then((res) => {
if (res) {
- if (res.supplierCredit !== null) {
- this.payMap['month'].availableCreditLine = res.supplierCredit
- } else {
- this.payMap['month'] = null
+ this.payMap['month'].availableCreditLine = res.supplierCredit
+ if (this.payMap['month'].availableCreditLine < this.orderInfo.totalOfferPrice && this.currentPayType == 'month') {
+ this.currentPayType = null
}
} else {
- this.payMap['month'] = null
+ this.payMap['month'].isShow = false
}
})
- // 获取飞算额度
+ },
+ // 获取飞算额度
+ completeFsCredit() {
getFsCredit({
enterpriseId: this.$store.state.companyInfo.id
}).then((res) => {
- if (isObject(res)) {
+ if (res) {
this.payMap['fs'].availableCreditLine = res.availableCreditLine
+ if (this.payMap['fs'].availableCreditLine < this.orderInfo.totalOfferPrice && this.currentPayType == 'fs') {
+ this.currentPayType = null
+ }
} else {
- this.payMap['fs'] = null
- }
- })
- // 获取默认地址
- getDefaultAddress({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => {
- if (res) {
- this.deliveryAddress = res
- this.deliveryAddress.addressId = res.id
+ this.payMap['fs'].isShow = false
}
})
}