diff --git a/package-lock.json b/package-lock.json index b073e115a1d7091ae4d5323e30c698c76f738486..29e8d14475936295171aa4ba23c152854714956a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1420,6 +1420,62 @@ } } }, + "babel-core": { + "version": "6.26.3", + "resolved": "https://registry.npmmirror.com/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.8", + "slash": "^1.0.0", + "source-map": "^0.5.7" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmmirror.com/json5/-/json5-0.5.1.tgz", + "integrity": "sha512-4xrs1aW+6N5DalkqSVA8fxh458CXvR99WU8WLKmq4v8eWAL86Xo3BVqyd3SkA9wEVjCMqyvvRRkshAdOnBp5rw==", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/slash/-/slash-1.0.0.tgz", + "integrity": "sha512-3TYDR7xWt4dIqV2JauJr+EJeW356RXijHeUlO+8djJ+uBXPn8/2dpzBc8yQhh583sVvc9CvFAeQVgijsH+PNNg==", + "dev": true + } + } + }, "babel-eslint": { "version": "7.2.3", "resolved": "https://registry.npm.taobao.org/babel-eslint/download/babel-eslint-7.2.3.tgz", @@ -1432,6 +1488,40 @@ "babylon": "^6.17.0" } }, + "babel-generator": { + "version": "6.26.1", + "resolved": "https://registry.npmmirror.com/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", + "dev": true, + "requires": { + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" + }, + "dependencies": { + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmmirror.com/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha512-Mke0DA0QjUWuJlhsE0ZPPhYiJkRap642SmI/4ztCFaUs6V2AiH1sfecc+57NgaryfAA2VR3v6O+CSjC1jZJKOA==", + "dev": true + } + } + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmmirror.com/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha512-n7pFrqQm44TCYvrCDb0MqabAF+JUBq+ijBvNMUxpkLjJaAu32faIexewMumrH5KLLJ1HDyT0PTEqRyAe/GwwuQ==", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, "babel-messages": { "version": "6.23.0", "resolved": "https://registry.npm.taobao.org/babel-messages/download/babel-messages-6.23.0.tgz", @@ -1450,6 +1540,21 @@ "object.assign": "^4.1.0" } }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmmirror.com/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha512-veliHlHX06wjaeY8xNITbveXSiI+ASFnOqvne/LaIJIqOWi2Ogmj91KOugEz/hoh/fwMhXNBJPCv8Xaz5CyM4A==", + "dev": true, + "requires": { + "babel-core": "^6.26.0", + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "home-or-tmp": "^2.0.0", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "source-map-support": "^0.4.15" + } + }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npm.taobao.org/babel-runtime/download/babel-runtime-6.26.0.tgz", @@ -1468,6 +1573,19 @@ } } }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmmirror.com/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha512-PCOcLFW7/eazGUKIoqH97sO9A2UYMahsn/yRQ7uOk37iutwjq7ODtcTNF+iFDSHNfkctqsLRjLP7URnOx0T1fg==", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + } + }, "babel-traverse": { "version": "6.26.0", "resolved": "https://registry.npm.taobao.org/babel-traverse/download/babel-traverse-6.26.0.tgz", @@ -2205,6 +2323,11 @@ "which": "^1.2.9" } }, + "crypto-js": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.1.1.tgz", + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" + }, "css": { "version": "2.2.4", "resolved": "https://registry.npm.taobao.org/css/download/css-2.2.4.tgz", @@ -2481,6 +2604,15 @@ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmmirror.com/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha512-BDKtmHlOzwI7iRuEkhzsnPoi5ypEhWAJB5RvHWe1kMr06js3uK5B3734i3ui5Yd+wOJV1cpE4JnivPD283GU/A==", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, "doctrine": { "version": "2.1.0", "resolved": "https://registry.npm.taobao.org/doctrine/download/doctrine-2.1.0.tgz", @@ -3809,6 +3941,16 @@ "integrity": "sha1-hK5l+n6vsWX922FWauFLrwVmTw8=", "dev": true }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmmirror.com/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha512-ycURW7oUxE2sNiPVw1HVEFsW+ecOpJ5zaj7eC0RlwhibhRBod20muUN8qu/gzx956YrLolVvs1MTXwKgC2rVEg==", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.1" + } + }, "htmlhint": { "version": "0.11.0", "resolved": "https://registry.npm.taobao.org/htmlhint/download/htmlhint-0.11.0.tgz", @@ -5278,6 +5420,12 @@ "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", "dev": true }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmmirror.com/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npm.taobao.org/process-nextick-args/download/process-nextick-args-2.0.1.tgz", @@ -5800,6 +5948,15 @@ "urix": "^0.1.0" } }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmmirror.com/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "^0.5.6" + } + }, "source-map-url": { "version": "0.4.0", "resolved": "https://registry.npm.taobao.org/source-map-url/download/source-map-url-0.4.0.tgz", @@ -6189,6 +6346,12 @@ "escape-string-regexp": "^1.0.2" } }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmmirror.com/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha512-WZGXGstmCWgeevgTL54hrCuw1dyMQIzWy7ZfqRJfSmJZBwklI15egmQytFP6bPidmw3M8d5yEowl1niq4vmqZw==", + "dev": true + }, "tslib": { "version": "1.14.0", "resolved": "https://registry.npm.taobao.org/tslib/download/tslib-1.14.0.tgz?cache=0&sync_timestamp=1601998793819&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftslib%2Fdownload%2Ftslib-1.14.0.tgz", @@ -6569,6 +6732,26 @@ } } }, + "wepy": { + "version": "1.7.2", + "resolved": "https://registry.npmmirror.com/wepy/-/wepy-1.7.2.tgz", + "integrity": "sha512-22Q338OY2wV1kuINAtQQmO6V9r00wNTgLPOOOASZe8tdq0lGxv9FnFWxA7SqJihQJEeWXERFd/gN7GKQQ1CU1w==" + }, + "wepy-compiler-babel": { + "version": "1.5.3", + "resolved": "https://registry.npmmirror.com/wepy-compiler-babel/-/wepy-compiler-babel-1.5.3.tgz", + "integrity": "sha512-eFRH7IuebzKso5b3+zzo1K0FwXGVKLGfs3tYL9O0Vmf0NdIFL14iWBQAKOHWlnZJnxgH6JNzYtjUZqwcpj9XHg==", + "dev": true, + "requires": { + "babel-core": "^6.20.0" + } + }, + "wepy-compiler-less": { + "version": "1.3.14", + "resolved": "https://registry.npmmirror.com/wepy-compiler-less/-/wepy-compiler-less-1.3.14.tgz", + "integrity": "sha512-70n7Rb0i987RBun9EC+aTBHsscwSb6Vb4r7l+dgOy2KGyyvPvmhh2vSQduxFnhJzHuYRYMV+hxH51Jss+jE+vg==", + "dev": true + }, "wepy-eslint": { "version": "1.5.4", "resolved": "https://registry.npm.taobao.org/wepy-eslint/download/wepy-eslint-1.5.4.tgz", diff --git a/package.json b/package.json index 685de296f2756825a99a1404963f3fa83015cdd5..9631c5284e033799f75949575a4e492c20721e05 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,4 @@ - { +{ "name": "mpshaodai", "version": "0.0.2", "description": "A WePY project", @@ -19,13 +19,17 @@ "@vant/weapp": "^1.5.1", "@wepy/core": "^2.0.0-alpha.16", "@wepy/x": "^2.0.2", - "miniprogram-slide-view": "0.0.3" + "crypto-js": "^4.1.1", + "miniprogram-slide-view": "0.0.3", + "wepy": "^1.7.2" }, "devDependencies": { - "@wepy/cli": "^2.0.0-alpha.28", "@babel/core": "^7.1.0", "@babel/preset-env": "^7.1.0", "@wepy/babel-plugin-import-regenerator": "0.0.2", + "@wepy/cli": "^2.0.0-alpha.28", + "@wepy/compiler-babel": "^2.0.1", + "@wepy/compiler-less": "^2.0.1", "babel-eslint": "^7.2.1", "cross-env": "^5.1.3", "eslint": "^3.18.0", @@ -34,9 +38,9 @@ "eslint-plugin-html": "^2.0.1", "eslint-plugin-promise": "^3.5.0", "eslint-plugin-standard": "^2.0.1", - "wepy-eslint": "^1.5.3", "less": "^3.8.1", - "@wepy/compiler-babel": "^2.0.1", - "@wepy/compiler-less": "^2.0.1" + "wepy-compiler-babel": "^1.5.3", + "wepy-compiler-less": "^1.3.14", + "wepy-eslint": "^1.5.3" } } diff --git a/src/pages/approvePreview.wpy b/src/pages/approvePreview.wpy index bf3eff259d3f892382178fcabd6dbf2beac22bbe..d62e4579722a86629cf6aa1f0e0c3a2920ca3385 100644 --- a/src/pages/approvePreview.wpy +++ b/src/pages/approvePreview.wpy @@ -98,42 +98,57 @@
订单总览 - 课题组名称:{{orderList[0]['课题组名称']}} + 课题组名称:{{ queryOrder.ktzName }} + 请购人:{{ queryOrder.omsOrderApproveItemVoList[0].addcartName }} + 提交人:{{ queryOrder.omsOrderApproveItemVoList[0].submitName }} + 提交时间:{{ queryOrder.omsOrderApproveItemVoList[0].submitTime }} + 经费号:{{ queryOrder.ktkCode }} + 合计:{{ queryOrder.totalPrice }} +
商品明细 -
-
{{item['品名']}}
+
+
{{ item.productName }}
+
{{ '品牌: '+ item.brand +';货号:'+ item.itemNo +';包装规格' + item.spec }}
+
数量:{{ item.quantity }}
+
成交价:{{ item.payPrice }}
+
总价:{{ item.totalPrice }}
+
审批通过 - 审批驳回 + 审批拒绝
- +
+ +
@@ -158,128 +173,234 @@ wepy.page({ data: { orderList: [], showM: false, - refuse_reason: '' + refuse_reason: '', + queryOrder: {}, + userInfo: {}, + requestURL: '' }, computed: {}, methods: { onDClose(){ this.showM = false }, + cancelRefuse() { + wx.showToast({ + title: '您取消了拒绝', + icon: 'none' + }) + }, pass(){ - let order = wx.getStorageSync("order"); - let username = wx.getStorageSync("username"); - let role = wx.getStorageSync("role"); - - const param = { - username: username, 订单id: order, 审批角色: role, - 审批通过: '1', 审批说明: '', 审批人帐号: username - } - http.post('/order/orderApproval', param).then(res => { - if(res.flag === '1'){ - wx.showModal({ - title: "提示", - showCancel: false, - content: '审批完成', - //点击确认返回main界面 - success: function (res) { - wx.navigateBack({ - delta: 1 - }) - } - }) - }else{ - wx.showModal({ - title: "提示", - showCancel: false, - content: res.message, - //点击确认返回main界面 - success: function (res) { - wx.navigateBack({ - delta: 1 - }) - } - }) + wx.showModal({ + title: "提示", + content: '确认通过吗?', + success: (res) => { + if(res.confirm) { + wx.showLoading({ + title: '加载中' + }); + wx.request({ + url: `${this.requestURL}/approveOpera/pass`, + method: 'post', + header: { + 'Content-Type': 'application/json', + 'token': this.userInfo.token + }, + data: { + taskId: this.queryOrder.taskId, + option: '通过', + type: '审批' + }, + success: (res) => { + if (res.data.success) { + wx.hideLoading() + wx.showModal({ + title: "提示", + showCancel: false, + content: '通过成功', + //点击确认返回main界面 + success: function (res) { + wx.navigateBack({ + delta: 1 + }) + } + }) + } else { + wx.hideLoading() + wx.showModal({ + title: "提示", + showCancel: false, + content: res.message, + success: function (res) { + } + }) + } + } + }); + }else { + wx.showToast({ + title: '您取消了通过', + icon: 'none' + }) + } } }) + // let order = wx.getStorageSync("order"); + // let username = wx.getStorageSync("username"); + // let role = wx.getStorageSync("role"); + // const param = { + // username: username, 订单id: order, 审批角色: role, + // 审批通过: '1', 审批说明: '', 审批人帐号: username + // } + // http.post('/order/orderApproval', param).then(res => { + // if(res.flag === '1'){ + // wx.showModal({ + // title: "提示", + // showCancel: false, + // content: '审批完成', + // //点击确认返回main界面 + // success: function (res) { + // wx.navigateBack({ + // delta: 1 + // }) + // } + // }) + // }else{ + // wx.showModal({ + // title: "提示", + // showCancel: false, + // content: res.message, + // //点击确认返回main界面 + // success: function (res) { + // wx.navigateBack({ + // delta: 1 + // }) + // } + // }) + // } + // }) }, showRefuse(){ this.showM = true + this.refuse_reason = '' }, refuse(){ - if(!this.refuse_reason){ + if(!this.refuse_reason || this.refuse_reason.trim() === ''){ wx.showToast({ - title: '请输入驳回原因', + title: '请输入拒绝原因', icon: 'none' }) return } - let order = wx.getStorageSync("order"); - let username = wx.getStorageSync("username"); - let role = wx.getStorageSync("role"); - - const param = { - username: username, 订单id: order, 审批角色: role, - 审批通过: '0', 审批说明: this.refuse_reason, 审批人帐号: username - } - http.post('/order/orderApproval', param).then(res => { - this.showM = false - if(res.flag === '1'){ - wx.showModal({ - title: "提示", - showCancel: false, - content: '审批完成', - //点击确认返回main界面 - success: function (res) { - wx.navigateBack({ - delta: 1 - }) - } - }) - }else{ - wx.showModal({ - title: "提示", - showCancel: false, - content: res.message, - //点击确认返回main界面 - success: function (res) { - wx.navigateBack({ - delta: 1 - }) - } - }) + this.showM = false + wx.showLoading({ + title: '加载中' + }); + wx.request({ + url: `${this.requestURL}/approveOpera/refuse`, + method: 'post', + header: { + 'Content-Type': 'application/json', + 'token': this.userInfo.token + }, + data: { + taskId: this.queryOrder.taskId, + option: this.refuse_reason, + type: '审批' + }, + success: (res) => { + if (res.data.success) { + wx.hideLoading() + wx.showModal({ + title: "提示", + showCancel: false, + content: '拒绝成功', + //点击确认返回main界面 + success: function (res) { + wx.navigateBack({ + delta: 1 + }) + } + }) + } else { + wx.hideLoading() + wx.showModal({ + title: "提示", + showCancel: false, + content: res.message, + success: function (res) { + } + }) + } } - }) + }); + // let order = wx.getStorageSync("order"); + // let username = wx.getStorageSync("username"); + // let role = wx.getStorageSync("role"); + + // const param = { + // username: username, 订单id: order, 审批角色: role, + // 审批通过: '0', 审批说明: this.refuse_reason, 审批人帐号: username + // } + // http.post('/order/orderApproval', param).then(res => { + // this.showM = false + // if(res.flag === '1'){ + // wx.showModal({ + // title: "提示", + // showCancel: false, + // content: '审批完成', + // //点击确认返回main界面 + // success: function (res) { + // wx.navigateBack({ + // delta: 1 + // }) + // } + // }) + // }else{ + // wx.showModal({ + // title: "提示", + // showCancel: false, + // content: res.message, + // //点击确认返回main界面 + // success: function (res) { + // wx.navigateBack({ + // delta: 1 + // }) + // } + // }) + // } + // }) }, history(){ } }, - onLoad() { - let role = wx.getStorageSync("role"); - let order = wx.getStorageSync("order"); - http.post('/JPost?query=订单详情_mp', { 订单号: order }).then(res => { - if(res.flag === "1"){ - if(res.data[0]['等待审批']!==role){ - wx.showModal({ - title: "提示", - showCancel: false, - content: '您当前无法审批此订单,可能尚未流转至您或者您已审批过此订单', - //点击确认返回main界面 - success: function (res) { - wx.navigateBack({ - delta: 1 - }) - } + onLoad(option) { + this.requestURL = wx.getStorageSync('requestURL') + // 接收上个页面传过来的 一整个对象 + this.queryOrder = JSON.parse(decodeURIComponent(option.data)) + if(!this.queryOrder.orderSn) { + wx.showModal({ + title: "提示", + showCancel: false, + content: '未找到此订单', + //点击确认返回main界面 + success: function (res) { + wx.navigateBack({ + delta: 1 }) - return } - this.orderList = res.data - }else{ + }) + } + wx.getStorage({ + key: 'user_info', + success: (res) => { + this.userInfo = JSON.parse(res.data); + }, + fail: function() { wx.showModal({ title: "提示", showCancel: false, - content: '未找到此订单', - //点击确认返回main界面 + content: '用户未登录', success: function (res) { wx.navigateBack({ delta: 1 @@ -287,7 +408,40 @@ wepy.page({ } }) } - }) + }); + // let role = wx.getStorageSync("role"); + // let order = wx.getStorageSync("order"); + // http.post('/JPost?query=订单详情_mp', { 订单号: order }).then(res => { + // if(res.flag === "1"){ + // if(res.data[0]['等待审批']!==role){ + // wx.showModal({ + // title: "提示", + // showCancel: false, + // content: '您当前无法审批此订单,可能尚未流转至您或者您已审批过此订单', + // //点击确认返回main界面 + // success: function (res) { + // wx.navigateBack({ + // delta: 1 + // }) + // } + // }) + // return + // } + // this.orderList = res.data + // }else{ + // wx.showModal({ + // title: "提示", + // showCancel: false, + // content: '未找到此订单', + // //点击确认返回main界面 + // success: function (res) { + // wx.navigateBack({ + // delta: 1 + // }) + // } + // }) + // } + // }) } }) diff --git a/src/pages/index.wpy b/src/pages/index.wpy index b3b0eb109b169eb1a1175a19f78af6c505abdf11..1ad706cc9a4909368861f6a363af79da95bcd137 100644 --- a/src/pages/index.wpy +++ b/src/pages/index.wpy @@ -85,7 +85,7 @@
- {{ item }} + {{ item.orderSn }}
@@ -97,7 +97,19 @@ import { mapState } from '@wepy/x' import store from '../store' import testMixin from '../mixins/test' import http from '../common/http.js' - +const CryptoJS = require('../common/crypto-js.js') +const encode = (data) => { + let key = '0123456789ABCDEF' + let iv = '0123456789ABCDEF' + key = CryptoJS.enc.Utf8.parse(key) + iv = CryptoJS.enc.Utf8.parse(iv) + let decrypt = CryptoJS.AES.encrypt(data, key, { + iv: iv, + mode: CryptoJS.mode.CBC, + padding: CryptoJS.pad.Pkcs7 + }) + return decrypt.toString() +} const app = getApp().$wepy.$options wepy.page({ @@ -109,16 +121,22 @@ wepy.page({ mixins: [testMixin], data: { - orderList: [] + orderList: [], + userInfo: {}, + platformOptions: [] }, computed: {}, methods: { item_click(item){ - wx.setStorageSync("order", item); - + let data = JSON.stringify(item) wx.navigateTo({ - url: '/pages/approvePreview' + url: '/pages/approvePreview?data=' + encodeURIComponent(data) }) + // wx.setStorageSync("order", item); + + // wx.navigateTo({ + // url: '/pages/approvePreview' + // }) }, scanBtClick(){ @@ -165,112 +183,252 @@ wepy.page({ // } } }) + }, + getList() { + wx.getStorage({ + key: 'user_info', + success: (res) => { + this.userInfo = JSON.parse(res.data); + wx.showLoading({ + title: '加载中' + }); + const requestURL = wx.getStorageSync('requestURL') + wx.request({ + url: `${requestURL}/approveOpera/listUnApprove`, + method: 'post', + header: { + 'Content-Type': 'application/json', + 'token': this.userInfo.token + }, + data: { + searchText: '', + startTime: '', + endTime: '' + }, + success: (res) => { + if (res.data.success) { + this.orderList = res.data.data + } else { + this.orderList = [] + } + wx.hideLoading() + } + }); + }, + fail: function() { + console.log('用户未登录'); + } + }); } }, onShow() { - let usernam = wx.getStorageSync("username"); - let rol = wx.getStorageSync("role"); - let pla = wx.getStorageSync("plat"); - - if(usernam&&rol){ - let ktzCo = wx.getStorageSync("ktzCode"); - - let param = { 审批角色: rol } - if(ktzCo){ - param.课题组编号 = ktzCo - } - - if(pla === 'fwh'){ - wx.setStorageSync('urlPrefix','https://www.tmallab.com/fwhj') - }else{ - wx.setStorageSync('urlPrefix','https://www.tmallab.com/pkunxyj') - } - - http.post('/JPost?query=vue_审批list', param).then(res => { - if(res.flag === "1"){ - this.orderList = res.data.map(v=>{ - return v['订单号'] - }) - let l = Array.from(new Set(this.orderList)) - this.orderList = l - }else{ - this.orderList = [] - } - }) - } + // let usernam = wx.getStorageSync("username"); + // let rol = wx.getStorageSync("role"); + // let pla = wx.getStorageSync("plat"); + + // if(usernam&&rol){ + // if(pla === 'fwh'){ + // wx.setStorageSync('urlPrefix','http://tmallab.com/cgfwhj/') + // }else{ + // wx.setStorageSync('urlPrefix','https://www.tmallab.com/pkunxyj') + // } + + // http.post('/approveOpera/listUnApprove', param).then(res => { + // if(res.success){ + // this.orderList = res.data + // }else{ + // this.orderList = [] + // } + // }) + // } + // wx.getStorage({ + // key: 'user_info', + // success: (res) => { + // this.userInfo = JSON.parse(res.data); + // this.getList() + // }, + // fail: function() { + // console.log('用户未登录'); + // } + // }); + // let usernam = wx.getStorageSync("username"); + // let rol = wx.getStorageSync("role"); + // let pla = wx.getStorageSync("plat"); + + // if(usernam&&rol){ + // let ktzCo = wx.getStorageSync("ktzCode"); + + // let param = { 审批角色: rol } + // if(ktzCo){ + // param.课题组编号 = ktzCo + // } + + // if(pla === 'fwh'){ + // wx.setStorageSync('urlPrefix','https://www.tmallab.com/fwhj') + // }else{ + // wx.setStorageSync('urlPrefix','https://www.tmallab.com/pkunxyj') + // } + + // http.post('/JPost?query=vue_审批list', param).then(res => { + // if(res.flag === "1"){ + // this.orderList = res.data.map(v=>{ + // return v['订单号'] + // }) + // let l = Array.from(new Set(this.orderList)) + // this.orderList = l + // }else{ + // this.orderList = [] + // } + // }) + // } }, - onLoad(options) { - if(options.scene){ - var scene = decodeURIComponent(options.scene); - - console.log(scene) - var arrPara = scene.split(","); - - var role = arrPara[0] - var username = arrPara[1] - var plat = arrPara[3] - - wx.setStorageSync("plat", plat); - - if(role==='JS0010'){ - role = 'JSXXXX' - } - - wx.setStorageSync("username", username); - wx.setStorageSync("role", role); - - try { - var ktzCode = arrPara[2] - wx.setStorageSync("ktzCode", ktzCode); - }catch (e){ - console.log(e) - } - - } - - let usernam = wx.getStorageSync("username"); - let rol = wx.getStorageSync("role"); - - let pla = wx.getStorageSync("plat"); - let ktzCo = wx.getStorageSync("ktzCode"); - - if(!usernam||!rol||!pla){ - wx.showModal({ - title: "提示", - showCancel: false, - content: '请登录网页扫码登录此小程序', - //点击确认返回main界面 - success: function (res) { + async onLoad(options) { + const query = encodeURIComponent('获取平台信息') + const tag = encodeURIComponent('显示标识') + wx.request({ + url: 'https://tmallab.cn/fwhj/JPost?query=' + query + '&' + tag + '=a', + method: 'get', + headers: { + 'noSec': 'yes' + }, + success: ({ data: res }) => { + if (res.flag === '1') { + this.platformOptions = res.data.map(item => ({ + platformName: item['平台简称'], + platformNum: item['平台编号'], + platformUrl: item['平台请求地址'], + ifParameter: item['是否有台账'], + personnelAccess: item['人员权限'] + })) } - }) - return - } - - - if(pla === 'fwh'){ - wx.setStorageSync('urlPrefix','https://www.tmallab.com/fwhj') - }else{ - wx.setStorageSync('urlPrefix','https://www.tmallab.com/pkunxyj') - } + if(options.scene){ + // 例子:scene=role,userId,ktzCode,platform + // 如:scene=JS0010,CG00000,RG00086,fwh + let scene = decodeURIComponent(options.scene); + let arrPara = scene.split(","); + + let role = arrPara[0] + let username = arrPara[1] + let plat = arrPara[3] + let requestURL = this.platformOptions.find(v => v.platformNum === plat).platformUrl + wx.setStorage({ + key: 'requestURL', + data: requestURL + }); + // wx.setStorageSync("plat", plat); + wx.request({ + url: `${requestURL}/loginByUR`, + method: 'post', + header: { + 'Content-Type': 'application/json', + }, + data: { + username: username, + roleNum: role, + verifyCode:encode(username) + }, + success: (res) => { + if (res.data.success) { + let userInfo={ + sysid:res.data.data.umsUserRoleQueryVo[0].sysid, + token:res.data.data.token, + username:res.data.data.username, + 个人中心名称:res.data.data.umsUserRoleQueryVo[0].centerName, + 个人中心跳转:res.data.data.umsUserRoleQueryVo[0].centerPage, + 姓名:res.data.data.umsUserRoleQueryVo[0].personName, + 学工号:res.data.data.jobNum, + 已认证:null, + 角色编号:res.data.data.umsUserRoleQueryVo[0].roleNum, + 课题组名称:res.data.data.umsUserRoleQueryVo[0].groupName, + 课题组编号:res.data.data.umsUserRoleQueryVo[0].groupCode, + 默认页:'index' + }; + wx.setStorage({ + key: 'user_info', + data: JSON.stringify(userInfo), + }); + this.getList() + } else { + wx.showModal({ + title: '提示', + content: res.message, + success: function() { + } + }) + } + } + }); + // if(role==='JS0010'){ + // role = 'JSXXXX' + // } - let param = { 审批角色: rol } - if(ktzCo){ - param.课题组编号 = ktzCo - } + // wx.setStorageSync("username", username); + // wx.setStorageSync("role", role); - http.post('/JPost?query=vue_审批list', param).then(res => { - if(res.flag === "1"){ - this.orderList = res.data.map(v=>{ - return v['订单号'] - }) - let l = Array.from(new Set(this.orderList)) - this.orderList = l - }else{ - this.orderList = [] + // try { + // var ktzCode = arrPara[2] + // wx.setStorageSync("ktzCode", ktzCode); + // }catch (e){ + // console.log(e) + // } + } else { + wx.getStorage({ + key: 'user_info', + success: (res) => { + this.userInfo = JSON.parse(res.data); + this.getList() + }, + fail: function() { + console.log('用户未登录'); + } + }); + } } }) - } + // let usernam = wx.getStorageSync("username"); + // let rol = wx.getStorageSync("role"); + + // let pla = wx.getStorageSync("plat"); + // let ktzCo = wx.getStorageSync("ktzCode"); + + // if(!usernam||!rol||!pla){ + // wx.showModal({ + // title: "提示", + // showCancel: false, + // content: '请登录网页扫码登录此小程序', + // //点击确认返回main界面 + // success: function (res) { + // } + // }) + // return + // } + + + // if(pla === 'fwh'){ + // wx.setStorageSync('urlPrefix','https://www.tmallab.com/fwhj') + // }else{ + // wx.setStorageSync('urlPrefix','https://www.tmallab.com/pkunxyj') + // } + + // let param = { 审批角色: rol } + // if(ktzCo){ + // param.课题组编号 = ktzCo + // } + + // http.post('/JPost?query=vue_审批list', param).then(res => { + // if(res.flag === "1"){ + // this.orderList = res.data.map(v=>{ + // return v['订单号'] + // }) + // let l = Array.from(new Set(this.orderList)) + // this.orderList = l + // }else{ + // this.orderList = [] + // } + // }) + + }, })