123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- // pages/tabber/news/index.js
- const app=getApp();
- var id='',deviceId='',spoutDeviceId="",logistic_code="";
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- selectInfo: {},
- content:{},
- sealNo:'',
- height:'1200',
- info:"",
- check:true,
- img:{
- 大衣外套:'/image/icon/dayiwaitao.png',
- 家纺:'/image/icon/jiafang',
- 库类:'/image/icon/kulei.png',
- 配件:'/image/icon/peijian.png',
- 皮衣:'/image/icon/piyi.png',
- 裙类:'/image/icon/qunlei.png',
- 上衣:'/image/icon/shangyi.png',
- 箱包:'/image/icon/xiangbao.png',
- 鞋类:'/image/icon/xixie.png',
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
-
- id=options&&options.id?options.id:1
- deviceId=options&&options.pointId?options.pointId:1
- logistic_code=options&&options.logistic_code?options.logistic_code:0
- if(logistic_code!=0){
- this.setData({
- check:false,
- })
- this.getOrder()
- }else{
- this.setData({
- check:true,
- })
- this.getData()
- }
-
- },
- somao(){
- let that = this
- wx.scanCode({
- onlyFromCamera: true,
- success (res) {
- that.setData({sealNo: res.result.substr(0)})
- }
-
- })
- },
- getData:function(){
- var that=this
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/CheckOrder", {
- order_id:id
- }, "get").then(function (res) {
- console.log(res);
- wx.hideLoading();
- if (res.code != 200) {
- wx.showLoading({
- title: '数据获取失败',
- })
- setTimeout(function () {
- wx.hideLoading();
- }, 1000);
-
- } else {
-
-
- that.setData({
- content:res.message.data,
-
- })
-
- }
- }).catch(function (err) {
-
- console.log(err);
- })
-
- },
- getOrder:function(){
- var that=this
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/TakeOrder", {
- order_id:id,
- logistic_code:logistic_code
- }, "get").then(function (res) {
- console.log(res);
- wx.hideLoading();
- if (res.code != 200) {
- wx.showLoading({
- title: '数据获取失败',
- })
- setTimeout(function () {
- wx.hideLoading();
- }, 1000);
-
- } else {
-
-
- that.setData({
- content:res.message.data,
-
- })
-
- }
- }).catch(function (err) {
-
- console.log(err);
- })
-
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
- summit(e){
- var type=e.currentTarget.dataset.type
- var that=this
- if(type==1){
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/UserTakeOrder", {
- logistic_code:logistic_code,
- order_id:id,
-
- }, "post").then(function (res) {
- wx.hideLoading();
- if (res.code== 200) {
- wx.showModal({
- title: '成功',
- content: res.message.msg,
- showCancel:false,
- success (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- wx.navigateBack()
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- } else
- wx.showToast({title: res.message.msg,icon:'none'})
-
- }).catch(function (err) {
- console.log(222);
- })
- }else{
- wx.navigateBack({
- delta: 1,
- })
- }
- },
- onClick:function(e){
- var type=e.currentTarget.dataset.type
- var that=this
- if(type==1){
- if(that.data.sealNo=='')
- return wx.showToast({title: '封签号不能为空',icon:'none'})
- return that.onSubmit()
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/StoreCodeUserInfo", {
- order_no: that.data.orderSn
- }, "get").then(function (res) {
- wx.hideLoading();
- if (res.code== 200) {
- that.setData({
- smallPhone:res.message.data.phone
- })
- } else
- wx.showToast({title: res.message.msg,icon:'none'})
-
- }).catch(function (err) {
- console.log(222);
- })
-
- }else
- this.setData({
- show:!this.data.show
- })
-
- },
- scan:function(){
- var that=this
- wx.scanCode({
- onlyFromCamera: true,
- success (res) {
- that.setData({
- sealNo:res.result
- })
- }
-
- })
- },
- onSubmit:function(e){
- var that=this
- if(that.data.sealNo=='')
- return wx.showToast({title: '封签号不能为空',icon:'none'})
- if(deviceId=='')
- return wx.showToast({title: '设备号不能为空',icon:'none'})
- // if(spoutDeviceId=='')
- // return wx.showToast({title: '柜门号不能为空',icon:'none'})
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/CollectBindSeals", {
- seal_no: that.data.sealNo,
- device_id:deviceId,
- order_id:id,
-
- }, "post").then(function (res) {
- wx.hideLoading();
- if (res.code== 200) {
- wx.showModal({
- title: '成功',
- content: res.message.msg,
- showCancel:false,
- success (res) {
- if (res.confirm) {
- console.log('用户点击确定')
- wx.navigateBack()
- } else if (res.cancel) {
- console.log('用户点击取消')
-
- }
- }
- })
- } else
- wx.showToast({title: res.message.msg,icon:'none'})
-
- }).catch(function (err) {
- console.log(222);
- })
-
- },
- })
|