mo-bai 4 years ago
parent
commit
4e2d014589
3 changed files with 104 additions and 54 deletions
  1. 4
      env/index.js
  2. 21
      pages/order-detail/index.vue
  3. 133
      pages/order-make/index.vue

4
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

21
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
}
}
}
}

133
pages/order-make/index.vue

@ -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
}
})
}

Loading…
Cancel
Save