乱七八糟
This commit is contained in:
@@ -76,7 +76,7 @@
|
||||
PayStatusEnum
|
||||
} from '@/common/enum/order'
|
||||
import {
|
||||
getOrder,
|
||||
getOrderPay,
|
||||
setPayStatus
|
||||
} from '@/websoft/api/order.js'
|
||||
import {
|
||||
@@ -181,7 +181,7 @@
|
||||
} = this
|
||||
app.isLoading = true
|
||||
// 加载订单
|
||||
getOrder(orderId)
|
||||
getOrderPay(orderId)
|
||||
.then(res => {
|
||||
app.order = res.data
|
||||
app.isLoading = false
|
||||
@@ -271,7 +271,7 @@
|
||||
handleSubmit() {
|
||||
const app = this
|
||||
const {
|
||||
orderId
|
||||
id
|
||||
} = app.order
|
||||
// 判断是否选择了支付方式
|
||||
if (!app.curPaymentItem) {
|
||||
@@ -284,10 +284,10 @@
|
||||
// .js
|
||||
console.log("curPaymentItem: ",app.curPaymentItem);
|
||||
if(app.curPaymentItem.method == '余额支付'){
|
||||
balance(orderId).then(result => app.onSubmitCallback(result)).catch(err => app.$error(err.message))
|
||||
balance(id).then(result => app.onSubmitCallback(result)).catch(err => app.$error(err.message))
|
||||
}
|
||||
if(app.curPaymentItem.method == '支付宝'){
|
||||
alipay(orderId).then(result => app.onSubmitCallback(result)).catch(err => app.$error(err.message))
|
||||
alipay(id).then(result => app.onSubmitCallback(result)).catch(err => app.$error(err.message))
|
||||
}
|
||||
|
||||
|
||||
@@ -334,7 +334,7 @@
|
||||
payQuery(app.orderId).then(result => {
|
||||
if(result.code == 0) {
|
||||
app.$success('支付成功')
|
||||
app.$navTo('pages/order/index')
|
||||
uni.navigateBack()
|
||||
}
|
||||
})
|
||||
|
||||
@@ -348,7 +348,7 @@
|
||||
// })
|
||||
}
|
||||
if (res.resultCode == "6001") {
|
||||
app.$navTo('pages/order/index')
|
||||
uni.navigateBack()
|
||||
}
|
||||
// my.alert({
|
||||
// content: JSON.stringify(res),
|
||||
@@ -441,7 +441,7 @@
|
||||
if (lastPage && inArray(lastPage.route, backRoutes)) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
this.$navTo('pages/order/index', {}, 'redirectTo')
|
||||
uni.navigateBack()
|
||||
}
|
||||
}, 1200)
|
||||
},
|
||||
|
||||
@@ -63,10 +63,14 @@
|
||||
<text>¥{{ (record.batteryRent + record.batteryDeposit + record.batteryInsurance).toFixed(2) }}元</text>
|
||||
</view>
|
||||
<u-cell-group>
|
||||
<u-cell-item :title="`租金(按${record.periodsType == 0 ? '周' : '月'})`" :border-bottom="false" hover-class="none" :value="record.batteryRent">元</u-cell-item>
|
||||
<u-cell-item title="分期期数" :border-bottom="false" hover-class="none" :value="record.periods">期</u-cell-item>
|
||||
<u-cell-item title="押金" :border-bottom="false" hover-class="none" :value="record.batteryDeposit">元</u-cell-item>
|
||||
<u-cell-item title="保险" :border-bottom="false" hover-class="none" :value="record.batteryInsurance">元</u-cell-item>
|
||||
<u-cell-item :title="`租金(按${record.periodsType == 0 ? '周' : '月'})`" :border-bottom="false"
|
||||
hover-class="none" :value="record.batteryRent">元</u-cell-item>
|
||||
<u-cell-item title="分期期数" :border-bottom="false" hover-class="none"
|
||||
:value="record.periods">期</u-cell-item>
|
||||
<u-cell-item title="押金" :border-bottom="false" hover-class="none"
|
||||
:value="record.batteryDeposit">元</u-cell-item>
|
||||
<u-cell-item title="保险" :border-bottom="false" hover-class="none"
|
||||
:value="record.batteryInsurance">元</u-cell-item>
|
||||
</u-cell-group>
|
||||
</block>
|
||||
<block v-if="record.equipmentCategory === '40'">
|
||||
@@ -87,7 +91,7 @@
|
||||
<view class="name">电动车保险</view>
|
||||
{{ record.batteryInsurance }} 元
|
||||
</view>
|
||||
|
||||
|
||||
</view>
|
||||
<!-- <u-cell-group>
|
||||
<u-cell-item title="电动车租金" :border-bottom="false" hover-class="none" :value="`¥${record.batteryRent} 元`"></u-cell-item>
|
||||
@@ -95,10 +99,11 @@
|
||||
<u-cell-item title="电动车保险" :border-bottom="false" hover-class="none" :value="record.batteryInsurance"></u-cell-item>
|
||||
</u-cell-group> -->
|
||||
</block>
|
||||
|
||||
|
||||
<view class="xieyi">
|
||||
<checkbox-group @change="onAgree" style="display: flex; align-items: center;">
|
||||
<checkbox :checked="agree" />我已同意并阅读<div class="xieyi-text" @click="showXieyi">《服务协议》</div>与<div class="xieyi-text" @click="showXieyi">《隐私协议》</div>
|
||||
<checkbox :checked="agree" />我已同意并阅读<div class="xieyi-text" @click="showXieyi">《服务协议》</div>与<div
|
||||
class="xieyi-text" @click="showXieyi">《隐私协议》</div>
|
||||
</checkbox-group>
|
||||
</view>
|
||||
</view>
|
||||
@@ -106,7 +111,8 @@
|
||||
<u-input v-model="dealerPhone" :disabled="disabled" placeholder="请输入推荐人手机号" />
|
||||
</view>
|
||||
<view class="submit">
|
||||
<u-button type="primary" :disabled="!agree" @click="onBuy">立即下单</u-button>
|
||||
<image style="width: 7rem;margin: 0 auto;" @click="onBuy" src="@/static/zhimamianya.png" mode="widthFix"></image>
|
||||
<!-- <u-button type="primary" :disabled="!agree" @click="onBuy">立即下单</u-button> -->
|
||||
</view>
|
||||
<!-- <view class="submit">
|
||||
<u-button type="success" :disabled="agree" @click="copyCode(record.equipmentCode)">复制设备编号</u-button>
|
||||
@@ -115,14 +121,27 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { userId } from '@/config.js';
|
||||
import {
|
||||
userId
|
||||
} from '@/config.js';
|
||||
import {
|
||||
getEquipmentGoods
|
||||
} from '@/websoft/api/equipment-goods.js'
|
||||
import { getUser } from '@/websoft/api/user.js'
|
||||
import { addOrder } from '@/websoft/api/order.js'
|
||||
import { dateFormat } from '@/utils/util.js'
|
||||
import { createOrderNo } from '@/utils/util.js'
|
||||
import {
|
||||
getUser
|
||||
} from '@/websoft/api/user.js'
|
||||
import {
|
||||
addOrder,
|
||||
freeze,
|
||||
removeOrder,
|
||||
checkFreeze
|
||||
} from '@/websoft/api/order.js'
|
||||
import {
|
||||
dateFormat
|
||||
} from '@/utils/util.js'
|
||||
import {
|
||||
createOrderNo
|
||||
} from '@/utils/util.js'
|
||||
import store from '../../store';
|
||||
import {
|
||||
payQuery
|
||||
@@ -148,7 +167,7 @@
|
||||
batteryDeposit: 300,
|
||||
batteryInsurance: 0
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
@@ -158,14 +177,16 @@
|
||||
// 获取设备列表
|
||||
app.getEquipment()
|
||||
},
|
||||
onShow(){
|
||||
var time = new Date().getTime() + 60*60*1000*24
|
||||
onShow() {
|
||||
var time = new Date().getTime() + 60 * 60 * 1000 * 24
|
||||
const expirationTime = dateFormat('YYYY-mm-dd HH:MM:SS', new Date(time))
|
||||
console.log("time: ",time);
|
||||
console.log("expirationTime: ",expirationTime);
|
||||
console.log("time: ", time);
|
||||
console.log("expirationTime: ", expirationTime);
|
||||
payQuery(752).then(res => {
|
||||
console.log("res123: ",res);
|
||||
console.log("res123: ", res);
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
getEquipment() {
|
||||
@@ -178,7 +199,9 @@
|
||||
console.log("res: ", app.record);
|
||||
})
|
||||
},
|
||||
onChangeStepper({ value }) {
|
||||
onChangeStepper({
|
||||
value
|
||||
}) {
|
||||
this.month = value
|
||||
},
|
||||
change(e) {
|
||||
@@ -187,15 +210,15 @@
|
||||
onInput(month) {
|
||||
this.month = month
|
||||
},
|
||||
onAgree(){
|
||||
onAgree() {
|
||||
this.agree = !this.agree
|
||||
},
|
||||
showXieyi(){
|
||||
showXieyi() {
|
||||
this.$navTo('pages/help/xieyi')
|
||||
},
|
||||
copyCode(text){
|
||||
copyCode(text) {
|
||||
// #ifndef H5
|
||||
console.log("text: ",text);
|
||||
console.log("text: ", text);
|
||||
uni.setClipboardData({
|
||||
text: text,
|
||||
success: (result) => {
|
||||
@@ -211,7 +234,7 @@
|
||||
textarea.select() // 选中文本内容
|
||||
textarea.setSelectionRange(0, info.length)
|
||||
uni.showToast({ //提示
|
||||
title: '复制成功'
|
||||
title: '复制成功'
|
||||
})
|
||||
result = document.execCommand("copy")
|
||||
textarea.remove()
|
||||
@@ -229,34 +252,47 @@
|
||||
// }
|
||||
// });
|
||||
// // #endif
|
||||
|
||||
|
||||
|
||||
|
||||
// }
|
||||
},
|
||||
onBuy(){
|
||||
async onBuy() {
|
||||
const app = this
|
||||
const { record,dealerPhone } = this
|
||||
const {
|
||||
record,
|
||||
dealerPhone
|
||||
} = this
|
||||
let total = 0.0
|
||||
uni.showLoading({
|
||||
})
|
||||
// 未登录状态
|
||||
if(!uni.getStorageSync('userId')) {
|
||||
app.$error('请先登录',function(){
|
||||
if (!uni.getStorageSync('userId')) {
|
||||
app.$error('请先登录', function() {
|
||||
app.$navTo('pages/login/login');
|
||||
});
|
||||
return false;
|
||||
}
|
||||
if(record.equipmentCategory == '10'){
|
||||
total = (record.batteryPrice).toFixed(2)
|
||||
}
|
||||
if(record.equipmentCategory == '20'){
|
||||
total = (record.downPayment).toFixed(2)
|
||||
}
|
||||
if(record.equipmentCategory == '40' || record.equipmentCategory == '30'){
|
||||
total = (record.batteryDeposit + record.batteryRent + record.batteryInsurance).toFixed(2)
|
||||
const userRes = await getUser()
|
||||
const user = userRes.data
|
||||
|
||||
|
||||
if(record.equipmentCategory == 10) {
|
||||
total = record.batteryPrice
|
||||
}else if(record.equipmentCategory == 20) {
|
||||
total = record.downPayment + record.serviceCharges
|
||||
}else if(record.equipmentCategory == 30 || record.equipmentCategory == 40){
|
||||
total = record.batteryRent
|
||||
}
|
||||
total = total.toFixed(2)
|
||||
|
||||
const testTotal = 0.01
|
||||
var time = new Date().getTime() + 60*60*1000*24
|
||||
var time = new Date().getTime() + 60 * 60 * 1000 * 24
|
||||
const expirationTime = dateFormat('YYYY-mm-dd HH:MM:SS', new Date(time))
|
||||
app.expirationTime = expirationTime
|
||||
|
||||
|
||||
|
||||
|
||||
addOrder({
|
||||
orderNo: createOrderNo(),
|
||||
merchantCode: record.merchantCode,
|
||||
@@ -272,12 +308,43 @@
|
||||
orderSource: record.equipmentCategory,
|
||||
orderSourceId: record.goodsId,
|
||||
dealerPhone
|
||||
}).then(res => {
|
||||
const { orderId } = res.data
|
||||
app.$success("下单成功")
|
||||
setTimeout(() => {
|
||||
this.$navTo('pages/checkout/cashier/index', { orderId })
|
||||
}, 100)
|
||||
}).then(res => {
|
||||
const {
|
||||
orderId
|
||||
} = res.data
|
||||
if (record.equipmentCategory != 10) {
|
||||
my.tradePay({
|
||||
orderStr: res.data.orderStr, // 完整的支付参数拼接成的字符串,从服务端获取
|
||||
success: (res) => {
|
||||
|
||||
},
|
||||
fail: (res) => {
|
||||
|
||||
},
|
||||
complete: () => {
|
||||
checkFreeze(orderId).then(() => {
|
||||
app.$success("下单成功")
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/index'
|
||||
})
|
||||
}, 100)
|
||||
})
|
||||
|
||||
}
|
||||
});
|
||||
} else {
|
||||
checkFreeze(orderId).then(() => {
|
||||
app.$success("下单成功")
|
||||
setTimeout(() => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/order/index'
|
||||
})
|
||||
}, 100)
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
@@ -311,11 +378,13 @@
|
||||
font-size: 34rpx;
|
||||
margin-bottom: 10rpx;
|
||||
}
|
||||
|
||||
.goods-desc {
|
||||
font-size: 28rpx;
|
||||
color: #999999;
|
||||
}
|
||||
.selling-point{
|
||||
|
||||
.selling-point {
|
||||
padding: 5px 0;
|
||||
color: #e6760e;
|
||||
}
|
||||
@@ -362,17 +431,20 @@
|
||||
margin: 20rpx auto;
|
||||
padding: 10rpx 0;
|
||||
}
|
||||
.xieyi-text{
|
||||
|
||||
.xieyi-text {
|
||||
color: #0000ff;
|
||||
}
|
||||
.fenqi{
|
||||
|
||||
.fenqi {
|
||||
padding: 30rpx;
|
||||
border-top: 1px solid #eee;
|
||||
border-bottom: 1px solid #eee;
|
||||
.item{
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 20rpx 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
@@ -372,6 +372,8 @@
|
||||
uni.$on('syncSelectedId', selectedId => {
|
||||
this.selectedShopId = selectedId
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -388,6 +390,7 @@
|
||||
onShow() {
|
||||
// 获取当前订单信息
|
||||
this.getOrderData()
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user