[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = false"
  },
  {
    "path": ".gitignore",
    "content": "project.config.json"
  },
  {
    "path": "LICENSE",
    "content": "The GNU General Public License, Version 2, June 1991 (GPLv2)\n============================================================\n\n> Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n> 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\n\nEveryone is permitted to copy and distribute verbatim copies of this license\ndocument, but changing it is not allowed.\n\n\nPreamble\n--------\n\nThe licenses for most software are designed to take away your freedom to share\nand change it. By contrast, the GNU General Public License is intended to\nguarantee your freedom to share and change free software--to make sure the\nsoftware is free for all its users. This General Public License applies to most\nof the Free Software Foundation's software and to any other program whose\nauthors commit to using it. (Some other Free Software Foundation software is\ncovered by the GNU Lesser General Public License instead.) You can apply it to\nyour programs, too.\n\nWhen we speak of free software, we are referring to freedom, not price. Our\nGeneral Public Licenses are designed to make sure that you have the freedom to\ndistribute copies of free software (and charge for this service if you wish),\nthat you receive source code or can get it if you want it, that you can change\nthe software or use pieces of it in new free programs; and that you know you can\ndo these things.\n\nTo protect your rights, we need to make restrictions that forbid anyone to deny\nyou these rights or to ask you to surrender the rights. These restrictions\ntranslate to certain responsibilities for you if you distribute copies of the\nsoftware, or if you modify it.\n\nFor example, if you distribute copies of such a program, whether gratis or for a\nfee, you must give the recipients all the rights that you have. You must make\nsure that they, too, receive or can get the source code. And you must show them\nthese terms so they know their rights.\n\nWe protect your rights with two steps: (1) copyright the software, and (2) offer\nyou this license which gives you legal permission to copy, distribute and/or\nmodify the software.\n\nAlso, for each author's protection and ours, we want to make certain that\neveryone understands that there is no warranty for this free software. If the\nsoftware is modified by someone else and passed on, we want its recipients to\nknow that what they have is not the original, so that any problems introduced by\nothers will not reflect on the original authors' reputations.\n\nFinally, any free program is threatened constantly by software patents. We wish\nto avoid the danger that redistributors of a free program will individually\nobtain patent licenses, in effect making the program proprietary. To prevent\nthis, we have made it clear that any patent must be licensed for everyone's free\nuse or not licensed at all.\n\nThe precise terms and conditions for copying, distribution and modification\nfollow.\n\n\nTerms And Conditions For Copying, Distribution And Modification\n---------------------------------------------------------------\n\n**0.** This License applies to any program or other work which contains a notice\nplaced by the copyright holder saying it may be distributed under the terms of\nthis General Public License. The \"Program\", below, refers to any such program or\nwork, and a \"work based on the Program\" means either the Program or any\nderivative work under copyright law: that is to say, a work containing the\nProgram or a portion of it, either verbatim or with modifications and/or\ntranslated into another language. (Hereinafter, translation is included without\nlimitation in the term \"modification\".) Each licensee is addressed as \"you\".\n\nActivities other than copying, distribution and modification are not covered by\nthis License; they are outside its scope. The act of running the Program is not\nrestricted, and the output from the Program is covered only if its contents\nconstitute a work based on the Program (independent of having been made by\nrunning the Program). Whether that is true depends on what the Program does.\n\n**1.** You may copy and distribute verbatim copies of the Program's source code\nas you receive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice and\ndisclaimer of warranty; keep intact all the notices that refer to this License\nand to the absence of any warranty; and give any other recipients of the Program\na copy of this License along with the Program.\n\nYou may charge a fee for the physical act of transferring a copy, and you may at\nyour option offer warranty protection in exchange for a fee.\n\n**2.** You may modify your copy or copies of the Program or any portion of it,\nthus forming a work based on the Program, and copy and distribute such\nmodifications or work under the terms of Section 1 above, provided that you also\nmeet all of these conditions:\n\n*   **a)** You must cause the modified files to carry prominent notices stating\n    that you changed the files and the date of any change.\n\n*   **b)** You must cause any work that you distribute or publish, that in whole\n    or in part contains or is derived from the Program or any part thereof, to\n    be licensed as a whole at no charge to all third parties under the terms of\n    this License.\n\n*   **c)** If the modified program normally reads commands interactively when\n    run, you must cause it, when started running for such interactive use in the\n    most ordinary way, to print or display an announcement including an\n    appropriate copyright notice and a notice that there is no warranty (or\n    else, saying that you provide a warranty) and that users may redistribute\n    the program under these conditions, and telling the user how to view a copy\n    of this License. (Exception: if the Program itself is interactive but does\n    not normally print such an announcement, your work based on the Program is\n    not required to print an announcement.)\n\nThese requirements apply to the modified work as a whole. If identifiable\nsections of that work are not derived from the Program, and can be reasonably\nconsidered independent and separate works in themselves, then this License, and\nits terms, do not apply to those sections when you distribute them as separate\nworks. But when you distribute the same sections as part of a whole which is a\nwork based on the Program, the distribution of the whole must be on the terms of\nthis License, whose permissions for other licensees extend to the entire whole,\nand thus to each and every part regardless of who wrote it.\n\nThus, it is not the intent of this section to claim rights or contest your\nrights to work written entirely by you; rather, the intent is to exercise the\nright to control the distribution of derivative or collective works based on the\nProgram.\n\nIn addition, mere aggregation of another work not based on the Program with the\nProgram (or with a work based on the Program) on a volume of a storage or\ndistribution medium does not bring the other work under the scope of this\nLicense.\n\n**3.** You may copy and distribute the Program (or a work based on it, under\nSection 2) in object code or executable form under the terms of Sections 1 and 2\nabove provided that you also do one of the following:\n\n*   **a)** Accompany it with the complete corresponding machine-readable source\n    code, which must be distributed under the terms of Sections 1 and 2 above on\n    a medium customarily used for software interchange; or,\n\n*   **b)** Accompany it with a written offer, valid for at least three years, to\n    give any third party, for a charge no more than your cost of physically\n    performing source distribution, a complete machine-readable copy of the\n    corresponding source code, to be distributed under the terms of Sections 1\n    and 2 above on a medium customarily used for software interchange; or,\n\n*   **c)** Accompany it with the information you received as to the offer to\n    distribute corresponding source code. (This alternative is allowed only for\n    noncommercial distribution and only if you received the program in object\n    code or executable form with such an offer, in accord with Subsection b\n    above.)\n\nThe source code for a work means the preferred form of the work for making\nmodifications to it. For an executable work, complete source code means all the\nsource code for all modules it contains, plus any associated interface\ndefinition files, plus the scripts used to control compilation and installation\nof the executable. However, as a special exception, the source code distributed\nneed not include anything that is normally distributed (in either source or\nbinary form) with the major components (compiler, kernel, and so on) of the\noperating system on which the executable runs, unless that component itself\naccompanies the executable.\n\nIf distribution of executable or object code is made by offering access to copy\nfrom a designated place, then offering equivalent access to copy the source code\nfrom the same place counts as distribution of the source code, even though third\nparties are not compelled to copy the source along with the object code.\n\n**4.** You may not copy, modify, sublicense, or distribute the Program except as\nexpressly provided under this License. Any attempt otherwise to copy, modify,\nsublicense or distribute the Program is void, and will automatically terminate\nyour rights under this License. However, parties who have received copies, or\nrights, from you under this License will not have their licenses terminated so\nlong as such parties remain in full compliance.\n\n**5.** You are not required to accept this License, since you have not signed\nit. However, nothing else grants you permission to modify or distribute the\nProgram or its derivative works. These actions are prohibited by law if you do\nnot accept this License. Therefore, by modifying or distributing the Program (or\nany work based on the Program), you indicate your acceptance of this License to\ndo so, and all its terms and conditions for copying, distributing or modifying\nthe Program or works based on it.\n\n**6.** Each time you redistribute the Program (or any work based on the\nProgram), the recipient automatically receives a license from the original\nlicensor to copy, distribute or modify the Program subject to these terms and\nconditions. You may not impose any further restrictions on the recipients'\nexercise of the rights granted herein. You are not responsible for enforcing\ncompliance by third parties to this License.\n\n**7.** If, as a consequence of a court judgment or allegation of patent\ninfringement or for any other reason (not limited to patent issues), conditions\nare imposed on you (whether by court order, agreement or otherwise) that\ncontradict the conditions of this License, they do not excuse you from the\nconditions of this License. If you cannot distribute so as to satisfy\nsimultaneously your obligations under this License and any other pertinent\nobligations, then as a consequence you may not distribute the Program at all.\nFor example, if a patent license would not permit royalty-free redistribution of\nthe Program by all those who receive copies directly or indirectly through you,\nthen the only way you could satisfy both it and this License would be to refrain\nentirely from distribution of the Program.\n\nIf any portion of this section is held invalid or unenforceable under any\nparticular circumstance, the balance of the section is intended to apply and the\nsection as a whole is intended to apply in other circumstances.\n\nIt is not the purpose of this section to induce you to infringe any patents or\nother property right claims or to contest validity of any such claims; this\nsection has the sole purpose of protecting the integrity of the free software\ndistribution system, which is implemented by public license practices. Many\npeople have made generous contributions to the wide range of software\ndistributed through that system in reliance on consistent application of that\nsystem; it is up to the author/donor to decide if he or she is willing to\ndistribute software through any other system and a licensee cannot impose that\nchoice.\n\nThis section is intended to make thoroughly clear what is believed to be a\nconsequence of the rest of this License.\n\n**8.** If the distribution and/or use of the Program is restricted in certain\ncountries either by patents or by copyrighted interfaces, the original copyright\nholder who places the Program under this License may add an explicit\ngeographical distribution limitation excluding those countries, so that\ndistribution is permitted only in or among countries not thus excluded. In such\ncase, this License incorporates the limitation as if written in the body of this\nLicense.\n\n**9.** The Free Software Foundation may publish revised and/or new versions of\nthe General Public License from time to time. Such new versions will be similar\nin spirit to the present version, but may differ in detail to address new\nproblems or concerns.\n\nEach version is given a distinguishing version number. If the Program specifies\na version number of this License which applies to it and \"any later version\",\nyou have the option of following the terms and conditions either of that version\nor of any later version published by the Free Software Foundation. If the\nProgram does not specify a version number of this License, you may choose any\nversion ever published by the Free Software Foundation.\n\n**10.** If you wish to incorporate parts of the Program into other free programs\nwhose distribution conditions are different, write to the author to ask for\npermission. For software which is copyrighted by the Free Software Foundation,\nwrite to the Free Software Foundation; we sometimes make exceptions for this.\nOur decision will be guided by the two goals of preserving the free status of\nall derivatives of our free software and of promoting the sharing and reuse of\nsoftware generally.\n\n\nNo Warranty\n-----------\n\n**11.** BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR\nTHE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE\nSTATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM\n\"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,\nBUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\nPROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n**12.** IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR\nINABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA\nBEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\nFAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER\nOR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES."
  },
  {
    "path": "README.md",
    "content": "<a href=\"https://planmaster.prototype.im\"><img src=\"https://prototype.im/projects/planmaster@2x.png\" height=\"160\" align=\"right\"></a>\n\n# 套餐助手\n\n### 手机套餐对比选购小程序\n\n套餐助手是一个帮你在众多互联网套餐中选择最适合的套餐的小程序。\n\n## 赞助商\n\n<div valign=\"middle\">\n  <a href=\"https://www.duotai.net/?utm_source=planmaster&utm_medium=web&utm_campaign=planmaster-github\">\n    <img src=\"https://user-images.githubusercontent.com/978810/34824409-447c85e8-f709-11e7-813d-41c9e7f919fe.png\" alt=\"多态\" height=\"180\" />\n  </a>\n  <a href=\"https://www.duohui.co/?utm_source=planmaster&utm_medium=web&utm_campaign=planmaster-github\">\n    <img src=\"https://user-images.githubusercontent.com/978810/34824476-8fc7f4ce-f709-11e7-8f53-b10fdced0038.png\" height=\"180\"/>\n  </a>\n</div>\n\n## 立即体验\n\n![套餐助手小程序码](https://planmaster.prototype.im/minicode.jpg?fix)\n\n## 截图\n\n<img src=\"https://cdn.sspai.com/2017/11/19/a7c2965a0dfc12c27bf70859c3b9bb13.gif?imageView2/2/w/1120/q/90/interlace/1/ignore-error/1\" width=\"420\"/>\n\n## 开发使用说明\n\n1. 若未安装微信开发中者工具需先安装微信开发者工具。\n2. Clone 项目，使用微信开发者工具新建项目，选择项目目录即可。\n\n## 目录结构\n\n```\n.\n├── app.js                        // 在 onLaunch 时做一些统计相关的工作\n├── components\n│   └── sponsor                   // 广告组件，每次 onShow 时显示下一个广告\n├── pages\n│   ├── ad                        // 广告的 webview，广告的打开类型为 webview 时跳到该页面\n│   ├── changePlan                // 修改套餐页\n│   ├── detail                    // 套餐详情页\n│   ├── feedback                  // 反馈页面\n│   ├── index                     // 首页，费用计算及套餐推荐，推荐套餐按费用升序排列\n│   ├── newCard                   // 办理新卡的页面\n│   └── webview                   // 一个通用的 webview，其他网页都跳到这个页面\n├── static\n│   └── images\n└── utils\n    └── util.js                   // 工具函数，计算套餐的函数放在这里\n```\n## 项目介绍\n\n该小程序可以通过设置每月通话时间、流量等自动计算各种互联网套餐所需的费用并按照升序排列，从而帮助用户选择出最适合自己的套餐。\n\n该小程序有很多特色，比如加了很多漂亮的广告，这些广告不仅简洁漂亮，还支持多种打开方式，如跳转到另一个小程序，打开一个网页，甚至往剪贴板中写入一些内容。\n\n除此之外，得益于[多态](https://www.duotai.net/?utm_source=planmaster&utm_medium=web&utm_campaign=planmaster-github)提供的表单功能，我们收集到了很多有用的用户反馈，从而帮助我们不断改进完善，也使得我们可以及时纠正套餐信息中存在的错误。\n\n## 许可协议\n\n套餐助手小程序以附加禁止竞业限制的 GPLv2 许可证开放源代码。\n\n本项目的授权协议禁止您使用本项目源码来开发和发布与套餐助手业务相同或相近的小程序（手机套餐对比推荐）。\n"
  },
  {
    "path": "app.js",
    "content": "App({\n  onLaunch: function (opts) {\n    if (opts.referrerInfo && opts.referrerInfo.extraData && opts.referrerInfo.extraData.from) {\n      wx.reportAnalytics('adclick', {\n        from: opts.referrerInfo.extraData.from,\n      })\n    }\n    wx.setStorage({\n      key: 'showTime',\n      data: null,\n    })\n  },\n  getAds: function (cb) {\n    wx.request({\n      url: 'https://planmaster.prototype.im/ads.json',\n      success: res => {\n        const { showAd, ads } = res.data\n        let showTime = Number(wx.getStorageSync('showTime')) || 0\n        if (showAd) {\n          wx.setStorage({\n            key: 'showTime',\n            data: showTime + 1\n          })\n        }\n        const adData = {\n          showAd: showAd,\n          ads: ads,\n          ad: ads[showTime % ads.length],\n        }\n        typeof cb === 'function' && cb(adData)\n      }\n    })\n  },\n})"
  },
  {
    "path": "app.json",
    "content": "{\n  \"pages\":[\n    \"pages/index/index\",\n    \"pages/detail/detail\",\n    \"pages/newCard/newCard\",\n    \"pages/changePlan/changePlan\",\n    \"pages/feedback/feedback\",\n    \"pages/webview/webview\",\n    \"pages/ad/ad\"\n  ],\n  \"window\":{\n    \"backgroundColor\": \"#F6F6F6\",\n    \"backgroundTextStyle\":\"light\",\n    \"navigationBarBackgroundColor\": \"#F6F6F6\",\n    \"navigationBarTitleText\": \"套餐助手\",\n    \"navigationBarTextStyle\":\"black\"\n  }\n}\n"
  },
  {
    "path": "app.wxss",
    "content": "page {\n  background: #F6F6F6;\n}\nbutton {\n  margin: 15px;\n}\n.btn-group {\n  display: flex;\n  justify-content: space-between;\n  width: 100%;\n}\n.btn-group .btn:first-child {\n  margin-right: 0;\n}\n.btn {\n  flex-grow: 1;\n}\n.btn[type=\"primary\"] {\n  color: #FFF;\n  background: #1ABCFE;\n}\n.btn[type=\"default\"] {\n  color: #FFF;\n  background: #66C53A;\n}\n.input-value {\n  display: inline-block;\n  padding: 0 6px;\n  border: 1px solid #CCCCCC;\n  border-radius: 4px;\n  max-width: 3.5em;\n  font-size: 16px;\n  text-align: center;\n}\n.no-padding {\n  box-shadow: none !important;\n  padding: 0 !important;\n  margin: 20px 0 !important;\n}\n.footer {\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: space-between;\n  padding: 25px;\n}\n.footer-image image {\n  height: 32px;\n  width: 158px;\n}\n.footer-text {\n  padding-top: 10px;\n  font-size: 14px;\n  color: #A2A2A2;\n}"
  },
  {
    "path": "components/sponsor/sponsor.js",
    "content": "Component({\n  properties: {\n    // 这里定义了innerText属性，属性值可以在组件使用时指定\n    ad: {\n      type: Object,\n      value: {},\n    },\n    show: {\n      type: Boolean,\n      value: false,\n    }\n  },\n  data: {\n  },\n  methods: {\n    setSopnsorImageHeight: function (e) {\n      try {\n        const { windowWidth } = wx.getSystemInfoSync()\n        this.setData({\n          sopnsorImageHeight: (windowWidth - 30) / 3,\n        })\n      } catch (error) {\n        console.error(error)\n      }\n    },\n    goAd: function (e) {\n      const { ad } = this.data\n      const { openType } = e.currentTarget.dataset\n\n      if (openType === 'mina') {\n        wx.navigateToMiniProgram({\n          appId: ad.appId,\n          path: ad.url,\n          extraData: {\n            from: 'planmaster',\n          },\n          success(res) {\n          }\n        })\n      }\n      if (openType === 'webview') {\n        wx.navigateTo({\n          url: `/pages/ad/ad?url=${ad.url}`\n        })\n      }\n      if (openType === 'clipboard') {\n        const { text, modal: { title, content } } = ad.data\n        wx.setClipboardData({\n          data: text,\n          success: function(res) {\n            wx.showModal({\n              title: title,\n              content: content,\n              showCancel: false,\n            })\n          }\n        })\n      }\n    },\n  }\n})"
  },
  {
    "path": "components/sponsor/sponsor.json",
    "content": "{\n  \"component\": true\n}"
  },
  {
    "path": "components/sponsor/sponsor.wxml",
    "content": "<view class=\"sponsor{{ad.type === 'picture' ? ' no-padding' : ''}}\" bindtap=\"goAd\" data-open-type=\"{{ad.openType}}\">\n  <block wx:if=\"{{ad.type === 'text'}}\" >\n    <view wx:if=\"{{ad.img}}\" class=\"sponsor-column sponsor-img-box\">\n      <image class=\"sponsor-img\" src=\"{{ad.img}}\"></image>\n    </view>\n    <view class=\"sponsor-column\">\n      <view class=\"sponsor-row sponsor-title\">{{ad.title}}</view>\n      <view class=\"sponsor-row\">\n        <view class=\"sponsor-subtitle\">{{ad.subtitle}}</view>\n        <view class=\"sponsor-prompt\">广告</view>\n      </view>\n    </view>\n  </block>\n  <image wx:if=\"{{ad.type === 'picture'}}\" class=\"sponsor-picture\" src=\"{{ad.img}}\" style=\"height: {{sopnsorImageHeight}}px;\" bindload=\"setSopnsorImageHeight\"></image>\n</view>"
  },
  {
    "path": "components/sponsor/sponsor.wxss",
    "content": ".sponsor {\n  position: relative;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  padding: 15px;\n  margin: 15px 0;\n  font-size: 18px;\n  border-radius: 8px;\n  background: #FFF;\n  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);\n}\n.sponsor-row {\n  display: flex;\n  justify-content: space-between;\n  align-items: flex-end;\n  width: 100%;\n}\n.sponsor-row + .sponsor-row {\n  margin-top: 10px;\n}\n.sponsor-column {\n  display: flex;\n  flex-direction: column;\n  justify-content: center;\n  align-items: space-between;\n  align-self: stretch;\n  flex-grow: 1;\n}\n.sponsor-img-box {\n  flex-grow: 0;\n  margin-right: 10px;\n}\n.sponsor-img {\n  height: 60px;\n  width: 50px;\n}\n.sponsor-title {\n  font-size: 16px;\n}\n.sponsor-subtitle {\n  font-size: 14px;\n  color: #666666;\n}\n.sponsor-picture {\n  width: 100%;\n  border-radius: 6px;\n}\n.sponsor-prompt {\n  min-width: 2em;\n  padding: 1px 4px;\n  text-align: center;\n  font-size: 12px;\n  color: #999;\n  border: 1px solid #CCC;\n  border-radius: 4px;\n}"
  },
  {
    "path": "pages/ad/ad.js",
    "content": "const app = getApp()\n\nPage({\n  data: {\n  },\n  onLoad: function (q) {\n    this.setData({\n      url: q.url,\n    })\n  },\n  onShareAppMessage: function (res) {\n    return {\n      title: '套餐助手',\n      path: '/pages/ad/ad?url=' + this.data.url,\n    }\n  },\n})\n"
  },
  {
    "path": "pages/ad/ad.wxml",
    "content": "<web-view src=\"{{url}}\"></web-view>"
  },
  {
    "path": "pages/changePlan/changePlan.js",
    "content": "const app = getApp()\nconst serviceNumbers = {\n  '中国联通': '10010',\n  '中国电信': '10000',\n  '中国移动': '10086',\n}\n\nPage({\n  data: {\n    serviceNumbers: serviceNumbers,\n  },\n  onLoad: function (q) {\n    this.setData({\n      plan: JSON.parse(q.plan),\n    })\n  },\n  onShow: function () {\n    app.getAds(data => this.setData(data))\n  },\n  goChangePlanNow: function () {\n    wx.makePhoneCall({\n      phoneNumber: serviceNumbers[this.data.plan.operator]\n    })\n  },\n})\n"
  },
  {
    "path": "pages/changePlan/changePlan.json",
    "content": "{\n  \"navigationBarTitleText\": \"修改套餐\",\n  \"usingComponents\": {\n    \"sponsor\": \"/components/sponsor/sponsor\"\n  }\n}"
  },
  {
    "path": "pages/changePlan/changePlan.wxml",
    "content": "<view class=\"container\">\n  <view class=\"block\">\n      <view class=\"title\">如何将套餐修改为{{plan.cardName}}?</view>\n      <view class=\"content\">\n        要将套餐改为「{{plan.cardName}}」您可直接致电{{serviceNumbers[plan.operator]}}，转人工服务，请求客服帮您办理。需要注意的是老用户转套餐将不能享受新用户优惠，但是套餐中包含的免流等特权可以正常享受。\n        若客服表示无法办理或需要去营业厅办理，可用请求客服记一个需要回访的投诉，通常不久就会接到回访电话，这时一般就可以成功办理了。\n      </view>\n      <button class=\"btn\" type=\"primary\" bindtap=\"goChangePlanNow\">现在就去办理</button>\n  </view>\n  <view class=\"block\">\n    <view class=\"sponsor-block\">\n      <sponsor show=\"{{showAd}}\" ad=\"{{ad}}\"></sponsor>\n    </view>\n  </view>\n</view>"
  },
  {
    "path": "pages/changePlan/changePlan.wxss",
    "content": ".block {\n  margin: 20px;\n}\n.title {\n    margin: 15px;\n    text-align: center;\n    font-size: 24px;\n}\nbutton {\n  margin: 15px 0;\n}"
  },
  {
    "path": "pages/detail/detail.js",
    "content": "const { computeFee } = require('../../utils/util')\nconst app = getApp()\n\nPage({\n  data: {\n  },\n  onLoad: function (q) {\n    let plan = JSON.parse(q.plan)\n    const call = Number(q.call)\n    const inProvinceTraffic = Number(q.inProvinceTraffic)\n    const nationalTraffic = Number(q.nationalTraffic)\n\n    plan.price.costEstimate = computeFee(plan.price, call, inProvinceTraffic, nationalTraffic)\n    app.getAds(data => this.setData(data))\n    this.setData({\n      plan: plan,\n      call: call,\n      inProvinceTraffic: inProvinceTraffic,\n      nationalTraffic: nationalTraffic,\n    })\n  },\n  onShareAppMessage: function (res) {\n    const { plan, call, inProvinceTraffic, nationalTraffic } = this.data\n\n    return {\n      title: plan.partner + plan.cardName,\n      path: '/pages/detail/detail?plan=' + JSON.stringify(plan)\n        + '&call=' + call\n        + '&inProvinceTraffic=' + inProvinceTraffic\n        + '&nationalTraffic=' + nationalTraffic,\n    }\n  },\n  computeFee: function () {\n    let { plan, call, inProvinceTraffic, nationalTraffic } = this.data\n    plan.price.costEstimate = computeFee(plan.price, call, inProvinceTraffic, nationalTraffic)\n    this.setData({\n      plan: plan,\n    })\n  },\n  callInputChange: function (e) {\n    let call = Math.ceil(e.detail.value.match(/\\d+(?:\\.\\d+)?/))\n    this.setData({\n      call: call < 0 ? 0 : call\n    })\n    this.computeFee()\n  },\n  inProvinceTrafficInputChange: function (e) {\n    let traffic = Number(e.detail.value.match(/\\d+(?:\\.\\d+)?/)).toFixed(3)\n    this.setData({\n      inProvinceTraffic: traffic < 0 ? 0 : Number(traffic),\n    })\n    this.computeFee()\n  },\n  nationalTrafficInputChange: function (e) {\n    let traffic = Number(e.detail.value.match(/\\d+(?:\\.\\d+)?/)).toFixed(3)\n    this.setData({\n      nationalTraffic: traffic < 0 ? 0 : Number(traffic),\n    })\n    this.computeFee()\n  },\n  goChangePlan: function () {\n    wx.navigateTo({\n      url: `/pages/changePlan/changePlan?plan=${JSON.stringify(this.data.plan)}`\n    })\n  },\n  goApplyNew: function () {\n    wx.navigateTo({\n      url: `/pages/newCard/newCard?plan=${JSON.stringify(this.data.plan)}`\n    })\n  },\n  goFeedback: function () {\n    wx.navigateTo({\n      url: `/pages/feedback/feedback?plan=${JSON.stringify(this.data.plan)}`\n    })\n  },\n  goPrototype: function () {\n    wx.navigateTo({\n      url: `/pages/webview/webview?url=https://prototype.im/`\n    })\n  },\n})\n"
  },
  {
    "path": "pages/detail/detail.json",
    "content": "{\n  \"navigationBarTitleText\": \"套餐详情\",\n  \"usingComponents\": {\n    \"sponsor\": \"/components/sponsor/sponsor\"\n  }\n}"
  },
  {
    "path": "pages/detail/detail.wxml",
    "content": "<wxs module=\"m\">\n  var splitFee = function (fee) {\n    if (typeof fee === 'string') {\n      fee = fee.split('.')\n    } else {\n      fee = ['00', '00']\n    }\n    return {\n      feeBig: fee[0],\n      feeSmall: fee[1]\n    }\n  }\n  module.exports.splitFee = splitFee\n</wxs>\n<view class=\"container\">\n  <view class=\"block\">\n    <view class=\"block-row\">\n      <view class=\"block-title\">\n        <text>{{plan.cardName}}</text>\n        <text class=\"block-subtitle\">{{plan.price.condition}}</text>\n      </view>\n    </view>\n    <view class=\"block-row\">\n      <view class=\"block-column\">\n        {{plan.partner}} × <image wx:if=\"{{plan.operator === '中国联通'}}\" class=\"row-icon row-inline-icon\" src=\"/static/images/unicom.svg\"></image><image wx:elif=\"{{plan.operator === '中国电信'}}\" class=\"row-icon row-inline-icon\" src=\"/static/images/telecom.svg\"></image>{{plan.operator}}\n      </view>\n      <view class=\"block-column\">\n        <text>月租<text class=\"monthly-fee\">{{plan.price.monthlyFee}}</text>元</text>\n      </view>\n    </view>\n    <view class=\"block-divider\"></view>\n    <view class=\"block-row\">\n      <view class=\"block-column text-big\"><image class=\"row-icon\" src=\"/static/images/phone.svg\"></image>套餐内通话</view>\n      <view class=\"block-column\" wx:if=\"{{plan.price.callInplan >= 99999}}\">全国不限量</view>\n      <view class=\"block-column\" wx:else><text class=\"block-value\">{{plan.price.callInplan}}</text>分钟</view>\n    </view>\n    <view class=\"block-row\">\n      <view class=\"block-column text-big icon-offset\">套餐外通话</view>\n      <view class=\"block-column\"><text class=\"block-value\">{{plan.price.callOutPlanPrice}}</text>元每分钟</view>\n    </view>\n    <view class=\"block-divider\"></view>\n    <view class=\"block-row\">\n      <view class=\"block-column text-big\"><image class=\"row-icon\" src=\"/static/images/traffic.svg\"></image>套餐内流量</view>\n      <view class=\"block-column\">\n        <view wx:if=\"{{plan.price.trafficInPlan.national >= 99999}}\">\n          <view >全国不限量</view>\n        </view>\n        <view wx:elif=\"{{plan.price.trafficInPlan.inProvince >= 99999}}\">\n          <view>省内不限量</view>\n        </view>\n        <view wx:else>\n          <text>省内<text class=\"block-value\">{{plan.price.trafficInPlan.inProvince ?  plan.price.trafficInPlan.inProvince : '无'}}</text>{{plan.price.trafficInPlan.inProvince ? 'GB' : ''}} </text><text>全国<text class=\"block-value\">{{plan.price.trafficInPlan.national ?  plan.price.trafficInPlan.national : '无'}}</text>{{plan.price.trafficInPlan.national ? 'GB' : ''}}</text>\n        </view>\n      </view>\n    </view>\n    <view class=\"block-row multi-row\">\n      <view class=\"block-column text-big icon-offset\">套餐外流量</view>\n      <view class=\"block-column\">\n        <view class=\"align-right\">\n          <view wx:if=\"{{!plan.price.trafficOutPlanPrice.inProvince}}\">省内<text class=\"block-value\">无</text></view>\n          <view wx:elif=\"{{!plan.price.trafficOutPlanPrice.inProvince.daily && plan.price.trafficOutPlanPrice.inProvince.quantity >= 99999}}\">省内不限量</view>\n          <view wx:elif=\"{{plan.price.trafficOutPlanPrice.inProvince.daily && plan.price.trafficOutPlanPrice.inProvince.quantity >= 99999}}\">省内日租<text class=\"block-value\">{{plan.price.trafficOutPlanPrice.inProvince.price}}</text>元每天不限量</view>\n          <view wx:else>省内{{plan.price.trafficOutPlanPrice.inProvince.daily ? '日租' : '月租'}}<text class=\"block-value\">{{plan.price.trafficOutPlanPrice.inProvince.price}}</text>元每 {{plan.price.trafficOutPlanPrice.inProvince.quantity + ' GB'}}</view>\n          <view wx:if=\"{{!plan.price.trafficOutPlanPrice.national}}\">全国<text class=\"block-value\">无</text></view>\n          <view wx:elif=\"{{plan.price.trafficOutPlanPrice.national.quantity >= 99999}}\">全国不限量</view>\n          <view wx:else>全国{{plan.price.trafficOutPlanPrice.national.daily ? '日租' : '月租'}}<text class=\"block-value\">{{plan.price.trafficOutPlanPrice.national.price}}</text>元每 {{plan.price.trafficOutPlanPrice.national.quantity +' GB'}}</view>\n        </view>\n      </view>\n    </view>\n    <view class=\"block-divider\"></view>\n    <view class=\"block-row\">\n      <view class=\"block-column text-big\">\n        <image class=\"row-icon\" src=\"/static/images/privilege.svg\"></image>特权\n      </view>\n    </view>\n    <view class=\"block-row privilege\">\n      <view class=\"block-column icon-offset\">\n        {{plan.privilege}}\n      </view>\n    </view>\n  </view>\n  <view class=\"title\">\n    费用预估\n    <view class=\"subtitle\">请填写您的预计使用量，我可以为您计算预计费用</view>\n  </view>\n  <view class=\"block\">\n    <view class=\"block-row\">\n      <view class=\"block-column text-big\"><image class=\"row-icon\" src=\"/static/images/phone.svg\"></image>通话时间</view>\n      <view class=\"block-column\">\n        <view class=\"input-wrapper\">\n          <view class=\"input-value\">\n            <input type=\"digit\" value=\"{{call}}\" bindblur=\"callInputChange\"/>\n          </view>\n          <view class=\"input-unit\">分钟</view>\n        </view>\n      </view>\n    </view>\n    <view class=\"block-row\">\n      <view class=\"block-column text-big\"><image class=\"row-icon\" src=\"/static/images/traffic.svg\"></image>省内流量</view>\n      <view class=\"block-column\">\n        <view class=\"input-wrapper\">\n          <view class=\"input-value\">\n            <input type=\"digit\" value=\"{{inProvinceTraffic}}\" bindblur=\"inProvinceTrafficInputChange\"/>\n          </view>\n          <view class=\"input-unit\">GB</view>\n        </view>\n      </view>\n    </view>\n    <view class=\"block-row\">\n      <view class=\"block-column text-big\"><image class=\"row-icon\" src=\"/static/images/briefcase.svg\"></image>省外流量</view>\n      <view class=\"block-column\">\n        <view class=\"input-wrapper\">\n          <view class=\"input-value\">\n            <input type=\"digit\" value=\"{{nationalTraffic}}\" bindblur=\"nationalTrafficInputChange\"/>\n          </view>\n          <view class=\"input-unit\">GB</view>\n        </view>\n      </view>\n    </view>\n    <view class=\"block-divider\"></view>\n    <view class=\"block-row text-big\">\n      <view class=\"block-column\">预计费用</view>\n      <view class=\"block-column\">\n        <text class=\"fee-value\">\n        <text class=\"fee-value-big\">{{m.splitFee(plan.price.costEstimate.totalFee).feeBig}}</text>.{{m.splitFee(plan.price.costEstimate.totalFee).feeSmall}}</text>元\n      </view>\n    </view>\n    <view class=\"sub-fee\">\n      <view class=\"block-row\">\n        <view class=\"block-column\">月租</view>\n        <view class=\"block-column\">\n          <text>\n          <text class=\"fee-value-big\">{{m.splitFee(plan.price.costEstimate.monthlyFee).feeBig}}</text>.{{m.splitFee(plan.price.costEstimate.monthlyFee).feeSmall}}</text>元\n        </view>\n      </view>\n      <view class=\"block-row\">\n        <view class=\"block-column\">通话</view>\n        <view class=\"block-column\">\n          <text>\n          <text class=\"fee-value-big\">{{m.splitFee(plan.price.costEstimate.callFee).feeBig}}</text>.{{m.splitFee(plan.price.costEstimate.callFee).feeSmall}}</text>元\n        </view>\n      </view>\n      <view class=\"block-row\">\n        <view class=\"block-column\">流量</view>\n        <view class=\"block-column\">\n          <text>\n          <text class=\"fee-value-big\">{{m.splitFee(plan.price.costEstimate.trafficFee).feeBig}}</text>.{{m.splitFee(plan.price.costEstimate.trafficFee).feeSmall}}</text>元\n        </view>\n      </view>\n    </view>\n\n  </view>\n  <view class=\"btn-group\">\n    <button class=\"btn\" type=\"primary\" bindtap=\"goApplyNew\">办卡指南</button>\n    <button class=\"btn\" type=\"default\" bindtap=\"goChangePlan\">老用户指南</button>\n  </view>\n  <view class=\"block block-no-style\">\n    <view class=\"sponsor-block\">\n      <sponsor show=\"{{showAd}}\" ad=\"{{ad}}\"></sponsor>\n    </view>\n  </view>\n\n  <view class=\"footer\">\n    <view class=\"footer-image\" bindtap=\"goPrototype\">\n      <image mode=\"aspectFit\" src=\"https://prototype.im/badge@2x.png\"></image>\n    </view>\n    <view class=\"footer-text\" bindtap=\"goFeedback\">反馈问题</view>\n  </view>\n</view>\n"
  },
  {
    "path": "pages/detail/detail.wxss",
    "content": ".block {\n  margin: 18px;\n  background: #FFF;\n  font-size: 14px;\n  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);\n  border-radius: 8px;\n}\n.block-no-style {\n  background: none;\n  box-shadow: none;\n  border-radius: none;\n}\n.block-row {\n  display: flex;\n  justify-content: space-between;\n  margin: 15px;\n  padding: 0 10px;\n}\n.block-row:first-child {\n  padding-top: 20px;\n}\n.block-row:last-child {\n  padding-bottom: 20px;\n}\n.multi-row {\n  align-items: flex-start;\n}\n.text-big {\n  font-size: 16px;\n}\n.block-column {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  line-height: 28px;\n  vertical-align: middle;\n}\n.block-divider {\n  height: 2px;\n  width: calc(100% - 40px);\n  margin: 0 20px;\n  background: rgba(0, 0, 0, 0.04);\n  border-radius: 20px;\n}\n.row-icon {\n  margin-right: 8px;\n  height: 1em;\n  width: 1.2em;\n}\n.row-inline-icon {\n  margin: 0 8px;\n}\n.icon-offset {\n  margin-left: calc(1.2em + 8px);\n}\n.input-unit {\n  margin-left: 1em;\n  color: #666;\n}\n.title {\n  margin: 25px 18px;\n  font-size: 20px;\n}\n.subtitle {\n  margin-top: 15px;\n  font-size: 14px;\n  color: #666;\n}\n.block-title {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  width: 100%;\n  font-size: 20px;\n}\n.block-subtitle {\n  margin-left: 25px;\n  text-align: right;\n  font-size: 12px;\n  color: #FF983C;\n}\n.block-value {\n  margin: 0 6px;\n  font-size: 20px;\n}\n.align-right {\n  text-align: right;\n}\n.sub-fee {\n  border-top: 1px solid #EEEEEE;\n  background: #FAFAFA;\n  border-radius: 8px;\n}\n.sub-fee .block-row {\n  padding-top: 0;\n}\n.monthly-fee {\n  margin: 0 6px;\n  font-size: 24px;\n  color: #29AE60;\n  vertical-align: baseline;\n}\n.input-wrapper {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  width: 8em;\n}\n.privilege {\n  font-size: 14px;\n  color: #27AE60;\n}\n.fee-value {\n  margin: 0 5px;\n  color: #29AE60;\n}\n.fee-value-big {\n  font-size: 20px;\n}"
  },
  {
    "path": "pages/feedback/feedback.js",
    "content": "const app = getApp()\n\nPage({\n  data: {\n  },\n  onLoad: function (q) {\n    try {\n      let sysInfo = encodeURIComponent(JSON.stringify(wx.getSystemInfoSync()))\n      let plan = q.plan && JSON.parse(q.plan)\n      this.setData({\n        url: `https://i.duotai.co/forms/dkyqo?${sysInfo ? 'appVersion=' + sysInfo : ''}${plan ? '&plan=' + encodeURIComponent(plan.partner + plan.cardName) : ''}`\n      })\n    } catch (error) {\n      console.error(error)\n    }\n  },\n})\n"
  },
  {
    "path": "pages/feedback/feedback.json",
    "content": "{\n  \"navigationBarTitleText\": \"套餐助手反馈\"\n}"
  },
  {
    "path": "pages/feedback/feedback.wxml",
    "content": "<web-view src=\"{{url}}\"></web-view>"
  },
  {
    "path": "pages/index/index.js",
    "content": "const { computeFee } = require('../../utils/util')\nconst app = getApp()\nlet plans\nconst calls = [0, 50, 100, 200, 300, 500, 700, 1000, 1500, 2000, 2500, 3000]\nconst traffics = [0, 0.01, 0.02, 0.05, 0.2, 0.5, 0.7, 1, 2, 3, 5, 10, 20, 50, 100, 200]\nconst shareImage = 'https://planmaster.prototype.im/share_image.png'\nlet shareImageDownloaded = false\n\nPage({\n  data: {\n    call: calls[1],\n    callSlider: 1,\n    traffic: traffics[7],\n    trafficSlider: 7,\n    trafficPerDay: traffics[7] / 30,\n    freeTraffic: false,\n    outProvinceDay: 0,\n    operators: [\n      {\n        show: true,\n        name: '联通',\n        checked: true,\n        img: '/static/images/unicom.svg',\n      },\n      {\n        show: true,\n        name: '电信',\n        checked: false,\n        img: '/static/images/telecom.svg',\n      },\n      {\n        show: true,\n        name: '移动',\n        checked: false,\n        img: '/static/images/cmcom.png',\n      },\n    ],\n    selectedOperators: ['中国联通'],\n    plans: [\n      {\n        \"operator\": \"中国联通\",\n        \"partner\": \"腾讯\",\n        \"cardName\": \"大王卡\",\n        \"guideUrl\": \"https://planmaster.prototype.im/tencent\",\n        \"price\": {\n            \"monthlyFee\": 19,\n            \"trafficInPlan\": {\n                \"national\": 0,\n                \"inProvince\": 0\n            },\n            \"callInplan\": 0,\n            \"callOutPlanPrice\": 0.1,\n            \"trafficOutPlanPrice\": {\n                \"national\": {\n                    \"daily\": true,\n                    \"price\": 2,\n                    \"quantity\": 0.5\n                },\n                \"inProvince\": {\n                    \"daily\": true,\n                    \"price\": 1,\n                    \"quantity\": 0.5\n                }\n            }\n        },\n        \"privilege\": \"腾讯视频、王者荣耀等腾讯系应用及游戏免流，斗鱼等直播免流\",\n        \"description\": \"腾讯系应用及游戏免流，熊猫等直播免流\"\n      },\n      {\n        \"operator\": \"中国联通\",\n        \"partner\": \"蚂蚁金服\",\n        \"cardName\": \"大宝卡\",\n        \"guideUrl\": \"https://planmaster.prototype.im/alipay\",\n        \"price\": {\n            \"monthlyFee\": 36,\n            \"condition\": \"满一年或预存200\",\n            \"trafficInPlan\": {\n                \"national\": 3,\n                \"inProvince\": 0\n            },\n            \"callInplan\": 200,\n            \"callOutPlanPrice\": 0.1,\n            \"trafficOutPlanPrice\": {\n                \"national\": {\n                    \"daily\": false,\n                    \"price\": 10,\n                    \"quantity\": 1\n                },\n                \"inProvince\": null\n            }\n        },\n        \"privilege\": \"线下买单送流量。2017年11月起，全系每月+3元可享优酷视频免流（视频广告也免流，缓存下载不免流）\",\n        \"description\": \"送流量，优酷视频免流\"\n      },\n      {\n        \"operator\": \"中国联通\",\n        \"partner\": \"百度\",\n        \"cardName\": \"小圣卡\",\n        \"guideUrl\": \"https://planmaster.prototype.im/sheng\",\n        \"price\": {\n            \"monthlyFee\": 9,\n            \"trafficInPlan\": {\n                \"national\": 0.1,\n                \"inProvince\": 0\n            },\n            \"callInplan\": 0,\n            \"callOutPlanPrice\": 0.1,\n            \"trafficOutPlanPrice\": {\n                \"inProvince\": {\n                    \"daily\": true,\n                    \"price\": 1,\n                    \"quantity\": 0.8\n                },\n                \"national\": {\n                    \"daily\": false,\n                    \"price\": 15,\n                    \"quantity\": 1\n                }\n            }\n        },\n        \"privilege\": \"手机百度、百度贴吧、百度地图、爱奇艺、好看视频等APP免流量\",\n        \"description\": \"百度系APP免流量\"\n      },\n      {\n        \"operator\": \"中国联通\",\n        \"partner\": \"哔哩哔哩\",\n        \"cardName\": \"33卡\",\n        \"guideUrl\": \"https://planmaster.prototype.im/bilibili\",\n        \"price\": {\n            \"monthlyFee\": 33,\n            \"condition\": \"满一年或预存200元\",\n            \"trafficInPlan\": {\n                \"national\": 2,\n                \"inProvince\": 0\n            },\n            \"callInplan\": 100,\n            \"callOutPlanPrice\": 0.1,\n            \"trafficOutPlanPrice\": {\n                \"national\": {\n                    \"daily\": true,\n                    \"price\": 1,\n                    \"quantity\": 0.5\n                },\n                \"inProvince\": null\n            }\n        },\n        \"privilege\": \"哔哩哔哩免流\",\n        \"description\": \"哔哩哔哩免流\"\n      },\n      {\n        \"operator\": \"中国联通\",\n        \"partner\": \"网易\",\n        \"cardName\": \"大白金卡\",\n        \"guideUrl\": \"https://planmaster.prototype.im/wangyi\",\n        \"price\": {\n            \"monthlyFee\": 19,\n            \"trafficInPlan\": {\n                \"national\": 1,\n                \"inProvince\": 0\n            },\n            \"callInplan\": 100,\n            \"callOutPlanPrice\": 0.1,\n            \"trafficOutPlanPrice\": {\n                \"inProvince\": {\n                    \"daily\": true,\n                    \"price\": 1,\n                    \"quantity\": 0.8\n                },\n                \"national\": {\n                    \"daily\": true,\n                    \"price\": 2,\n                    \"quantity\": 0.8\n                }\n            }\n        },\n        \"privilege\": \"网易系应用游戏全免流\",\n        \"description\": \"网易系应用游戏全免流\"\n      },\n    ]\n  },\n  onShow: function () {\n    wx.request({\n      url: 'https://planmaster.prototype.im',\n      success: res => {\n        plans = typeof res.data === 'object' ? res.data : this.data.plans\n        let { operators } = this.data\n\n        operators = plans.some(p => p.operator === '中国移动') ? operators : operators.filter(o => o.name !== '移动')\n        this.setData({\n          plans: plans,\n          operators: operators,\n        })\n        this.recommendPlan(plans)\n      }\n    })\n    app.getAds(data => this.setData(data))\n  },\n  onShareAppMessage: function (res) {\n    return {\n      title: '套餐助手',\n      path: '/pages/index/index',\n    }\n  },\n  recommendPlan: function (plans) {\n    const { call, traffic, outProvinceDay, selectedOperators } = this.data\n    const inProvinceTraffic = traffic * (30 - outProvinceDay) / 30\n    const nationalTraffic = traffic * outProvinceDay / 30\n    let recommendedPlans = plans\n      .filter(p => selectedOperators.includes(p.operator))\n      .map(plan => {\n        plan.price.costEstimate = computeFee(plan.price, call, inProvinceTraffic, nationalTraffic)\n\n        return plan\n      })\n      .sort((a, b) => a.price.costEstimate.totalFee - b.price.costEstimate.totalFee)\n    if (selectedOperators.includes('中国联通') && recommendedPlans[0] && recommendedPlans[0].price.costEstimate.totalFee > 150) {\n      const icecream = recommendedPlans.find(p => p.cardName === '芝麻冰激凌')\n      recommendedPlans = recommendedPlans.filter(p => p.cardName !== '芝麻冰激凌')\n      recommendedPlans.unshift(icecream)\n    }\n    this.setData({\n      recommendedGreatPlans: recommendedPlans.slice(0, 1),\n      recommendedGoodPlans: recommendedPlans.slice(1, 3),\n      recommendedOtherPlans: recommendedPlans.slice(3),\n    })\n  },\n  callSliderChange: function (e) {\n    const callSlider = Number(e.detail.value)\n    this.setData({\n      callSlider: callSlider,\n      call: calls[Number(e.detail.value)],\n    })\n    this.recommendPlan(plans)\n  },\n  callSliderChaning: function (e) {\n    this.setData({\n      call: calls[Number(e.detail.value)],\n    })\n  },\n  callInputChange: function (e) {\n    let call = Math.ceil(e.detail.value.match(/\\d+(?:\\.\\d+)?/))\n    this.setData({\n      call: call < 0 ? 0 : call\n    })\n    this.recommendPlan(plans)\n  },\n  trafficSliderChange: function (e) {\n    const trafficSlider = Number(e.detail.value)\n    this.setData({\n      trafficSlider: trafficSlider,\n      traffic: traffics[Number(e.detail.value)],\n      trafficPerDay: traffics[Number(e.detail.value)] / 30,\n    })\n    this.recommendPlan(plans)\n  },\n  trafficSliderChanging: function (e) {\n    this.setData({\n      traffic: traffics[Number(e.detail.value)],\n    })\n  },\n  trafficInputChange: function (e) {\n    let traffic = Number(e.detail.value.match(/\\d+(?:\\.\\d+)?/)).toFixed(3)\n    this.setData({\n      traffic: traffic < 0 ? 0 : Number(traffic),\n    })\n    this.recommendPlan(plans)\n  },\n  outProvinceDaySliderChange: function (e) {\n    this.setData({\n      outProvinceDay: Number(e.detail.value),\n    })\n    this.recommendPlan(plans)\n  },\n  outProvinceDaySliderChanging: function (e) {\n    this.setData({\n      outProvinceDay: Number(e.detail.value),\n    })\n  },\n  outProvinceDayInputChange: function (e) {\n    let outProvinceDay = Number(e.detail.value.match(/\\d+(?:\\.\\d+)?/))\n    outProvinceDay = outProvinceDay > 30 ? 30 : outProvinceDay < 0 ? 0 : outProvinceDay\n    this.setData({\n      outProvinceDay: outProvinceDay,\n    })\n    this.recommendPlan(plans)\n  },\n  goOutChange: function (e) {\n    this.setData({\n      goOutFrequently: e.detail.value === 'yes',\n    })\n  },\n  freeTrafficChange: function (e) {\n    this.setData({\n      freeTraffic: e.detail.value === 'yes',\n    })\n    this.recommendPlan(plans)\n  },\n  applyModeChange: function (e) {\n    this.setData({\n      applyMode: e.detail.value,\n    })\n    this.recommendPlan(plans)\n  },\n  onOperatorChange: function (e) {\n    const { index, checked } = e.currentTarget.dataset\n    let { operators, selectedOperators } = this.data\n    operators[index].checked = !checked\n    selectedOperators = operators.filter(o => o.checked).map(o => '中国' + o.name)\n\n    this.setData({\n      operators: operators,\n      selectedOperators: selectedOperators,\n    })\n    this.recommendPlan(plans)\n  },\n  previewShareImage: function () {\n    wx.previewImage({\n      current: shareImage,\n      urls: [shareImage],\n    })\n  },\n  getShareImage: function () {\n    const showSuccessModal = () => {\n      wx.showModal({\n        title: '分享图片保存成功',\n        content: '分享图片已经保存到相册，请在朋友圈点击选择相册中的图片然后进行分享。',\n      })\n    }\n    const showFailModal = () => {\n      wx.showModal({\n        title: '保存失败',\n        content: '请尝试手动保存。',\n        showCancel: false,\n        success: () => {\n          this.previewShareImage()\n        }\n      })\n    }\n    const saveImage = () => {\n      wx.showLoading()\n      wx.downloadFile({\n        header: {\n          'Accept': 'image/*'\n        },\n        url: shareImage,\n        success: res => {\n          console.log('download success')\n          wx.hideLoading()\n          if (res.statusCode !== 200) {\n            showFailModal()\n            return\n          }\n          wx.saveImageToPhotosAlbum({\n            filePath: res.tempFilePath,\n            success: () => {\n              shareImageDownloaded = true\n              showSuccessModal()\n            },\n            fail: res => {\n              showFailModal()\n            },\n            complete: () => {\n            }\n          })\n        },\n      })\n    }\n    if (shareImageDownloaded) {\n      showSuccessModal()\n      return\n    }\n    wx.getSetting({\n      success: (res) => {\n        if (res.authSetting[\"scope.writePhotosAlbum\"] === undefined) {\n          wx.showModal({\n            title: '需要图片保存权限',\n            content: '我们需要保存图片到系统相册的权限，以保存分享图片，请在弹出的授权框中选择允许。',\n            showCancel: false,\n            success: () => {\n              saveImage()\n            }\n          })\n        } else {\n          saveImage()\n        }\n      }\n    })\n\n  },\n  goDetail: function (e) {\n    const { call, traffic, outProvinceDay, recommendedGreatPlans, recommendedGoodPlans, recommendedOtherPlans } = this.data\n    const inProvinceTraffic = traffic * (30 - outProvinceDay) / 30\n    const nationalTraffic = traffic * outProvinceDay / 30\n    const { index, type } = e.currentTarget.dataset\n    let plans\n\n    switch (type) {\n      case 'great':\n        plans =recommendedGreatPlans\n        break\n      case 'good':\n        plans =recommendedGoodPlans\n        break\n      case 'other':\n        plans =recommendedOtherPlans\n        break\n      default:\n        break\n    }\n    const plan = plans[index]\n    if (plan.operator === '中国移动') {\n      wx.navigateTo({\n        url: '/pages/webview/webview?url=' + plan.guideUrl,\n      })\n    } else {\n      wx.navigateTo({\n        url: '/pages/detail/detail?plan='\n          + JSON.stringify(plan)\n          + '&call=' + call\n          + '&inProvinceTraffic=' + inProvinceTraffic\n          + '&nationalTraffic=' + nationalTraffic\n      })\n    }\n\n  },\n  goFeedback: function () {\n    wx.navigateTo({\n      url: `/pages/feedback/feedback`\n    })\n  },\n  goPrototype: function () {\n    wx.navigateTo({\n      url: `/pages/webview/webview?url=https://prototype.im/`\n    })\n  },\n})\n"
  },
  {
    "path": "pages/index/index.json",
    "content": "{\n  \"usingComponents\": {\n    \"sponsor\": \"/components/sponsor/sponsor\"\n  }\n}"
  },
  {
    "path": "pages/index/index.wxml",
    "content": "<wxs module=\"m\">\n    var splitFee = function (fee) {\n      if (typeof fee === 'string') {\n        fee = fee.split('.')\n      } else {\n        fee = ['00', '00']\n      }\n      return {\n        feeBig: fee[0],\n        feeSmall: fee[1]\n      }\n    }\n    module.exports.splitFee = splitFee;\n  </wxs>\n<view class=\"container\">\n  <view class=\"block\">\n    <view class=\"block-title\">\n      使用量设置\n      <view class=\"block-subtitle\">您一般每个月使用多少通话和流量？</view>\n    </view>\n    <view class=\"block-content\">\n      <view class=\"block-item column\">\n        <view class=\"item-row slider-box\">\n          <view class=\"item-title\"><image class=\"item-title-icon\" src=\"/static/images/phone.svg\" />每月平均通话时间</view>\n          <view class=\"input-unit\">分钟</view>\n        </view>\n        <view class=\"item-row\">\n          <slider class=\"slider\" bindchanging=\"callSliderChaning\" bindchange=\"callSliderChange\" value=\"{{callSlider}}\" max=\"11\" step=\"1\"/>\n          <view class=\"input-value\">\n            <input type=\"digit\" value=\"{{callSlider === 11 ? call + ' +': call}}\" bindblur=\"callInputChange\"/>\n          </view>\n        </view>\n      </view>\n      <view class=\"block-item column\">\n        <view class=\"item-row slider-box\">\n          <view class=\"item-title\"><image class=\"item-title-icon\" src=\"/static/images/traffic.svg\" />每月平均流量使用</view>\n          <view class=\"input-unit\">GB</view>\n        </view>\n        <view class=\"item-row\">\n          <slider class=\"slider\" bindchanging=\"trafficSliderChanging\" bindchange=\"trafficSliderChange\" value=\"{{trafficSlider}}\" max=\"15\" step=\"1\"/>\n          <view class=\"input-value\">\n            <input type=\"digit\" value=\"{{trafficSlider === 15 ? traffic + ' +': traffic}}\" bindblur=\"trafficInputChange\"/>\n          </view>\n        </view>\n      </view>\n      <view class=\"block-item column\">\n        <view class=\"item-row slider-box\">\n          <view class=\"item-title\"><image class=\"item-title-icon\" src=\"/static/images/briefcase.svg\" />每月在省外的时间</view>\n          <view class=\"input-unit\">天</view>\n        </view>\n        <view class=\"item-row\">\n          <slider class=\"slider\" bindchanging=\"outProvinceDaySliderChanging\" bindchange=\"outProvinceDaySliderChange\" max=\"30\" step=\"1\"/>\n          <view class=\"input-value\">\n            <input type=\"digit\" value=\"{{outProvinceDay}}\" bindblur=\"outProvinceDayInputChange\"/>\n          </view>\n        </view>\n      </view>\n    </view>\n  </view>\n  <view class=\"block plan\">\n    <view class=\"block-title\">\n      推荐套餐\n      <view class=\"block-subtitle\">以下是我根据您选择的使用量为您推荐的套餐</view>\n    </view>\n    <view class=\"operator\">\n      <view class=\"operator-item\" bindtap=\"onOperatorChange\" wx:for=\"{{operators}}\" wx:key=\"{{item.name}}\" data-index=\"{{index}}\" data-checked=\"{{item.checked}}\">\n        <view class=\"operator-name\">\n          <image class=\"operator-icon operator-icon-inline\" src=\"{{item.img}}\"></image><text class=\"operator-text\">{{item.name}}</text>\n        </view>\n        <image wx:if=\"{{item.checked}}\" class=\"operator-icon operator-icon-big\" src=\"/static/images/circle-checked.svg\"></image>\n        <image wx:else class=\"operator-icon operator-icon-big\" src=\"/static/images/circle.svg\"></image>\n      </view>\n    </view>\n    <view class=\"block-item\" wx:for=\"{{recommendedGreatPlans}}\" data-index=\"{{index}}\" data-type=\"great\" bindtap=\"goDetail\">\n      <view class=\"item-column\">\n        <view class=\"plan-name\">\n          <image wx:if=\"{{index === 0}}\" class=\"plan-rank-icon\" src=\"/static/images/gold-medal.svg\"></image>\n          <text>{{item.cardName}}</text>\n        </view>\n        <view class=\"plan-partner-name\">{{item.partner}}</view>\n      </view>\n      <view class=\"plan-fee\">\n        <view wx:if=\"{{item.price.condition}}\" class=\"condition\">{{item.price.condition}}</view>\n        <view class=\"normal-fee\">约<text class=\"fee-value{{index === 0 ? ' recommanded' : ''}}\">\n          <text class=\"fee-value-big\">{{m.splitFee(item.price.costEstimate.totalFee).feeBig}}</text>.{{m.splitFee(item.price.costEstimate.totalFee).feeSmall}}</text>元／月\n        </view>\n        <view wx:if=\"{{item.description && item.description !== '无'}}\" class=\"discounted-fee\">{{item.description}}</view>\n      </view>\n    </view>\n    <sponsor show=\"{{showAd}}\" ad=\"{{ad}}\"></sponsor>\n    <view class=\"block-item\" wx:for=\"{{recommendedGoodPlans}}\" data-index=\"{{index}}\" data-type=\"good\" bindtap=\"goDetail\">\n      <view class=\"item-column\">\n        <view class=\"plan-name\">\n          <image wx:if=\"{{index === 0}}\" class=\"plan-rank-icon\" src=\"/static/images/silver-medal.svg\"></image>\n          <image wx:if=\"{{index === 1}}\" class=\"plan-rank-icon\" src=\"/static/images/copper-medal.svg\"></image>\n          <text>{{item.cardName}}</text>\n        </view>\n        <view class=\"plan-partner-name\">{{item.partner}}</view>\n      </view>\n      <view class=\"plan-fee\">\n        <view wx:if=\"{{item.price.condition}}\" class=\"condition\">{{item.price.condition}}</view>\n        <view class=\"normal-fee\">约<text class=\"fee-value{{index === 0 ? ' recommanded' : ''}}\">\n          <text class=\"fee-value-big\">{{m.splitFee(item.price.costEstimate.totalFee).feeBig}}</text>.{{m.splitFee(item.price.costEstimate.totalFee).feeSmall}}</text>元／月\n        </view>\n        <view wx:if=\"{{item.description && item.description !== '无'}}\" class=\"discounted-fee\">{{item.description}}</view>\n      </view>\n    </view>\n    <view class=\"block-item share\">\n      <view class=\"item-column\">\n        <view class=\"item-row\">\n          <view class=\"sponsor-title\">将套餐助手分享给家人和朋友</view>\n        </view>\n        <view class=\"item-row\">\n          <view class=\"sponsor-subtitle\">好东西当然要分享给大家！</view>\n        </view>\n        <view class=\"item-row\">\n          <view class=\"btn-group\">\n            <button class=\"btn share-btn\" open-type=\"share\" type=\"primary\" bindtap=\"goApplyNew\">转发分享</button>\n            <button class=\"btn share-btn\" type=\"default\" bindtap=\"getShareImage\">👯 朋友圈分享</button>\n          </view>\n        </view>\n      </view>\n    </view>\n    <view class=\"block-item\" wx:for=\"{{recommendedOtherPlans}}\" wx:key=\"{{item.cardName}}\" data-index=\"{{index}}\" data-type=\"other\" bindtap=\"goDetail\">\n      <view class=\"item-column\">\n        <view class=\"plan-name\">\n          <text>{{item.cardName}}</text>\n        </view>\n        <view class=\"plan-partner-name\">{{item.partner}}</view>\n      </view>\n      <view class=\"plan-fee\">\n        <view wx:if=\"{{item.price.condition}}\" class=\"condition\">{{item.price.condition}}</view>\n        <view class=\"normal-fee\">约<text class=\"fee-value{{index === 0 ? ' recommanded' : ''}}\">\n          <text class=\"fee-value-big\">{{m.splitFee(item.price.costEstimate.totalFee).feeBig}}</text>.{{m.splitFee(item.price.costEstimate.totalFee).feeSmall}}</text>元／月\n        </view>\n        <view wx:if=\"{{item.description && item.description !== '无'}}\" class=\"discounted-fee\">{{item.description}}</view>\n      </view>\n    </view>\n    <sponsor show=\"{{showAd}}\" ad=\"{{ad}}\"></sponsor>\n  </view>\n  <view class=\"block footer\">\n    <view class=\"footer-image\" bindtap=\"goPrototype\">\n      <image mode=\"aspectFit\" src=\"https://prototype.im/badge@2x.png\"></image>\n    </view>\n    <view class=\"footer-text\" bindtap=\"goFeedback\">反馈问题</view>\n  </view>\n</view>\n"
  },
  {
    "path": "pages/index/index.wxss",
    "content": "page {\n  min-height: 100%;\n}\n.container {\n  height: 100%;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: space-between;\n  box-sizing: border-box;\n}\n.block {\n  padding: 15px;\n  width: 100%;\n  box-sizing: border-box;\n}\n.block-title {\n  font-size: 20px;\n  margin-bottom: 30px;\n}\n.block-subtitle {\n  margin: 15px 0;\n  font-size: 14px;\n  color: #666;\n}\n.block-item {\n  position: relative;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  margin: 15px 0;\n  padding: 15px;\n  font-size: 18px;\n  border-radius: 8px;\n  background: #FFF;\n  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);\n}\n.block-item:last-child {\n  margin-bottom: 0;\n}\n.block-item.column {\n  flex-direction: column;\n}\n.item-row {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  width: 100%;\n}\n.item-row + .item-row {\n  margin-top: 10px;\n}\n.item-column {\n  display: flex;\n  flex-direction: column;\n  justify-content: space-between;\n  align-self: stretch;\n  flex-grow: 1;\n}\n.item-title {\n  font-size: 16px;\n}\n.item-title-icon {\n  height: 1.2em;\n  width: 1.2em;\n  margin-right: 10px;\n  vertical-align: middle;\n}\n.checkbox-group {\n  display: flex;\n  flex-direction: column;\n}\n.checkbox {\n  margin: 10px;\n}\n.radio-group {\n  display: flex;\n  justify-content: space-around;\n  width: 70%;\n  margin: 15px auto;\n}\n.slider-box {\n  flex-grow: 1;\n}\n.slider {\n  margin-left: 10px;\n  margin-right: 20px;\n  flex-grow: 1;\n}\n.slider-value {\n  display: flex;\n  justify-content: space-around;\n  align-items: center;\n  margin: 15px auto;\n  width: 70%;\n}\n.input-unit {\n  text-align: right;\n  font-size: 14px;\n  color: #999;\n}\n.operator {\n  display: flex;\n  justify-content: space-between;\n}\n.operator-item {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  flex-grow: 1;\n  margin-bottom: 15px;\n  padding: 8px;\n  font-size: 12px;\n  line-height: 16px;\n  border-radius: 8px;\n  background: #FFF;\n  box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);\n}\n\n.operator-item + .operator-item {\n  margin-left: 10px;\n}\n.operator-text {\n  vertical-align: middle;\n}\n.operator-icon {\n  height: 1em;\n  width: 1.2em;\n  vertical-align: middle;\n}\n.operator-icon-inline {\n  margin-right: 0.4em;\n}\n.operator-icon-big {\n  height: 1.5em;\n  width: 1.5em;\n}\n@media (min-device-width: 375px)  {\n  .operator-item {\n    display: flex;\n    justify-content: space-between;\n    align-items: center;\n    flex-grow: 1;\n    margin-bottom: 15px;\n    padding: 10px;\n    font-size: 14px;\n    line-height: 16px;\n    border-radius: 8px;\n    background: #FFF;\n    box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.1);\n  }\n  .operator-item + .operator-item {\n    margin-left: 15px;\n  }\n}\n.plan-rank-icon {\n  margin-right: 10px;\n  height: 1.5em;\n  width: 1.2em;\n  vertical-align: middle;\n}\n.plan-name text {\n  line-height: 1.5em;\n  vertical-align: middle;\n}\n.plan-fee {\n  font-size: 14px;\n  text-align: right;\n}\n.normal-fee {\n  margin-bottom: 5px;\n}\n.condition {\n  max-width: 15em;\n  font-size: 12px;\n  color: #FF983C;\n}\n.discounted-fee {\n  max-width: 15em;\n  font-size: 12px;\n  color: #60D390;\n}\n.fee-value {\n  margin: 0 5px;\n  color: #FF983C;\n}\n.fee-value-big {\n  font-size: 20px;\n}\n.fee-value.recommanded {\n  color: #29AE60;\n}\n.plan-partner-name {\n  margin-top: 10px;\n  font-size: 12px;\n  color: #666;\n}\n.share-btn {\n  margin: 0;\n  margin-top: 10px;\n  width: calc(50% - 15px);\n  line-height: 2.4em;\n  font-size: 16px;\n}\n.share-btn:not(:first-child) {\n  margin-left: 15px;\n}"
  },
  {
    "path": "pages/newCard/newCard.js",
    "content": "\n\nconst app = getApp()\n\nPage({\n  data: {\n  },\n\n  onLoad: function (q) {\n    this.setData({\n      plan: JSON.parse(q.plan),\n    })\n  },\n\n})\n"
  },
  {
    "path": "pages/newCard/newCard.json",
    "content": "{\n  \"navigationBarTitleText\": \"办理新卡\"\n}"
  },
  {
    "path": "pages/newCard/newCard.wxml",
    "content": "<web-view src=\"{{plan.guideUrl}}\"></web-view>\n"
  },
  {
    "path": "pages/newCard/newCard.wxss",
    "content": ".title {\n    text-align: center;\n    font-size: 24px;\n}"
  },
  {
    "path": "pages/webview/webview.js",
    "content": "const app = getApp()\n\nPage({\n  data: {\n  },\n  onLoad: function (q) {\n    this.setData({\n      url: q.url,\n    })\n  },\n  onShareAppMessage: function (res) {\n    return {\n      title: '套餐助手',\n      path: '/pages/webview/webview?url=' + this.data.url,\n    }\n  },\n})\n"
  },
  {
    "path": "pages/webview/webview.wxml",
    "content": "<web-view src=\"{{url}}\"></web-view>"
  },
  {
    "path": "utils/util.js",
    "content": "const formatTime = date => {\n  const year = date.getFullYear()\n  const month = date.getMonth() + 1\n  const day = date.getDate()\n  const hour = date.getHours()\n  const minute = date.getMinutes()\n  const second = date.getSeconds()\n\n  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')\n}\n\nconst formatNumber = n => {\n  n = n.toString()\n  return n[1] ? n : '0' + n\n}\n\nconst computeFee = (price, call, inProvinceTraffic, nationalTraffic) => {\n  const overCall = call - price.callInplan <= 0 ? 0 : call - price.callInplan\n\n  let trafficPerDay = (inProvinceTraffic + nationalTraffic) / 30\n  let noInProvinceTrafficDays = 0\n  let noNationalTrafficDays = 0\n  let noTrafficDays = 30 - (price.trafficInPlan.inProvince + price.trafficInPlan.national) / trafficPerDay\n  noTrafficDays = noTrafficDays >= 0 ? noTrafficDays : 0\n  if (trafficPerDay > 0) {\n    noInProvinceTrafficDays = noTrafficDays * (inProvinceTraffic / (inProvinceTraffic + nationalTraffic)) > 0 ? noTrafficDays * (inProvinceTraffic / (inProvinceTraffic + nationalTraffic)) : 0\n    noNationalTrafficDays = noTrafficDays * (nationalTraffic / (inProvinceTraffic + nationalTraffic)) > 0 ? noTrafficDays * (nationalTraffic / (inProvinceTraffic + nationalTraffic)) : 0\n  }\n\n  if (price.trafficInPlan.inProvince === 0) {\n    inProvinceTraffic = inProvinceTraffic - price.trafficInPlan.national * inProvinceTraffic / (inProvinceTraffic + nationalTraffic)\n    nationalTraffic = nationalTraffic - price.trafficInPlan.national * nationalTraffic / (inProvinceTraffic + nationalTraffic)\n  } else {\n    inProvinceTraffic = inProvinceTraffic - price.trafficInPlan.inProvince\n    nationalTraffic = nationalTraffic - price.trafficInPlan.national\n  }\n  inProvinceTraffic = inProvinceTraffic >= 0 ? inProvinceTraffic : 0\n  nationalTraffic = nationalTraffic >= 0 ? nationalTraffic : 0\n\n  if (!price.trafficOutPlanPrice.inProvince) {\n    nationalTraffic = inProvinceTraffic + nationalTraffic\n    noNationalTrafficDays = noNationalTrafficDays + noInProvinceTrafficDays\n    inProvinceTraffic = 0\n    noInProvinceTrafficDays = 0\n  }\n\n  let fee = price.monthlyFee\n  let callFee = overCall * price.callOutPlanPrice\n  let trafficFee = 0\n  let inProvinceFee = 0\n  let nationalFee = 0\n  const { inProvince, national, daily } = price.trafficOutPlanPrice\n\n  if (inProvinceTraffic + nationalTraffic > 0) {\n    if (inProvince && national) {\n      if (inProvince.daily) {\n        inProvinceFee = Math.ceil(trafficPerDay / inProvince.quantity) * inProvince.price * noInProvinceTrafficDays\n      } else {\n        inProvinceFee = Math.ceil(inProvinceTraffic / inProvince.quantity) * inProvince.price\n      }\n      if (national.daily) {\n        nationalFee = Math.ceil(trafficPerDay / national.quantity) * national.price * noNationalTrafficDays\n      } else {\n        nationalFee = Math.ceil(nationalTraffic / national.quantity) * national.price\n      }\n    } else if (national) {\n      if (national.daily) {\n        nationalFee = Math.ceil(trafficPerDay / national.quantity) * national.price * noNationalTrafficDays\n      } else {\n        nationalFee = Math.ceil(nationalTraffic / national.quantity) * national.price\n      }\n    }\n  }\n\n  trafficFee = nationalFee + inProvinceFee\n\n  return {\n    totalFee: (fee + callFee + trafficFee).toFixed(2),\n    monthlyFee: price.monthlyFee.toFixed(2),\n    callFee: callFee.toFixed(2),\n    inProvinceFee: inProvinceFee.toFixed(2),\n    nationalFee: nationalFee.toFixed(2),\n    trafficFee: trafficFee.toFixed(2),\n  }\n}\n\nmodule.exports = {\n  formatTime: formatTime,\n  computeFee: computeFee,\n}\n"
  }
]