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 唯一环境变量 * @description 唯一环境变量
*/ */
const env = 'test'
// const env = 'test'
// const env = 'dev' // const env = 'dev'
// const env = 'production'
const env = 'production'
export default env 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: { methods: {
go2, go2,
back, back,
@ -396,7 +404,6 @@ export default {
paySign: result.paySign paySign: result.paySign
} }
console.log('info', info) console.log('info', info)
this.wxCode = null
this.wxPay(info) this.wxPay(info)
}) })
}) })
@ -420,9 +427,6 @@ export default {
icon: 'error', icon: 'error',
duration: 2000 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"> <view class="timer-area">
<text style="font-size: 30rpx; color: #000000">送货时间:</text> <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>
<!-- 支付方式 --> <!-- 支付方式 -->
<view class="pay-area"> <view class="pay-area">
@ -97,16 +97,16 @@
<view class="left"> <view class="left">
<image class="img" src="/static/imgs/order/month-pay-icon.png"></image> <image class="img" src="/static/imgs/order/month-pay-icon.png"></image>
<text style="font-size: 30rpx; color: #000000; margin: 0 16rpx">使用月结额度</text> <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> </view>
<image <image
v-if="payMap['month'] != null && payMap['month'].availableCreditLine > orderInfo.totalOfferPrice"
v-if="payMap['month'].isShow && payMap['month'].availableCreditLine > orderInfo.totalOfferPrice"
@click="selectPayMethod('month')" @click="selectPayMethod('month')"
class="img" class="img"
:src="currentPayType == 'month' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'" :src="currentPayType == 'month' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'"
></image> ></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> </text>
</view> </view>
@ -114,16 +114,16 @@
<view class="left"> <view class="left">
<image class="img" src="/static/imgs/order/fs-pay-icon.png"></image> <image class="img" src="/static/imgs/order/fs-pay-icon.png"></image>
<text style="font-size: 30rpx; color: #000000; margin: 0 16rpx">使用飞算资金</text> <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> </view>
<image <image
v-if="payMap['fs'] != null && payMap['fs'].availableCreditLine > orderInfo.totalOfferPrice"
v-if="payMap['fs'].isShow && payMap['fs'].availableCreditLine > orderInfo.totalOfferPrice"
@click="selectPayMethod('fs')" @click="selectPayMethod('fs')"
class="img" class="img"
:src="currentPayType == 'fs' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'" :src="currentPayType == 'fs' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'"
></image> ></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> </text>
</view> </view>
@ -156,30 +156,33 @@ import { go2, back, getCache } from '@/utils/hook.js'
import { getPreOrderInfo, getDefaultAddress, submitClientOrder, calcNotInvoiceOrderInfo } from '@/apis/orderApi' import { getPreOrderInfo, getDefaultAddress, submitClientOrder, calcNotInvoiceOrderInfo } from '@/apis/orderApi'
import { getFsCredit, getMonthCredit } from '@/apis/commonApi' import { getFsCredit, getMonthCredit } from '@/apis/commonApi'
import { isObject } from '@/utils/is' import { isObject } from '@/utils/is'
import { invoiceStatusEnum } from '@/enums/index'
import { invoiceStatusEnum, paymentMethodEnum } from '@/enums/index'
export default { export default {
data() { data() {
return { return {
startTimeStamp: new Date().getTime(),
orderInfo: { orderInfo: {
customerEnterpriseName: '', customerEnterpriseName: '',
receivedTime: null receivedTime: null
}, },
invoiceInfo: {}, // invoiceInfo: {}, //
noInvoiceInfo: null, //
deliveryAddress: {}, deliveryAddress: {},
currentPayType: null, currentPayType: null,
payMap: { payMap: {
month: { month: {
availableCreditLine: 0, availableCreditLine: 0,
value: 2
value: paymentMethodEnum.MONTHLY_PAY,
isShow: false
}, },
fs: { fs: {
availableCreditLine: 0, availableCreditLine: 0,
value: 4
value: paymentMethodEnum.FLY_PAY,
isShow: false
}, },
wxpay: { wxpay: {
value: 1
value: paymentMethodEnum.WECHAT_PAY,
isShow: false
} }
}, },
loading: false, loading: false,
@ -194,6 +197,7 @@ export default {
if (res) { if (res) {
this.orderInfo = res this.orderInfo = res
this.invoiceInfo = res this.invoiceInfo = res
this.completePayment(res.paymentMethods)
} }
}) })
} else { } else {
@ -209,7 +213,13 @@ export default {
} }
}, },
created() { created() {
this.init()
//
getDefaultAddress({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => {
if (res) {
this.deliveryAddress = res
this.deliveryAddress.addressId = res.id
}
})
}, },
onShow() { onShow() {
let address = getCache('address') let address = getCache('address')
@ -227,21 +237,16 @@ export default {
selectInvoice(type) { selectInvoice(type) {
this.isInvoice = type this.isInvoice = type
if (!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 { } else {
this.orderInfo = this.invoiceInfo this.orderInfo = this.invoiceInfo
} }
@ -287,7 +292,14 @@ export default {
icon: 'success', icon: 'success',
success: () => { success: () => {
setTimeout(() => { 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) }, 1000)
} }
}) })
@ -297,37 +309,62 @@ export default {
this.loading = false 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({ getMonthCredit({
enterpriseId: this.$store.state.companyInfo.id, enterpriseId: this.$store.state.companyInfo.id,
supplierId: this.$store.state.supplierId supplierId: this.$store.state.supplierId
}).then((res) => { }).then((res) => {
if (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 { } else {
this.payMap['month'] = null
this.payMap['month'].isShow = false
} }
}) })
//
},
//
completeFsCredit() {
getFsCredit({ getFsCredit({
enterpriseId: this.$store.state.companyInfo.id enterpriseId: this.$store.state.companyInfo.id
}).then((res) => { }).then((res) => {
if (isObject(res)) {
if (res) {
this.payMap['fs'].availableCreditLine = res.availableCreditLine this.payMap['fs'].availableCreditLine = res.availableCreditLine
if (this.payMap['fs'].availableCreditLine < this.orderInfo.totalOfferPrice && this.currentPayType == 'fs') {
this.currentPayType = null
}
} else { } 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