40 lines
893 B
JavaScript
40 lines
893 B
JavaScript
const app = getApp();
|
|
import $ from "../../utils/request";
|
|
|
|
Page({
|
|
data: {
|
|
deviceInfo: null,
|
|
},
|
|
|
|
onLoad(options) {
|
|
this.getDevice();
|
|
},
|
|
|
|
// 获取已经绑定的设备列表
|
|
getDevice() {
|
|
let params = {};
|
|
$.ajax("weighingScale/list/device", params, "GET", false).then((res) => {
|
|
this.setData({
|
|
deviceInfo: res.result[0]
|
|
})
|
|
})
|
|
},
|
|
|
|
delDevice() {
|
|
let scaleDeviceId = this.data.deviceInfo.macAddress.replace(/:/g, '');
|
|
let params = {
|
|
equipmentCode: scaleDeviceId,
|
|
};
|
|
$.ajax("weighingScale/del/device", params, "POST", true, "正在解绑设备...").then(res_ => {
|
|
wx.showToast({
|
|
icon: "none",
|
|
title: res_.message,
|
|
})
|
|
setTimeout(() => {
|
|
wx.navigateBack({
|
|
delta: 1
|
|
})
|
|
}, 1500);
|
|
});
|
|
}
|
|
}) |