KainyGuo vor 6 Jahren
Ursprung
Commit
901d7183d9
100 geänderte Dateien mit 4509 neuen und 2290 gelöschten Zeilen
  1. 13 13
      LICENSE
  2. 25 25
      README.md
  3. 22 56
      src/app.js
  4. 1 0
      src/app.wxss
  5. 211 0
      src/common/api/api.js
  6. 90 0
      src/common/countdown/countdown.js
  7. 3 0
      src/common/countdown/countdown.json
  8. 6 0
      src/common/countdown/countdown.wxml
  9. 22 0
      src/common/countdown/countdown.wxss
  10. 70 0
      src/common/login/login.js
  11. 3 0
      src/common/login/login.json
  12. 13 0
      src/common/login/login.wxml
  13. 65 0
      src/common/login/login.wxss
  14. 43 0
      src/common/toptips/index.js
  15. 3 0
      src/common/toptips/index.wxml
  16. 22 0
      src/common/toptips/index.wxss
  17. 86 0
      src/common/user/user.js
  18. 14 0
      src/config.js
  19. BIN
      src/img/11.png
  20. BIN
      src/img/2.png
  21. BIN
      src/img/3.png
  22. BIN
      src/img/btn_baocun@2x.png
  23. BIN
      src/img/wechat.png
  24. 287 0
      src/lib/promise/promise.js
  25. 1 0
      src/lib/util/base64.min.js
  26. 483 0
      src/lib/util/util.js
  27. 48 0
      src/lib/wx/wx.js
  28. 99 65
      src/pages/activityDetail/activityDetail.js
  29. 47 47
      src/pages/activityDetail/activityDetail.wxml
  30. 532 190
      src/pages/creatOrder/creatOrder.js
  31. 4 1
      src/pages/creatOrder/creatOrder.json
  32. 153 150
      src/pages/creatOrder/creatOrder.wxml
  33. 8 6
      src/pages/creatOrder/creatOrder.wxss
  34. 150 60
      src/pages/flashSale/index.js
  35. 5 1
      src/pages/flashSale/index.json
  36. 42 57
      src/pages/flashSale/index.wxml
  37. 5 0
      src/pages/flashSale/index.wxss
  38. 58 3
      src/pages/huiTravel/index.js
  39. 15 23
      src/pages/huiTravel/index.wxml
  40. 5 0
      src/pages/huiTravel/index.wxss
  41. 218 91
      src/pages/index/index.js
  42. 5 1
      src/pages/index/index.json
  43. 57 185
      src/pages/index/index.wxml
  44. 3 3
      src/pages/index/index.wxss
  45. 39 2
      src/pages/me/me.js
  46. 14 23
      src/pages/me/me.wxml
  47. 197 66
      src/pages/menpiao/index.js
  48. 42 133
      src/pages/menpiao/index.wxml
  49. 4 0
      src/pages/menpiao/index.wxss
  50. 212 67
      src/pages/myOrder/myOrder.js
  51. 4 1
      src/pages/myOrder/myOrder.json
  52. 18 72
      src/pages/myOrder/myOrder.wxml
  53. 89 65
      src/pages/needKnow/needKnow.js
  54. 95 95
      src/pages/needKnow/needKnow.wxml
  55. 167 80
      src/pages/orderDetail/orderDetail.js
  56. 117 142
      src/pages/orderDetail/orderDetail.wxml
  57. 1 0
      src/pages/orderDetail/orderDetail.wxss
  58. 79 79
      src/pages/repay/repay.js
  59. 55 55
      src/pages/repay/repay.wxml
  60. 34 31
      src/pages/reverse/index.js
  61. 4 1
      src/pages/reverse/index.json
  62. 13 56
      src/pages/reverse/index.wxml
  63. 65 65
      src/pages/selectOwner/editOwner.js
  64. 25 25
      src/pages/selectOwner/editOwner.wxml
  65. 65 65
      src/pages/selectOwner/selectOwner.js
  66. 41 41
      src/pages/selectOwner/selectOwner.wxml
  67. 112 10
      src/pages/travel/detail.js
  68. 78 137
      src/pages/travel/detail.wxml
  69. 2 2
      src/project.config.json
  70. BIN
      src/wxParse/emojis/00.gif
  71. BIN
      src/wxParse/emojis/01.gif
  72. BIN
      src/wxParse/emojis/02.gif
  73. BIN
      src/wxParse/emojis/03.gif
  74. BIN
      src/wxParse/emojis/04.gif
  75. BIN
      src/wxParse/emojis/05.gif
  76. BIN
      src/wxParse/emojis/06.gif
  77. BIN
      src/wxParse/emojis/07.gif
  78. BIN
      src/wxParse/emojis/08.gif
  79. BIN
      src/wxParse/emojis/09.gif
  80. BIN
      src/wxParse/emojis/10.gif
  81. BIN
      src/wxParse/emojis/100.gif
  82. BIN
      src/wxParse/emojis/101.gif
  83. BIN
      src/wxParse/emojis/102.gif
  84. BIN
      src/wxParse/emojis/103.gif
  85. BIN
      src/wxParse/emojis/104.gif
  86. BIN
      src/wxParse/emojis/105.gif
  87. BIN
      src/wxParse/emojis/106.gif
  88. BIN
      src/wxParse/emojis/107.gif
  89. BIN
      src/wxParse/emojis/108.gif
  90. BIN
      src/wxParse/emojis/109.gif
  91. BIN
      src/wxParse/emojis/11.gif
  92. BIN
      src/wxParse/emojis/110.gif
  93. BIN
      src/wxParse/emojis/111.gif
  94. BIN
      src/wxParse/emojis/112.gif
  95. BIN
      src/wxParse/emojis/113.gif
  96. BIN
      src/wxParse/emojis/114.gif
  97. BIN
      src/wxParse/emojis/115.gif
  98. BIN
      src/wxParse/emojis/116.gif
  99. BIN
      src/wxParse/emojis/117.gif
  100. 0 0
      src/wxParse/emojis/118.gif

Datei-Diff unterdrückt, da er zu groß ist
+ 13 - 13
LICENSE


+ 25 - 25
README.md

@@ -1,26 +1,26 @@
-# menpiao
-
-门票预订小程序
-
-## 小程序账号信息
-  - AppID(小程序ID): wx92485988c18d94c4   
-  - secret:94ccdcb817279a5b857da9c14fb87d6f
-  - 商户号: 1496543922
-
-## 接口路径
-  - 生产:https://api3.zowoyoo.com/api/minapp/ticket/hotProducts
-
-  - 测试(后台管理):https://yanshi.zowoyoo.com/home/index.jsp
-
-## 设计稿及文档
-  - 设计稿:https://lanhuapp.com/url/9qSvD
-  - 接口文档: /READEEM/小程序UI.pdf
-
-## 模块
-  - 主页
-  - 景点门票 
-  - 自由行(资讯 /api/minapp/news/infos)
-  - 预定
-  - 订单
-  - 限时抢购
+# menpiao
+
+门票预订小程序
+
+## 小程序账号信息
+  - AppID(小程序ID): wx92485988c18d94c4   
+  - secret:94ccdcb817279a5b857da9c14fb87d6f
+  - 商户号: 1496543922
+
+## 接口路径
+  - 生产:https://api3.zowoyoo.com/api/minapp/ticket/hotProducts
+
+  - 测试(后台管理):https://yanshi.zowoyoo.com/home/index.jsp
+
+## 设计稿及文档
+  - 设计稿:https://lanhuapp.com/url/9qSvD
+  - 接口文档: /READEEM/小程序UI.pdf
+
+## 模块
+  - 主页
+  - 景点门票 
+  - 自由行(资讯 /api/minapp/news/infos)
+  - 预定
+  - 订单
+  - 限时抢购
   - 我的

+ 22 - 56
src/app.js

@@ -1,60 +1,26 @@
-// app.js
-var env = 1
-
-/* 服务器链接 */
-var Domain = 'https://api3.zowoyoo.com/';
-var Testmain = 'https://yanshi.zowoyoo.com/home/index.jsp/'
-if (env == 0) {
-  Domain = Testmain;
-} else {
-  Domain = Domain
-}
-
-
+import wxPromisify from './lib/wx/wx.js';
+import { getRandomNum } from './lib/util/util.js';
+import config from './config.js';
+import shuoAPI from './common/api/api.js';
+import shuoUser from './common/user/user.js';
 App({
-  onLaunch: function() {
-
+  onLaunch: function () {
+    shuoAPI.onError(function (err) {
+      if (err.code === 401) { //401:session验证失败
+        // 重新登录
+        shuoAPI.wechatUserLogin();
+      }
+      wxPromisify.showModal({ content: "" + err, showCancel: false });
+    });
+    console.log("onLaunch...");
   },
-
-  //get请求
-  $get: function(url, params, success, fail) {
-    let self = this
-    let obj = {}
-    obj.ParentCustId = 288037
-    obj.appId = 'wx92485988c18d94c4'
-    obj.userId = 'holiday'
-    obj.custId = 288222
-    wx.request({
-      url: Domain + url,
-      data: Object.assign(params, obj),
-      method: "get",
-      header: Object.assign({
-        'Content-Type': 'application/json;charset=UTF-8' // 默认值
-      }, obj),
-      success: success,
-      fail: fail
-    })
+  // 获得标语
+  getSlogan: function () {
+    let max = config.sloganArr.length - 1;
+    let n = getRandomNum(0, max);
+    return config.sloganArr[n];
   },
-  //post请求
-  $post: function(url, params, success, fail) {
-    let self = this
-    let obj = {}
-    obj.ParentCustId = 288037
-    obj.appId = 'wx92485988c18d94c4'
-    obj.userId = 'holiday'
-    obj.custId = 288222
-    wx.request({
-      url: Domain + url,
-      data: JSON.stringify(params),
-      method: 'post',
-      header: Object.assign({
-        'Content-Type': 'application/json;charset=UTF-8' // 默认值
-      }, obj),
-      success: success,
-      fail: fail
-    })
-  },
-  globalData: {
-    userInfo: null
+  onError: function (e) {
+    wxPromisify.showModal({ content: e });
   }
-})
+})

+ 1 - 0
src/app.wxss

@@ -665,3 +665,4 @@ button:after {
   height: 196rpx;
   z-index: -1;
 }
+

+ 211 - 0
src/common/api/api.js

@@ -0,0 +1,211 @@
+/**
+ * 基于自我游系统接口的全新调整。
+ * 本模块提供所有后端接口的调用
+ */
+import wxPromisify from '../../lib/wx/wx.js';
+import Promise from '../../lib/promise/promise.js';
+import { extend } from '../../lib/util/util.js';
+import config from '../../config.js';
+import user from '../user/user.js';
+
+// 存放错误处理的回调,在 shuoAPI.onError 中注册回调
+let errorCallbacks = [];
+
+let APP_VERSION = config.version;
+// api域名,开发环境和正式环境
+let API_HOST = {
+  ENV_PROD: 'https://api3.zowoyoo.com', 
+  // ENV_PROD: 'https://dev.ziwoyou.cn'
+}['ENV_' + config.env.toUpperCase()];
+
+// api请求封装
+export const shuoAPIClient = {
+  request: (path, data = {}, requireLogin = true, method, header = {}, dataType) => {
+    let appendData = { version: APP_VERSION };
+    appendData.ParentCustId=config.ParentCustId;
+    appendData.appId = config.appId;
+    appendData.custId = wx.getStorageSync("order_cust_id") || config.custId;
+    appendData.userId = wx.getStorageSync("order_user_id");
+    if (requireLogin) {
+      appendData.sessionId = user.getMyTokenSync();
+    }
+    extend(header, appendData);
+
+    return wxPromisify.request({
+      url: API_HOST + path,
+      data: data,
+      header: header,
+      method: method,
+      dataType: dataType
+    }).then(res => {
+      // console.log('res返回值:', res, res.header['X-Authorization'],111)
+      var errMsg, errCode, httpStatus = res.statusCode;
+      if ((httpStatus >= 200 && httpStatus < 300) || httpStatus === 304) {
+        errCode = 0;
+      } else if (httpStatus == 401){
+        errMsg = '未登录或登录超时,操作失败';
+        errCode = httpStatus;
+      }else{
+        errMsg = '网络请求失败';
+        errCode = httpStatus;
+      }
+      // 根据返回值做一些处理
+      if (errCode !== 0 || errMsg) {
+        console.log("req error:", errCode);
+        let error = new Error(errMsg);
+        error.code = errCode;
+        error.httpStatus = httpStatus;
+        errorCallbacks.some(function (cb) {
+          return cb(error);
+        });
+        return error.resolved ? Promise.resolve(null) : Promise.reject(error);
+      }
+
+      // return Promise.resolve(res.data);
+      return Promise.resolve(res); // 测试调整
+    });
+  },
+
+  get: (path, data, requireLogin = true, header = {}, dataType) => {
+    return shuoAPIClient.request(path, data, requireLogin, 'GET', header, dataType);
+  },
+
+  post: (path, data, requireLogin = true, header = {}, dataType) => {
+    // json解析有问题
+    //extend(header, { 'content-type': 'application/x-www-form-urlencoded' });
+    return shuoAPIClient.request(path, data, requireLogin, 'POST', header, dataType);
+  }
+};
+
+let shuoUploadClient = {
+  request: (path, filePath, formData = {}, requireLogin = true, header = {}) => {
+    let appendData = { 
+      version: APP_VERSION,
+      'content-type': 'multipart/form-data'
+    };
+    if (requireLogin) {
+      appendData.sessionId = user.getMyTokenSync();
+    }
+    extend(header, appendData);
+    return wxPromisify.uploadFile({
+      url: API_HOST + path,
+      filePath: filePath,
+      name: 'file',
+      header: header,
+      formData: formData
+    }).then(res => {
+      var errMsg, errCode, httpStatus = res.statusCode;
+      if ((httpStatus >= 200 && httpStatus < 300) || httpStatus === 304) {
+        errCode = 0;
+      } else if (httpStatus == 401) {
+        errMsg = '未登录或登录超时,操作失败';
+        errCode = httpStatus;
+      } else {
+        errMsg = '网络请求失败';
+        errCode = httpStatus;
+      }
+      // 根据返回值做一些处理
+      if (errCode !== 0 || errMsg) {
+        let error = new Error(errMsg);
+        error.code = errCode;
+        error.httpStatus = httpStatus;
+        errorCallbacks.some(function (cb) {
+          return cb(error);
+        });
+        return error.resolved ? Promise.resolve(null) : Promise.reject(error);
+      }
+      
+      return Promise.resolve(res.data);
+    });
+  },
+  upload: (path, filePath, formData = {}, requireLogin = true, header = {}) => {
+    return shuoUploadClient.request(path, filePath, formData, requireLogin, header);
+  }
+};
+
+/**
+ * API的名字由文档里的接口地址变换而来, 去掉了前面统一的路径 /wechat/user/login, 将斜杠变成驼峰 wechatUserLogin
+ */
+export default {
+  /**
+   * 指定请求接口出错时的回调
+   */
+  onError: function (cb) { errorCallbacks.push(cb); },
+
+  /**
+   * 登录(会调用 wx.login 并将获取到的code提供给后端)
+   * @return {Promise} 发送请求的Promise
+   */
+  wechatUserLogin: function () {
+    // 登录
+    return wxPromisify.login().then(res => {
+      let wxUserInfo = {};
+      console.log('res:',res)
+      console.log("code:", res.code);
+      wxUserInfo["code"] = res.code;
+      wxUserInfo["ParentCustId"] = config.ParentCustId;
+      wxUserInfo["appId"] = config.appId;
+      // 获取用户信息
+      wxUserInfo["userInfo"] = wx.getStorageSync('userInfo')
+      wxUserInfo["order_cust_id"] = wx.getStorageSync("order_cust_id");
+      wxUserInfo["order_user_id"] = wx.getStorageSync("order_user_id");
+      console.log("userInfo:", wx.getStorageSync('userInfo'));
+      // 无用户信息,授权到此为止
+      if (!wx.getStorageSync('userInfo')) return null;
+      // 获取系统信息
+      return wxPromisify.getSystemInfo().then(sysRes => {
+        console.log("sysRes:", sysRes);
+        wxUserInfo["deviceInfo"] = sysRes;
+        let selfData = {
+          appId: config.appId,
+          code: wxUserInfo["code"],
+          ...wxUserInfo["userInfo"],
+          orderCustId: wx.getStorageSync("order_cust_id") || config.custId,
+          orderUserId: wx.getStorageSync("order_user_id") || ''
+        }
+        
+        return shuoAPIClient.post('/api/minapp/user/minAppLogin', selfData, true).then(loginRes => {
+          console.log("loginRes:", loginRes);
+          wx.setStorageSync("order_cust_id", loginRes.data.orderCustId || config.custId);
+          wx.setStorageSync("order_user_id", loginRes.data.orderUserId || '');
+          let uInfo = {
+            info: wx.getStorageSync('userInfo'),
+            sessionId: loginRes.data.sessionId || ''
+          };
+          user.setCurrentUserSync(uInfo);
+          return uInfo;
+        });
+      });
+    });
+  },
+  /**
+   * 获得本人的信息
+   */
+  wechatUserMyInfo: () => shuoAPIClient.get('/api/3/myInfo.jsp'),
+  
+  /**
+   * 获得商户信息
+   */
+  wechatUserAgentInfo: (order_cust_id) => shuoAPIClient.get('/api/3/custInfo', { order_cust_id: order_cust_id}),
+
+  /**
+   * 微信举报
+   */
+  wechatComplaint: (phone, wechat, content, formId) => shuoAPIClient.post('/app/complaint/submit', { userMobile: phone, userWechat: wechat, complaintContent:content, wxFormId: formId }, true, { 'content-type': 'application/x-www-form-urlencoded' }),
+
+  /**微信抢购下单 */
+  wechatOrder: (json) => shuoAPIClient.post('/api/3/order.jsp', json, true, { 'content-type': 'application/x-www-form-urlencoded' }),
+
+  wechatOrderDetail: (id) => shuoAPIClient.post('/api/3/orderDetail.jsp', { orderId: id }, true, { 'content-type': 'application/x-www-form-urlencoded' }),
+
+  wechatOrderPay: (id) => shuoAPIClient.post('/api/3/payInfo.jsp', { orderId: id }, true, { 'content-type': 'application/x-www-form-urlencoded' }),
+  // 抢购的产品详情
+  wechatSnapUpPordDetail: (infoId) => shuoAPIClient.get(`/api/minapp/snapup/product/${infoId}`),
+
+  /* wechatPordDetailOrder: (id, travelDate, orderCustId) => shuoAPIClient.post('/api/3/detail.jsp', { infoId: id, isOrder: 1, travelDate: travelDate, orderCustId: orderCustId}, true, { 'content-type': 'application/x-www-form-urlencoded' }),
+
+  wechatNewsDetail: (id, order_cust_id) => shuoAPIClient.post('/api/3/newsDetail.jsp', { infoId: id, order_cust_id: order_cust_id }, true, { 'content-type': 'application/x-www-form-urlencoded' }),
+ */
+  //设置提醒
+  wechatTips: (data) => shuoAPIClient.post('/api/minapp/user/notifications', data, true),
+}

+ 90 - 0
src/common/countdown/countdown.js

@@ -0,0 +1,90 @@
+Component({
+  properties: {
+    // 属性值可以在组件使用时指定
+    startTime: {
+      type: Number,
+      value: 0
+      // observer: function (newVal, oldVal, changedPath) {
+      //   // 属性被改变时执行的函数(可选)
+      //   this.data.startTime = newVal
+      // }
+    },
+    endTime: {
+      type: Number,
+      value: 0
+      // observer: function (newVal, oldVal, changedPath) {
+      //   // 属性被改变时执行的函数(可选)
+      //   this.data.endTime = newVal
+      // }
+    },
+    dayEmpty: {
+      type: Boolean,
+      value: true
+    }
+  },
+  data: {
+    // 这里是一些组件内部数据
+    dayEmpty: true,
+    day: 0,
+    hour: 0,
+    minute: 0,
+    second: 0,
+    interval: null
+  },
+  
+  ready: function () {
+    // 在组件实例进入页面节点树时执行
+    this.setData({
+      dayEmpty: this.properties.dayEmpty
+    })
+    this.countdown()
+  },
+  detached: function () {
+    // 在组件实例被从页面节点树移除时执行
+    console.log('停止')
+    clearInterval(this.data.interval)
+  },
+  methods: {
+    // 这里是一个自定义方法
+    countdown(){
+      let self = this
+      let stime = self.properties.startTime;
+      let etime = self.properties.endTime;
+      if (!stime || stime == 0 || !etime || etime == 0) {
+        return false
+      }
+      self.data.interval = setInterval(function(){
+        let stime = self.properties.startTime;
+        let etime = self.properties.endTime;
+        self.properties.startTime = self.properties.startTime + 1000;
+        let t = etime - stime;
+        let d = Math.floor(t / 1000 / 60 / 60 / 24);
+        let hour = Math.floor(t / 1000 / 60 / 60 % 24);
+        let min = Math.floor(t / 1000 / 60 % 60);
+        let sec = Math.floor(t / 1000 % 60);
+        if (self.properties.dayEmpty) {
+          hour += d * 24
+        }
+        if (hour < 0 || min < 0 || sec < 0) {
+          clearInterval(self.data.interval)
+        }
+        if (hour < 10) {
+          hour = "0" + hour
+        }
+        if (min < 10) {
+          min = "0" + min
+        }
+        if (sec < 10) {
+          sec = "0" + sec
+        }
+        // console.log('time', hour+':'+min+':'+sec)
+        self.setData({
+          day: d,
+          hour: hour,
+          minute: min,
+          second: sec
+        }) 
+      }, 1000)
+    }
+  }
+})

+ 3 - 0
src/common/countdown/countdown.json

@@ -0,0 +1,3 @@
+{
+  "component": true
+}

+ 6 - 0
src/common/countdown/countdown.wxml

@@ -0,0 +1,6 @@
+<view class='flex f20 flex flex-aic' style='color:#FD7644'>
+  <view wx:if='{{!dayEmpty}}' class='flex mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{day}}</view><text wx:if='{{!dayEmpty}}' class="mr10">天</text>
+  <view class='flex mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{hour}}</view>:
+  <view class='flex ml10 mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{minute}}</view>:
+  <view class='flex ml10 mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{second}}</view>
+</view>

+ 22 - 0
src/common/countdown/countdown.wxss

@@ -0,0 +1,22 @@
+.flex {
+  display: flex;
+}
+.f20 {
+  font-size: 20rpx;
+}
+.flex-aic {
+  align-items: center;
+}
+.mr10 {
+  margin-right: 10rpx;
+}
+.flex-center {
+  justify-content: center;
+  align-items: center;
+}
+.cfff {
+  color: #fff;
+}
+.ml10 {
+  margin-left: 10rpx;
+}

+ 70 - 0
src/common/login/login.js

@@ -0,0 +1,70 @@
+import shuoAPI, { shuoAPIClient } from '../api/api.js'
+import shuoUser from '../user/user.js';
+Component({
+  properties: {
+    // 属性值可以在组件使用时指定
+    
+  },
+  data: {
+    // 这里是一些组件内部数据
+    selfAuthVisible: false
+  },
+  
+  ready: function () {
+    // 在组件实例进入页面节点树时执行
+    let that = this
+    //获取授权
+    wx.checkSession({
+      success: function () {
+        console.log(" onLoad sessionId:", shuoUser.getMyTokenSync());
+        if (!shuoUser.checkMyToken()) {
+          that.loginAndInitData();
+        }
+      },
+      fail: function () {
+        console.log('fail session ')
+        that.loginAndInitData();
+      }
+    });
+  },
+  detached: function () {
+    // 在组件实例被从页面节点树移除时执行
+
+  },
+  methods: {
+    // 这里是一个自定义方法
+    loginAndInitData() {
+      shuoAPI.wechatUserLogin().then(res => {
+        console.log('wechatUserLogin res:', res);
+        if (!res) {
+          this.setData({
+            selfAuthVisible: true
+          })
+          return;
+        } else {
+          this.initData()
+        }
+      });
+    },
+    // 授权遮罩
+    authMask() {
+      this.setData({
+        selfAuthVisible: false
+      })
+    },
+    // 点击获取用户信息
+    onGotUserInfo(e) {
+      console.log('点击获取用户信息: ', e.detail)
+      wx.setStorageSync('userInfo', e.detail.userInfo)
+      this.loginAndInitData()
+      this.setData({
+        selfAuthVisible: false
+      })
+      console.log('getCurrentPages()', getCurrentPages())
+    },
+    //初始化数据
+    initData() {
+      this.triggerEvent('loginCallBack', true) //myevent自定义名称事件,父组件中使用
+    },
+  }
+})

+ 3 - 0
src/common/login/login.json

@@ -0,0 +1,3 @@
+{
+  "component": true
+}

+ 13 - 0
src/common/login/login.wxml

@@ -0,0 +1,13 @@
+<!-- 授权弹窗 -->
+<view class='accredit-wrap1' wx:if="{{selfAuthVisible}}">
+  <view class='mask1' bindtap='authMask'></view>
+  <view class='accredit-box1'>
+    <view class='box-top1'>微信授权</view>
+    <view class='box-cont1'>
+      <view class='logo1'><image src='/img/wechat.png'></image></view>
+      <view class='info1'>小程序申请获得以下权限:</view>
+      <view class='tips1'>获得你的公开信息(昵称、头像等)</view>
+      <button class='btn1' open-type="getUserInfo" lang="zh_CN" bindgetuserinfo="onGotUserInfo">确认授权</button>
+    </view>
+  </view>
+</view>

+ 65 - 0
src/common/login/login.wxss

@@ -0,0 +1,65 @@
+/*授权*/
+.accredit-wrap1{
+  z-index: 99;
+}
+.accredit-wrap1 .mask1 {
+  position: fixed;
+  width: 100%;
+  height: 100%;
+  top:0;
+  left: 0;
+  background-color: rgba(0, 0, 0, 0.6);
+  z-index: 99;
+} 
+.accredit-wrap1 .accredit-box1 {
+  background-color: #fff;
+  position: fixed;
+  left: 50%;
+  top: 50%;
+  width: 500rpx;
+  margin-left:-250rpx;
+  transform: translateY(-50%);
+  border-radius: 10rpx;
+  z-index: 99;
+}
+.accredit-wrap1 .accredit-box1 .box-top1 {
+  height: 90rpx;
+  line-height: 90rpx;
+  text-align: center;
+  font-size: 32rpx;
+  font-weight: bold;
+  border-bottom: 2rpx solid #eee;
+}
+.accredit-wrap1 .accredit-box1 .box-cont1 .logo1 {
+  width:80rpx;
+  height: 80rpx;
+  margin: 30rpx auto;
+}
+.accredit-wrap1 .accredit-box1 .box-cont1 .logo1 image {
+  width:100%;
+  height: 100%;
+}
+.accredit-wrap1 .accredit-box1 .box-cont1 .info1 {
+  margin: 0 50rpx;
+  border-bottom: 2rpx solid #f4f4f4;
+  padding-bottom: 20rpx;
+  font-size: 28rpx;
+}
+.accredit-wrap1 .accredit-box1 .box-cont1 .tips1 {
+  font-size: 24rpx;
+  color: #555;
+  margin: 0 50rpx;
+  padding: 20rpx 0;
+}
+.accredit-wrap1 .accredit-box1 .box-cont1 .btn1 {
+  background-color: transparent;
+  font-size: 28rpx;
+  border-top: 2rpx solid #eee;
+  margin-top: 20rpx;
+  color: #4db232;
+  line-height:2.6;
+  display:block;
+}
+.accredit-wrap1 .accredit-box1 .box-cont1 button::after {
+  display: none;
+}

+ 43 - 0
src/common/toptips/index.js

@@ -0,0 +1,43 @@
+/*
+ * 有赞ui
+ * 顶部信息提示
+ */
+module.exports = {
+  showZanTopTips(content = '', options = {}) {
+    let zanTopTips = this.data.zanTopTips || {};
+    // 如果已经有一个计时器在了,就清理掉先
+    if (zanTopTips.timer) {
+      clearTimeout(zanTopTips.timer);
+      zanTopTips.timer = undefined;
+    }
+
+    if (typeof options === 'number') {
+      options = {
+        duration: options
+      };
+    }
+
+    // options参数默认参数扩展
+    options = Object.assign({
+      duration: 3000
+    }, options);
+
+    // 设置定时器,定时关闭topTips
+    let timer = setTimeout(() => {
+      this.setData({
+        'zanTopTips.show': false,
+        'zanTopTips.timer': undefined
+      });
+    }, options.duration);
+
+    // 展示出topTips
+    this.setData({
+      zanTopTips: {
+        show: true,
+        content,
+        options,
+        timer
+      }
+    });
+  }
+};

+ 3 - 0
src/common/toptips/index.wxml

@@ -0,0 +1,3 @@
+<template name="zan-toptips">
+  <view class="zan-toptips {{ zanTopTips.show ? 'zan-toptips--show' : '' }}">{{ zanTopTips.content }}</view>
+</template>

+ 22 - 0
src/common/toptips/index.wxss

@@ -0,0 +1,22 @@
+.zan-toptips {
+  display: block;
+  position: fixed;
+  -webkit-transform: translateZ(0) translateY(-100%);
+  width: 100%;
+  /* 至少有一行的高度,保证第一次动画显示正常 */
+  min-height: 32px;
+  top: 0;
+  line-height: 2.3;
+  font-size: 14px;
+  text-align: center;
+  color: #FFF;
+  background-color: #E64340;
+  z-index: 110;
+
+  /* 动画部分 */
+  transition: all 0.4s ease;
+}
+
+.zan-toptips--show {
+  -webkit-transform: translateZ(0) translateY(0);
+}

+ 86 - 0
src/common/user/user.js

@@ -0,0 +1,86 @@
+/**
+ * 爱说不说
+ * 本模块提供当前用户数据的读写
+ */
+import wx from '../../lib/wx/wx.js';
+import { extend } from '../../lib/util/util.js';
+
+// 本地存储中的缓存键名
+const STORAGE_KEY_USER = 'STORAGE_KEY_USER';
+
+
+// 缓存当前登录用户
+let cachedUser;
+// 获取当前登录用户
+function getCurrentUserSync() {
+  if (!cachedUser) {
+    cachedUser = wx.getStorageSync(STORAGE_KEY_USER);
+  }
+  return cachedUser || {};
+}
+
+export default {
+  /**
+   * 设置当前登录用户
+   * @param {Object} user 登录用户。包含info和sessionId两个字段
+   */
+  setCurrentUserSync: user => {
+    if (!user) { return; }
+    cachedUser = {
+      info: user.info,
+      sessionId: user.sessionId
+    };
+    wx.setStorageSync(STORAGE_KEY_USER, cachedUser);
+  },
+
+  /**
+   * 清理当前登录用户信息
+   */
+  clearCurrentUserSync: () => {
+    cachedUser = undefined;
+    wx.removeStorageSync(STORAGE_KEY_USER);
+  },
+
+  /**
+   * 获取当前用户的sessionId
+   * @return {String} 当前用户的sessionId
+   */
+  getMyTokenSync: () => {
+    return cachedUser ? cachedUser.sessionId : 0;
+  },
+
+  /**
+   * 本地判断用户是否登录(根据当前用户的sessionId判断)
+   * @return {Boolean} 当前用户是否登录
+   */
+  checkMyToken: () =>{
+    return cachedUser && cachedUser.sessionId;
+  },
+
+  /**
+   * 获取当前用户的信息
+   * @param {String} [key] 信息字段。如果为null,则返回全部信息
+   * @return {Any|Object} 用户信息
+   */
+  getMyInfoSync: key => {
+    let info = getCurrentUserSync().info;
+    if (info) {
+      return key != null ? info[key] : extend({}, info);
+    } else {
+      return key != null ? null : {};
+    }
+  },
+
+  /**
+   * 更新当前用户的信息
+   * @param {Object} [values] 要更新的键值对
+   * @return {Object} 更新后的用户信息
+   */
+  updateMyInfoSync: values => {
+    let info = getCurrentUserSync().info;
+    if (info) {
+      extend(info, values);
+      return extend({}, info);
+    }
+  }
+};

+ 14 - 0
src/config.js

@@ -0,0 +1,14 @@
+export default {
+  version: '1.0.0',
+  appName: '自我游-限时抢购',// 自我游,爱订不订
+  env: 'prod',
+  publicPath: 'https://api3.zowoyoo.com',
+  downloadFile: 'https://yanshi.zowoyoo.com', // 预览或下载文件使用,暂时只拼团使用
+  ParentCustId: '84826',// 自我游15463,244727;爱订309845,331121;话语钱: 723081 ,测试:288037
+  appId: '101',// 小程序的编号
+  custId: '84826' //'451918 '
+  /* publicPath: 'https://dev.ziwoyou.cn',
+  ParentCustId: '288037',// 自我游15463,244727;爱订309845,331121;话语钱: 723081 ,测试:288037
+  appId: '101',// 小程序的编号
+  custId: '244727' // '451918 '  */
+};

BIN
src/img/11.png


BIN
src/img/2.png


BIN
src/img/3.png


BIN
src/img/btn_baocun@2x.png


BIN
src/img/wechat.png


+ 287 - 0
src/lib/promise/promise.js

@@ -0,0 +1,287 @@
+'use strict';
+
+
+// 输出错误日志(兼容旧浏览器)
+var logError = console && typeof console.error === 'function' ?
+	function(e) { console.error('Uncaught (in promise) %o', e); } :
+	function() { };
+
+
+// 判断某个对象是否支持then方法
+function isThenable(obj) { return obj && typeof obj.then === 'function'; }
+
+// 如果value是thenable的,就执行then,否则resolve
+function thenOrResolve(value, resolve, reject) {
+	if ( isThenable(value) ) {
+    value.then(resolve, reject);
+	} else {
+		resolve(value);
+	}
+}
+
+
+// Promise的四种状态(其中canceled是扩展的)
+var STATUS_PENDING = 0,
+	STATUS_FULFILLED = 1,
+	STATUS_REJECTED = 2,
+	STATUS_CANCELED = 3;
+
+
+/**
+ * ES6 Promise的兼容实现,并进行了必要的扩展
+ * @class Promise
+ * @constructor
+ * @param {Function} executor 带有resolve、reject、setCanceler三个参数的函数,
+ *   其中setCanceler用于指定cancel时执行的函数
+ */
+export default class Promise {
+  constructor(executor) {
+    if (typeof executor !== 'function') {
+      throw new Error('Promise executor must be a function');
+    }
+
+    let t = this;
+
+    // 初始状态为pending
+    t._status = STATUS_PENDING;
+
+    // 存放各种状态下的回调函数
+    t._pendings = { };
+
+    // 封装拒绝状态的确定(下面好几个地方用到)
+    function reject(reason) { t._settle(STATUS_REJECTED, reason); }
+
+    try {
+      executor((value) => {
+        thenOrResolve(value, function(value) {
+          t._settle(STATUS_FULFILLED, value);
+        }, reject);
+      }, reject, (canceler) => {
+        if (typeof canceler !== 'function') {
+          throw new Error('Promise canceler must be a function');
+        }
+        t._canceler = canceler;
+      });
+    } catch (e) {
+      reject(e);
+    }
+  }
+
+  // 确定状态并执行对应的回调
+  _settle(status, value) {
+    let t = this;
+    // 如果不是处于初始状态,就不能再变了
+    if (t._status !== STATUS_PENDING) { return; }
+
+    t._status = status;
+    t._value = value;
+ 
+    // 拒绝状态下,如果没有对此状态的回调,则认为没有进行异常处理,输出拒绝信息
+    if (t._status === STATUS_REJECTED) {
+      setTimeout(() => {
+        if (!t._hasRejectedHandler) { logError(value); }
+      }, 0);
+    }
+
+    // 执行回调
+    let callbacks = t._pendings[status];
+    if (callbacks) {
+      callbacks.forEach((cb) => { cb(value); });
+    }
+
+    delete t._pendings;
+  }
+
+  // 添加回调函数
+  _listen(status, cb) {
+    let t = this;
+
+    // 记录当前promise有对拒绝状态进行处理
+    if (status === STATUS_REJECTED) { t._hasRejectedHandler = true; }
+
+    switch (t._status) {
+      case STATUS_PENDING:
+        t._pendings[status] = t._pendings[status] || [ ];
+        t._pendings[status].push(cb);
+        break;
+
+      case status:
+        cb(t._value);
+        break;
+    }
+  }
+
+  /**
+   * 取消操作(仅当promise的状态未确定时有效)
+   * @method cancel
+   * @for Promise
+   */
+  cancel() {
+    let t = this;
+    if (t._status === STATUS_PENDING) {
+      if (t._canceler) {
+        t._canceler.call(window);
+        t._settle(STATUS_CANCELED);
+      } else {
+        throw new Error('Promise canceler is undefined');
+      }
+    }
+  }
+
+  // 对then和spread的统一处理  
+  _then(onFulfilled, onRejected, toSpread) {
+    let t = this;
+
+    return new Promise((resolve, reject, setCanceler) => {
+      t._listen(STATUS_FULFILLED, function() {
+        let value = t._value;
+        if (onFulfilled) {
+          try {
+            if (toSpread) {
+              value = onFulfilled.apply(window, value);
+            } else {
+              value = onFulfilled.call(window, value);
+            }
+          } catch (e) {
+            reject(e);
+            return;
+          }
+        }
+        thenOrResolve(value, resolve, reject);
+      });
+
+      t._listen(STATUS_REJECTED, () => {
+        let value = t._value;
+        if (onRejected) {
+          try {
+            value = onRejected.call(window, value);
+          } catch (e) {
+            reject(e);
+            return;
+          }
+          thenOrResolve(value, resolve, reject);
+        } else {
+          reject(value);
+        }
+      });
+
+      if (t._canceler) {
+        setCanceler(() => { t.cancel(); });
+      }
+    });
+  }
+
+  /**
+   * 指定当前promise被解决后的操作
+   * @method then
+   * @for Promise
+   * @param {Function} onFulfilled 当前promise被满足后调用的函数
+   * @param {Function} onRejected 当前promise被拒绝后调用的函数
+   * @return {Promise} 以回调函数解决的promise
+   */
+  then(onFulfilled, onRejected) {
+    return this._then(onFulfilled, onRejected);
+  }
+
+  /**
+   * 指定当前promise被满足后的操作。仅当满足promise的值是数组时可用,数组会展开为回调函数的参数
+   * @method spread
+   * @for Promise
+   * @param {Function} onFulfilled 当前promise被满足后调用的函数
+   * @return {Promise} 以回调函数解决的promise
+   */
+  spread(onFulfilled) {
+    return this._then(onFulfilled, null, true);
+  }
+
+  /**
+   * 指定当前promise被拒绝后执行的操作
+   * @method catch
+   * @for Promise
+   * @param {Function} onRejected 当前promise被拒绝后调用的函数
+   * @return {Promise} 以回调函数解决的promise
+   */
+  catch(onRejected) {
+    return this.then(null, onRejected);
+  }
+
+  /**
+   * 指定当前promise被解决或被取消后执行的操作
+   * @method finally
+   * @for Promise
+   * @param {Function} handler 状态确定后执行的函数
+   * @return {Promise} 与当前promise状态相同的新promise
+   */
+  finally(handler) {
+    let t = this;
+
+    return new Promise((resolve, reject, setCanceler) => {
+      function callback() {
+        let result = {
+          code: t._status,
+          FULFILLED: STATUS_FULFILLED,
+          REJECTED: STATUS_REJECTED,
+          CANCELED: STATUS_CANCELED
+        };
+
+        let settle, value = t._value;
+        switch (t._status) {
+          case STATUS_FULFILLED:
+            result.value = value;
+            settle = function() { resolve(value); };
+            break;
+
+          case STATUS_REJECTED:
+            result.reason = value;
+            settle = function() { reject(value); };
+            break;
+        }
+
+        if (handler) {
+          try {
+            handler.call(window, result);
+          } catch (e) {
+            reject(e);
+            return;
+          }
+        }
+
+        if (settle) { settle(); }
+      }
+
+      if (t._canceler) {
+        setCanceler(() => { t.cancel(); });
+      }
+
+      t._listen(STATUS_FULFILLED, callback);
+      t._listen(STATUS_REJECTED, callback);
+      t._listen(STATUS_CANCELED, callback);
+    });
+  }
+
+	static all(promises) {
+		var count = promises.length;
+
+		if (count) {
+			return new Promise((resolve, reject) => {
+				var values = new Array(count);
+				promises.forEach((promise, i) => {
+					promise.then(value => {
+						values[i] = value;
+						if (!--count) { resolve(values); }
+					}, reject);
+				});
+			});
+		} else {
+			return Promise.resolve([ ]);
+		}
+	}
+
+  static resolve(value) {
+    return new Promise((resolve, reject) => resolve(value) )
+  }
+
+  static reject(error) {
+    return new Promise((resolve, reject) => reject(error) )
+  }
+}

Datei-Diff unterdrückt, da er zu groß ist
+ 1 - 0
src/lib/util/base64.min.js


+ 483 - 0
src/lib/util/util.js

@@ -0,0 +1,483 @@
+/**
+ * 把源对象自身的属性(Own Property)扩展到目标对象
+ * @method extend
+ * @param {Any} target 目标对象
+ * @param {Any*} [source] 源对象。若有同名属性,则后者覆盖前者
+ * @return {Any} 目标对象
+ */
+export function extend(target) {
+	if (target == null) { throw new Error('target cannot be null'); }
+
+	let i = 0, len = arguments.length, key, src;
+	while (++i < len) {
+		src = arguments[i];
+		if (src != null) {
+			for (key in src) {
+				if ( src.hasOwnProperty(key) ) { target[key] = src[key]; }
+			}
+		}
+	}
+
+	return target;
+}
+
+
+/**
+ * 扩展页面(若有同名方法,则先执行页面扩展对象的,最后执行目标页面的)
+ * @method extendPage
+ * @param {Object} target 目标页面
+ * @param {Object*} [source] 页面扩展对象
+ * @return {Any} 目标页面
+ */
+export function extendPage(target) {
+	if (target == null) { throw new Error('target cannot be null'); }
+
+	let i = 0, len = arguments.length, src;
+	while (++i < len) {
+		src = arguments[i];
+		Object.keys(src).forEach(function(key) {
+			let srcMember = src[key], targetMember = target[key];
+			if (typeof srcMember === 'function' && typeof targetMember === 'function') {
+				target[key] = function() {
+					let t = this,
+							args = arguments,
+							result = srcMember.apply(t, args);
+
+					if (result === false) {
+						return result;
+					} else if (result != null && typeof result.then === 'function') {
+						return result.then(function(value) {
+							return value === false ? value : targetMember.apply(t, args);
+						});
+					} else {
+						return targetMember.apply(t, args);
+					}
+				};
+			} else if (targetMember == null) {
+				target[key] = srcMember;
+			}
+		});
+	}
+
+	return target;
+}
+
+
+/**
+ * 解析日期
+ * @method parseDate
+ * @param {Number|Date} date 要解析的日期;如果为数字,则表示毫秒
+ * @return {Object} 解析后的日期对象
+ */
+export function parseDate(date) {
+	if (typeof date === 'number') {
+    if (date.toString().length==10){
+      date = date * 1000;
+    }
+		date = new Date(date);
+	}
+
+	return {
+		year: date.getFullYear().toString(),
+		month: ('0' + (date.getMonth() + 1)).slice(-2),
+		date: ('0' + date.getDate()).slice(-2),
+		day: '日一二三四五六'[date.getDay()],
+		originalDate: date
+	};
+}
+
+/// 日期格式化
+export function formatDate(date, format) {
+  if (typeof date === 'number') {
+    if (date.toString().length == 10) {
+      date = date * 1000;
+    }
+    date = new Date(date);
+  }
+  var o = {
+    "M+": date.getMonth() + 1, //month
+    "d+": date.getDate(),    //day
+    "h+": date.getHours(),   //hour
+    "m+": date.getMinutes(), //minute
+    "s+": date.getSeconds(), //second
+    "q+": Math.floor((date.getMonth() + 3) / 3),  //quarter
+    "S": date.getMilliseconds() //millisecond
+  }
+  if (/(y+)/.test(format)) format = format.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
+  for (var k in o)
+    if (new RegExp("(" + k + ")").test(format))
+      format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
+  return format;
+}
+
+/**
+ * 取区间内随机数
+ * @method getRandom
+ * @param {Number} min 最小数
+ * @param {Number} max 最大数
+ */
+export function getRandomNum(min, max) {
+  var range = max - min;
+  var rand = Math.random();
+  return (min + Math.round(rand * range));
+}  
+
+
+/**
+ * 获取指定宽度的图片URL
+ * @method resizeImg
+ * @param {String} url 图片URL
+ * @param {Number} width 指定宽度
+ * @return {String} 特定尺寸的图片的URL
+ */
+export function resizeImg(url, newWidth) {
+	if ( /^https?:\/\/qiniu-/i.test(url) ) {
+		url = url.replace(/[?\/]imageView2\/.*$/, '');
+		if (url.indexOf('?') !== -1) {
+			url += '/';
+		} else {
+			url += '?';
+		}
+		url += 'imageView2/0/w/' + newWidth;
+	}
+	return url;
+}
+
+
+/**
+ * 判断有效手机号码
+ * @method isPhoneNO
+ * @param {Number} mobile 手机号码
+ */
+export function isPhoneNO(mobile) {
+	return /^1[34578]\d{9}$/.test(mobile);
+}
+
+/**
+ * 判断有效金额
+ * @method isMoney
+ * @param {Number} money 金额
+ */
+export function isMoney(money){
+  return /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/.test(money);
+}
+
+/**
+ * 判断是否汉字
+ * @method isChinese
+ * @param {String} text 文本
+ */
+export function isChinese(text){
+  return /^[\u4E00-\u9FA5]+$/.test(text);
+}
+
+/**
+ * 判断是否正整数
+ * @method isPInt
+ * @param {String} num 数字
+ */
+export function isPInt(num){
+  return /^[1-9]+[0-9]*]*$/.test(num);
+}
+
+/**
+ * 判断是否正整数
+ * @method formatFloat
+ * @param {Number} src 数字
+ * @param {Number} pos 保留小数点位数
+ */
+export function formatFloat(src, pos) {
+  if (!src) return 0;
+  if (!pos) pos = 0;
+  return Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos);
+}
+
+/**
+ * 串行执行若干个Promise实例
+ * @method promiseSeries
+ * @param {Array} promiseCreators 返回promise实例的函数数组
+ * @return {Promise} Promise实例
+ */
+export function promiseSeries(promiseCreators) {
+	let lastPromise;
+	promiseCreators.forEach(function(promiseCreator) {
+		if (lastPromise) {
+			lastPromise = lastPromise.then(function() {
+				return promiseCreator();
+			});
+		} else {
+			lastPromise = promiseCreator();
+		}
+	});
+
+	return lastPromise;
+}
+
+
+/**
+ * 回调队列(wx的某些方法只能设一个回调函数,故需要一个队列)
+ * @class CallbackQueue
+ */
+export class CallbackQueue {
+	constructor() {
+		this._allQueue = { };
+	}
+
+	add(types, fn) {
+		let allQueue = this._allQueue;
+		types.split(/\s+/).forEach(function(type) {
+			allQueue[type] = allQueue[type] || [ ];
+			allQueue[type].push(fn);
+		});
+	}
+
+	clear(types) {
+		if (types) {
+			let allQueue = this._allQueue;
+			types.split(/\s+/).forEach(function(type) {
+				delete allQueue[type];
+			});
+		} else {
+			this._allQueue = { };
+		}
+	}
+
+	export(type) {
+		var t = this;
+
+		return function() {
+			var queue = t._allQueue[type],
+					fnThis = this,
+					args = arguments;
+	
+			if (queue) {
+				queue.forEach(function(fn) {
+					fn.apply(fnThis, args);
+				});
+			}
+		};
+	}
+}
+/* 延迟执行 */
+export function debounce(func, wait) {
+  var timeout;
+
+  return function () {
+    var context = this;
+    var args = arguments;
+
+    clearTimeout(timeout)
+    timeout = setTimeout(function () {
+      func.apply(context, args)
+    }, wait);
+  }
+}
+/* 百度转火星坐标 */
+export function bd09togcj02(bd_lon, bd_lat) {
+  let x_PI = Math.PI * 3000.0 / 180.0;
+  let new_bd_lon = +bd_lon;
+  let new_bd_lat = +bd_lat;
+  let x = new_bd_lon - 0.0065;
+  let y = new_bd_lat - 0.006;
+  let z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI);
+  let theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI);
+  let gg_lng = z * Math.cos(theta);
+  let gg_lat = z * Math.sin(theta);
+  return {
+    longitude: gg_lng,
+    latitude: gg_lat
+  }
+};
+/* 打开微信地图逻辑 */
+export function openMap(e) {
+  let longitude = e.target.dataset.longitude,
+    latitude = e.target.dataset.latitude,
+    name = e.target.dataset.name,
+    address = e.target.dataset.addr;
+  let item = bd09togcj02(longitude, latitude);
+  wx.getSetting({
+    success: res => {
+      if (res.authSetting['scope.userLocation']) {  // 已经授权
+        wx.openLocation({
+          latitude: item.latitude,
+          longitude: item.longitude,
+          name,
+          address,
+          scale: 16
+        })
+      } else if (res.authSetting['scope.userLocation'] === false) { // 已请求过但是拒绝了
+        wx.openSetting({
+          success: data => {
+            if (data.authSetting['scope.userLocation']) {
+              wx.openLocation({
+                latitude: item.latitude,
+                longitude: item.longitude,
+                name,
+                address,
+                scale: 16
+              });
+            }
+          }
+        });
+      } else if (res.authSetting['scope.userLocation'] === undefined) { // 还未请求过
+        wx.authorize({
+          scope: 'scope.userLocation',
+          success: data => {
+            wx.openLocation({
+              latitude: item.latitude,
+              longitude: item.longitude,
+              name,
+              address,
+              scale: 16
+            });
+          }
+        })
+      }
+    }
+  }); 
+}
+/* 验证处理 */
+// 手机号
+export function validateMobile(str){
+  const reg = /^1\d{10}$/;
+  return reg.test(str);
+}
+// 邮箱
+export function validateEmail(str){
+  const reg = /^[\w-.]+@[\w-]+(\.[\w-]+)+$/;
+  return reg.test(str);
+}
+// 身份证
+export function validateID(str){
+  const reg = /(^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$)|(^[1-9]\d{5}\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{2}$)/;
+  return reg.test(str);
+}
+/* 去掉字符串标签 */
+export function delHtmlTag(str) {
+  return str.replace(/<[^>]+>/g, "");
+}
+/**
+ * 进行数字比较
+ * attr:属性
+ * rev: 默认升序,false为降序
+ */
+export function sortBy(attr, rev) {
+  //第二个参数没有传递 默认升序排列
+  if (rev == undefined) {
+    rev = 1;
+  } else {
+    rev = (rev) ? 1 : -1;
+  }
+  return function (a, b) {
+    a = a[attr];
+    b = b[attr];
+    if (a < b) {
+      return rev * -1;
+    }
+    if (a > b) {
+      return rev * 1;
+    }
+    return 0;
+  }
+}
+/* 是否为空对象 */
+export function isEmptyObject(obj) {
+  for(var key in obj) {
+    return false
+  }
+  return true
+}
+
+/** 倒计时计算器 */
+export function stimer(intDiff) {
+  var day = 0,
+    hour = 0,
+    minute = 0,
+    second = 0;//时间默认值
+  if (intDiff > 0) {
+    day = Math.floor(intDiff / (60 * 60 * 24));
+    hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
+    minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
+    second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
+  }
+  if (minute <= 9) minute = '0' + minute;
+  if (second <= 9) second = '0' + second;
+  return {
+    day: day,
+    hour: hour,
+    minute: minute,
+    second: second
+  }
+}
+
+/** 转化时间戳 */ // 5小时、5分钟、5秒钟
+export function formatTime(val) {
+  let str = ''
+  const offsetTime = new Date().getTime() - new Date(val).getTime()
+  let hour = Math.floor((offsetTime / 3600000) % 24)
+  let minute = Math.floor((offsetTime / 60000) % 60)
+  let second = Math.floor((offsetTime / 1000) % 60)
+  if (hour > 0) {
+    str = `${hour}小时`
+  } else {
+    if (minute > 0) {
+      str = `${minute}分钟`
+    } else {
+      str = `${second}秒钟`
+    }
+  }
+  return str
+}
+
+function dateToDate(date) {
+  var sDate = new Date();
+  if (typeof date == 'object'
+    && typeof new Date().getMonth == "function"
+  ) {
+    sDate = date;
+  }
+  else if (typeof date == "string") {
+    var arr = date.split('-')
+    if (arr.length == 3) {
+      sDate = new Date(arr[0] + '-' + arr[1] + '-' + arr[2]);
+    }
+  }
+
+  return sDate;
+}
+
+// 分割数组
+export function splitArr(arr, size) {
+  let tempArr = []
+  for (let i = 0; i < arr.length; i += size) {
+    tempArr.push(arr.slice(i, i + size))
+  }
+  return tempArr
+}
+
+
+export function addMonth(date, num) {
+  num = parseInt(num);
+  var sDate = dateToDate(date);
+
+  var sYear = sDate.getFullYear();
+  var sMonth = sDate.getMonth() + 1;
+  var sDay = sDate.getDate();
+
+  var eYear = sYear;
+  var eMonth = sMonth + num;
+  var eDay = sDay;
+  while (eMonth > 12) {
+    eYear++;
+    eMonth -= 12;
+  }
+
+  var eDate = new Date(eYear, eMonth - 1, eDay);
+
+  while (eDate.getMonth() != eMonth - 1) {
+    eDay--;
+    eDate = new Date(eYear, eMonth - 1, eDay);
+  }
+
+  return eDate;
+}

+ 48 - 0
src/lib/wx/wx.js

@@ -0,0 +1,48 @@
+import Promise from '../promise/promise.js';
+
+
+function canPromisify(key) {
+  // 特别指定的wx对象中不进行Promise封装的方法
+  let noPromiseMethods = {
+    clearStorage: 1,
+    hideToast: 1,
+    showNavigationBarLoading: 1,
+    hideNavigationBarLoading: 1,
+    drawCanvas: 1,
+    canvasToTempFilePath: 1,
+    hideKeyboard: 1,
+  };
+
+  return !(
+    noPromiseMethods[key] ||
+    /^(on|create|stop|pause|close)/.test(key) ||
+    /\w+Sync$/.test(key)
+  );
+}
+
+
+var wxPromisify = { };
+Object.keys(wx).forEach((key) => {
+  if ( canPromisify(key) ) {
+    wxPromisify[key] = function(obj) {
+      obj = obj || { };
+      return new Promise((resolve, reject) => {
+        obj.success = resolve;
+        obj.fail = (res) => {
+          if (res && res.errMsg) {
+            reject( new Error(res.errMsg) );
+          } else {
+            reject(res);
+          }
+        };
+        wx[key](obj);
+      });
+    };
+  } else {
+    wxPromisify[key] = function() {
+      return wx[key].apply(wx, arguments);
+    };
+  }
+});
+
+export default wxPromisify;

+ 99 - 65
src/pages/activityDetail/activityDetail.js

@@ -1,66 +1,100 @@
-// pages/activityDetail/activityDetail.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-  
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-  
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-  
-  }
+// pages/activityDetail/activityDetail.js
+import { shuoAPIClient } from '../../common/api/api.js';
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    id: null,
+    detail: null,
+    infoTickets: []
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    console.log('options',options);
+    this.setData({
+      id: options.id
+    })
+    console.log('id', this.data.id)
+  },
+  
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    this.getDetail();
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  },
+  // 加载详情
+  getDetail() {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/news/info/'+this.data.id,
+      {
+        startIndex: 0,
+        resultNum: 5
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('详情', res)
+        // if (res.data.results && res.data.results.length) {
+        //   this.data.selectedTheme = res.data.results[0].catId
+        //   this.setData({
+        //     themesDatas: res.data.results
+        //   })
+        //   //更新景点
+        //   this.getViews()
+        // }
+        this.setData({
+          detail: res.data,
+          infoTickets: res.data.infoTickets
+        })
+      })
+  },
 })

Datei-Diff unterdrückt, da er zu groß ist
+ 47 - 47
src/pages/activityDetail/activityDetail.wxml


+ 532 - 190
src/pages/creatOrder/creatOrder.js

@@ -1,191 +1,533 @@
-// pages/creatOrder/creatOrder.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    dateList: [],
-    curr: "",
-    isMoreDate: false,
-    isMask: false,
-    num:1,
-    choosedData:1
-  },
-  chooseDate:function(e){
-    console.log(e.currentTarget.dataset.index)
-    this.setData({
-      choosedData: e.currentTarget.dataset.index
-    })
-  },
-  increaseNum:function(){
-    let num=this.data.num
-      if(num>1){
-        num--
-        this.setData({
-          num: num
-        })
-      }
-  },
-  addNum:function(){
-    let num = this.data.num
-    num++
-    this.setData({
-      num: num
-    })
-  },
-  lastDay: function() {
-    console.log(this.data.dateList)
-    let curr = this.data.curr
-    console.log(curr)
-    
-    if (curr == '今天') {
-      curr = this.data.day
-    } else if (curr == '明天') {
-      curr = this.data.day + 1
-    }
-    if (curr > this.data.day) {
-      this.setData({
-        curr: this.data.dateList[curr-2],
-        week: this.data.week - 1
-      })
-    }
-
-  },
-  nextDay: function() {
-    console.log(this.data.dateList)
-    let curr = this.data.curr
-    console.log(curr)
-    
-    if (curr == '今天') {
-      curr = this.data.day
-    } else if (curr == '明天') {
-      curr = this.data.day + 1
-    }
-    if (curr < this.data.dateList.length) {
-      this.setData({
-        curr: this.data.dateList[curr],
-        week:(this.data.week+1)%7
-      })
-    }
-
-
-  },
-  select: function(e) {
-    console.log(e.currentTarget.dataset.day)
-    let select = e.currentTarget.dataset.day
-    if (select > this.data.day || select == '今天' || select == '明天') {
-      this.setData({
-        curr: select,
-      })
-    }
-
-    let week = new Date().getDay()
-    let day = select
-    if (day == '今天') {
-      day = this.data.day
-    } else if (day == '明天') {
-      day = this.data.day + 1
-    }
-
-    week = (week + (day - this.data.day)) % 7
-    console.log('week' + week)
-    this.setData({
-      week: week
-    })
-  },
-  tapMoreDate: function() {
-    this.setData({
-      isMoreDate: true,
-      isMask: true
-    })
-  },
-  close: function() {
-    this.setData({
-      isMoreDate: false,
-      isMask: false
-    })
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function(options) {
-    var dateList = []
-
-
-    console.log(this.data.dateList)
-    var today = new Date()
-
-    console.log(today.getMonth() + 1)
-    let month = today.getMonth() + 1
-    let day = today.getDate()
-    console.log(day)
-    let week = today.getDay()
-    console.log(today.getDay())
-    for (var i = 1; i < 31; i++) {
-      if (day == i) {
-        dateList.push('今天')
-      } else if (day + 1 == i) {
-        dateList.push('明天')
-      } else {
-        dateList.push(i)
-      }
-    }
-    this.setData({
-      dateList: dateList,
-      month: today.getMonth() + 1,
-      day: day,
-      week: week,
-      curr: '今天'
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function() {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function() {
-
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function() {
-
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function() {
-
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function() {
-
-  }
+// pages/creatOrder/creatOrder.js
+import { shuoAPIClient } from '../../common/api/api.js';
+import user from '../../common/user/user.js';
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    dateList: [],
+    curr: "",
+    isMoreDate: false, // 日期框展示
+    isMask: false,
+    num:1,
+    choosedData: 1,
+    infoId: null,
+    year: null,
+    month: null,
+    blankDays: [],
+    prices: null,
+    price3: null,
+    selectDate: null, //
+    prodDetail: null, //产品详情
+    priceTotal: null, //计算后的总价
+    linkInfo: [], //游客信息
+    remark: ''
+  },
+
+  /**
+   * 下单
+   */
+  addOrder() {
+    if (!user.getMyTokenSync()) {
+      this.openToast('尚未登录授权,无法下单', 'none')
+      return false
+    }
+    let travelDate = this.data.selectDate
+    if (!travelDate) {
+      this.openToast('请选择出游日期', 'none')
+      return false
+    }
+    let linkInfo = this.data.linkInfo
+    let peoples = []
+    for (let info of linkInfo) {
+      if (!info.nameValue) {
+        this.openToast('游客姓名未输入', 'none')
+        return false
+      }
+      if (!info.phoneValue) {
+        this.openToast('手机号码未输入', 'none')
+        return false
+      }
+      if (!info.idCardValue) {
+        this.openToast('身份证号码未输入', 'none')
+        return false
+      }
+      let people = {
+        linkMan: info.nameValue,
+        linkPhone: info.phoneValue,
+        linkCreditType: 0, //身份证
+        linkCreditNo: info.idCardValue
+      }
+      peoples.push(people)
+    }
+    // 下单参数
+    let params = {
+      infoId: this.data.infoId,
+      travelDate,
+      ticketNum: this.data.num,
+      people: peoples,
+      linkMan: peoples[0].linkMan,
+      linkPhone: peoples[0].linkPhone,
+      linkCreditType: peoples[0].linkCreditType,
+      linkCreditNo: peoples[0].linkCreditNo,
+      orderMemo: this.data.remark
+    }
+    let data = {
+      orderCommonRequest: params,
+      treeId: 0
+    }
+    console.log('请求参数json:', data)
+    wx.showLoading({
+      title: '提交订单中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/order/order',
+      data, true, 'POST').then(res => {
+        wx.hideLoading()
+        console.log('下单返回', res)
+        if (res.data.state == 2) { // 下单成功,可以立即发起支付
+          let orderId = res.data.orderId
+          wx.requestPayment({
+            'timeStamp': res.data.timestamp,
+            'nonceStr': res.data.noncestr,
+            'package': res.data.packages,
+            'signType': res.data.signtype,
+            'paySign': res.data.paysign,
+            'complete': function (res) {
+              console.log(res, '支付信息')
+              let isPay = res.errMsg.indexOf('fail') > -1 ? 2 : 1;// 支付失败或取消支付:2, 支付成功:1;
+              wx.redirectTo({
+                url: `/pages/orderDetail/orderDetail?orderId=${orderId}`
+              });
+            }
+          });
+
+        } else if (res.data.state == 1) {
+          let orderId = res.data.orderId
+          wx.redirectTo({
+            url: `/pages/orderDetail/orderDetail?orderId=${orderId}`
+          });
+        } else {
+          wx.showModal({
+            title: '提示',
+            content: '很抱歉,下单失败了!',
+            showCancel: false
+          });
+        }
+      })
+  },
+
+  /**
+   * 弹框提示
+   */
+  openToast (title, icon) {
+    wx.showToast({
+      title: title,
+      icon: icon,
+      duration: 2000
+    })
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function(options) {
+    console.log('options', options)
+    let today = new Date();
+    console.log('today.getMonth()', today.getMonth())
+    this.setData({
+      infoId: options.infoId,
+      month: today.getMonth() + 1,
+      year: today.getFullYear()
+    })
+    this.initDate(this.data.year, this.data.month)
+    this.blankDays(this.data.year, this.data.month)
+  },
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+
+  },
+
+  onShow: function () {
+    console.log('creatOrder')
+    this.getPrice()
+    this.getProdDetail()
+  },
+
+  /**
+   * 初始化日历
+   */
+  initDate(year, month) {
+    let date = new Date(year, month, 0)
+    let days = date.getDate()
+
+    var dateList = []
+
+    console.log(this.data.dateList)
+    var today = new Date()
+
+    let day = today.getDate()
+    console.log(day)
+    let week = today.getDay()
+    console.log(today.getDay())
+    for (var i = 1; i <= days; i++) {
+      // if (day == i) {
+      //   dateList.push('今天')
+      // } else if (day + 1 == i) {
+      //   dateList.push('明天')
+      // } else {
+        dateList.push(i)
+      // }
+    }
+    this.setData({
+      dateList: dateList,
+      day: day,
+      week: week,
+      curr: '今天'
+    })
+  },
+
+  /**
+   * 当前月第一日前面的空白格 
+   */
+  blankDays(year, month){
+    let date = new Date(year, month - 1, 1)
+    console.log('date', date.getFullYear() + '-' + date.getMonth() + '-' +date.getDate());
+    let week = date.getDay();
+    let blankDays = []
+    for (let i = 0; i < week; i++) {
+      blankDays.push("");
+    }
+    this.setData({
+      blankDays: blankDays
+    })
+  },
+
+  /**
+   * 登录回调
+   */
+  loginCallBack: function(e) {
+    // console.log('loginCallBack')
+    // if (getCurrentPages().length != 0) {
+    //   //刷新当前页面的数据
+    //   getCurrentPages()[getCurrentPages().length - 1].onLoad()
+    // }
+  },
+
+  /**
+   * 非日历内的选中日期事件
+   */
+  chooseDate: function (e) {
+    console.log(e.currentTarget.dataset.traveldate)
+    this.setData({
+      selectDate: e.currentTarget.dataset.traveldate
+    })
+    this.priceCalculation()
+  },
+
+  /**
+   * 数量减少
+   */
+  increaseNum: function () {
+    let num = this.data.num
+    if (num > 1) {
+      num--
+      this.setData({
+        num: num
+      })
+      this.priceCalculation()
+      this.changeLinkInfo()
+    }
+  },
+
+  /**
+   * 数量增加
+   */
+  addNum: function () {
+    let num = this.data.num
+    num++
+    this.setData({
+      num: num
+    })
+    this.priceCalculation()
+    this.changeLinkInfo()
+  },
+
+  /**
+   * 价格计算
+   */
+  priceCalculation: function () {
+    let num = this.data.num
+    let selectDate = this.data.selectDate
+    if (!selectDate) {
+      return false
+    }
+    let prices = this.data.prices
+    let priceTotal = prices[selectDate].salePrice / 100 * num
+    this.setData({
+      priceTotal: priceTotal
+    })
+  },
+
+  /**
+   * 上个月
+   */
+  lastMonth: function () {
+    let year = this.data.year
+    let month = this.data.month
+    if (month == 1) {
+      year = year - 1
+      month = 12
+    } else {
+      month--
+    }
+    this.setData({
+      year: year,
+      month: month
+    })
+    this.initDate(year, month)
+    this.blankDays(year, month)
+    this.getPrice()
+  },
+
+  /**
+   * 下个月
+   */
+  nextMonth: function () {
+    let year = this.data.year
+    let month = this.data.month
+    if (month == 12) {
+      year = year + 1
+      month = 1
+    } else {
+      month++
+    }
+    this.setData({
+      year: year,
+      month: month
+    })
+    this.initDate(year, month)
+    this.blankDays(year, month)
+    this.getPrice()
+  },
+
+  /**
+   * 价格日历内选择日期
+   */
+  select: function (e) {
+    console.log('select', e.currentTarget.dataset.day)
+    let select = e.currentTarget.dataset.day
+    let price = this.data.prices[this.data.year + '-' + (this.data.month < 10 ? '0' + this.data.month : this.data.month) + '-' + (select < 10 ? '0' + select : select)]
+    if (!price) {
+      return false;
+    }
+    this.setData({
+      curr: select,
+      selectDate: price.travelDate
+    })
+    this.priceCalculation()
+    
+
+    let week = new Date().getDay()
+    let day = select
+    if (day == '今天') {
+      day = this.data.day
+    } else if (day == '明天') {
+      day = this.data.day + 1
+    }
+
+    week = (week + (day - this.data.day)) % 7
+    console.log('week' + week)
+    this.setData({
+      week: week
+    })
+  },
+
+  /**
+   * 价格日历开启
+   */
+  tapMoreDate: function () {
+    this.setData({
+      isMoreDate: true,
+      isMask: true
+    })
+  },
+
+  /**
+   * 价格日历关闭
+   */
+  close: function () {
+    this.setData({
+      isMoreDate: false,
+      isMask: false
+    })
+  },
+  
+  /**
+   * 获取价格
+   */
+  getPrice() {
+    // wx.showLoading({
+    //   title: '加载中...',
+    //   mask: true
+    // });
+    shuoAPIClient.request('/api/minapp/ticket/productPrices',
+      {
+        year: this.data.year,
+        month: this.data.month,
+        infoId: this.data.infoId
+      }, false).then(res => {
+        // wx.hideLoading()
+        let prices = {}
+        console.log('价格', res)
+        if (res.data && res.data) {
+          for (let data of res.data) {
+            prices[data.travelDate] = data
+          }
+          let price3 = []
+          for (let i = 0; i < 3; i++) {
+            if (res.data[i]) {
+              price3.push(res.data[i])
+            }
+          }
+          this.setData({
+            prices: prices,
+            price3: price3
+          })
+          console.log('prices', this.data.prices)
+        }
+      })
+  },
+
+  /**
+   * 产品详情
+   */
+  getProdDetail() {
+    let self = this
+    shuoAPIClient.request('/api/minapp/ticket/product/' + self.data.infoId,
+      {}, false).then(res => {
+        console.log('产品详情', res)
+        if (res && res.data) {
+          self.setData({
+            prodDetail: res.data
+          })
+        }
+        this.initLinkInfo()
+      })
+  },
+  
+  /**
+   * 初始取票人信息
+   */
+  initLinkInfo() {
+    let linkInfo = []
+    let linkDetail = {
+      name: "姓名",
+      nameValue: '',
+      phone: "手机号",
+      phoneValue: '',
+      idCard: '身份证',
+      idCardValue: '',
+    }
+    linkInfo.push(linkDetail)
+    this.setData({
+      linkInfo: linkInfo
+    })
+  },
+
+  /**
+   * 取票人信息变更处理
+   */
+  changeLinkInfo() {
+    let isSingle = this.data.prodDetail.isSingle
+    let num = this.data.num
+    let linkInfo = this.data.linkInfo
+    if (isSingle == 1) {
+      let linkLength = linkInfo.length
+      if (linkLength > num) {
+        for (let i = 0; i < linkLength - num; i++) {
+          linkInfo.splice(linkInfo.length - 1, 1)
+        }
+      } else if (linkLength < num) {
+        let linkDetail = {
+          name: "姓名",
+          nameValue: '',
+          phone: "手机号",
+          phoneValue: '',
+          idCard: '身份证',
+          idCardValue: '',
+        }
+        for (let i = 0; i < num - linkLength; i++) {
+          linkInfo.push(linkDetail)
+        }
+      }
+      this.setData({
+        linkInfo: linkInfo
+      })
+    }
+  },
+  
+  /**
+   * 输入姓名
+   */
+  inputName(e) {
+    console.log('输入姓名', e)
+    let index = e.currentTarget.dataset.index
+    let value = e.detail.value
+    let linkInfo = this.data.linkInfo
+    if (linkInfo[index]) {
+      linkInfo[index].nameValue = value
+      this.setData({
+        linkInfo: linkInfo
+      })
+    }
+    console.log('linkInfo', this.data.linkInfo)
+  },
+
+  /**
+   * 输入电话
+   */
+  inputPhone(e) {
+    console.log('输入电话', e)
+    let index = e.currentTarget.dataset.index
+    let value = e.detail.value
+    let linkInfo = this.data.linkInfo
+    if (linkInfo[index]) {
+      linkInfo[index].phoneValue = value
+      this.setData({
+        linkInfo: linkInfo
+      })
+    }
+    console.log('linkInfo', this.data.linkInfo)
+  },
+
+  /**
+   * 输入身份证
+   */
+  inputIdCard(e) {
+    console.log('输入身份证', e)
+    let index = e.currentTarget.dataset.index
+    let value = e.detail.value
+    let linkInfo = this.data.linkInfo
+    if (linkInfo[index]) {
+      linkInfo[index].idCardValue = value
+      this.setData({
+        linkInfo: linkInfo
+      })
+    }
+    console.log('linkInfo', this.data.linkInfo)
+  },
+
+  /**
+   * 留言 
+   */
+  inputRemark(e) {
+    console.log('输入留言', e)
+    this.setData({
+      remark: e.detail.value
+    })
+  }
 })

+ 4 - 1
src/pages/creatOrder/creatOrder.json

@@ -1,3 +1,6 @@
 {
-    "navigationBarTitleText": "订单填写"
+    "navigationBarTitleText": "订单填写",
+    "usingComponents": {
+      "login": "../../common/login/login"
+    }
 }

+ 153 - 150
src/pages/creatOrder/creatOrder.wxml

@@ -1,150 +1,153 @@
-<!--pages/creatOrder/creatOrder.wxml-->
-<view class='pad20 mb20 bgfff'>
-  <view class='bdb pb20'>
-    <view class='f32 c333'>【餐饮】上海迪士尼乐园80元餐</view>
-    <navigator url='/pages/needKnow/needKnow' hover-class='none' class='f26 c666 ml10 mt10'>预订须知 ></navigator>
-  </view>
-  <view class='pt20 pb20 bdb'>
-    <view>
-      <view class='f28 c333 bold mr20'>游玩日期</view>
-      <view class='f24 c666'>请选择日期</view>
-    </view>
-    <view class='mt20 mb10 flex flex-bt'>
-      <view class='{{choosedData==1?"selItem":"item"}} f24 flex flex-column flex-center por' data-index='1' bindtap='chooseDate'>
-        <view class='c666'>今天{{month}}月{{day}}</view>
-        <view class='red mt10 bold'>不可订</view>
-        <image src='/img/box.png' style='width:100%;height:100%;top:0;left:0' class='poa' wx:if='{{choosedData==1}}'></image>
-      </view>
-      <view class='{{choosedData==2?"selItem":"item"}} f24 flex flex-column flex-center por' data-index='2' bindtap='chooseDate'>
-        <view class='c666'>明天{{month}}月{{day+1}}</view>
-        <view class='red mt10 bold'>¥68元</view>
-        <image src='/img/box.png' style='width:100%;height:100%;top:0;left:0' class='poa' wx:if='{{choosedData==2}}'></image>
-      </view>
-      <view class='{{choosedData==3?"selItem":"item"}} por f24 flex flex-column flex-center' data-index='3' bindtap='chooseDate'>
-        <view class='c666'>后天{{month}}月{{day+2}}</view>
-        <view class='red mt10 bold'>¥68元</view>
-        <image src='/img/box.png' style='width:100%;height:100%;top:0;left:0' class='poa' wx:if='{{choosedData==3}}'></image>
-      </view>
-      <view class='item f24 flex flex-column flex-center' bindtap='tapMoreDate'>
-        <view class='c666'>更多</view>
-        <view class='mt10'>日期</view>
-      </view>
-
-    </view>
-  </view>
-  <view class='flex flex-bt flex-aic pt20'>
-    <view class='f28 c333'>购买数量</view>
-    <view class='flex'>
-      <image src='/img/min.png' style='width:45rpx;height:45rpx;' bindtap='increaseNum'></image>
-      <view class='flex flex-center f28 c333' style='width:45rpx;height:45rpx;'>{{num}}</view>
-      <image src='/img/max.png' style='width:45rpx;height:45rpx;' bindtap='addNum'></image>
-    </view>
-  </view>
-  <view class='flex flex-start flex-aic pl20 mt20' style='height:52rpx;background:#F6FAFC'>
-    <image src='/img/time1.png' style='width:22rpx;height:22rpx;'></image>
-    <view class='f24 green ml10'>每单最多预定5张</view>
-  </view>
-</view>
-
-<view class='pad20 bgfff mt20 mb20'>
-  <view class='flex flex-aic bdb pb20'>
-    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-    <view class='f32 c333 ml20'>取票人信息</view>
-  </view>
-  <view class='pt20'>
-    <view class='flex flex-aic pb20 bdb'>
-      <view class='flex flex-aic flex-1'>
-        <view class='f28 c333 flex' style='width:120rpx'>
-          <view class='flex flex-bt' style='width:80rpx'> 
-          <text>姓</text>
-          <text>名</text>
-          </view>
-          <text>:</text>
-        </view>
-        <input class='ml20 f28 c333' style='margin-left:24rpx' placeholder='取票人姓名' placeholder-class='f28 c999'></input>
-      </view>
-      <navigator url='/pages/selectOwner/selectOwner' hover-class='none'>
-        <image src='/img/book.png' style='width:34rpx;height:37rpx;' class='pl20'></image>
-      </navigator>
-    </view>
-    <view class='flex flex-aic pt20 pb20 bdb'>
-      <view class='f28 c333' style='width:120rpx'>手机号:</view>
-      <input class='ml20 f28 c333' placeholder='用于接收确认短信' placeholder-class='f28 c999'></input>
-    </view>
-    <view class='flex flex-aic pt20 pb20 bdb'>
-      <view class='f28 c333' style='width:120rpx'>身份证:</view>
-      <input class='ml20 f28 c333' placeholder='用于景区入园凭证' placeholder-class='f28 c999'></input>
-    </view>
-    <view class='flex flex-aic pb20 bdb pt20'>
-      <view class='flex flex-aic flex-1'>
-        <view class='f28 c333 flex' style='width:120rpx'>
-          <view class='flex flex-bt' style='width:80rpx'> 
-          <text>留</text>
-          <text>言</text>
-          </view>
-          <text>:</text>
-        </view>
-        <input class='ml20 f28 c333' placeholder='留言给商家' placeholder-class='f28 c999'></input>
-      </view>
-    </view>
-  </view>
-</view>
-
-<view class='f22 flex flex-aic pl20'>
-  <image src='/img/gou.png' style='width:20rpx;height:20rpx;'></image>
-  <view class='c666 ml10'>我已同意并阅读</view>
-  <navigator url='/pages/needKnow/needKnow' hover-class='none' class='green'>预订须知</navigator>
-</view>
-
-<view class='footer b-box bgfff flex flex-bt flex-aic pl20 pr20'>
-  <view>
-    <view class='f28 c666'>合计:</view>
-    <view class='f32 red bold'>¥68元</view>
-  </view>
-  <view class='flex flex-aic'>
-    <view class='flex flex-aic flex-bt'>
-      <view class='f24 c999 mr20'>明细</view>
-      <image src='/img/up.png' style='width:25rpx;height:14rpx;'></image>
-    </view>
-    <view class='f28 por ml20 flex flex-center' style='width:200rpx;height:70rpx;'>
-      <view class='cfff' style='z-index:1;'>提交订单</view>
-      <image src='/img/btn_img.png' style='width:100%;height:100%;top:0;left:0' class='poa'></image>
-    </view>
-  </view>
-</view>
-
-<view class='moreDate b-box' wx:if="{{isMoreDate}}">
-  <view class='f36 c333 flex flex-center por'>
-    <view class='bold'>选择游玩日期</view>
-    <image src='/img/close.png' style='width:24rpx;height:24rpx;top:16rpx;right:40rpx;' class='poa' bindtap='close'></image>
-  </view>
-  <view class='flex flex-bt f32' style='margin-top:40rpx;color:#717171;padding:20rpx 40rpx'>
-    <view class='{{week==1?"green":""}}'>一</view>
-    <view class='{{week==2?"green":""}}'>二</view>
-    <view class='{{week==3?"green":""}}'>三</view>
-    <view class='{{week==4?"green":""}}'>四</view>
-    <view class='{{week==5?"green":""}}'>五</view>
-    <view class='{{week==6?"green":""}}'>六</view>
-    <view class='{{week==0?"green":""}}'>日</view>
-  </view>
-
-  <view class='flex flex-center' style='margin-top:20rpx'>
-    <image src='/img/left.png' style='width:14rpx;height:25rpx;' class='pad20' bindtap='lastDay'></image>
-    <view class='f28 c666 ml20 mr20'>2018年{{month}}月</view>
-    <image src='/img/right.png' style='width:14rpx;height:25rpx;' class='pad20' bindtap='nextDay'></image>
-  </view>
-
-  <view class='f32 cBA flex flex-wrap'>
-    <view class='dateItem'></view>
-    <view class='dateItem'></view>
-    <view wx:for='{{dateList}}' wx:key='item' class='dateItem flex-column flex-aic {{curr==item?"active":""}}' data-day='{{item}}' bindtap='select'>
-      <text class='f24 cfff' wx:if='{{curr==item}}'>已选</text>
-      <text class='{{curr==item?"cfff":"c4a"}}'>{{item}}</text>
-      <text wx:if='{{item=="今天"}}' class='f24 {{curr==item?"cfff":"c4a"}}'>¥68</text>
-      <text wx:if='{{item=="明天"}}' class='f24 {{curr==item?"cfff":"c4a"}}'>¥68</text>
-      <text wx:if='{{item>=day}}' class='f24 {{curr==item?"cfff":"c4a"}}'>¥68</text>
-    </view>
-  </view>
-</view>
-
-<view class='mask' wx:if="{{isMask}}"></view>
+<!--pages/creatOrder/creatOrder.wxml-->
+<view class='pad20 mb20 bgfff'>
+  <view class='bdb pb20'>
+    <view class='f32 c333'>{{prodDetail.infoTitle}}</view>
+    <navigator url='/pages/needKnow/needKnow?infoId={{infoId}}' hover-class='none' class='f26 c666 ml10 mt10'>预订须知 ></navigator>
+  </view>
+  <view class='pt20 pb20 bdb' wx:if='{{price3 && price3.length > 0}}'>
+    <view>
+      <view class='f28 c333 bold mr20'>游玩日期</view>
+      <view wx:if="{{!selectDate}}" class='f24 c666'>请选择日期</view>
+      <view wx:else class='f24 c666'>当前选定的日期:{{selectDate}}</view>
+    </view>
+    <view class='mt20 mb10 flex flex-bt'>
+      <view wx:for='{{price3}}' wx:key='{{index}}' class='{{selectDate==item.travelDate?"selItem":"item"}} f24 flex flex-column flex-center por' data-travelDate='{{item.travelDate}}' bindtap='chooseDate'>
+        <view class='c666'>{{item.travelDate}}</view>
+        <view class='red mt10 bold'>¥{{item.salePrice / 100}}</view>
+        <image src='/img/box.png' style='width:100%;height:100%;top:0;left:0' class='poa' wx:if='{{selectDate==item.travelDate}}'></image>
+      </view>
+      <view class='item f24 flex flex-column flex-center' bindtap='tapMoreDate'>
+        <view class='c666'>更多</view>
+        <view class='mt10'>日期</view>
+      </view>
+
+    </view>
+  </view>
+  <view wx:else>
+    <view class='f28 c333 bold mr20'>无价格不可预订</view>
+  </view>
+  <view class='flex flex-bt flex-aic pt20'>
+    <view class='f28 c333'>购买数量</view>
+    <view class='flex'>
+      <image src='/img/min.png' style='width:45rpx;height:45rpx;' bindtap='increaseNum'></image>
+      <view class='flex flex-center f28 c333' style='width:45rpx;height:45rpx;'>{{num}}</view>
+      <image src='/img/max.png' style='width:45rpx;height:45rpx;' bindtap='addNum'></image>
+    </view>
+  </view>
+  <view class='flex flex-start flex-aic pl20 mt20' style='height:52rpx;background:#F6FAFC'>
+    <image src='/img/time1.png' style='width:22rpx;height:22rpx;'></image>
+    <view class='f24 green ml10'>每单最多预定{{prodDetail.maxNum == 0 ? '无限制' : maxNum + '张'}}</view>
+  </view>
+</view>
+
+<view class='pad20 bgfff mt20 mb20' wx:for='{{linkInfo}}' wx:key='{{index}}'>
+  <view class='flex flex-aic bdb pb20'>
+    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+    <view class='f32 c333 ml20'>取票人信息{{linkInfo && linkInfo.length > 1 ? index + 1 : ''}}</view>
+  </view>
+  <view class='pt20'>
+    <view class='flex flex-aic pb20 bdb'>
+      <view class='flex flex-aic flex-1'>
+        <view class='f28 c333 flex' style='width:120rpx'>
+          <view class='flex flex-bt' style='width:80rpx'> 
+          <text>{{item.name}}</text>
+          </view>
+          <text>:</text>
+        </view>
+        <input data-index='{{index}}' bindinput='inputName' class='ml20 f28 c333' style='margin-left:24rpx' placeholder='取票人姓名' placeholder-class='f28 c999'></input>
+      </view>
+      <!-- <navigator url='/pages/selectOwner/selectOwner' hover-class='none'>
+        <image src='/img/book.png' style='width:34rpx;height:37rpx;' class='pl20'></image>
+      </navigator> -->
+    </view>
+    <view class='flex flex-aic pt20 pb20 bdb'>
+      <view class='f28 c333' style='width:120rpx'>{{item.phone}}:</view>
+      <input data-index='{{index}}' bindinput='inputPhone' class='ml20 f28 c333' placeholder='用于接收确认短信' placeholder-class='f28 c999'></input>
+    </view>
+    <view class='flex flex-aic pt20 pb20 bdb'>
+      <view class='f28 c333' style='width:120rpx'>{{item.idCard}}:</view>
+      <input type='idcard' data-index='{{index}}' bindinput='inputIdCard' class='ml20 f28 c333' placeholder='用于景区入园凭证' placeholder-class='f28 c999'></input>
+    </view>
+    
+  </view>
+</view>
+<view class='pad20 bgfff mt20 mb20'>
+  <view class='flex flex-aic bdb pb20'>
+    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+    <view class='f32 c333 ml20'>留言备注</view>
+  </view>
+  <view class='pt20'>
+    <view class='flex flex-aic pb20 bdb pt20'>
+      <view class='flex flex-aic flex-1'>
+        <view class='f28 c333 flex' style='width:120rpx'>
+          <view class='flex flex-bt' style='width:80rpx'> 
+          <text>留</text>
+          <text>言</text>
+          </view>
+          <text>:</text>
+        </view>
+        <input bindinput='inputRemark' class='ml20 f28 c333' placeholder='留言给商家' placeholder-class='f28 c999'></input>
+      </view>
+    </view>
+  </view>
+</view>
+
+<view class='f22 flex flex-aic pl20'>
+  <image src='/img/gou.png' style='width:20rpx;height:20rpx;'></image>
+  <view class='c666 ml10'>我已同意并阅读</view>
+  <navigator url='/pages/needKnow/needKnow?infoId={{infoId}}' hover-class='none' class='green'>预订须知</navigator>
+</view>
+
+<view class='footer b-box bgfff flex flex-bt flex-aic pl20 pr20'>
+  <view>
+    <view class='f28 c666'>合计:</view>
+    <view class='f32 red bold'>¥{{priceTotal ? priceTotal : '--'}}元</view>
+  </view>
+  <view class='flex flex-aic'>
+    <view class='flex flex-aic flex-bt'>
+      <view class='f24 c999 mr20'>明细</view>
+      <image src='/img/up.png' style='width:25rpx;height:14rpx;'></image>
+    </view>
+    <view class='f28 por ml20 flex flex-center' style='width:200rpx;height:70rpx;' bindtap='addOrder'>
+      <view class='cfff' style='z-index:1;'>提交订单</view>
+      <image src='/img/btn_img.png' style='width:100%;height:100%;top:0;left:0' class='poa'></image>
+    </view>
+  </view>
+</view>
+
+<view class='moreDate b-box' wx:if="{{isMoreDate}}">
+  <view class='f36 c333 flex flex-center por'>
+    <view class='bold'>选择游玩日期</view>
+    <image src='/img/close.png' style='width:24rpx;height:24rpx;top:16rpx;right:40rpx;' class='poa' bindtap='close'></image>
+  </view>
+  <view class='flex flex-bt f32' style='margin-top:40rpx;color:#717171;padding:20rpx 40rpx'>
+    <view class='{{week==0?"green":""}}'>日</view>
+    <view class='{{week==1?"green":""}}'>一</view>
+    <view class='{{week==2?"green":""}}'>二</view>
+    <view class='{{week==3?"green":""}}'>三</view>
+    <view class='{{week==4?"green":""}}'>四</view>
+    <view class='{{week==5?"green":""}}'>五</view>
+    <view class='{{week==6?"green":""}}'>六</view>
+  </view>
+
+  <view class='flex flex-center' style='margin-top:20rpx'>
+    <image src='/img/left.png' style='width:14rpx;height:25rpx;' class='pad20' bindtap='lastMonth'></image>
+    <view class='f28 c666 ml20 mr20'>{{year}}年{{month}}月</view>
+    <image src='/img/right.png' style='width:14rpx;height:25rpx;' class='pad20' bindtap='nextMonth'></image>
+  </view>
+
+  <view class='f32 cBA flex flex-wrap'>
+    <view class='dateItem' wx:for='{{blankDays}}' wx:key='{{index}}'></view>
+    <view wx:for='{{dateList}}' wx:key='{{index}}' class='dateItem flex-column flex-aic {{selectDate && selectDate==prices[year + "-" + (month < 10 ? "0" + month : month) + "-" + (item < 10 ? "0" + item : item) ].travelDate?"active":""}}' data-day='{{item}}' bindtap='select'>
+      <!-- <text class='f24 cfff' wx:if='{{curr==item}}'>已选</text> -->
+      <text class='{{selectDate && selectDate==prices[year + "-" + (month < 10 ? "0" + month : month) + "-" + (item < 10 ? "0" + item : item) ].travelDate?"cfff":"c4a"}}'>{{item}}</text>
+      <!-- <text wx:if='{{item=="今天"}}' class='f24 {{curr==item?"cfff":"c4a"}}'>¥68</text>
+      <text wx:if='{{item=="明天"}}' class='f24 {{curr==item?"cfff":"c4a"}}'>¥68</text> -->
+      <text wx:if='{{prices[year + "-" + (month < 10 ? "0" + month : month) + "-" + (item < 10 ? "0" + item : item) ].salePrice}}' class='f24 {{selectDate && selectDate==prices[year + "-" + (month < 10 ? "0" + month : month) + "-" + (item < 10 ? "0" + item : item) ].travelDate?"cfff":"c4a"}}'>¥{{prices[year + '-' + (month < 10 ? "0" + month : month) + '-' + (item < 10 ? '0' + item : item)].salePrice / 100}}</text>
+    </view>
+  </view>
+</view>
+
+<view class='mask' wx:if="{{isMask}}"></view>
+
+<login bind:loginCallBack="loginCallBack"></login>

+ 8 - 6
src/pages/creatOrder/creatOrder.wxss

@@ -2,8 +2,8 @@
 
 page {
   background: #f5f5f5;
-  height: 100%;
-  padding-bottom: 50rpx;
+  /* height: 100%; */
+  padding-bottom: 150rpx;
 }
 
 .item {
@@ -25,6 +25,7 @@ page {
   left: 0;
   width: 100%;
   height: 108rpx;
+  z-index: 99;
 }
 
 .moreDate {
@@ -52,7 +53,7 @@ page {
 }
 
 .dateItem {
-  height: 140rpx;
+  height: 120rpx;
   width: calc(100%/7);
   display: flex;
   justify-content: center;
@@ -61,9 +62,10 @@ page {
 }
 
 .active {
-  width: 90rpx;
-  height: 140rpx;
+  /* width: 90rpx; */
+  width: calc(100%/7);
+  height: 120rpx;
   border-radius: 12rpx;
   background-image: url('https://image.qcloud.weyou.shop/online/image/20180818165032733610.png');
   background-position: center;
-}
+}

+ 150 - 60
src/pages/flashSale/index.js

@@ -1,4 +1,5 @@
 // pages/menpiao/index.js
+import { shuoAPIClient } from '../../common/api/api.js';
 Page({
 
   /**
@@ -10,8 +11,11 @@ Page({
     interval: 5000,
     duration: 1000,
     tabIndex: 1,
-    region: ['上海'],
-    currentRegion: '上海',
+    region: 0,
+    currentRegion: '全部',
+    areas: null, //地区列表
+    areaName: 'areaName',
+    selectedArea: 0, //选中的地区id
     day: 2,
     day2: 3,
     second: 50,
@@ -22,7 +26,67 @@ Page({
     hour2: 22,
     isMDD: false,
     isCYLX: false,
-    isSort: false
+    keyword: '',
+    startIndex: 0,
+    resultNum: 5,
+    isAll: 0, //0未加载完,1加载完,2无数据
+    prodLock: false, //请求景点锁,一次请求未完毕不可进行第二次
+    products: [],
+    orderbyArray: [
+      "价格从低到高",
+      "价格从高到低",
+      "销量从高到低",
+      "推荐值从高到低",
+    ],
+    orderBy: 0
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    this.restoreData()
+    this.getAreas()
+  },
+
+  /**
+   * 请求数据重置
+   */
+  restoreData() {
+    this.setData({
+      startIndex: 0,
+      isAll: 0,
+      products: []
+    })
+  },
+
+  //获取城市
+  getAreas() {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/common/areas',
+      {
+        areaType: 0, //周边地区
+        treeId: 0
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('城市', res)
+        if (res.data && res.data) {
+          let currentRegion = wx.getStorageSync('currentRegion')
+          let region = wx.getStorageSync('region')
+          let selectedArea = wx.getStorageSync('selectedArea')
+          console.log(currentRegion, region, selectedArea)
+          this.setData({
+            areas: res.data,
+            currentRegion: currentRegion ? currentRegion : res.data[0].areaName,
+            region: region ? region : 0,
+            selectedArea: selectedArea ? selectedArea : res.data[0].areaId
+          })
+        }
+        this.getProducts()
+      })
   },
 
   changeSort(e) {
@@ -46,64 +110,98 @@ Page({
     }
   },
 
+  /**
+   * 滑动到底部加载
+   */
+  scrolltolower: function ()  {
+    if (!this.data.prodLock && this.data.isAll == 0) {
+      this.getProducts()
+    }
+  },
 
-  // 倒计时
-  setDateOut() {
-    var self = this
-    var InterVal = setInterval(function() {
-      self.setData({
-        second: self.data.second - 1
-      })
-      if (self.data.second == -1) {
-        self.setData({
-          second: 59,
-          minute: self.data.minute - 1,
-        })
-      }
-      if (self.data.minute == -1) {
-        self.setData({
-          minute: 59,
-          hour: self.data.hour - 1,
-        })
-      }
-      if (self.data.hour == 0 && self.data.minute == 0 && self.data.second == 0) {
-        clearInterval(InterVal)
-      }
-    }, 1000)
-  },
-
-  setDateOut2() {
-    var self = this
-    var InterVal2 = setInterval(function() {
-      self.setData({
-        second2: self.data.second2 - 1
+  //产品
+  getProducts() {
+    this.data.prodLock = true
+    shuoAPIClient.request('/api/minapp/ticket/products',
+      {
+        keyword: this.data.keyword,
+        areaId: this.data.selectedArea ? this.data.selectedArea : '',
+        orderBy: this.data.orderBy,
+        startIndex: this.data.startIndex,
+        resultNum: this.data.resultNum
+      }, false).then(res => {
+        console.log('产品', res)
+        if (res.data.results && res.data.results.length) {
+          let startIndex = this.data.startIndex + this.data.resultNum
+          let datas = this.data.products
+          datas.push(...res.data.results)
+          let isAll = 0
+          if (res.data.sizeAll == datas.length) {
+            isAll = 1
+          }
+          this.setData({
+            products: datas,
+            startIndex,
+            isAll,
+            prodLock: false
+          })
+        } else {
+          this.setData({
+            products: [],
+            isAll: 2,
+            prodLock: false
+          })
+        }
       })
-      if (self.data.second2 == -1) {
-        self.setData({
-          second2: 59,
-          minute2: self.data.minute2 - 1,
-        })
-      }
-      if (self.data.minute2 == -1) {
-        self.setData({
-          minute2: 59,
-          hour2: self.data.hour2 - 1,
-        })
-      }
-
-      if (self.data.hour2 == 0 && self.data.minute2 == 0 && self.data.second2 == 0) {
-        clearInterval(InterVal)
-      }
-    }, 1000)
   },
 
-
+  /**
+   * 地区修改
+   */
   bindRegionChange: function(e) {
     console.log('picker发送选择改变,携带值为', e.detail.value)
+    this.data.selectedArea = this.data.areas[e.detail.value].areaId
+    console.log('地区修改', this.data.selectedArea)
     this.setData({
       region: e.detail.value,
-      currentRegion: e.detail.value[e.detail.value.length - 1]
+      currentRegion: this.data.areas[e.detail.value].areaName
+    })
+    wx.setStorage({
+      key: 'region',
+      data: e.detail.value,
+    })
+    wx.setStorage({
+      key: 'currentRegion',
+      data: this.data.areas[e.detail.value].areaName,
+    })
+    wx.setStorage({
+      key: 'selectedArea',
+      data: this.data.areas[e.detail.value].areaId
+    })
+    this.restoreData()
+    this.getProducts()
+  },
+
+  /**
+   * 搜索
+   */
+  bindSearch: function(e) {
+    let keyword = e.detail.value
+    console.log('搜索框事件', keyword)
+    this.setData({
+      keyword
     })
+    this.restoreData()
+    this.getProducts()
+  },
+
+  orderByChange: function(e) {
+    console.log(e)
+    this.setData({
+      orderBy: e.detail.value
+    })
+    this.restoreData()
+    this.getProducts()
   },
   /**
    * 生命周期函数--监听页面加载
@@ -116,14 +214,6 @@ Page({
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function() {
-    this.setDateOut()
-    this.setDateOut2()
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function() {
 
   },
 

+ 5 - 1
src/pages/flashSale/index.json

@@ -1,3 +1,7 @@
 {
-  "navigationBarTitleText": "限时抢购"
+  "navigationBarTitleText": "限时抢购",
+  "usingComponents": {
+    "countdown": "../../common/countdown/countdown"
+  }
+
 }

+ 42 - 57
src/pages/flashSale/index.wxml

@@ -2,13 +2,18 @@
 
 <view class='searchBgView flex flex-center'>
   <view class="searchBox flex flex-aic">
-    <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
+    <!-- <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
       <butotn class='f30 c4a bdr flex flex-center' style='width:140rpx'>{{currentRegion}}
         <image src="/img/icon/xl.png" style='width:13rpx;height:8rpx' class='ml10'></image>
       </butotn>
+    </picker> -->
+    <picker mode="selector" range='{{areas}}' range-key="{{areaName}}" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
+      <butotn class='f30 c4a bdr flex flex-center' style='width:150rpx'>{{currentRegion}}
+        <image src="/img/icon/xl.png" style='width:13rpx;height:8rpx' class='ml10'></image>
+      </butotn>
     </picker>
     <icon type='search' size='14' class='ml20'></icon>
-    <input class='ml20 f30 c4a' placeholder='景点/迪士尼' placeholder-style='color:#AAAAAA'></input>
+    <input class='ml20 f30 c4a' placeholder='景点/迪士尼' placeholder-style='color:#AAAAAA' value='{{keyword}}' bindconfirm='bindSearch'></input>
   </view>
 </view>
 
@@ -21,67 +26,47 @@
     <image class='ml10' bindtap='changeSort' data-sortBy='2' wx:if="{{!isCYLX}}" src="/img/icon/xl.png" style='width:13rpx;height:8rpx'></image>
     <image class='ml10' bindtap='changeSort' data-sortBy='2' wx:if="{{isCYLX}}" src="/img/icon/sl.png" style='width:13rpx;height:8rpx'></image>
   </view>
-  <view class='flex flex-center flex-1' bindtap='changeSort' data-sortBy='3'>默认排序
-    <image class='ml10' bindtap='changeSort' data-sortBy='3' wx:if="{{!isSort}}" src="/img/icon/xl.png" style='width:13rpx;height:8rpx'></image>
-    <image class='ml10' bindtap='changeSort' data-sortBy='3' wx:if="{{isSort}}" src="/img/icon/sl.png" style='width:13rpx;height:8rpx'></image>
-  </view>
+  <picker mode="selector" range='{{orderbyArray}}' bindchange="orderByChange" value="{{orderBy}}" class='flex flex-center flex-1'>{{orderbyArray[orderBy]}}
+    <image class='ml10' bindtap='changeSort' data-sortBy='3' src="/img/icon/xl.png" style='width:13rpx;height:8rpx'></image>
+  </picker>
 </view>
 
-<navigator open-type='navigate' hover-class='none' url='/pages/reverse/index' class='listItem pad40 b-box'>
-  <view class='imgBox'>
-    <image src="/img/11.png" style='width:100%;border-radius:10rpx;height:290rpx'></image>
-    <view class='top f20 flex flex-center plr10'>
-      <view class='bdr' style='padding-right:10rpx'>上海</view>
-      <view class='ml10'>可订今日</view>
-    </view>
-    <view class='bottom flex flex-aic flex-bt pad10 b-box'>
-      <view class='f24 cfff flex flex-aic'>距离开抢:
-        <text class='numBox mr10'>{{day}}</text>天
-        <text class='numBox ml10'>{{hour}}</text>:
-        <text class='numBox'>{{minute}}</text>:
-        <text class='numBox'>{{second}}</text>
+<scroll-view scroll-y='{{true}}' style='height:1010rpx' bindscrolltolower='scrolltolower'>
+  <navigator open-type='navigate' wx:for="{{products}}" wx:key="{{index}}" hover-class='none' url='/pages/reverse/index?infoId={{item.infoId}}' class='listItem pad40 b-box'>
+    <view class='imgBox'>
+      <image src="{{item.signImg}}" style='width:100%;border-radius:10rpx;height:290rpx'></image>
+      <view class='top f20 flex flex-center plr10'>
+        <view class='bdr' style='padding-right:10rpx'>{{item.city}}</view>
+        <view class='ml10'>{{item.startDay > 0 ? '提前' + item.startDay + '日订' : '可订今日'}}</view>
+      </view>
+      <view class='bottom flex flex-aic flex-bt pad10 b-box'>
+        <view class='f24 cfff flex flex-aic' wx:if="{{item.orderStartDate && item.orderEndDate}}">距离{{item.nowDate > item.orderStartDate ? '结束' : '开抢'}}:
+          <countdown wx:if="{{item.nowDate > item.orderStartDate}}" startTime='{{item.nowDate}}' endTime='{{item.orderEndDate}}' dayEmpty='{{false}}'></countdown>
+          <countdown wx:else startTime='{{item.nowDate}}' endTime='{{item.orderStartDate}}' dayEmpty='{{false}}'></countdown>
+        </view>
+        <view class='cfff f24'>限量{{item.stock}}份</view>
       </view>
-      <view class='cfff f24'>限量50份</view>
-    </view>
-  </view>
-  <view class='mt30 f32 bold c333'>上海迪士尼乐园75折活动,领券立减2</view>
-  <view class='mt20 c333 flex flex-aic flex-bt'>
-    <view class='flex flex-aic'>
-      <view class='f26 c666'>抢购价</view>
-      <view class='f28 ml10' style='color:#FF0000'>¥270元</view>
-      <view class='f24 ml20 text-through' style='color:#9B9B9B'>390元</view>
-    </view>
-    <view class='buyBtn f28 cfff flex flex-center'>
-      立即抢购
-    </view>
-  </view>
-</navigator>
-<navigator open-type='navigate' hover-class='none' url='/pages/reverse/index' class='listItem pad40 b-box'>
-  <view class='imgBox'>
-    <image src="/img/11.png" style='width:100%;border-radius:10rpx;height:290rpx'></image>
-    <view class='top f20 flex flex-center plr10'>
-      <view class='bdr' style='padding-right:10rpx'>上海</view>
-      <view class='ml10'>可订今日</view>
     </view>
-    <view class='bottom flex flex-aic flex-bt pad10 b-box'>
-      <view class='f24 cfff flex flex-aic'>距离开抢:
-        <text class='numBox mr10'>{{day2}}</text>天
-        <text class='numBox ml10'>{{hour2}}</text>:
-        <text class='numBox'>{{minute2}}</text>:
-        <text class='numBox'>{{second2}}</text>
+    <view class='mt30 f32 bold c333'>{{item.infoTitle}}</view>
+    <view class='mt20 c333 flex flex-aic flex-bt'>
+      <view class='flex flex-aic'>
+        <view class='f26 c666'>抢购价</view>
+        <view class='f28 ml10' style='color:#FF0000'>¥{{item.salePrice / 100}}元</view>
+        <view class='f24 ml20 text-through' style='color:#9B9B9B'>{{item.marketPrice / 100}}元</view>
+      </view>
+      <view class='buyBtn f28 cfff flex flex-center'>
+        立即抢购
       </view>
-      <view class='cfff f24'>限量50份</view>
     </view>
-  </view>
-  <view class='mt30 f32 bold c333'>上海迪士尼乐园75折活动,领券立减2</view>
-  <view class='mt20 c333 flex flex-aic flex-bt'>
-    <view class='flex flex-aic'>
-      <view class='f26 c666'>抢购价</view>
-      <view class='f28 ml10' style='color:#FF0000'>¥270元</view>
-      <view class='f24 ml20 text-through' style='color:#9B9B9B'>390元</view>
+  </navigator>
+  <view class='listItem pad40 b-box flex' wx:if='{{isAll == 0}}'>
+    <view class='flex flex-center flex-1 loading'>
+      加载中...
     </view>
-    <view class='buyBtn f28 cfff flex flex-center'>
-      立即抢购
+  </view>
+  <view class='listItem pad40 b-box flex' wx:elif='{{isAll == 2}}'>
+    <view class='flex flex-center flex-1 loading'>
+      暂无数据
     </view>
   </view>
-</navigator>
+</scroll-view>

+ 5 - 0
src/pages/flashSale/index.wxss

@@ -69,3 +69,8 @@
   text-align: center;
   font-size: 20rpx;
 }
+.listItem .loading{
+  font-size:25rpx;
+  color:#C4C4C4;
+
+}

+ 58 - 3
src/pages/huiTravel/index.js

@@ -1,4 +1,6 @@
 // pages/huiTravel/index.js
+import { shuoAPIClient } from '../../common/api/api.js';
+
 Page({
 
   /**
@@ -7,7 +9,11 @@ Page({
   data: {
     tabIndex: 1,
     region: ['上海'],
-    currentRegion: '上海'
+    currentRegion: '上海',
+    page: 0,
+    isAll: 0, //0未加载完,1加载完,2无数据
+    lock: false, //请求景点锁,一次请求未完毕不可进行第二次
+    infos: []
   },
 
   bindRegionChange: function(e) {
@@ -18,6 +24,51 @@ Page({
     })
   },
 
+  //获取营销内容
+  getInfos() {
+    this.setData({
+      lock: true
+    })
+    shuoAPIClient.request('/api/minapp/news/infos',
+      {
+        page: this.data.page,
+        resultNum: 10
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('营销内容', res)
+        if (res.data.results && res.data.results.length) {
+          let datas = this.data.infos
+          datas.push(...res.data.results)
+          let isAll = 0
+          if (res.data.sizeAll == datas.length) {
+            isAll = 1
+          }
+          this.setData({
+            infos: datas,
+            page: this.data.page + 1,
+            isAll,
+            lock: false
+          })
+        } else {
+          this.setData({
+            infos: [],
+            isAll: 2,
+            lock: false
+          })
+        }
+      })
+  },
+
+  /**
+ * 请求数据重置
+ */
+  restoreData() {
+    this.setData({
+      page: 0,
+      isAll: 0,
+      infos: []
+    })
+  },
   /**
    * 生命周期函数--监听页面加载
    */
@@ -36,7 +87,8 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function() {
-
+    this.restoreData()
+    this.getInfos()
   },
 
   /**
@@ -64,7 +116,10 @@ Page({
    * 页面上拉触底事件的处理函数
    */
   onReachBottom: function() {
-
+    console.log('onReachBottom')
+    if (!this.data.lock && this.data.isAll == 0) {
+      this.getInfos()
+    }
   },
 
   /**

+ 15 - 23
src/pages/huiTravel/index.wxml

@@ -1,6 +1,6 @@
-<image src="/img/banner.jpg" class='w100 topBg' style='height:196rpx'></image>
+<!-- <image src="/img/banner.jpg" class='w100 topBg' style='height:196rpx'></image> -->
 
-<view class='searchBgView flex flex-center'>
+<!-- <view class='searchBgView flex flex-center'>
   <view class="searchBox flex flex-aic">
     <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
       <butotn class='f30 c4a bdr flex flex-center' style='width:140rpx'>{{currentRegion}}
@@ -10,34 +10,26 @@
     <icon type='search' size='14' class='ml20'></icon>
     <input class='ml20 f30 c4a' placeholder='景点/迪士尼' placeholder-style='color:#AAAAAA'></input>
   </view>
-</view>
+</view> -->
 
 <view class='b-box w100' style='padding:0 30rpx'>
-  <navigator url='/pages/activityDetail/activityDetail' hover-class='none' class='bdb flex flex-bt w100 b-box' style='padding:30rpx 0'>
+  <navigator wx:for='{{infos}}' wx:key='{{index}}' url='/pages/activityDetail/activityDetail?id={{item.id}}' hover-class='none' class='bdb flex flex-bt w100 b-box' style='padding:30rpx 0'>
     <view class='f32 c333 flex flex-column flex-bt flex-1'>
       <view>
-        上海迪士尼乐园(度假区)优惠了,快来订购吧!
+        {{item.title}}
       </view>
-      <view class='f26 c999'>2018-03-26 18:40</view>
+      <view class='f26 c999'>{{item.createDate}}</view>
     </view>
-    <image src="/img/11.png" style='width:182rpx;height:136rpx;border-radius:5rpx'></image>
+    <image src="item.img" style='width:182rpx;height:136rpx;border-radius:5rpx'></image>
   </navigator>
-  <navigator url='/pages/activityDetail/activityDetail' hover-class='none' class='bdb flex flex-bt w100 b-box' style='padding:30rpx 0'>
-    <view class='f32 c333 flex flex-column flex-bt flex-1'>
-      <view>
-        上海迪士尼乐园(度假区)优惠了,快来订购吧!
-      </view>
-      <view class='f26 c999'>2018-03-26 18:40</view>
+  <view class='listItem pad40 b-box flex' wx:if='{{isAll == 0}}'>
+    <view class='flex flex-center flex-1 loading'>
+      加载中...
     </view>
-    <image src="/img/11.png" style='width:182rpx;height:136rpx;border-radius:5rpx'></image>
-  </navigator>
-  <navigator url='/pages/activityDetail/activityDetail' hover-class='none' class='bdb flex flex-bt w100 b-box' style='padding:30rpx 0'>
-    <view class='f32 c333 flex flex-column flex-bt flex-1'>
-      <view>
-        上海迪士尼乐园(度假区)优惠了,快来订购吧!
-      </view>
-      <view class='f26 c999'>2018-03-26 18:40</view>
+  </view>
+  <view class='listItem pad40 b-box flex' wx:elif='{{isAll == 2}}'>
+    <view class='flex flex-center flex-1 loading'>
+      暂无数据
     </view>
-    <image src="/img/11.png" style='width:182rpx;height:136rpx;border-radius:5rpx'></image>
-  </navigator>
+  </view>
 </view>

+ 5 - 0
src/pages/huiTravel/index.wxss

@@ -18,3 +18,8 @@
   width: 100%;
   height: 196rpx;
 }
+
+.listItem .loading{
+  font-size: 25rpx;
+  color: #c4c4c4;
+}

+ 218 - 91
src/pages/index/index.js

@@ -1,25 +1,28 @@
+import { shuoAPIClient } from '../../common/api/api.js';
 //index.js
 //获取应用实例
 const app = getApp()
-
 Page({
   data: {
     indicatorDots: false,
     autoplay: true,
+    current: 0,
     interval: 2000,
     duration: 300,
     tabIndex: 1,
-    region: ['上海'],
-    currentRegion: '上海',
-    day: 3,
-    second: 50,
-    minute: 40,
-    hour: 52,
-    day2: 2,
-    second2: 40,
-    minute2: 30,
-    hour2: 22,
-    isScrollTopIcon: false
+    region: 0,
+    currentRegion: '全部',
+    isScrollTopIcon: false,
+    themesDatas: null, //主题列表
+    areas: null, //地区列表
+    areaName: 'areaName',
+    selectedArea: 0, //选中的地区id
+    specialProducts: null, //限时特惠产品
+    selectedTheme: 0, //猜你喜欢选中的主题id
+    views: null, //猜你喜欢(景点)
+    informations: null, //资讯播报
+    infos: null, //营销内容,
+    dayEmpty: false
   },
 
   backToTop() {
@@ -28,104 +31,228 @@ Page({
       duration: 300
     })
   },
+  onLoad: function () {
 
-  // 倒计时
-  setDateOut() {
-    var self = this
-    var InterVal = setInterval(function() {
-      self.setData({
-        second: self.data.second - 1
+  },
+  onShow(option) {
+    this.getAreas();
+    this.getThemes();
+    this.getInfos()
+  },
+  //获取主题
+  getThemes() {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/ticket/themes',
+      {
+        startIndex: 0,
+        resultNum: 5
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('主题', res)
+        if (res.data.results && res.data.results.length) {
+          this.data.selectedTheme = res.data.results[this.data.tabIndex - 1].catId
+          this.setData({
+            themesDatas: res.data.results
+          })
+          //更新景点
+          this.getViews()
+        }
       })
-      if (self.data.second == -1) {
-        self.setData({
-          second: 59,
-          minute: self.data.minute - 1,
-        })
-      }
-      if (self.data.minute == -1) {
-        self.setData({
-          minute: 59,
-          hour: self.data.hour - 1,
+  },
+  //获取城市
+  getAreas() {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/common/areas',
+      {
+        areaType: 0, //周边地区
+        treeId: 0
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('城市', res)
+        if (res.data && res.data) {
+          let currentRegion = wx.getStorageSync('currentRegion')
+          let region = wx.getStorageSync('region')
+          let selectedArea = wx.getStorageSync('selectedArea')
+          console.log(currentRegion, region, selectedArea)
+          this.setData({
+            areas: res.data,
+            currentRegion: currentRegion ? currentRegion : res.data[0].areaName,
+            region: region ? region : 0,
+            selectedArea: selectedArea ? selectedArea : res.data[0].areaId
+          })
+          //更新限时特惠
+          this.getSpecialProduct(res.data[0].areaId)
+          //更新资讯播报
+          this.getInformations(res.data[0].areaId);
+        }
+      })
+  },
+  //限时特惠
+  getSpecialProduct(areaId) {
+    if (!areaId || areaId == 0 || areaId == '0') {
+      areaId = this.data.selectedArea
+    }
+    if (!areaId || areaId == 0 || areaId == '0') {
+      areaId = ''
+    }
+    console.log('areaId', areaId)
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/ticket/products',
+      {
+        areaId,
+        orderBy: 3,//推荐值至高向低排序
+        startIndex: 0,
+        resultNum: 10
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('限时特惠', res)
+        this.setData({
+          current: 0,
+          specialProducts: []
         })
-      }
-      if (self.data.hour == 0 && self.data.minute == 0 && self.data.second == 0) {
-        clearInterval(InterVal)
-      }
-    }, 1000)
+        if (res.data.results && res.data.results.length) {
+          let datas = res.data.results
+          let result = []
+          for (var i = 0, len = datas.length; i < len; i += 2) {
+            result.push(datas.slice(i, i + 2));
+          }
+          console.log('限时特惠result', result)
+          this.setData({
+            specialProducts: result
+          })
+        }
+      })
+  },
+  
+  //猜你喜欢(景点)
+  getViews() {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/ticket/views',
+      {
+        themeId: this.data.selectedTheme,
+        areaId: this.data.selectedArea,
+        startIndex: 0,
+        resultNum: 20
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('景点', res)
+        if (res.data.results && res.data.results.length) {
+          let datas = res.data.results
+          //分割成两个景点一组
+          var result = [];
+          for (var i = 0, len = datas.length; i < len; i += 2) {
+            result.push(datas.slice(i, i + 2));
+          }
+          console.log(result)
+          this.setData({
+            views: result
+          })
+        } else {
+          this.setData({
+            views: null
+          })
+        }
+      })
   },
 
-  setDateOut2() {
-    var self = this
-    var InterVal2 = setInterval(function() {
-      self.setData({
-        second2: self.data.second2 - 1
+  //获取资讯播报
+  getInformations(areaId) {
+    if (!areaId || areaId == '0') {
+      areaId = ''
+    }
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/news/informationList',
+      {
+        areaId,
+        startIndex: 0, 
+        resultNum: 5
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('资讯播报', res)
+        if (res.data && res.data) {
+          this.setData({
+            informations: res.data
+          })
+        }
       })
-      if (self.data.second2 == -1) {
-        self.setData({
-          second2: 59,
-          minute2: self.data.minute2 - 1,
-        })
-      }
-      if (self.data.minute2 == -1) {
-        self.setData({
-          minute2: 59,
-          hour2: self.data.hour2 - 1,
-        })
-      }
+  },
 
-      if (self.data.hour2 == 0 && self.data.minute2 == 0 && self.data.second2 == 0) {
-        clearInterval(InterVal)
-      }
-    }, 1000)
+  //获取营销内容
+  getInfos() {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/news/infos',
+      {
+        page: 0,
+        resultNum: 5
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('营销内容', res)
+        if (res.data.results && res.data.results.length) {
+          this.setData({
+            infos: res.data.results
+          })
+        }
+      })
   },
 
+  //修改城市之后的回调
   bindRegionChange: function(e) {
-    console.log('picker发送选择改变,携带值为', e.detail.value)
+    console.log('areas', this.data.areas)
+    this.data.selectedArea = this.data.areas[e.detail.value].areaId
+    console.log('地区修改', this.data.selectedArea)
     this.setData({
       region: e.detail.value,
-      currentRegion: e.detail.value[e.detail.value.length - 2]
+      currentRegion: this.data.areas[e.detail.value].areaName
     })
-  },
-
-  onGotUserInfo(e) {
-    console.log(e)
-    let params = {}
-    params.minAppLogin = e.detail.userInfo
-    app.$post('api/minapp/user/minAppLogin', params, res => {
-      console.log(res)
+    wx.setStorage({
+      key: 'region',
+      data: e.detail.value,
+    })
+    wx.setStorage({
+      key: 'currentRegion',
+      data: this.data.areas[e.detail.value].areaName,
     })
+    wx.setStorage({
+      key: 'selectedArea',
+      data: this.data.areas[e.detail.value].areaId
+    })
+    this.getSpecialProduct()
+    this.getViews()
   },
 
   changeTab(e) {
+    console.log('更改主题', e)
     this.setData({
-      tabIndex: e.currentTarget.dataset.index
+      tabIndex: e.currentTarget.dataset.index,
+      selectedTheme: this.data.themesDatas[e.currentTarget.dataset.index - 1].catId
     })
+    let catId = this.data.themesDatas[e.currentTarget.dataset.index - 1].catId
+    this.getViews()
   },
 
-  onPageScroll: function(e) {
-    if (e.scrollTop <= 400) {
-      this.setData({
-        isScrollTopIcon: false
-      })
-    } else {
-      this.setData({
-        isScrollTopIcon: true
-      })
-    }
-    if (e.scrollTop >= 750){
-       this.setData({
-         fixTop:true
-       })
-    }else{
-      this.setData({
-        fixTop: false
-      })
-    }
-  },
-
-  onLoad: function() {
-    this.setDateOut()
-    this.setDateOut2()
-  },
-
+  //搜索框事件
+  bindSearch: function(e){
+    console.log(e)
+    wx.navigateTo({    //保留当前页面,跳转到应用内的某个页面(最多打开5个页面,之后按钮就没有响应的)
+      url: "/pages/menpiao/index?keyword=" + e.detail.value
+    })
+  }
 })

+ 5 - 1
src/pages/index/index.json

@@ -1 +1,5 @@
-{}
+{
+  "usingComponents": {
+    "countdown": "../../common/countdown/countdown"
+  }
+}

+ 57 - 185
src/pages/index/index.wxml

@@ -6,64 +6,44 @@
 </view>
 
 <swiper class='swiper' indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
-  <block>
+  <block wx:for='{{informations}}' wx:key='{{index}}'>
     <swiper-item>
-      <image class='topBg w100' src="/img/icon/img_homeNormal.png" style='height:350rpx'></image>
-    </swiper-item>
-  </block>
-  <block>
-    <swiper-item>
-      <image class='topBg w100' src="/img/11.png" style='height:350rpx'></image>
+      <image class='topBg w100' src="{{item.img ? item.img : '/img/icon/img_homeNormal.png'}}" style='height:350rpx'></image>
     </swiper-item>
   </block>
 </swiper>
-
 <view class='searchView flex flex-aic pad10 pt20 pb20 b-box'>
-  <view class='flex flex-column flex-center ml20 mt20 mb20'>
+  <!-- <view class='flex flex-column flex-center ml20 mt20 mb20'>
     <text class='f26 c666'>明日</text>
     <image src='/img/sun.png' style='width:50rpx;height:50rpx;'></image>
-  </view>
-  <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
-    <butotn class='f30 c4a bdr flex flex-center' style='width:130rpx'>{{currentRegion}}
+  </view> -->
+  <picker mode="selector" range='{{areas}}' range-key="{{areaName}}" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
+    <butotn class='f30 c4a bdr flex flex-center' style='width:150rpx'>{{currentRegion}}
       <image src="/img/icon/xl.png" style='width:13rpx;height:8rpx' class='ml10'></image>
     </butotn>
   </picker>
   <icon type='search' size='14' class='ml20'></icon>
-  <input class='ml20 f30 c4a' placeholder='景点/迪士尼' confirm-type='search' placeholder-style='color:#AAAAAA'></input>
+  <input class='ml20 f30 c4a' placeholder='景点/迪士尼' confirm-type='search' bindconfirm='bindSearch' placeholder-style='color:#AAAAAA'></input>
 </view>
 
 
 <view class='mt40 flex bgfff'>
-  <view class='flex flex-center flex-1 flex-column'>
-    <image src="/img/icon/1.png" style='width:85rpx;height:85rpx'></image>
-    <view class='f26 c666 mt20'>迪士尼</view>
-  </view>
-  <navigator open-type='navigate' url="/pages/menpiao/index" hover-class='none' class='flex flex-center flex-1 flex-column'>
+  <navigator wx:for='{{themesDatas}}' wx:key='{{item.catId}}' open-type='navigate' url="/pages/menpiao/index?themeId={{item.catId}}&themeName={{item.catName}}" hover-class='none' class='flex flex-center flex-1 flex-column'>
     <image src="/img/icon/2.png" style='width:85rpx;height:85rpx'></image>
-    <view class='f26 c666 mt20'>门票</view>
-  </navigator>
-  <navigator open-type='navigate' url="/pages/freeGo/index" hover-class='none' class='flex flex-center flex-1 flex-column'>
-    <image src="/img/icon/3.png" style='width:85rpx;height:85rpx'></image>
-    <view class='f26 c666 mt20'>自由行</view>
+    <view class='f26 c666 mt20'>{{item.catName}}</view>
   </navigator>
-  <view class='flex flex-center flex-1 flex-column'>
-    <image src="/img/icon/4.png" style='width:85rpx;height:85rpx'></image>
-    <view class='f26 c666 mt20'>亲子酒店</view>
-  </view>
-  <view class='flex flex-center flex-1 flex-column'>
-    <image src="/img/icon/5.png" style='width:85rpx;height:85rpx'></image>
-    <view class='f26 c666 mt20'>演出展览</view>
-  </view>
 </view>
-
-<view class='middleTips flex flex-aic pad20 b-box flex-bt'>
-  <view class='flex flex-aic'>
-    <image src="/img/icon/img_toutiaoNormal.png" style='width:125rpx;height:30rpx'></image>
-    <view class='ml20 f28 c222 pr10'>迪士尼特价限时75折,疯狂抢购</view>
-  </view>
-  <navigator open-type='navigate' hover-class='none' url="/pages/activityDetail/activityDetail" class='f26' style='color:#079E61;padding-left:20rpx;border-left:2rpx #979797 solid'>查看</navigator>
-</view>
-
+<swiper class="swiper-height2" vertical="true" indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
+  <swiper-item wx:for="{{infos}}" wx:key='{{index}}'>
+    <view class='middleTips flex flex-aic pad20 b-box flex-bt'>
+            <view class='flex flex-aic'>
+              <image src="/img/icon/img_toutiaoNormal.png" style='width:125rpx;height:30rpx'></image>
+              <view class='ml20 f28 c222 pr10'>{{item.title}}</view>
+            </view>
+            <navigator open-type='navigate' hover-class='none' url="/pages/activityDetail/activityDetail?id={{item.id}}" class='f26' style='color:#079E61;padding-left:20rpx;border-left:2rpx #979797 solid'>查看</navigator>
+    </view>
+  </swiper-item>
+</swiper>
 <view class='greyBar mt20'></view>
 
 <view class='xsth flex flex-center flex-column' style='padding-bottom:40rpx'>
@@ -72,56 +52,35 @@
     <view class='f36 c333 bold ml10'>限时特惠</view>
   </view>
   <view class='f26 mt20 through-line flex flex-center' style='color:#9B9B9B'>超值特惠,限时抢购</view>
-  <view class='mt20 flex flex-center flex-bt' style='width:93%'>
-    <navigator hover-class='none' url="/pages/reverse/index" class='flex flex-center flex-column flex-1 mr10'>
-      <view class='w100 imgBox' style='height:238rpx'>
-        <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-        <view class='topImgTip f20 flex flex-center plr10'>
-          <view class='bdr' style='padding-right:10rpx'>上海</view>
-          <view class='ml10'>可订今日</view>
-        </view>
-      </view>
-      <view class='flex flex-aic mt20 flex-ais w100'>
-        <view class='f24 flex flex-aic' style='color:#717171'>
-          <image src="/img/icon/nz.png" style='width:32rpx;height:32rpx;margin-right:5rpx'></image> 距结束还剩:</view>
-        <view class='flex f20 flex flex-aic' style='color:#FD7644'>
-          <view class='flex mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{hour}}</view>:
-          <view class='flex ml10 mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{minute}}</view>:
-          <view class='flex ml10 mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{second}}</view>
-        </view>
-      </view>
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
-      <view class='mt20 c333  flex flex-aic flex-jcc  w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-        <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-      </view>
-    </navigator>
-    <navigator hover-class='none' url="/pages/reverse/index" class='flex flex-center flex-column flex-1 mr10'>
-      <view class='w100 imgBox' style='height:238rpx'>
-        <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-        <view class='topImgTip f20 flex flex-center plr10'>
-          <view class='bdr' style='padding-right:10rpx'>上海</view>
-          <view class='ml10'>可订今日</view>
-        </view>
-      </view>
-      <view class='flex flex-aic mt20 flex-ais w100'>
-        <view class='f24 flex flex-aic' style='color:#717171'>
-          <image src="/img/icon/nz.png" style='width:32rpx;height:32rpx;margin-right:5rpx'></image> 距结束还剩:</view>
-        <view class='flex f20 flex flex-aic' style='color:#FD7644'>
-          <view class='flex mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{hour2}}</view>:
-          <view class='flex ml10 mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{minute2}}</view>:
-          <view class='flex ml10 mr10 flex-center cfff' style='border-radius:5rpx;width:32rpx;height:32rpx;background:#FD6A3C'>{{second2}}</view>
+  <swiper style='width:100%;height:500rpx' indicator-dots="{{indicatorDots}}" autoplay="{{true}}" interval="{{interval}}" duration="{{duration}}" current='{{current}}'>
+    <block>
+      <swiper-item wx:for='{{specialProducts}}' wx:key='{{index}}'>
+        <view class='mt20 flex flex-center flex-bt' style='width:93%;padding-left:4%'>
+          <navigator wx:for='{{item}}' wx:key='{{item.infoId}}' hover-class='none'  url="/pages/reverse/index?infoId={{item.infoId}}" class='flex flex-center flex-column flex-1 mr10'>
+            <view class='w100 imgBox' style='height:238rpx'>
+              <image src="{{item.signImg}}" style='border-radius:8rpx;width:100%;height:238rpx'></image>
+              <view class='topImgTip f20 flex flex-center plr10'>
+                <view class='bdr' style='padding-right:10rpx'>{{item.city}}</view>
+                <view class='ml10'>{{item.startDay > 0 ? '需提前' + item.startDay + '天订' : '可订今日'}}</view>
+              </view>
+            </view>
+            <view class='flex flex-aic mt20 flex-ais w100'>
+              <view class='f24 flex flex-aic' style='color:#717171'>
+                <image src="/img/icon/nz.png" style='width:32rpx;height:32rpx;margin-right:5rpx'></image> 距结束还剩:</view>
+                <countdown startTime='{{item.nowDate}}' endTime='{{item.orderEndDate}}'></countdown>
+            </view>
+            <view class='mt20 c333 bold flex flex-ais w100' style=''>{{item.infoTitle}}</view>
+            <view class='mt20 c333  flex flex-aic flex-jcc  w100'>
+              <view class='f28 bold' style='color:#FF0000'>¥{{item.salePrice / 100}}元</view>
+              <view class='f24 ml10' style='color:#9B9B9B'>起</view>
+              <view class='f24 oriPrice' style='color:#9B9B9B'>¥{{item.marketPrice / 100}}</view>
+            </view>
+          </navigator>
         </view>
-      </view>
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
-      <view class='mt20 c333  flex flex-aic flex-jcc  w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-        <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-      </view>
-    </navigator>
-  </view>
+      </swiper-item>
+    </block>
+  </swiper>
+  
 </view>
 
 <view class='greyBar'></view>
@@ -133,110 +92,23 @@
   </view>
   <view class='f26 mt20 through-line flex flex-center' style='color:#9B9B9B'>总有一个您喜欢的</view>
   <view class='tabBar flex flex-bt'>
-    <view bindtap='changeTab' data-index="1" class='item {{tabIndex==1?"active":""}}'>门票</view>
-    <view bindtap='changeTab' data-index="2" class='item {{tabIndex==2?"active":""}}'>自由行</view>
-    <view bindtap='changeTab' data-index="3" class='item {{tabIndex==3?"active":""}}'>亲自酒店</view>
-    <view bindtap='changeTab' data-index="4" class='item {{tabIndex==4?"active":""}}'>演出展览</view>
-  </view>
-  <view class='mt20 flex flex-center flex-bt' style='width:93%'>
-    <navigator open-type='navigate' hover-class='none' url="/pages/travel/detail" class='flex flex-center flex-column flex-1 mr10'>
-      <view class='w100 imgBox' style='height:238rpx'>
-        <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-        <view class='topImgTip f20 flex flex-center plr10'>
-          <view class='bdr' style='padding-right:10rpx'>上海</view>
-          <view class='ml10'>可订今日</view>
-        </view>
-      </view>
-
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
-      <view class='mt20 c333  flex flex-aic  w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-        <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-      </view>
-    </navigator>
-    <navigator open-type='navigate' hover-class='none' url="/pages/travel/detail" class='flex flex-center flex-column flex-1 ml10'>
-      <view class='w100 imgBox' style='height:238rpx'>
-        <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-        <view class='topImgTip f20 flex flex-center plr10'>
-          <view class='bdr' style='padding-right:10rpx'>上海</view>
-          <view class='ml10'>可订今日</view>
-        </view>
-      </view>
-
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
-      <view class='mt20 c333  flex flex-aic w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-        <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-      </view>
-    </navigator>
-  </view>
-  <view class='mt40 flex flex-center flex-bt' style='width:93%'>
-    <navigator open-type='navigate' hover-class='none' url="/pages/travel/detail" class='flex flex-center flex-column flex-1 mr10'>
-      <view class='w100 imgBox' style='height:238rpx'>
-        <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-        <view class='topImgTip f20 flex flex-center plr10'>
-          <view class='bdr' style='padding-right:10rpx'>上海</view>
-          <view class='ml10'>可订今日</view>
-        </view>
-      </view>
-
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
-      <view class='mt20 c333  flex flex-aic  w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-        <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-      </view>
-    </navigator>
-    <navigator open-type='navigate' hover-class='none' url="/pages/travel/detail" class='flex flex-center flex-column flex-1 ml10'>
-      <view class='w100 imgBox' style='height:238rpx'>
-        <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-        <view class='topImgTip f20 flex flex-center plr10'>
-          <view class='bdr' style='padding-right:10rpx'>上海</view>
-          <view class='ml10'>可订今日</view>
-        </view>
-      </view>
-
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
-      <view class='mt20 c333  flex flex-aic w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-        <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-      </view>
-    </navigator>
+    <view wx:for='{{themesDatas}}' wx:key='{{item.catId}}' bindtap='changeTab' data-index="{{index + 1}}" class='item {{tabIndex==index + 1?"active":""}}'>{{item.catName}}</view>
   </view>
-  <view class='mt40 flex flex-center flex-bt' style='width:93%'>
-    <navigator open-type='navigate' hover-class='none' url="/pages/travel/detail" class='flex flex-center flex-column flex-1 mr10'>
+  <view wx:for='{{views}}' wx:key='{{index}}' class='mt20 flex flex-center flex-bt' style='width:93%'>
+    <navigator wx:for='{{item}}' wx:key='{{item.viewId}}' open-type='navigate' hover-class='none' url="/pages/travel/detail?viewId={{item.viewId}}" class='flex flex-center flex-column flex-1 mr10'>
       <view class='w100 imgBox' style='height:238rpx'>
-        <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
+        <image src="{{item.signImg}}" style='border-radius:8rpx;width:100%;height:238rpx'></image>
         <view class='topImgTip f20 flex flex-center plr10'>
-          <view class='bdr' style='padding-right:10rpx'>上海</view>
-          <view class='ml10'>可订今日</view>
+          <view class='bdr' style='padding-right:10rpx'>{{item.areaName}}</view>
+          <view class='ml10'>{{item.startDay ? '需提前' + item.startDay + '天订' : '可订今日'}}</view>
         </view>
       </view>
 
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
+      <view class='mt20 c333 bold flex flex-ais w100' style=''>{{item.viewName}}</view>
       <view class='mt20 c333  flex flex-aic  w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-        <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-      </view>
-    </navigator>
-    <navigator open-type='navigate' hover-class='none' url="/pages/travel/detail" class='flex flex-center flex-column flex-1 ml10'>
-      <view class='w100 imgBox' style='height:238rpx'>
-        <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-        <view class='topImgTip f20 flex flex-center plr10'>
-          <view class='bdr' style='padding-right:10rpx'>上海</view>
-          <view class='ml10'>可订今日</view>
-        </view>
-      </view>
-
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
-      <view class='mt20 c333  flex flex-aic w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
+        <view class='f28 bold' style='color:#FF0000'>¥{{item.minPrice / 100}}元</view>
         <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
+        <view class='f24 oriPrice' style='color:#9B9B9B'>¥{{item.marketPrice / 100}}</view>
       </view>
     </navigator>
   </view>

+ 3 - 3
src/pages/index/index.wxss

@@ -1,6 +1,3 @@
-page{
-     
-}
 .topBg {
   position: absolute;
   left: 0;
@@ -121,4 +118,7 @@ page{
   top: 0;
   left: 0;
   z-index: 999;
+}
+.swiper-height2 {
+  height: 140rpx
 }

+ 39 - 2
src/pages/me/me.js

@@ -1,11 +1,12 @@
 // pages/me/me.js
+import { shuoAPIClient } from '../../common/api/api.js';
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-  
+    views: null
   },
   // 打电话
   callPhone: function () {
@@ -39,9 +40,45 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function () {
-  
+    this.getHotProducts()
   },
 
+  //猜你喜欢
+  getHotProducts() {
+    let areaId = wx.getStorageSync('selectedArea')
+    if (!areaId || areaId == 'null') {
+      areaId = ''
+    }
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/ticket/views',
+      {
+        areaId,
+        startIndex: 0,
+        resultNum: 20
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('猜你喜欢', res)
+        if (res.data.results && res.data.results.length) {
+          let datas = res.data.results
+          //分割成两个景点一组
+          var result = [];
+          for (var i = 0, len = datas.length; i < len; i += 2) {
+            result.push(datas.slice(i, i + 2));
+          }
+          console.log(result)
+          this.setData({
+            views: result
+          })
+        } else {
+          this.setData({
+            views: null
+          })
+        }
+      })
+  },
   /**
    * 生命周期函数--监听页面隐藏
    */

+ 14 - 23
src/pages/me/me.wxml

@@ -12,25 +12,25 @@
 </view>
 
 <view class='flex w100 pad30 b-box'>
-  <navigator url='/pages/myOrder/myOrder?index=0' hover-class='none' class='flex-1 flex flex-column flex-center'>
+  <navigator url='/pages/myOrder/myOrder?state=&stateIndex=0' hover-class='none' class='flex-1 flex flex-column flex-center'>
     <image src="/img/dingdan@2x.png" style='width:40rpx;height:40rpx'></image>
     <view class='f24 mt10' style='color:#717171'>全部订单</view>
   </navigator>
-  <navigator url='/pages/myOrder/myOrder?index=1' hover-class='none' class='flex-1 flex flex-column flex-center'>
+  <navigator url='/pages/myOrder/myOrder?state=1&stateIndex=1' hover-class='none' class='flex-1 flex flex-column flex-center'>
     <image src="/img/daizhifu@2x.png" style='width:40rpx;height:40rpx'></image>
     <view class='f24 mt10' style='color:#717171'>待支付</view>
   </navigator>
-  <navigator url='/pages/myOrder/myOrder?index=2' hover-class='none' class='flex-1 flex flex-column flex-center'>
+  <navigator url='/pages/myOrder/myOrder?state=2&stateIndex=2' hover-class='none' class='flex-1 flex flex-column flex-center'>
     <image src="/img/daichuxing@2x.png" style='width:40rpx;height:40rpx'></image>
     <view class='f24 mt10' style='color:#717171'>待出行</view>
   </navigator>
-  <navigator url='/pages/myOrder/myOrder?index=3' hover-class='none' class='flex-1 flex flex-column flex-center'>
+  <navigator url='/pages/myOrder/myOrder?state=3&stateIndex=3' hover-class='none' class='flex-1 flex flex-column flex-center'>
     <image src="/img/daishouhou@2x.png" style='width:52rpx;height:40rpx'></image>
-    <view class='f24 mt10' style='color:#717171'>待售后</view>
+    <view class='f24 mt10' style='color:#717171'>已取消</view>
   </navigator>
-  <navigator url='/pages/myOrder/myOrder?index=4' hover-class='none' class='flex-1 flex flex-column flex-center'>
+  <navigator url='/pages/myOrder/myOrder?state=4&stateIndex=4' hover-class='none' class='flex-1 flex flex-column flex-center'>
     <image src="/img/yichenggong@2x.png" style='width:40rpx;height:40rpx'></image>
-    <view class='f24 mt10' style='color:#717171'>已成</view>
+    <view class='f24 mt10' style='color:#717171'>已成</view>
   </navigator>
 </view>
 
@@ -75,26 +75,17 @@
   </view>
   <view class='f26 mt20 through-line flex flex-center' style='color:#9B9B9B'>总有一个您喜欢的</view>
 
-  <view class='mt40 flex flex-center flex-bt' style='width:93%'>
-    <navigator url='/pages/travel/detail' hover-class='none' class='flex flex-center flex-column flex-1 mr10'>
-      <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
+  <view wx:for="{{views}}" wx:key="{{index}}" class='mt40 flex flex-center flex-bt' style='width:93%'>
+    <navigator wx:for="{{item}}" wx:key="{{index}}" url='/pages/travel/detail?viewId={{item.viewId}}' hover-class='none' class='flex flex-center flex-column flex-1 mr10'>
+      <image src="{{item.signImg}}" style='border-radius:8rpx;width:100%;height:238rpx'></image>
 
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
+      <view class='mt20 c333 bold flex flex-ais w100' style=''>{{item.viewName}}</view>
       <view class='mt20 c333  flex flex-aic  w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
+        <view class='f28 bold' style='color:#FF0000'>¥{{item.minPrice / 100}}元</view>
         <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-      </view>
-    </navigator>
-    <navigator url='/pages/travel/detail' hover-class='none' class='flex flex-center flex-column flex-1 ml10'>
-      <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-
-      <view class='mt20 c333 bold flex flex-ais w100' style=''>上海迪士尼乐园</view>
-      <view class='mt20 c333  flex flex-aic w100'>
-        <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-        <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-        <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
+        <view class='f24 oriPrice' style='color:#9B9B9B'>¥{{item.marketPrice / 100}}</view>
       </view>
     </navigator>
+    
   </view>
 </view>

+ 197 - 66
src/pages/menpiao/index.js

@@ -1,4 +1,4 @@
-// pages/menpiao/index.js
+import { shuoAPIClient } from '../../common/api/api.js';
 Page({
 
   /**
@@ -23,89 +23,220 @@ Page({
     second2: 40,
     minute2: 30,
     hour2: 22,
+    keyword: '',
+    themeId: '',
+    themeName: '',
+    areas: null, //地区列表
+    areaName: 'areaName',
+    selectedArea: '',
+    views: [],
+    startIndex: 0,
+    resultNum: 5,
+    isAll: 0, //0未加载完,1加载完,2无数据
+    viewLock: false, //请求景点锁,一次请求未完毕不可进行第二次
+    products: []
+  },
+  /**
+     * 生命周期函数--监听页面加载
+     */
+  onLoad: function (options) {
+    console.log('options', options)
+    let keyword = options.keyword ? options.keyword : ''
+    let themeId = options.themeId ? options.themeId : ''
+    let themeName = options.themeName ? options.themeName : ''
+    this.setData({
+      keyword,
+      themeId,
+      themeName
+    })
+    
   },
 
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+    
+  },
 
-  // 倒计时
-  setDateOut() {
-    var self = this
-    var InterVal = setInterval(function() {
-      self.setData({
-        second: self.data.second - 1
-      })
-      if (self.data.second == -1) {
-        self.setData({
-          second: 59,
-          minute: self.data.minute - 1,
-        })
-      }
-      if (self.data.minute == -1) {
-        self.setData({
-          minute: 59,
-          hour: self.data.hour - 1,
-        })
-      }
-      if (self.data.hour == 0 && self.data.minute == 0 && self.data.second == 0) {
-        clearInterval(InterVal)
-      }
-    }, 1000)
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    this.restoreData()
+    this.getAreas()
   },
 
-  setDateOut2() {
-    var self = this
-    var InterVal2 = setInterval(function() {
-      self.setData({
-        second2: self.data.second2 - 1
-      })
-      if (self.data.second2 == -1) {
-        self.setData({
-          second2: 59,
-          minute2: self.data.minute2 - 1,
-        })
-      }
-      if (self.data.minute2 == -1) {
-        self.setData({
-          minute2: 59,
-          hour2: self.data.hour2 - 1,
-        })
-      }
+  /**
+   * 请求数据重置
+   */
+  restoreData() {
+    this.setData({
+      startIndex: 0,
+      isAll: 0,
+      views: []
+    })
+  },
 
-      if (self.data.hour2 == 0 && self.data.minute2 == 0 && self.data.second2 == 0) {
-        clearInterval(InterVal)
-      }
-    }, 1000)
+  //获取城市
+  getAreas() {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/common/areas',
+      {
+        areaType: 0, //周边地区
+        treeId: 0
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('城市', res)
+        if (res.data && res.data) {
+          let currentRegion = wx.getStorageSync('currentRegion')
+          let region = wx.getStorageSync('region')
+          let selectedArea = wx.getStorageSync('selectedArea')
+          console.log(currentRegion, region, selectedArea)
+          this.setData({
+            areas: res.data,
+            currentRegion: currentRegion ? currentRegion : res.data[0].areaName,
+            region: region ? region : 0,
+            selectedArea: selectedArea ? selectedArea : res.data[0].areaId
+          })
+          this.getProducts(selectedArea)
+        }
+        this.getViews()
+      })
   },
 
+  //景点
+  getViews() {
+    this.data.viewLock = true
+    shuoAPIClient.request('/api/minapp/ticket/views',
+      {
+        keyword: this.data.keyword,
+        areaId: this.data.selectedArea,
+        themeId: this.data.themeId,
+        startIndex: this.data.startIndex,
+        resultNum: this.data.resultNum
+      }, false).then(res => {
+        console.log('景点', res)
+        if (res.data.results && res.data.results.length) {
+          let startIndex = this.data.startIndex + this.data.resultNum
+          let datas = this.data.views
+          datas.push(...res.data.results)
+          let isAll = 0
+          if (res.data.sizeAll == datas.length) {
+            isAll = 1
+          }
+          this.setData({
+            views: datas,
+            startIndex,
+            isAll,
+            viewLock: false
+          })
+        } else {
+          this.setData({
+            views: [],
+            isAll: 2,
+            viewLock: false
+          })
+        }
+      })
+  },
 
+  //滚动产品
+  getProducts(areaId) {
+    if (!areaId) {
+      let areaId = this.data.selectedArea
+    }
+    if (!areaId) {
+      areaId = ''
+    }
+    let themeId = this.data.themeId
+    console.log('areaId', areaId)
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/ticket/products',
+      {
+        areaId,
+        themeId,
+        orderBy: 3,//推荐值至高向低排序
+        startIndex: 0,
+        resultNum: 10
+      }, false).then(res => {
+        wx.hideLoading()
+        console.log('滚动产品', res)
+        if (res.data.results && res.data.results.length) {
+          let datas = res.data.results
+          let result = []
+          for (var i = 0, len = datas.length; i < len; i += 2) {
+            result.push(datas.slice(i, i + 2));
+          }
+          console.log('滚动产品result', result)
+          this.setData({
+            products: result
+          })
+        }
+      })
+  },
+  scrolltolower: function() {
+    console.log('scrolltolower')
+    if (!this.data.viewLock && this.data.isAll == 0) {
+      this.getViews()
+    }
+  },
   bindRegionChange: function(e) {
     console.log('picker发送选择改变,携带值为', e.detail.value)
+    console.log('地区修改', this.data.selectedArea)
     this.setData({
       region: e.detail.value,
-      currentRegion: e.detail.value[e.detail.value.length - 1]
+      currentRegion: this.data.areas[e.detail.value].areaName,
+      selectedArea: this.data.areas[e.detail.value].areaId,
+      startIndex: 0,
+      views: [],
     })
+    this.getViews()
+    wx.setStorage({
+      key: 'region',
+      data: e.detail.value,
+    })
+    wx.setStorage({
+      key: 'currentRegion',
+      data: this.data.areas[e.detail.value].areaName,
+    })
+    wx.setStorage({
+      key: 'selectedArea',
+      data: this.data.areas[e.detail.value].areaId
+    })
+    this.getProducts(this.data.areas[e.detail.value].areaId)
   },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function(options) {
-
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function() {
-    this.setDateOut()
-    this.setDateOut2()
+  bindSearch: function(e) {
+    let keyword = e.detail.value
+    console.log('搜索框事件', keyword)
+    this.setData({
+      startIndex: 0,
+      views: [],
+      keyword
+    })
+    this.getViews()
   },
 
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function() {
-
+  openViewDetail: function(e) {
+    console.log(e.currentTarget.dataset.viewid)
+    let viewId = e.currentTarget.dataset.viewid
+    let self = this
+    wx.navigateTo({    //保留当前页面,跳转到应用内的某个页面(最多打开5个页面,之后按钮就没有响应的)
+      url: "/pages/travel/detail?viewId=" + viewId,
+      success() {
+        self.setData({
+          startIndex: 0,
+          views: []
+        })
+      }
+    })
   },
-
   /**
    * 生命周期函数--监听页面隐藏
    */

+ 42 - 133
src/pages/menpiao/index.wxml

@@ -2,94 +2,42 @@
 
 <view class='searchBgView flex flex-center'>
   <view class="searchBox flex flex-aic">
-    <picker mode="region" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
+    <picker mode="selector" range='{{areas}}' range-key="{{areaName}}" bindchange="bindRegionChange" value="{{region}}" custom-item="{{customItem}}">
       <butotn class='f30 c4a bdr flex flex-center' style='width:140rpx'>{{currentRegion}}
         <image src="/img/icon/xl.png" style='width:13rpx;height:8rpx' class='ml10'></image>
       </butotn>
     </picker>
     <icon type='search' size='14' class='ml20'></icon>
-    <input class='ml20 f30 c4a' placeholder='景点/迪士尼' placeholder-style='color:#AAAAAA'></input>
+    <input class='ml20 f30 c4a' placeholder='景点/迪士尼' placeholder-style='color:#AAAAAA' value='{{keyword}}' bindconfirm='bindSearch'></input>
   </view>
 </view>
 
-<view class='xsth flex flex-center flex-column' style=''>
+<view wx:if='{{themeId && products.length > 0}}' class='xsth flex flex-center flex-column' style=''>
   <view class='f36 c333 mt40 bold flex flex-aic '>
-    <image class='mr10' src="/img/like.png" style='width:38rpx;height:38rpx'></image>热门推荐</view>
+    <image class='mr10' src="/img/like.png" style='width:38rpx;height:38rpx'></image>{{themeName}}</view>
   <view class='f26 mt20 through-line flex flex-center' style='color:#9B9B9B'>总有一个您喜欢的</view>
   <swiper class='swiper-box' style='width:93%;height:450rpx' indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}">
-    <block>
+    <block wx:for="{{products}}" wx:key="{{index}}">
       <swiper-item>
         <view class='mt40 flex flex-center flex-bt' style='width:100%'>
-          <navigator open-type='navigate' hover-class='none' url="/pages/activityDetail/activityDetail" class='flex flex-center flex-column flex-1 mr10'>
+          <navigator wx:for="{{item}}" wx:key="{{index}}" open-type='navigate' hover-class='none' url="/pages/needKnow/needKnow?infoId={{item.infoId}}" class='flex flex-center flex-column flex-1 mr10'>
             <view class='w100 imgBox' style='height:238rpx'>
-              <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
+              <image src="{{item.signImg}}" style='border-radius:8rpx;width:100%;height:238rpx'></image>
               <view class='topImgTip f20 flex flex-center plr10'>
-                <view class='bdr' style='padding-right:10rpx'>上海</view>
-                <view class='ml10'>可订今日</view>
+                <view class='bdr' style='padding-right:10rpx'>{{item.city}}</view>
+                <view class='ml10'>{{item.startDay == 0 ? '可订今日' : '提前' + item.startDay + '天订'}}</view>
               </view>
             </view>
-            <view class='mt20 c333 bold flex flex-ais w100 f28' style=''>上海迪士尼乐园</view>
+            <view class='mt20 c333 bold flex flex-ais w100 f28' style=''>{{item.infoTitle}}</view>
             <view class='mt20 c333  flex flex-aic flex-jcc  w100'>
-              <view class='f28 bold' style='color:#FF0000'>¥270元</view>
+              <view class='f28 bold' style='color:#FF0000'>¥{{item.salePrice}}元</view>
               <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-              <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-            </view>
-          </navigator>
-          <navigator open-type='navigate' hover-class='none' url="/pages/activityDetail/activityDetail" class='flex flex-center flex-column flex-1 mr10'>
-            <view class='w100 imgBox' style='height:238rpx'>
-              <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-              <view class='topImgTip f20 flex flex-center plr10'>
-                <view class='bdr' style='padding-right:10rpx'>上海</view>
-                <view class='ml10'>可订今日</view>
-              </view>
-            </view>
-            <view class='mt20 c333 bold flex flex-ais w100 f28' style=''>上海迪士尼乐园</view>
-            <view class='mt20 c333  flex flex-aic flex-jcc  w100'>
-              <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-              <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-              <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-            </view>
-          </navigator>
-        </view>
-      </swiper-item>
-    </block>
-    <block>
-      <swiper-item>
-        <view class='mt40 flex flex-center flex-bt' style='width:100%'>
-          <navigator open-type='navigate' hover-class='none' url="/pages/activityDetail/activityDetail" class='flex flex-center flex-column flex-1 mr10'>
-            <view class='w100 imgBox' style='height:238rpx'>
-              <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-              <view class='topImgTip f20 flex flex-center plr10'>
-                <view class='bdr' style='padding-right:10rpx'>上海</view>
-                <view class='ml10'>可订今日</view>
-              </view>
-            </view>
-            <view class='mt20 c333 bold flex flex-ais w100 f28' style=''>上海迪士尼乐园</view>
-            <view class='mt20 c333  flex flex-aic flex-jcc  w100'>
-              <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-              <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-              <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
-            </view>
-          </navigator>
-          <navigator open-type='navigate' hover-class='none' url="/pages/activityDetail/activityDetail" class='flex flex-center flex-column flex-1 mr10'>
-            <view class='w100 imgBox' style='height:238rpx'>
-              <image src="/img/2.png" style='border-radius:8rpx;width:100%;height:238rpx'></image>
-              <view class='topImgTip f20 flex flex-center plr10'>
-                <view class='bdr' style='padding-right:10rpx'>上海</view>
-                <view class='ml10'>可订今日</view>
-              </view>
-            </view>
-            <view class='mt20 c333 bold flex flex-ais w100 f28' style=''>上海迪士尼乐园</view>
-            <view class='mt20 c333  flex flex-aic flex-jcc  w100'>
-              <view class='f28 bold' style='color:#FF0000'>¥270元</view>
-              <view class='f24 ml10' style='color:#9B9B9B'>起</view>
-              <view class='f24 oriPrice' style='color:#9B9B9B'>¥390</view>
+              <view class='f24 oriPrice' style='color:#9B9B9B'>¥{{item.marketPrice}}</view>
             </view>
           </navigator>
         </view>
       </swiper-item>
     </block>
-
   </swiper>
 </view>
 
@@ -106,80 +54,41 @@
   </view>
 </view>
 
-<view class='listItem pad40 b-box flex bdb'>
-  <image src="/img/11.png" style='width:250rpx;height:200rpx;border-radius:10rpx;'></image>
-  <view class='flex flex-column ml20 flex-bt'>
-    <view>
-      <view class='f32 c333 bold'>走进滩浒岛</view>
-      <view class='flex mt10'>
-        <view class='tip flex flex-center'>今日可用</view>
-        <view class='tip flex flex-center ml10'>官方电子票</view>
-        <view class='tip flex flex-center ml10'>刷身份证入园</view>
-      </view>
-      <view class='flex mt10 flex-aic'>
-        <view class='f26 bdr pr10' style='color:#FB8E00'>4.7分 很好 </view>
-        <view class='c666 f26 ml10'> 已销售1000+笔</view>
+<scroll-view scroll-y='{{true}}' style='height:1090rpx' bindscrolltolower='scrolltolower'>
+  <view class='listItem pad40 b-box flex bdb' wx:for='{{views}}' wx:key='{{item.viewId}}' data-viewId='{{item.viewId}}' bindtap='openViewDetail'>
+    <image src="{{item.signImg}}" style='width:280rpx;height:200rpx;border-radius:10rpx;'></image>
+    <view class='flex flex-column ml20 flex-bt'>
+      <view>
+        <view class='f32 c333 bold'>{{item.viewName}}</view>
+        <view class='flex mt10'>
+          <view class='tip flex flex-center'>{{item.startDay == 0 ? '今日可用' : '提前' + item.startDay + '天订'}}</view>
+          <view class='tip flex flex-center ml10'>官方电子票</view>
+          <view class='tip flex flex-center ml10'>快速入园</view>
+        </view>
+        <view class='flex mt10 flex-aic'>
+          <view class='f26 bdr pr10' style='color:#FB8E00'>4.7分 很好 </view>
+          <view class='c666 f26 ml10'> 已销售1000+笔</view>
+        </view>
       </view>
-    </view>
-    <view class='flex flex-aic flex-bt'>
-      <view class='flex flex-aic'>
-        <view class='f28 cred bold'>¥</view>
-        <view class='cred f32 bold'>180元</view>
-        <view class='f24 c333 ml10' style='color:#9B9B9B'>起</view>
+      <view class='flex flex-aic flex-bt'>
+        <view class='flex flex-aic'>
+          <view class='f28 cred bold'>¥</view>
+          <view class='cred f32 bold'>{{item.minPrice}}元</view>
+          <view class='f24 c333 ml10' style='color:#9B9B9B'>起</view>
+        </view>
+        <!-- <view class='f24' style='color:#717171'>距我1.75km</view> -->
       </view>
-      <view class='f24' style='color:#717171'>距我1.75km</view>
     </view>
   </view>
+<view class='listItem pad40 b-box flex' wx:if='{{isAll == 0}}'>
+  <view class='flex flex-center flex-1 loading'>
+    加载中...
+  </view>
 </view>
-
-<view class='listItem pad40 b-box flex bdb'>
-  <image src="/img/11.png" style='width:250rpx;height:200rpx;border-radius:10rpx;'></image>
-  <view class='flex flex-column ml20 flex-bt'>
-    <view>
-      <view class='f32 c333 bold'>走进滩浒岛</view>
-      <view class='flex mt10'>
-        <view class='tip flex flex-center'>今日可用</view>
-        <view class='tip flex flex-center ml10'>官方电子票</view>
-        <view class='tip flex flex-center ml10'>刷身份证入园</view>
-      </view>
-      <view class='flex mt10 flex-aic'>
-        <view class='f26 bdr pr10' style='color:#FB8E00'>4.7分 很好 </view>
-        <view class='c666 f26 ml10'> 已销售1000+笔</view>
-      </view>
-    </view>
-    <view class='flex flex-aic flex-bt'>
-      <view class='flex flex-aic'>
-        <view class='f28 cred bold'>¥</view>
-        <view class='cred f32 bold'>180元</view>
-        <view class='f24 c333 ml10' style='color:#9B9B9B'>起</view>
-      </view>
-      <view class='f24' style='color:#717171'>距我1.75km</view>
-    </view>
+<view class='listItem pad40 b-box flex' wx:elif='{{isAll == 2}}'>
+  <view class='flex flex-center flex-1 loading'>
+    暂无数据
   </view>
 </view>
+</scroll-view>
 
-<view class='listItem pad40 b-box flex bdb'>
-  <image src="/img/11.png" style='width:250rpx;height:200rpx;border-radius:10rpx;'></image>
-  <view class='flex flex-column ml20 flex-bt'>
-    <view>
-      <view class='f32 c333 bold'>走进滩浒岛</view>
-      <view class='flex mt10'>
-        <view class='tip flex flex-center'>今日可用</view>
-        <view class='tip flex flex-center ml10'>官方电子票</view>
-        <view class='tip flex flex-center ml10'>刷身份证入园</view>
-      </view>
-      <view class='flex mt10 flex-aic'>
-        <view class='f26 bdr pr10' style='color:#FB8E00'>4.7分 很好 </view>
-        <view class='c666 f26 ml10'> 已销售1000+笔</view>
-      </view>
-    </view>
-    <view class='flex flex-aic flex-bt'>
-      <view class='flex flex-aic'>
-        <view class='f28 cred bold'>¥</view>
-        <view class='cred f32 bold'>180元</view>
-        <view class='f24 c333 ml10' style='color:#9B9B9B'>起</view>
-      </view>
-      <view class='f24' style='color:#717171'>距我1.75km</view>
-    </view>
-  </view>
-</view>

+ 4 - 0
src/pages/menpiao/index.wxss

@@ -118,4 +118,8 @@
   font-family: PingFangSC-Regular;
   color: rgba(255, 255, 255, 1);
   line-height: 28rpx;
+}
+.loading {
+  font-size: 25rpx;
+  color: #C4C4C4
 }

+ 212 - 67
src/pages/myOrder/myOrder.js

@@ -1,68 +1,213 @@
-// pages/myOrder/myOrder.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-    
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    this.setData({
-      index: options.index
-    })
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-  
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-  
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-  
-  }
+// pages/myOrder/myOrder.js
+import { shuoAPIClient } from '../../common/api/api.js';
+import user from '../../common/user/user.js';
+import { formatDate } from '../../lib/util/util.js';
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    stateArray:[
+      {
+        name: '全部订单',
+        value: ''
+      },
+      {
+        name: '待支付订单',
+        value: '1'
+      },
+      {
+        name: '待出行订单',
+        value: '2'
+      },
+      {
+        name: '已取消订单',
+        value: '3'
+      },
+      {
+        name: '已完成订单',
+        value: '4'
+      },
+    ],
+    stateName: [
+      '待确认',
+      '待付款',
+      '已付款',
+      '已取消',
+      '已完成'
+    ],
+    stateIndex: 0,
+    state: '',
+    keyword: '',
+    startIndex: 0,
+    resultNum: 5,
+    isAll: 0, //0未加载完,1加载完,2无数据
+    orderLock: false, //列表锁,一次请求未完毕不可进行第二次
+    orders: []
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    if (options.state) {
+      this.setData({
+        state: options.state,
+        stateIndex: options.stateIndex
+      })
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    this.restoreData()
+    this.getOrderList()
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+    console.log('onReachBottom')
+    if (!this.data.orderLock && this.data.isAll == 0) {
+      this.getOrderList()
+    }
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  },
+  
+  /**
+ * 登录回调
+ */
+  loginCallBack: function (e) {
+    console.log('loginCallBack')
+    this.restoreData()
+    this.getOrderList()
+  },
+
+  /**
+   * 弹框提示
+   */
+  openToast(title, icon) {
+    wx.showToast({
+      title: title,
+      icon: icon,
+      duration: 2000
+    })
+  },
+
+  /**
+   * 订单列表
+   */
+  getOrderList() {
+    if (!user.getMyTokenSync()) {
+      return false
+    }
+    this.data.orderLock = true
+    shuoAPIClient.request('/api/minapp/order/orders',
+      {
+        keyword: this.data.keyword,
+        orderStatus: this.data.state,
+        startIndex: this.data.startIndex,
+        resultNum: this.data.resultNum
+      }, true).then(res => {
+        console.log('订单', res)
+        if (res.data.results && res.data.results.length) {
+          let startIndex = this.data.startIndex + this.data.resultNum
+          let datas = this.data.orders
+          for (let data of res.data.results) {
+            data.travelDate = formatDate(data.travelDate, 'yyyy-MM-dd')
+          }
+          datas.push(...res.data.results)
+          let isAll = 0
+          if (res.data.sizeAll == datas.length) {
+            isAll = 1
+          }
+          this.setData({
+            orders: datas,
+            startIndex,
+            isAll,
+            orderLock: false
+          })
+        } else {
+          this.setData({
+            orders: [],
+            isAll: 2,
+            orderLock: false
+          })
+        }
+      })
+  },
+
+  /**
+   * 改变状态
+   */
+  bindPickerChange(e) {
+    console.log(e.detail.value)
+    console.log('state', this.data.stateArray[e.detail.value].value)
+    this.setData({
+      stateIndex: e.detail.value,
+      state: this.data.stateArray[e.detail.value].value
+    })
+    this.restoreData()
+    this.getOrderList()
+  },
+
+  /**
+   * 还原订单列表请求公用数据
+   */
+  restoreData() {
+    this.setData({
+      startIndex: 0,
+      isAll: 0,
+      orders: []
+    })
+  },
+  /**
+   * 搜索
+   */
+  bindconfirm(e) {
+    console.log(e)
+    this.setData({
+      keyword: e.detail.value
+    })
+    this.restoreData()
+    this.getOrderList()
+  }
 })

+ 4 - 1
src/pages/myOrder/myOrder.json

@@ -1,3 +1,6 @@
 {
-  "navigationBarTitleText": "我的订单"
+  "navigationBarTitleText": "我的订单",
+  "usingComponents": {
+    "login": "../../common/login/login"
+  }
 }

+ 18 - 72
src/pages/myOrder/myOrder.wxml

@@ -2,103 +2,49 @@
 <view class='pad20 bgfff mb20 pb20'>
   <view class='searchBox flex flex-aic pl20'>
     <view class='f30 c4a flex flex-aic pr20 bdr'>
-      <text wx:if='{{index==0}}'>全部订单</text>
-      <text wx:elif='{{index==1}}'>待支付订单</text>
-      <text wx:elif='{{index==2}}'>待出行订单</text>
-      <text wx:elif='{{index==3}}'>待售后订单</text>
-      <text wx:elif='{{index==4}}'>已成功订单</text>
+      <picker bindchange="bindPickerChange" value="{{stateIndex}}" range="{{stateArray}}" range-key='name'>
+        <view class="picker">{{stateArray[stateIndex].name}} </view>
+      </picker>
       <image src='/img/san_down.png' style='width:24rpx;height:24rpx;'></image>
     </view>
     <view class='flex-1 flex flex-aic pl20'>
       <icon type='search' size='14'></icon>
-      <input class='f30 c666 ml10' placeholder='搜索'></input>
+      <input class='f30 c666 ml10' placeholder='搜索' confirm-type='搜索' bindconfirm='bindconfirm'></input>
     </view>
   </view>
 
 
 </view>
-<navigator url='/pages/orderDetail/orderDetail' hover-class='none' class='pad20 bgfff mb20'>
+<navigator wx:for="{{orders}}" wx:key="{{index}}" url='/pages/orderDetail/orderDetail?orderId={{item.orderId}}' hover-class='none' class='pad20 bgfff mb20'>
   <view class='flex flex-bt pt20 pb20 bdb'>
-    <text class='f26 c666'>订单号:152738761</text>
-    <text class='f26 orange'>待付款</text>
+    <text class='f26 c666'>订单号:{{item.orderId}}</text>
+    <text class='f26 orange'>{{stateName[item.state]}}</text>
   </view>
   <view class='pt20 pb20 flex flex-bt bdb'>
     <image src='/img/2.png' style='width:180rpx;height:136rpx;'></image>
     <view class='flex-1 flex flex-column flex-bt ml20'>
-      <view class='f32 c333'>上海迪士尼乐园80元餐券</view>
+      <view class='f32 c333'>{{item.prodDetail}}</view>
       <view class='flex flex-column'>
-        <text class='f26 c666'>游玩日期:2018-03-26 </text>
-        <text class='red f28 mt10'>¥68元</text>
+        <text class='f26 c666'>游玩日期:{{item.travelDate}} </text>
+        <text class='red f28 mt10'>¥{{item.ticketMoney}}元</text>
       </view>
     </view>
   </view>
 
   <view class='pt20 flex flex-bt'>
     <view>
-      <text class='f26 c666'>共2件商品,合计</text>
-      <text class='red f26'>¥136</text>
+      <text class='f26 c666'>共{{item.ticketNum}}件商品,合计</text>
+      <text class='red f26'>¥{{item.memOrderMoney}}</text>
     </view>
     <view class='flex flex-bt'>
-      <view class='cancel f24 c999 flex flex-center'>取消订单</view>
-      <view class='pay f24 green flex flex-center ml20'>去支付</view>
+      <view class='cancel f24 c999 flex flex-center' wx:if='{{item.state == 1}}'>取消订单</view>
+      <view class='pay f24 green flex flex-center ml20' wx:if='{{item.state == 1}}'>去支付</view>
     </view>
   </view>
 </navigator>
 
-<navigator url='/pages/orderDetail/orderDetail' hover-class='none' class='pad20 bgfff mb20'>
-  <view class='flex flex-bt pt20 pb20 bdb'>
-    <text class='f26 c666'>订单号:152738761</text>
-    <text class='f26 orange'>退款中</text>
-  </view>
-  <view class='pt20 pb20 flex flex-bt bdb'>
-    <image src='/img/2.png' style='width:180rpx;height:136rpx;'></image>
-    <view class='flex-1 flex flex-column flex-bt ml20'>
-      <view class='f32 c333'>上海迪士尼乐园80元餐券</view>
-      <view class='flex flex-column'>
-        <text class='f26 c666'>游玩日期:2018-03-26 </text>
-        <text class='red f28 mt10'>¥68元</text>
-      </view>
-    </view>
-  </view>
-
-  <view class='pt20 flex flex-bt'>
-    <view>
-      <text class='f26 c666'>共2件商品,合计</text>
-      <text class='red f26'>¥136</text>
-    </view>
-    <!-- <view class='flex flex-bt'>
-      <view class='cancel f24 c999 flex flex-center'>取消订单</view>
-      <view class='pay f24 green flex flex-center ml20'>去支付</view>
-    </view> -->
-  </view>
-</navigator>
-
-<navigator url='/pages/orderDetail/orderDetail' hover-class='none' class='pad20 bgfff mb20'>
-  <view class='flex flex-bt pt20 pb20 bdb'>
-    <text class='f26 c666'>订单号:152738761</text>
-    <text class='f26 c999'>已成功</text>
-  </view>
-  <view class='pt20 pb20 flex flex-bt bdb'>
-    <image src='/img/2.png' style='width:180rpx;height:136rpx;'></image>
-    <view class='flex-1 flex flex-column flex-bt ml20'>
-      <view class='f32 c333'>上海迪士尼乐园80元餐券</view>
-      <view class='flex flex-column'>
-        <text class='f26 c666'>游玩日期:2018-03-26 </text>
-        <text class='red f28 mt10'>¥68元</text>
-      </view>
-    </view>
-  </view>
-
-  <view class='pt20 flex flex-bt'>
-    <view>
-      <text class='f26 c666'>共2件商品,合计</text>
-      <text class='red f26'>¥136</text>
-    </view>
-    <!-- <view class='flex flex-bt'>
-      <view class='cancel f24 c999 flex flex-center'>取消订单</view>
-      <view class='pay f24 green flex flex-center ml20'>去支付</view>
-    </view> -->
-  </view>
-</navigator>
+<view class='f24 c666 flex flex-center' style='height:180rpx;' wx:if='{{isAll == 0}}'>加载中</view>
+<view class='f24 c666 flex flex-center' style='height:180rpx;' wx:if='{{isAll == 1}}'>已显示所有订单</view>
+<view class='f24 c666 flex flex-center' style='height:180rpx;' wx:if='{{isAll == 2}}'>无订单数据</view>
 
-<view class='f24 c666 flex flex-center' style='height:180rpx;'>已加载显示全部内容</view>
+<login bind:loginCallBack="loginCallBack"></login>

+ 89 - 65
src/pages/needKnow/needKnow.js

@@ -1,66 +1,90 @@
-// pages/needKnow/needKnow.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-  
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-  
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-  
-  }
+// pages/needKnow/needKnow.js
+import { shuoAPIClient } from '../../common/api/api.js';
+import WxParse from '../../wxParse/wxParse.js';
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    infoId: null,
+    orderDesc: '',
+    prodDetail: null
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    this.setData({
+      infoId: options.infoId
+    })
+    console.log('infoId', this.data.infoId)
+    this.getProdDetail()
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    
+  },
+
+  /**
+   * 产品详情
+   */
+  getProdDetail() {
+    let self = this
+    shuoAPIClient.request('/api/minapp/ticket/product/' + self.data.infoId,
+      {}, false).then(res => {
+        console.log('产品详情', res)
+        if (res && res.data) {
+          self.setData({
+            prodDetail: res.data
+          })
+          WxParse.wxParse('orderDesc', 'html', res.data.orderDesc, self, 5);
+        }
+      })
+  },
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
 })

+ 95 - 95
src/pages/needKnow/needKnow.wxml

@@ -1,96 +1,96 @@
-<!--pages/needKnow/needKnow.wxml-->
-<view class='pad20 bgfff flex flex-bt mb20'>
-  <image src='/img/2.png' style='width:182rpx;height:136rpx;'></image>
-  <view class='flex-1 ml20'>
-    <view class='f32 c333'>上海迪士尼乐园度假区</view>
-    <view class='mt20'>
-      <text class='f28 red'>¥275元 </text>
-      <text class='f28 c999 oriPrice'>390元</text>
-    </view>
-  </view>
-</view>
-
-<view class='bgfff pad20'>
-  <view class='pt20'>
-    <view class='zs flex flex-center'>
-      <image class='zsImg' src='/img/zs.png' style='height:25rpx'></image>
-      <text class='f32 orange bold'>预订须知</text> </view>
-  </view>
-  <view class='pad20 bgfff mt20'>
-    <view class='flex flex-aic pb20'>
-      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-      <text class='f32 c333 ml20'>预订说明:</text>
-    </view>
-    <view class='flex flex-aic pl20 ml20'>
-      <text class='f28 c666'>预订时间:</text>
-      <view class='green f20 box'>今日可用</view>
-    </view>
-    <view class='flex flex-aic mt10 pl20 ml20'>
-      <text class='f28 c666'>有效日期:</text>
-      <view class='c333 f28'>2018-07-24至2018-02—4周一至周日</view>
-    </view>
-  </view>
-  <view class='pad20 bgfff'>
-    <view class='flex flex-aic pb20'>
-      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-      <text class='f32 c333 ml20'>预订说明:</text>
-    </view>
-    <view class='flex flex-ais mt10 pl20 ml20'>
-      <text class='f28 c666'>费用包含:</text>
-      <view class='c333 f28 flex-1' style='line-height:46rpx'>凭票可全天通行乐园所有有了设施和娱乐 演出。</view>
-    </view>
-  </view>
-  <view class='pl20 pb20 pr20 bgfff'>
-    <view class='flex flex-aic pb20'>
-      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-      <text class='f32 c333 ml20'>预订说明:</text>
-    </view>
-    <view class='flex flex-aic pl20 ml20'>
-      <text class='f28 c666'>使用方法:</text>
-      <view class='green f20 box'>无需换票</view>
-    </view>
-    <view class='flex flex-ais mt20 pl20 ml20'>
-      <text class='f28 c666'>使用地址:</text>
-      <view class='c333 f28 flex-1'>上海迪士尼度假区,持购票所用人身份证 和短信验证码直接至乐园闸机,所有人需 同时入园。</view>
-    </view>
-  </view>
-
-  <view class='pad20 bgfff'>
-    <view class='flex flex-aic pb20'>
-      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-      <text class='f32 c333 ml20'>退改说明:</text>
-    </view>
-    <view class='flex flex-ais mt10 pl20 ml20'>
-      <text class='f28 c666'>退改说明:</text>
-      <view class='c333 f28 flex-1' style='line-height:46rpx'>随时可退款,24小时内处理。过期未消费 自动退款。</view>
-    </view>
-  </view>
-
-  <view class='pad20 bgfff'>
-    <view class='flex flex-aic pb20'>
-      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-      <text class='f32 c333 ml20'>其他说明:</text>
-    </view>
-    <view class='flex flex-ais mt10 pl20 ml20'>
-      <text class='f28 c666' style='letter-spacing:14rpx'>其  他:</text>
-      <view class='c333 f28 flex-1' style='line-height:46rpx'>所有不满1.4米的儿童需至少一名有监护能 力的成人陪同,一人一票制, 陪同者也需 购票、孕妇禁止下水游玩。</view>
-    </view>
-  </view>
-</view>
-
-<view class='footer b-box bgfff flex flex-bt flex-aic pl20 pr20'>
-  <view>
-    <text class='f28 c666'>合计:</text>
-    <text class='f32 red bold'>¥68元</text>
-  </view>
-  <view class='flex flex-aic'>
-    <button open-type='contact' hover-class='none' class='f28 por ml20 flex flex-center' style='width:200rpx;height:70rpx;'>
-      <text class='orange' style='z-index:1;'>在线咨询</text>
-      <image src='/img/btn1_img.png' style='width:100%;height:100%;top:0;left:0' class='poa'></image>
-    </button>
-    <navigator url='/pages/creatOrder/creatOrder' hover-class='none' class='f28 por ml20 flex flex-center' style='width:200rpx;height:70rpx;'>
-      <text class='cfff' style='z-index:1;'>立即预订</text>
-      <image src='/img/btn_img.png' style='width:100%;height:100%;top:0;left:0' class='poa'></image>
-    </navigator>
-  </view>
+<!--pages/needKnow/needKnow.wxml-->
+<view class='pad20 bgfff flex flex-bt mb20'>
+  <image src='{{prodDetail.signImg}}' style='width:182rpx;height:136rpx;'></image>
+  <view class='flex-1 ml20'>
+    <view class='f32 c333'>{{prodDetail.infoTitle}}</view>
+    <view class='mt20'>
+      <text class='f28 red'>¥{{prodDetail.salePrice / 100}}元 </text>
+      <text class='f28 c999 oriPrice'>{{prodDetail.marketPrice / 100}}元</text>
+    </view>
+  </view>
+</view>
+
+<view class='bgfff pad20'>
+  <view class='pt20'>
+    <view class='zs flex flex-center'>
+      <image class='zsImg' src='/img/zs.png' style='height:25rpx'></image>
+      <text class='f32 orange bold'>预订须知</text> </view>
+  </view>
+  <view class='pad20 bgfff mt20'>
+    <view class='flex flex-aic pb20'>
+      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+      <text class='f32 c333 ml20'>预订说明:</text>
+    </view>
+    <view class='flex flex-aic pl20 ml20'>
+      <text class='f28 c666'>预订时间:</text>
+      <view class='green f20 box'>{{prodDetail.startDay == 0 ? '今日可用' : '提前' + prodDetail.startDay + '天购票'}}</view>
+    </view>
+    <view class='flex flex-aic mt10 pl20 ml20'>
+      <text class='f28 c666'>有效日期:</text>
+      <view class='c333 f28'>{{prodDetail.validityType == 0 ? '当天有效' : prodDetail.validity}}</view>
+    </view>
+  </view>
+  <view class='pad20 bgfff' wx:if="{{prodDetail.chargeInclude}}">
+    <view class='flex flex-aic pb20'>
+      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+      <text class='f32 c333 ml20'>费用说明:</text>
+    </view>
+    <view class='flex flex-ais mt10 pl20 ml20'>
+      <text class='f28 c666'>费用包含:</text>
+      <view class='c333 f28 flex-1' style='line-height:46rpx'>{{prodDetail.chargeInclude}}</view>
+    </view>
+  </view>
+  <view class='pl20 pb20 pr20 bgfff' wx:if="{{prodDetail.userNote}}">
+    <view class='flex flex-aic pb20'>
+      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+      <text class='f32 c333 ml20'>使用说明:</text>
+    </view>
+    <view class='flex flex-aic pl20 ml20'>
+      <text class='f28 c666'>使用方法:</text>
+      <view class='green f20 box'>{{prodDetail.userNote}}</view>
+    </view>
+    <!-- <view class='flex flex-ais mt20 pl20 ml20'>
+      <text class='f28 c666'>使用地址:</text>
+      <view class='c333 f28 flex-1'>上海迪士尼度假区,持购票所用人身份证 和短信验证码直接至乐园闸机,所有人需 同时入园。</view>
+    </view> -->
+  </view>
+
+  <view class='pad20 bgfff' wx:if="{{prodDetail.refundNote}}">
+    <view class='flex flex-aic pb20'>
+      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+      <text class='f32 c333 ml20'>退改说明:</text>
+    </view>
+    <view class='flex flex-ais mt10 pl20 ml20'>
+      <text class='f28 c666'>退改说明:</text>
+      <view class='c333 f28 flex-1' style='line-height:46rpx'>{{prodDetail.refundNote}}</view>
+    </view>
+  </view>
+
+  <view class='pad20 bgfff' wx:if="{{prodDetail.importantNote}}">
+    <view class='flex flex-aic pb20'>
+      <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+      <text class='f32 c333 ml20'>其他说明:</text>
+    </view>
+    <view class='flex flex-ais mt10 pl20 ml20'>
+      <text class='f28 c666' style='letter-spacing:14rpx'>其  他:</text>
+      <view class='c333 f28 flex-1' style='line-height:46rpx'>{{prodDetail.importantNote}}</view>
+    </view>
+  </view>
+</view>
+
+<view class='footer b-box bgfff flex flex-bt flex-aic pl20 pr20'>
+  <view>
+    <text class='f28 c666'>合计:</text>
+    <text class='f32 red bold'>¥{{prodDetail.salePrice / 100}}元</text>
+  </view>
+  <view class='flex flex-aic'>
+    <button open-type='contact' hover-class='none' class='f28 por ml20 flex flex-center' style='width:200rpx;height:70rpx;'>
+      <text class='orange' style='z-index:1;'>在线咨询</text>
+      <image src='/img/btn1_img.png' style='width:100%;height:100%;top:0;left:0' class='poa'></image>
+    </button>
+    <navigator url='/pages/creatOrder/creatOrder?infoId={{prodDetail.infoId}}' hover-class='none' class='f28 por ml20 flex flex-center' style='width:200rpx;height:70rpx;'>
+      <text class='cfff' style='z-index:1;'>立即预订</text>
+      <image src='/img/btn_img.png' style='width:100%;height:100%;top:0;left:0' class='poa'></image>
+    </navigator>
+  </view>
 </view>

+ 167 - 80
src/pages/orderDetail/orderDetail.js

@@ -1,81 +1,168 @@
-// pages/orderDetail/orderDetail.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-  
-  },
-
-
-  // 打电话
-  callPhone:function(){
-    console.log('打电话')
-    wx.makePhoneCall({
-      phoneNumber:'021-39888682',
-      success:function(){
-        console.log('打电话成功')
-        
-      },
-      fail:function(){
-        console.log('打电话失败')
-      }
-    })
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-  
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-  
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-  
-  }
+// pages/orderDetail/orderDetail.js
+import { shuoAPIClient } from '../../common/api/api.js';
+import { formatDate } from '../../lib/util/util.js';
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    orderId: null,
+    orderDetail: null,
+    prodDetail: null,
+    stateName: [
+      '待确认',
+      '待付款',
+      '已付款',
+      '已取消',
+      '已完成'
+    ],
+  },
+
+
+  // 打电话
+  callPhone:function(){
+    console.log('打电话')
+    wx.makePhoneCall({
+      phoneNumber:'021-39888682',
+      success:function(){
+        console.log('打电话成功')
+        
+      },
+      fail:function(){
+        console.log('打电话失败')
+      }
+    })
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+    let orderId = options.orderId
+    this.setData({
+      orderId
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+    this.orderDetail()
+  },
+
+  orderDetail() {
+    if (!this.data.orderId) {
+      wx.showModal({
+        title: '提示',
+        content: '参数错误',
+        showCancel: false
+      });
+      return false
+    }
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/tickets/order/' + this.data.orderId,
+      {}, true).then(res => {
+        wx.hideLoading()
+        console.log('订单详情', res)
+        if (res.data && res.data) {
+          res.data.travelDate = formatDate(res.data.travelDate, 'yyyy-MM-dd')
+          res.data.orderDate = formatDate(res.data.orderDate, 'yyyy-MM-dd')
+          this.setData({
+            orderDetail: res.data
+          })
+          this.getProdDetail(res.data.infoId)
+        }
+      })
+  },
+
+  getProdDetail(infoId) {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/ticket/product/' + infoId,
+      {}, false).then(res => {
+        wx.hideLoading()
+        console.log('产品详情', res)
+        if (res.data && res.data) {
+          this.setData({
+            prodDetail: res.data
+          })
+        }
+      })
+  },
+
+  /**
+   * 支付
+   */
+  pay() {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/order/payInfo/' + this.data.orderDetail.orderId,
+      {}, true).then(res => {
+        wx.hideLoading()
+        console.log('支付', res)
+        if (res.data && res.data) {
+          if (res.data.state == 1) {
+            wx.requestPayment({
+              'timeStamp': res.data.timestamp,
+              'nonceStr': res.data.noncestr,
+              'package': res.data.packages,
+              'signType': res.data.signtype,
+              'paySign': res.data.paysign,
+              'complete': function (res) {
+                console.log(res, '支付信息')
+              }
+            });
+          } else {
+            wx.showModal({
+              title: '支付提示',
+              content: res.data.msg,
+              showCancel: false
+            });
+          }
+        }
+      })
+  },
+
+  /**
+   * 取消订单
+   */
+  cancelOrder() {
+    wx.showLoading({
+      title: '加载中...',
+      mask: true
+    });
+    shuoAPIClient.request('/api/minapp/order/' + this.data.orderDetail.orderId,
+      {}, true, 'DELETE').then(res => {
+        wx.hideLoading()
+        console.log('取消订单', res)
+        if (res.data && res.data) {
+          if (res.data.state == 1) {
+            wx.redirectTo({
+              url: `/pages/repay/repay`
+            });
+          } else {
+            wx.showModal({
+              title: '退款提示',
+              content: res.data.msg,
+              showCancel: false
+            });
+          }
+        }
+      })
+  }
 })

+ 117 - 142
src/pages/orderDetail/orderDetail.wxml

@@ -1,142 +1,117 @@
-<!--pages/orderDetail/orderDetail.wxml-->
-<view class='pad20 bgfff mt20'>
-  <view class='pb20 flex flex-bt flex-aic bgfff mt20 bdb'>
-    <view class='f26 c666'>上海迪士尼乐园80元餐券</view>
-    <view>
-      <text class='f28 red mr10'>¥68元</text>
-      <text class='f28 c4a'>x1</text> </view>
-  </view>
-  <view class='pt20 pb20 flex flex-bt bdb'>
-    <image src='/img/2.png' style='width:182rpx;height:136rpx;'></image>
-    <view class='flex flex-column flex-bt flex-1 ml20'>
-      <view class='f32 c333'>上海迪士尼乐园80元餐券</view>
-      <view class='flex flex-column'>
-        <view class='f26 c4a'>游玩日期:2018-03-26 </view>
-        <view class='f26 c4a'>入园方式:XXX短信换票入园</view>
-      </view>
-
-    </view>
-  </view>
-
-  <view class='flex flex-end flex-aic pt20 pb20 bdb'>
-    <view>
-      <text class='f28 c666'>共1件商品,合计:</text>
-      <text class='f32 red'>¥68元</text> </view>
-  </view>
-
-  <view class='pt20'>
-    <view class='flex flex-center' style='height:52rpx;background:#F6FAFC'>
-      <text class='f24 green'>改退规则:</text>
-      <text class='f24 c999'>随时可退款,24小时内处理。过期未消费自动退款。</text>
-    </view>
-
-  </view>
-</view>
-
-<view class='pad20 bgfff mt20'>
-  <view class='flex flex-aic bdb pb20'>
-    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-    <text class='f32 c333 ml20'>订单信息</text>
-  </view>
-  <view class='pt20'>
-    <view class='f28 c333'>订单号:20812516</view>
-    <view class='f28 c333 mt10'>下单时间:2018-03-13 22:20</view>
-    <view class='flex flex-bt flex-aic'>
-      <text class='f28 c333'>支付方式:在线支付</text>
-      <navigator url='/pages/repay/repay' hover-class='none' class='apply flex flex-center'>
-        <text class='f28 cfff' style='z-index:1'>申请退款</text>
-        <image class='btnImg' src='/img/btn_bg.png'></image>
-      </navigator>
-    </view>
-  </view>
-</view>
-
-<view class='pad20 bgfff mt20'>
-  <view class='flex flex-aic bdb pb20'>
-    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-    <text class='f32 c333 ml20'>取票人信息</text>
-  </view>
-  <view class='pt20'>
-    <view class='f28 c333'>取票人:李潇潇</view>
-    <view class='f28 c333 mt10'>手机号:180****4278</view>
-    <view class='flex flex-bt flex-aic mt10'>
-      <text class='f28 c333'>身份证:5108241995****6790</text>
-    </view>
-  </view>
-</view>
-
-<view class='pad20 bgfff mt20'>
-  <view class='flex flex-aic bdb pb20'>
-    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-    <text class='f32 c333 ml20'>位置信息</text>
-  </view>
-  <view class='pt20'>
-    <view class='flex flex-bt flex-aic'>
-      <text class='f28 c333'>上海市浦东新区上海迪士尼乐园度假区…</text>
-      <view class='apply flex flex-center'>
-        <text class='f28 cfff' style='z-index:1'>到这里去</text>
-        <image class='btnImg' src='/img/btn_bg.png'></image>
-      </view>
-    </view>
-  </view>
-</view>
-
-<view class='pad20 bgfff mt20'>
-  <view class='flex flex-aic bdb pb20'>
-    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-    <text class='f32 c333 ml20'>联系客服</text>
-  </view>
-  <!-- <view class='pt20 pb20 bdb' catchtap='callPhone'>
-    <view class='flex flex-bt flex-aic pt20 pb20'>
-      <view class='flex flex-aic'>
-        <image src='/img/phone.png' style='width:32rpx;height:32rpx;'></image>
-        <text class='f28 c333 ml20'>021-39888682</text>
-      </view>
-      <image src='/img/right-arrow.png' style='width:14rpx;height:24rpx;'></image>
-    </view>
-  </view>
-  <button open-type='contact' hover-class='none' class='pt20 pb20 bdb w100'>
-    <view class='flex flex-bt flex-aic pt20 pb20'>
-      <view class='flex flex-aic'>
-        <image src='/img/contact.png' style='width:32rpx;height:32rpx;'></image>
-        <text class='f28 c333 ml20'>在线客服</text>
-      </view>
-      <image src='/img/right-arrow.png' style='width:14rpx;height:24rpx;'></image>
-    </view>
-  </button>
-  <view class='pt20 pb20'>
-    <view class='flex flex-bt flex-aic pt20 pb20'>
-      <view class='flex flex-aic'>
-        <image src='/img/time.png' style='width:32rpx;height:32rpx;'></image>
-        <view class='flex flex-column'>
-          <text class='f28 c333 ml20'>服务时间:周一至周日 7:30-24:00</text>
-          <text class='f24 c999 ml20 mt10'>(时区所在地:北京)</text>
-        </view>
-      </view>
-      <image src='/img/right-arrow.png' style='width:14rpx;height:24rpx;'></image>
-    </view>
-  </view> -->
-  <view bindtap='callPhone' style='color:#222;' class='f28 flex flex-aic'>
-    <image src="/img/icon_dh@2x.png" style='width:32rpx;height:32rpx'></image>
-    <view class='flex flex-bt flex-aic flex-1 ml20 b-box' style='padding:30rpx 30rpx 30rpx 0;margin-left:40rpx'>
-      <view>021-39888682</view>
-      <image src="/img/more@2x.png" style='width:14rpx;height:24rpx'></image>
-    </view>
-  </view>
-  <button open-type='contact' hover-class='none' style='color:#222;' class='f28 flex flex-aic'>
-    <image src="/img/icon_zxkf@2x.png" style='width:32rpx;height:32rpx'></image>
-    <view class='flex flex-bt flex-aic flex-1 ml20 bdt b-box' style='padding:30rpx 30rpx 30rpx 0;margin-left:40rpx'>
-      <view>在线客服</view>
-      <image src="/img/more@2x.png" style='width:14rpx;height:24rpx'></image>
-    </view>
-  </button>
-  <view style='color:#222;' class='f28 flex flex-aic '>
-    <image src="/img/icon_fwsj@2x.png" style='width:32rpx;height:32rpx'></image>
-    <view class='flex flex-bt flex-aic flex-1 ml20 bdt b-box' style='padding:30rpx 30rpx 30rpx 0;margin-left:40rpx'>
-      <view class='flex flex-column'>
-        <view>服务时间:周一至周日 7:00-24:00</view>
-        <view class='f24 c999'>(时区所在地:北京)</view>
-      </view>
-    </view>
-  </view>
-</view>
+<!--pages/orderDetail/orderDetail.wxml-->
+<view class='pad20 bgfff mt20'>
+  <view class='pb20 flex flex-bt flex-aic bgfff mt20 bdb'>
+    <view class='f26 c666'>{{prodDetail.infoTitle}}</view>
+    <view>
+      <text class='f28 red mr10'>¥{{orderDetail.memOrderMoney / orderDetail.ticketNum}}元</text>
+      <text class='f28 c4a'>x{{orderDetail.ticketNum}}</text> </view>
+  </view>
+  <view class='pt20 pb20 flex flex-bt bdb'>
+    <image src='{{prodDetail.signImg}}' style='width:182rpx;height:136rpx;'></image>
+    <view class='flex flex-column flex-bt flex-1 ml20'>
+      <view class='f32 c333'>{{prodDetail.infoTitle}}</view>
+      <view class='flex flex-column'>
+        <view class='f26 c4a'>游玩日期:{{orderDetail.travelDate}} </view>
+        <view class='f26 c4a'>入园方式:{{prodDetail.userNote}}</view>
+      </view>
+
+    </view>
+  </view>
+
+  <view class='flex flex-end flex-aic pt20 pb20 bdb'>
+    <view>
+      <text class='f28 c666'>共{{orderDetail.ticketNum}}件商品,合计:</text>
+      <text class='f32 red'>¥{{orderDetail.memOrderMoney}}元</text> </view>
+  </view>
+
+  <view class='pt20'>
+    <view class='flex flex-center' style='height:52rpx;background:#F6FAFC'>
+      <text class='f24 green'>改退规则:</text>
+      <text class='f24 c999'>{{prodDetail.refundNote}}</text>
+    </view>
+
+  </view>
+</view>
+
+<view class='pad20 bgfff mt20'>
+  <view class='flex flex-aic bdb pb20'>
+    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+    <text class='f32 c333 ml20'>订单信息</text>
+  </view>
+  <view class='pt20'>
+    <view class='f28 c333'>订单号:{{orderDetail.orderId}}</view>
+    <view class='f28 c333 mt10'>下单时间:{{orderDetail.orderDate}}</view>
+    <view class='flex flex-bt flex-aic'>
+      <text class='f28 c333' wx:if='{{orderDetail.state == 2}}'>支付方式:在线支付</text>
+      <text class='f28 c333' wx:else>订单状态:{{stateName[orderDetail.state]}}</text>
+      <view bindtap='pay' hover-class='none' class='apply flex flex-center' wx:if='{{orderDetail.state == 1}}'>
+        <text class='f28 cfff' style='z-index:1'>支付</text>
+        <image class='btnImg' src='/img/btn_bg.png'></image>
+      </view>
+      <view bindtap='cancelOrder' hover-class='none' class='apply flex flex-center' style='margin-left:10rpx' wx:if='{{orderDetail.state == 1}}'>
+        <text class='f28 cfff' style='z-index:1'>取消订单</text>
+        <image class='btnImg' src='/img/btn_bg.png'></image>
+      </view>
+    </view>
+  </view>
+</view>
+
+<view class='pad20 bgfff mt20'>
+  <view class='flex flex-aic bdb pb20'>
+    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+    <text class='f32 c333 ml20'>取票人信息</text>
+  </view>
+  <view class='pt20'>
+    <view class='f28 c333'>取票人:{{orderDetail.linkMan}}</view>
+    <view class='f28 c333 mt10'>手机号:{{orderDetail.linkPhone}}</view>
+    <view class='flex flex-bt flex-aic mt10'>
+      <text class='f28 c333'>身份证:{{orderDetail.linkCreditNo}}</text>
+    </view>
+  </view>
+</view>
+
+<!-- <view class='pad20 bgfff mt20'>
+  <view class='flex flex-aic bdb pb20'>
+    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+    <text class='f32 c333 ml20'>位置信息</text>
+  </view>
+  <view class='pt20'>
+    <view class='flex flex-bt flex-aic'>
+      <text class='f28 c333'>上海市浦东新区上海迪士尼乐园度假区…</text>
+      <view class='apply flex flex-center'>
+        <text class='f28 cfff' style='z-index:1'>到这里去</text>
+        <image class='btnImg' src='/img/btn_bg.png'></image>
+      </view>
+    </view>
+  </view>
+</view> -->
+
+<!-- <view class='pad20 bgfff mt20'>
+  <view class='flex flex-aic bdb pb20'>
+    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+    <text class='f32 c333 ml20'>联系客服</text>
+  </view>
+  <view bindtap='callPhone' style='color:#222;' class='f28 flex flex-aic'>
+    <image src="/img/icon_dh@2x.png" style='width:32rpx;height:32rpx'></image>
+    <view class='flex flex-bt flex-aic flex-1 ml20 b-box' style='padding:30rpx 30rpx 30rpx 0;margin-left:40rpx'>
+      <view>021-39888682</view>
+      <image src="/img/more@2x.png" style='width:14rpx;height:24rpx'></image>
+    </view>
+  </view>
+  <button open-type='contact' hover-class='none' style='color:#222;' class='f28 flex flex-aic'>
+    <image src="/img/icon_zxkf@2x.png" style='width:32rpx;height:32rpx'></image>
+    <view class='flex flex-bt flex-aic flex-1 ml20 bdt b-box' style='padding:30rpx 30rpx 30rpx 0;margin-left:40rpx'>
+      <view>在线客服</view>
+      <image src="/img/more@2x.png" style='width:14rpx;height:24rpx'></image>
+    </view>
+  </button>
+  <view style='color:#222;' class='f28 flex flex-aic '>
+    <image src="/img/icon_fwsj@2x.png" style='width:32rpx;height:32rpx'></image>
+    <view class='flex flex-bt flex-aic flex-1 ml20 bdt b-box' style='padding:30rpx 30rpx 30rpx 0;margin-left:40rpx'>
+      <view class='flex flex-column'>
+        <view>服务时间:周一至周日 7:00-24:00</view>
+        <view class='f24 c999'>(时区所在地:北京)</view>
+      </view>
+    </view>
+  </view>
+</view> -->

+ 1 - 0
src/pages/orderDetail/orderDetail.wxss

@@ -6,6 +6,7 @@ page{
   width: 160rpx;
   height: 50rpx;
   position: relative;
+  margin-left:160rpx;
 }
 .btnImg{
   width: 100%;

+ 79 - 79
src/pages/repay/repay.js

@@ -1,80 +1,80 @@
-// pages/repay/repay.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-  
-  },
-
-  // 打电话
-  callPhone: function () {
-    console.log('打电话')
-    wx.makePhoneCall({
-      phoneNumber: '400-861-6681',
-      success: function () {
-        console.log('打电话成功')
-
-      },
-      fail: function () {
-        console.log('打电话失败')
-      }
-    })
-  },
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-  
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-  
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-  
-  }
+// pages/repay/repay.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+  
+  },
+
+  // 打电话
+  callPhone: function () {
+    console.log('打电话')
+    wx.makePhoneCall({
+      phoneNumber: '400-861-6681',
+      success: function () {
+        console.log('打电话成功')
+
+      },
+      fail: function () {
+        console.log('打电话失败')
+      }
+    })
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
 })

+ 55 - 55
src/pages/repay/repay.wxml

@@ -1,56 +1,56 @@
-<!--pages/repay/repay.wxml-->
-<view class='flex flex-column flex-center bgfff mb20' style='padding:60rpx;'>
-  <image src='/img/repay.png' style='width:198rpx;height:166rpx;' class='mt20'></image>
-  <image src='/img/repay_text.png' style='width:480rpx;' mode='widthFix' class='mt20'></image>
-  <view class='f28 c999 mt20'>预计7个工作日内完成,节假日顺延</view>
-</view>
-<view class='pad20 bgfff mt20 mb20'>
-  <view class='flex flex-aic bdb pb20'>
-    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
-    <text class='f32 c333 ml20'>取票人信息</text>
-  </view>
-  <view class='pt20'>
-    <view class='f28 c333'>订单号:20812516</view>
-    <view class='f28 c333 mt10'>订单名称:上海迪士尼乐园80元餐券</view>
-    <view class='f28 c333 mt10'>实付金额:¥68元</view>
-    <view class='f28 c333 mt10'>实退金额:¥65元</view>
-    <view class='flex flex-start flex-aic pl20 mt20' style='height:52rpx;background:#F6FAFC'>
-      <text class='f24 green'>改退规则:</text>
-      <text class='f24 c999'>游玩日当天申请退款,每张扣除3元的手续费</text>
-    </view>
-  </view>
-</view>
-
-
-<view class='pad20 bgfff mt20'>
-  <view class='pt20 pb20 bdb' bindtap='callPhone'>
-    <view class='flex flex-bt flex-aic pt20 pb20'>
-      <view class='flex flex-aic'>
-        <image src='/img/phone.png' style='width:32rpx;height:32rpx;'></image>
-        <text class='f28 c333 ml20'>400-861-6681</text>
-      </view>
-      <image src='/img/right-arrow.png' style='width:14rpx;height:24rpx;'></image>
-    </view>
-  </view>
-  <button open-type='contact' hover-class='none' class='pt20 pb20 bdb w100'>
-    <view class='flex flex-bt flex-aic pt20 pb20'>
-      <view class='flex flex-aic'>
-        <image src='/img/contact.png' style='width:32rpx;height:32rpx;'></image>
-        <text class='f28 c333 ml20'>在线客服</text>
-      </view>
-      <image src='/img/right-arrow.png' style='width:14rpx;height:24rpx;'></image>
-    </view>
-  </button>
-  <view class='pt20 pb20'>
-    <view class='flex flex-bt flex-aic pt20 pb20'>
-      <view class='flex flex-aic'>
-        <image src='/img/time.png' style='width:32rpx;height:32rpx;'></image>
-        <view class='flex flex-column'>
-          <text class='f28 c333 ml20'>服务时间:周一至周日 7:30-24:00</text>
-          <text class='f24 c999 ml20 mt10'>(时区所在地:北京)</text>
-        </view>
-      </view>
-      <image src='/img/right-arrow.png' style='width:14rpx;height:24rpx;'></image>
-    </view>
-  </view>
+<!--pages/repay/repay.wxml-->
+<view class='flex flex-column flex-center bgfff mb20' style='padding:60rpx;'>
+  <image src='/img/repay.png' style='width:198rpx;height:166rpx;' class='mt20'></image>
+  <image src='/img/repay_text.png' style='width:480rpx;' mode='widthFix' class='mt20'></image>
+  <view class='f28 c999 mt20'>取消订单成功</view>
+</view>
+<!-- <view class='pad20 bgfff mt20 mb20'>
+  <view class='flex flex-aic bdb pb20'>
+    <image src='/img/aside.png' style='width:6rpx;height:28rpx'></image>
+    <text class='f32 c333 ml20'>取票人信息</text>
+  </view>
+  <view class='pt20'>
+    <view class='f28 c333'>订单号:20812516</view>
+    <view class='f28 c333 mt10'>订单名称:上海迪士尼乐园80元餐券</view>
+    <view class='f28 c333 mt10'>实付金额:¥68元</view>
+    <view class='f28 c333 mt10'>实退金额:¥65元</view>
+    <view class='flex flex-start flex-aic pl20 mt20' style='height:52rpx;background:#F6FAFC'>
+      <text class='f24 green'>改退规则:</text>
+      <text class='f24 c999'>游玩日当天申请退款,每张扣除3元的手续费</text>
+    </view>
+  </view>
+</view> -->
+
+
+<view class='pad20 bgfff mt20'>
+  <view class='pt20 pb20 bdb' bindtap='callPhone'>
+    <view class='flex flex-bt flex-aic pt20 pb20'>
+      <view class='flex flex-aic'>
+        <image src='/img/phone.png' style='width:32rpx;height:32rpx;'></image>
+        <text class='f28 c333 ml20'>400-861-6681</text>
+      </view>
+      <image src='/img/right-arrow.png' style='width:14rpx;height:24rpx;'></image>
+    </view>
+  </view>
+  <button open-type='contact' hover-class='none' class='pt20 pb20 bdb w100'>
+    <view class='flex flex-bt flex-aic pt20 pb20'>
+      <view class='flex flex-aic'>
+        <image src='/img/contact.png' style='width:32rpx;height:32rpx;'></image>
+        <text class='f28 c333 ml20'>在线客服</text>
+      </view>
+      <image src='/img/right-arrow.png' style='width:14rpx;height:24rpx;'></image>
+    </view>
+  </button>
+  <view class='pt20 pb20'>
+    <view class='flex flex-bt flex-aic pt20 pb20'>
+      <view class='flex flex-aic'>
+        <image src='/img/time.png' style='width:32rpx;height:32rpx;'></image>
+        <view class='flex flex-column'>
+          <text class='f28 c333 ml20'>服务时间:周一至周日 7:30-24:00</text>
+          <text class='f24 c999 ml20 mt10'>(时区所在地:北京)</text>
+        </view>
+      </view>
+      <image src='/img/right-arrow.png' style='width:14rpx;height:24rpx;'></image>
+    </view>
+  </view>
 </view>

+ 34 - 31
src/pages/reverse/index.js

@@ -1,4 +1,6 @@
 // pages/reverse/index.js
+import { shuoAPIClient } from '../../common/api/api.js';
+import WxParse from '../../wxParse/wxParse.js';
 Page({
 
   /**
@@ -6,37 +8,10 @@ Page({
    */
   data: {
     index: 1,
-    hour: 3,
-    minute: 22,
-    second: 10,
-    day: 7
+    infoId: null,
+    prodDetail: null
   },
 
-  setDateOut() {
-    var self = this
-    var InterVal = setInterval(function() {
-      self.setData({
-        second: self.data.second - 1
-      })
-      if (self.data.second == -1) {
-        self.setData({
-          second: 59,
-          minute: self.data.minute - 1,
-        })
-      }
-      if (self.data.minute == -1) {
-        self.setData({
-          minute: 59,
-          hour: self.data.hour - 1,
-        })
-      }
-      if (self.data.hour == 0 && self.data.minute == 0 && self.data.second == 0) {
-        clearInterval(InterVal)
-      }
-    }, 1000)
-  },
-
-
   changeTab(e) {
     this.setData({
       index: e.currentTarget.dataset.index
@@ -47,10 +22,38 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
-    this.setDateOut()
+    this.setData({
+      infoId: options.infoId
+    })
   },
 
   /**
+   * 产品详情
+   */
+  getProdDetail() {
+    let self = this
+    shuoAPIClient.request('/api/minapp/common/product/' + self.data.infoId,
+      {}, false).then(res => {
+        console.log('产品详情', res)
+        if (res && res.data) {
+          self.setData({
+            prodDetail: res.data
+          })
+          WxParse.wxParse('orderDesc', 'html', res.data.orderDesc, self, 5);
+          WxParse.wxParse('content', 'html', res.data.prodDetail, self, 5);
+        }
+      })
+  },
+
+  goOrder: function() {
+    wx.navigateTo({    //保留当前页面,跳转到应用内的某个页面(最多打开5个页面,之后按钮就没有响应的)
+      url: "/pages/creatOrder/creatOrder?infoId=" + this.data.infoId,
+      success() {
+
+      }
+    })
+  },
+  /**
    * 生命周期函数--监听页面初次渲染完成
    */
   onReady: function() {
@@ -61,7 +64,7 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function() {
-
+    this.getProdDetail()
   },
 
   /**

+ 4 - 1
src/pages/reverse/index.json

@@ -1,3 +1,6 @@
 {
-  "navigationBarTitleText": "上海迪士尼乐园"
+  "navigationBarTitleText": "上海迪士尼乐园",
+  "usingComponents": {
+    "countdown": "../../common/countdown/countdown"
+  }
 }

+ 13 - 56
src/pages/reverse/index.wxml

@@ -1,26 +1,25 @@
+<import src="../../wxParse/wxParse.wxml"/> 
 <view class='imgBox'>
-  <image src="/img/11.png" class='w100' style='height:300rpx;'></image>
+  <image src="{{prodDetail.signImg}}" class='w100' style='height:300rpx;'></image>
   <view class='bottom flex flex-aic flex-bt pad10 b-box'>
-    <view class='f24 cfff flex flex-aic'>距离开抢:
-      <text class='numBox mr10'>{{day}}</text>天
-      <text class='numBox ml10'>{{hour}}</text>:
-      <text class='numBox'>{{minute}}</text>:
-      <text class='numBox'>{{second}}</text>
+    <view class='f24 cfff flex flex-aic' wx:if="{{prodDetail.orderStartDate && prodDetail.orderEndDate}}">距离{{prodDetail.nowDate > prodDetail.orderStartDate ? '结束' : '开抢'}}:
+      <countdown wx:if="{{prodDetail.nowDate > prodDetail.orderStartDate}}" startTime='{{prodDetail.nowDate}}' endTime='{{prodDetail.orderEndDate}}' dayEmpty='{{false}}'></countdown>
+          <countdown wx:else startTime='{{prodDetail.nowDate}}' endTime='{{prodDetail.orderStartDate}}' dayEmpty='{{false}}'></countdown>
     </view>
-    <view class='cfff f24'>限量50份</view>
+    <view class='cfff f24'>限量{{prodDetail.stock}}份</view>
   </view>
 </view>
 
 <view class='pad20 b-box w100 flex flex-column bdb'>
-  <view class='f32 c333 bold'>上海迪士尼乐园75折活动,领券立减2</view>
+  <view class='f32 c333 bold'>{{prodDetail.infoTitle}}</view>
   <view class='flex flex-bt mt20'>
     <view class='flex flex-aic'>
       <view class='c666 f26'> 抢购价 </view>
-      <view class='red ml10 f30 bold'> ¥270元 </view>
-      <view class='ml10 text-throught f24 c999 text-through'> 390
+      <view class='red ml10 f30 bold'> ¥{{prodDetail.salePrice / 100}}元 </view>
+      <view class='ml10 text-throught f24 c999 text-through'> {{prodDetail.marketPrice / 100}}
       </view>
     </view>
-    <view class='qgBtn flex flex-center f28 cfff'>立即抢购</view>
+    <view class='qgBtn flex flex-center f28 cfff' bindtap='goOrder'>立即抢购</view>
   </view>
 </view>
 
@@ -32,53 +31,11 @@
 <view class='greyBar'></view>
 
 <view class='bgfff pad20' wx:if="{{index==1}}">
-  <view class='bgfff mt20'>
-    <view class='flex flex-aic pl20 ml20'>
-      <text class='f28 c666'>预订时间:</text>
-      <view class='green f20 box'>今日可用</view>
-    </view>
-    <view class='flex flex-aic mt10 pl20 ml20'>
-      <text class='f28 c666'>有效日期:</text>
-      <view class='c333 f28'>2018-07-24至2018-02—4周一至周日</view>
-    </view>
-  </view>
-  <view class='pad20 bgfff'>
-
-    <view class='flex flex-ais mt10 ml20'>
-      <text class='f28 c666'>费用包含:</text>
-      <view class='c333 f28 flex-1' style='line-height:46rpx'>凭票可全天通行乐园所有有了设施和娱乐 演出。</view>
-    </view>
-  </view>
-  <view class='pl20 pb20 pr20 bgfff'>
-
-    <view class='flex flex-aic  ml20'>
-      <text class='f28 c666'>使用方法:</text>
-      <view class='green f20 box'>无需换票</view>
-    </view>
-    <view class='flex flex-ais mt20  ml20'>
-      <text class='f28 c666'>使用地址:</text>
-      <view class='c333 f28 flex-1'>上海迪士尼度假区,持购票所用人身份证 和短信验证码直接至乐园闸机,所有人需 同时入园。</view>
-    </view>
-  </view>
-  <view class='pad20 bgfff'>
-    <view class='flex flex-ais mt10  ml20'>
-      <text class='f28 c666' style='letter-spacing:14rpx'>其  他:</text>
-      <view class='c333 f28 flex-1' style='line-height:46rpx'>所有不满1.4米的儿童需至少一名有监护能 力的成人陪同,一人一票制, 陪同者也需 购票、孕妇禁止下水游玩。</view>
-    </view>
-  </view>
+  <template is="wxParse" data="{{wxParseData:orderDesc.nodes}}"/>
 </view>
 
 <view class='flex flex-center pad30 b-box flex-column' wx:if="{{index==2}}">
-  <view class='f30 c333 bold'>迪士尼乐园游玩秘籍,一定要看哟!
-  </view>
-  <image src="/img/11.png" class='detailImg w100 mt30' mode='widthFix'></image>
-  <view class='f28 c71 mt20 text'>
-    欢迎来到一个前所未见的神奇世界,在此点亮您的心中奇梦。这就是上海迪士尼乐园,无论老幼,都可以在此感受充满创造力、冒险和刺激的乐趣!
-  </view>
-  <image src="/img/11.png" class='detailImg w100 mt30' mode='widthFix'></image>
-  <view class='f28 c71 mt20 text'>
-    把目光投向奇幻童话城堡,世界上最大的迪士尼城堡,准备好开始探索这七大各具魅力而令人难忘的神奇园区:米奇大街、奇想花园、梦幻世界、探险岛、宝藏湾、明日世界和迪士尼·皮克斯玩具总动员主题园区。
-  </view>
+  <template is="wxParse" data="{{wxParseData:content.nodes}}"/>
 </view>
 
-<view class='bottomBtn f32 cfff flex flex-center bold'>立即抢购</view>
+<view class='bottomBtn f32 cfff flex flex-center bold' bindtap='goOrder'>立即抢购</view>

+ 65 - 65
src/pages/selectOwner/editOwner.js

@@ -1,66 +1,66 @@
-// pages/selectOwner/editOwner.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-  
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-  
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-  
-  }
+// pages/selectOwner/editOwner.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
 })

+ 25 - 25
src/pages/selectOwner/editOwner.wxml

@@ -1,26 +1,26 @@
-<!--pages/selectOwner/editOwner.wxml-->
-<view class='bgfff pad20'>
-  <view class='flex flex-aic bdb pb20'>
-    <image src='/img/book.png' style='width:34rpx;height:37rpx;'></image>
-    <text class='f32 c333 bold ml20'>姓名及证件信息</text>
-  </view>
-  <view class='flex flex-aic pt20 pb20 bdb'>
-    <text class='f28 c333'>中文姓名:</text>
-    <input placeholder='取票人姓名' placeholder-class='f28 c999'></input>
-  </view>
-  <view class='flex flex-aic pt20 pb20 bdb'>
-    <text class='f28 c333'>手机号码:</text>
-    <input placeholder='请输入手机号码' placeholder-class='f28 c999'></input>
-  </view>
-  <view class='flex flex-aic pt20 pb20 bdb'>
-    <text class='f28 c333'>证件类型:</text>
-    <text class='f28 c4a'>身份证</text>
-  </view>
-  <view class='flex flex-aic pt20 '>
-    <text class='f28 c333'>证件号码:</text>
-    <input placeholder='请输入证件号码' placeholder-class='f28 c999'></input>
-  </view>
-
-</view>
-
+<!--pages/selectOwner/editOwner.wxml-->
+<view class='bgfff pad20'>
+  <view class='flex flex-aic bdb pb20'>
+    <image src='/img/book.png' style='width:34rpx;height:37rpx;'></image>
+    <text class='f32 c333 bold ml20'>姓名及证件信息</text>
+  </view>
+  <view class='flex flex-aic pt20 pb20 bdb'>
+    <text class='f28 c333'>中文姓名:</text>
+    <input placeholder='取票人姓名' placeholder-class='f28 c999'></input>
+  </view>
+  <view class='flex flex-aic pt20 pb20 bdb'>
+    <text class='f28 c333'>手机号码:</text>
+    <input placeholder='请输入手机号码' placeholder-class='f28 c999'></input>
+  </view>
+  <view class='flex flex-aic pt20 pb20 bdb'>
+    <text class='f28 c333'>证件类型:</text>
+    <text class='f28 c4a'>身份证</text>
+  </view>
+  <view class='flex flex-aic pt20 '>
+    <text class='f28 c333'>证件号码:</text>
+    <input placeholder='请输入证件号码' placeholder-class='f28 c999'></input>
+  </view>
+
+</view>
+
 <view class='save f32 cfff flex flex-center'>保存</view>

+ 65 - 65
src/pages/selectOwner/selectOwner.js

@@ -1,66 +1,66 @@
-// pages/selectOwner/selectOwner.js
-Page({
-
-  /**
-   * 页面的初始数据
-   */
-  data: {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面初次渲染完成
-   */
-  onReady: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面隐藏
-   */
-  onHide: function () {
-  
-  },
-
-  /**
-   * 生命周期函数--监听页面卸载
-   */
-  onUnload: function () {
-  
-  },
-
-  /**
-   * 页面相关事件处理函数--监听用户下拉动作
-   */
-  onPullDownRefresh: function () {
-  
-  },
-
-  /**
-   * 页面上拉触底事件的处理函数
-   */
-  onReachBottom: function () {
-  
-  },
-
-  /**
-   * 用户点击右上角分享
-   */
-  onShareAppMessage: function () {
-  
-  }
+// pages/selectOwner/selectOwner.js
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide: function () {
+  
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload: function () {
+  
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh: function () {
+  
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom: function () {
+  
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage: function () {
+  
+  }
 })

+ 41 - 41
src/pages/selectOwner/selectOwner.wxml

@@ -1,42 +1,42 @@
-<!--pages/selectOwner/selectOwner.wxml-->
-<view>
-  <navigator url='/pages/selectOwner/editOwner' hover-class='none' class='bgfff flex flex-center pad20' style='width:80%;height:100rpx;margin:20rpx auto;border-radius:10rpx;'>
-    <image src='/img/add.png' style='width:22rpx;height:22rpx;'></image>
-    <text class='f30 green ml20'>新增常用取票人</text>
-  </navigator>
-  <view class='bgfff flex flex-ais flex-column pad20 ' style='width:80%;margin:20rpx auto;border-radius:10rpx;'>
-    <view class='flex flex-bt flex-aic w100 mb20'>
-      <view class='flex flex-aic'>
-        <image src='/img/circle.png' style='width:30rpx;height:30rpx;'></image>
-        <text class='f30 c4a ml10'>李筱筱</text>
-      </view>
-      <view class='flex flex-aic flex-bt'>
-        <navigator class='flex' url='/pages/selectOwner/editOwner' hover-class='none'>
-          <image src='/img/edit.png' style='width:28rpx;height:28rpx;' class='mr20'></image>
-        </navigator>
-
-        <image src='/img/delete.png' style='width:28rpx;height:28rpx;' class='ml20'></image>
-      </view>
-    </view>
-    <view class='f26 c4a'>手机号:180 0000 000</view>
-    <view class='f26 c4a'>身份证:510824 1992 0923 0014</view>
-  </view>
-
-  <view class='bgfff flex flex-ais flex-column pad20 ' style='width:80%;margin:20rpx auto;border-radius:10rpx;'>
-    <view class='flex flex-bt flex-aic w100 mb20'>
-      <view class='flex flex-aic'>
-        <image src='/img/selected.png' style='width:30rpx;height:30rpx;'></image>
-        <text class='f30 c4a ml10'>李筱筱</text>
-      </view>
-      <view class='flex flex-aic flex-bt'>
-        <navigator class='flex' url='/pages/selectOwner/editOwner' hover-class='none'>
-          <image src='/img/edit.png' style='width:28rpx;height:28rpx;' class='mr20'></image>
-        </navigator>
-
-        <image src='/img/delete.png' style='width:28rpx;height:28rpx;' class='ml20'></image>
-      </view>
-    </view>
-    <view class='f26 c4a'>手机号:180 0000 000</view>
-    <view class='f26 c4a'>身份证:510824 1992 0923 0014</view>
-  </view>
+<!--pages/selectOwner/selectOwner.wxml-->
+<view>
+  <navigator url='/pages/selectOwner/editOwner' hover-class='none' class='bgfff flex flex-center pad20' style='width:80%;height:100rpx;margin:20rpx auto;border-radius:10rpx;'>
+    <image src='/img/add.png' style='width:22rpx;height:22rpx;'></image>
+    <text class='f30 green ml20'>新增常用取票人</text>
+  </navigator>
+  <view class='bgfff flex flex-ais flex-column pad20 ' style='width:80%;margin:20rpx auto;border-radius:10rpx;'>
+    <view class='flex flex-bt flex-aic w100 mb20'>
+      <view class='flex flex-aic'>
+        <image src='/img/circle.png' style='width:30rpx;height:30rpx;'></image>
+        <text class='f30 c4a ml10'>李筱筱</text>
+      </view>
+      <view class='flex flex-aic flex-bt'>
+        <navigator class='flex' url='/pages/selectOwner/editOwner' hover-class='none'>
+          <image src='/img/edit.png' style='width:28rpx;height:28rpx;' class='mr20'></image>
+        </navigator>
+
+        <image src='/img/delete.png' style='width:28rpx;height:28rpx;' class='ml20'></image>
+      </view>
+    </view>
+    <view class='f26 c4a'>手机号:180 0000 000</view>
+    <view class='f26 c4a'>身份证:510824 1992 0923 0014</view>
+  </view>
+
+  <view class='bgfff flex flex-ais flex-column pad20 ' style='width:80%;margin:20rpx auto;border-radius:10rpx;'>
+    <view class='flex flex-bt flex-aic w100 mb20'>
+      <view class='flex flex-aic'>
+        <image src='/img/selected.png' style='width:30rpx;height:30rpx;'></image>
+        <text class='f30 c4a ml10'>李筱筱</text>
+      </view>
+      <view class='flex flex-aic flex-bt'>
+        <navigator class='flex' url='/pages/selectOwner/editOwner' hover-class='none'>
+          <image src='/img/edit.png' style='width:28rpx;height:28rpx;' class='mr20'></image>
+        </navigator>
+
+        <image src='/img/delete.png' style='width:28rpx;height:28rpx;' class='ml20'></image>
+      </view>
+    </view>
+    <view class='f26 c4a'>手机号:180 0000 000</view>
+    <view class='f26 c4a'>身份证:510824 1992 0923 0014</view>
+  </view>
 </view>

+ 112 - 10
src/pages/travel/detail.js

@@ -1,28 +1,53 @@
 // pages/travel/detail.js
+import { shuoAPIClient } from '../../common/api/api.js';
+import WxParse from '../../wxParse/wxParse.js';
 Page({
 
   /**
    * 页面的初始数据
    */
   data: {
-    isL: false
+    isL: false,
+    viewId: null,
+    viewDetail: null,
+    recommendProduct: [],
+    adultProduct: [],
+    childProduct: [],
+    prodDetail: null,
+    productDesc: ''
   },
 
-  toggleL() {
-    this.setData({
-      isL: !this.data.isL
-    })
+  //成人票展开事件
+  toggleL(event) {
+    console.log('成人票展开事件', event)
+    let index = event.currentTarget.dataset.index
+    let ticketType = event.currentTarget.dataset.type
+    if (ticketType == 1) {
+      let datas = this.data.adultProduct
+      datas[index].isL = !datas[index].isL
+      this.setData({
+        adultProduct: datas
+      })
+    } else if (ticketType == 2) {
+      let datas = this.data.childProduct
+      datas[index].isL = !datas[index].isL
+      this.setData({
+        childProduct: datas
+      })
+    }
+    
   },
 
-  naviToYdxz() {
+  naviToYdxz(e) {
     wx.navigateTo({
-      url: '/pages/needKnow/needKnow',
+      url: '/pages/needKnow/needKnow?infoId=' + e.currentTarget.dataset.infoid,
     })
   },
   
-  naviToYd(){
+  naviToYd(e){
+    console.log('点击预定', e)
     wx.navigateTo({
-      url: '/pages/creatOrder/creatOrder',
+      url: '/pages/creatOrder/creatOrder?infoId=' + e.currentTarget.dataset.infoid,
     })
   },
 
@@ -30,7 +55,10 @@ Page({
    * 生命周期函数--监听页面加载
    */
   onLoad: function(options) {
-
+    this.setData({
+      viewId: options.viewId
+    })
+    console.log('viewId', this.data.viewId)
   },
 
   /**
@@ -44,7 +72,81 @@ Page({
    * 生命周期函数--监听页面显示
    */
   onShow: function() {
+    this.getViewDetail()
+    this.getProduct(0)  //推荐票
+    this.getProduct(1)  //成人票
+    this.getProduct(2)  //儿童票
+  },
 
+  /**
+   * @orderBy 0特价票(推荐) 1普通票(成人票) 2儿童票
+   */
+  getProduct(ticketType) {
+    shuoAPIClient.request('/api/minapp/ticket/products',
+      {
+        viewId: this.data.viewId,
+        orderBy: 3, //推荐值排序
+        ticketTypeName: ticketType,
+      }, false).then(res => {
+        console.log('产品', res)
+        if (res.data.results && res.data.results.length) {
+          if (ticketType == 0) {
+            this.setData({
+              recommendProduct: res.data.results
+            })
+          } else if (ticketType == 1) {
+            let datas = res.data.results
+            for (let data of datas) {
+              data.isL = false
+            }
+            this.setData({
+              adultProduct: datas
+            })
+            if (datas && datas.length > 0) {
+              this.getProdDetail(datas[0].infoId)
+            }
+          } else if (ticketType == 2) {
+            let datas = res.data.results
+            for (let data of datas) {
+              data.isL = false
+            }
+            this.setData({
+              childProduct: datas
+            })
+          }
+          
+        } 
+      })
+  },
+  /**
+   * 景点详情
+   */
+  getViewDetail() {
+    shuoAPIClient.request('/api/minapp/common/view/' + this.data.viewId,
+      {}, false).then(res => {
+        console.log('景点详情', res)
+        if (res && res.data) {
+          this.setData({
+            viewDetail: res.data
+          })
+        }
+      })
+  },
+  /**
+   * 产品详情
+   */
+  getProdDetail(infoId) {
+    let self = this
+    shuoAPIClient.request('/api/minapp/ticket/product/' + infoId,
+      {}, false).then(res => {
+        console.log('产品详情', res)
+        if (res && res.data) {
+          self.setData({
+            prodDetail: res.data
+          })
+          WxParse.wxParse('productDesc', 'html', res.data.content, self, 5);
+        }
+      })
   },
 
   /**

Datei-Diff unterdrückt, da er zu groß ist
+ 78 - 137
src/pages/travel/detail.wxml


+ 2 - 2
src/project.config.json

@@ -4,7 +4,7 @@
 		"ignore": []
 	},
 	"setting": {
-		"urlCheck": false,
+		"urlCheck": true,
 		"es6": true,
 		"postcss": true,
 		"minified": true,
@@ -12,7 +12,7 @@
 	},
 	"compileType": "miniprogram",
 	"libVersion": "2.0.4",
-	"appid": "wx484c3bb78abc6598",
+	"appid": "wxc627db84bc3463e9",
 	"projectname": "nnlx1",
 	"isGameTourist": false,
 	"condition": {

BIN
src/wxParse/emojis/00.gif


BIN
src/wxParse/emojis/01.gif


BIN
src/wxParse/emojis/02.gif


BIN
src/wxParse/emojis/03.gif


BIN
src/wxParse/emojis/04.gif


BIN
src/wxParse/emojis/05.gif


BIN
src/wxParse/emojis/06.gif


BIN
src/wxParse/emojis/07.gif


BIN
src/wxParse/emojis/08.gif


BIN
src/wxParse/emojis/09.gif


BIN
src/wxParse/emojis/10.gif


BIN
src/wxParse/emojis/100.gif


BIN
src/wxParse/emojis/101.gif


BIN
src/wxParse/emojis/102.gif


BIN
src/wxParse/emojis/103.gif


BIN
src/wxParse/emojis/104.gif


BIN
src/wxParse/emojis/105.gif


BIN
src/wxParse/emojis/106.gif


BIN
src/wxParse/emojis/107.gif


BIN
src/wxParse/emojis/108.gif


BIN
src/wxParse/emojis/109.gif


BIN
src/wxParse/emojis/11.gif


BIN
src/wxParse/emojis/110.gif


BIN
src/wxParse/emojis/111.gif


BIN
src/wxParse/emojis/112.gif


BIN
src/wxParse/emojis/113.gif


BIN
src/wxParse/emojis/114.gif


BIN
src/wxParse/emojis/115.gif


BIN
src/wxParse/emojis/116.gif


BIN
src/wxParse/emojis/117.gif


+ 0 - 0
src/wxParse/emojis/118.gif


Einige Dateien werden nicht angezeigt, da zu viele Dateien in diesem Diff geändert wurden.