| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- const utils = require('../../utils/util')
- const util = require('../../utils/util')
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- isPickerRender: false,
- isPickerShow: false,
- pickerConfig: {
- endDate: true,
- dateLimit: true,
- initStartTime: "2020-01-01",
- initEndTime: "2020-12-01",
- limitStartTime: "2015-01-01",
- limitEndTime: "2095-01-01"
- },
- searchParams: {
- startTime: "",
- endTime: "",
- storeId:'',
- pageNo: 1,
- pageSize: 10,
- orderSn:'',
- storeName:'',
- },
- loadding: false,
- pullUpOn: true,
- dataStr: '',
- storeList:[],
- selectH: 0,
- orderList:[]
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.bindStoreList()
- this.submitSearch()
- },
- timePickerShow: function () {
- this.setData({
- isPickerShow: true,
- isPickerRender: true,
- chartHide: true
- });
- },
- pickerHide: function () {
- this.setData({
- isPickerShow: false,
- chartHide: false
- });
- },
- setPickerTime: function (val) {
- console.log(val);
- let data = val.detail;
- let startTime = utils.formatDate(data.startTime)
- let endTime = utils.formatDate(data.endTime)
- this.setData({
- ["searchParams.startTime"]: data.startTime,
- ["searchParams.endTime"]: data.endTime,
- dataStr: startTime +" ~ "+ endTime
- });
- this.data.searchParams.startTime = data.startTime;
- this.data.searchParams.endTime = data.endTime;
- },
- bindStorePickerChange: function (e) {
- var item = this.data.storeList[e.detail.value]
- console.log(item)
- this.setData({
- ['searchParams.storeId']: item.id,
- ['searchParams.storeName']: item.storeName
- })
- this.data.searchParams.storeId = item.id;
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.setData({
- ["searchParams.pageNo"]: 1,
- pullUpOn: true,
- loadding: false,
- orderList: []
- })
- this.bindProductOrderList()
- setTimeout(() => {
- wx.stopPullDownRefresh()
- }, 300);
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- var that = this
- //只是测试效果,逻辑以实际数据为准
- this.setData({
- loadding: true,
- pullUpOn: true
- })
- this.setData({
- ["searchParams.pageNo"]: that.data.searchParams.pageNo + 1
- })
- this.bindProductOrderList()
- },
- showSearchModel: function() {
- this.setData({
- selectH: 300
- })
- },
- hideSearchModel: function() {
- this.setData({
- selectH: 0
- })
- },
- clearSearch(){
- this.setData({
- ['searchParams.storeName']: '',
- ['searchParams.storeId']: '',
- ['searchParams.startTime']: '',
- ['searchParams.endTime']: '',
- dataStr: '',
- })
- },
- bindStoreList() {
- var that = this
- util.request(util.api.storeList, {}, "GET", false, true, app.globalData.token).then((res) => {
- if (res.code == 200) {
- that.setData({
- storeList: res.result
- })
- }
- }).catch((res) => {})
- },
- submitSearch(){
- this.setData({
- selectH: 0,
- ["searchParams.pageNo"]: 1,
- pullUpOn: true,
- loadding: false,
- orderList: []
- })
- this.bindProductOrderList()
- },
- bindProductOrderList(){
- var that = this
- util.request(util.api.productOrderListPage, that.data.searchParams, "GET", false, false, app.globalData.token).then((res) => {
- if (res.code == 200) {
- if (res.result.records.length > 0) {
- if (that.data.orderList.length > 0) {
- let list = that.data.orderList
- res.result.records.forEach((e)=>{
- list.push(e)
- })
- that.setData({
- orderList: list
- })
- }else{
- that.setData({
- orderList: res.result.records
- })
- }
- } else {
- that.setData({
- loadding: false,
- pullUpOn: false
- })
- }
- }
- }).catch((res) => {})
- },
- searchProductOrder(){
- if(this.data.searchParams.storeId === undefined){
- this.data.searchParams.storeId = ''
- }
- if(this.data.searchParams.storeName === undefined){
- this.data.searchParams.storeName = ''
- }
- this.bindProductOrderList()
- },
- inputedit: function (e) {
- let _this = this;
- let dataset = e.currentTarget.dataset;
- let value = e.detail.value;
- let name = dataset.name;
- _this.data[name] = value;
- _this.setData({
- [name]: _this.data[name]
- });
- },
- })
|