乱七八糟

This commit is contained in:
weicw
2023-10-23 15:21:33 +08:00
parent 0256bd355d
commit 686c1ae304
29 changed files with 2571 additions and 294 deletions

View File

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