From 305f6f593d0d8c2ce8f64df8fb0842a715973a3d Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Thu, 27 May 2021 11:33:48 +0800 Subject: [PATCH] no message --- components/field/index.js | 5 +- pages/agent/appointment/index.js | 2 +- pages/agent/appointment/index.wxml | 23 +++--- pages/agent/appointment/index.wxss | 3 +- pages/index/config.js | 68 ------------------ pages/index/index.js | 84 +++++++++++----------- pages/index/index.wxml | 4 +- pages/login/index.js | 97 ++++++++++++++++++++++---- pages/process/index/index.js | 5 -- pages/process/outside-add/index.js | 14 ++-- pages/process/outside-add/index.wxml | 84 +++++++++++----------- pages/process/outside-item/index.js | 10 +-- pages/process/outside-item/index.json | 1 + pages/process/outside-item/index.wxml | 52 +++++++++++--- pages/process/outside-price/index.js | 2 +- pages/process/outside-price/index.wxml | 33 +++++++-- pages/process/payment/index.js | 2 +- pages/process/payment/index.wxml | 22 +++--- pages/process/payment/index.wxss | 2 +- pages/storage/index/index.js | 2 +- 20 files changed, 279 insertions(+), 236 deletions(-) delete mode 100644 pages/index/config.js diff --git a/components/field/index.js b/components/field/index.js index 088020f..1d355e4 100644 --- a/components/field/index.js +++ b/components/field/index.js @@ -33,7 +33,7 @@ VantComponent({ this.emitChange() }, onFocus(event) { - this.focused = true + this.data.focused = true this.setShowClear() this.$emit('focus', event.detail) }, @@ -82,7 +82,8 @@ VantComponent({ }) }, setShowClear() { - const { clearable, readonly, focused, value } = this.data + const { clearable, readonly, focused } = this.data; + const { value } = this; this.setData({ showClear: clearable && focused && !!value && !readonly }) }, noop() { } diff --git a/pages/agent/appointment/index.js b/pages/agent/appointment/index.js index 6c53c3b..fbb7ff8 100644 --- a/pages/agent/appointment/index.js +++ b/pages/agent/appointment/index.js @@ -88,7 +88,7 @@ Scene({ }) getRelation().then(result => { if(util.isEmpty(result.data) || util.isEmpty(result.data.bizUserId)){ - this.setData({ show: true }) + // this.setData({ show: true }) } wx.hideLoading() }).catch(err => { diff --git a/pages/agent/appointment/index.wxml b/pages/agent/appointment/index.wxml index 62f1bd2..df86831 100644 --- a/pages/agent/appointment/index.wxml +++ b/pages/agent/appointment/index.wxml @@ -14,8 +14,9 @@ 余额提现 - - 纸品信息 + + + 纸品信息 @@ -57,8 +58,9 @@ - - 车辆信息 + + + 车辆信息 @@ -81,15 +83,18 @@ - - 备注信息 + + + + 其他信息 - - {{form.remark?form.remark:'点击输入备注,最多100字'}} - + 提交订单 diff --git a/pages/agent/appointment/index.wxss b/pages/agent/appointment/index.wxss index c0543e9..27a03c5 100644 --- a/pages/agent/appointment/index.wxss +++ b/pages/agent/appointment/index.wxss @@ -27,8 +27,9 @@ .textarea{ width:100%; height:80px; - padding:0px 30rpx; + padding:12rpx; font-size: 14px; + border: 1rpx solid #f3f3f3; } .bg-blue{ diff --git a/pages/index/config.js b/pages/index/config.js deleted file mode 100644 index dd66300..0000000 --- a/pages/index/config.js +++ /dev/null @@ -1,68 +0,0 @@ -export default { - pro1Name: '巫医和尚唐有限公司', - pro1: [ - { - text: '济州岛打包站', - id: 11, - }, - { - text: '福州道打包站', - id: 12, - }, - { - text: '钟落潭打包站', - id: 13, - disabled: true, - }, - { - text: '义乌', - id: 14, - },{ - text: '杭州', - id: 1, - }, - { - text: '温州', - id: 2, - }, - { - text: '宁波', - id: 3, - disabled: true, - }, - { - text: '义乌', - id: 4, - }, - ], - pro2Name: '江苏', - pro2: [ - { - text: '南京', - id: 5, - }, - { - text: '无锡', - id: 6, - }, - { - text: '徐州', - id: 7, - }, - { - text: '苏州', - id: 8, - }, - ], - pro3Name: '福建', - pro3: [ - { - text: '泉州', - id: 9, - }, - { - text: '厦门', - id: 10, - }, - ], -}; diff --git a/pages/index/index.js b/pages/index/index.js index a678c14..b234dc8 100644 --- a/pages/index/index.js +++ b/pages/index/index.js @@ -3,24 +3,8 @@ import Scene from './scene' import { getMessageList } from "../../api/saas" import { headerFactoryId } from "../../api/user" const event = require('../../utils/event') +const storage = require('../../utils/storage') const app = getApp() -import config from './config'; - -const items = [ - { - text: config.pro1Name, - children: config.pro1, - }, - { - text: config.pro2Name, - children: config.pro2, - }, - { - text: config.pro3Name, - disabled: true, - children: config.pro3, - }, -]; Scene({ /** @@ -39,21 +23,10 @@ Scene({ tabIndex: 0, zIndex: 9, setInter: null, - factoryId: '12313K78978KK', factoryName: '', - factoryList: [ - {id: '12313000KK12K', name: '济州岛打包站'}, - {id: '12313K78978KK', name: '福州道打包站'}, - {id: '1231345500KKK', name: '钟落潭打包站'}, - {id: '12345678978KK', name: '鹤山常服打包站'}, - {id: '123sdfsdf00KKK', name: '合剂打包站'}, - {id: '1231332K78978K', name: '永宁街打包站'}, - {id: '123242K78978KK', name: '河西路打包站'}, - {id: '12313378978KK5', name: '成林道打包站'} - ], - items, - mainActiveIndex: 0, - activeId: 0, + items: [], + mActiveIndex: 0, + factoryId: '', visible: false }, /************************************** 初始化流程 ********************************************/ @@ -64,8 +37,33 @@ Scene({ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 updateManager.applyUpdate() }) + this.data.items = [] + for (let mIndex = 0; m < app.userInfo.enterpriseInfos.length; mIndex++) { + const element = app.userInfo.enterpriseInfos[mIndex] + var enterprise = { text: element.enterpriseName } + var children = [] + for (let nIndex = 0; n < element.factoryInfos.length; nIndex++) { + const item = element.factoryInfos[nIndex] + if(item.factoryId == app.userInfo.factoryId){ + this.data.mActiveIndex = mIndex + } + var factory = { id: item.factoryId } + if(item.applicationStatus == 0 && !element.isAdmin){ + factory.text = item.factoryName + '(申请中)' + factory.disabled = true + } else { + factory.text = item.factoryName + } + children.push(factory) + } + enterprise.children = children + this.data.items.push(enterprise) + } this.setData({ userInfo: app.userInfo, + items: this.data.items, + mActiveIndex: this.data.mActiveIndex, + factoryId: app.userInfo.factoryId, factoryName: app.userInfo.factoryName, customBar: app.globalData.CustomBar || (app.globalData.isIos ? 64 : 60), fragment: (app.globalData.safeFragmentHeight + app.globalData.statusBarHeight), @@ -115,25 +113,23 @@ Scene({ pageView.onClose() } }, - changeFactory: function(e){ - var item = this.data.factoryList[e.currentTarget.dataset.index] + onHide: function(){ + this.setData({ visible: false }) + }, + onClickNav({ detail }) { + this.setData({ mActiveIndex: detail.index || 0 }); + }, + changeFactory({ detail }) { wx.showLoading({ title: '正在切换', mask: true }) - headerFactoryId(item.id) + app.userInfo.factoryId = detail.id + storage.put('X-FACTORY-ID' + app.userInfo.userId, detail.id) + headerFactoryId(detail.id) var pageView = this.selectComponent('#' + this.data.tabList[this.data.tabIndex].value) if (pageView && this.data.tabIndex != 3) { pageView.fetchStatisticsInfo(true) } event.emit('EventMessage', { what: 999, desc: 'changeFactory' }) - this.setData({ visible: false, factoryId: item.id, factoryName: item.name }) - }, - onHide: function(){ - this.setData({ visible: false }) - }, - onClickNav({ detail }) { - this.setData({ mainActiveIndex: detail.index || 0 }); - }, - onClickItem({ detail }) { - this.setData({ activeId: detail.id }); + this.setData({ visible: false, factoryId: detail.id, factoryName: detail.text }) }, onUnload: function(){ event.remove('EventMessage', this) diff --git a/pages/index/index.wxml b/pages/index/index.wxml index 383ee8d..86ceda0 100644 --- a/pages/index/index.wxml +++ b/pages/index/index.wxml @@ -39,8 +39,8 @@ --> - + diff --git a/pages/login/index.js b/pages/login/index.js index 50c3f03..0ba659e 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -93,6 +93,25 @@ Page({ return false }, /************************************** 获取用户信息,进行登录 ********************************************/ + toIndex: function(){ + var factoryId = storage.get('X-FACTORY-ID' + app.userInfo.userId) + if(factoryId){ + app.userInfo.factoryId = factoryId + } else { + const enterpriseInfo = app.userInfo.enterpriseInfos[app.userInfo.enterpriseInfos.length - 1] + if(enterpriseInfo.factoryInfos && enterpriseInfo.factoryInfos.length){ + factoryId = enterpriseInfo.factoryInfos[enterpriseInfo.factoryInfos.length - 1].factoryId + } + } + if(factoryId){ + headerFactoryId(app.userInfo.factoryId) + wx.redirectTo({ url: '/pages/index/index' }) + } else { + this.setData({ loging: false}) + Dialog.alert({ title: '温馨提示', message: '还没有您所属的打包站信息,请联系相关客服人员' }).then(() => { + }) + } + }, fetchUserInfo: function(authorization){ config.header = { 'Authorization': 'QNT ' + authorization } // token 切换流程 @@ -105,12 +124,7 @@ Page({ app.userInfo = result.data app.globalData.token = authorization storage.put('Authorization', app.globalData.token) - if(app.userInfo.factoryId && this.data.metaData){ - Dialog.alert({ title: '温馨提示', message: '您已经绑定过工厂了,现在就进入?' }).then(() => { - headerFactoryId(app.userInfo.factoryId) - wx.redirectTo({ url: '/pages/index/index' }) - }) - } else if(this.data.metaData){ + if(this.data.metaData){ // 这里要进行账号的绑定,对工厂进行绑定;或者进行申请操作; if(this.data.metaData.qrPage == '/page/index/register'){ this.data.metaData.userName = this.data.metaData.factoryCustomerName || '默认姓名' @@ -120,22 +134,77 @@ Page({ } else { this.setData({ loging: false, metaData: this.data.metaData }) } - } else if(app.userInfo.factoryId){ - this.setData({ loging: false}) - if(!result.data.isSaasPerssion){ - Dialog.alert({ title: '温馨提示', message: '您的打包站还在授权中,请耐心等待,或者联系相关客服人员' }).then(() => { + } else if(app.userInfo.enterpriseInfos && app.userInfo.enterpriseInfos.length){ + var isEnterpriseAdmin = false + for (let index = 0; index < app.userInfo.enterpriseInfos.length; index++) { + if(app.userInfo.enterpriseInfos[index].isEnterpriseAdmin){ + isEnterpriseAdmin = true + break + } + } + if(isEnterpriseAdmin){ + this.toIndex() + return + } + var applicationStatus = -1 + for (let m = 0; m < app.userInfo.enterpriseInfos.length; m++) { + const element = app.userInfo.enterpriseInfos[m] + for (let n = 0; n < element.factoryInfos.length; n++) { + const item = element.factoryInfos[n] + if(applicationStatus == -1){ + applicationStatus = item.applicationStatus + } + } + } + if(applicationStatus == -1){ + this.setData({ loging: false}) + Dialog.alert({ title: '温馨提示', message: '还没有您所属的打包站信息,请联系相关客服人员' }).then(() => { + }) + return + } + if(applicationStatus == 0){ + this.setData({ loging: false}) + Dialog.alert({ title: '温馨提示', message: '您的申请还在审核中,如有疑问请联系管理员。' }).then(() => { }) return } - headerFactoryId(app.userInfo.factoryId) - wx.redirectTo({ url: '/pages/index/index' }) + this.toIndex() } else { this.setData({ loging: false}) - Dialog.alert({ title: '温馨提示', message: '还没有您所属的打包站,请耐心等待,或者联系相关客服人员,如果有时间也可以进去逛逛?' }).then(() => { - wx.redirectTo({ url: '/pages/index/index' }) + Dialog.alert({ title: '温馨提示', message: '还没有您所属的打包站信息,请联系相关客服人员' }).then(() => { }) } + // if(app.userInfo.factoryId && this.data.metaData){ + // Dialog.alert({ title: '温馨提示', message: '您已经绑定过工厂了,现在就进入?' }).then(() => { + // headerFactoryId(app.userInfo.factoryId) + // wx.redirectTo({ url: '/pages/index/index' }) + // }) + // } else if(this.data.metaData){ + // // 这里要进行账号的绑定,对工厂进行绑定;或者进行申请操作; + // if(this.data.metaData.qrPage == '/page/index/register'){ + // this.data.metaData.userName = this.data.metaData.factoryCustomerName || '默认姓名' + // } + // if(!util.isEmpty(this.data.metaData.factoryCustomerMobile)){ + // this.setData({ loging: false, metaData: this.data.metaData, ['form.account']: this.data.metaData.factoryCustomerMobile }) + // } else { + // this.setData({ loging: false, metaData: this.data.metaData }) + // } + // } else if(app.userInfo.factoryId){ + // this.setData({ loging: false}) + // if(!result.data.isSaasPerssion){ + // Dialog.alert({ title: '温馨提示', message: '您的打包站还在授权中,请耐心等待,或者联系相关客服人员' }).then(() => { + // }) + // return + // } + // headerFactoryId(app.userInfo.factoryId) + // wx.redirectTo({ url: '/pages/index/index' }) + // } else { + // this.setData({ loging: false}) + // Dialog.alert({ title: '温馨提示', message: '还没有您所属的打包站信息,请耐心等待,或者联系相关客服人员' }).then(() => { + // }) + // } }).catch(err => { + console.log(err) if(err.code == 400){ util.showToast('获取用户信息失败,请注册登录') this.setData({ loging: false, regist: true}) diff --git a/pages/process/index/index.js b/pages/process/index/index.js index 9c500a2..d55940b 100644 --- a/pages/process/index/index.js +++ b/pages/process/index/index.js @@ -95,11 +95,6 @@ Component({ wx.navigateTo({ url: '/pages/process/agent-list/index' }) }, checkList: function (e) { - if(app.userInfo.applicationStatus == 0){ - Dialog.alert({ title: '温馨提示', message: '您的申请还在审核中,如有疑问请联系管理员。' }).then(() => { - }) - return - } if(e.currentTarget.dataset.status == 3){ wx.navigateTo({ url: '/pages/process/payment-list/index?status=' + e.currentTarget.dataset.status }) } else if(e.currentTarget.dataset.status == 4){ diff --git a/pages/process/outside-add/index.js b/pages/process/outside-add/index.js index 9bd99d1..12af5d8 100644 --- a/pages/process/outside-add/index.js +++ b/pages/process/outside-add/index.js @@ -106,11 +106,9 @@ Scene({ }, showCategory: function(e){ if(e.currentTarget.dataset.index >= 0){ - this.data.cateIndex = e.currentTarget.dataset.index - this.setData({ visible: true, columns: this.data.column1 }) + this.setData({ visible: true, columns: this.data.column1, cateIndex: e.currentTarget.dataset.index }) } else { - this.data.cateIndex = -1 - this.setData({ visible: true, columns: this.data.column4 }) + this.setData({ visible: true, columns: this.data.column4, cateIndex: -1 }) } }, onConfirm: function({detail}){ @@ -135,7 +133,7 @@ Scene({ this.setData({ visible: false }) }, bindInput: function (e) { - this.data.form.productCategoryInfos[e.currentTarget.dataset.index].unitPrice = e.detail.value + this.data.form.productCategoryInfos[e.currentTarget.dataset.index].unitPrice = e.detail }, onChange: function({detail}) { this.data.form.equipmentRemark = detail @@ -186,7 +184,7 @@ Scene({ for (let index = 0; index < this.data.form.productCategoryInfos.length; index++) { const element = this.data.form.productCategoryInfos[index] if(util.isEmpty(element.productId)){ - util.showToast('请选择第' + (index + 1) + '项废纸品类') + util.showToast('请选择第' + (index + 1) + '项品类') return } if(!util.isEmpty(this.data.form.scrapPaperReceiptId)){ @@ -197,11 +195,11 @@ Scene({ } } if(element.highestUnitPrice && Number(element.unitPrice) > Number(element.highestUnitPrice)){ - util.showToast('第' + (index + 1) + '项废纸品类单价不得高于:' + element.highestUnitPrice + '元/公斤') + util.showToast('第' + (index + 1) + '项品类单价不得高于:' + element.highestUnitPrice + '元/公斤') return } if(element.lowestUnitPrice && Number(element.unitPrice) < Number(element.lowestUnitPrice)){ - util.showToast('第' + (index + 1) + '项废纸品类单价不得低于:' + element.lowestUnitPrice + '元/公斤') + util.showToast('第' + (index + 1) + '项品类单价不得低于:' + element.lowestUnitPrice + '元/公斤') return } } diff --git a/pages/process/outside-add/index.wxml b/pages/process/outside-add/index.wxml index 04f18a3..08b8f4a 100644 --- a/pages/process/outside-add/index.wxml +++ b/pages/process/outside-add/index.wxml @@ -3,7 +3,10 @@ {{form.scrapPaperReceiptId ? '修改订单' : '新增厂外收货'}} - + + + 订单信息 + @@ -13,7 +16,7 @@ {{form.factoryCustomerName || '请选择客户'}} - + * @@ -31,58 +34,55 @@ {{form.driverName || '请选择司机'}} - - - - - - - 品类 - {{index + 1}} - - - - - - - * - 废纸品类 - - {{item.productCategoryName || '请选择废纸品类'}} - - - - - - * - 单价(元/公斤) - - - - - - - - - 添加品类 - - - 操作员 {{form.operatorName || '请选择操作员'}} - + 预计到厂时间 {{form.predictDeliveryToFactoryTime || '请选择预计到厂时间'}} - + + + + + + 纸品信息 + + + + + + + + * + 品类{{index + 1}} + + + + + {{item.productCategoryName || '请选择品类'}} + + + + + * + 单价(元/公斤) + + + + + + + 添加品类 + + + 取消订单 提交订单 diff --git a/pages/process/outside-item/index.js b/pages/process/outside-item/index.js index a2b9c29..5b3cd25 100644 --- a/pages/process/outside-item/index.js +++ b/pages/process/outside-item/index.js @@ -41,7 +41,7 @@ Component({ } }, bindInput: function (e) { - this.data.item[e.currentTarget.id] = e.detail.value + this.data.item[e.currentTarget.id] = e.detail if(e.currentTarget.id == 'grossWeight' || e.currentTarget.id == 'tareWeight'){ if(Number(this.data.item.grossWeight) > 0){ if(Number(this.data.item.tareWeight) > 0){ @@ -59,19 +59,19 @@ Component({ this.setData({['item.netWeight']: null, ['item.estimatedAmount']: null}) } } else if(e.currentTarget.id == 'deductPercent'){ - if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){ + if(util.isEmpty(e.detail) || Number(e.detail) <= 0){ this.data.item.deductWeight = null this.data.item.deductPercent = null } else { - this.data.item.deductWeight = math.divide(math.times(this.data.item.netWeight, Number(e.detail.value)), 100).toFixed(2) + this.data.item.deductWeight = math.divide(math.times(this.data.item.netWeight, Number(e.detail)), 100).toFixed(2) } this.statAmount() } else if(e.currentTarget.id == 'deductWeight'){ - if(util.isEmpty(e.detail.value) || Number(e.detail.value) <= 0){ + if(util.isEmpty(e.detail) || Number(e.detail) <= 0){ this.data.item.deductWeight = null this.data.item.deductPercent = null } else { - this.data.item.deductPercent = math.times(math.divide(Number(e.detail.value), this.data.item.netWeight), 100).toFixed(2) + this.data.item.deductPercent = math.times(math.divide(Number(e.detail), this.data.item.netWeight), 100).toFixed(2) } this.statAmount() } else if(e.currentTarget.id == 'settleUnitPrice'){ diff --git a/pages/process/outside-item/index.json b/pages/process/outside-item/index.json index e5922ae..e19036c 100644 --- a/pages/process/outside-item/index.json +++ b/pages/process/outside-item/index.json @@ -2,6 +2,7 @@ "component": true, "usingComponents": { "van-cell": "/components/cell/index", + "van-field": "/components/field/index", "van-checkbox": "/components/checkbox/index", "van-uploader": "/components/uploader/index" } diff --git a/pages/process/outside-item/index.wxml b/pages/process/outside-item/index.wxml index b072c66..a0e1c04 100644 --- a/pages/process/outside-item/index.wxml +++ b/pages/process/outside-item/index.wxml @@ -12,7 +12,7 @@ {{item.unitPrice || '请输入单价'}} - + + + + * + 毛重(公斤) + + + + + + * + 皮重(公斤) + + 净重(公斤) @@ -55,17 +67,23 @@ - + + + + * + 结算单价(元/公斤) + + + + + + + 扣重(公斤) + + + + + + + 扣点(%) + + 结算重量(公斤) diff --git a/pages/process/outside-price/index.js b/pages/process/outside-price/index.js index d6c670b..43c52a1 100644 --- a/pages/process/outside-price/index.js +++ b/pages/process/outside-price/index.js @@ -70,7 +70,7 @@ Scene({ } }, bindInput: function (e) { - this.data.param[e.currentTarget.id] = e.detail.value + this.data.param[e.currentTarget.id] = e.detail }, cancelForm: function(e){ Dialog.confirm({ title: '温馨提示', message: '确定取消该订单?' }).then(() => { diff --git a/pages/process/outside-price/index.wxml b/pages/process/outside-price/index.wxml index 0ec5c9b..391a945 100644 --- a/pages/process/outside-price/index.wxml +++ b/pages/process/outside-price/index.wxml @@ -22,7 +22,10 @@ 重新定价 - + + + 订单信息 + 客户姓名 @@ -56,8 +59,11 @@ - - + + + + 纸品信息 + @@ -86,7 +92,7 @@ {{form.estimatedAmount || '- -'}} - + + + + * + 厂外皮重(公斤) + + + + + + * + 厂外毛重(公斤) + + + 取消订单 保存订单 diff --git a/pages/process/payment/index.js b/pages/process/payment/index.js index 1622fc6..acf9caa 100644 --- a/pages/process/payment/index.js +++ b/pages/process/payment/index.js @@ -161,7 +161,7 @@ Scene({ } wx.showLoading({ title: '正在处理', mask: true }) this.data.requesting = true - this.data.params.settleType = settleType + this.data.params.settleType = Number(settleType) paymentOrder(this.data.params).then(result => { wx.hideLoading() if(!util.isEmpty(result.message)){ diff --git a/pages/process/payment/index.wxml b/pages/process/payment/index.wxml index 205cb66..c3fc08c 100644 --- a/pages/process/payment/index.wxml +++ b/pages/process/payment/index.wxml @@ -11,7 +11,7 @@ - + 付款方式 @@ -27,26 +27,24 @@ - + - - - 付款备注 + + 付款备注 - - +