| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- // pages/shenhe/shenhe.js
- var app = getApp();
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- userInfo: wx.getStorageSync('userInfo'),
- roleShow: false,
- pageHide: false,
- statusAdminList: [{
- id: '',
- name: "全部"
- }, {
- id: 0,
- name: "待审核"
- },
- {
- id: 1,
- name: "审核通过"
- },
- {
- id: 2,
- name: "已终止"
- },
- {
- id: 3,
- name: "超时自动取消"
- },
- {
- id: 4,
- name: "人工取消"
- }
- ],
- queryList: [{
- column: "checkNumber",
- name: "订单编号",
- text: "请输入订单编号"
- },
- {
- column: "dvyFlowId",
- name: "快递单号",
- text: "请输入快递单号"
- },
- {
- column: "picTitle",
- name: "商品名称",
- text: "请输入商品名称"
- },
- {
- column: "createTime",
- name: "下单时间",
- text: "开始日期 - 结束日期",
- type: 1
- },
- ],
- valueText: "",
- queryIndex: 3,
- queryShow: false,
- skuCode: "", //商品编码SKU
- checkStatus: 0, //订单状态
- checkNumber: "", //订单编号
- dvyFlowId: "", //快递单号
- picTitle: "", //商品名称
- orderTimeStart: "",
- orderTimeEnd: "",
- current: 0,
- orderList: [],
- current: 0,
- pages: null,
- loading: true,
- pageHide: false,
- isStraumann: false
- },
- /**
- * 生命周期函数--监听页面加载
- */
- async onLoad(options) {
- this.setData({
- checkStatus: options.status || 0
- })
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- async onShow() {
- setTimeout(() => {
- wx.setNavigationBarTitle({
- title: app.globalData.tabbar.list[1].text,
- });
- }, 500);
- let userInfo = wx.getStorageSync('userInfo');
- if (typeof this.getTabBar === 'function' && this.getTabBar()) {
- // let userInfo = wx.getStorageSync('userInfo');
- // if (userInfo && userInfo.userId) {
- // app.globalData.tabbar.list[0].show = false;
- // } else {
- // app.globalData.tabbar.list[0].show = true;
- // }
- setTimeout(() => {
- this.getTabBar().setData({
- selectIndex: 1,
- tabbar: app.globalData.tabbar
- })
- }, 500);
- }
- this.setData({
- isStraumann: wx.getStorageSync('isStraumann')
- })
- // if (this.data.pageHide) {
- // this.setData({
- // current: 0,
- // orderList: [],
- // pages: null
- // });
- // }
- this.setData({
- current: 0,
- loading: false,
- orderList: [],
- userInfo
- })
- if (!userInfo || !userInfo.userId) {
- return;
- }
- let roleList = wx.getStorageSync('roleList');
- let role = roleList.find(v => v.roleCode == 'ROLE_ORDER_AUDIT' || v.roleCode == 'SZMAdmin');
- if (this.data.isStraumann) {
- this.setData({
- roleShow: true
- })
- } else if (role) {
- this.setData({
- roleShow: true
- })
- } else if (!role) {
- this.setData({
- roleShow: false
- })
- return;
- }
- if (!wx.getStorageSync('companyName')) {
- wx.showToast({
- title: '请选择货主',
- icon: 'error'
- });
- return;
- }
- await this.initData({
- current: 0
- });
- this.setData({
- loading: false
- })
- },
- async initData(d) {
- if (!this.data.roleShow) {
- return;
- }
- let userInfo = wx.getStorageSync('userInfo');
- this.setData({
- current: this.data.current + 1,
- loadding: true
- });
- let {
- data
- } = await app.ajax.get({
- url: `/admin/bxdordercheck/queryByMini`,
- data: {
- checkUserId: userInfo.userId,
- checkStatus: this.data.statusAdminList[this.data.checkStatus].id,
- checkNumber: this.data.checkNumber,
- orderTimeStart: this.data.orderTimeStart ? this.data.orderTimeStart + ' 00:00:00' : '',
- orderTimeEnd: this.data.orderTimeEnd ? this.data.orderTimeEnd + ' 23:59:59' : '',
- current: d && d.current != undefined ? d.current : this.data.current,
- size: 20,
- }
- });
- this.setData({
- current: this.data.current,
- orderList: this.data.orderList.concat(data.data.records),
- pages: data.data.pages || null,
- loadding: false
- })
- // admin/bxdorder/query?activityImgs=&companyId=56&companyName=HZRCS&createTime=¤t=1&desc=create_time&mobile=&orderCheckNumber=&orderNumber=&orderSaleName&receiverName=&size=10&status=
- },
- async queryData(e) {
- this.setData({
- orderList: [],
- checkStatus: 0
- })
- await this.initData({
- current: 0
- });
- },
- chooseQuery(e) {
- if (this.data.queryIndex == e.currentTarget.dataset.index) {
- return;
- }
- this.setData({
- checkNumber: "", //订单编号
- dvyFlowId: "", //快递单号
- picTitle: "", //商品名称
- orderTimeStart: "",
- orderTimeEnd: "",
- valueText: "",
- })
- this.setData({
- queryShow: !this.data.queryShow
- })
- },
- chooseQueryItem(e) {
- if (this.data.queryIndex == e.currentTarget.dataset.index) {
- return;
- }
- this.setData({
- checkNumber: "", //订单编号
- dvyFlowId: "", //快递单号
- picTitle: "", //商品名称
- orderTimeStart: "",
- orderTimeEnd: "",
- valueText: "",
- })
- this.setData({
- queryShow: !this.data.queryShow,
- queryIndex: e.currentTarget.dataset.index
- })
- },
- async changeTabbar(e, a) {
- if (this.data.checkStatus == e.detail.index) {
- return;
- }
- this.setData({
- orderList: [],
- current: 0,
- checkStatus: e.detail.index
- })
- await this.initData(0);
- },
- bindinputchange(e) {
- this.setData({
- valueText: e.detail.value,
- [e.currentTarget.dataset.name]: e.detail.value
- })
- },
- bindchange1(e) {
- this.setData({
- orderTimeStart: e.detail.value
- })
- },
- bindchange2(e) {
- this.setData({
- orderTimeEnd: e.detail.value
- })
- },
- cleanDate(e) {
- this.setData({
- checkNumber: "", //订单编号
- dvyFlowId: "", //快递单号
- picTitle: "", //商品名称
- orderTimeStart: "",
- orderTimeEnd: "",
- valueText: "",
- })
- },
- async approve(e) {
- let row = e.currentTarget.dataset.item;
- await app.ajax.post({
- url: "/admin/bxdordercheck/audit",
- data: {
- checkId: row.checkId,
- checkReason: "小程序端快速审核通过",
- checkStatus: 1,
- companyId: row.companyId,
- companyName: row.companyName,
- }
- });
- setTimeout(async () => {
- wx.showToast({
- title: '审核通过成功',
- });
- }, 200);
- this.setData({
- orderList: [],
- current: 0
- })
- let that = this;
- setTimeout(async () => {
- await that.initData();
- }, 1000);
- },
- async approve2(e) {
- let row = e.currentTarget.dataset.item;
- let that = this;
- wx.showModal({
- // title: '提示',
- title: `确认终止订单(${row.checkNumber})吗?`,
- editable: true,
- placeholderText: "请输入终止订单原因",
- complete: async (res) => {
- if (res.confirm) {
- if (!res.content) {
- wx.showToast({
- title: '请填写终止订单原因!',
- icon: "none"
- })
- return;
- }
- await app.ajax.post({
- url: "/admin/bxdordercheck/audit",
- data: {
- checkId: row.checkId,
- checkReason: res.content,
- checkStatus: 2,
- }
- });
- setTimeout(async () => {
- wx.showToast({
- title: '中止订单成功',
- });
- }, 200);
- that.setData({
- orderList: [],
- current: 0
- })
- setTimeout(async () => {
- await that.initData();
- }, 1000);
- }
- }
- })
- },
- toLogin() {
- wx.navigateTo({
- url: '/pages/login/login',
- })
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- this.setData({
- pageHide: true
- })
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- this.setData({
- pageHide: false
- })
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|