123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- // pages/order/access/access.js
- const app=getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- orders:"",
- network_id:0,
-
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- console.log(options);
- var network_id=options.network_id;
- this.setData({
- network_id:network_id,
- })
-
- },
- scan(){
- wx.scanCode({
- onlyFromCamera: true,
- success: (result) => {
- var url=result.result;
- var network_id=app.getQueryVariable(url,"network_id");
- var order_num=app.getQueryVariable(url,"orde_num");
- wx.navigateTo({
- url: '/pages/order/deposit/deposit?network_id='+network_id+"&order_num="+order_num+"&is_deposit=1"
- })
- console.log(result)
- },
- fail: (res) => {},
- complete: (res) => {},
- })
- },
- /**
- * 取件
- */
- receive(){
- wx.scanCode({
- onlyFromCamera: true,
- success: (result) => {
- var url=result.result;
- var network_id=app.getQueryVariable(url,"network_id");
- var order_num=app.getQueryVariable(url,"orde_num");
- wx.navigateTo({
- url: '/pages/order/deposit/deposit?network_id='+network_id+"&order_num="+order_num+"&is_deposit=0",
- })
- console.log(result)
- },
- fail: (res) => {},
- complete: (res) => {},
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- this.getDeviceinfo(this.data.network_id);
- },
- /**
- * @name 获取当前网点存取单
- * @param int network_id 网点id
- */
- getDeviceinfo:function(network_id){
- var that=this;
- app.api.useApi(app.globalData.baseAppUrl+"api/order/getDeviceinfo",{
- network_id:network_id
- }).then((res)=>{
- if(res.code!=200){
- wx.showToast({
- title: res.message.msg,
- icon:"none",
- success:function(){
- setTimeout(() => {
- wx.hideLoading({
- success: (res) => {},
- })
- }, 2000);
- }
- })
- }else{
- that.setData({
- orders:res.message.data
- })
- }
- }).catch((err)=>{
- that.getDeviceinfo(network_id)
- })
- }
- })
|