[
  {
    "path": ".gitignore",
    "content": "# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# TypeScript v1 declaration files\ntypings/\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n\n# next.js build output\n.next\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2018 HunterX\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# E-Coupon\n一个简单的领优惠券小程序：\n1. 数据来源于「淘客助手API」\n2. 使用「淘宝官方API」生成「淘口令」\n3. 前端基于 Vant-Weapp 开发\n4. 后端利用了小程序的新功能「云开发」\n\n# 演示效果\n![](https://github.com/HunterXuan/E-Coupon/blob/master/demo.gif)\n\n# 可改进项\n1. 小程序应用内缓存数据，加快加载速度\n2. 整合两个API，统一数据获取源\n"
  },
  {
    "path": "cloudfunctions/getCouponList/index.js",
    "content": "// 获取优惠券列表\nconst cloud = require('wx-server-sdk')\nconst request = require('request')\nconst util = require('util')\n\ncloud.init()\n\n// 云函数入口函数\nexports.main = async (event, context) => {\n  const config = await cloud.callFunction({\n    name: 'getExtConf'\n  })\n\n  return new Promise((resolve, reject) => {\n    let urlTpl = 'https://api.taokezhushou.com/api/v1/search?app_key=%s&cate_id=%s&sort=%s&page=%s'\n    request(util.format(\n      urlTpl,\n      config.result.TKZS_APP_KEY,\n      event.category,\n      event.sort,\n      event.page), function (error, response, body) {\n      if (!error && response.statusCode == 200) {\n        let responseBody = JSON.parse(body)\n        let result = []\n\n        responseBody.data.forEach(function (v, i, a) {\n          result.push({\n            itemId: v.goods_id,\n            title: v.goods_title,\n            shortTitle: v.goods_short_title,\n            picUrl: v.goods_pic,\n            longPicUrl: v.goods_long_pic,\n            introduction: v.goods_intro,\n            originalPrice: parseFloat(v.goods_price).toFixed(1),\n            presentPrice: (parseFloat(v.goods_price) - parseFloat(v.coupon_amount)).toFixed(1),\n            saleCount: parseInt(v.goods_sale_num),\n            couponId: v.coupon_id,\n            couponApplyPrice: parseFloat(v.coupon_apply_amount).toFixed(1),\n            couponPrice: parseInt(v.coupon_amount),\n            couponStartTime: v.coupon_start_time.slice(0, 10),\n            couponEndTime: v.coupon_end_time.slice(0, 10),\n            isTmall: v.is_tmall,\n            isJHS: v.juhuasuan,\n            isTQG: v.taoqianggou\n          })\n        })\n\n        resolve(result)\n      } else {\n        reject()\n      }\n    })\n  })\n}"
  },
  {
    "path": "cloudfunctions/getCouponList/package.json",
    "content": "{\n  \"name\": \"getCouponList\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"wx-server-sdk\": \"latest\"\n  }\n}\n"
  },
  {
    "path": "cloudfunctions/getExtConf/index.js",
    "content": "// 接口相关配置\nconst cloud = require('wx-server-sdk')\n\ncloud.init()\n\n// 云函数入口函数\nexports.main = async (event, context) => {\n  return {\n    'APP_KEY': 'APP_KEY',\t\t\t\t\t\t\t\t// 淘宝客 APP KEY\n    'APP_SEC': 'APP_SEC',\t\t\t\t\t\t\t\t// 淘宝客 APP SECRECT\n    'APP_URL': 'http://gw.api.taobao.com/router/rest',\t// 淘宝客 API 地址\n    'APP_DE_PID': 'mm_XXXXXXXXX_YYYYYYYYY_ZZZZZZZZZ',\t// 桌面端推广位 PID\n    'APP_MO_PID': 'mm_XXXXXXXXX_YYYYYYYYY_ZZZZZZZZZ',\t// 移动端推广位 PID\n    'APP_DE_ZID': 'ZZZZZZZZZ',\t\t\t\t\t\t\t// 桌面端 ZONE ID，即桌面端推广位 PID 最后一段数字\n    'APP_MO_ZID': 'ZZZZZZZZZ',\t\t\t\t\t\t\t// 移动端 ZONE ID，即移动端推广位 PID 最后一段数字\n    'TKZS_APP_KEY': 'TKZS_APP_KEY'\t\t\t\t\t\t// 淘客助手 APP KEY\n  }\n}"
  },
  {
    "path": "cloudfunctions/getExtConf/package.json",
    "content": "{\n  \"name\": \"getExtConf\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"wx-server-sdk\": \"latest\"\n  }\n}\n"
  },
  {
    "path": "cloudfunctions/getHotList/index.js",
    "content": "// 云函数入口文件\nconst cloud = require('wx-server-sdk')\nconst request = require('request')\nconst util = require('util')\n\ncloud.init()\n\n// 云函数入口函数\nexports.main = async (event, context) => {\n  const config = await cloud.callFunction({\n    name: 'getExtConf'\n  })\n\n  return new Promise((resolve, reject) => {\n    let urlTpl = 'https://api.taokezhushou.com/api/v1/top_hour?app_key=%s&page=%s'\n    request(util.format(\n      urlTpl,\n      config.result.TKZS_APP_KEY,\n      event.page), function (error, response, body) {\n        if (!error && response.statusCode == 200) {\n          let responseBody = JSON.parse(body)\n          let result = []\n\n          responseBody.data.forEach(function (v, i, a) {\n            result.push({\n              itemId: v.goods_id,\n              title: v.goods_title,\n              shortTitle: v.goods_short_title,\n              picUrl: v.goods_pic,\n              longPicUrl: v.goods_long_pic,\n              introduction: v.goods_intro,\n              originalPrice: parseFloat(v.goods_price).toFixed(1),\n              presentPrice: (parseFloat(v.goods_price) - parseFloat(v.coupon_amount)).toFixed(1),\n              saleCount: parseInt(v.goods_sale_num),\n              couponId: v.coupon_id,\n              couponApplyPrice: parseFloat(v.coupon_apply_amount).toFixed(1),\n              couponPrice: parseInt(v.coupon_amount),\n              couponStartTime: v.coupon_start_time.slice(0, 10),\n              couponEndTime: v.coupon_end_time.slice(0, 10),\n              isTmall: v.is_tmall,\n              isJHS: v.juhuasuan,\n              isTQG: v.taoqianggou\n            })\n          })\n\n          resolve(result)\n        } else {\n          reject()\n        }\n      })\n  })\n}"
  },
  {
    "path": "cloudfunctions/getHotList/package.json",
    "content": "{\n  \"name\": \"getHotList\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"wx-server-sdk\": \"latest\"\n  }\n}\n"
  },
  {
    "path": "cloudfunctions/getNineNineList/index.js",
    "content": "// 云函数入口文件\nconst cloud = require('wx-server-sdk')\nconst request = require('request')\nconst util = require('util')\n\ncloud.init()\n\n// 云函数入口函数\nexports.main = async (event, context) => {\n  const config = await cloud.callFunction({\n    name: 'getExtConf'\n  })\n\n  return new Promise((resolve, reject) => {\n    let urlTpl = 'https://api.taokezhushou.com/api/v1/search?app_key=%s&page=%s&price_end=10'\n    request(util.format(\n      urlTpl,\n      config.result.TKZS_APP_KEY,\n      event.page), function (error, response, body) {\n        if (!error && response.statusCode == 200) {\n          let responseBody = JSON.parse(body)\n          let result = []\n\n          responseBody.data.forEach(function (v, i, a) {\n            result.push({\n              itemId: v.goods_id,\n              title: v.goods_title,\n              shortTitle: v.goods_short_title,\n              picUrl: v.goods_pic,\n              longPicUrl: v.goods_long_pic,\n              introduction: v.goods_intro,\n              originalPrice: parseFloat(v.goods_price).toFixed(1),\n              presentPrice: (parseFloat(v.goods_price) - parseFloat(v.coupon_amount)).toFixed(1),\n              saleCount: parseInt(v.goods_sale_num),\n              couponId: v.coupon_id,\n              couponApplyPrice: parseFloat(v.coupon_apply_amount).toFixed(1),\n              couponPrice: parseInt(v.coupon_amount),\n              couponStartTime: v.coupon_start_time.slice(0, 10),\n              couponEndTime: v.coupon_end_time.slice(0, 10),\n              isTmall: v.is_tmall,\n              isJHS: v.juhuasuan,\n              isTQG: v.taoqianggou\n            })\n          })\n\n          resolve(result)\n        } else {\n          reject()\n        }\n      })\n  })\n}"
  },
  {
    "path": "cloudfunctions/getNineNineList/package.json",
    "content": "{\n  \"name\": \"getNineNineList\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"request\": \"^2.88.0\",\n    \"topsdk\": \"^1.0.10\",\n    \"wx-server-sdk\": \"latest\"\n  }\n}\n"
  },
  {
    "path": "cloudfunctions/getSearchList/index.js",
    "content": "// 获取优惠券列表\nconst cloud = require('wx-server-sdk')\nconst request = require('request')\nconst util = require('util')\n\ncloud.init()\n\n// 云函数入口函数\nexports.main = async (event, context) => {\n  const config = await cloud.callFunction({\n    name: 'getExtConf'\n  })\n\n  return new Promise((resolve, reject) => {\n    let urlTpl = 'https://api.taokezhushou.com/api/v1/search?app_key=%s&q=%s&page=%s'\n    request(encodeURI(util.format(\n      urlTpl,\n      config.result.TKZS_APP_KEY,\n      event.query,\n      event.page)), function (error, response, body) {\n        if (!error && response.statusCode == 200) {\n          let responseBody = JSON.parse(body)\n          let result = []\n\n          responseBody.data.forEach(function (v, i, a) {\n            result.push({\n              itemId: v.goods_id,\n              title: v.goods_title,\n              shortTitle: v.goods_short_title,\n              picUrl: v.goods_pic,\n              longPicUrl: v.goods_long_pic,\n              introduction: v.goods_intro,\n              originalPrice: parseFloat(v.goods_price).toFixed(1),\n              presentPrice: (parseFloat(v.goods_price) - parseFloat(v.coupon_amount)).toFixed(1),\n              saleCount: parseInt(v.goods_sale_num),\n              couponId: v.coupon_id,\n              couponApplyPrice: parseFloat(v.coupon_apply_amount).toFixed(1),\n              couponPrice: parseInt(v.coupon_amount),\n              couponStartTime: v.coupon_start_time.slice(0, 10),\n              couponEndTime: v.coupon_end_time.slice(0, 10),\n              isTmall: v.is_tmall,\n              isJHS: v.juhuasuan,\n              isTQG: v.taoqianggou\n            })\n          })\n\n          resolve(result)\n        } else {\n          reject()\n        }\n      })\n  })\n}"
  },
  {
    "path": "cloudfunctions/getSearchList/package.json",
    "content": "{\n  \"name\": \"getSearchList\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"wx-server-sdk\": \"latest\"\n  }\n}\n"
  },
  {
    "path": "cloudfunctions/getTimeList/index.js",
    "content": "// 云函数入口文件\nconst cloud = require('wx-server-sdk')\nconst request = require('request')\nconst util = require('util')\n\ncloud.init()\n\n// 云函数入口函数\nexports.main = async (event, context) => {\n  const config = await cloud.callFunction({\n    name: 'getExtConf'\n  })\n\n  return new Promise((resolve, reject) => {\n    let urlTpl = 'https://api.taokezhushou.com/api/v1/search?app_key=%s&page=%s&taoqianggou=1'\n    request(util.format(\n      urlTpl,\n      config.result.TKZS_APP_KEY,\n      event.page), function (error, response, body) {\n        if (!error && response.statusCode == 200) {\n          let responseBody = JSON.parse(body)\n          let result = []\n\n          responseBody.data.forEach(function (v, i, a) {\n            result.push({\n              itemId: v.goods_id,\n              title: v.goods_title,\n              shortTitle: v.goods_short_title,\n              picUrl: v.goods_pic,\n              longPicUrl: v.goods_long_pic,\n              introduction: v.goods_intro,\n              originalPrice: parseFloat(v.goods_price).toFixed(1),\n              presentPrice: (parseFloat(v.goods_price) - parseFloat(v.coupon_amount)).toFixed(1),\n              saleCount: parseInt(v.goods_sale_num),\n              couponId: v.coupon_id,\n              couponApplyPrice: parseFloat(v.coupon_apply_amount).toFixed(1),\n              couponPrice: parseInt(v.coupon_amount),\n              couponStartTime: v.coupon_start_time.slice(0, 10),\n              couponEndTime: v.coupon_end_time.slice(0, 10),\n              isTmall: v.is_tmall,\n              isJHS: v.juhuasuan,\n              isTQG: v.taoqianggou\n            })\n          })\n\n          resolve(result)\n        } else {\n          reject()\n        }\n      })\n  })\n}"
  },
  {
    "path": "cloudfunctions/getTimeList/package.json",
    "content": "{\n  \"name\": \"getTimeList\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"wx-server-sdk\": \"latest\"\n  }\n}\n"
  },
  {
    "path": "cloudfunctions/getTpwd/index.js",
    "content": "// 云函数入口文件\nconst cloud = require('wx-server-sdk')\nconst util = require('util')\nconst TopClient = require('topsdk')\n\ncloud.init()\n\n// 云函数入口函数\nexports.main = async (event, context) => {\n  const config = await cloud.callFunction({\n    name: 'getExtConf'\n  })\n\n  const client = new TopClient(\n    config.result.APP_KEY,\n    config.result.APP_SEC,\n    config.result.APP_URL\n  )\n\n  let urlTpl = 'https://uland.taobao.com/coupon/edetail?activityId=%s&pid=%s&itemId=%s'\n\n  return new Promise((resolve, reject) => {\n    client.execute('taobao.tbk.tpwd.create', {\n      'text': event.title,\n      'logo': event.picUrl,\n      'url': util.format(\n        urlTpl,\n        event.couponId,\n        config.result.APP_MO_PID,\n        event.itemId\n      )\n    }, function (error, response) {\n      if (!error && response) {\n        resolve(response)\n      }\n    })\n  })\n}"
  },
  {
    "path": "cloudfunctions/getTpwd/package.json",
    "content": "{\n  \"name\": \"getTpwd\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"topsdk\": \"^1.0.10\",\n    \"wx-server-sdk\": \"latest\"\n  }\n}\n"
  },
  {
    "path": "miniprogram/.gitignore",
    "content": "project.config.json\n"
  },
  {
    "path": "miniprogram/LICENSE",
    "content": "Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License."
  },
  {
    "path": "miniprogram/README.md",
    "content": "## 优惠券小程序\n\n## 效果\n![演示](coupon.gif)\n\n### 使用方法\n\n    git clone https://github.com/AmateurEvents/coupon.git\n    cd coupon\n\n#### 无服务端\n\n* 下载微信开发者工具\n* 打开项目\n\n#### 有服务端版\n\n* 申请小程序\n* 填写AppID\n* 搭建服务端\n* 打开小程序\n\n### 待做\n\n* 服务端接口完善\n* 获取商品详情\n* 获取商品推荐理由\n* ....\n\n### 交流(感兴趣的可加qq)\n\n![交流](qq.jpeg)"
  },
  {
    "path": "miniprogram/app.js",
    "content": "App({\n  onLaunch: function () {\n    wx.clearStorageSync();\n\n    if (!wx.cloud) {\n      console.error('请使用 2.2.3 或以上的基础库以使用云能力')\n    } else {\n      wx.cloud.init({\n        traceUser: true,\n      })\n    }\n  },\n  \n  globalData: {\n  }\n})\n"
  },
  {
    "path": "miniprogram/app.json",
    "content": "{\n  \"pages\": [\n    \"pages/favour/favour\",\n    \"pages/index/index\",\n    \"pages/ninenine/ninenine\",\n    \"pages/search/search\",\n    \"pages/time/time\",\n    \"pages/hot/hot\",\n    \"pages/detail/detail\"\n  ],\n  \"window\": {\n    \"backgroundTextStyle\": \"dark\",\n    \"backgroundColor\": \"#f7f7f7\",\n    \"navigationBarBackgroundColor\": \"#ff6666\",\n    \"navigationBarTitleText\": \"一点优惠\",\n    \"navigationBarTextStyle\": \"#fff\"\n  },\n  \"tabBar\": {\n    \"color\": \"#999\",\n    \"selectedColor\": \"#ff6666\",\n    \"backgroundColor\": \"#f7f7f7\",\n    \"borderStyle\": \"black\",\n    \"list\": [\n      {\n        \"pagePath\": \"pages/favour/favour\",\n        \"text\": \"首页\",\n        \"iconPath\": \"images/favour.png\",\n        \"selectedIconPath\": \"images/favour-on.png\"\n      },\n      {\n        \"pagePath\": \"pages/ninenine/ninenine\",\n        \"text\": \"9.9包邮\",\n        \"iconPath\": \"images/99.png\",\n        \"selectedIconPath\": \"images/99-on.png\"\n      },\n      {\n        \"pagePath\": \"pages/search/search\",\n        \"text\": \"超级搜\",\n        \"iconPath\": \"images/search.png\",\n        \"selectedIconPath\": \"images/search-on.png\"\n      },\n      {\n        \"pagePath\": \"pages/time/time\",\n        \"text\": \"淘抢购\",\n        \"iconPath\": \"images/time.png\",\n        \"selectedIconPath\": \"images/time-on.png\"\n      },\n      {\n        \"pagePath\": \"pages/hot/hot\",\n        \"text\": \"热销\",\n        \"iconPath\": \"images/hot.png\",\n        \"selectedIconPath\": \"images/hot-on.png\"\n      }\n    ]\n  }\n}"
  },
  {
    "path": "miniprogram/app.wxss",
    "content": "@import \"miniprogram_npm/vant-weapp/common/index.wxss\";\n.top-search-bar .van-search {\n  background-color: #ff6666 !important;\n}"
  },
  {
    "path": "miniprogram/pages/detail/detail.js",
    "content": "var app = getApp()\nPage({\n  data: {\n    couponInfo: {},\n    picWidth: wx.getSystemInfoSync().windowWidth,\n    showTpwdDialog: false,\n    tpwd: \"\",\n    hasTpwd: false\n  },\n\n  onShow: function () {\n    wx.setStorageSync('isDetailBack', true)\n  },\n\n  onLoad: function (options) {\n    this.setData({\n      couponInfo: wx.getStorageSync('couponInfo')\n    })\n\n    this.setTpwd()\n  },\n\n  showTpwd: function () {\n    this.setData({\n      showTpwdDialog: true\n    })\n  },\n\n  setTpwd: function () {\n    if (this.data.tpwd == '') {\n      let that = this\n      wx.cloud.callFunction({\n        name: 'getTpwd',\n        data: {\n          'title': that.data.couponInfo.title,\n          'picUrl': that.data.couponInfo.picUrl,\n          'couponId': that.data.couponInfo.couponId,\n          'itemId': that.data.couponInfo.itemId\n        },\n        success: (response) => {\n          that.setData({\n            tpwd: response.result.data.model,\n            hasTpwd: true\n          })\n        }\n      })\n    }\n  },\n\n  copyTpwd: function () {\n    wx.setClipboardData({\n      data: this.data.tpwd,\n      success: (res) => {\n        wx.showToast({\n          title: '复制成功',\n        })\n      }\n    })\n  }\n})\n"
  },
  {
    "path": "miniprogram/pages/detail/detail.json",
    "content": "{\n  \"usingComponents\": {\n    \"van-row\": \"../../../miniprogram_npm/vant-weapp/row/index\",\n    \"van-col\": \"../../../miniprogram_npm/vant-weapp/col/index\",\n    \"van-search\": \"../../../miniprogram_npm/vant-weapp/search/index\",\n    \"van-tab\": \"../../../miniprogram_npm/vant-weapp/tab/index\",\n    \"van-tabs\": \"../../../miniprogram_npm/vant-weapp/tabs/index\",\n    \"van-button\": \"../../../miniprogram_npm/vant-weapp/button/index\",\n    \"van-card\": \"../../../miniprogram_npm/vant-weapp/card/index\",\n    \"van-tag\": \"../../../miniprogram_npm/vant-weapp/tag/index\",\n    \"van-submit-bar\": \"../../../miniprogram_npm/vant-weapp/submit-bar/index\",\n    \"van-dialog\": \"../../../miniprogram_npm/vant-weapp/dialog/index\"\n  }\n}"
  },
  {
    "path": "miniprogram/pages/detail/detail.wxml",
    "content": "<view class=\"page\">\n  <view>\n    <image style=\"height:{{picWidth}}px;width:{{picWidth}}px;\" src=\"{{couponInfo.picUrl}}\"></image>\n  </view>\n\n  <view class=\"page_bd\">\n    <van-row>\n      <van-col span=\"24\">\n        <text>{{couponInfo.title}}</text>\n      </van-col>\n    </van-row>\n\n    <van-row>\n      <van-col span=\"12\">\n        <text class=\"original-price\">现价￥{{couponInfo.originalPrice}}</text>\n      </van-col>\n      <van-col span=\"12\" class=\"text-right\">\n        <text class=\"sale-count-text\">已售 {{couponInfo.saleCount}} 件</text>\n      </van-col>\n    </van-row>\n\n    <van-row>\n      <van-col span=\"12\">\n        <text class=\"present-price\">券后价￥<text class=\"present-price-num\">{{ couponInfo.presentPrice }}</text></text>\n      </van-col>\n      <van-col span=\"12\" class=\"text-right\">\n        <van-tag type=\"danger\">{{ couponInfo.isTmall ? \"天猫\" : (couponInfo.isTQG ? \"淘抢购\" : (couponInfo.isJHS ? \"聚划算\" : \"淘宝\")) }}</van-tag>\n      </van-col>\n    </van-row>\n\n    <van-row custom-class=\"coupon-time-row\">\n      <van-col span=\"24\">\n        <view class=\"text-center\"><text>{{ couponInfo.couponPrice }} 元优惠券</text></view>\n        <view class=\"text-center\"><text>使用期限: {{ couponInfo.couponStartTime }} - {{ couponInfo.couponEndTime }}</text></view>\n      </van-col>\n    </van-row>\n\n    <van-row custom-class=\"coupon-intro-row\">\n      <van-col span=\"24\">\n        <text>{{ couponInfo.introduction }}</text>\n      </van-col>\n    </van-row>\n\n    <van-row custom-class=\"coupon-intro-pic-row\">\n      <van-col span=\"24\">\n        <image style=\"width:100%;\" src=\"{{couponInfo.longPicUrl}}\" mode=\"widthFix\"/>\n      </van-col>\n    </van-row>\n    \n  </view>\n\n  <view>\n    <van-submit-bar\n      label=\"券后价 \"\n      price=\"{{ couponInfo.presentPrice * 100 }}\"\n      button-text=\"立即领券\"\n      bind:submit=\"showTpwd\"\n      loading=\"{{ !hasTpwd }}\"\n    />\n  </view>\n\n  <van-dialog\n    use-slot\n    title=\"淘口令\"\n    show=\"{{ showTpwdDialog }}\"\n    confirm-button-text=\"一键复制\"\n    bind:confirm=\"copyTpwd\"\n  >\n    <van-row custom-class=\"coupon-tpwd-text\">\n      <van-col span=\"24\">\n        <text selectable=\"true\">复制框内整段文字，打开「手机淘宝」即可领券购买。{{ tpwd }}</text>\n      </van-col>\n    </van-row>\n  </van-dialog>\n</view>"
  },
  {
    "path": "miniprogram/pages/detail/detail.wxss",
    "content": ".page_bd {\n  padding: 0 12px 50px 12px;\n}\n\n.original-price {\n  color: #999;\n  font-size: 12px;\n  text-decoration: line-through;\n}\n\n.present-price {\n  color: #ff6666;\n  font-size: 12px;\n}\n\n.present-price-num {\n  font-size: 18px;\n}\n\n.sale-count-text {\n  color: #999;\n  font-size: 12px;\n}\n\n.coupon-time-row {\n  color: #fff;\n  font-size: 12px;\n  padding: 10px;\n  margin: 10px 0;\n  outline: 2px solid #fff;\n  outline-offset: -5px;\n  background-color: #ff6666;\n}\n\n.coupon-intro-row {\n  font-size: 12px;\n  padding: 10px;\n  margin: 0 0 10px 0;\n  border: 1px dashed #999;\n}\n\n.coupon-intro-pic-row {\n  box-shadow: 1px 10px 5px #999;\n}\n\n.coupon-tpwd-text {\n  font-size: 14px;\n  padding: 10px;\n  margin: 5px;\n  border: 1px dashed #999;\n}\n\n.text-center {\n  text-align: center;\n}\n\n.text-right {\n  text-align: right;\n}"
  },
  {
    "path": "miniprogram/pages/favour/favour.js",
    "content": "let app = getApp()\nPage({\n  data: {\n    sortByList: [],\n    categoryList: [],\n    couponList: [],\n    selectedSortIndex: 0,\n    selectedCatIndex: 0,\n    pageIndex: 1\n  },\n\n  onLoad: function (options) {\n    this.setSortByList()\n    this.setCategoryList()\n  },\n\n  onShow: function () {\n    if (wx.getStorageSync('isDetailBack')) {\n      wx.removeStorageSync('isDetailBack')\n      return\n    }\n\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      selectedSortIndex: wx.getStorageSync('selectedSortIndex'),\n      selectedCatIndex: wx.getStorageSync('selectedCatIndex')\n    })\n    this.getMoreCouponList()\n  },\n\n  // 设置排序列表\n  setSortByList: function () {\n    this.setData({\n      sortByList: [\n        { key: \"\", name: \"综合\" },\n        { key: \"new\", name: \"最新券\" },\n        { key: \"price_asc\", name: \"最优惠\" },\n        { key: \"sale_num\", name: \"最畅销\" }\n      ],\n      selectedSortIndex: 0\n    })\n  },\n\n  // 获取商品分类\n  setCategoryList: function () {\n    let categoryList = [\n      { id: \"\", name: \"全部分类\" },\n      { id: \"1\", name: \"女装\" },\n      { id: \"2\", name: \"男装\" },\n      { id: \"3\", name: \"内衣\" },\n      { id: \"4\", name: \"数码家电\" },\n      { id: \"5\", name: \"美食\" },\n      { id: \"6\", name: \"美妆个护\" },\n      { id: \"7\", name: \"母婴\" },\n      { id: \"8\", name: \"鞋包配饰\" },\n      { id: \"9\", name: \"家居家装\" },\n      { id: \"10\", name: \"文体车品\" },\n      { id: \"11\", name: \"其它\" }\n    ]\n\n    this.setData({\n      categoryList: categoryList,\n      selectedCatIndex: 0\n    })\n  },\n\n  getMoreCouponList: function () {\n    var that = this\n    wx.showLoading({\n      title: '加载中',\n    })\n    wx.cloud.callFunction({\n      name: 'getCouponList',\n      data: {\n        'category': that.data.selectedCatIndex ? that.data.categoryList[that.data.selectedCatIndex].id : '',\n        'sort': that.data.selectedSortIndex ? that.data.sortByList[that.data.selectedSortIndex].key : '',\n        'page': that.data.pageIndex\n      },\n      success: response => {\n        that.setData({\n          couponList: that.data.couponList.concat(response.result)\n        }, () => {\n          wx.hideLoading()\n        })\n      }\n    })\n  },\n\n  sortByChanged: function (e) {\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      selectedSortIndex: e.detail.index,\n    })\n    this.getMoreCouponList()\n    wx.setStorageSync('selectedSortIndex', e.detail.index)\n  },\n\n  categoryChanged: function (e) {\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      selectedCatIndex: e.detail.value,\n    })\n    this.getMoreCouponList()\n    wx.setStorageSync('selectedCatIndex', e.detail.value)\n  },\n\n  jumpToSearch: function (e) {\n    wx.switchTab({\n      url: '../search/search',\n    })\n  },\n\n  jumpToDetail: function (e) {\n    wx.setStorage({\n      key: 'couponInfo',\n      data: this.data.couponList[e.currentTarget.dataset.index],\n      success: () => {\n        wx.navigateTo({\n          url: '../detail/detail',\n        })\n      }\n    })\n  },\n\n  onPullDownRefresh: function () {\n    this.setData({\n      couponList: [],\n      pageIndex: 1\n    })\n    wx.stopPullDownRefresh()\n    this.getMoreCouponList()\n  },\n\n  onReachBottom: function () {\n    this.setData({\n      pageIndex: this.data.pageIndex + 1\n    })\n    this.getMoreCouponList()\n  }\n})\n"
  },
  {
    "path": "miniprogram/pages/favour/favour.json",
    "content": "{\n  \"usingComponents\": {\n    \"van-row\": \"../../../miniprogram_npm/vant-weapp/row/index\",\n    \"van-col\": \"../../../miniprogram_npm/vant-weapp/col/index\",\n    \"van-search\": \"../../../miniprogram_npm/vant-weapp/search/index\",\n    \"van-tab\": \"../../../miniprogram_npm/vant-weapp/tab/index\",\n    \"van-tabs\": \"../../../miniprogram_npm/vant-weapp/tabs/index\",\n    \"van-button\": \"../../../miniprogram_npm/vant-weapp/button/index\",\n    \"van-card\": \"../../../miniprogram_npm/vant-weapp/card/index\",\n    \"van-tag\": \"../../../miniprogram_npm/vant-weapp/tag/index\",\n    \"van-icon\": \"../../../miniprogram_npm/vant-weapp/icon/index\"\n  }\n}"
  },
  {
    "path": "miniprogram/pages/favour/favour.wxml",
    "content": "<view class=\"page\">\n  <view>\n    <van-search\n      placeholder=\"请输入搜索关键词\"\n      bind:focus=\"jumpToSearch\"\n      class=\"top-search-bar\"\n    >\n    </van-search>\n  </view>\n\n  <view>\n    <van-row>\n      <van-col span=\"19\">\n        <van-tabs active=\"{{ selectedSortIndex != '' ? selectedSortIndex : 0 }}\" bind:change=\"sortByChanged\">\n          <block wx:for=\"{{ sortByList }}\" wx:key=\"item.itemId\">\n            <van-tab title=\"{{ item.name }}\"></van-tab>\n          </block>\n        </van-tabs>\n      </van-col>\n      <van-col span=\"5\">\n        <picker bindchange=\"categoryChanged\" value=\"{{ selectedCatIndex }}\" range=\"{{ categoryList }}\" range-key=\"name\">\n          <van-tabs>\n            <van-tab title=\"{{ selectedCatIndex ? categoryList[selectedCatIndex].name : '全部分类' }}\"></van-tab>\n          </van-tabs>\n        </picker>\n      </van-col>\n    </van-row>\n  </view>\n\n  <view>\n    <view wx:for=\"{{ couponList }}\" wx:key=\"{{ item.itemId }}\" bindtap=\"jumpToDetail\" data-index=\"{{index}}\" hover-class=\"navigator-hover\">\n      <van-card\n        thumb=\"{{ item.picUrl }}\"\n      >\n        <view slot=\"title\" class=\"coupon-list-title\">\n          <view class=\"van-ellipsis\">{{ item.shortTitle }}</view>\n        </view>\n\n        <view slot=\"desc\" class=\"coupon-list-desc\">\n          <view>热销 {{ item.saleCount }} 件</view>\n        </view>\n\n        <view slot=\"footer\" class=\"coupon-list-footer\">\n          <van-row class=\"text-right\">\n            <view>现价￥<text class=\"original-price\">{{ item.originalPrice }}</text></view>\n            <view>\n              <van-tag plain type=\"danger\">{{item.couponPrice}} 元</van-tag> 券后价<text class=\"present-price\">￥<text class=\"present-price-num\">{{ item.presentPrice }}</text>\n                </text>\n              </view>\n          </van-row>\n        </view>\n      </van-card>\n    </view>\n  </view>\n</view>"
  },
  {
    "path": "miniprogram/pages/favour/favour.wxss",
    "content": "/* pages/favour/favour.wxss */\n.top-search-bar {\n  background-color: #ff6666;\n  border: none\n}\n\n.coupon-list-title {\n  padding-bottom: 5px;\n}\n\n.coupon-list-desc {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.coupon-list-footer {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.original-price {\n  text-decoration: line-through;\n}\n\n.present-price {\n  color: #ff6666;\n}\n\n.present-price-num {\n  font-size: 18px;\n}\n\n.text-right {\n  text-align: right;\n}"
  },
  {
    "path": "miniprogram/pages/hot/hot.js",
    "content": "let app = getApp()\nPage({\n  data: {\n    sortByList: [],\n    categoryList: [],\n    couponList: [],\n    selectedSortIndex: 0,\n    selectedCatIndex: 0,\n    pageIndex: 1,\n    isLoading: true,\n    loadOver: false\n  },\n\n  onLoad: function (options) {\n    this.setSortByList()\n    this.setCategoryList()\n  },\n\n  onShow: function () {\n    if (wx.getStorageSync('isDetailBack')) {\n      wx.removeStorageSync('isDetailBack')\n      return\n    }\n\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      isLoading: true,\n      loadOver: false,\n      selectedSortIndex: wx.getStorageSync('selectedSortIndex'),\n      selectedCatIndex: wx.getStorageSync('selectedCatIndex')\n    })\n    this.getMoreCouponList()\n  },\n\n  // 设置排序列表\n  setSortByList: function () {\n    this.setData({\n      sortByList: [\n        { key: \"new\", name: \"最新券\" },\n        { key: \"price_asc\", name: \"最优惠\" },\n        { key: \"sale_num\", name: \"最畅销\" }\n      ],\n      selectedSortIndex: 0\n    })\n  },\n\n  // 获取商品分类\n  setCategoryList: function () {\n    let categoryList = [\n      { id: \"\", name: \"全部分类\" },\n      { id: \"1\", name: \"女装\" },\n      { id: \"2\", name: \"男装\" },\n      { id: \"3\", name: \"内衣\" },\n      { id: \"4\", name: \"数码家电\" },\n      { id: \"5\", name: \"美食\" },\n      { id: \"6\", name: \"美妆个护\" },\n      { id: \"7\", name: \"母婴\" },\n      { id: \"8\", name: \"鞋包配饰\" },\n      { id: \"9\", name: \"家居家装\" },\n      { id: \"10\", name: \"文体车品\" },\n      { id: \"11\", name: \"其它\" }\n    ]\n\n    this.setData({\n      categoryList: categoryList,\n      selectedCatIndex: 0\n    })\n  },\n\n  getMoreCouponList: function () {\n    var that = this\n    wx.showLoading({\n      title: '加载中',\n    })\n    wx.cloud.callFunction({\n      name: 'getHotList',\n      data: {\n        'category': that.data.selectedCatIndex ? that.data.categoryList[that.data.selectedCatIndex].id : '',\n        'page': that.data.pageIndex\n      },\n      success: response => {\n        that.setData({\n          couponList: that.data.couponList.concat(response.result)\n        }, () => {\n          wx.hideLoading()\n        })\n      }\n    })\n  },\n\n  sortByChanged: function (e) {\n    this.setData({\n      couponList: [],\n      loadOver: false,\n      isLoading: true,\n      pageIndex: 1,\n      selectedSortIndex: e.detail.index,\n    })\n    this.getMoreCouponList()\n    wx.setStorageSync('selectedSortIndex', e.detail.index)\n  },\n\n  categoryChanged: function (e) {\n    this.setData({\n      couponList: [],\n      loadOver: false,\n      isLoading: true,\n      pageIndex: 1,\n      selectedCatIndex: e.detail.value,\n    })\n    this.getMoreCouponList()\n    wx.setStorageSync('selectedCatIndex', e.detail.value)\n  },\n\n  jumpToDetail: function (e) {\n    wx.setStorage({\n      key: 'couponInfo',\n      data: this.data.couponList[e.currentTarget.dataset.index],\n      success: () => {\n        wx.navigateTo({\n          url: '../detail/detail',\n        })\n      }\n    })\n  },\n\n  onPullDownRefresh: function () {\n    this.setData({\n      couponList: [],\n      loadOver: false,\n      isLoading: true,\n      pageIndex: 1\n    })\n    wx.stopPullDownRefresh()\n    this.getMoreCouponList()\n  },\n\n  onReachBottom: function () {\n    this.setData({\n      isLoading: true,\n      loadOver: false,\n      pageIndex: this.data.pageIndex + 1\n    })\n    this.getMoreCouponList()\n  }\n})\n"
  },
  {
    "path": "miniprogram/pages/hot/hot.json",
    "content": "{\n  \"usingComponents\": {\n    \"van-row\": \"../../../miniprogram_npm/vant-weapp/row/index\",\n    \"van-col\": \"../../../miniprogram_npm/vant-weapp/col/index\",\n    \"van-search\": \"../../../miniprogram_npm/vant-weapp/search/index\",\n    \"van-tab\": \"../../../miniprogram_npm/vant-weapp/tab/index\",\n    \"van-tabs\": \"../../../miniprogram_npm/vant-weapp/tabs/index\",\n    \"van-button\": \"../../../miniprogram_npm/vant-weapp/button/index\",\n    \"van-card\": \"../../../miniprogram_npm/vant-weapp/card/index\",\n    \"van-tag\": \"../../../miniprogram_npm/vant-weapp/tag/index\",\n    \"van-icon\": \"../../../miniprogram_npm/vant-weapp/icon/index\",\n    \"van-nav-bar\": \"../../../miniprogram_npm/vant-weapp/nav-bar/index\"\n  }\n}"
  },
  {
    "path": "miniprogram/pages/hot/hot.wxml",
    "content": "<view class=\"page\">\n  <view style=\"padding: 3px;\">\n    <image src=\"../../images/hot-items.jpg\" style=\"width:100%;\" mode=\"widthFix\"></image>\n  </view>\n\n  <view>\n    <view wx:for=\"{{ couponList }}\" wx:key=\"{{ item.itemId }}\" bindtap=\"jumpToDetail\" data-index=\"{{index}}\" hover-class=\"navigator-hover\">\n      <van-card\n        thumb=\"{{ item.picUrl }}\"\n      >\n        <view slot=\"title\" class=\"coupon-list-title\">\n          <view class=\"van-ellipsis\">{{ item.shortTitle }}</view>\n        </view>\n\n        <view slot=\"desc\" class=\"coupon-list-desc\">\n          <view>热销 {{ item.saleCount }} 件</view>\n        </view>\n\n        <view slot=\"footer\" class=\"coupon-list-footer\">\n          <van-row class=\"text-right\">\n            <view>现价￥<text class=\"original-price\">{{ item.originalPrice }}</text></view>\n            <view>\n              <van-tag plain type=\"danger\">{{item.couponPrice}} 元</van-tag> 券后价<text class=\"present-price\">￥<text class=\"present-price-num\">{{ item.presentPrice }}</text>\n                </text>\n              </view>\n          </van-row>\n        </view>\n      </van-card>\n    </view>\n  </view>\n</view>"
  },
  {
    "path": "miniprogram/pages/hot/hot.wxss",
    "content": "/* pages/favour/favour.wxss */\n.top-search-bar {\n  background-color: #ff6666;\n  border: none\n}\n\n.coupon-list-title {\n  padding-bottom: 5px;\n}\n\n.coupon-list-desc {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.coupon-list-footer {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.original-price {\n  text-decoration: line-through;\n}\n\n.present-price {\n  color: #ff6666;\n}\n\n.present-price-num {\n  font-size: 18px;\n}\n\n.text-right {\n  text-align: right;\n}"
  },
  {
    "path": "miniprogram/pages/index/index.js",
    "content": "// pages/index/index.js\nPage({\n\n  /**\n   * Page initial data\n   */\n  data: {\n\n  },\n\n  /**\n   * Lifecycle function--Called when page load\n   */\n  onLoad: function (options) {\n    wx.switchTab({\n      url: '../search/search',\n    })\n  },\n\n  /**\n   * Lifecycle function--Called when page is initially rendered\n   */\n  onReady: function () {\n\n  },\n\n  /**\n   * Lifecycle function--Called when page show\n   */\n  onShow: function () {\n\n  },\n\n  /**\n   * Lifecycle function--Called when page hide\n   */\n  onHide: function () {\n\n  },\n\n  /**\n   * Lifecycle function--Called when page unload\n   */\n  onUnload: function () {\n\n  },\n\n  /**\n   * Page event handler function--Called when user drop down\n   */\n  onPullDownRefresh: function () {\n\n  },\n\n  /**\n   * Called when page reach bottom\n   */\n  onReachBottom: function () {\n\n  },\n\n  /**\n   * Called when user click on the top right corner to share\n   */\n  onShareAppMessage: function () {\n\n  }\n})"
  },
  {
    "path": "miniprogram/pages/index/index.json",
    "content": "{}"
  },
  {
    "path": "miniprogram/pages/index/index.wxml",
    "content": "<!--pages/index/index.wxml-->\n<text>pages/index/index.wxml</text>\n"
  },
  {
    "path": "miniprogram/pages/index/index.wxss",
    "content": "/* pages/index/index.wxss */"
  },
  {
    "path": "miniprogram/pages/ninenine/ninenine.js",
    "content": "let app = getApp()\nPage({\n  data: {\n    sortByList: [],\n    categoryList: [],\n    couponList: [],\n    selectedSortIndex: 0,\n    selectedCatIndex: 0,\n    pageIndex: 1\n  },\n\n  onLoad: function (options) {\n  },\n\n  onShow: function () {\n    if (wx.getStorageSync('isDetailBack')) {\n      wx.removeStorageSync('isDetailBack')\n      return\n    }\n\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      selectedSortIndex: wx.getStorageSync('selectedSortIndex'),\n      selectedCatIndex: wx.getStorageSync('selectedCatIndex')\n    })\n    this.getMoreCouponList()\n  },\n\n  getMoreCouponList: function () {\n    var that = this\n    wx.showLoading({\n      title: '加载中',\n    })\n    wx.cloud.callFunction({\n      name: 'getNineNineList',\n      data: {\n        'category': that.data.selectedCatIndex ? that.data.categoryList[that.data.selectedCatIndex].id : '',\n        'sort': that.data.selectedSortIndex ? that.data.sortByList[that.data.selectedSortIndex].key : 'new',\n        'page': that.data.pageIndex\n      },\n      success: response => {\n        that.setData({\n          couponList: that.data.couponList.concat(response.result)\n        }, () => {\n          wx.hideLoading()\n        })\n      }\n    })\n  },\n\n  sortByChanged: function (e) {\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      selectedSortIndex: e.detail.index,\n    })\n    this.getMoreCouponList()\n    wx.setStorageSync('selectedSortIndex', e.detail.index)\n  },\n\n  categoryChanged: function (e) {\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      selectedCatIndex: e.detail.value,\n    })\n    this.getMoreCouponList()\n    wx.setStorageSync('selectedCatIndex', e.detail.value)\n  },\n\n  jumpToDetail: function (e) {\n    wx.setStorage({\n      key: 'couponInfo',\n      data: this.data.couponList[e.currentTarget.dataset.index],\n      success: () => {\n        wx.navigateTo({\n          url: '../detail/detail',\n        })\n      }\n    })\n  },\n\n  onPullDownRefresh: function () {\n    this.setData({\n      couponList: [],\n      pageIndex: 1\n    })\n    wx.stopPullDownRefresh()\n    this.getMoreCouponList()\n  },\n\n  onReachBottom: function () {\n    this.setData({\n      pageIndex: this.data.pageIndex + 1\n    })\n    this.getMoreCouponList()\n  }\n})\n"
  },
  {
    "path": "miniprogram/pages/ninenine/ninenine.json",
    "content": "{\n  \"usingComponents\": {\n    \"van-row\": \"../../../miniprogram_npm/vant-weapp/row/index\",\n    \"van-col\": \"../../../miniprogram_npm/vant-weapp/col/index\",\n    \"van-search\": \"../../../miniprogram_npm/vant-weapp/search/index\",\n    \"van-tab\": \"../../../miniprogram_npm/vant-weapp/tab/index\",\n    \"van-tabs\": \"../../../miniprogram_npm/vant-weapp/tabs/index\",\n    \"van-button\": \"../../../miniprogram_npm/vant-weapp/button/index\",\n    \"van-card\": \"../../../miniprogram_npm/vant-weapp/card/index\",\n    \"van-tag\": \"../../../miniprogram_npm/vant-weapp/tag/index\",\n    \"van-icon\": \"../../../miniprogram_npm/vant-weapp/icon/index\"\n  }\n}"
  },
  {
    "path": "miniprogram/pages/ninenine/ninenine.wxml",
    "content": "<view class=\"page\">\n  <view style=\"padding: 3px;\">\n    <image src=\"../../images/9.9.jpg\" style=\"width:100%;\" mode=\"widthFix\"></image>\n  </view>\n\n  <view>\n    <view wx:for=\"{{ couponList }}\" wx:key=\"{{ item.itemId }}\" bindtap=\"jumpToDetail\" data-index=\"{{index}}\" hover-class=\"navigator-hover\">\n      <van-card\n        thumb=\"{{ item.picUrl }}\"\n      >\n        <view slot=\"title\" class=\"coupon-list-title\">\n          <view class=\"van-ellipsis\">{{ item.shortTitle }}</view>\n        </view>\n\n        <view slot=\"desc\" class=\"coupon-list-desc\">\n          <view>热销 {{ item.saleCount }} 件</view>\n        </view>\n\n        <view slot=\"footer\" class=\"coupon-list-footer\">\n          <van-row class=\"text-right\">\n            <view>现价￥<text class=\"original-price\">{{ item.originalPrice }}</text></view>\n            <view>\n              <van-tag plain type=\"danger\">{{item.couponPrice}} 元</van-tag> 券后价<text class=\"present-price\">￥<text class=\"present-price-num\">{{ item.presentPrice }}</text>\n                </text>\n              </view>\n          </van-row>\n        </view>\n      </van-card>\n    </view>\n  </view>\n</view>"
  },
  {
    "path": "miniprogram/pages/ninenine/ninenine.wxss",
    "content": "/* pages/favour/favour.wxss */\n.top-search-bar {\n  background-color: #ff6666;\n  border: none\n}\n\n.coupon-list-title {\n  padding-bottom: 5px;\n}\n\n.coupon-list-desc {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.coupon-list-footer {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.original-price {\n  text-decoration: line-through;\n}\n\n.present-price {\n  color: #ff6666;\n}\n\n.present-price-num {\n  font-size: 18px;\n}\n\n.text-right {\n  text-align: right;\n}"
  },
  {
    "path": "miniprogram/pages/search/search.js",
    "content": "let app = getApp()\nPage({\n  data: {\n    couponList: [],\n    searchContent: \"\",\n    pageIndex: 1\n  },\n\n  onLoad: function (options) {\n  },\n\n  onShow: function () {\n    if (wx.getStorageSync('isDetailBack')) {\n      wx.removeStorageSync('isDetailBack')\n      return\n    }\n\n    this.setData({\n      couponList: [],\n      searchContent: \"\",\n      pageIndex: 1\n    })\n  },\n\n  onSearch: function (e) {\n    if (e.detail !== \"\") {\n      this.setData({\n        searchContent: e.detail,\n        couponList: []\n      }, () => {\n        this.getMoreCouponList()\n      })\n    }\n  },\n\n  jumpToDetail: function (e) {\n    wx.setStorage({\n      key: 'couponInfo',\n      data: this.data.couponList[e.currentTarget.dataset.index],\n      success: () => {\n        wx.navigateTo({\n          url: '../detail/detail',\n        })\n      }\n    })\n  },\n\n  getMoreCouponList: function () {\n    var that = this\n\n    wx.showLoading({\n      title: '加载中',\n    })\n\n    wx.cloud.callFunction({\n      name: 'getSearchList',\n      data: {\n        'query': that.data.searchContent,\n        'page': that.data.pageIndex\n      },\n      success: response => {\n        that.setData({\n          couponList: that.data.couponList.concat(response.result)\n        }, () => {\n          wx.hideLoading()\n        })\n      }\n    })\n  },\n\n  jumpToDetail: function (e) {\n    wx.setStorage({\n      key: 'couponInfo',\n      data: this.data.couponList[e.currentTarget.dataset.index],\n      success: () => {\n        wx.navigateTo({\n          url: '../detail/detail',\n        })\n      }\n    })\n  },\n\n  onReachBottom: function () {\n    if (this.data.searchContent !== \"\") {\n      this.setData({\n        pageIndex: this.data.pageIndex + 1\n      }, () => {\n        this.getMoreCouponList()\n      })\n    }\n  }\n})\n"
  },
  {
    "path": "miniprogram/pages/search/search.json",
    "content": "{\n  \"usingComponents\": {\n    \"van-row\": \"../../../miniprogram_npm/vant-weapp/row/index\",\n    \"van-col\": \"../../../miniprogram_npm/vant-weapp/col/index\",\n    \"van-search\": \"../../../miniprogram_npm/vant-weapp/search/index\",\n    \"van-tab\": \"../../../miniprogram_npm/vant-weapp/tab/index\",\n    \"van-tabs\": \"../../../miniprogram_npm/vant-weapp/tabs/index\",\n    \"van-button\": \"../../../miniprogram_npm/vant-weapp/button/index\",\n    \"van-card\": \"../../../miniprogram_npm/vant-weapp/card/index\",\n    \"van-tag\": \"../../../miniprogram_npm/vant-weapp/tag/index\",\n    \"van-icon\": \"../../../miniprogram_npm/vant-weapp/icon/index\"\n  }\n}"
  },
  {
    "path": "miniprogram/pages/search/search.wxml",
    "content": "<view class=\"page\">\n  <view>\n    <van-search\n      placeholder=\"请输入搜索关键词\"\n      bind:search=\"onSearch\"\n      class=\"top-search-bar\"\n    >\n    </van-search>\n  </view>\n\n  <view hidden=\"{{ couponList.length != 0 }}\">\n    <image src=\"../../images/search-tips.jpg\" style=\"width:100%;\" mode=\"widthFix\"></image>\n  </view>\n\n  <view>\n    <view wx:for=\"{{ couponList }}\" wx:key=\"{{ item.itemId }}\" bindtap=\"jumpToDetail\" data-index=\"{{index}}\" hover-class=\"navigator-hover\">\n      <van-card\n        thumb=\"{{ item.picUrl }}\"\n      >\n        <view slot=\"title\" class=\"coupon-list-title\">\n          <view class=\"van-ellipsis\">{{ item.shortTitle }}</view>\n        </view>\n\n        <view slot=\"desc\" class=\"coupon-list-desc\">\n          <view>热销 {{ item.saleCount }} 件</view>\n        </view>\n\n        <view slot=\"footer\" class=\"coupon-list-footer\">\n          <van-row class=\"text-right\">\n            <view>现价￥<text class=\"original-price\">{{ item.originalPrice }}</text></view>\n            <view>\n              <van-tag plain type=\"danger\">{{item.couponPrice}} 元</van-tag> 券后价<text class=\"present-price\">￥<text class=\"present-price-num\">{{ item.presentPrice }}</text>\n                </text>\n              </view>\n          </van-row>\n        </view>\n      </van-card>\n    </view>\n  </view>\n</view>"
  },
  {
    "path": "miniprogram/pages/search/search.wxss",
    "content": "/* pages/favour/favour.wxss */\n.search-btn {\n  padding: 0 8px;\n  background-color: #fff;\n}\n\n.coupon-list-title {\n  padding-bottom: 5px;\n}\n\n.coupon-list-desc {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.coupon-list-footer {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.original-price {\n  text-decoration: line-through;\n}\n\n.present-price {\n  color: #ff6666;\n}\n\n.present-price-num {\n  font-size: 18px;\n}\n\n.text-right {\n  text-align: right;\n}"
  },
  {
    "path": "miniprogram/pages/time/time.js",
    "content": "let app = getApp()\nPage({\n  data: {\n    couponList: [],\n    selectedSortIndex: 0,\n    selectedCatIndex: 0,\n    pageIndex: 1\n  },\n\n  onLoad: function (options) {\n  },\n\n  onShow: function () {\n    if (wx.getStorageSync('isDetailBack')) {\n      wx.removeStorageSync('isDetailBack')\n      return\n    }\n\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      selectedSortIndex: wx.getStorageSync('selectedSortIndex'),\n      selectedCatIndex: wx.getStorageSync('selectedCatIndex')\n    })\n    this.getMoreCouponList()\n  },\n\n  getMoreCouponList: function () {\n    var that = this\n    wx.showLoading({\n      title: '加载中',\n    })\n    wx.cloud.callFunction({\n      name: 'getTimeList',\n      data: {\n        'category': that.data.selectedCatIndex ? that.data.categoryList[that.data.selectedCatIndex].id : '',\n        'page': that.data.pageIndex\n      },\n      success: response => {\n        that.setData({\n          couponList: that.data.couponList.concat(response.result)\n        }, () => {\n          wx.hideLoading()\n        })\n      }\n    })\n  },\n\n  sortByChanged: function (e) {\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      selectedSortIndex: e.detail.index,\n    })\n    this.getMoreCouponList()\n    wx.setStorageSync('selectedSortIndex', e.detail.index)\n  },\n\n  categoryChanged: function (e) {\n    this.setData({\n      couponList: [],\n      pageIndex: 1,\n      selectedCatIndex: e.detail.value,\n    })\n    this.getMoreCouponList()\n    wx.setStorageSync('selectedCatIndex', e.detail.value)\n  },\n\n  jumpToDetail: function (e) {\n    wx.setStorage({\n      key: 'couponInfo',\n      data: this.data.couponList[e.currentTarget.dataset.index],\n      success: () => {\n        wx.navigateTo({\n          url: '../detail/detail',\n        })\n      }\n    })\n  },\n\n  onPullDownRefresh: function () {\n    this.setData({\n      couponList: [],\n      pageIndex: 1\n    })\n    wx.stopPullDownRefresh()\n    this.getMoreCouponList()\n  },\n\n  onReachBottom: function () {\n    this.setData({\n      pageIndex: this.data.pageIndex + 1\n    })\n    this.getMoreCouponList()\n  }\n})\n"
  },
  {
    "path": "miniprogram/pages/time/time.json",
    "content": "{\n  \"usingComponents\": {\n    \"van-row\": \"../../../miniprogram_npm/vant-weapp/row/index\",\n    \"van-col\": \"../../../miniprogram_npm/vant-weapp/col/index\",\n    \"van-search\": \"../../../miniprogram_npm/vant-weapp/search/index\",\n    \"van-tab\": \"../../../miniprogram_npm/vant-weapp/tab/index\",\n    \"van-tabs\": \"../../../miniprogram_npm/vant-weapp/tabs/index\",\n    \"van-button\": \"../../../miniprogram_npm/vant-weapp/button/index\",\n    \"van-card\": \"../../../miniprogram_npm/vant-weapp/card/index\",\n    \"van-tag\": \"../../../miniprogram_npm/vant-weapp/tag/index\",\n    \"van-icon\": \"../../../miniprogram_npm/vant-weapp/icon/index\"\n  }\n}"
  },
  {
    "path": "miniprogram/pages/time/time.wxml",
    "content": "<view class=\"page\">\n  <view style=\"padding: 3px;\">\n    <image src=\"../../images/time-items.jpg\" style=\"width:100%;\" mode=\"widthFix\"></image>\n  </view>\n\n  <view>\n    <view wx:for=\"{{ couponList }}\" wx:key=\"{{ item.itemId }}\" bindtap=\"jumpToDetail\" data-index=\"{{index}}\" hover-class=\"navigator-hover\">\n      <van-card\n        thumb=\"{{ item.picUrl }}\"\n      >\n        <view slot=\"title\" class=\"coupon-list-title\">\n          <view class=\"van-ellipsis\">{{ item.shortTitle }}</view>\n        </view>\n\n        <view slot=\"desc\" class=\"coupon-list-desc\">\n          <view>热销 {{ item.saleCount }} 件</view>\n        </view>\n\n        <view slot=\"footer\" class=\"coupon-list-footer\">\n          <van-row class=\"text-right\">\n            <view>现价￥<text class=\"original-price\">{{ item.originalPrice }}</text></view>\n            <view>\n              <van-tag plain type=\"danger\">{{item.couponPrice}} 元</van-tag> 券后价<text class=\"present-price\">￥<text class=\"present-price-num\">{{ item.presentPrice }}</text>\n                </text>\n              </view>\n          </van-row>\n        </view>\n      </van-card>\n    </view>\n  </view>\n</view>"
  },
  {
    "path": "miniprogram/pages/time/time.wxss",
    "content": "/* pages/favour/favour.wxss */\n.top-search-bar {\n  background-color: #ff6666;\n  border: none\n}\n\n.coupon-list-title {\n  padding-bottom: 5px;\n}\n\n.coupon-list-desc {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.coupon-list-footer {\n  color: #b6b6b6;\n  font-size: 12px;\n}\n\n.original-price {\n  text-decoration: line-through;\n}\n\n.present-price {\n  color: #ff6666;\n}\n\n.present-price-num {\n  font-size: 18px;\n}\n\n.text-right {\n  text-align: right;\n}"
  }
]