123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240 |
- // pages/tabber/builds/index.js
- const app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- number: "",
- data: "",
- show: false,
- results: 0,
- radio: 1,
- isshow: false,
- inpuval: "",
- placeholder: "",
- hand_up_count: 0,
- need_hand_up_count: 0,
- order_no:"",
- popuptype: 0,
- },
- onLoad(option) {
- this.setData({
- pylon_no:option.pylon_no
- })
-
- },
- onShow(){
- this.getdata();
- },
- getScancode: function () {
- var _this = this;
- // 允许从相机和相册扫码
- wx.scanCode({
- onlyFromCamera: true,
- scanType: ['barCode', 'qrCode', 'datamatrix', 'pdf417'],
- success: (res) => {
- console.log(res);
- var result = res.result;
- _this.setData({
- inpuval: result,
- })
- },
- fail: (err) => {
- console.log(err);
- }
- })
- },
- getdata() {
- var that = this;
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/hand/hand_desc", {
- pylon_no: this.data.pylon_no
- }, "get").then(function (res) {
- console.log(res);
- if (res.code != 200) {
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(function () {
- wx.hideLoading();
- }, 1000);
- } else {
- wx.hideLoading();
- let data = res.message.data
- data.new_length = that.length(data.new_hand_ups);
- that.setData({
- data,
- pylon_no:res.message.pylon_no,
- hand_up_count: res.message.hand_up_count,
- need_hand_up_count: res.message.need_hand_up_count,
- order_no:res.message.order_no
- })
- }
- }).catch(function (err) {
- console.log(222);
- })
- },
- onClick(e) {
- var butt = e.currentTarget.dataset.butt;
- if (butt == '扫描') {
- this.scan();
- } else {
- this.sub();
- }
-
- },
- length(obj) {
- var count = 0;
- for (var i in obj) {
- count++;
- }
- return count;
- },
- show(e) {
- let that = this
- var tid = e.currentTarget.dataset.id
- var type = e.currentTarget.dataset.type
- this.setData({popuptype: type})
- console.log(tid)
- if (tid==1) {
- this.setData({
- show: !this.data.show,
- placeholder: '扫描或人工输入水洗码扫描',
- butt: '扫描'
- })
- } else {
- if(that.data.results==1){
- that.setData({
- isshow: !this.data.isshow,
- show: !this.data.show,
- placeholder: '扫描或输入封签号打包',
- butt: '绑定'
- })
- }else{
- wx.showToast({
- title: '请先勾选使用封签打包',
- icon: 'none',
- duration: 1000
- })
- }
- }
- if(this.data.show){
- this.setData({inpuval:''})
- }
- },
- isshow() {
- this.setData({
- isshow: !this.data.isshow,
- })
- },
- bindinput(e) {
- this.setData({
- inpuval: e.detail.value,
- })
- },
- onClose() {
- this.setData({
- show: !this.data.show,
- popuptype: 0
- })
- },
- Close() {
- this.setData({
- isshow: !this.data.isshow,
- })
- },
- onClose_del() {
- this.setData({
- show: !this.data.show,
- inpuval: "",
- })
- },
- sub() {
- this.onClose()
- var that = this;
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/pack/pack", {
- keyword: this.data.inpuval,
- type: this.data.results,
- order_no:this.data.order_no
- }, "post").then(function (res) {
- console.log(res);
- if (res.code != 200) {
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(function () {
- wx.hideLoading();
- }, 1000);
- } else {
- wx.hideLoading();
- let data = res.message.data
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(()=>{
- wx.hideLoading();
- wx.navigateTo({
- url: '/pages/record/recorddetailsinfo/recorddetailsinfo?si=1&id='+data.id.id,
- })
- },1000)
-
-
- }
- }).catch(function (err) {
- console.log(222);
- })
- },
- onChange(event) {
- console.log(event.detail)
- this.setData({
- results: event.detail,
- });
- },
- scan() {
- var that = this;
- app.api.useApi(app.globalData.baseAppUrl + "api/admin/sorting/pack/HandCode", {
- wash_code: this.data.inpuval
- }, "post").then(function (res) {
- console.log(res);
- if (res.code != 200) {
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(function () {
- wx.hideLoading();
- }, 1000);
- } else {
- wx.hideLoading();
- let data = res.message.data
- wx.showLoading({
- title: res.message.msg,
- })
- setTimeout(function () {
- wx.hideLoading();
- that.onClose()
- that.getdata()
- }, 1000);
- }
- }).catch(function (err) {
- console.log(222);
- })
- },
- })
|