第一次提交

This commit is contained in:
gxwebsoft
2023-08-04 13:04:21 +08:00
commit 7a73b38bd5
764 changed files with 166417 additions and 0 deletions

441
pages/equipment/detail.vue Executable file
View File

@@ -0,0 +1,441 @@
<template>
<view class="container" :style="appThemeStyle">
<view class="addres-list">
<view class="address-item">
<view class="head-info">
<view class="title">{{ title }}</view>
<view class="description">{{ description }}</view>
</view>
<u-form :label-width="200" :model="form" ref="uForm">
<u-form-item left-icon="info-circle" label="剩余电量">
<view class="item-right">{{ form.surplusPower }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="设备电压">
<view class="item-right">{{ form.equipmentVoltage }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="GPS信号">
<view class="item-right">{{ form.gps }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="GSM信号">
<view class="item-right">{{ form.gsm }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="设备电流">
<view class="item-right">{{ form.equipmentCurrent }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="标称容量">
<view class="item-right">{{ form.nominalCapacity }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="设备温度">
<view class="item-right">{{ form.equipmentTemperature }}</view>
</u-form-item>
<u-form-item left-icon="info-circle" label="电池温度">
<view class="item-right">{{ form.batteryTemperature }}</view>
</u-form-item>
</u-form>
</view>
<view class="address-item">
<u-row gutter="16" justify="center">
<u-col span="4">
<view class="demo-layout bg-purple">
<text class="desc">最高电压</text>
<text class="value1">3.168V</text>
</view>
</u-col>
<u-col span="4">
<view class="demo-layout bg-purple-light">
<text class="desc">最低电压</text>
<text class="value2">3.166V</text>
</view>
</u-col>
<u-col span="4">
<view class="demo-layout bg-purple-dark">
<text class="desc">相差压值</text>
<text class="value3">0.002V</text>
</view>
</u-col>
</u-row>
</view>
<view class="address-item">
<view class="head-info">
<view class="title">电芯电压</view>
</view>
<view class="content">
<image class="image" src="../../../static/battery.png"></image>
</view>
</view>
</view>
</view>
</template>
<script>
import * as AddressApi from '@/api/address'
import Empty from '@/components/empty'
export default {
components: {
Empty
},
data() {
return {
//当前页面参数
options: {},
form: {
surplusPower: '98%',
equipmentVoltage: '82.6V',
gps: '',
gsm: '',
equipmentCurrent: '12AH',
nominalCapacity: '50AH',
equipmentTemperature: '2℃',
batteryTemperature: '35℃'
},
// 正在加载
isLoading: true,
// 收货地址列表
list: [],
// 默认收货地址
defaultId: null,
title: '设备信息',
description: '要查看设备的相关参数信息'
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 当前页面参数
this.options = options
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取页面数据
this.getPageData()
},
methods: {
// 获取页面数据
getPageData() {
const app = this
app.isLoading = true
Promise.all([app.getDefaultId(), app.getAddressList()])
.then(() => {
// 列表排序把默认收货地址放到最前
app.onReorder()
})
.finally(() => app.isLoading = false)
},
// 获取收货地址列表
getAddressList() {
const app = this
return new Promise((resolve, reject) => {
AddressApi.list()
.then(result => {
app.list = result.data.list
resolve(result)
})
.catch(reject)
})
},
// 获取默认的收货地址
getDefaultId() {
return new Promise((resolve, reject) => {
const app = this
AddressApi.defaultId()
.then(result => {
app.defaultId = result.data.defaultId
resolve(result)
})
.catch(reject)
})
},
// 列表排序把默认收货地址放到最前
onReorder() {
const app = this
app.list.sort(item => {
return item.address_id == app.defaultId ? -1 : 1
})
},
navTo(url) {
this.$navTo(url)
},
/**
* 添加新地址
*/
handleCreate() {
this.$navTo('pages/address/create')
},
/**
* 编辑地址
* @param {int} addressId 收货地址ID
*/
handleUpdate(addressId) {
this.$navTo('pages/address/update', {
addressId
})
},
/**
* 删除收货地址
* @param {int} addressId 收货地址ID
*/
handleRemove(addressId) {
const app = this
uni.showModal({
title: "提示",
content: "您确定要删除当前收货地址吗?",
success({
confirm
}) {
confirm && app.onRemove(addressId)
}
});
},
/**
* 确认删除收货地址
* @param {int} addressId 收货地址ID
*/
onRemove(addressId) {
const app = this
AddressApi.remove(addressId)
.then(result => {
app.getPageData()
})
},
/**
* 设置为默认地址
* @param {Object} addressId
*/
handleSetDefault(addressId) {
const app = this
AddressApi.setDefault(addressId)
.then(result => {
app.defaultId = addressId
app.options.from === 'checkout' && uni.navigateBack()
})
}
}
}
</script>
<style lang="scss" scoped>
.addres-list {
padding-bottom: calc(constant(safe-area-inset-bottom) + 140rpx);
padding-bottom: calc(env(safe-area-inset-bottom) + 140rpx);
padding-top: 20rpx;
.head-info {
width: 750rpx;
margin: auto;
display: felx;
flex-direction: column;
.title {
font-weight: bold;
font-size: 34rpx;
}
.description {
padding: 10rpx 0;
font-size: 30rpx;
color: #999999;
}
}
}
// 项目内容
.address-item {
margin: 0 auto 20rpx auto;
padding: 30rpx 40rpx;
width: 94%;
box-shadow: 0 1rpx 5rpx 0 rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
background: #fff;
.title {
display: flex;
justify-content: space-between;
}
.item-right {
display: flex;
justify-content: flex-end;
}
.demo-layout {
display: flex;
flex-direction: column;
.value1 {
color: #de4e02;
}
.value2 {
color: #ff0089;
}
.value3 {
color: #0c10f5;
}
}
.image{
width: 200rpx;
height: 200rpx;
}
}
.contacts {
margin-bottom: 16rpx;
display: flex;
justify-content: space-between;
.bms-info {
display: flex;
flex-direction: column;
.item {
margin-right: 16rpx;
}
.name {
margin-right: 16rpx;
}
}
.bms-image {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
width: 120rpx;
.bms-image-box {
display: flex;
font-size: 22rpx;
margin-bottom: 18rpx;
color: #00af00;
.bms-image-fbf {
margin-top: 22rpx;
}
}
.image {
width: 50rpx;
height: 60rpx;
}
}
}
.address {
font-size: 28rpx;
.region {
margin-right: 10rpx;
}
}
.line {
margin: 20rpx 0;
border-bottom: 1rpx solid #f3f3f3;
}
.line-align {
width: 6rpx;
height: 48rpx;
border-right: 1rpx solid #f3f3f3;
}
.item-option {
display: flex;
justify-content: space-around;
align-items: center;
height: 48rpx;
// 单选框
.item-radio {
font-size: 28rpx;
.radio {
vertical-align: middle;
transform: scale(0.76)
}
.text {
vertical-align: middle;
}
}
// 操作
.events {
display: flex;
align-items: center;
line-height: 48rpx;
.event-item {
font-size: 28rpx;
margin-right: 26rpx;
color: #4c4c4c;
&:last-child {
margin-right: 0;
}
.title {
margin-left: 8rpx;
}
}
}
}
// 底部操作栏
.footer-fixed {
position: fixed;
bottom: var(--window-bottom);
left: 0;
right: 0;
z-index: 11;
// 设置ios刘海屏底部横线安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.btn-wrapper {
height: 120rpx;
padding: 0 40rpx;
}
.btn-item {
flex: 1;
font-size: 28rpx;
height: 86rpx;
color: #fff;
border-radius: 50rpx;
display: flex;
justify-content: center;
align-items: center;
box-shadow: 0 1rpx 5rpx 0 rgba(0, 0, 0, 0.05);
}
.btn-item-main {
background: linear-gradient(to right, $main-bg, $main-bg2);
}
}
</style>

View File

@@ -0,0 +1,255 @@
<template>
<view>
<view class="goods-info">
<view class="goods">
<image src="../../static/goods/battery.png" mode="aspectFit"></image>
<view class="info">
<text class="goods-name">{{ record.equipmentName }}</text>
<!-- <text class="goods-desc">归属门店{{ record.merchantName }}</text> -->
<text class="goods-desc">电池型号{{ record.batteryModel }}</text>
<text class="goods-desc">电池编号{{ record.equipmentCode }}</text>
<text class="goods-desc">是否激活{{ record.isCtive == 0 ? '已激活' : '未激活' }}</text>
<text class="goods-desc">BMS{{ record.bms }}</text>
<text class="goods-desc">工作状态{{ record.workingStatus }}</text>
<text class="goods-desc">租赁状态{{ record.leaseStatus }}</text>
<text class="goods-desc">电池状态{{ record.batteryStatus }}</text>
<text class="goods-desc">电池电量{{ record.batteryPower }}</text>
<text class="goods-desc">是否在线{{ record.isOnline }}</text>
<text class="goods-desc">总电压{{ record.totalVoltage }}</text>
<text class="goods-desc">剩余容量{{ record.surplusCapacity }}</text>
<text class="selling-point" v-if="record.equipmentCategory === '锂电池租赁'">全新电池连续组满15个月电池归客户</text>
</view>
</view>
</view>
<view class="submit">
<u-button type="primary" @click="onBuy">立即购买</u-button>
</view>
<!-- <view class="submit">
<u-button type="success" :disabled="agree" @click="copyCode(record.equipmentCode)">复制设备编号</u-button>
</view> -->
<view class="submit">
<u-button type="success" :disabled="agree" @click="gohome">返回首页</u-button>
</view>
</view>
</template>
<script>
import { userId } from '@/config.js';
import {
getEquipment
} from '@/websoft/api/equipment.js'
import { getUser } from '@/websoft/api/user.js'
import { addOrder } from '@/websoft/api/order.js'
import { createOrderNo } from '@/utils/util.js'
import store from '../../store';
export default {
components: {
// Search
},
data() {
return {
record: {},
// 正在加载中
isLoading: true,
// 当前选择的设备ID
equipmentId: null,
merchantId: null,
merchantCode: null,
show: true,
mode: 'range',
month: 6,
agree: false,
price: {
batteryRent: 300,
batteryDeposit: 300,
batteryInsurance: 0
},
}
},
onLoad(option) {
const app = this
// 记录当前选择的门店ID
console.log("option: ",option);
app.equipmentId = Number(option.equipmentId)
app.merchantId = Number(option.merchantId)
app.merchantCode = option.merchantCode
// 获取设备列表
app.getEquipment()
},
methods: {
getEquipment() {
const app = this
const {
equipmentId
} = this
getEquipment(equipmentId).then(res => {
app.record = res.data
console.log("res2222: ", app.record);
})
},
gohome(){
uni.reLaunch({
url: '/pages/index/index'
})
},
onChangeStepper({ value }) {
this.month = value
},
change(e) {
console.log(e);
},
onInput(month) {
this.month = month
},
onAgree(){
this.agree = !this.agree
},
showXieyi(){
this.$navTo('pages/help/xieyi')
},
copyCode(text){
// #ifndef H5
console.log("text: ",text);
uni.setClipboardData({
text: text,
success: (result) => {
this.$success("复制成功")
}
})
// #endif
// #ifdef H5
let textarea = document.createElement("textarea")
textarea.value = text
textarea.readOnly = "readOnly"
document.body.appendChild(textarea)
textarea.select() // 选中文本内容
textarea.setSelectionRange(0, info.length)
uni.showToast({ //提示
title: '复制成功'
})
result = document.execCommand("copy")
textarea.remove()
// #endif
// copy() {
// let result
// // #ifndef H5
// //uni.setClipboardData方法就是讲内容复制到粘贴板
// uni.setClipboardData({
// data: this.downUrl.url, //要被复制的内容
// success: () => { //复制成功的回调函数
// uni.showToast({ //提示
// title: '复制成功'
// })
// }
// });
// // #endif
// }
},
onBuy(){
const app = this
const { equipmentId } = this
this.$navTo('pages/merchant/merchant', { equipmentId })
}
}
}
</script>
<style lang="scss" scoped>
.goods-info {
background-color: #ffffff;
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
.goods {
padding: 20rpx;
display: flex;
image {
width: 170rpx;
height: 170rpx;
margin: 20rpx;
}
.info {
display: flex;
flex-direction: column;
padding: 20rpx;
.goods-name {
font-size: 34rpx;
margin-bottom: 10rpx;
}
.goods-desc {
font-size: 28rpx;
color: #999999;
}
.selling-point{
padding: 5px 0;
color: #e6760e;
}
}
}
.between-time {
width: 500rpx;
margin: auto;
padding-bottom: 20rpx;
text-align: center;
.select-slider {
line-height: 2em;
color: #e6760e;
}
}
}
.order {
background-color: #ffffff;
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
.title {
font-weight: bold;
font-size: 30rpx;
padding: 20rpx;
display: flex;
justify-content: space-between;
}
.xieyi {
padding: 20rpx;
font-size: 26rpx;
}
}
.submit {
border-radius: 12rpx;
width: 700rpx;
margin: 20rpx auto;
padding: 10rpx 0;
}
.xieyi-text{
color: #0000ff;
}
.fenqi{
padding: 30rpx;
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
.item{
display: flex;
justify-content: space-between;
padding: 20rpx 0;
}
}
</style>