This commit is contained in:
weicw
2023-09-28 21:19:51 +08:00
parent 81ecfd9df0
commit 0256bd355d
21 changed files with 1025 additions and 596 deletions

View File

@@ -6,17 +6,17 @@
<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="goods-desc">电池型号{{ record.batteryModel || '' }}</text>
<text class="goods-desc">电池编号{{ record.equipmentCode || '' }}</text>
<text class="goods-desc">是否激活{{ record.isCtive || '' }}</text>
<text class="goods-desc">BMS{{ record.bms || ''}}</text>
<text class="goods-desc">设备状态{{ record.workingStatus || ''}}</text>
<text class="goods-desc">租赁状态{{ record.userId > 0?'在租': '闲置' }}</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>
@@ -27,6 +27,12 @@
<view class="submit">
<u-button type="primary" @click="onBuy">立即购买</u-button>
</view>
<uni-data-picker ref="equipmenPicker" v-model="orderId" @change="confirmReplace" placeholder="请选择需要更换的旧电池" popup-title="请选择需要更换的旧电池" :localdata="equipments" :map="{text:'equipmentCode',value:'orderId'}">
<view class="submit">
<u-button type="warning" @click="onReplace">更换电池</u-button>
</view>
</uni-data-picker>
<!-- <view class="submit">
<u-button type="success" :disabled="agree" @click="copyCode(record.equipmentCode)">复制设备编号</u-button>
</view> -->
@@ -34,6 +40,8 @@
<u-button type="success" :disabled="agree" @click="gohome">返回首页</u-button>
</view>
</view>
</template>
@@ -46,6 +54,7 @@
import { addOrder } from '@/websoft/api/order.js'
import { createOrderNo } from '@/utils/util.js'
import store from '../../store';
import * as EquipmentApi from '@/websoft/api/equipment.js'
export default {
components: {
// Search
@@ -68,11 +77,16 @@
batteryDeposit: 300,
batteryInsurance: 0
},
showEquipments: false,
equipments: [
],
orderId: null
}
},
onLoad(option) {
const app = this
app.getMyEquipments()
// 记录当前选择的门店ID
console.log("option: ",option);
app.equipmentId = Number(option.equipmentId)
@@ -92,6 +106,13 @@
console.log("res2222: ", app.record);
})
},
getMyEquipments() {
const app = this
EquipmentApi.pageEquipment({userId: uni.getStorageSync('userId')}).then(res => {
console.log("res: ",res);
app.equipments = res.data.list
})
},
gohome(){
uni.reLaunch({
url: '/pages/index/index'
@@ -156,7 +177,57 @@
const app = this
const { equipmentId } = this
this.$navTo('pages/merchant/merchant', { equipmentId })
}
},
onReplace() {
console.log("点击更换电池");
const app = this
if(this.record.userId > 0) {
uni.showToast({
title: '该电池已经被别人租走了',
icon: 'none'
})
}else if(app.equipments.length == 0) {
uni.showToast({
title: '你没有可更换的电池',
icon: 'none'
})
}else {
this.$refs.equipmenPicker.show()
this.showEquipments = true
}
},
confirmReplace(e) {
const app = this
uni.showModal({
title: '提示',
content: `确认更换此电池?`,
success: (res) => {
if(res.confirm) {
app.doEquipment()
}
}
})
console.log(e);
},
doEquipment(canReset = false) {
const app = this
const {
equipmentId,
equipmentCode,
} = app.record
EquipmentApi.changeEquipment({
equipmentCode,
equipmentId,
orderId: app.orderId
}).then(result => {
app.$success(result.message)
app.getEquipment()
app.getMyEquipments()
}).catch(err => {
app.$error(err.message)
})
},
}
}

View File

@@ -94,13 +94,24 @@
// my.alert({ title: res.code });
// }
// })
my.scan({
scanType: ['barCode'],
my.ap.openAlipayApp({
appCode: 'alipayScan',
success: res => {
console.log("res: ",res);
my.alert({ title: res.code });
console.log('openAlipayApp success', res);
},
fail: err => {
console.log('openAlipayApp fail', err);
}
});
// my.scan({
// scanType: ['qrCode'],
// autoDecodeCharset: true,
// success: res => {
// console.log("res: ",res);
// my.ap.openAlipayApp()
// },
// });
}
}
}
@@ -138,7 +149,12 @@
}
.bottom-bar{
position: fixed;
/* #ifdef H5 */
bottom: 100rpx;
/* #endif */
/* #ifndef H5 */
bottom: 10rpx;
/* #endif */
left: 25rpx;
z-index: 1000;
line-height: 70rpx;

View File

@@ -54,7 +54,7 @@
<script>
import {
uploadFile
} from '@/websoft/api/upload.js'
} from '@/api/upload'
import {
pageOrder,
removeOrder,
@@ -66,6 +66,7 @@
export default {
data() {
return {
form: {},
order: {},
orderSourceData: [],
// 按钮禁用
@@ -130,13 +131,14 @@
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(chooseImageRes) {
const tempFilePaths = chooseImageRes.tempFilePaths;
uploadFile({
filePath: tempFilePaths[0],
fileType: 'image',
name: 'file'
}).then(res => {
console.log("res: ", res);
app.orderSourceData.push(fileUrl + res.data.path)
app.orderSourceData.push(res.data.url)
receiptOrder({
orderId,
orderSourceData: JSON.stringify(app.orderSourceData)

View File

@@ -31,11 +31,11 @@
</block>
</view>
<view class="status-text">
<text class="state-text" v-if="order.payStatus == 10">待支付</text>
<text class="state-text" v-if="order.payStatus == 20 && order.receiptStatus == 10">绑定</text>
<text class="state-text" v-if="order.orderStatus == OrderStatusEnum.COMPLETED.value && order.receiptStatus == 20">已完成</text>
<text class="state-text" v-if="order.receiptStatus == 21">退租</text>
<text class="state-text" v-if="order.receiptStatus == 30">已退租</text>
<text class="state-text" v-if="order.payStatus == 20 && (order.receiptStatus == 30 || order.currPeriods >= order.periods)">已完成</text>
<text class="state-text" v-else-if="order.payStatus == 10">支付</text>
<text class="state-text" v-else-if="order.payStatus == 20 && order.receiptStatus == 10">待绑定</text>
<text class="state-text" v-else-if="order.orderStatus == 30 && order.receiptStatus == 20">进行</text>
<text class="state-text" v-else-if="order.receiptStatus == 21">进行中</text>
<!-- <text>{{ order.stateText }}</text> -->
</view>
</view>
@@ -215,6 +215,12 @@
</view>
</view>
</block>
<view class="info-item">
<view class="item-lable">可用天数</view>
<view class="item-content">
<text>{{ Math.abs(order.expirationDay) }}天</text>
</view>
</view>
<block v-if="equipmentGoods.equipmentCategory == '40'">
<view class="info-item">
<view class="item-lable">下单方式</view>
@@ -369,10 +375,11 @@
<!-- 续费订单 -->
<view class="trade-info i-card">
<view class="info-item" v-if="equipmentGoods.equipmentCategory != '40'">
<view class="info-item" v-if="order.orderSource != 10">
<view class="item-lable">当前期数</view>
<view class="item-content">
<text>第 {{ renewOrderList.length + 1 }} 期</text>
<text v-if="order.orderSource == 20">首期</text>
<text v-else>第 1 期</text>
</view>
</view>
<view class="info-item">
@@ -411,6 +418,10 @@
<text>+¥{{ orderPrice3 }}</text>
</view>
</view>
<view class="info-item">
<view class="item-lable">付款时间</view>
<view class="item-content">{{ order.payTime }}</view>
</view>
<view class="info-item"
v-if="order.orderStatus == OrderStatusEnum.COMPLETED.value && equipmentGoods.equipmentCategory != '10'">
<view class="item-lable">到期时间</view>
@@ -420,12 +431,7 @@
{{ Math.abs(order.expirationDay) }}天)</text>
</view>
</view>
<view class="info-item">
<view class="item-lable">可用天数</view>
<view class="item-content">
<text>{{ Math.abs(order.expirationDay) }}天</text>
</view>
</view>
<!-- <view v-if="order.updatePrice.value != '0.00'" class="info-item">
<view class="item-lable">后台改价</view>
@@ -443,10 +449,10 @@
</view>
</view>
</view>
<view class="renew-divider">-- 历史订单 --</view>
<view class="renew-divider">-- 续费订单 --</view>
<view class="renew-order" v-if="renewOrderList.length > 0 && equipmentGoods.equipmentCategory != '10' ">
<!-- 首付 -->
<!-- <view class="trade-info i-card " v-for="(item,index) in renewOrderList" :key="index" v-if="index == 0">
<!-- 首付 -->
<!-- <view class="trade-info i-card " v-for="(item,index) in renewOrderList" :key="index" v-if="index == 0">
<view class="info-item" v-if="equipmentGoods.equipmentCategory != '40'">
<view class="item-lable">期数</view>
<view class="item-content">
@@ -485,10 +491,11 @@
</view>
</view> -->
<view class="trade-info i-card " v-for="(item,index) in renewOrderList" :key="index">
<view class="info-item" v-if="equipmentGoods.equipmentCategory != '40'">
<view class="item-lable">期数</view>
<view class="info-item" v-if="order.orderSource != 10">
<view class="item-lable">当前期数</view>
<view class="item-content">
<text>第 {{ index + 1 }} 期</text>
<text v-if="order.orderSource == 20">第 {{ index + 1}} 期</text>
<text v-else>第 {{ index + 2}} 期</text>
</view>
</view>
<view class="info-item">
@@ -546,8 +553,8 @@
</view>
</view>
</view>
</view>
</view>
@@ -557,7 +564,7 @@
<view class="btn-wrapper">
<!-- 未支付取消订单 -->
<block v-if="order.payStatus == PayStatusEnum.PENDING.value">
<view class="btn-item" @click="onCancel(order.orderId)">取消</view>
<view class="btn-item" @click="onCancel(order.orderId)">取消订单</view>
</block>
<!-- 已支付进行中的订单 -->
<block v-if="order.orderStatus != OrderStatusEnum.APPLY_CANCEL.value">
@@ -586,14 +593,16 @@
<view class="btn-item active" @click="onReceipt(order.orderId)">确认收货</view>
</block>
<!-- 订单评价 -->
<block v-if="order.orderStatus == OrderStatusEnum.COMPLETED.value && order.isComment == 0 && order.receiptStatus != 30">
<block
v-if="order.orderStatus == OrderStatusEnum.COMPLETED.value && order.isComment == 0 && order.receiptStatus != 30">
<view class="btn-item" @click="handleTargetEquipment(order.equipmentId)">查看电池</view>
<view class="btn-item" @click="handleHireEquipment(order.orderId)"
v-if="equipmentGoods.equipmentCategory != '10' && !orderEnd">我要续费</view>
<view class="btn-item" @click="handleRentingOut(order)"
v-if="equipmentGoods.equipmentCategory != '10' && order.receiptStatus != 21">我要退租</view>
<view class="btn-item" @click="handleRentingOut(order)"
v-if="equipmentGoods.equipmentCategory != '10' && order.receiptStatus == 21 && !orderEnd">取消退租</view>
v-if="equipmentGoods.equipmentCategory != '10' && order.receiptStatus == 21 && !orderEnd">取消退租
</view>
</block>
</view>
</view>
@@ -710,8 +719,7 @@
}) {
// 当前订单ID
this.orderId = orderId
// 获取当前订单信息
this.getOrderDetail()
// 注册全局事件订阅: 是否刷新当前订单数据
uni.$on('syncRefreshOrder', (val, isCur) => {
if (!isCur) {
@@ -724,7 +732,7 @@
* 生命周期函数--监听页面显示
*/
onShow() {
this.canReset && this.getOrderDetail()
this.getOrderDetail()
this.canReset = false
},
@@ -744,7 +752,7 @@
if (result.data.equipment) {
app.equipmentId = result.data.equipment.equipmentId
}
// 项目显示
app.priceTitle1 = null
app.priceTitle2 = null
@@ -808,8 +816,12 @@
})
.then(res => {
console.log(res);
res.data.sort((a,b) => {
return new Date(a.createTime.replace(/-/gi, '/')) - new Date(b.createTime.replace(/-/gi, '/'))
})
app.renewOrderList = res.data;
if(res.data.length >= app.equipmentGoods.periods){
if (res.data.length >= app.equipmentGoods.periods && (this.order.orderSource == 20 || this
.order.orderSource == 30)) {
app.orderEnd = true
}
// 计算逾期
@@ -942,17 +954,33 @@
orderId
})
},
handleRentingOut(order){
const { orderId,equipmentId } = order
EquipmentApi.rentingOut({orderId,equipmentId}).then(res => {
this.$success(res.message)
setTimeout(() => {
// 刷新当前订单数据
app.getOrderDetail(true)
}, 1500)
}).catch(err => {
this.$success(err.message)
handleRentingOut(order) {
const app = this
uni.showModal({
title: '提示',
content: '是否退租',
success: (result) => {
if(result.confirm) {
const {
orderId,
equipmentId
} = order
EquipmentApi.rentingOut({
orderId,
equipmentId
}).then(res => {
this.$success(res.message)
setTimeout(() => {
// 刷新当前订单数据
app.getOrderDetail(true)
}, 1500)
}).catch(err => {
this.$success(err.message)
})
}
}
})
},
// 跳转到设备详情页
@@ -986,7 +1014,7 @@
orderSource: order.orderSource,
orderSourceId: order.goodsId,
equipmentId: order.equipmentId,
dealerPhone:order.dealerPhone,
dealerPhone: order.dealerPhone,
comments: '续租订单' + order.orderNo
}).then(res => {
const {
@@ -1413,6 +1441,7 @@
align-items: center;
font-size: 26rpx;
color: #333;
.act-copy {
margin-left: 20rpx;
padding: 2rpx 20rpx;
@@ -1444,7 +1473,8 @@
font-size: 26rpx;
color: #333;
text-align: right;
.expirat-time-box{
.expirat-time-box {
display: flex;
flex-direction: column;
}
@@ -1477,7 +1507,7 @@
.renew-order {
display: flex;
flex-direction: column-reverse;
flex-direction: column;
}
// 底部操作栏
@@ -1579,9 +1609,10 @@
color: #ff0000;
padding-left: 10rpx
}
.renew-divider{
.renew-divider {
padding: 30rpx 0;
text-align: center;
color: #666666;
}
</style>
</style>

View File

@@ -13,11 +13,12 @@
<text class="order-time">{{ item.merchantName }}</text>
</view>
<view class="item-top-right">
<text class="state-text" v-if="item.payStatus == 10">待支付</text>
<text class="state-text" v-if="item.payStatus == 20 && item.receiptStatus == 10">绑定</text>
<text class="state-text" v-if="item.orderStatus == 30 && item.receiptStatus == 20">已完成</text>
<text class="state-text" v-if="item.receiptStatus == 21">退租</text>
<text class="state-text" v-if="item.receiptStatus == 30">已退租</text>
<text class="state-text" v-if="item.payStatus == 20 && (item.receiptStatus == 30 || item.currPeriods >= item.periods)">已完成</text>
<text class="state-text" v-else-if="item.payStatus == 10">支付</text>
<text class="state-text" v-else-if="item.payStatus == 20 && item.receiptStatus == 10">待绑定</text>
<text class="state-text" v-else-if="item.orderStatus == 30 && item.receiptStatus == 20">进行</text>
<text class="state-text" v-else-if="item.receiptStatus == 21">进行中</text>
</view>
</view>
<!-- 商品列表 -->
@@ -115,6 +116,12 @@
<!-- <view class="btn-item" v-if="item.equipmentGoods.equipmentCategory == '锂电池租赁' || item.equipmentGoods.equipmentCategory == '电动车租赁'" @click="handleTargetDetail(item.orderId)">续费</view> -->
<view class="btn-item" @click="handleTargetDetail(item.orderId)">详情</view>
</block>
<block
v-if="item.orderStatus == OrderStatusEnum.COMPLETED.value && item.isComment == 0 && item.receiptStatus != 30">
<view class="btn-item" @click="handleTargetDetail(item.orderId)"
v-if="item.equipmentGoods.equipmentCategory != '10' && !orderEnd">我要续费 </view>
</block>
</view>
</view>
</view>
@@ -181,7 +188,8 @@
import {
pageOrder,
removeOrder,
receiptOrder
receiptOrder,
addOrder
} from '@/websoft/api/order.js'
import {
bindEquipment
@@ -190,7 +198,9 @@
uploadFile
} from '@/websoft/api/upload.js'
import { fileUrl } from '@/config.js';
import {
createOrderNo,dateFormat
} from '@/utils/util.js'
// 每页记录数量
const pageSize = 15
@@ -201,12 +211,18 @@
}, {
name: `待支付`,
value: 'payment'
}, {
},
{
name: `待绑定`,
value: 'delivery'
}, {
name: `已完成`,
},
{
name: `进行中`,
value: 'comment'
},
{
name: `已完成`,
value: 'refund'
}]
export default {
@@ -303,7 +319,7 @@
app.curTab = index > -1 ? index : 0
}
},
/**
* 上拉加载的回调 (页面初始化时也会执行一次)
* 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10
@@ -321,7 +337,6 @@
// })
// .catch(() => app.mescroll.endErr())
},
// 获取订单列表
getOrderList(pageNo = 1) {
const app = this
@@ -343,11 +358,11 @@
}
if (curTab == 3) {
app.where.payStatus = 20;
app.where.receiptStatus = 20;
app.where.orderStatus = 30;
}
if (curTab == 4) {
app.where.receiptStatus = 20;
app.where.isComment = 0;
app.where.payStatus = 20;
app.where.orderStatus = 40;
}
app.where.userId = uni.getStorageSync('userId');
app.where.isRenew = 0;

View File

@@ -1,29 +1,62 @@
<template>
<view>
<uni-list>
<uni-list-item :key="index" v-for="(item, index) in dataList" :title="`订单号:${item.orderNo}`"
:note="`${orderType[item.scene]}:+ ${item.money}元`" :rightText="item.createTime"></uni-list-item>
</uni-list>
<view class="cell" :key="index" v-for="(item, index) in dataList">
<view class="cell-top">
<view class="title"> {{`订单号:${item.orderNo}`}}</view>
<view class="time"> {{item.createTime}}</view>
</view>
<view cell-desc>
<view class="cell-desc-item">
{{`${orderType[item.scene]}:+ ${item.money}`}}
</view>
<view class="cell-desc-item">
门店名称:{{item.merchantName }}
</view>
<view class="cell-desc-item">
下单方式:{{ orderSource[item.orderSource] }}<text v-if="item.orderSource == 20 || item.orderSource == 30 "> {{item.isRenew?'续费':'首期'}}</text>
</view>
<view class="cell-desc-item">
设备编号:{{item.equipmentCode }}
</view>
</view>
</view>
<empty v-if="dataList.length == 0"></empty>
<!-- <uni-list>
<uni-list-item :title=""
:note="`${orderType[item.scene]}:+ ${item.money}元`" :rightText="item.createTime">
</uni-list-item>
</uni-list> -->
</view>
</template>
<script>
import * as LogApi from '@/api/shop/profitLog.js'
import {mapGetters} from 'vuex'
import {
mapGetters
} from 'vuex'
import storage from '../../../utils/storage';
import Empty from '@/components/empty'
export default {
components: {Empty},
data() {
return {
dataList: [],
hasMore: true,
page: 1,
limit: 10,
where: {
},
orderType:{
limit: 20,
where: {},
orderType: {
1: "投资收益",
3: "推广收益",
4: "门店收益",
5: "门店业绩",
5: "区域经理收益",
},
orderSource: {
10: "销售",
20: "分期",
30: "以租代购",
40: "租赁",
}
};
},
@@ -38,17 +71,20 @@
LogApi.list({
page: this.page,
limit: this.limit,
userId: this.userId
userId: storage.get("userId")
}).then(res => {
if(res.code == 0){
if (res.code == 0) {
res.data.list.forEach(item => {
item.createTime = this.$u.timeFormat(item.createTime, 'yyyy-mm-dd');
item.createTime = item.createTime.replace(/-/gi, '/')
item.createTime = this.$u.timeFormat(item.createTime, 'yyyy-mm-dd hh:MM');
})
this.dataList.push(...res.data.list)
this.hasMore = this.dataList.length < res.data.count
this.hasMore = this.dataList.length < res.data.count
}
}).finally(()=>{
}).finally(() => {
uni.stopPullDownRefresh()
})
},
@@ -63,8 +99,8 @@
this.hasMore = true
},
onReachBottom() {
if(this.hasMore){
this.page ++
if (this.hasMore) {
this.page++
this.queryList();
}
}
@@ -72,5 +108,21 @@
</script>
<style lang="scss">
.cell{
padding: 27rpx 30rpx;
&-top {
display: flex;
justify-content: space-between;
align-items: center;
}
border-bottom: solid #e8e8e8 1px;
}
.title{
font-size: 28rpx;
}
.time {
font-size: 24rpx;
color: #999;
}
</style>

View File

@@ -1,38 +1,41 @@
<template>
<view class="container" :style="appThemeStyle">
<view class="addres-list">
<view class="address-item" v-for="(item, index) in list" :key="index">
<view class="title">
<text>设备编号{{ item.equipmentCode }}</text>
<u-tag v-if="item.isCtive == '已激活'" :text="item.isCtive" plain size="mini" type="success"></u-tag>
<u-tag v-else :text="item.isCtive" plain size="mini" type="warning"></u-tag>
</view>
<view class="line"></view>
<view class="contacts">
<view class="bms-info">
<text class="item">电池型号{{ item.batteryModel }}</text>
<text class="item">BMS模块{{ item.bms }}</text>
<text class="item">工作状态{{ item.workingStatus }}</text>
<text class="item">电池状态健康</text>
</view>
<view class="bms-image">
<view class="bms-image-box">
<image class="image" src="/static/battery.png"></image>
<text class="bms-image-fbf">67%</text>
<view class="container" :style="appThemeStyle">
<view class="addres-list">
<view class="address-item" v-for="(item, index) in list" :key="index">
<view class="title">
<text>设备编号{{ item.equipmentCode }}</text>
<u-tag v-if="item.isCtive == '已激活'" :text="item.isCtive" plain size="mini" type="success"></u-tag>
<u-tag v-else :text="item.isCtive" plain size="mini" type="warning"></u-tag>
</view>
<u-tag text="离线" plain size="mini" type="info"></u-tag>
</view>
</view>
<view class="line"></view>
<view class="item-option">
<view class="_left">
<u-icon label="操作" size="40" name="map" @click="navTo('package/user/equipment/operation?equipmentId='+item.equipmentId)"></u-icon>
</view>
<view class="line-align"></view>
<view class="_right">
<view class="events">
<u-icon label="详情" size="40" name="file-text" @click="navTo('package/user/equipment/detail?equipmentId='+item.equipmentId)"></u-icon>
<!-- <view class="event-item" @click="handleUpdate(item.address_id)">
<view class="line"></view>
<view class="contacts">
<view class="bms-info">
<text class="item">电池型号{{ item.batteryModel }}</text>
<text class="item">BMS模块{{ item.bms }}</text>
<text class="item">工作状态{{ item.workingStatus }}</text>
<text class="item">设备电压{{ item.totalVoltage }}</text>
<text class="item">剩余电量{{ item.batteryPower }}</text>
</view>
<view class="bms-image">
<view class="bms-image-box">
<image class="image" src="/static/battery.png"></image>
<text class="bms-image-fbf">{{ item.batteryPower }}</text>
</view>
<u-tag text="离线" plain size="mini" type="info"></u-tag>
</view>
</view>
<view class="line"></view>
<view class="item-option">
<view class="_left">
<u-icon label="操作" size="40" name="map"
@click="navTo('package/user/equipment/operation?equipmentId='+item.equipmentId)"></u-icon>
</view>
<view class="line-align"></view>
<view class="_right">
<view class="events">
<u-icon label="详情" size="40" name="file-text"
@click="navTo('package/user/equipment/detail?equipmentId='+item.equipmentId)"></u-icon>
<!-- <view class="event-item" @click="handleUpdate(item.address_id)">
<text class="iconfont icon-edit"></text>
<text class="title">编辑</text>
</view>
@@ -40,316 +43,337 @@
<text class="iconfont icon-delete"></text>
<text class="title">删除</text>
</view> -->
</view>
</view>
</view>
</view>
</view>
<empty v-if="!list.length" tips="暂无设备" />
<!-- 底部操作按钮 -->
<!-- <view class="footer-fixed">
</view>
</view>
</view>
</view>
</view>
<empty v-if="!list.length" tips="暂无设备" />
<!-- 底部操作按钮 -->
<!-- <view class="footer-fixed">
<view class="btn-wrapper">
<view class="btn-item btn-item-main" @click="handleCreate()">添加新地址</view>
</view>
</view> -->
</view>
</view>
</template>
<script>
import * as EquipmentApi from '@/websoft/api/equipment.js'
import Empty from '@/components/empty'
import * as EquipmentApi from '@/websoft/api/equipment.js'
import Empty from '@/components/empty'
import storage from '../../../utils/storage';
export default {
components: {
Empty
},
data() {
return {
//当前页面参数
options: {},
// 正在加载
isLoading: true,
// 收货地址列表
list: [],
// 默认收货地址
defaultId: null
}
},
export default {
components: {
Empty
},
data() {
return {
//当前页面参数
options: {},
// 正在加载
isLoading: true,
// 收货地址列表
list: [],
// 默认收货地址
defaultId: null
}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 当前页面参数
this.options = options
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 当前页面参数
this.options = options
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取页面数据
this.getPageData()
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取页面数据
this.getPageData()
},
methods: {
methods: {
// 获取页面数据
getPageData() {
const app = this
app.isLoading = true
Promise.all([app.getDefaultId(), app.getEquipmentList()])
.then(() => {
// 列表排序把默认收货地址放到最前
app.onReorder()
})
.finally(() => app.isLoading = false)
},
// 获取页面数据
getPageData() {
const app = this
app.isLoading = true
Promise.all([app.getDefaultId(), app.getEquipment()])
.then(() => {
// 列表排序把默认收货地址放到最前
app.onReorder()
})
.finally(() => app.isLoading = false)
},
// 获取收货地址列表
getEquipment() {
const app = this
EquipmentApi.getEquipment(this.options.equipmentId).then(res => {
this.list = [res.data]
console.log(res);
})
},
getEquipmentList() {
const app = this
EquipmentApi.pageEquipment({
userId: storage.get("userId")
}).then(res => {
this.list = res.data.list
console.log(res);
})
},
// 获取默认的收货地址
getDefaultId() {
return new Promise((resolve, reject) => {
const app = this
// AddressApi.defaultId()
// .then(result => {
// app.defaultId = result.data.defaultId
// resolve(result)
// })
// .catch(reject)
})
},
// 获取收货地址列表
getEquipment() {
const app = this
EquipmentApi.pageEquipment({userId: uni.getStorageSync('userId')}).then(res => {
console.log("res: ",res);
app.list = res.data.list
})
},
// 列表排序把默认收货地址放到最前
onReorder() {
const app = this
app.list.sort(item => {
return item.address_id == app.defaultId ? -1 : 1
})
},
// 获取默认的收货地址
getDefaultId() {
return new Promise((resolve, reject) => {
const app = this
// AddressApi.defaultId()
// .then(result => {
// app.defaultId = result.data.defaultId
// resolve(result)
// })
// .catch(reject)
})
},
navTo(url) {
this.$navTo(url)
},
// 列表排序把默认收货地址放到最前
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')
},
/**
* 添加新地址
*/
handleCreate() {
this.$navTo('pages/address/create')
},
/**
* 编辑地址
* @param {int} addressId 收货地址ID
*/
handleUpdate(addressId) {
this.$navTo('pages/address/update', {
addressId
})
},
/**
* 编辑地址
* @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
*/
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 {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()
})
}
}
}
/**
* 设置为默认地址
* @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;
}
.addres-list {
padding-bottom: calc(constant(safe-area-inset-bottom) + 140rpx);
padding-bottom: calc(env(safe-area-inset-bottom) + 140rpx);
padding-top: 20rpx;
}
// 项目内容
.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{
// 项目内容
.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;
}
}
.contacts {
margin-bottom: 16rpx;
display: flex;
justify-content: space-between;
}
}
.contacts {
margin-bottom: 16rpx;
display: flex;
justify-content: space-between;
.bms-info{
display: flex;
flex-direction: column;
color: #666666;
.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{
.bms-info {
display: flex;
font-size: 22rpx;
margin-bottom: 18rpx;
color: #00af00;
.bms-image-fbf{
margin-top: 22rpx;
flex-direction: column;
color: #666666;
.item {
margin-right: 16rpx;
}
.name {
margin-right: 16rpx;
}
}
.image{
width: 50rpx; height: 60rpx;
.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;
.address {
font-size: 28rpx;
.region {
margin-right: 10rpx;
}
}
.region {
margin-right: 10rpx;
}
}
.line {
margin: 20rpx 0;
border-bottom: 1rpx solid #f3f3f3;
}
.line-align{
width: 6rpx;
height: 48rpx;
border-right: 1rpx solid #f3f3f3;
}
.line {
margin: 20rpx 0;
border-bottom: 1rpx solid #f3f3f3;
}
.item-option {
display: flex;
justify-content: space-around;
align-items: center;
height: 48rpx;
.line-align {
width: 6rpx;
height: 48rpx;
border-right: 1rpx solid #f3f3f3;
}
// 单选框
.item-radio {
font-size: 28rpx;
.item-option {
display: flex;
justify-content: space-around;
align-items: center;
height: 48rpx;
.radio {
vertical-align: middle;
transform: scale(0.76)
}
// 单选框
.item-radio {
font-size: 28rpx;
.text {
vertical-align: middle;
}
}
.radio {
vertical-align: middle;
transform: scale(0.76)
}
// 操作
.events {
display: flex;
align-items: center;
line-height: 48rpx;
.text {
vertical-align: middle;
}
}
.event-item {
font-size: 28rpx;
margin-right: 26rpx;
color: #4c4c4c;
// 操作
.events {
display: flex;
align-items: center;
line-height: 48rpx;
&:last-child {
margin-right: 0;
}
.event-item {
font-size: 28rpx;
margin-right: 26rpx;
color: #4c4c4c;
.title {
margin-left: 8rpx;
}
}
}
&:last-child {
margin-right: 0;
}
}
.title {
margin-left: 8rpx;
}
}
}
}
// 底部操作栏
.footer-fixed {
position: fixed;
bottom: var(--window-bottom);
left: 0;
right: 0;
z-index: 11;
// 底部操作栏
.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);
// 设置ios刘海屏底部横线安全区域
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.btn-wrapper {
height: 120rpx;
padding: 0 40rpx;
}
.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 {
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);
}
.btn-item-main {
background: linear-gradient(to right, $main-bg, $main-bg2);
}
}
</style>
}
</style>

View File

@@ -53,9 +53,9 @@
<u-button shape="circle" size="mini"
@click="navTo('package/dealer/withdraw/apply')">查看明细</u-button>
</view> -->
<view class="asset-left-item" style="display: flex;align-items: center;">
<!-- <view class="asset-left-item" style="display: flex;align-items: center;">
<u-button shape="circle" type="primary" size="mini" @click="onApply">去提现</u-button>
</view>
</view> -->
</view>
</view>
<view class="my-service">
@@ -125,11 +125,11 @@
<!-- 退出登录 -->
<!-- <view v-if="isLogin" class="my-logout">
<view v-if="isLogin" class="my-logout">
<view class="logout-btn" @click="handleLogout()">
<text>退出登录</text>
</view>
</view> -->
</view>
<u-toast ref="uToast" />
</view>
@@ -181,7 +181,7 @@
{id: 'get_order',name: '订单管理',icon: 'qpdingdan',type: 'link',url: 'pages/order/index'},
{id: 'equipment',name: '设备管理',icon: 'shouhuodizhi',type: 'link',url: 'pages/user/equipment/index'},
{id: 'saleman',name: '收益明细',icon: 'shouhuodizhi',type: 'link',url: 'pages/saleman/profir-log/profir-log'},
{id: 'withdraw_kog',name: '提现记录',icon: 'shouhuodizhi',type: 'link',url: 'package/dealer/withdraw/apply'},
// {id: 'withdraw_kog',name: '提现记录',icon: 'shouhuodizhi',type: 'link',url: 'package/dealer/withdraw/apply'},
{id: 'help',name: '使用帮助',icon: 'bangzhu',type: 'link',url: 'pages/help/index'},
{id: 'administration',name: '关于我们',icon: 'sy-yh',type: 'link',url: 'pages/help/about'},
]