|
|
|
@ -89,7 +89,7 @@ |
|
|
|
<!-- 送货时间 --> |
|
|
|
<view class="timer-area"> |
|
|
|
<text style="font-size: 30rpx; color: #000000">送货时间:</text> |
|
|
|
<qn-datetime-picker v-model="orderInfo.receivedTime" type="datetime" :border="false"></qn-datetime-picker> |
|
|
|
<qn-datetime-picker :start="startTimeStamp" v-model="orderInfo.receivedTime" type="datetime" :border="false"></qn-datetime-picker> |
|
|
|
</view> |
|
|
|
<!-- 支付方式 --> |
|
|
|
<view class="pay-area"> |
|
|
|
@ -97,16 +97,16 @@ |
|
|
|
<view class="left"> |
|
|
|
<image class="img" src="/static/imgs/order/month-pay-icon.png"></image> |
|
|
|
<text style="font-size: 30rpx; color: #000000; margin: 0 16rpx">使用月结额度</text> |
|
|
|
<text v-if="payMap['month'] != null" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['month'].availableCreditLine }}</text> |
|
|
|
<text v-if="payMap['month'].isShow" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['month'].availableCreditLine }}</text> |
|
|
|
</view> |
|
|
|
<image |
|
|
|
v-if="payMap['month'] != null && payMap['month'].availableCreditLine > orderInfo.totalOfferPrice" |
|
|
|
v-if="payMap['month'].isShow && payMap['month'].availableCreditLine > orderInfo.totalOfferPrice" |
|
|
|
@click="selectPayMethod('month')" |
|
|
|
class="img" |
|
|
|
:src="currentPayType == 'month' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'" |
|
|
|
></image> |
|
|
|
<text v-if="payMap['month'] == null" style="font-size: 28rpx; color: #888888">待申请</text> |
|
|
|
<text v-if="payMap['month'] != null && payMap['month'].availableCreditLine < orderInfo.totalOfferPrice" style="font-size: 28rpx; color: #888888"> |
|
|
|
<text v-if="!payMap['month'].isShow" style="font-size: 28rpx; color: #888888">待申请</text> |
|
|
|
<text v-if="payMap['month'].isShow && payMap['month'].availableCreditLine < orderInfo.totalOfferPrice" style="font-size: 28rpx; color: #888888"> |
|
|
|
余额不足 |
|
|
|
</text> |
|
|
|
</view> |
|
|
|
@ -114,16 +114,16 @@ |
|
|
|
<view class="left"> |
|
|
|
<image class="img" src="/static/imgs/order/fs-pay-icon.png"></image> |
|
|
|
<text style="font-size: 30rpx; color: #000000; margin: 0 16rpx">使用飞算资金</text> |
|
|
|
<text v-if="payMap['fs'] != null" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['fs'].availableCreditLine }}</text> |
|
|
|
<text v-if="payMap['fs'].isShow" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['fs'].availableCreditLine }}</text> |
|
|
|
</view> |
|
|
|
<image |
|
|
|
v-if="payMap['fs'] != null && payMap['fs'].availableCreditLine > orderInfo.totalOfferPrice" |
|
|
|
v-if="payMap['fs'].isShow && payMap['fs'].availableCreditLine > orderInfo.totalOfferPrice" |
|
|
|
@click="selectPayMethod('fs')" |
|
|
|
class="img" |
|
|
|
:src="currentPayType == 'fs' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'" |
|
|
|
></image> |
|
|
|
<text v-if="payMap['fs'] == null" style="font-size: 28rpx; color: #888888">待申请</text> |
|
|
|
<text v-if="payMap['fs'] != null && payMap['fs'].availableCreditLine < orderInfo.totalOfferPrice" style="font-size: 28rpx; color: #888888"> |
|
|
|
<text v-if="!payMap['fs'].isShow" style="font-size: 28rpx; color: #888888">待申请</text> |
|
|
|
<text v-if="payMap['fs'].isShow && payMap['fs'].availableCreditLine < orderInfo.totalOfferPrice" style="font-size: 28rpx; color: #888888"> |
|
|
|
余额不足 |
|
|
|
</text> |
|
|
|
</view> |
|
|
|
@ -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 |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
|