249 lines
5.9 KiB
JavaScript
249 lines
5.9 KiB
JavaScript
// logs.js
|
||
const app = getApp()
|
||
import {
|
||
Eentstatus,
|
||
GetdingdanbyID,
|
||
CHBYT,
|
||
} from '../../lib/RequestingCenter.js'
|
||
let SCREEN_WIDTH = 750
|
||
let RATE = wx.getSystemInfoSync().screenHeight / wx.getSystemInfoSync().screenWidth
|
||
let ShippingCodes = ""
|
||
var sqlids = 0;
|
||
|
||
Page({
|
||
data: {
|
||
ScreenTotalW: SCREEN_WIDTH,
|
||
ScreenTotalH: SCREEN_WIDTH * RATE,
|
||
listers: [],
|
||
chemaList: [],
|
||
isCopyingTextDomID: "",
|
||
isok: true,
|
||
wxma: "",
|
||
dingdanbianh: "",
|
||
ColorBox_BarCodeList: [],
|
||
selectedoutboxlist: [],
|
||
ProjectList: [],
|
||
scrollTop: 0
|
||
},
|
||
onLoad: function (option) {
|
||
wx.hideLoading();
|
||
wx.showLoading({
|
||
title: '请稍后....',
|
||
});
|
||
sqlids = option.sqlid
|
||
|
||
var that = this;
|
||
var data = option.ShippingCode
|
||
let list = []
|
||
if (sqlids == 1) {
|
||
that.setData({
|
||
DBname: "uts_zongqing"
|
||
})
|
||
} else {
|
||
that.setData({
|
||
DBname: "uts_johao"
|
||
})
|
||
}
|
||
ShippingCodes = option.ShippingCode
|
||
GetdingdanbyID({
|
||
ShippingCode: data,
|
||
sqlid: sqlids
|
||
}).then(res => {
|
||
console.log(res.IsAdmin)
|
||
if (res.IsAdmin == 2 || res.IsAdmin == 1) {
|
||
that.setData({
|
||
isok: false
|
||
})
|
||
}
|
||
if (res.Status == 200) {
|
||
console.log(res)
|
||
res.Data.userinfo.forEach((x) => {
|
||
list.push(x.ShippingCode);
|
||
x.projectNameInfo = res.Data.ProjectList.filter(y => y.ID == x.ProjectID)[0].ProjectName;
|
||
})
|
||
res.Data.SC.forEach((it) => {
|
||
//list.push(x.ShippingCode);
|
||
it.projectNameInfo = res.Data.ProjectList.filter(z => z.ID == it.Value[0].ProjectID)[0].ProjectName;
|
||
})
|
||
|
||
that.setData({
|
||
listers: res.Data.userinfo,
|
||
OutBoxCodeList: res.Data.SC,
|
||
dingdanbianh: res.Data.userinfo[0].ShippingCode,
|
||
ProjectList: res.Data.ProjectList
|
||
});
|
||
|
||
} else if (res.Status == 100) {
|
||
app.toast(2, "你的帐号已经被管理员禁用了,请联系管理员")
|
||
} else {
|
||
app.toast(2, res.Message || "网络繁忙")
|
||
}
|
||
wx.hideLoading();
|
||
}, err => {
|
||
app.toast(2, "网络繁忙")
|
||
}).catch(
|
||
err => {
|
||
console.log(err)
|
||
app.toast("异常", 'error')
|
||
}
|
||
);
|
||
},
|
||
|
||
// 外箱码信息查询
|
||
ColorBox_BarCode: function (e) {
|
||
var that = this;
|
||
// wx.navigateTo({
|
||
// url: '/pages/ColorBoxBarCode/ColorBoxBarCode?ShippingCode=' + e.currentTarget.id
|
||
// })
|
||
var xx = this.data.OutBoxCodeList.find(ee => {
|
||
return ee.Key == e.currentTarget.id
|
||
})
|
||
if (that.data.show == e.currentTarget.id) {
|
||
that.setData({
|
||
show: 0,
|
||
ColorBox_BarCodeList: xx.Value
|
||
})
|
||
console.log(that.data.show)
|
||
} else {
|
||
that.setData({
|
||
show: e.currentTarget.id,
|
||
ColorBox_BarCodeList: xx.Value
|
||
})
|
||
console.log(that.data.ColorBox_BarCodeList)
|
||
console.log(121)
|
||
}
|
||
},
|
||
//根据彩盒码查询里面的产品经过了多少站
|
||
ColorBox_BarCodeSelct: function (params) {
|
||
var that = this;
|
||
CHBYT({
|
||
CHID: params.currentTarget.id
|
||
}).then(res => {
|
||
if (res.Status == 200) {
|
||
that.setData({
|
||
chemaList: res.Data.userinfo
|
||
});
|
||
} else {
|
||
app.toast(2, res.Message || "网络繁忙")
|
||
}
|
||
}, err => {
|
||
app.toast(2, "网络繁忙")
|
||
}).catch(
|
||
err => {
|
||
console.log(err)
|
||
app.toast("异常", 'error')
|
||
}
|
||
);
|
||
if (that.data.shows == params.currentTarget.id) {
|
||
that.setData({
|
||
shows: 0,
|
||
})
|
||
console.log(that.data.shows)
|
||
} else {
|
||
that.setData({
|
||
shows: params.currentTarget.id
|
||
})
|
||
console.log(121)
|
||
}
|
||
},
|
||
onHide: function () {
|
||
|
||
},
|
||
//滚动条至最底部
|
||
autoScroll: function () {
|
||
var that = this
|
||
let query = wx.createSelectorQuery()
|
||
query.select('.display').boundingClientRect(res => {
|
||
console.log('res', res)
|
||
that.setData({
|
||
scrollTop: res.height * 100
|
||
})
|
||
})
|
||
query.exec(res => {})
|
||
},
|
||
|
||
//长按复制
|
||
copyText: function (e) {
|
||
console.log(e)
|
||
var that = this
|
||
|
||
var strID = e.currentTarget.id;
|
||
var arrSplit = strID.split("_");
|
||
const text = arrSplit[1];
|
||
//开始蓝底白字
|
||
that.setData({
|
||
isCopyingTextDomID: strID
|
||
});
|
||
|
||
wx.setClipboardData({
|
||
data: text,
|
||
success: function () {
|
||
wx.showToast({
|
||
title: '复制成功',
|
||
});
|
||
|
||
//已经copy成功,但是依然显示蓝底白字状态1秒钟,然后提示用户拷贝成功,取消蓝底白字状态。
|
||
setTimeout(function () {
|
||
that.setData({
|
||
isCopyingTextDomID: ''
|
||
});
|
||
}, 3000);
|
||
},
|
||
fail: function () {
|
||
wx.showToast({
|
||
title: '复制失败',
|
||
icon: 'none',
|
||
});
|
||
},
|
||
});
|
||
},
|
||
//有权限的人修改状态
|
||
Someonewithpermissiontomodifythestatus: function () {
|
||
var that = this
|
||
var Codes = ShippingCodes
|
||
wx.showModal({
|
||
title: '提示',
|
||
content: '您确定修改' + Codes + '状态',
|
||
success(res) {
|
||
if (res.confirm) {
|
||
console.log('用户点击确认')
|
||
Eentstatus({
|
||
ShippingCodes: Codes,
|
||
sqlid :sqlids
|
||
}).then(res => {
|
||
app.toast(2, "修改状态成功")
|
||
console.log(res)
|
||
if (res.Status == 200) {
|
||
wx.switchTab({
|
||
url: '/pages/index/index'
|
||
})
|
||
that.setData({
|
||
isok: true
|
||
})
|
||
} else {
|
||
app.toast(2, res.Message || "网络繁忙")
|
||
}
|
||
}, err => {
|
||
app.toast(2, "网络繁忙")
|
||
}).catch(
|
||
err => {
|
||
console.log(err)
|
||
app.toast("异常", 'error')
|
||
}
|
||
);
|
||
} else if (res.cancel) {
|
||
console.log('用户点击取消')
|
||
}
|
||
}
|
||
})
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
}
|
||
}) |