1
This commit is contained in:
@@ -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)
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user