From fb054fa2b699e8d36842fa7b7ce86b8eefc2d76a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=8F=B6?= Date: Mon, 28 Feb 2022 14:04:55 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=98=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.json | 4 +- commons/css/base/imgSize.wxss | 1 + commons/js/config.js | 6 ++ commons/js/utils/apiQuery.js | 35 +++++++ pages/index/index.js | 107 ++++++++++++------- pages/index/index.wxml | 14 +-- pages/inventory/detail/index.js | 169 ++++++++++++++++++++++++++++++ pages/inventory/detail/index.json | 6 ++ pages/inventory/detail/index.wxml | 54 ++++++++++ pages/inventory/detail/index.wxss | 1 + pages/inventory/list/index.js | 161 ++++++++++++++++++++++++++++ pages/inventory/list/index.json | 6 ++ pages/inventory/list/index.wxml | 59 +++++++++++ pages/inventory/list/index.wxss | 3 + 14 files changed, 579 insertions(+), 47 deletions(-) create mode 100644 pages/inventory/detail/index.js create mode 100644 pages/inventory/detail/index.json create mode 100644 pages/inventory/detail/index.wxml create mode 100644 pages/inventory/detail/index.wxss create mode 100644 pages/inventory/list/index.js create mode 100644 pages/inventory/list/index.json create mode 100644 pages/inventory/list/index.wxml create mode 100644 pages/inventory/list/index.wxss diff --git a/app.json b/app.json index 942d29b..23961f3 100644 --- a/app.json +++ b/app.json @@ -37,7 +37,9 @@ "pages/storeInfo/index", "pages/siyutong/index", "pages/siyutong/activityDetail/index", - "pages/siyutong/activityRanking/index" + "pages/siyutong/activityRanking/index", + "pages/inventory/detail/index", + "pages/inventory/list/index" ], "echarts": [ { diff --git a/commons/css/base/imgSize.wxss b/commons/css/base/imgSize.wxss index d1556c6..60498b7 100644 --- a/commons/css/base/imgSize.wxss +++ b/commons/css/base/imgSize.wxss @@ -16,6 +16,7 @@ .img-135x135{width:135rpx;height:135rpx;box-sizing:border-box;} .img-140x140{width:140rpx;height:140rpx;box-sizing:border-box;} .img-160x160{width:160rpx;height:160rpx;box-sizing:border-box;} +.img-190x175{width:190rpx;height:175rpx;box-sizing:border-box;} .img-200x180{width:200rpx;height:180rpx;box-sizing:border-box;} .img-208x170{width:208rpx;height:170rpx;box-sizing:border-box;} .img-220x200{width:220rpx;height:200rpx;box-sizing:border-box;} diff --git a/commons/js/config.js b/commons/js/config.js index 9be6f18..819d371 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -119,6 +119,12 @@ api = { appSytactivityDetail:'app/sytactivity/detail', //活动详情 appSytactivityLog:'app/sytactivity/log', //实时战报 appSytactivityRanking:'app/sytactivity/ranking', //活动排名 + + appInventoryTabs:'app/inventory/tabs', //盘点记录_tab + appInventoryLists:'app/inventory/lists', //盘点记录 + appInventory:'app/inventory', //盘点详情 /盘点上传图片 + appInventoryRemind:'app/inventory/remind', //盘点提醒 + } diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js index ee1438a..1a2ed32 100644 --- a/commons/js/utils/apiQuery.js +++ b/commons/js/utils/apiQuery.js @@ -762,4 +762,39 @@ apiQuery.getAppSytactivityRanking = function (params) { }) } +//盘点记录_tab +apiQuery.getAppInventoryTabs = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appInventoryTabs, 2, params, "GET", resolve, reject) + }) +} + +//盘点列表 +apiQuery.getAppInventoryLists = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appInventoryLists, 2, params, "GET", resolve, reject) + }) +} + +//盘点详情 +apiQuery.getAppInventory = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appInventory, 2, params, "GET", resolve, reject) + }) +} + +//确认盘点 +apiQuery.postAppInventory = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(true, Config.api.appInventory, 2, params, "POST", resolve, reject) + }) +} + +//盘点提醒 +apiQuery.getAppInventoryRemind = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(false, Config.api.appInventoryRemind, 2, params, "GET", resolve, reject) + }) +} + export default apiQuery; \ No newline at end of file diff --git a/pages/index/index.js b/pages/index/index.js index 0e981b5..817b137 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -43,42 +43,8 @@ Page({ isShowProfile:true,//是否显示授权用户信息按钮 banneractive: 0, banneractive2: 0, - remind:[ - { - title:'调拨提醒', - content:'您有新的车辆调拨,需要您进行确认操作。', - img:'https://qs.haodian.cn/wechat_app/lichebao/allot/car.gif?v=220224', - btn:{ - title:'前往操作', - url:'/pages/allot/list/index', - }, - }, - { - title:'盘点提醒', - content:'您有新的车辆盘点,需要您进行确认操作。', - img:'https://qs.haodian.cn/wechat_app/lichebao/inventory/animation.gif', - btn:{ - title:'前往操作', - url:'/pages/inventory/list/index', - }, - }, - ], - remind2:[ - { - title:'车辆调拨', - content:'您有新的车辆调拨,需要您进行确认操作。', - img:'https://qs.haodian.cn/wechat_app/lichebao/allot/car.gif?v=220224', - url:'/pages/allot/list/index', - allotNum:'1', - }, - { - title:'车辆盘点', - content:'您有新的车辆调拨,需要您进行确认操作。', - img:'https://qs.haodian.cn/wechat_app/lichebao/inventory/icon.png', - url:'/pages/inventory/list/index', - allotNum:'2', - }, - ], + remindTab:[], + remindMsg:[], }, onLoad(options) { @@ -107,9 +73,14 @@ Page({ }, onShow: function () { + this.setData({ + remindTab:[], + remindMsg:[], + }); this.getAppUserCal() this.getHoursTip() this.getAppTransferRemind() + this.getAppInventoryRemind() }, //生命周期函数--监听页面卸载 @@ -148,11 +119,64 @@ Page({ //调拨提醒 getAppTransferRemind(){ _.apiQuery.getAppTransferRemind().then(res => { - this.setData({ - allotNum: res.data.total, - }) if(res.data.total>0){ + let remindTab = this.data.remindTab + remindTab.push({ + title:'车辆调拨', + content:'您有新的车辆调拨,需要您进行确认操作。', + img:'https://qs.haodian.cn/wechat_app/lichebao/allot/car.gif?v=220224', + url:'/pages/allot/list/index', + allotNum:res.data.total, + }) + let remindMsg = this.data.remindMsg + remindMsg.push({ + title:'调拨提醒', + content:'您有新的车辆调拨,需要您进行确认操作。', + img:'https://qs.haodian.cn/wechat_app/lichebao/allot/car.gif?v=220224', + btn:{ + title:'前往操作', + url:'/pages/allot/list/index', + }, + }) this.setData({ + remindTab, + remindMsg, + isShowReport:true, + isShowNotice:false, + }) + }else{ + this.setData({ + isShowReport:false, + }) + } + }); + }, + + //盘点提醒 + getAppInventoryRemind(){ + _.apiQuery.getAppInventoryRemind().then(res => { + if(res.data.total>0){ + let remindTab = this.data.remindTab + remindTab.push({ + title:'车辆盘点', + content:'您有新的车辆调拨,需要您进行确认操作。', + img:'https://qs.haodian.cn/wechat_app/lichebao/inventory/icon.png', + url:'/pages/inventory/list/index', + allotNum:res.data.total, + }) + let remindMsg = this.data.remindMsg + remindMsg.push({ + title:'盘点提醒', + content:'您有新的车辆盘点,需要您进行确认操作。', + img:'https://qs.haodian.cn/wechat_app/lichebao/inventory/animation.gif', + btn:{ + title:'前往操作', + url:'/pages/inventory/list/index', + }, + }) + this.setData({ + remindTab, + remindMsg, isShowReport:true, isShowNotice:false, }) @@ -346,10 +370,15 @@ Page({ //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh: function () { + this.setData({ + remindTab:[], + remindMsg:[], + }); this.getAppUserCal() this.getAppStatisticsHcust() this.getAppStatisticsHorder() this.getAppTransferRemind() + this.getAppInventoryRemind() }, }) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 2cc58aa..a2f9f5f 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -35,10 +35,10 @@ - + - + {{item.title}} @@ -50,8 +50,8 @@ - - + + @@ -177,7 +177,7 @@ - + {{item.title}} {{item.content}} @@ -191,8 +191,8 @@ - - + + diff --git a/pages/inventory/detail/index.js b/pages/inventory/detail/index.js new file mode 100644 index 0000000..9115201 --- /dev/null +++ b/pages/inventory/detail/index.js @@ -0,0 +1,169 @@ +import _ from '../../../commons/js/commons' +const app = getApp() +Page({ + data: { + imgUrl:_.config.imgUrl, + isShowTransfer:false,//是否显示确认弹窗 + car_img:[],//请上传运输单 + id:'',//查看id + mileage:'',//里程数 + }, + onLoad: function (options) { + for (let key in options) { + this.setData({ + [key]: options[key] + }) + } + + this.getAppInventory() + + }, + onShow: function () { + + }, + + //获取订单详情 + getAppInventory(){ + let params = {}; + if(this.data.id != ''){ + params['id'] = this.data.id; + } + _.apiQuery.getAppInventory(params).then(res=>{ + this.setData({ + info:res.data, + car_img:res.data.car_img, + mileage:res.data.mileage?res.data.mileage:'', + }) + + wx.stopPullDownRefresh() + + }) + }, + + //选择图片 + chooseImg(e) { + let that = this + wx.chooseImage({ + count: 1, + sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有 + sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有 + success(res1) { + wx.showLoading({ + title: '图片上传中', + }) + wx.uploadFile({ + url: _.config.api.upImg, + filePath: res1.tempFilePaths[0], + name: 'img', + formData: { + 'app': 'liche' + }, + success(res) { + setTimeout(function () { + wx.hideLoading() + }, 500); + let imgdata = JSON.parse(res.data) + that.setData({ + ['car_img['+e.currentTarget.dataset.index+'].src']:imgdata.data.full_url, + ['car_img['+e.currentTarget.dataset.index+'].value']:imgdata.data.url, + }) + }, + fail(res) { + wx.hideLoading() + wx.showToast({ + title: res.data.msg, + icon: 'none', + duration: 2000 + }) + } + }) + }, + fail: res => { + wx.showToast({ + title: '文件选择失败', + icon: 'none', + duration: 2000 + }) + } + }) + }, + + //显示报备异常弹框 + optShowReport(e){ + this.setData({ + isShowReport:!this.data.isShowReport, + photos:[], + note:'', + optid:e.currentTarget.dataset.id?e.currentTarget.dataset.id:'', + }) + }, + + + //推送链接 + pushLink(e){ + if(e.currentTarget.dataset.url){ + _.$router.openUrlScheme(e.currentTarget.dataset.url) + } + }, + + //确认盘点信息 + postAppInventory() { + let that = this + if (that.data.mileage == ''){ + wx.showToast({ + title: '请填定里程数', + icon: 'none' + }) + }else{ + that.setData({ + submitFlag: true, + }) + + let params = {}; + params['id'] = that.data.id; + params['car_img'] = that.data.car_img; + params['mileage'] = that.data.mileage; + _.apiQuery.postAppInventory(params).then(res => { + + let pages = getCurrentPages(); + let prevPage = null; //上一个页面 + if (pages.length >= 2) { + prevPage = pages[pages.length - 2]; //上一个页面 + if(prevPage.route == 'pages/inventory/list/index'){ + prevPage.onPullDownRefresh() + } + } + + that.onPullDownRefresh() + + that.setData({ + submitFlag: false, + }) + wx.showModal({ + title: '操作成功', + content: '', + confirmText: "返回", + confirmColor: "#36afa2", + showCancel:false, + success(res) { + if (res.confirm) { + wx.navigateBack({ + delta: 1 + }) + } + } + }) + }).catch(res=>{ + that.setData({ + submitFlag: false, + }) + }); + } + }, + + //页面相关事件处理函数--监听用户下拉动作 + onPullDownRefresh(){ + this.getAppInventory() + }, + +}) \ No newline at end of file diff --git a/pages/inventory/detail/index.json b/pages/inventory/detail/index.json new file mode 100644 index 0000000..e843c7c --- /dev/null +++ b/pages/inventory/detail/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "盘点详情", + "usingComponents": { + + } +} \ No newline at end of file diff --git a/pages/inventory/detail/index.wxml b/pages/inventory/detail/index.wxml new file mode 100644 index 0000000..3f0359a --- /dev/null +++ b/pages/inventory/detail/index.wxml @@ -0,0 +1,54 @@ + + + + + {{info.biz_name}} + + + {{item.title}} + + + {{it}} + + + {{item.value}} + + + + + 盘点信息 + + + + + + + + + + {{item.title}} + + + + + + + 上传{{item.title}} + + + {{item.title}} + + + + + + km + + + + + + + 请盘点以上对应信息。 + + \ No newline at end of file diff --git a/pages/inventory/detail/index.wxss b/pages/inventory/detail/index.wxss new file mode 100644 index 0000000..b4dc2ef --- /dev/null +++ b/pages/inventory/detail/index.wxss @@ -0,0 +1 @@ +/* pages/allot/detail/index.wxss */ \ No newline at end of file diff --git a/pages/inventory/list/index.js b/pages/inventory/list/index.js new file mode 100644 index 0000000..2e53e79 --- /dev/null +++ b/pages/inventory/list/index.js @@ -0,0 +1,161 @@ +import _ from '../../../commons/js/commons' +const app = getApp() +Page({ + data: { + list: [],//客户列表 + pageNo: 1, + noData: false, + end: false, + load: true, + loading: false, + flag:1, + s_date:'', + e_date:'', + + tabs_id:'',//分类 1进行中2已完成 + tab:[], + channel:'',//是否来自渠道 + }, + onLoad: function (options) { + for (let key in options) { + this.setData({ + [key]: options[key] + }) + } + + if(this.data.title){ + wx.setNavigationBarTitle({ + title:this.data.title, + }) + } + + this.getAppInventoryTabs() + }, + + //tab + getAppInventoryTabs() { + _.apiQuery.getAppInventoryTabs().then(res => { + this.setData({ + tab:res.data, + tabs_id:this.data.tabs_id==''?res.data[0].id:this.data.tabs_id, + }) + + this.getAppInventoryLists() + + wx.stopPullDownRefresh() + }); + }, + + //切换tab + changeTab(e){ + this.setData({ + tabs_id: this.data.tab[e.currentTarget.dataset.index].id, + }) + this.searchSubmit() + }, + + //获取客户列表 + getAppInventoryLists() { + this.setData({ + load: false, + loading: true, + }) + let params = {}; + params['page'] = this.data.pageNo; + params['size'] = 10; + if(this.data.channel != ''){ + params['channel'] = this.data.channel; + } + if(this.data.tabs_id != ''){ + params['tabs_id'] = this.data.tabs_id; + } + if(this.data.s_date != ''){ + params['s_date'] = this.data.s_date; + } + if(this.data.e_date != ''){ + params['e_date'] = this.data.e_date; + } + _.apiQuery.getAppInventoryLists(params).then(res => { + this.setData({ + flag: this.data.flag - 1 + }) + if (!this.data.flag) { + this.setData({ + pageNo: this.data.pageNo + 1, + list: this.data.list.concat(res.data.list), + load: true, + loading: false, + }) + if (res.data.total == 0) { + this.setData({ + noData: true + }) + } else if (this.data.list.length == res.data.total) { + this.setData({ + end: true + }) + } + } + wx.stopPullDownRefresh() + }); + }, + + //提交搜索 + searchSubmit(){ + this.setData({ + list: [], + pageNo: 1, + noData: false, + end: false, + load: true, + loading: false, + flag: this.data.flag + 1 + }) + this.getAppInventoryLists() + }, + + //建卡时间 + startDate(e){ + this.setData({ + s_date: e.detail.value, + }) + }, + + //建卡时间 + endDate(e){ + this.setData({ + e_date: e.detail.value, + }) + }, + + //推送链接 + pushLink(e){ + if(e.currentTarget.dataset.url){ + _.$router.openUrlScheme(e.currentTarget.dataset.url) + } + }, + + //页面相关事件处理函数--监听用户下拉动作 + onPullDownRefresh(){ + this.setData({ + list: [], + pageNo: 1, + noData: false, + end: false, + load: true, + loading: false, + flag: this.data.flag + 1 + }) + this.getAppInventoryLists() + }, + + //页面上拉触底事件的处理函数 + onReachBottom(){ + if (this.data.noData || this.data.end||!this.data.load) return; + this.setData({ + flag: this.data.flag + 1 + }) + this.getAppInventoryLists() + }, + +}) \ No newline at end of file diff --git a/pages/inventory/list/index.json b/pages/inventory/list/index.json new file mode 100644 index 0000000..2412ceb --- /dev/null +++ b/pages/inventory/list/index.json @@ -0,0 +1,6 @@ +{ + "navigationBarTitleText": "盘点列表", + "usingComponents": { + + } +} \ No newline at end of file diff --git a/pages/inventory/list/index.wxml b/pages/inventory/list/index.wxml new file mode 100644 index 0000000..1edacaf --- /dev/null +++ b/pages/inventory/list/index.wxml @@ -0,0 +1,59 @@ + + + + + + + + + {{item.name}} + + + + + + + + {{item.name}} + + + + + + + + + + + 请选择 + {{s_date}} + + + - + + + 请选择 + {{e_date}} + + + 搜索 + + + + + + + {{item.biz_name}} + + + {{it.title}} + {{it.value}} + + + {{item.c_time}} + + + + + + \ No newline at end of file diff --git a/pages/inventory/list/index.wxss b/pages/inventory/list/index.wxss new file mode 100644 index 0000000..5e4f035 --- /dev/null +++ b/pages/inventory/list/index.wxss @@ -0,0 +1,3 @@ +.tabmenu2{display:inline-block;line-height:72rpx;} +.tabmenu2.active view.relative{display:inline-block;} +.tabmenu2.active view.relative::before{display:inline-block;position:absolute;bottom:0;left:50%;transform:translate(-50%,0);width:64rpx;height:6rpx;content:"";background-color:#36afa2;} \ No newline at end of file