123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312 |
- const api = require('../../../utils/api.js');
- const login = require('../../../utils/index.js');
- const app = getApp(), {
- globalData: {
- util: {
- regeneratorRuntime,
- navigate_auth_native,
- getWeatherInfo
- }
- }
- } = app;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- district: "洛龙"
- },
- navigateTo: function (e) {
- let that = this
- let getUserInfo = login.default.getUserInfo();
- getUserInfo.then((resolve) => {
- that.data.userInfo = resolve
- if (!that.data.userInfo.id) {
- return false
- } else {
- if (that.data.userInfo.isRealname != 1) {
- wx.showToast({
- title: '请先完善用户信息',
- icon: 'none'
- })
- return false
- }
- switch (that.flag) {
- case '1':
- if (!that.data.userInfo) {
- login.default.auth()
- return false
- } else if (that.data.userInfo.identity != 0) {
- wx.showToast({
- title: '企业身份不能办理个人事项',
- icon: 'none'
- })
- return false
- }
- break;
- case '2':
- if (!that.data.userInfo) {
- login.default.auth()
- return false
- } else if (that.data.userInfo.identity != 1) {
- wx.showToast({
- title: '个人身份不能办理企业事项',
- icon: 'none'
- })
- return false
- }
- break
- }
- getApp().globalData.util.navigate_auth_native(e);
- }
- })
- },
- nav(e) {
- let that = this
- switch (that.flag) {
- case '1':
- if (!that.data.userInfo) {
- login.default.auth()
- return false
- } else if (that.data.userInfo.identity != 0) {
- wx.showToast({
- title: '请切换到个人',
- icon: 'none'
- })
- return false
- }
- break;
- case '2':
- if (!that.data.userInfo) {
- login.default.auth()
- return false
- } else if (that.data.userInfo.identity != 1) {
- wx.showToast({
- title: '请切换到法人',
- icon: 'none'
- })
- return false
- }
- break
- }
- if (that.data.userInfo.isRealname != 1) {
- wx.showToast({
- title: '请先实名',
- icon: 'none'
- })
- return false
- }
- getApp().globalData.util.navigate_auth_native(e);
- },
- inText: function (e) {
- let that = this
- let arr = []
- if (that.data.params) {
- that.data.param = that.data.params
- } else {
- that.data.params = that.data.param
- }
- for (var i = 0; i < that.data.param.length; i++) {
- if (String(that.data.param[i].serviceName).indexOf(String(e.detail.value).trim()) != -1) {
- arr.push(that.data.param[i])
- }
- }
- that.setData({
- param: arr
- })
- },
- nullText: function (e) {
- let that = this
- if (!String(e.detail.value).trim()) {
- that.setData({
- param: that.data.params ? that.data.params : that.data.param
- })
- }
- },
- /**
- * 生命周期函数--监听页面加载
- */
- async onLoad({
- id,
- scene = "",
- flag,
- preService,
- code,
- unid,
- titleName
- }) {
- let that = this
- wx.setNavigationBarTitle({
- title: titleName,
- })
- let options = {}
- options.flag = flag
- options.preService = preService
- options.code = code
- options.unid = unid
- let [pid = id, cid = 0] = scene.match(/\d{1,}/g) || []
- this.data = {
- pid,
- cid
- }
- that.req(options)
- this.setData({ weather: await getWeatherInfo() })
- },
- req: function (options) {
- let that = this
- that.flag = options.flag
- wx.showLoading({
- title: '正在加载',
- })
- wx.setStorageSync('flag', options.flag)
- var requestData = ''
- if (options.preService == 'PERSON_ZT' & options.flag == 1) {
- requestData = 'personZt'
- } else if (options.preService == 'PERSON_RSSJ' & options.flag == 1) {
- requestData = 'personRssj'
- } else if (options.preService == 'PERSON_TDRQ' & options.flag == 1) {
- requestData = 'personTdrq'
- } else if (options.preService == 'ENTERPRISE_ZT' & options.flag == 2) {
- requestData = 'enterpriseZt'
- } else if (options.preService == 'ENTERPRISE_TDDX' & options.flag == 2) {
- requestData = 'enterpriseTddx'
- } else if (options.preService == 'ENTERPRISE_JYHD' & options.flag == 2) {
- requestData = 'enterpriseJyhd'
- }
- if (options.unid) {
- wx.request({
- url: api.handles,
- data: {
- 'flag': options.flag,
- deptUnid: options.unid
- },
- method: 'GET',
- success(res) {
- wx.hideLoading()
- that.data.param = res.data.data
- that.setData({
- param: res.data.data,
- flag: options.flag
- })
- }
- })
- return false
- } else {
- wx.request({
- url: api.handles,
- data: {
- [requestData]: options.code,
- 'flag': options.flag
- },
- method: 'GET',
- success(res) {
- wx.hideLoading()
- that.data.param = res.data.data
- that.setData({
- param: res.data.data,
- flag: options.flag
- })
- }
- })
- }
- },
- nav: function (e) {
- wx.navigateTo({
- url: e.currentTarget.dataset.url,
- })
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- this.setData({
- param: this.data.params,
- searchValue: ''
- })
- wx.stopPullDownRefresh()
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function ({
- from,
- target
- }) {
- let cid = 0;
- if (from == 'button') {
- ({
- dataset: {
- cid
- }
- } = target)
- }
- return {
- title: '弹出分享时显示的分享标题',
- //imageUrl: '',
- path: `pages/handle/details/index?scene=${this.data.pid}_${cid}`
- }
- },
- setcur({
- target: {
- dataset: {
- sindex,
- url,
- docCount
- }
- }
- }) {
- sindex && this.setData({
- cur: sindex
- })
- },
- navigate_auth_native,
- })
|