Browse Source

first commit

wing 5 years ago
commit
17487bfa51
100 changed files with 6310 additions and 0 deletions
  1. 28 0
      .project
  2. 27 0
      api/project.js
  3. 49 0
      app.js
  4. 120 0
      app.json
  5. 50 0
      app.wxss
  6. 29 0
      component/currency/currency.js
  7. 3 0
      component/currency/currency.json
  8. 1 0
      component/currency/currency.wxml
  9. 0 0
      component/currency/currency.wxss
  10. 31 0
      component/filter/filter.js
  11. 3 0
      component/filter/filter.json
  12. 1 0
      component/filter/filter.wxml
  13. 0 0
      component/filter/filter.wxss
  14. 171 0
      component/formatTime/formatTime.js
  15. 3 0
      component/formatTime/formatTime.json
  16. 1 0
      component/formatTime/formatTime.wxml
  17. 0 0
      component/formatTime/formatTime.wxss
  18. 14 0
      component/project/project.js
  19. 3 0
      component/project/project.json
  20. 16 0
      component/project/project.wxml
  21. 49 0
      component/project/project.wxss
  22. 31 0
      component/toast/toast.js
  23. 9 0
      component/toast/toast.wxml
  24. 22 0
      component/toast/toast.wxss
  25. BIN
      images/footer/categories.png
  26. BIN
      images/footer/categoriesa.png
  27. BIN
      images/footer/categoriesc.png
  28. BIN
      images/footer/farm.png
  29. BIN
      images/footer/farma.png
  30. BIN
      images/footer/farmc.png
  31. BIN
      images/footer/home.png
  32. BIN
      images/footer/homea.png
  33. BIN
      images/footer/homec.png
  34. BIN
      images/footer/my.png
  35. BIN
      images/footer/mya.png
  36. BIN
      images/footer/myc.png
  37. BIN
      images/footer/play.png
  38. BIN
      images/footer/poster.png
  39. BIN
      images/footer/search.png
  40. BIN
      images/footer/searcha.png
  41. BIN
      images/footer/share.png
  42. BIN
      images/footer/shoppingcart.png
  43. BIN
      images/footer/shoppingcarta.png
  44. BIN
      images/footer/weixin.png
  45. BIN
      images/footer/weixina.png
  46. BIN
      images/footer/weixinc.png
  47. 101 0
      packageMerchant/pages/merchant/accounts/accounts.js
  48. 10 0
      packageMerchant/pages/merchant/accounts/accounts.json
  49. 32 0
      packageMerchant/pages/merchant/accounts/accounts.wxml
  50. 125 0
      packageMerchant/pages/merchant/accounts/accounts.wxss
  51. 281 0
      packageMerchant/pages/merchant/logistics/logistics.js
  52. 8 0
      packageMerchant/pages/merchant/logistics/logistics.json
  53. 77 0
      packageMerchant/pages/merchant/logistics/logistics.wxml
  54. 189 0
      packageMerchant/pages/merchant/logistics/logistics.wxss
  55. 138 0
      packageMerchant/pages/merchant/order/order.js
  56. 9 0
      packageMerchant/pages/merchant/order/order.json
  57. 104 0
      packageMerchant/pages/merchant/order/order.wxml
  58. 324 0
      packageMerchant/pages/merchant/order/order.wxss
  59. 316 0
      packageMerchant/pages/merchant/orders/orders.js
  60. 9 0
      packageMerchant/pages/merchant/orders/orders.json
  61. 104 0
      packageMerchant/pages/merchant/orders/orders.wxml
  62. 340 0
      packageMerchant/pages/merchant/orders/orders.wxss
  63. 89 0
      packageUser/pages/user/address/address.js
  64. 4 0
      packageUser/pages/user/address/address.json
  65. 38 0
      packageUser/pages/user/address/address.wxml
  66. 92 0
      packageUser/pages/user/address/address.wxss
  67. 83 0
      packageUser/pages/user/bankinfo/bankinfo.js
  68. 4 0
      packageUser/pages/user/bankinfo/bankinfo.json
  69. 48 0
      packageUser/pages/user/bankinfo/bankinfo.wxml
  70. 122 0
      packageUser/pages/user/bankinfo/bankinfo.wxss
  71. 150 0
      packageUser/pages/user/bind/bind.js
  72. 4 0
      packageUser/pages/user/bind/bind.json
  73. 39 0
      packageUser/pages/user/bind/bind.wxml
  74. 156 0
      packageUser/pages/user/bind/bind.wxss
  75. 15 0
      packageUser/pages/user/bindsuccess/bindsuccess.js
  76. 4 0
      packageUser/pages/user/bindsuccess/bindsuccess.json
  77. 6 0
      packageUser/pages/user/bindsuccess/bindsuccess.wxml
  78. 31 0
      packageUser/pages/user/bindsuccess/bindsuccess.wxss
  79. 110 0
      packageUser/pages/user/buy/buy.js
  80. 4 0
      packageUser/pages/user/buy/buy.json
  81. 45 0
      packageUser/pages/user/buy/buy.wxml
  82. 148 0
      packageUser/pages/user/buy/buy.wxss
  83. 523 0
      packageUser/pages/user/exchange/exchange.js
  84. 4 0
      packageUser/pages/user/exchange/exchange.json
  85. 195 0
      packageUser/pages/user/exchange/exchange.wxml
  86. 382 0
      packageUser/pages/user/exchange/exchange.wxss
  87. 17 0
      packageUser/pages/user/exchangeSuccess/exchangeSuccess.js
  88. 3 0
      packageUser/pages/user/exchangeSuccess/exchangeSuccess.json
  89. 15 0
      packageUser/pages/user/exchangeSuccess/exchangeSuccess.wxml
  90. 52 0
      packageUser/pages/user/exchangeSuccess/exchangeSuccess.wxss
  91. 79 0
      packageUser/pages/user/farm/farm.js
  92. 8 0
      packageUser/pages/user/farm/farm.json
  93. 74 0
      packageUser/pages/user/farm/farm.wxml
  94. 281 0
      packageUser/pages/user/farm/farm.wxss
  95. 237 0
      packageUser/pages/user/fund/fund.js
  96. 9 0
      packageUser/pages/user/fund/fund.json
  97. 61 0
      packageUser/pages/user/fund/fund.wxml
  98. 242 0
      packageUser/pages/user/fund/fund.wxss
  99. 108 0
      packageUser/pages/user/granary/granary.js
  100. 0 0
      packageUser/pages/user/granary/granary.json

+ 28 - 0
.project

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>fohow_xcx</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.aptana.ide.core.unifiedBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.aptana.projects.webnature</nature>
+	</natures>
+	<filteredResources>
+		<filter>
+			<id>1589890505457</id>
+			<name></name>
+			<type>26</type>
+			<matcher>
+				<id>org.eclipse.ui.ide.multiFilter</id>
+				<arguments>1.0-name-matches-false-false-node_modules</arguments>
+			</matcher>
+		</filter>
+	</filteredResources>
+</projectDescription>

+ 27 - 0
api/project.js

@@ -0,0 +1,27 @@
+var $state = require('../utils/modules.js')
+var _request = require('../utils/request.js')
+
+// 项目列表
+function getProjects (that, state, page, per_page) {
+  // wx.showLoading({
+  //   title: '加载中',
+  // })
+  var url = 'v1/products'
+  var params = {
+    state: state,
+    page: page,
+    per_page: per_page
+  }
+  var success = function (val, res) {
+    $state.state.projectList.total = val.data.list_count
+    var result = res ? that.data.project.concat(val.data.list || []) : []
+    that.setData({ project: result })
+    $state.state.projectList.more = val.data.list_count > val.data.list
+  }
+  _request.$get(url, params, success)
+}
+
+module.exports = {
+  getProjects: getProjects
+}
+

+ 49 - 0
app.js

@@ -0,0 +1,49 @@
+//app.js
+var request = require('utils/request.js')
+var utils = require('utils/util.js')
+App({
+  onLaunch: function (res) {
+    console.log(res)
+    this.login()
+  },
+  onShow: function () {
+    this.check()
+  },
+  login () {
+    wx.login({
+      success: res => {
+        request.login(res)
+      }
+    })
+  },
+  check: function () {
+    var that = this
+    var url = 'v1/user/check'
+    var params = {
+    }
+    var success = function (res) {
+      if (res.data.wx_user_id > 0) {
+        that.globalData.wx_id = res.data.wx_user_id
+        that.globalData.copartner_state = res.data.copartner_state
+      }
+    }
+    request.$get(url, params, success)
+  },
+  globalData: {
+    version: '2.2', // 版本号
+    vershow: true, 
+    userInfo: null,
+// 正式
+    d5c: "fhwx.hiwavo.com",
+// 测试
+    // d5c: "tm.d5ct.com",
+    order: false,  // 订单详情跳转记录
+    merchant: '',  // 物流初始化
+    redPacketId: 0, // 红包id
+    wx_id: 0, // 微信id
+    try_login: false,
+    copartner_state: '',
+    isshow: '',
+    isupdate: true
+  }
+})

+ 120 - 0
app.json

@@ -0,0 +1,120 @@
+{
+  "pages": [
+    "pages/start/start",
+    "pages/home/home",
+    "pages/user/all/all",
+    "pages/cart/cart",
+    "pages/projects/projects",
+    "pages/helpfarm/helpfarm",
+    "pages/helpfarm/helpfarm-detail/helpfarm-detail",
+    "pages/helpfarm/helpfarm-success/helpfarm-success",
+    "pages/helpfarm/success/success",
+    "pages/helpfarm/count/count",
+    "pages/helpfarm/othercustom/othercustom",
+    "pages/helpfarm/group/group",
+    "pages/projects/project-detail/project-detail",
+    "pages/projects/project-success/project-success",
+    "pages/pay/pay",
+    "pages/customservice/customservice",
+    "pages/web/web",
+    "pages/parse/parse",
+    "pages/activity/redpacket/redpacket",
+    "pages/activity/screen/screen"
+  ],
+  "subpackages": [
+    {
+      "root": "packageUser",
+      "pages": [
+        "pages/user/bind/bind",
+        "pages/user/buy/buy",
+        "pages/user/granary/granary",
+        "pages/user/granary/use/use",
+        "pages/user/fund/fund",
+        "pages/user/farm/farm",
+        "pages/user/otherbind/otherbind",
+        "pages/user/bindsuccess/bindsuccess",
+        "pages/user/address/address",
+        "pages/user/newAddress/newAddress",
+        "pages/user/radish/radish",
+        "pages/user/radishDetail/radishDetail",
+        "pages/user/orders/orders",
+        "pages/user/order/order",
+        "pages/user/safe/safe",
+        "pages/user/exchange/exchange",
+        "pages/user/exchangeSuccess/exchangeSuccess",
+        "pages/user/invite/invite",
+        "pages/user/invite/detail/detail",
+        "pages/user/invite/month/month",
+        "pages/user/invite/total/total",
+        "pages/user/invite/rank/rank",
+        "pages/user/invite/contribution/contribution",
+        "pages/user/invite/material/material",
+        "pages/user/identity/identity",
+        "pages/user/bankinfo/bankinfo",
+        "pages/user/recharge/recharge",
+        "pages/user/withdraw/withdraw"
+      ]
+    },
+    {
+      "root": "packageMerchant",
+      "pages": [
+        "pages/merchant/orders/orders",
+        "pages/merchant/order/order",
+        "pages/merchant/logistics/logistics",
+        "pages/merchant/accounts/accounts"
+      ]
+    }
+  ],
+  "preloadRule": {
+    "pages/user/all/all": {
+      "network": "all",
+      "packages": [
+        "packageMerchant"
+      ]
+    }
+  },
+  "window": {
+    "backgroundTextStyle": "light",
+    "navigationBarBackgroundColor": "#eab86a",
+    "navigationBarTitleText": "WeChat",
+    "navigationBarTextStyle": "white",
+    "enablePullDownRefresh": false
+  },
+  "tabBar": {
+    "color": "#4c4c4c",
+    "selectedColor": "#eab86a",
+    "list": [
+      {
+        "iconPath": "images/footer/home.png",
+        "selectedIconPath": "images/footer/homec.png",
+        "pagePath": "pages/home/home",
+        "text": "首页"
+      },
+      {
+        "iconPath": "images/footer/categories.png",
+        "selectedIconPath": "images/footer/categoriesc.png",
+        "pagePath": "pages/projects/projects",
+        "text": "商品"
+      },
+      {
+        "iconPath": "images/footer/shoppingcart.png",
+        "selectedIconPath": "images/footer/shoppingcarta.png",
+        "pagePath": "pages/cart/cart",
+        "text": "购物车"
+      },
+      {
+        "iconPath": "images/footer/weixin.png",
+        "selectedIconPath": "images/footer/weixinc.png",
+        "pagePath": "pages/customservice/customservice",
+        "text": "客服"
+      },
+      {
+        "iconPath": "images/footer/my.png",
+        "selectedIconPath": "images/footer/myc.png",
+        "pagePath": "pages/user/all/all",
+        "text": "我的"
+      }
+    ]
+  },
+  "sitemapLocation": "sitemap.json"
+}

+ 50 - 0
app.wxss

@@ -0,0 +1,50 @@
+/**app.wxss**/
+@import "component/toast/toast.wxss";
+page {
+  font-family: "微软雅黑", "Microsoft Yahei";
+  height: 100%;
+}
+.app-bg {
+  width: 100%;
+  min-height: 100%;
+  background-color: #f2f4f6;
+}
+.fl {
+  float: left;
+}
+.fr {
+  float: right;
+}
+.clean {
+  clear: both;
+}
+.clear {
+  clear: both;
+}
+.container {
+  width: 100%;
+  height: 100%;
+}
+.ellipsis {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  word-wrap: normal;
+}
+.ellipsisLn {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  /*-webkit-line-clamp: @line;*/
+}
+button::after {
+  border: 0;
+}
+button {
+  border-radius: 0;
+  border: 0;
+  margin: 0;
+  padding: 0;
+  background: none;
+}

+ 29 - 0
component/currency/currency.js

@@ -0,0 +1,29 @@
+// component/project/project.js
+var util = require('../../utils/accounting.min.js');
+Component({
+  properties: {
+    symbol: {
+      type: String,
+      value: '',
+      observer: 'updata'
+    },
+    value: {
+      type: Number,
+      observer: 'updata'
+    }
+  },
+  data: {
+    price: ''
+  },
+  ready: function (options) {
+    this.updata()
+  },
+  methods: {
+    updata () {
+      var val = util.formatMoney(this.data.value / 100, this.data.symbol, 2)
+      this.setData({
+        price: val
+      })
+    }
+  }
+})

+ 3 - 0
component/currency/currency.json

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

+ 1 - 0
component/currency/currency.wxml

@@ -0,0 +1 @@
+<text>{{price}}</text>

+ 0 - 0
component/currency/currency.wxss


+ 31 - 0
component/filter/filter.js

@@ -0,0 +1,31 @@
+Component({
+  properties: {
+    symbol: {
+      type: String,
+      value: '',
+      observer: 'formatNumber'
+    },
+    value: {
+      type: Number,
+      observer: 'formatNumber'
+    }
+  },
+  data: {
+    filter: ''
+  },
+  ready: function (options) {
+    this.formatNumber(this.data.value)
+  },
+  methods: {
+    formatNumber (num) { 
+    if (isNaN(num)) { 
+      throw new TypeError("num is not a number"); 
+    }
+    var price = ("" + num).replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, "$1,")
+    this.setData({
+     filter: price
+    })
+    // return ("" + num).replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, "$1,");  
+    },
+  }
+})

+ 3 - 0
component/filter/filter.json

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

+ 1 - 0
component/filter/filter.wxml

@@ -0,0 +1 @@
+<text>¥{{filter}}</text>

+ 0 - 0
component/filter/filter.wxss


+ 171 - 0
component/formatTime/formatTime.js

@@ -0,0 +1,171 @@
+var formatNumber = n => {
+  n = n.toString()
+  return n[1] ? n : '0' + n
+}
+Component({
+  properties: {
+    type: {
+      type: String,
+      value: 'formatTime',
+      observer: 'updata'
+    },
+    value: {
+      type: Number,
+      observer: 'updata'
+    }
+  },
+  data: {
+    time: ''
+  },
+  ready: function (options) {
+    this.updata()
+  },
+  methods: {
+    updata () {
+      switch (this.data.type) {
+        case 'formatTime':
+          var val = this.formatTime(this.data.value)
+          this.setData({
+            time: val
+          })
+          break
+        case 'formatTime1':
+          var val = this.formatTime1(this.data.value)
+          this.setData({
+            time: val
+          })
+          break
+        case 'formatDate':
+          var val = this.formatDate(this.data.value)
+          this.setData({
+            time: val
+          })
+          break
+        case 'formatChDate':
+          var val = this.formatChDate(this.data.value)
+          this.setData({
+            time: val
+          })
+          break
+        case 'formatChTime':
+          var val = this.formatChTime(this.data.value)
+          this.setData({
+            time: val
+          })
+          break
+        case 'formatmonth':
+          var val = this.formatmonth(this.data.value)
+          this.setData({
+            time: val
+          })
+          break
+        case 'formatmonth1':
+          var val = this.formatmonth1(this.data.value)
+          this.setData({
+            time: val
+          })
+          break
+        case 'formatmonth2':
+          var val = this.formatmonth2(this.data.value)
+          this.setData({
+            time: val
+          })
+          break
+        case 'formatDay':
+          var val = this.formatDay(this.data.value)
+          this.setData({
+            time: val
+          })
+          break
+        default:
+          var val = this.formatTime(this.data.value)
+          this.setData({
+            time: val
+          })
+      }
+    },
+    formatTime (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      let hour = date.getHours()
+      let minute = date.getMinutes()
+      return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':')
+    },
+    formatTime1 (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      let hour = date.getHours()
+      let minute = date.getMinutes()
+      return [month, day].map(formatNumber).join('-') + ' ' + [hour, minute].map(formatNumber).join(':')
+    },
+    formatDate (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      return [year, month, day].map(formatNumber).join('-')
+    },
+    formatChDate (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      return year + '年' + month + '月' + day + '日'
+    },
+    formatmonth (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      // return year + '年' + month + '月' + day + '日'
+      return year + '/' + month 
+    },
+    formatmonth1 (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      // return year + '年' + month + '月' + day + '日'
+      return year + '-' + month 
+    },
+    formatmonth2 (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      // return year + '年' + month + '月' + day + '日'
+      return month + '月' + day + '日'
+    },
+    formatDay (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      // return year + '年' + month + '月' + day + '日'
+      return year + '/' + month + '/' + day
+    },
+    formatChTime (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      let hour = date.getHours()
+      let minute = date.getMinutes()
+      let second = date.getSeconds()
+      return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':')
+    },
+    formatChDate (value) {
+      let date = new Date(value * 1000)
+      let year = date.getFullYear()
+      let month = date.getMonth() + 1
+      let day = date.getDate()
+      let hour = date.getHours()
+      let minute = date.getMinutes()
+      return year + '年' + month + '月' + day + '日' + [hour, minute].map(formatNumber).join(':')
+    }
+  }
+})

+ 3 - 0
component/formatTime/formatTime.json

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

+ 1 - 0
component/formatTime/formatTime.wxml

@@ -0,0 +1 @@
+<text class="">{{time}}</text>

+ 0 - 0
component/formatTime/formatTime.wxss


+ 14 - 0
component/project/project.js

@@ -0,0 +1,14 @@
+// component/project/project.js
+Component({
+
+  /**
+   * 页面的初始数据
+   */
+  properties: {
+    projectItem: {
+      type: Array
+    }
+  },
+  data: {
+  }
+})

+ 3 - 0
component/project/project.json

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

+ 16 - 0
component/project/project.wxml

@@ -0,0 +1,16 @@
+<!--component/project/project.wxml-->
+<view class="all">
+  <view class="project" wx:for="{{projectItem}}">
+    <image class="project-img" src="{{item.cover}}"></image>
+    <view class="project-info">
+      <text class="project-title">{{item.name}}</text>
+      <text class="project-count">已售{{item.current_investor_count}}件</text>
+      <view class="project-price">
+      <currency symbol="¥" value="200" ></currency>
+      </view>
+      <text class="project-point">(或{{item.person_min_crowd_funding / 1000}}代金券)</text>
+    </view>
+    <view class="project-out"></view>
+  </view>
+  <view class="clean"></view>
+</view>

+ 49 - 0
component/project/project.wxss

@@ -0,0 +1,49 @@
+/* component/project/project.wxss */
+.all {
+  padding-top: 20rpx;
+}
+.clean {
+  clear: both;
+}
+.project {
+  position: relative;
+  float: left;
+  margin-left: 20rpx;
+  margin-bottom: 20rpx;
+  width: 345rpx;
+  height: 554rpx;
+  background-color: #fff;
+}
+.project-img {
+  width: 100%;
+  height: 345rpx;
+}
+.project-title {
+  padding-top: 15rpx;
+  line-height: 36rpx;
+  margin-bottom:15rpx;
+  -webkit-line-clamp: 2;
+  font-size: 28rpx;
+  color: #2b2b2b;
+  overflow:hidden;
+  text-overflow:ellipsis;
+  display:-webkit-box;
+  -webkit-box-orient:vertical;
+}
+.project-info {
+  padding: 0 10rpx;
+}
+.project-count {
+  display: block;
+  color: #bbbbbb;
+  font-size: 24rpx;
+}
+.project-price {
+  color: #eab86a;
+  font-size: 28rpx;
+  font-weight: bold;
+}
+.project-point {
+  color: #bbbbbb;
+  font-size: 24rpx;
+}

+ 31 - 0
component/toast/toast.js

@@ -0,0 +1,31 @@
+
+let _compData = {
+  '_toast_.isHide': false,// 控制组件显示隐藏
+  '_toast_.content': ''// 显示的内容
+}
+let toastPannel = {
+  // toast显示的方法
+  show: function(data) {
+    let self = this;
+    this.setData({ '_toast_.isHide': true, '_toast_.content': data});
+    setTimeout(function(){
+      self.setData({ '_toast_.isHide': false})
+    },2000)
+  }
+}
+function ToastPannel() {
+  // 拿到当前页面对象
+  let pages = getCurrentPages();
+  let curPage = pages[pages.length - 1];
+  this.__page = curPage;
+  // 小程序最新版把原型链干掉了。。。换种写法
+  Object.assign(curPage, toastPannel);
+  // 附加到page上,方便访问
+  curPage.toastPannel = this;
+  // 把组件的数据合并到页面的data对象中
+  curPage.setData(_compData);
+  return this;
+}
+module.exports = {
+  ToastPannel
+}

+ 9 - 0
component/toast/toast.wxml

@@ -0,0 +1,9 @@
+ <template name="toast">
+  <view class="toast_content_box" wx:if="{{ isHide }}">
+    <view class="toast_content">
+      <view class="toast_content_text">
+        {{content}}
+      </view>
+    </view>
+  </view>
+ </template>

+ 22 - 0
component/toast/toast.wxss

@@ -0,0 +1,22 @@
+.toast_content_box {
+  display: flex;
+  width: 100%;
+  height: 100%;
+  justify-content: center;
+  align-items: center;
+  position: fixed;
+  z-index: 999;
+}
+.toast_content {
+  width: 50%;
+  padding: 20rpx;
+  background: rgba(0, 0, 0, 0.8);
+  border-radius: 20rpx;
+}
+.toast_content_text {
+  height: 100%;
+  width: 100%;
+  color: #fff;
+  font-size: 28rpx;
+  text-align: center;
+} 

BIN
images/footer/categories.png


BIN
images/footer/categoriesa.png


BIN
images/footer/categoriesc.png


BIN
images/footer/farm.png


BIN
images/footer/farma.png


BIN
images/footer/farmc.png


BIN
images/footer/home.png


BIN
images/footer/homea.png


BIN
images/footer/homec.png


BIN
images/footer/my.png


BIN
images/footer/mya.png


BIN
images/footer/myc.png


BIN
images/footer/play.png


BIN
images/footer/poster.png


BIN
images/footer/search.png


BIN
images/footer/searcha.png


BIN
images/footer/share.png


BIN
images/footer/shoppingcart.png


BIN
images/footer/shoppingcarta.png


BIN
images/footer/weixin.png


BIN
images/footer/weixina.png


BIN
images/footer/weixinc.png


+ 101 - 0
packageMerchant/pages/merchant/accounts/accounts.js

@@ -0,0 +1,101 @@
+var _request = require('../../../../utils/request.js')
+var id
+Page({
+  data: {
+    page: 1,
+    per_page: 10,
+    list: [],
+    already_settle:'',
+    not_settle:'',
+    total_sale:'',
+    // settle_price:[],
+    more: true,
+    num: ''
+  },
+  onLoad: function (options) {
+    id = options.id
+    // var app = getApp()
+    // new app.ToastPannel()
+    this.getSettleList()
+    this.getSettleStat()
+    this.getTime()
+  },
+  getSettleList () {
+    var that = this
+    var url = 'v1/merchant/settle/list'
+    var params = {
+      merchant_id: id,
+      page: this.data.page,
+      per_page: this.data.per_page
+    }
+    var success = function (res) {
+      // var arr = []
+      // for(var i = 0; i<data.length; i++){
+      //   // console.log(data[i].settle_price)
+      //   arr.push(that.formatNumber(data[i].settle_price))
+      //   console.log(arr.length)
+      // }
+      var result = that.data.list.concat(res.data.list || [])
+      console.log(result)
+      that.setData({
+        list: result,
+        // settle_price: arr
+      })
+      var listMore = res.data.list_count > that.data.list.length
+      that.setData({
+        more: listMore
+      })
+    }
+    _request.$get(url, params, success, that)
+  },
+  getSettleStat () {
+    var that = this
+    var url = 'v1/merchant/settle/stat'
+    var params = {
+      merchant_id: id,
+    }
+    var success = function (res) {
+      var data1 = res.data
+      console.log(data1)
+      that.setData({
+        already_settle: that.formatNumber(data1.already_settle),
+        not_settle: that.formatNumber(data1.not_settle),
+        total_sale: that.formatNumber(data1.total_sale)
+      })
+    }
+    _request.$get(url, params, success, that)
+  },
+  //千分位格式化
+  formatNumber (num) {
+    var num1 = num.toFixed(2)
+    if (isNaN(num)) { 
+      throw new TypeError("num is not a number"); 
+    } 
+    return ("" + num1).replace(/(\d{1,3})(?=(\d{3})+(?:$|\.))/g, "$1,");  
+  },
+  toOther () {
+    wx.navigateTo({
+      url: '/pages/parse/parse?id=10'
+    })
+  },
+  onReachBottom: function () {
+    if (this.data.more) {
+      var page = this.data.page + 1
+      this.setData({
+        page: page
+      })
+      this.getSettleList()
+    }
+  },
+  getTime () {
+    var that = this
+    var date=new Date;
+    var year=date.getFullYear(); 
+    var month=date.getMonth()+1;
+    month =(month<10 ? "0"+month:month); 
+    var mydate = (year.toString()+'/'+month.toString());
+    that.setData({
+      num: mydate
+    })
+  }
+})

+ 10 - 0
packageMerchant/pages/merchant/accounts/accounts.json

@@ -0,0 +1,10 @@
+{
+ "navigationBarTitleText": "结算管理",
+ "navigationBarBackgroundColor": "#86a7da",
+ "usingComponents": {
+   "currency": "../../../../component/currency/currency",
+   "format-time": "../../../../component/formatTime/formatTime",
+   "filter": "../../../../component/filter/filter"
+ },
+ "backgroundColor": "#f3f3f3"
+}

+ 32 - 0
packageMerchant/pages/merchant/accounts/accounts.wxml

@@ -0,0 +1,32 @@
+<!--packageMerchant/pages/merchant/accounts/accounts.wxml-->
+ 
+<view class="bg">
+  <view class="accounts">
+    <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/icon/question_icon.png" class="accounts-icon" bindtap="toOther"/>
+    <view class="accounts-top">
+      <view class="w-text">未结算金额(元)</view>
+      <view class="w-money">{{not_settle}}</view>
+    </view>
+    <view class="accounts-bottom">
+      <view class="accounts-left">
+        <view class="y-text">已结算金额(元)</view>
+        <view class="y-money">{{already_settle}}</view>
+      </view>
+      <view class="accounts-right">
+        <view class="x-text">销售总额(元)</view>
+        <view class="x-money">{{total_sale}}</view>
+      </view>
+    </view>
+  </view>
+</view>
+<view class="accounts-record">
+   <view class="record-title">月结记录</view>
+   <view class="record-li" wx:for="{{list}}" wx:key="{{index}}" wx:if="{{list}}">
+     <text class="record-time">{{item.ym}}</text>
+     <filter class="{{num==item.ym?'first':'record-money'}}" value="{{item.settle_price}}" data-index="{{index}}"></filter>
+   </view>
+   <view wx:if="{{list.length<=0}}">
+     <image class="img" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/icon/account_null.jpg" />
+     <view class="no-record">抱歉,暂无月结记录</view>
+   </view>
+</view>

+ 125 - 0
packageMerchant/pages/merchant/accounts/accounts.wxss

@@ -0,0 +1,125 @@
+.bg{
+  background-color: #f3f3f3;
+  width: 100%;
+  height: 372rpx;
+  overflow: hidden;
+}
+.accounts{
+  background: -webkit-linear-gradient(left, #86a7da , #658ac5);
+  background: -o-linear-gradient(right, #86a7da, #658ac5);
+  background: -moz-linear-gradient(right, #86a7da, #658ac5);
+  background: linear-gradient(to right, #86a7da , #658ac5);
+  height: 332rpx;
+  width: 710rpx;
+  margin: 20rpx auto 0;
+  border-radius:10rpx;
+  position: relative;
+}
+.w-text{
+  font-size: 30rpx;
+  text-align: center;
+  color:#d2e4ff;
+  padding-top: 25rpx;
+  padding-bottom: 25rpx;
+}
+.w-money{
+  font-size: 40rpx;
+  text-align: center;
+  color: #fff;
+  font-weight: 900;
+  padding-bottom: 40rpx;
+}
+.y-text{
+  font-size: 30rpx;
+  text-align: center;
+  color:#d2e4ff;
+  padding-top: 30rpx;
+  padding-bottom: 10rpx;
+}
+.y-money{
+  font-size: 30rpx;
+  text-align: center;
+  color: #fff;
+  font-weight: 900;
+  /* padding-bottom: 30rpx; */
+}
+.x-text{
+  font-size: 30rpx;
+  text-align: center;
+  color:#d2e4ff;
+  padding-top: 30rpx;
+  padding-bottom: 10rpx;
+}
+.x-money{
+  font-size: 30rpx;
+  text-align: center;
+  color: #fff;
+  font-weight: 900;
+  /* padding-bottom: 30rpx; */
+}
+.accounts-bottom{
+  border-top: 1rpx solid #6584b4;
+}
+.accounts-left{
+  float: left;
+  padding-left: 12%;
+}
+.accounts-right{
+  float: right;
+  padding-right: 12%;
+}
+.record-title{
+  text-align: center;
+  font-size: 26rpx;
+  color: #8ba5ce;
+  background-color: #f4f7fc;
+  margin: 20rpx auto 0;
+  width: 710rpx;
+  height: 40rpx;
+  padding-top: 10rpx;
+}
+.record-li{
+  height: 120rpx;
+  width: 710rpx;
+  margin: 0 auto;
+  border-bottom: 1rpx solid #ccc;
+}
+.record-time{
+  font-size: 23rpx;
+  color: #999;
+  line-height: 120rpx;
+}
+.record-money{
+ font-size: 30rpx;
+ color: #eab86a;
+ line-height: 120rpx;
+ float: right;
+}
+.accounts-icon{
+  width: 40rpx;
+  height: 40rpx;
+  position: absolute;
+  top: 26rpx;
+  right: 26rpx;
+}
+.accounts-record{
+  position: relative;
+}
+.img{
+  width: 125rpx;
+  height: 125rpx;
+  display: block;
+  margin: 150rpx auto 0;
+}
+.no-record{
+  font-size: 30rpx;
+  text-align: center;
+  margin-top: 17rpx;
+  color: #b3becb
+}
+.first{
+  font-size: 30rpx;
+  color: #999;
+  line-height: 120rpx;
+  float: right;
+}

+ 281 - 0
packageMerchant/pages/merchant/logistics/logistics.js

@@ -0,0 +1,281 @@
+var _request = require('../../../../utils/request.js')
+var validator = require('../../../../utils/validator.js')
+var rid
+var fomlds = []
+Page({
+  data: {
+    order: {},
+    company: '',
+    express: '',
+    company1: '',
+    express1: '',
+    company2: '',
+    express2: '',
+    secondshow: false,
+    thirdshow: false,
+  },
+  bindCompany (e) {
+    this.setData({
+      company: e.detail.value
+    })
+  },
+  bindExpress (e) {
+    this.setData({
+      express: e.detail.value
+    })
+  },
+  bindCompany1 (e) {
+    this.setData({
+      company1: e.detail.value
+    })
+  },
+  bindExpress1 (e) {
+    this.setData({
+      express1: e.detail.value
+    })
+  },
+  bindCompany2 (e) {
+    this.setData({
+      company2: e.detail.value
+    })
+  },
+  bindExpress2 (e) {
+    this.setData({
+      express2: e.detail.value
+    })
+  },
+  onLoad: function (options) {
+    rid = options.id
+    this.getRadish()
+  },
+  onHide: function (val) {
+    this.sendFomlds()
+  },
+  getRadish () {
+    var that = this
+    var url = 'v1/merchant/order/detail/' + rid
+    var params = {
+    }
+    var success = function (res) {
+      var data = res.data
+      that.setData({
+        order: data
+      })
+      if (that.data.order.ex_company_array.length === 1 && that.data.order.ex_order_no_array.length === 1) {
+        that.setData({
+          company: data.ex_company_array[0],
+          express: data.ex_order_no_array[0]
+        })
+      } 
+      else if (that.data.order.ex_company_array.length === 2 && that.data.order.ex_order_no_array.length === 2) {
+        that.setData({
+          secondshow: true,
+          company: data.ex_company_array[0],
+          express: data.ex_order_no_array[0],
+          company1: data.ex_company_array[1],
+          express1: data.ex_order_no_array[1]
+        })
+      } 
+      else if (that.data.order.ex_company_array.length === 3 && that.data.order.ex_order_no_array.length === 3) {
+        that.setData({
+          secondshow: true,
+          thirdshow: true,
+          company: data.ex_company_array[0],
+          express: data.ex_order_no_array[0],
+          company1: data.ex_company_array[1],
+          express1: data.ex_order_no_array[1],
+          company2: data.ex_company_array[2],
+          express2: data.ex_order_no_array[2],
+        })
+      } 
+      else if (getApp().globalData.merchant) {
+        that.setData({
+          company: getApp().globalData.merchant
+        })
+      }
+    }
+    _request.$get(url, params, success)
+  },
+  setExpressRequest: function () {
+    var id = this.data.order.order_id
+    var that = this
+    var url = 'v1/merchant/order/' + id
+    var company = that.data.company
+    var express = that.data.express
+    if (that.data.secondshow === true) {
+      company = that.data.company + '/' + that.data.company1
+      express = that.data.express + '/' + that.data.express1
+    }
+    if (that.data.thirdshow === true) {
+      company = that.data.company + '/' + that.data.company1 + '/' + that.data.company2
+      express = that.data.express + '/' + that.data.express1 + '/' + that.data.express2
+    }
+    var params = {
+      express_company: company,
+      express_order_no: express,
+      status: 'dispatch'
+    }
+    var success = function (res) {
+      getApp().globalData.order = true
+      getApp().globalData.merchant = that.data.company
+      wx.navigateBack()
+    }
+    _request.$put(url, params, success)
+  },
+  putExpressRequest: function () {
+    var id = this.data.order.order_id
+    var that = this
+    var url = 'v1/merchant/order/' + id
+    var company = that.data.company
+    var express = that.data.express
+    if (that.data.secondshow === true) {
+      company = that.data.company + '/' + that.data.company1
+      express = that.data.express + '/' + that.data.express1
+    }
+    if (that.data.thirdshow === true) {
+      company = that.data.company + '/' + that.data.company1 + '/' + that.data.company2
+      express = that.data.express + '/' + that.data.express1 + '/' + that.data.express2
+    }
+    var params = {
+      express_company: company,
+      express_order_no: express
+    }
+    var success = function (res) {
+      getApp().globalData.order = true
+      getApp().globalData.merchant = that.data.company
+      wx.navigateBack()
+    }
+    _request.$put(url, params, success)
+  },
+  jstext (val) {
+    var strshow = val.indexOf('/')
+    if (strshow >= 0) {
+      return false
+    }
+    if (strshow < 0) {
+      return true
+    }
+  },
+  validate () {
+    var msg
+    if (!validator.required(this.data.company)) {
+      msg = '物流公司不能为空'
+    } else if (!validator.required(this.data.express)) {
+      msg = '物流号不能为空'
+    } else if (!this.jstext(this.data.company) || !this.jstext(this.data.express)) {
+      msg = '请不要输入"/"等特殊字符'
+    } else if (this.data.secondshow === true && !validator.required(this.data.company1)) {
+      msg = '物流公司不能为空'
+    } else if (this.data.secondshow === true && !validator.required(this.data.express1)) {
+      msg = '物流号不能为空'
+    } else if (this.data.secondshow === true && (!this.jstext(this.data.company1) || !this.jstext(this.data.express1))) {
+      msg = '请不要输入"/"等特殊字符'
+    } else if (this.data.thirdshow === true && !validator.required(this.data.company2)) {
+      msg = '物流公司不能为空'
+    } else if (this.data.thirdshow === true && !validator.required(this.data.express2)) {
+      msg = '物流号不能为空'
+    } else if (this.data.secondshow === true && (!this.jstext(this.data.company2) || !this.jstext(this.data.express2))) {
+      msg = '请不要输入"/"等特殊字符'
+    }
+    return { isOk: !msg, msg }
+  },
+  setExpress: function (e) {
+    this.formSubmit(e)
+    var { isOk, msg } = this.validate()
+    if (isOk) {
+      this.setExpressRequest()
+    } else {
+      wx.showToast({
+        title: msg,
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  },
+  putExpress: function (e) {
+    this.formSubmit(e)
+    var { isOk, msg } = this.validate()
+    if (isOk) {
+      this.putExpressRequest()
+    } else {
+      wx.showToast({
+        title: msg,
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  },
+  getqcode: function () {
+    var that = this
+    wx.scanCode({
+      success: (res) => {
+        that.setData({
+          express: res.result
+        })
+      }
+    })
+  },
+  getqcode1: function () {
+    var that = this
+    wx.scanCode({
+      success: (res) => {
+        that.setData({
+          express1: res.result
+        })
+      }
+    })
+  },
+  getqcode2: function () {
+    var that = this
+    wx.scanCode({
+      success: (res) => {
+        that.setData({
+          express2: res.result
+        })
+      }
+    })
+  },
+  formSubmit: function (e) {
+    fomlds = e.detail.formId
+    this.sendFomlds()
+  },
+  sendFomlds: function () {
+    var that = this
+    var url = 'v1/formid'
+    var params = {
+      formIds: fomlds
+    }
+    var success = function (res) {
+      console.log(res)
+    }
+    _request.$post(url, params, success)
+  },
+  pluslist () {
+    var that = this
+    if (that.data.secondshow === false) {
+      that.setData({
+        secondshow: true
+      })
+    } else {
+      that.setData({
+        thirdshow: true
+      })
+    }
+  },
+  miuslist () {
+    var that = this
+    if (that.data.secondshow === true && that.data.thirdshow === false) {
+      that.setData({
+        secondshow: false,
+        express1: '',
+        company1: '',
+      })
+    } else if (that.data.secondshow === true && that.data.thirdshow === true) {
+      that.setData({
+        thirdshow: false,
+        express2: '',
+        company2: '',
+      })
+    }
+  }
+})

+ 8 - 0
packageMerchant/pages/merchant/logistics/logistics.json

@@ -0,0 +1,8 @@
+{
+  "navigationBarTitleText": "填写物流",
+  "navigationBarBackgroundColor": "#86a7da",
+  "usingComponents": {
+    "currency": "../../../../component/currency/currency"
+  },
+  "backgroundColor": "#f3f3f3"
+}

+ 77 - 0
packageMerchant/pages/merchant/logistics/logistics.wxml

@@ -0,0 +1,77 @@
+<view class="bg">
+  <view class="logistics-top__bg">
+    <view class="logistics-top">
+      <view class="logistics-top__text">买家信息</view>
+      <image class="logistics-top__head" src="{{order.wx_user.head}}"></image>
+      <view class="logistics-top__name">{{order.wx_user.nickname}}</view>
+    </view>
+  </view>
+  <view class="orderDetail-address" wx:key="{{index}}" wx:if="{{order.status !== 'unpay' && order.status !== 'closed'}}">
+    <view class="orderDetail-address__left"></view>
+    <view class="orderDetail-address__right">
+      <view class="orderDetail-address__info">
+        <view class="orderDetail-address__name">收件人:{{order.contact}}</view>
+        <view class="orderDetail-address__tel">{{order.tel}}</view>
+        <view class="clean"></view>
+      </view>
+      <view class="orderDetail-address__more ellipsisLn">{{order.address}}</view>
+    </view>
+  </view>
+  <view class="logistics-main">
+    <view class="logistics-main__line logistics-main__border">
+      <view class="logistics-main__title">物流公司</view>
+      <input type="text" class="logistics-main__input" placeholder-class="text-placeholder" placeholder="请填写寄件物流公司名称" value="{{company}}" bindinput="bindCompany" />
+    </view>
+    <view class="logistics-main__line">
+      <view class="logistics-main__title">单号</view>
+      <view class="logistics-main__qcode" bindtap="getqcode"></view>
+      <input type="number" class="logistics-main__qcinput" placeholder-class="text-placeholder" placeholder="请填写寄件物流单号" value="{{express}}" bindinput="bindExpress" />
+    </view>
+  </view>
+
+  <view class="logistics-main" wx:if="{{secondshow}}">
+    <view class="logistics-main__line logistics-main__border">
+      <view class="logistics-main__title">物流公司</view>
+      <input type="text" class="logistics-main__input" placeholder-class="text-placeholder" placeholder="请填写寄件物流公司名称" value="{{company1}}" bindinput="bindCompany1" />
+    </view>
+    <view class="logistics-main__line">
+      <view class="logistics-main__title">单号</view>
+      <view class="logistics-main__qcode" bindtap="getqcode1"></view>
+      <input type="number" class="logistics-main__qcinput" placeholder-class="text-placeholder" placeholder="请填写寄件物流单号" value="{{express1}}" bindinput="bindExpress1" />
+    </view>
+  </view>
+  <view class="logistics-main" wx:if="{{thirdshow}}">
+    <view class="logistics-main__line logistics-main__border">
+      <view class="logistics-main__title">物流公司</view>
+      <input type="text" class="logistics-main__input" placeholder-class="text-placeholder" placeholder="请填写寄件物流公司名称" value="{{company2}}" bindinput="bindCompany2" />
+    </view>
+    <view class="logistics-main__line">
+      <view class="logistics-main__title">单号</view>
+      <view class="logistics-main__qcode" bindtap="getqcode2"></view>
+      <input type="number" class="logistics-main__qcinput" placeholder-class="text-placeholder" placeholder="请填写寄件物流单号" value="{{express2}}" bindinput="bindExpress2" />
+    </view>
+  </view>
+
+  <view class="plus-part" bindtap="pluslist" wx:if="{{!thirdshow}}">
+    <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/orderlist/lplus.png" class="plus-img" />
+    <view class="plus-text">添加物流信息</view>
+    <view class="clear"></view>
+  </view>
+  <view class="mius-part" bindtap="miuslist" wx:if="{{secondshow}}">
+    <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/orderlist/lmius.png" class="mius-img" />
+    <view class="mius-text">删减物流信息</view>
+    <view class="clear"></view>
+  </view>
+  <form bindsubmit="setExpress" report-submit="{{true}}" wx:if="{{order.status === 'processing'}}">
+    <button class="button logistics-button" formType="submit" data-id="{{item.order_id}}">
+      确认发货
+    </button>
+  </form>
+  <form bindsubmit="putExpress" report-submit="{{true}}" wx:if="{{order.status === 'dispatch'}}">
+    <button class="button logistics-button" formType="submit" data-id="{{item.order_id}}">
+      修改物流
+    </button>
+  </form>
+<!--   <view class="logistics-button" bindtap="setExpress" wx:if="{{order.status === 'processing'}}">确认发货</view>
+  <view class="logistics-button" bindtap="putExpress" wx:if="{{order.status === 'dispatch'}}">修改物流</view> -->
+</view>

+ 189 - 0
packageMerchant/pages/merchant/logistics/logistics.wxss

@@ -0,0 +1,189 @@
+.bg {
+  position: relative;
+  width: 100%;
+  min-height: 100%;
+  background-color: #f3f3f3;
+  padding-bottom: 100rpx;
+}
+form {
+  position: relative;
+}
+button::afrer {
+  border: 0;
+}
+.button {
+  border: 0;
+  margin: 0;
+  padding: 0;
+  background: 0;
+  position: static;
+}
+.logistics-top__bg {
+  width: 100%;
+  background-color: #fff;
+}
+.logistics-top {
+  height: 260rpx;
+  border-bottom: 1rpx solid #eeeeee;
+  margin: 0 20rpx;
+}
+.logistics-top__text {
+  line-height: 28rpx;
+  padding: 25rpx 0 30rpx 0;
+  font-size: 28rpx;
+  text-align: center;
+  color: #999999;
+}
+.logistics-top__head {
+  width: 88rpx;
+  height: 88rpx;
+  margin: 0 auto;
+  display: block;
+  border: 1rpx solid #cdcdcd;
+  border-radius: 100%;
+}
+.logistics-top__name {
+  font-size: 28rpx;
+  text-align: center;
+  color: #4c4c4c;
+  padding-top: 10rpx;
+}
+.orderDetail-address {
+  position: relative;
+  padding: 0 20rpx;
+  height: 195rpx;
+  color: #4c4c4c;
+  font-size: 28rpx;
+  background-color: #fff;
+}
+.orderDetail-address__left {
+  margin: 78rpx 0 0 19rpx;
+  float: left;
+  width: 33rpx;
+  height: 38rpx;
+  background-size: 100% 100%;
+  background-image: url('http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/merchant.png');
+}
+.orderDetail-address__right {
+  float: right;
+  width: 640rpx;
+}
+.orderDetail-address__info {
+  padding-top: 25rpx;
+}
+.orderDetail-address__name {
+  float: left;
+}
+.orderDetail-address__tel {
+  float: right;
+}
+.orderDetail-address__more {
+  padding-top: 20rpx;
+  -webkit-line-clamp: 2;
+  line-height: 50rpx;
+  height: 100rpx;
+}
+.orderDetail-address__border {
+  position: absolute;
+  left: 0;
+  bottom: 2rpx;
+  width: 100%;
+  height: 2rpx;
+}
+.text-placeholder {
+  color: #bbbbbb;
+}
+.logistics-main {
+  margin-top: 20rpx;
+  background-color: #fff;
+}
+.logistics-main__line {
+  position: relative;
+  padding: 0 20rpx;
+}
+.logistics-main__border {
+  border-bottom: 1rpx solid #eeeeee;
+}
+.logistics-main__title {
+  font-size: 28rpx;
+  line-height: 28rpx;
+  padding-top: 33rpx;
+  padding-bottom: 7rpx;
+  color: #4c4c4c;
+}
+.logistics-main__input {
+  line-height: 74rpx;
+  height: 74rpx;
+  padding-bottom: 25rpx;
+  color: #4c4c4c;
+  font-size: 28rpx;
+}
+.logistics-main__qcinput {
+  line-height: 74rpx;
+  height: 74rpx;
+  padding-bottom: 25rpx;
+  color: #4c4c4c;
+  font-size: 28rpx;
+  margin-right: 60rpx;
+}
+.logistics-main__qcode {
+  width: 40rpx;
+  height: 40rpx;
+  position: absolute;
+  top: 83rpx;
+  right: 24rpx;
+  background-size: 100% 100%;
+  background-image: url('http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/qcode.png');
+}
+.logistics-button {
+  position: fixed;
+  left: 0;
+  bottom: 0;
+  width: 100%;
+  height: 90rpx;
+  line-height: 90rpx;
+  font-size: 28rpx;
+  color: #fff;
+  text-align: center;
+  background: linear-gradient(to right, #74b5f3, #3171cf);
+  border-radius: 0rpx;
+  z-index: 100;
+}
+.plus-part {
+  margin-top: 48rpx;
+  margin-bottom: 148rpx;
+  display: inline-block;
+  margin-right: 15rpx;
+}
+.mius-part {
+  margin-top: 48rpx;
+  margin-left: 20rpx;
+  margin-bottom: 148rpx;
+  display: inline-block;
+}
+.plus-img {
+  display: inline-block;
+  width: 36rpx;
+  height: 36rpx;
+  float: left;
+  margin-right: 15rpx;
+  margin-left: 20rpx;
+}
+.plus-text {
+  float: left;
+  color: #3575d1;
+  font-size: 28rpx;
+}
+.mius-img {
+  display: inline-block;
+  width: 36rpx;
+  height: 36rpx;
+  float: left;
+  margin-right: 15rpx;
+  /* margin-left: 50rpx; */
+}
+.mius-text {
+  float: left;
+  color: #e45050;
+  font-size: 28rpx;
+}

+ 138 - 0
packageMerchant/pages/merchant/order/order.js

@@ -0,0 +1,138 @@
+var _request = require('../../../../utils/request.js')
+var rid
+Page({
+  data: {
+    order: {},
+    express: '',
+    refundDialog: false,
+    is_super_admin: ''
+  },
+  onLoad: function (options) {
+    rid = options.id
+    // this.setData({
+    //   is_super_admin: options.is_super_admin
+    // })
+  },
+  onShow: function () {
+    this.check()
+    this.getRadish()
+  },
+  getRadish () {
+    var that = this
+    var url = 'v1/merchant/order/detail/' + rid
+    var params = {
+    }
+    var success = function (res) {
+      var data = res.data
+      that.setData({
+        order: data
+      })
+      that.formatOrder()
+    }
+    _request.$get(url, params, success)
+  },
+  confirmPopup () {
+    var that = this
+    wx.showModal({
+      title: '提示',
+      content: '是否确认收货?',
+      success: function(res) {
+        if (res.confirm) {
+          that.confirmOrder()
+        } else if (res.cancel) {
+        }
+      }
+    })
+  },
+  check () {
+    var that = this
+    var url = 'v1/user/check'
+    var params = {
+    }
+    var success = function (res) {
+      that.setData({
+        is_super_admin: res.data.is_super_admin
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  CancelPopup () {
+    var that = this
+    wx.showModal({
+      title: '提示',
+      content: '确定取消该订单?',
+      success: function(res) {
+        if (res.confirm) {
+          that.CancelOrder()
+        } else if (res.cancel) {
+        }
+      }
+    })
+  },
+  confirmOrder: function () {
+    var id = this.data.order.order_id
+    var that = this
+    var url = 'v1/order/' + id + '/confirm'
+    var params = {
+    }
+    var success = function (res) {
+      getApp().globalData.order = true
+      wx.navigateBack()
+    }
+    _request.$put(url, params, success)
+  },
+  CancelOrder: function () {
+    var id = this.data.order.order_id
+    var that = this
+    var url = 'v1/order/' + id + '/cancel'
+    var params = {
+    }
+    var success = function (res) {
+      getApp().globalData.order = true
+      wx.navigateBack()
+    }
+    _request.$put(url, params, success)
+  },
+  refundedOrder: function () {
+    var that = this
+    var id = that.data.order.order_id
+    var url = 'v1/merchant/order/refund/' + id
+    var params = {
+    }
+    var success = function (res) {
+      getApp().globalData.order = true
+      wx.navigateBack()
+    }
+    _request.$put(url, params, success)
+  },
+  showRefundDialog () {
+    var that = this
+    that.refundDialog = !that.refundDialog
+    that.setData({
+      refundDialog: that.refundDialog
+    })
+  },
+  formatOrder: function () {
+    var id = this.data.order.express_order_no
+    var result = ''
+    for (var i = 0; i < id.length; i++) {
+      if (i%4 === 0 && i !== 0) {
+        result = result + ' '
+      }
+      result = result + id[i]
+    }
+    this.setData({
+      express: result
+    })
+  },
+  // copeOrder: function () {
+  //   var that = this
+  //   var id = this.data.order.express_order_no
+  //   wx.setClipboardData({
+  //     data: id,
+  //     success: function(res) {
+  //       that.openToast('已成功复制到剪贴板')
+  //     }
+  //   })
+  // }
+})

+ 9 - 0
packageMerchant/pages/merchant/order/order.json

@@ -0,0 +1,9 @@
+{
+  "navigationBarTitleText": "订单详情",
+  "navigationBarBackgroundColor": "#86a7da",
+  "usingComponents": {
+    "currency": "../../../../component/currency/currency",
+    "format-time": "../../../../component/formatTime/formatTime"
+  },
+  "backgroundColor": "#f3f3f3"
+}

+ 104 - 0
packageMerchant/pages/merchant/order/order.wxml

@@ -0,0 +1,104 @@
+<view class="bg">
+  <view class="order-title__bg">
+    <view class="order-title">
+      <image class="order-title__left" src="{{order.wx_user.head}}"></image>
+      <view class="order-title__name ellipsis">{{order.wx_user.nickname}}</view>
+      <view class="order-title__right">买家信息</view>
+      <view class="clean"></view>
+    </view>
+  </view>
+
+  <view class="orderDetail-address"  wx:if="{{order.status !== 'unpay' && order.status !== 'closed'}}">
+    <view class="orderDetail-address__left"></view>
+    <view class="orderDetail-address__right">
+      <view class="orderDetail-address__info">
+        <view class="orderDetail-address__name">收件人:{{order.contact}}</view>
+        <view class="orderDetail-address__tel">{{order.tel}}</view>
+        <view class="clean"></view>
+      </view>
+      <view class="orderDetail-address__more">{{order.address}}</view>
+    </view>
+    <view class="clear"></view>
+  </view>
+
+  <view class="orderDetail-express" >
+    <view class="orderDetail-express__main {{order.status === 'refunded'?'closed':''}}">
+      <view class="orderDetail-express__title">{{order.status_cn === '已退款'? '已关闭':order.status_cn}}</view>
+      <view class="orderDetail-express__val" >
+        <text>{{express}}</text>
+        <text class="orderDetail-express__com" wx:if="{{order.express_order_no}}">({{order.express_company}})</text>
+      </view>
+    </view>
+  </view>
+
+  <view class="orderDetail-project">
+    <view class="order-main">
+      <image class="order-main__left" src="{{order.product.cover}}"></image>
+      <view class="order-main__right">
+        <view class="order-info__title ellipsisLn">{{order.product.name}}</view>
+        <view class="order-info__price"><!-- {{order.product.price}}代金券 --><currency symbol="¥" value="{{order.unit_price}}" />(<currency symbol="¥" value="{{order.buy_price / order.count}}" />)</view>
+        <view class="order-info__count">x{{order.count}}</view>
+      </view>
+      <view class="clean"></view>
+    </view>
+    <view class="orderDetail-allprice">共 <text>{{order.count}}</text> 件商品 合计:<currency symbol="¥" value="{{order.unit_price * order.count}}" />(<currency symbol="¥" value="{{order.buy_price}}" />)<!-- {{order.total_price}}代金券 --></view>
+
+    <!-- <view class="orderDetail-count">
+      <view class="orderDetail-count__title">认购数量</view>
+      <view class="orderDetail-count__count">x{{order.count}}</view>
+      <view class="clean"></view>
+    </view> -->
+    <!-- <view class="orderDetail-discount">
+      <view class="orderDetail-discount__title">抵扣</view>
+      <view class="orderDetail-discount__count">-¥1000<text class="orderDetail-discount__point">(100000代金券)</text></view>
+      <view class="clean"></view>
+    </view> -->
+    <!-- <view class="orderDetail-payPrice">
+      <view class="orderDetail-payPrice__title">实际支付</view>
+      <view class="orderDetail-payPrice__count">{{order.total_price}}代金券</view>
+      <view class="clean"></view>
+    </view> -->
+  </view>
+
+  <view class="orderDetail-info">
+    <view class="orderDetail-info__line">订单编号:{{order.order_id}}</view>
+    <view class="orderDetail-info__line">创建时间:<format-time type="formatTime" value="{{order.ctime}}" ></format-time></view>
+    <view class="orderDetail-info__line">支付时间:<format-time type="formatTime" value="{{order.paied_at}}" ></format-time></view>
+    <view class="orderDetail-info__line" wx:if="{{order.dtime !== 0}}">发货时间:<format-time type="formatTime" value="{{order.dtime}}" ></format-time></view>
+    <view class="orderDetail-info__line" wx:if="{{order.dtime === 0}}">发货时间:-</view>
+  </view>
+
+  <view class="orderDetail-btnbg" wx:if="{{order.status === 'unpay' || order.status === 'processing' || order.status === 'dispatch'}}">
+    <navigator url="/packageMerchant/pages/merchant/order/order?id={{order.order_id}}" open-type="navigate">
+      <view class="orderDetail-btn__black"  wx:if="{{order.status === 'unpay'}}">查看订单</view>
+    </navigator>
+
+    <navigator url="/packageMerchant/pages/merchant/logistics/logistics?id={{order.order_id}}" open-type="navigate">
+      <view class="orderDetail-btn__red" wx:if="{{order.status === 'processing'}}">发货</view>
+    </navigator>
+
+    <navigator url="/packageMerchant/pages/merchant/logistics/logistics?id={{order.order_id}}" open-type="navigate">
+      <view class="orderDetail-btn__black" wx:if="{{order.status === 'dispatch'}}">修改物流</view>
+    </navigator>
+
+    <view class="orderDetail-btn__black" bindtap="showRefundDialog" wx:if="{{(order.status === 'processing' || order.status === 'dispatch') && is_super_admin}}">退款</view>
+  </view>
+
+  <view class="orderDetail-dialog" wx:if="{{refundDialog}}">
+    <view class="orderDetail-dialog__bg"></view>
+    <view class="orderDetail-dialog__width">
+      <view class="orderDetail-icon">
+        <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/icon/tip_icon.jpg"></image>
+      </view>
+      <view class="orderDetail-dialog__info">
+        <view>确认退款后,</view>
+        <view>代金券将直接退还至买家账户!</view>
+      </view>
+      <view class="orderDetail-dialog__btn">
+        <text bindtap="showRefundDialog">取消</text>
+        <text bindtap="refundedOrder" style="color: #eab86a;border-left: 1rpx solid #eee;">确认</text>
+      </view>
+    </view>
+  </view>
+
+</view>

+ 324 - 0
packageMerchant/pages/merchant/order/order.wxss

@@ -0,0 +1,324 @@
+.bg {
+  position: relative;
+  width: 100%;
+  min-height: 100%;
+  background-color: #f3f3f3;
+}
+.order-title {
+  margin: 0 20rpx;
+  height: 90rpx;
+  line-height: 90rpx;
+  font-size: 28rpx;
+  border-bottom: 1rpx solid #eeeeee;
+}
+.order-title__bg {
+  width: 100%;
+  height: 92rpx;
+  background-color: #fff;
+}
+.order-title__left {
+  margin-top: 20rpx;
+  display: block;
+  width: 44rpx;
+  height: 44rpx;
+  float: left;
+  border-radius: 100%;
+}
+.order-title__name {
+  float: left;
+  margin-left: 20rpx;
+  width: 375rpx;
+  color: #4c4c4c;
+  font-size: 28rpx;
+}
+.order-title__right {
+  color: #999999;
+  float: right;
+}
+.orderDetail-address {
+  position: relative;
+  padding: 0 20rpx;
+  color: #4c4c4c;
+  font-size: 28rpx;
+  background-color: #fff;
+}
+.orderDetail-address__left {
+  margin: 90rpx 0 0 19rpx;
+  float: left;
+  width: 33rpx;
+  height: 38rpx;
+  background-size: 100% 100%;
+  background-image: url('https://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/addressblue.png');
+}
+.orderDetail-address__right {
+  float: right;
+  width: 640rpx;
+}
+.orderDetail-address__info {
+  padding-top: 25rpx;
+}
+.orderDetail-address__name {
+  float: left;
+}
+.orderDetail-address__tel {
+  float: right;
+}
+.orderDetail-address__more {
+  padding-top: 20rpx;
+  padding-bottom: 20rpx;
+  line-height: 50rpx;
+}
+.orderDetail-address__border {
+  position: absolute;
+  left: 0;
+  bottom: 2rpx;
+  width: 100%;
+  height: 2rpx;
+}
+.order-main {
+  width: 710rpx;
+  height: 200rpx;
+  background-color: #fcfcfc;
+}
+.order-main__left {
+  width: 200rpx;
+  height: 200rpx;
+  display: block;
+  float: left;
+}
+.order-main__right {
+  position: relative;
+  width: 490rpx;
+  height: 200rpx;
+  float: right;
+}
+.order-info__title {
+  color: #4c4c4c;
+  padding-top: 5rpx;
+  font-size: 24rpx;
+  line-height: 36rpx;
+  height: 72rpx;
+  -webkit-line-clamp: 2;
+}
+.order-info__type {
+  padding-top: 12rpx;
+  font-size: 24rpx;
+  color: #bbbbbb;
+}
+.order-info__price {
+  position: absolute;
+  bottom: 16rpx;
+  left: 0;
+  font-size: 24rpx;
+  color: #bbb;
+}
+.order-info__point {
+  color: #bbbbbb;
+}
+.order-info__count {
+  position: absolute;
+  bottom: 16rpx;
+  right: 0;
+  font-size: 28rpx;
+  color: #eab86a;
+}
+.orderDetail-project {
+  padding: 20rpx;
+  background-color: #fff;
+}
+.orderDetail-count {
+  padding-top: 50rpx;
+  line-height: 48rpx;
+  font-size: 28rpx;
+}
+.orderDetail-count__title {
+  color: #4c4c4c;
+  float: left;
+}
+.orderDetail-count__count {
+  color: #4c4c4c;
+  float: right;
+}
+.orderDetail-discount {
+  line-height: 48rpx;
+  font-size: 28rpx;
+}
+.orderDetail-discount__title {
+  color: #4c4c4c;
+  float: left;
+}
+.orderDetail-discount__count {
+  color: #eab86a;
+  float: right;
+}
+.orderDetail-discount__point {
+  color: #bbbbbb;
+}
+.orderDetail-payPrice {
+  line-height: 80rpx;
+}
+.orderDetail-payPrice__title {
+  float: left;
+  font-size: 28rpx;
+  color: #eab86a;
+}
+.orderDetail-payPrice__count {
+  float: right;
+  color: #eab86a;
+  font-size: 32rpx;
+}
+.orderDetail-info {
+  padding: 30rpx 20rpx;
+  background-color: #ffffff;
+  margin-top: 16rpx;
+}
+.orderDetail-info__line {
+  line-height: 42rpx;
+  color: #bbbbbb;
+  font-size: 24rpx;
+}
+.orderDetail-btnbg {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  width: 100%;
+  height: 88rpx;
+  background-color: #fff;
+  border-top: 1rpx solid #dddddd;
+}
+.orderDetail-btn__red {
+  width: 158rpx;
+  height: 58rpx;
+  border: 1rpx solid #eab86a;
+  font-size: 28rpx;
+  color: #eab86a;
+  text-align: center;
+  line-height: 58rpx;
+  border-radius: 5rpx;
+  margin-right: 20rpx;
+  margin-top: 14rpx;
+  float: right;
+}
+.orderDetail-btn__black {
+  width: 158rpx;
+  height: 58rpx;
+  border: 1rpx solid #cccccc;
+  font-size: 28rpx;
+  color: #4c4c4c;
+  text-align: center;
+  line-height: 58rpx;
+  border-radius: 5rpx;
+  margin-right: 20rpx;
+  margin-top: 14rpx;
+  float: right;
+}
+.orderDetail-express {
+  background-color: #fff;
+  margin: 20rpx 0;
+  padding: 20rpx 0;
+}
+.orderDetail-express__main {
+  background-color: #fffae4;
+  margin: 0 20rpx;
+  padding-bottom: 27rpx;
+}
+.orderDetail-express__main.closed {
+  background-color: #eeeeee;
+  border: 1rpx solid #ccc;
+  box-sizing: border-box;
+}
+.orderDetail-express__main.closed .orderDetail-express__title {
+  color: #999999;
+}
+.orderDetail-express__title {
+  text-align: center;
+  font-size: 28rpx;
+  color: #f7ae87;
+  padding: 28rpx 0 16rpx;
+}
+.orderDetail-express__val {
+  color: #5b93c3;
+  text-align: center;
+  font-size: 28rpx;
+  font-weight: bold;
+}
+.orderDetail-express__btn {
+  width: 88rpx;
+  height: 40rpx;
+  border: 1rpx solid #f7ae87;
+  text-align: center;
+  margin: 16rpx auto 0;
+  line-height: 40rpx;
+  font-size: 24rpx;
+  color: #f7ae87;
+  border-radius: 5rpx;
+}
+.orderDetail-express__com {
+  padding-left: 5rpx;
+}
+.orderDetail-allprice {
+  padding-top: 20rpx;
+  height: 70rpx;
+  line-height: 70rpx;
+  text-align: right;
+  color: #4c4c4c;
+  font-size: 24rpx;
+}
+.orderDetail-allprice text {
+  color: #eab86a;
+  font-size: 28rpx;
+}
+.orderDetail-dialog {
+  position: relative;
+  width: 100%;
+}
+.orderDetail-dialog__bg {
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  min-height: 100%;
+  background: rgba(0, 0, 0, 0.3);
+  z-index: 1;
+}
+.orderDetail-dialog__width {
+  position: fixed;
+  top: 20%;
+  left: 50%;
+  width: 560rpx;
+  margin-left: -280rpx;
+  border-radius: 16rpx;
+  background-color: #fff;
+  z-index: 100;
+}
+.orderDetail-icon {
+  width: 114rpx;
+  height: 114rpx;
+  margin: 64rpx auto 34rpx;
+}
+.orderDetail-icon image {
+  width: 100%;
+  height: 100%;
+}
+.orderDetail-dialog__info {
+  text-align: center;
+  line-height: 48rpx;
+  font-size: 28rpx;
+  color: #4c4c4c;
+  margin-bottom: 40rpx;
+}
+.orderDetail-dialog__btn {
+  width: 100%;
+  height: 100rpx;
+  text-align: center;
+  border-top: 1rpx solid #eee;
+  font-size: 24rpx;
+  color: #4c4c4c;
+  box-sizing: border-box;
+}
+.orderDetail-dialog__btn text {
+  display: inline-block;
+  width: 49%;
+  line-height: 100rpx;
+  box-sizing: border-box;
+}

+ 316 - 0
packageMerchant/pages/merchant/orders/orders.js

@@ -0,0 +1,316 @@
+var _request = require('../../../../utils/request.js')
+var id
+var fomlds = ''
+var arr = []
+// var start = 0
+// var end = 10
+Page({
+  data: {
+    tabLeft: '0%',
+    type: 'processing',
+    page: 1,
+    per_page: 10,
+    start : 0,
+    end : 10,
+    list: [],
+    more: true,
+    tabChange: false,
+    contact: '',
+    is_super_admin: '',
+    laststart: '',
+    lastend: '',
+    atrue: false,
+    bcount: 1,
+    sum: 1,
+    loading: false
+  },
+  onLoad: function (options) {
+    id = options.id
+    this.getOrderList()
+    this.setData({
+      is_super_admin: options.is_super_admin
+    })
+    console.log(options)
+  },
+  onShow () {
+    wx.hideNavigationBarLoading()
+    if (getApp().globalData.order) {
+      this.typeList()
+      getApp().globalData.order = false
+    }
+  },
+  onHide: function (val) {
+    this.sendFomlds()
+  },
+  bindContact (e) {
+    this.setData({
+      contact: e.detail.value
+    })
+  },
+  tabProcessing: function () {
+    if (this.data.type !== 'processing') {
+      this.setData({
+        tabLeft: '0%',
+        type: 'processing',
+        more: true,
+        page: 1,
+        tabChange: true
+      })
+      this.getOrderList()
+    }
+  },
+  tabDispatch: function () {
+    if (this.data.type !== 'dispatch') {
+      this.setData({
+        tabLeft: '25%',
+        type: 'dispatch',
+        more: true,
+        page: 1,
+        tabChange: true
+      })
+      this.getOrderList()
+    }
+  },
+  tabComplete: function () {
+    if (this.data.type !== 'complete') {
+      this.setData({
+        tabLeft: '50%',
+        type: 'complete',
+        more: true,
+        page: 1,
+        tabChange: true
+      })
+      this.getOrderList()
+    }
+  },
+  tabClosed () {
+    if (this.data.type !== 'closed') {
+      this.setData({
+        tabLeft: '75%',
+        type: 'refunded',
+        more: true,
+        page: 1,
+        tabChange: true
+      })
+      this.getOrderList()
+    }
+  },
+  getContactList () {
+    this.setData({
+      list: [],
+      more: true,
+      page: 1
+    })
+    this.getOrderList()
+  },
+  getOrderList () {
+    var that = this
+    var url = 'v1/merchant/orders'
+    var params = {
+      contact: this.data.contact,
+      merchant_id: id,
+      status: this.data.type,
+      page: this.data.page,
+      per_page: this.data.per_page,
+    }
+    var success = function (res) {
+      if (that.data.tabChange) {
+        that.setData({
+          list: [],
+          tabChange: false,
+          start : 0,
+          end : 10,
+          page: 1,
+          per_page: 10,
+          bcount: 1
+        })
+        arr = []
+      }
+      // 新代码
+      arr = arr.concat(res.data.list || [])
+      if (that.data.page === 1) {
+        var sum = Math.ceil(res.data.list_count / that.data.per_page)
+        that.setData({
+          list: res.data.list,
+          sum: sum
+        })
+      } else {
+        that.setData({
+          list: res.data.list
+        })
+      }
+      // 旧代码
+      // var result = arr.concat(res.data.list || [])
+      // arr = result
+      // var sum1
+      // if (res.data.list_count % 10 >= 1) {
+      //   sum1 = parseInt(res.data.list_count / 10) + 1
+      //   if (sum1 < 10) {
+      //     sum1 = '0' + sum1
+      //   }
+      // } else {
+      //   sum1 = parseInt(res.data.list_count / 10)
+      //   if (sum1 < 10) {
+      //     sum1 = '0' + sum1
+      //   }
+      // }
+      // var arr1 = arr.slice(that.data.start,that.data.end) 
+      // that.setData({
+      //   list: arr1,
+      //   sum: sum1
+      // })
+      var listMore = res.data.list_count > arr.length
+      wx.hideLoading()
+      that.setData({
+        more: listMore,
+        loading: false
+      })
+    }
+    var fail = function () {
+      wx.hideLoading()
+      that.setData({
+        loading: false
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  typeList: function () {
+    this.setData({
+      more: true,
+      page: 1,
+      tabChange: true
+    })
+    this.getOrderList()
+  },
+  toOrder: function (e) {
+    this.formSubmit(e)
+    wx.navigateTo({
+      url: '/packageMerchant/pages/merchant/order/order?id=' + e.detail.target.dataset.id + '&is_super_admin=' + this.data.is_super_admin
+    })
+  },
+  toSend: function (e) {
+    this.formSubmit(e)
+    wx.navigateTo({
+      url: '/packageMerchant/pages/merchant/logistics/logistics?id=' + e.detail.target.dataset.id
+    })
+  },
+  toUpdate: function (e) {
+    this.formSubmit(e)
+    wx.navigateTo({
+      url: '/packageMerchant/pages/merchant/logistics/logistics?id=' + e.detail.target.dataset.id
+    })
+  },
+  formSubmit: function (e) {
+    fomlds = e.detail.formId
+    this.sendFomlds()
+  },
+  sendFomlds: function () {
+    var that = this
+    var url = 'v1/formid'
+    var params = {
+      formIds: fomlds
+    }
+    var success = function (res) {
+    }
+    _request.$post(url, params, success)
+  },
+  copeOrder: function (e) {
+    var item = e.currentTarget.dataset.item
+    var text = item.contact + ' ' + item.tel + ' ' + item.address
+    wx.setClipboardData({
+      data: text,
+      success: function(res) {
+        wx.showToast({
+          title: '已成功复制到剪贴板',
+          icon: 'none',
+          duration: 2000
+        })
+      }
+    })
+  },
+  prev () {
+    if (this.data.page > 1) {
+      var page = this.data.page - 1
+      this.setData({
+        page: page,
+        list: arr.slice((page - 1) * this.data.per_page, page * this.data.per_page)
+      })
+    } else {
+      wx.showToast({
+        title: '当前为第一页',
+        icon: 'none',
+        duration: 2000
+      })
+    }
+    // if (this.data.page > 1) {
+    //   var start1 = this.data.start - 10
+    //   var end1 = this.data.end - 10
+    //   var arr2 = arr.slice(start1,end1)
+    //   var page = this.data.page - 1
+    //   this.setData({
+    //     start: start1,
+    //     end: end1,
+    //     list: arr2,
+    //     page: page,
+    //     atrue: true
+    //   })
+    // }
+  },
+  next () {
+    if (!this.data.loading) {
+      if (this.data.page < this.data.sum) {
+        var page = this.data.page + 1
+        console.log(arr.length)
+        if (arr.length >= page * this.data.per_page || !this.data.more) {
+          this.setData({
+            page: page,
+            list: arr.slice((page - 1) * this.data.per_page, page * this.data.per_page)
+          })
+        } else {
+          this.setData({
+            page: page
+          })
+          if (!this.data.loading) {
+            this.setData({
+              loading: true
+            })
+            wx.showLoading()
+            this.getOrderList()
+          }
+        }
+      } else {
+        wx.showToast({
+          title: '已经是最后一页',
+          icon: 'none',
+          duration: 2000
+        })
+      }
+    }
+    // if (this.data.more) {
+    //   if (this.data.atrue == true && this.data.page !== this.data.bcount ) {
+    //     var start3 = this.data.start + 10
+    //     var end3 = this.data.end + 10
+    //     var page = this.data.page + 1
+    //     var arr3 = arr.slice(start3,end3)
+    //     this.setData({
+    //       start: start3,
+    //       end: end3,
+    //       list: arr3,
+    //       page: page
+    //     })
+    //     console.log(this.data.list)
+    //   } else {
+    //     var start = this.data.start + 10
+    //     var end = this.data.end + 10
+    //     var page = this.data.page + 1
+    //     this.setData({
+    //       page: page,
+    //       start: start,
+    //       end: end
+    //     })
+    //     this.data.bcount += 1
+    //     this.getOrderList()
+    //   }
+    // }
+  }
+})

+ 9 - 0
packageMerchant/pages/merchant/orders/orders.json

@@ -0,0 +1,9 @@
+{
+  "navigationBarTitleText": "订单管理",
+  "navigationBarBackgroundColor": "#86a7da",
+  "usingComponents": {
+    "currency": "../../../../component/currency/currency",
+    "format-time": "../../../../component/formatTime/formatTime"
+  },
+  "backgroundColor": "#f3f3f3"
+}

+ 104 - 0
packageMerchant/pages/merchant/orders/orders.wxml

@@ -0,0 +1,104 @@
+<view class="bg">
+  <view style="height: 1rpx;"></view>
+  <view class="orders-tabs">
+    <view class="orders-tab" bindtap="tabProcessing">待发货</view>
+    <view class="orders-tab" bindtap="tabDispatch">已发货</view>
+    <view class="orders-tab" bindtap="tabComplete">已完成</view>
+    <view class="orders-tab" bindtap="tabClosed">已退款</view>
+    <view class="clean"></view>
+    <view class="orders-tab__border" style="left: {{tabLeft}}"></view>
+  </view>
+
+  <input class="orders-input" placeholder="按用户名搜索" placeholder-style="color: #6e9dd4;" bindinput="bindContact" bindconfirm="getContactList" />
+
+  <view class="orders-main">
+    <view class="order" wx:for="{{list}}" wx:key="{{index}}">
+      <view class="order-title">
+        <view class="order-title__name ellipsis">{{item.order_id}}</view>
+        <view class="order-title__right"><format-time type="formatTime" value="{{item.paied_at}}" ></format-time></view>
+        <view class="clean"></view>
+      </view>
+
+      <navigator url="/packageMerchant/pages/merchant/order/order?id={{item.order_id}}" open-type="navigate">
+        <view class="order-main">
+          <image class="order-main__left" src="{{item.product.cover}}"></image>
+          <view class="order-main__right">
+            <view class="order-info__title ellipsisLn">{{item.product.name}}</view>
+            <!-- <view class="order-info__type ellipsis">{{item.product.detail}}</view> -->
+            <view class="order-info__price"><currency symbol="¥" value="{{item.unit_price}}" />(<currency symbol="¥" value="{{item.buy_price / item.count}}" />)<!-- <currency symbol="¥" value="{{item.product.price}}" ></currency><text class="order-info__point">(或{{item.product.price}}代金券)</text> --></view>
+            <view class="order-info__count">x{{item.count}}</view>
+          </view>
+          <view class="clean"></view>
+        </view>
+      </navigator>
+
+      <view class="order-allprice">共 <text>{{item.count}}</text> 件商品 合计:<currency symbol="¥" value="{{item.unit_price * item.count}}" />(<currency symbol="¥" value="{{item.buy_price}}" />)</view>
+
+      <view class="address">
+        <view class="address-top">
+          <!-- <image class="address-head" src="{{item.wx_user.head}}"></image> -->
+          <view class="address-userInfo">
+            <view class="address-name ellipsis">{{item.contact}}</view>
+            <view class="address-texttel ellipsis">{{item.tel}}</view>
+            <view class="clean"></view>
+          </view>
+          
+          <view class="address-cope" bindtap="copeOrder" data-item="{{item}}">复制</view>
+          <view class="clean"></view>
+        </view>
+
+        <view class="address-main">
+          <!-- <view class="address-left"></view>
+          <view class="address-right">
+            <view class="address-text">
+              <view class="address-textname esllipsis">{{item.contact}}</view>
+              <view class="address-texttel ellipsis">{{item.tel}}</view>
+              <view class="clean"></view>
+            </view>
+            <view class="address-more ellipsisLn">{{item.address}}</view>
+          </view> -->
+          <image class="address-icon" src="https://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/addressblue.png"></image>
+          <text class="address-more ellipsisLn">{{item.address}}</text>
+          <view class="clean"></view>
+        </view>
+
+      </view>
+
+      <view class="order-btn">
+<!--         <navigator url="/packageMerchant/pages/merchant/order/order?id={{item.order_id}}" open-type="navigate">
+          <view class="order-btn__black" >查看订单</view>
+        </navigator> -->
+        <form bindsubmit="toOrder" report-submit="{{true}}" >
+          <button class="button order-btn__black" formType="submit" data-id="{{item.order_id}}">
+            更多详情
+          </button>
+        </form>
+<!--         <navigator url="/packageMerchant/pages/merchant/logistics/logistics?id={{item.order_id}}" open-type="navigate">
+          <view class="order-btn__red" wx:if="{{item.status === 'processing'}}">发货</view>
+        </navigator> -->
+        <form bindsubmit="toSend" report-submit="{{true}}" wx:if="{{item.status === 'processing'}}">
+          <button class="button order-btn__red" formType="submit" data-id="{{item.order_id}}">
+            发货
+          </button>
+        </form>
+<!--         <navigator url="/packageMerchant/pages/merchant/logistics/logistics?id={{item.order_id}}" open-type="navigate">
+          <view class="order-btn__black" wx:if="{{item.status !== 'dispatch'}}">修改物流</view>
+        </navigator> -->
+        <form bindsubmit="toUpdate" report-submit="{{true}}" wx:if="{{item.status === 'dispatch'}}">
+          <button class="button order-btn__black" formType="submit" data-id="{{item.order_id}}">
+            修改物流
+          </button>
+        </form>
+      </view>
+    </view>
+    <view class="orders-no" wx:if="{{list.length <= 0}}">
+      <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/unorders.png" class="orders-no__icon"></image>
+      <view class="orders-no__text">还没有订单信息</view>
+    </view>
+  </view>
+  <view class="orders-bottom">
+    <view class="orders-prev" bindtap="prev">上一页</view>
+    <view class="orders-center">{{page > 9 ? page : '0' + page }}/{{sum > 9 ? sum : '0' + sum}}</view>
+    <view class="orders-next" bindtap="next">下一页</view>
+  </view>
+</view>

+ 340 - 0
packageMerchant/pages/merchant/orders/orders.wxss

@@ -0,0 +1,340 @@
+.bg {
+  position: relative;
+  width: 100%;
+  min-height: 100%;
+  background-color: #f3f3f3;
+}
+form {
+  position: relative;
+}
+button::afrer {
+  border: 0;
+}
+.button {
+  border: 0;
+  margin: 0;
+  padding: 0;
+  background: 0;
+  position: static;
+}
+.orders-main {
+  padding-top: 26rpx;
+  padding-bottom: 100rpx;
+}
+.order {
+  padding: 0 20rpx;
+  background-color: #fff;
+  margin-bottom: 20rpx;
+}
+.orders-tabs {
+  position: fixed;
+  top: -1rpx;
+  left: 0rpx;
+  width: 100%;
+  height: 91rpx;
+  background-color: #fff;
+  border-bottom: 1rpx solid #dddddd;
+  z-index: 99999;
+}
+.orders-tab {
+  width: 25%;
+  height: 90rpx;
+  float: left;
+  line-height: 90rpx;
+  text-align: center;
+  font-size: 28rpx;
+  color: #4c4c4c;
+}
+.orders-tab__border {
+  position: absolute;
+  width: 25%;
+  height: 4rpx;
+  bottom: 0;
+  background-color: #86a7da;
+  transition: left 0.4s;
+  -webkit-transition: left 0.4s;
+}
+.order-title {
+  height: 90rpx;
+  line-height: 90rpx;
+  font-size: 28rpx;
+}
+.order-title__left {
+  margin-top: 20rpx;
+  display: block;
+  width: 44rpx;
+  height: 44rpx;
+  float: left;
+  border-radius: 100%;
+}
+.order-title__name {
+  float: left;
+  width: 375rpx;
+  color: #999999;
+  font-size: 28rpx;
+}
+.order-title__right {
+  color: #999999;
+  float: right;
+}
+.order-main {
+  width: 710rpx;
+  height: 200rpx;
+  background-color: #fcfcfc;
+}
+.order-main__left {
+  width: 200rpx;
+  height: 200rpx;
+  display: block;
+  float: left;
+  
+}
+.order-main__right {
+  position: relative;
+  width: 490rpx;
+  height: 200rpx;
+  float: right;
+}
+.order-info__title {
+  color: #4c4c4c;
+  font-size: 24rpx;
+  line-height: 36rpx;
+  padding-top: 5rpx;
+  height: 72rpx;
+  -webkit-line-clamp: 2;
+}
+.order-info__type {
+  padding-top: 12rpx;
+  font-size: 24rpx;
+  color: #bbbbbb;
+}
+.order-info__price {
+  position: absolute;
+  bottom: 16rpx;
+  left: 0;
+  font-size: 24rpx;
+  color: #bbb;
+}
+.order-info__point {
+  color: #bbbbbb;
+}
+.order-info__count {
+  position: absolute;
+  bottom: 16rpx;
+  right: 0;
+  font-size: 28rpx;
+  color: #eab86a;
+}
+.order-allprice {
+  padding-top: 20rpx;
+  height: 70rpx;
+  line-height: 70rpx;
+  text-align: right;
+  color: #4c4c4c;
+  font-size: 24rpx;
+  border-bottom: 1rpx solid #eeeeee;
+}
+.order-allprice text {
+  color: #eab86a;
+  font-size: 28rpx;
+}
+.order-btn {
+  height: 108rpx;
+}
+.order-btn__black {
+  float: right;
+  width: 158rpx;
+  height: 58rpx;
+  border: 1rpx solid #cccccc;
+  font-size: 28rpx;
+  color: #4c4c4c;
+  text-align: center;
+  line-height: 58rpx;
+  margin-top: 20rpx;
+  margin-left: 20rpx;
+  border-radius: 5rpx;
+}
+.order-btn__red {
+  float: right;
+  width: 158rpx;
+  height: 58rpx;
+  border: 1rpx solid #eab86a;
+  font-size: 28rpx;
+  color: #eab86a;
+  text-align: center;
+  line-height: 58rpx;
+  margin-top: 20rpx;
+  margin-left: 20rpx;
+  border-radius: 5rpx;
+}
+.orders-no {
+  padding-top: 250rpx;
+}
+.orders-no__icon {
+  display: block;
+  width: 204rpx;
+  height: 258rpx;
+  margin: 0 auto;
+}
+.orders-no__text {
+  text-align: center;
+  font-size: 28rpx;
+  margin-top: 25rpx;
+  color: #cccccc;
+}
+.address {
+  padding-top: 30rpx;
+  padding-bottom: 30rpx;
+  border-bottom: 1rpx solid #eeeeee;
+}
+.address-top {
+  width: 100%;
+  padding-left: 56rpx;
+  box-sizing: border-box;
+}
+.address-head {
+  width: 42rpx;
+  height: 42rpx;
+  float: left;
+  border-radius: 100%;
+  margin-top: 20rpx;
+}
+.address-userInfo {
+  float: left;
+  width: 300rpx;
+  font-size: 28rpx;
+  color: #4c4c4c;
+}
+.address-name {
+  width: 300rpx;
+  line-height: 44rpx;
+  font-size: 28rpx;
+  color: #4c4c4c;
+}
+.address-cope {
+  float: right;
+  width: 160rpx;
+  height: 48rpx;
+  line-height: 48rpx;
+  text-align: center;
+  margin-top: 10rpx;
+  font-size: 24rpx;
+  color: #b9c9e2;
+  border: 1rpx solid #b9c9e2;
+}
+.address-icon {
+  float: left;
+  display: block;
+  width: 32rpx;
+  height: 38rpx;
+  margin-right: 24rpx;
+}
+.address-right {
+  float: right;
+  width: 652rpx;
+}
+.address-text {
+  width: 100%;
+  line-height: 40rpx;
+  font-size: 28rpx;
+  color: #4c4c4c;
+}
+.address-textname {
+  float: left;
+  width: 335rpx;
+}
+.address-main {
+  width: 100%;
+  margin-top: 20rpx;
+}
+.address-texttel {
+  width: 250rpx;
+}
+.address-more {
+  -webkit-line-clamp: 2;
+  font-size: 28rpx;
+  color: #4c4c4c;
+}
+.orders-input {
+  display: block;
+  margin: 110rpx 20rpx 0;
+  background-color: #fff;
+  width: 710rpx;
+  height: 80rpx;
+  line-height: 80rpx;
+  text-align: center;
+  font-size: 28rpx;
+  color: #4c4c4c;
+}
+.orders-bottom {
+  height: 100rpx;
+  background: #ffffff;
+  display: flex;
+  width: 100%;
+  justify-content: space-around;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  z-index: 999;
+  border-top: 1rpx solid #cccccc;
+}
+.orders-prev {
+  height: 62rpx;
+  width: 198rpx;
+  text-align: center;
+  line-height: 62rpx;
+  border: #cccccc solid 1rpx;
+  border-radius: 10rpx;
+  color: #5a8dd2;
+  margin-top: 18rpx;
+  font-size: 28rpx;
+  /* flex: 0.5; */
+}
+.orders-prev1 {
+  height: 62rpx;
+  width: 198rpx;
+  text-align: center;
+  line-height: 62rpx;
+  border: #cccccc solid 1rpx;
+  border-radius: 10rpx;
+  color: #999;
+  margin-top: 18rpx;
+  font-size: 28rpx;
+  /* flex: 0.5; */
+}
+.orders-center {
+  background: #eeeeee;
+  height: 62rpx;
+  width: 198rpx;
+  text-align: center;
+  line-height: 62rpx;
+  border-radius: 10rpx;
+  /* color: #5a8dd2; */
+  font-size: 28rpx;
+  margin-top: 19rpx;
+  /* flex: 0.5; */
+}
+.orders-next {
+  height: 62rpx;
+  width: 198rpx;
+  text-align: center;
+  line-height: 62rpx;
+  border: #cccccc solid 1rpx;
+  border-radius: 10rpx;
+  color: #5a8dd2;
+  margin-top: 18rpx;
+  font-size: 28rpx;
+  /* flex: 0.5; */
+}
+.orders-next1 {
+  height: 62rpx;
+  width: 198rpx;
+  text-align: center;
+  line-height: 62rpx;
+  border: #cccccc solid 1rpx;
+  border-radius: 10rpx;
+  color: #999;
+  margin-top: 18rpx;
+  font-size: 28rpx;
+  /* flex: 0.5; */
+}

+ 89 - 0
packageUser/pages/user/address/address.js

@@ -0,0 +1,89 @@
+var _request = require('../../../../utils/request.js')
+var _handle = require('../../../../utils/handle.js')
+Page({
+  data: {
+    addressList: []
+  },
+  onLoad: function (options) {
+  },
+  onShow () {
+    this.getAddressList()
+  },
+  getAddressList () {
+    var that = this
+    var url = 'v1/address'
+    var params = {
+    }
+    var success = function (res) {
+      that.setData({
+        addressList: res.data
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  delAddress (val) {
+    var that = this
+    var id = val.currentTarget.dataset.val
+    wx.showModal({
+      title: '提示',
+      content: '确定删除该地址?',
+      success: function(res) {
+        if (res.confirm) {
+          that.delAddressReques(id)
+        } else if (res.cancel) {
+        }
+      }
+    })
+  },
+  delAddressReques (val) {
+    var id = val
+    var that = this
+    var url = 'v1/address/' + id
+    var params = {
+    }
+    var success = function (res) {
+      that.getAddressList()
+      wx.showToast({
+        title: '删除地址成功',
+        icon: 'none',
+        duration: 2000
+      })
+    }
+    _request.$del(url, params, success)
+  },
+  defaultAddress (val) {
+    var id = val.currentTarget.dataset.val
+    var that = this
+    var url = 'v1/address/' + id + '/default'
+    var params = {
+    }
+    var success = function (res) {
+    	wx.setStorageSync('use_address', false) //存入地址
+      wx.navigateBack({
+        delta: 1
+      })
+      that.getAddressList()
+    }
+    _request.$put(url, params, success)
+  },
+  setAddress(val){
+  	console.log(val)
+  	var index = val.currentTarget.dataset.index;
+  	console.log('addressindex',index);
+  	wx.setStorageSync('use_address', this.data.addressList[index]) //存入地址
+  	wx.navigateBack({
+        delta: 1
+    })
+  },
+  addAddress (e) {
+    _handle.setFormId(e)
+    wx.navigateTo({
+      url: '/packageUser/pages/user/newAddress/newAddress'
+    })
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_address'
+    })
+  }
+})

+ 4 - 0
packageUser/pages/user/address/address.json

@@ -0,0 +1,4 @@
+{
+  "navigationBarTitleText": "收货地址",
+  "backgroundColor": "#f3f3f3"
+}

+ 38 - 0
packageUser/pages/user/address/address.wxml

@@ -0,0 +1,38 @@
+<view class="bg">
+  <view style="height: 20rpx;"></view>
+  <view class="address" wx:key="{{index}}" wx:for="{{addressList}}" wx:for-index="index">
+    <view class="address-info" bindtap="setAddress" data-index="{{index}}">
+      <view>
+        <view class="address-name ellipsis">{{item.contact}}</view>
+        <view class="address-tel">{{item.tel}}</view>
+        <view class="clean"></view>
+      </view>
+      <view class="address-more ellipsisLn">
+        <text class="address-province">{{item.province}}</text>
+        <text class="address-province">{{item.city}}</text>
+        <text class="address-province">{{item.district}}</text>
+        {{item.address}}
+      </view>
+    </view>
+    <view class="address-handle">
+      <view class="address-default" data-val="{{item.id}}" bindtap="defaultAddress">
+        <image class="address-default__icon" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/address.png" wx:if="{{item.state === 1}}"></image>
+        <view class="address-default__no" wx:if="{{item.state !== 1}}"></view>
+        <view class="address-default__text">选用并设为默认地址</view>
+        <view class="clean"></view>
+      </view>
+      <view class="address-del">
+        <image class="address-del__icon" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/addressdel.png"></image>
+        <view class="address-del__text" data-val="{{item.id}}" bindtap="delAddress">删除</view>
+        <view class="clean"></view>
+      </view>
+      <view class="clean"></view>
+    </view>
+  </view>
+  <view style="height: 90rpx;"></view>
+  <form bindsubmit="addAddress" report-submit="{{true}}" class="address-form">
+    <button formType="submit" class="address-btn">
+      添加收货地址
+    </button>
+  </form>
+</view>

+ 92 - 0
packageUser/pages/user/address/address.wxss

@@ -0,0 +1,92 @@
+.bg {
+  position: relative;
+  width: 100%;
+  min-height: 100%;
+  background-color: #f3f3f3;
+}
+.address {
+  padding: 20rpx 20rpx 0;
+  background-color: #fff;
+  font-size: 28rpx;
+  margin-bottom: 20rpx;
+}
+.address-info {
+  height: 140rpx;
+  color: #4c4c4c;
+  border-bottom: 1px solid #eeeeee;
+}
+.address-name {
+  float: left;
+  width: 450rpx;
+}
+.address-tel {
+  float: right;
+}
+.address-province {
+  margin-right: 10rpx;
+}
+.address-more {
+  margin-top: 16rpx;
+  -webkit-line-clamp: 2;
+}
+.address-handle {
+  height: 80rpx;
+  line-height: 80rpx;
+}
+.address-default {
+  float: left;
+  height: 80rpx;
+}
+.address-default__icon {
+  float: left;
+  display: block;
+  width: 44rpx;
+  height: 44rpx;
+  margin-top: 18rpx;
+  margin-right: 10rpx;
+}
+.address-default__no {
+  float: left;
+  width: 43rpx;
+  height: 43rpx;
+  margin-top: 18rpx;
+  margin-right: 10rpx;
+  border: 1px solid #dddddd;
+  border-radius: 3rpx;
+  background-color: #f3f3f3;
+}
+.address-default__text {
+  float: left;
+}
+.address-del {
+  float: right;
+  height: 80rpx;
+}
+.address-del__icon {
+  float: left;
+  display: block;
+  margin-top: 26rpx;
+  margin-right: 10rpx;
+  width: 28rpx;
+  height: 28rpx;
+}
+.address-del__text {
+  float: left;
+  color: #bbbbbb;
+}
+.address-form {
+  position: fixed;
+  left: 0;
+  bottom: 0;
+  width: 100%;
+  height: 90rpx;
+}
+.address-btn {
+  width: 100%;
+  height: 100%;
+  background-color: #eab86a;
+  color: #fff;
+  line-height: 90rpx;
+  text-align: center;
+  font-size: 28rpx;
+}

+ 83 - 0
packageUser/pages/user/bankinfo/bankinfo.js

@@ -0,0 +1,83 @@
+var _request = require('../../../../utils/request.js')
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+  	has_bank:false,
+    account_name: '',
+    bank_name: '',
+    bank_account: '',
+    bankInfo:{}
+  },
+  /**
+   * 生命周期函数--监听页面加载
+   */
+  onLoad: function (options) {
+//  this.checkCertified()
+		this.getBankInfo();
+  },
+  accountName (e) {
+    console.log(e)
+    var that = this
+    that.setData({
+      account_name: e.detail.value
+    })
+  },
+  bankName (e) {
+    console.log(e)
+    var that = this
+    that.setData({
+      bank_name: e.detail.value
+    })
+  },
+  bankAccount (e) {
+    console.log(e)
+    var that = this
+    that.setData({
+      bank_account: e.detail.value
+    })
+  },
+	confirmClick () {
+	    var that = this
+	    var url = 'v1/user/save_card'
+	    var params = {
+	      account_name: that.data.account_name,
+		    bank_name: that.data.bank_name,
+		    bank_account: that.data.bank_account
+	    }
+	    var success = function (res) {
+	      if (res.data) {
+	        wx.showToast({
+	          title: '银行卡绑定成功~',
+	          icon: 'none',
+	          duration: 2000
+	        })
+	        that.getBankInfo()
+	      }
+	    }
+	    _request.$post(url, params, success)
+	},
+  getBankInfo(){
+  	var that = this
+    var url = 'v1/user/get_bank_info'
+    var params = {
+    }
+    var success = function (res) {
+      	that.setData({
+        	account_name: res.data.account_name,
+			    bank_name: res.data.bank_name,
+			    bank_account: res.data.bank_account,
+			    bankInfo:res.data,
+			    has_bank:res.data.has_bank
+        })
+    }
+    _request.$get(url, params, success)
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_identity'
+    })
+  }
+})

+ 4 - 0
packageUser/pages/user/bankinfo/bankinfo.json

@@ -0,0 +1,4 @@
+{
+  "navigationBarTitleText": "银行信息",
+  "disableScroll": true
+}

+ 48 - 0
packageUser/pages/user/bankinfo/bankinfo.wxml

@@ -0,0 +1,48 @@
+<view class="identity__bg">
+  <view class="identity__head">
+    <image src="https://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/xcx/rabbitimg/identity_bg.png"></image>
+  </view>
+
+  <view class="identity_wid">
+    <view class="identity_content">
+      <view class="title" wx:if="{{!has_bank}}">请先绑定银行卡</view>
+      <view class="title" wx:if="{{has_bank}}">已成功绑定银行卡</view>
+      <view class="identity_name">
+        <view class="fl">
+          <text>姓名</text>
+          <input type="text" bindinput="accountName" placeholder="真实姓名" value="{{account_name}}" disabled="{{has_bank}}"/>
+          <view class="clean"></view>
+        </view>
+        <view class="clean"></view>
+      </view>
+      <view class="identity_number">
+        <view class="fl">
+          <text>开户银行</text>
+          <input type="text" bindinput="bankName" placeholder="请填写银行卡开户银行" value="{{bank_name}}" disabled="{{has_bank}}"/>
+          <view class="clean"></view>
+        </view>
+        <view class="clean"></view>
+      </view>
+      <view class="identity_number">
+        <text>银行账号</text>
+        <input type="text" bindinput="bankAccount" placeholder="请输入您的银行账号" value="{{bank_account}}" disabled="{{has_bank}}"/>
+        <view class="clean"></view>
+      </view>
+
+      <view class="identity_btn" bindtap="confirmClick" wx:if="{{!has_bank}}">立即绑定</view>
+    </view>
+
+<!--
+    <view class="identity_content" wx:if="{{has_bank}}">
+      <image class="identity__img" src="https://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/xcx/rabbitimg/identity.png"></image>
+      <view class="identity_headImg">
+        <image wx:if="{{certificateData.head}}" src="{{certificateData.head}}"></image>
+        <image wx:if="{{!certificateData.head}}" src="https://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/labbit_default.png"></image>
+      </view>
+      <view class="info">{{certificateData.real_name}}</view>
+      <view class="info">{{certificateData.identity_card_with_star}}</view>
+    </view>
+-->  
+  </view>
+
+</view>

+ 122 - 0
packageUser/pages/user/bankinfo/bankinfo.wxss

@@ -0,0 +1,122 @@
+.identity__bg {
+  width: 100%;
+  min-height: 100%;
+  background: #f3f3f3;
+}
+.identity__head {
+  width: 100%;
+  height: 248rpx;
+  background-image: linear-gradient(180deg, 
+    #eab86a 0%, 
+    #d4932b 100%);
+}
+.identity__head image {
+  display: block;
+  width: 201rpx;
+  height: 251rpx;
+  margin: 0 auto;
+}
+.identity_wid {
+  width: 100%;
+  padding: 0 20rpx;
+  box-sizing: border-box;
+}
+.identity_content {
+  position: relative;
+  width: 100%;
+  background: #fff;
+  padding: 54rpx 30rpx 38rpx;
+  margin-top: 20rpx;
+  box-sizing: border-box;
+}
+.identity_content .title {
+  text-align: center;
+  font-size: 28rpx;
+  color: #7f93ae;
+  margin-bottom: 54rpx;
+}
+.identity_name, .identity_number {
+  width: 100%;
+  height: 100rpx;
+  background: #f6f9fd;
+  border: 1rpx solid #e5e5e5;
+  padding-left: 30rpx;
+  padding-right: 20rpx;
+  margin-bottom:30rpx;
+  box-sizing: border-box;
+}
+.identity_name fl {
+  float: left;
+}
+.identity_name text, .identity_number text{
+  /*display: inline-block;*/
+  float: left;
+  width: 140rpx;
+  line-height: 100rpx;
+  font-size: 28rpx;
+  color: #7f93ae;
+}
+.identity_name input {
+  float: left;
+  width: 160rpx;
+  height: 100rpx;
+  border: none;
+  outline: none;
+  font-size: 28rpx;
+  color: #b8c6d9;
+}
+.identity_name .btn {
+  float: right;
+  width: 260rpx;
+  height: 52rpx;
+  background: #fff;
+  border-radius: 26rpx;
+  line-height: 52rpx;
+  font-size: 24rpx;
+  color: #eab86a;
+  border: 1rpx solid #eab86a;
+  box-sizing: border-box;
+  text-align: center;
+  margin-top: 24rpx;
+}
+.identity_number input {
+  float: left;
+  width: 440rpx;
+  height: 100rpx;
+  border: none;
+  outline: none;
+  font-size: 28rpx;
+  color: #b8c6d9;
+}
+.identity_btn {
+  width: 100%;
+  height: 88rpx;
+  background: #eab86a;
+  border-radius: 8rpx;
+  line-height: 88rpx;
+  text-align: center;
+  font-size: 28rpx;
+  color: #ffffff;
+}
+.identity__img {
+  position: absolute;
+  width: 224rpx;
+  height: 162rpx;
+  right: 0;
+}
+.identity_headImg {
+  width: 172rpx;
+  height: 172rpx;
+  margin: 0 auto 46rpx;
+}
+.identity_headImg image {
+  width: 100%;
+  height: 100%;
+  border-radius: 50%;
+}
+.identity_content .info {
+  font-size: 28rpx;
+  color: #7f93ae;
+  text-align: center;
+  margin-bottom: 24rpx;
+}

+ 150 - 0
packageUser/pages/user/bind/bind.js

@@ -0,0 +1,150 @@
+// packageUser/pages/user/bind/bind.js
+var validator = require('../../../../utils/validator.js')
+var _request = require('../../../../utils/request.js')
+var _handle = require('../../../../utils/handle.js')
+Page({
+
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    tel: 0,
+    yzm: '',
+    countdown: 0
+  },
+  getTel (val) {
+    console.log(val)
+    if (val.detail.encryptedData) {
+      this.bindWxTel(val.detail)
+    }
+  },
+  bindWxTel (res) {
+    var str = JSON.stringify({
+      encryptedData: res.encryptedData,
+      iv: res.iv
+    })
+    var that = this
+    var url = 'v1/wxuser/one_click/binding/phonumer'
+    var params = {
+      userinfo: str
+    }
+    var success = function (res) {
+      wx.navigateTo({
+        url: '/packageUser/pages/user/bindsuccess/bindsuccess'
+      })
+    }
+    _request.$post(url, params, success)
+  },
+  bindPhone (e) {
+    this.setData({
+      tel: e.detail.value
+    })
+  },
+  bindYzm (e) {
+    this.setData({
+      yzm: e.detail.value
+    })
+  },
+  getYzm (e) {
+    _handle.setFormId(e)
+    if (validator.telphone(this.data.tel)) {
+      this.requireYzm()
+    } else {
+      wx.showToast({
+        title: '手机号码格式不正确',
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  },
+  startCountdown: function () {
+    var smsRequestTime = wx.getStorageSync('sms_request_time')
+    if (smsRequestTime) {
+      var count = parseInt((60000 - (new Date() - smsRequestTime)) / 1000)
+      this.setData({
+        countdown: count
+      })
+      if (this.data.countdown > 0) {
+        var timer = setInterval(() => {
+          var countdown = this.data.countdown - 1
+          this.setData({
+            countdown: countdown
+          })
+          if (this.data.countdown <= 0) {
+            clearInterval(timer)
+          }
+        }, 1000)
+        // clearInterval(this.interval)
+      }
+    } else {
+    }
+  },
+  requireYzm () {
+    var that = this
+    var url = 'v1/code/send'
+    var params = {
+      tel: this.data.tel,
+      valid_type: 'binding'
+    }
+    var success = function (res) {
+      wx.setStorageSync('sms_request_time', Date.now())
+      that.startCountdown()
+    }
+    _request.$post(url, params, success)
+  },
+  requireBindTel () {
+    var that = this
+    var url = 'v1/wxuser/binding/tel'
+    var params = {
+      tel: this.data.tel,
+      code: this.data.yzm
+    }
+    var success = function (res) {
+      wx.navigateTo({
+        url: '/packageUser/pages/user/bindsuccess/bindsuccess'
+      })
+    }
+    _request.$post(url, params, success)
+  },
+  setBind (e) {
+    _handle.setFormId(e)
+    var { isOk, msg } = this.validate()
+    if (isOk) {
+      this.requireBindTel()
+    } else {
+      wx.showToast({
+        title: msg,
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  },
+  validate () {
+    var msg
+    if (!validator.required(this.data.tel)) {
+      msg = '手机不能为空'
+    } else if (!validator.telphone(this.data.tel)) {
+      msg = '手机号码格式不正确'
+    } else if (!validator.required(this.data.yzm)) {
+      msg = '验证码不能为空'
+    }
+    return { isOk: !msg, msg }
+  },
+  otherbind () {
+    var that = this
+    var url = 'v1/wxuser/one_click/binding/tel'
+    var params = {
+    }
+    var success = function (res) {
+      wx.navigateTo({
+        url: '/packageUser/pages/user/bindsuccess/bindsuccess'
+      })
+    }
+    _request.$post(url, params, success)
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_bind'
+    })
+  }
+})

+ 4 - 0
packageUser/pages/user/bind/bind.json

@@ -0,0 +1,4 @@
+{
+  "navigationBarTitleText": "绑定手机",
+  "disableScroll": true
+}

+ 39 - 0
packageUser/pages/user/bind/bind.wxml

@@ -0,0 +1,39 @@
+<view class="bg">
+  <view class="bind">
+    <image class="bind-logo" src="https://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/bindlogo.jpg"></image>
+    <view class="phone-block">
+       <input type="number" maxlength="11" class="phone" placeholder="请输入待绑定的手机号码" placeholder-class="text-placeholder" bindinput="bindPhone" />
+       <image class="phone-logo" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/bindphone.png"></image>
+    </view>
+    <view class="yzm-block">
+      <view class="yzm-textBlock">
+        <input type="number" maxlength="11" class="yzm" placeholder="请输入短信验证码" placeholder-class="text-placeholder" bindinput="bindYzm" />
+        <image class="yzm-logo" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/bindpsd.png"></image>
+      </view>
+      <form wx:if="{{ countdown <= 0 }}"  bindsubmit="getYzm" report-submit="{{true}}" class="getyzm">
+        <button formType="submit" class="getyzm-btn">
+          获取验证码
+        </button>
+      </form>
+      <!-- <view class="getyzm" bindtap="getYzm">获取验证码</view> -->
+      <view class="nogetyzm" wx:if="{{ countdown > 0 }}" >重新发送({{countdown}})</view>
+      <view class="clean"></view>
+    </view>
+    <form bindsubmit="setBind" report-submit="{{true}}"  class="bind-btn">
+      <button formType="submit" class="bind-button">
+        绑定
+      </button>
+    </form>
+    <!-- <view class="bind-btn" bindtap="setBind">绑定</view> -->
+    <view class="bind-border">
+      <view class="bind-huo">或</view>
+    </view>
+    <!--<view class="bind-d5c" bindtap="otherbind"><text style="color: #d29e5b">第五创账号</text>一键绑定</view>-->
+    <button class="bind-d5c" open-type="getPhoneNumber" bindgetphonenumber="getTel">使用<text style="color: #24aa39">微信</text>绑定手机号</button>
+<!--     <view bindtap="otherbind">
+      <image class="d5c-logo" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/rabbit_one_click_bind_d5c_phone.png" />
+      <view class="one-bind">一键绑定第五创账号</view>
+    </view> -->
+  </view>
+  <view class="success"></view>
+</view>

+ 156 - 0
packageUser/pages/user/bind/bind.wxss

@@ -0,0 +1,156 @@
+/* packageUser/pages/user/bind/bind.wxss */
+.bg {
+  width: 100%;
+  height: 100%;
+}
+.bind {
+  width: 100%;
+  height: 100%;
+}
+.bind-logo {
+  display: block;
+  width: 100%;
+  height: 365rpx;
+}
+.phone {
+  width: 633rpx;
+  padding-left: 77rpx;
+  height: 88rpx;
+  line-height: 88rpx;
+  font-size: 28rpx;
+}
+.phone-block {
+  position: relative;
+  width: 710rpx;
+  height: 88rpx;
+  border-bottom: 1px solid #cccccc;
+  margin: 56rpx auto 0;
+}
+.text-placeholder {
+  color: #bbbbbb;
+}
+.phone-logo {
+  position: absolute;
+  top: 23rpx;
+  left: 16rpx;
+  width: 30rpx;
+  height: 40rpx;
+}
+.yzm-block {
+  position: relative;
+  width: 710rpx;
+  margin: 40rpx auto 0;
+}
+.yzm-textBlock {
+  position: relative;
+  float: left;
+  border-bottom: 1px solid #cccccc;
+}
+.yzm {
+  width: 363rpx;
+  height: 88rpx;
+  padding-left: 77rpx;
+  line-height: 88rpx;
+  font-size: 28rpx;
+}
+.yzm-logo {
+  position: absolute;
+  top: 23rpx;
+  left: 16rpx;
+  width: 32rpx;
+  height: 40rpx;
+}
+.getyzm {
+  display: block;
+  float: right;
+  width: 228rpx;
+  height: 86rpx;
+  border: 1px solid #eab86a;
+  border-radius: 6rpx;
+  background-color: #fff;
+}
+.getyzm-btn {
+  width: 100%;
+  height: 100%;
+  line-height: 86rpx;
+  text-align: center;
+  color: #eab86a;
+  font-size: 28rpx;
+}
+.nogetyzm {
+  display: block;
+  float: right;
+  width: 228rpx;
+  height: 86rpx;
+  border: 1px solid #cccccc;
+  line-height: 86rpx;
+  text-align: center;
+  color: #cccccc;
+  font-size: 28rpx;
+  border-radius: 6rpx;
+}
+.bind-btn {
+  display: block;
+  width: 710rpx;
+  height: 88rpx;
+  margin: 70rpx auto 0;
+  border-radius: 4rpx;
+}
+.bind-button {
+  width: 100%;
+  height: 100%;
+  background-color: #eab86a;
+  text-align: center;
+  line-height: 88rpx;
+  color: #fff;
+  font-size: 36rpx;
+}
+.d5c-logo {
+  width: 120rpx;
+  height: 120rpx;
+  margin: 240rpx auto 0;
+  text-align: center;
+  display: block;
+}
+.one-bind {
+  margin: 0 auto;
+  color: #b6b6b6;
+  font-size: 28rpx;
+  text-align: center;
+}
+.bind-border {
+  position: relative;
+  width: 710rpx;
+  height: 60rpx;
+  margin: 0 auto 50rpx;
+  border-bottom: 1rpx solid #cccccc;
+}
+.bind-huo {
+  width: 100rpx;
+  height: 50rpx;
+  position: absolute;
+  background-color: #fff;
+  color: #cccccc;
+  font-size: 24rpx;
+  position: absolute;
+  left: 50%;
+  margin-left: -50rpx;
+  bottom: -25rpx;
+  line-height: 50rpx;
+  text-align: center;
+}
+.bind-d5c {
+  width: 708rpx;
+  height: 88rpx;
+  border: 0;
+  border: 1rpx solid #cccccc;
+  background-color: #f3f3f3;
+  border-radius: 4rpx;
+  margin: 0 auto 20rpx;
+  text-align: center;
+  line-height: 88rpx;
+  font-size: 32rpx;
+}
+button::after{
+  border:none;
+}

+ 15 - 0
packageUser/pages/user/bindsuccess/bindsuccess.js

@@ -0,0 +1,15 @@
+var _request = require('../../../../utils/request.js')
+Page({
+  data: {
+  },
+  getHome () {
+    wx.reLaunch({
+      url: '/pages/home/home'
+    })
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_bindsuccess'
+    })
+  }
+})

+ 4 - 0
packageUser/pages/user/bindsuccess/bindsuccess.json

@@ -0,0 +1,4 @@
+{
+  "navigationBarTitleText": "绑定手机",
+  "disableScroll": true
+}

+ 6 - 0
packageUser/pages/user/bindsuccess/bindsuccess.wxml

@@ -0,0 +1,6 @@
+<view class="bg">
+  <view class="block"> </view>
+  <image class="bind-logo" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/bindsuccess.png"></image>
+  <view class="bind-text">绑定成功</view>
+  <view class="bind-btn" bindtap="getHome">返回首页</view>
+</view>

+ 31 - 0
packageUser/pages/user/bindsuccess/bindsuccess.wxss

@@ -0,0 +1,31 @@
+.bg {
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+}
+.block {
+  height: 233rpx;
+}
+.bind-logo {
+  display: block;
+  width: 200rpx;
+  height: 200rpx;
+  margin: 0 auto;
+}
+.bind-text {
+  padding-top: 30rpx;
+  font-size: 32rpx;
+  color: #eab86a;
+  text-align: center;
+}
+.bind-btn {
+  margin: 450rpx auto 0;
+  width: 710rpx;
+  height: 88rpx;
+  border: 1px solid #cccccc;
+  border-radius: 4rpx;
+  text-align: center;
+  line-height: 88rpx;
+  color: #999999;
+  font-size: 28rpx;
+}

+ 110 - 0
packageUser/pages/user/buy/buy.js

@@ -0,0 +1,110 @@
+var _request = require('../../../../utils/request.js')
+Page({
+  data: {
+    inputValue: '',
+    balance: '',
+    buttonClicked: false,
+    orderId: '',
+    path: '',
+    luoboCount: '',
+    countMoney: '0.00'
+  },
+  onLoad: function (options) {
+    this.data.orderId = options.orderId
+    this.data.path = options.path
+    // this.data.luoboCount = options.luoboCount
+    // this.setData({
+    //   luoboCount: options.luoboCount
+    // })
+    // this.setData({
+    //   countMoney: options.countMoney
+    // })
+    this.checkbalance()
+  },
+  bindKeyInput: function(e) {
+    this.setData({
+      inputValue: e.detail.value
+    })
+    if (!this.data.inputValue) {
+      this.setData({
+        countMoney:'0.00'
+      })
+    }
+  },
+  toWeixin (e) {
+    var count = parseInt(e.currentTarget.dataset.text) || this.data.inputValue || this.data.luoboCount
+    var that = this
+    that.buttonClicked()
+    var url = 'v1/balance_order/generate'
+    var params = {
+      count: count*100,
+      payway: 'service_wxpay'
+    }
+    var success = function (val) {
+      that.topay(val.data)
+    }
+    _request.$post(url, params, success)
+  },
+  topay (res) {
+    var that = this 
+    var url = 'v1/pay'
+    var params = {
+      order_id: res.order_id,
+      pay_way: res.pay_way
+    }
+    var success = function (val) {
+      wx.requestPayment({
+        'timeStamp': val.data.pay_data.timeStamp,
+        'nonceStr': val.data.pay_data.nonceStr,
+        'package': val.data.pay_data.package,
+        'signType': val.data.pay_data.signType,
+        'paySign': val.data.pay_data.paySign,
+        'success':function(res){
+          wx.showToast({
+            title: '支付成功',
+            icon: 'success',
+            duration: 1000
+          })
+          that.checkbalance()
+          wx.navigateTo({
+            url:  that.data.path + '?orderId=' + that.data.orderId
+          })
+        },
+        'fail':function(res){
+
+        }
+      })
+    }
+    _request.$post(url, params, success)
+  },
+  checkbalance () {
+    var that = this
+    var url = 'v1/user/balance/info'
+    var params = {
+    }
+    var success = function (res) {
+      var result = res.data.total
+      that.setData({
+        balance: result,
+        invitemode:  res.data.show_invite_mode
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  buttonClicked () {
+    var that = this
+    that.setData({
+      buttonClicked: true
+    })
+    setTimeout(function () {
+      that.setData({
+        buttonClicked: false
+      })
+    }, 3000)
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_rabbitbuy'
+    })
+  }
+})

+ 4 - 0
packageUser/pages/user/buy/buy.json

@@ -0,0 +1,4 @@
+{
+ "navigationBarTitleText": "购买代金券",
+ "disableScroll": true
+}

+ 45 - 0
packageUser/pages/user/buy/buy.wxml

@@ -0,0 +1,45 @@
+<view class="buy-bg">
+  <navigator url="/packageUser/pages/user/radish/radish" >
+    <view class="buy-top">
+      <text class="buy-luobo-text">我的代金券</text>
+      <view class="buy-luobo-count">{{balance / 100}}</view>
+    </view>
+  </navigator>
+  <view class="buy-chong" wx:if="{{!invitemode}}">快捷购买</view>
+  
+  <view class="buy-chong-park">
+  	<!--
+    <view class="chong" bindtap="{{!buttonClicked?'toWeixin':''}}" data-text="5000">
+      <view class="chong-luobo-count">5000代金券</view>
+      <view class="chong-luobo-money">¥50</view>
+    </view>
+    <view class="chong" bindtap="{{!buttonClicked?'toWeixin':''}}" data-text="7500">
+      <view class="chong-luobo-count">7500代金券</view>
+      <view class="chong-luobo-money">¥75</view>
+    </view>
+    <view class="chong" bindtap="{{!buttonClicked?'toWeixin':''}}" data-text="10000">
+      <view class="chong-luobo-count">10000代金券</view>
+      <view class="chong-luobo-money">¥100</view>
+    </view>
+    -->
+    <view class="chong" bindtap="{{!buttonClicked?'toWeixin':''}}" data-text="3000" style="width:97%">
+      <view class="chong-luobo-count">4200代金券</view>
+      <view class="chong-luobo-money">¥3000</view>
+    </view>
+  </view>
+  
+  <!--<view class="buy-other">购买其它数量</view>-->
+  <!--
+  <view class="other-part" wx:if="{{invitemode}}">
+  
+    <view class="other-part-money"><text class="jiage">价格</text><text class="shu" wx:if="{{inputValue}}">{{inputValue*0.85}}</text><text class="shu" wx:if="{{!inputValue}}">{{countMoney}}</text><text class="yuan">元</text></view>
+    <view class="other-part-input">
+      <text class="chongzhi">充值</text>
+      <input class="input" type="number" value="{{luoboCount}}" bindinput="bindKeyInput" placeholder="请输入数量" placeholder-style="color:#b8c6d9;font-size:32rpx;text-align:center"/>
+      <text class="chongzhi-luobo">代金券</text>
+    </view>
+   
+    <view class="other-buy-luobo" bindtap="{{!buttonClicked?'toWeixin':''}}">买代金券</view>
+  </view>
+  -->
+</view>

+ 148 - 0
packageUser/pages/user/buy/buy.wxss

@@ -0,0 +1,148 @@
+.buy-bg{
+ width: 100%;
+ height: 100%;
+ background-color: #f3f3f3;
+}
+.buy-top{
+ width: 100%;
+ height: 172rpx;
+ background: url('http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/icon/labibackgroud2.png') no-repeat;
+ background-size: 100%;
+ box-sizing: border-box;
+	position: relative;
+}
+.buy-luobo-text{
+ font-size: 30rpx;
+ color: #FFF;
+ position: absolute;
+ left: 50%;
+ top: 30rpx;
+ transform: translateX(-50%);
+}
+.buy-luobo-count{
+ font-size: 40rpx;
+ color: #fff;
+ /* margin: 0 auto; */
+ text-align: center;
+ padding-top: 80rpx;
+ font-weight: 600;
+}
+.buy-chong{
+ width: 100%;
+ height: 100rpx;
+ text-align: center;
+ font-size: 30rpx;
+ color: #999999;
+ padding-top: 30rpx;
+ box-sizing: border-box;
+}
+.buy-chong-park{
+ width: 100%;
+ height: 188rpx;
+ box-sizing: border-box;
+ padding-left: 23rpx;
+ /* background: red; */
+}
+.chong-luobo-count{
+ font-size: 32rpx;
+ color: #eab86a;
+ text-align: center;
+ padding-top: 20rpx;
+}
+.chong-luobo-money{
+ font-size: 32rpx;
+ color: #cccccc;
+ text-align: center;
+ padding-top: 10rpx;
+}
+.chong{
+ height: 128rpx;
+ width: 222rpx;
+ background: #fff;
+ border-radius: 10rpx;
+ float: left;
+ margin-right: 21rpx;
+}
+.buy-other{
+ width: 100%;
+ height: 75rpx;
+ text-align: center;
+ color: #999999;
+ font-size: 30rpx;
+}
+.other-part{
+ height: 524rpx;
+ width: 710rpx;
+ box-sizing: border-box;
+ margin: 0 23rpx;
+ background: #fff;
+ border-radius: 10rpx;
+ overflow: hidden;
+ 
+}
+.other-part-money{
+ width: 614rpx;
+ height: 56rpx;
+ margin: 0 auto;
+ margin-top: 110rpx;
+ box-sizing: border-box;
+ text-align: center;
+ position: relative;
+}
+.jiage{
+ color: #999999;
+ font-size: 30rpx;
+ position: absolute;
+ left: 0;
+ top: 7rpx;
+}
+.yuan{
+ color: #999999;
+ font-size: 30rpx;
+ position: absolute;
+ top: 7rpx;
+ right: 0;
+}
+.shu{
+ font-size: 40rpx;
+ text-align: center;
+}
+.input{
+ width: 471rpx;
+ margin: 0 auto;
+ padding-top: 25rpx;
+ text-align: center;
+ font-size: 40rpx;
+}
+.other-part-input{
+  height: 100rpx;
+  width: 650rpx;
+  position: relative;
+  margin: 92rpx auto 0;
+  border: 1rpx solid #e5e5e5;
+  background: #f6f9fd;
+}
+.chongzhi{
+ color: #7f93ae;
+ font-size: 30rpx;
+ position: absolute;
+ top: 28rpx;
+ left: 20rpx;
+}
+.chongzhi-luobo{
+ color: #7f93ae;
+ font-size: 30rpx;
+ position: absolute;
+ top: 28rpx;
+ right: 20rpx;
+}
+.other-buy-luobo{
+ width: 650rpx;
+ height: 88rpx;
+ background: #eab86a;
+ margin: 40rpx auto 0;
+ text-align: center;
+ line-height: 88rpx;
+ color: #fff;
+ border-radius: 10rpx;
+}

+ 523 - 0
packageUser/pages/user/exchange/exchange.js

@@ -0,0 +1,523 @@
+var _request = require('../../../../utils/request.js')
+var _handle = require('../../../../utils/handle.js')
+Page({
+  data: {
+    page: 1,
+    per_page: 10,
+    curItem: {},
+  	radishCount: 0,
+  	checkIntegral: {},
+  	companyList: [],
+    more: true,
+    showPanel: false,
+    showPwdDialog: false,
+    ydCodeDialog: false,
+    ydExchangeDialog: false,
+    clogo: '',
+    integralTotal: 0,
+    originInToTal: 0,
+    countdown: 0,
+    servicePwd: '',
+    phoneCode: '',
+    useIntegral: 0,
+    panelId: '',
+    show: false,
+    imgUrls: [
+    ],
+    indicatorDots: true,
+    autoplay: true,
+    interval: 5000,
+    duration: 1000,
+    circular: true,
+    bindTel: false,
+    checkData: {},
+    lock: false
+  },
+  onLoad: function () {
+  	// this.getBalanceInfo()
+    this.getCompanyList()
+    this.check()
+    this.getBanners()
+  },
+  onReachBottom: function () {
+    if (this.data.more) {
+      var page = this.data.page + 1
+      this.setData({
+        page: page
+      })
+      this.getCompanyList()
+    }
+  },
+  getCode () {
+    var that = this
+    var url = 'v1/platforms/yidong/send_code'
+    var params = {
+    }
+    var success = function (res) {
+      wx.setStorageSync('sms_request_time', Date.now())
+      that.startCountdown()
+    }
+    _request.$get(url, params, success)
+  },
+  startCountdown: function () {
+    var smsRequestTime = wx.getStorageSync('sms_request_time')
+    if (smsRequestTime) {
+      var count = parseInt((60000 - (new Date() - smsRequestTime)) / 1000)
+      this.setData({
+        countdown: count
+      })
+      if (this.data.countdown > 0) {
+        var timer = setInterval(() => {
+          var countdown = this.data.countdown - 1
+          this.setData({
+            countdown: countdown
+          })
+          if (this.data.countdown <= 0) {
+            clearInterval(timer)
+          }
+        }, 1000)
+      }
+    }
+  },
+  getBalanceInfo: function () {
+    var that = this
+    var url = "v1/user/balance/info";
+    var params = {}
+    var success = function (val) {
+      that.setData({
+        balanceInfo: val.data,
+        bindTel : true
+      });
+    }
+    _request.$get(url, params, success)
+  },
+  getCompanyList: function () {
+    var that = this
+    var url = "v1/platforms";
+    var params = {
+      page: that.data.page,
+      per_page: that.data.per_page,
+      cache: false
+    }
+    var success = function (res) {
+      var result = that.data.companyList.concat(res.data.list || [])
+      console.log(result)
+      that.setData({
+        companyList: result
+      })
+      var listMore = res.data.list_count > that.data.companyList.length
+      that.setData({
+        more: listMore
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  radishCountInput: function (e) {
+    var that = this
+    var item = that.data.curItem
+    if (e.detail.value) {
+      that.data.radishCount = Number(e.detail.value)
+      that.data.integralTotal = (that.data.originInToTal - ((e.detail.value * item.p_count) / item.labi_count)).toFixed(2)
+    } else if (e.detail.value === '') {
+      that.data.integralTotal = 0
+    }
+    if ((that.data.originInToTal - that.data.integralTotal) * 100 % 100 === 0) {
+      that.data.useIntegral = that.data.originInToTal - that.data.integralTotal
+    } else {
+      that.data.useIntegral = (that.data.originInToTal - that.data.integralTotal).toFixed(2)
+    }
+    this.setData({
+      integralTotal: that.data.integralTotal,
+      useIntegral: that.data.useIntegral
+    })
+  },
+  checkUserIntegral: function (tag) {
+  	var that = this
+    var url
+    if (tag === 'liantong' || tag === 'yidong' || tag === 'yizhifu' ) {
+     url = "v1/platform/" + tag + "/check";
+    } else {
+      url  = "v1/platform/" + that.data.curItem.id + "/check";
+    }
+    var params
+    if (tag === 'yidong') {
+      params = {
+        code: that.data.phoneCode
+      }
+    } else {
+      params = {}
+    } 
+    var success = function (val) {
+      var integral
+      var item = that.data.curItem
+      that.data.originInToTal = val.data.total
+      if (val.data.total >= 0 && that.data.curItem.tag === 'yidong') {
+        that.ydDialog()
+        that.setData({
+          showPanel: that.data.showPanel,
+          panelId: that.data.curItem.id,
+          clogo: that.data.curItem.logo
+        })
+      }
+      if (val.data.total) {
+        // integral = item.p_start_count * item.labi_count / item.p_count
+        // that.data.integralTotal = val.data.total - ((integral * item.p_count) / item.labi_count)
+        integral = Math.floor(val.data.total / item.p_count) * item.labi_count
+        that.data.integralTotal = (val.data.total - (integral * item.p_count / item.labi_count)).toFixed(2)
+        that.data.radishCount = integral
+      } else {
+        integral = 0
+        that.data.integralTotal = 0
+      }
+      if ((that.data.originInToTal - that.data.integralTotal) * 100 % 100 === 0) {
+        that.data.useIntegral = that.data.originInToTal - that.data.integralTotal
+      } else {
+        that.data.useIntegral = (that.data.originInToTal - that.data.integralTotal).toFixed(2)
+      }
+      that.setData({
+        checkIntegral: val.data,
+        integralTotal: that.data.integralTotal,
+        useIntegral: that.data.useIntegral,
+        radishCount: integral,
+        originInToTal: val.data.total
+      });
+    }
+    _request.$get(url, params, success)
+  },
+  exchange: function (e) {
+    _handle.setFormId(e)
+  	var that = this
+    that.data.lock = true
+  	var ratio = e.detail.target.dataset.ratio
+  	var url = "v1/platform/" + e.detail.target.dataset.id + "/exchange"
+    var params = {
+      count: that.data.radishCount
+    }
+  	var success = function (val) {
+      that.data.lock = false
+      wx.redirectTo({
+        url: '/packageUser/pages/user/exchangeSuccess/exchangeSuccess'
+      })
+    }
+    if (that.data.radishCount) {
+      if (e.detail.target.dataset.tag === 'yizhifu') {
+        that.getdianxin()
+      } else {
+        if (that.data.integralTotal >= 0) {
+          if (that.data.radishCount % that.data.curItem.labi_range === 0) {
+            if (e.detail.target.dataset.tag === 'liantong') {
+              that.showDialog()
+            } else if (e.detail.target.dataset.tag === 'yidong') {
+              that.data.ydExchangeDialog = !that.data.ydExchangeDialog
+              that.setData({
+                ydExchangeDialog: that.data.ydExchangeDialog
+              })
+            } else {
+              if (that.data.lock) {
+                _request.$post(url, params, success)
+              }
+            }
+          } else {
+            wx.showToast({
+              title: '请以' + that.data.curItem.labi_range + '的倍数输入代金券数',
+              icon: 'none',
+              duration: 2000
+            })
+          }
+        } else {
+          wx.showToast({
+            title: '代金券余额不足~',
+            icon: 'none',
+            duration: 2000
+          })
+        }
+      }
+    } else {
+      wx.showToast({
+        title: '请输入兑换的代金券~',
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  },
+  getdianxin () {
+    var that = this
+    var url = 'v1/pf/yizhifu/page/exchange'
+    var params = {
+      count: that.data.radishCount
+    }
+    var success = function (val) {
+      console.log(val)
+      wx.navigateTo({
+        url: '/pages/web/web?id=' + val.result_str
+      })
+    }
+    _request.$post(url, params, success)
+  },
+  servicePwdInput (e) {
+    var that = this
+    that.data.servicePwd = e.detail.value
+  },
+  phoneCodeInput (e) {
+    var that = this
+    that.data.phoneCode = e.detail.value
+  },
+  checkYDIntegral () {
+    var that = this
+    if (that.data.phoneCode) {
+      that.openPanelTwo()
+    } else {
+      wx.showToast({
+        title: '验证码不能为空',
+        icon: 'none',
+        duration: 1000
+      })
+    }
+  },
+  sumbit () {
+    var that = this
+    var url = "v1/platform/liantong/exchange"
+    var params = {
+      count: that.data.radishCount,
+      pwd: that.data.servicePwd
+    }
+    var success = function (val) {
+      wx.redirectTo({
+        url: '/packageUser/pages/user/exchangeSuccess/exchangeSuccess'
+      })
+    }
+    _request.$post(url, params, success)
+  },
+  sumbitYD () {
+    var that = this
+    var url = "v1/platform/yidong/exchange"
+    var params = {
+      count: that.data.radishCount,
+      code: that.data.phoneCode
+    }
+    var success = function (val) {
+      wx.redirectTo({
+        url: '/packageUser/pages/user/exchangeSuccess/exchangeSuccess'
+      })
+    }
+    if (that.data.phoneCode) {
+      _request.$post(url, params, success)
+    } else {
+      wx.showToast({
+        title: '验证码不能为空',
+        icon: 'none',
+        duration: 1000
+      })
+    }
+  },
+  openPanel (e) {
+    var that = this
+    that.data.curItem = e.currentTarget.dataset.item
+    if (e.currentTarget.dataset.item.tag === 'yidong') {
+      if (that.data.curItem.state === 1) {
+        if (!that.data.showPanel) {
+          that.ydDialog()
+          that.setData({
+            clogo: that.data.curItem.logo
+          })
+        } else {
+          that.data.showPanel = !that.data.showPanel
+          that.setData({
+            showPanel: that.data.showPanel,
+            transferR: 90,
+            radishCount: 0,
+            originInToTal: 0,
+            integralTotal: 0
+          })
+        }
+      }
+     } //else if (e.currentTarget.dataset.item.tag === 'yizhifu') {
+    //   that.data.showPanel = !that.data.showPanel
+    //   that.data.show = !that.data.show
+    //   that.setData({
+    //     showPanel: that.data.showPanel,
+    //     show : that.data.show
+    //   })
+    // }
+     else {
+      that.openPanelTwo()
+    }
+  },
+  openPanelTwo () {
+    var that = this
+    if (that.data.curItem.state === 1) {
+      that.data.showPanel = !that.data.showPanel
+      if (that.data.showPanel) {
+        that.checkUserIntegral(that.data.curItem.tag)
+        if (that.data.curItem.tag === 'yizhifu') {
+          that.setData({
+            show: true
+          })
+        }
+        that.setData({
+          transferR: -90,
+          // show: false
+        })
+      } else {
+        that.setData({
+          transferR: 90,
+          radishCount: 0,
+          originInToTal: 0,
+          integralTotal: 0,
+          show: false,
+        })
+      }
+      if (that.data.curItem.tag !== 'yidong') {
+        that.setData({
+          showPanel: that.data.showPanel,
+          panelId: that.data.curItem.id,
+          clogo: that.data.curItem.logo,
+        })
+      }
+      // if (that.data.curItem.tag === 'yizhifu') {
+      //   console.log(4444)
+      //   that.setData({
+      //     showPanel: that.data.showPanel,
+      //     panelId: that.data.curItem.id,
+      //     clogo: that.data.curItem.logo,
+      //   })
+      // }
+    }
+  },
+  showDialog () {
+    var that = this
+    that.data.showPwdDialog = !that.data.showPwdDialog
+    that.setData({
+      showPwdDialog: that.data.showPwdDialog
+    })
+  },
+  ydDialog () {
+    var that = this
+    that.data.ydCodeDialog = !that.data.ydCodeDialog
+    that.setData({
+      ydCodeDialog: that.data.ydCodeDialog
+    })
+  },
+  ydExDialog () {
+    var that = this
+    that.data.ydExchangeDialog = !that.data.ydExchangeDialog
+    if (!that.data.ydExchangeDialog) {
+      that.data.showPanel = !that.data.showPanel,
+      that.setData({
+        showPanel: that.data.showPanel,
+        ydExchangeDialog: that.data.ydExchangeDialog
+      })
+    } else {
+      that.setData({
+        ydExchangeDialog: that.data.ydExchangeDialog
+      })
+    }
+  },
+  minus () {
+    var that = this
+    var item = that.data.curItem
+    var minRadishCount = item.p_start_count * item.labi_count / item.p_count
+    var left = that.data.radishCount - item.labi_range
+    if (left >= minRadishCount) {
+      that.data.radishCount = left
+      that.data.integralTotal = (that.data.checkIntegral.total - ((that.data.radishCount * item.p_count) / item.labi_count)).toFixed(2)
+      if ((that.data.originInToTal - that.data.integralTotal) * 100 % 100 === 0) {
+        that.data.useIntegral = that.data.originInToTal - that.data.integralTotal
+      } else {
+        that.data.useIntegral = (that.data.originInToTal - that.data.integralTotal).toFixed(2)
+      }
+      that.setData({
+        radishCount: that.data.radishCount,
+        integralTotal: that.data.integralTotal,
+        useIntegral: that.data.useIntegral
+      })
+    } else {
+      wx.showToast({
+        title: '兑换代金券数量不对',
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  },
+  plus () {
+    var that = this
+    var item = that.data.curItem
+    that.data.radishCount = that.data.radishCount + item.labi_range
+    that.data.integralTotal = (that.data.checkIntegral.total - ((that.data.radishCount * item.p_count) / item.labi_count)).toFixed(2)
+    if ((that.data.originInToTal - that.data.integralTotal) * 100 % 100 === 0) {
+      that.data.useIntegral = that.data.originInToTal - that.data.integralTotal
+    } else {
+      that.data.useIntegral = (that.data.originInToTal - that.data.integralTotal).toFixed(2)
+    }
+    that.setData({
+      radishCount: that.data.radishCount,
+      integralTotal: that.data.integralTotal,
+      useIntegral: that.data.useIntegral
+    })
+  },
+  toUrl () {
+    var that = this
+    if (that.data.curItem.get_url_type === 'internal') {
+      wx.navigateTo({
+        url: that.data.curItem.get_url
+      })
+    } else if (that.data.curItem.get_url_type === 'external') {
+      wx.navigateTo({
+        url: '/pages/web/web?id=' + that.data.curItem.get_url
+      })
+    } else {
+      wx.showToast({
+        title: '未设置链接',
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  },
+  check () {
+    var that = this
+    var url = 'v1/user/check'
+    var params = {
+    }
+    var success = function (res) {
+      if (res.data.wx_user_id <= 0) {
+        wx.login({
+          success: res => {
+            _request.login(res)
+          }
+        })
+      } else {
+        that.setData({
+          checkData: res.data
+        })
+        if (that.data.checkData.merchant_id > 0) {
+          // that.getmerchant()
+        }
+        if (res.data.user_id > 0 && !that.data.bindTel) {
+          that.setData({
+            bindTel: true
+          })
+          that.getBalanceInfo()
+        }
+      }
+    }
+    _request.$get(url, params, success)
+  },
+  getBanners () {
+    var item = 'lol'
+    var that = this 
+    var url = 'v1/ad/' + item + '/items'
+    var params = {
+    }
+    var success = function (res) {
+      that.setData({
+        imgUrls: res.data
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_exchange'
+    })
+  }
+})

+ 4 - 0
packageUser/pages/user/exchange/exchange.json

@@ -0,0 +1,4 @@
+{
+  "navigationBarTitleText": "代金券兑换代金券",
+  "backgroundColor": "#f3f3f3"
+}

+ 195 - 0
packageUser/pages/user/exchange/exchange.wxml

@@ -0,0 +1,195 @@
+<view class="exchange-top">
+  <view class="exchange-top-content">
+    <text class="exchange-top-radish">我的代金券</text>
+    <text class="exchange-top-count" wx:if="{{bindTel}}">{{balanceInfo.total}}</text>
+    <view wx:if="{{!bindTel}}">
+      <view class="user-title">
+        <text>尚未绑定手机 , </text>
+      </view>
+      <navigator url="/packageUser/pages/user/bind/bind">
+          <view class="bind">立即绑定</view>
+      </navigator>
+    </view>
+    <navigator url="/packageUser/pages/user/buy/buy" wx:if="{{bindTel}}">
+      <view class="exchange-top-btn">购买代金券</view>
+    </navigator>
+    <navigator url="/packageUser/pages/user/otherbind/otherbind" wx:if="{{!bindTel}}">
+      <view class="exchange-top-btn">购买代金券</view>
+    </navigator>
+  </view>
+
+  
+  <swiper class="swiper" indicator-active-color="#eab86a" indicator-color="#fff" indicator-dots="{{indicatorDots}}" autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}" circular="{{circular}}">
+    <block wx:for="{{imgUrls}}" wx:key="{{index}}">
+      <swiper-item style="border-radius: 10rpx;">
+        <image src="{{item.img}}"  class="slide-image"/>
+      </swiper-item>
+    </block>
+  </swiper>
+
+  <view class="exchange-tip">
+    <view class="exchange-tip-info">代金券是指用户在其他企业大使以个人手机注册账号的代金券。</view>
+  </view>
+
+  <view class="exchange-title">
+    <text>企业大使</text>
+    <text class="fr">汇兑比例</text>
+    <view class="clean"></view>
+  </view>
+
+  <view class="{{item.state === 1 ? 'exchange-panel':'exchange-panel bg'}}" wx:for="{{companyList}}" wx:for-index="index" wx:key="{{item.id}}" style="{{showPanel && panelId === item.id? '': 'padding-bottom: 0;'}}">
+
+    <view class="exchange-rule" bindtap="openPanel" data-item="{{item}}">
+
+      <view class="exchange-rule-company">
+        <image src="{{item.logo}}"></image>
+        <view class="exchange-company-slogan">
+          <view>{{item.name}}</view>
+          <view class="secondTitle ellipsis">{{item.slogan}}</view>
+        </view>
+        <view class="clean"></view>
+      </view>
+
+      <view class="exchange-rule-per" wx:if="{{item.state === 1}}">
+        <text class="">{{item.p_count}}:{{item.labi_count}}</text>
+        <text wx:if="{{item.state !== 1}}">{{item.state_cn}}</text>
+        <image wx:if="{{panelId === item.id}}" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/arrow_right.jpg" style="transform:rotate({{transferR}}deg);"></image>
+        <image wx:if="{{panelId !== item.id}}" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/arrow_right.jpg" style="transform:rotate(90deg);"></image>
+      </view>
+
+      <view class="exchange-rule-per" wx:if="{{item.state !== 1}}">
+        <text class="{{item.state === 3 ? 'redWord':''}}">{{item.state_cn}}</text>
+      </view>
+      <view class="clean"></view>
+    </view>
+
+    <view wx:if="{{showPanel && panelId === item.id}}">
+    <!-- <view> -->
+      <view wx:if="{{bindTel}}">
+        <view class="exchange-integral" wx:if="{{!show}}">
+          <text class="exchange-integral-title">现有代金券</text>
+          <text class="exchange-integral-count">{{originInToTal}}</text>
+          <view class="clean"></view>
+        </view>
+
+        <view class="exchange-integral" wx:if="{{!show}}">
+          <text class="exchange-integral-title">将消耗代金券</text>
+          <text class="exchange-integral-count">{{useIntegral}}</text>
+          <view class="clean"></view>
+        </view>
+      </view>
+      <view wx:if="{{!bindTel}}">
+        <view class="exchange-integral1" wx:if="{{!show}}">
+          <text class="exchange-integral-title">现有代金券</text>
+          <text class="exchange-integral-text">尚未绑定手机 , 无法获取代金券数据</text>
+          <view class="clean"></view>
+        </view>
+      </view>
+      <view class="exchange-radish">
+        <view class="left">
+          <text class="fl">汇兑代金券</text>
+          <input wx:if="{{!originInToTal}}" type="number" value="{{radishCount}}" bindinput="radishCountInput" disabled="{{!show}}" />
+          <input wx:if="{{originInToTal}}" type="number" bindinput="radishCountInput" value="{{radishCount}}" placeholder="请输入兑换代金券数" />
+        </view>
+        <view class="right" wx:if="{{originInToTal}}">
+          <view class="bg fl" style="margin-right: 36rpx;" bindtap="minus">
+            <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/minus.png"></image>
+          </view>
+          <view class="bg fl" bindtap="plus">
+            <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/plus.png"></image>
+          </view>
+        </view>
+        <view class="clean"></view>
+      </view>
+
+      <view>
+        <view class="exchange-btn1 fl" bindtap="toUrl">{{item.get_text}}</view>
+        <form bindsubmit="exchange" report-submit="{{true}}"  class="exchange-btn2 fr">
+          <button formType="submit" class="exchange-btn2__button" data-id="{{item.id}}" data-ratio="{{item.ratio}}" data-tag="{{item.tag}}">
+            立即汇兑
+          </button>
+        </form>
+        <!-- <view class="exchange-btn2 fr" bindtap="exchange" ></view> -->
+        <view class="clean"></view>
+      </view>
+      
+    </view>
+
+  </view>
+
+  <!-- 联通输入服务密码 -->
+  <view class="pwdDialog" wx:if="{{showPwdDialog}}">
+    <view class="pwdDialog-panel">
+      <view class="pwdDialog-hearder">
+        <text>请输入付款密码</text>
+        <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/closed.jpg" bindtap="showDialog"></image>
+      </view>
+
+      <view class="pwdDialog-logo">
+        <image src="{{clogo}}"></image>
+      </view>
+
+      <view class="pwdDialog-input">
+        <text>付款密码</text>
+        <input type="password" name="password" bindinput="servicePwdInput" placeholder="请输入付款密码" /> 
+      </view>
+
+      <view class="pwdDialog-btn" bindtap="sumbit">
+        确认
+      </view>
+
+      <view class="pwdDialog-forgot" bindtap="toUrl">
+        查看付款密码
+      </view>
+    </view>
+  </view>
+
+  <!-- 查询移动代金券验证码 -->
+  <view class="pwdDialog" wx:if="{{ydCodeDialog}}">
+    <view class="ydDialog-panel">
+      <view class="pwdDialog-hearder">
+        <text>请输入获取移动代金券验证码</text>
+        <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/closed.jpg" bindtap="ydDialog"></image>
+      </view>
+
+      <view class="pwdDialog-logo">
+        <image src="{{clogo}}"></image>
+      </view>
+
+      <view class="ydDialog-input">
+        <input type="text" name="code" bindinput="phoneCodeInput" placeholder="请输入短信验证码" /> 
+        <view wx:if="{{ countdown <= 0 }}" class="ydDialog-btnCode" bindtap="getCode">获取验证码</view>
+        <view class="ydDialog-btnCode" style="color: #bac8da;" wx:if="{{ countdown > 0 }}" >{{countdown}}s后可重新获取</view>
+      </view>
+
+      <view class="ydDialog-btn" bindtap="checkYDIntegral">
+        确认
+      </view>
+    </view>
+  </view>
+
+  <!-- 汇兑移动代金券验证码 -->
+  <view class="pwdDialog" wx:if="{{ydExchangeDialog}}">
+    <view class="ydDialog-panel">
+      <view class="pwdDialog-hearder">
+        <text>请输入汇兑移动代金券验证码</text>
+        <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/image/icon/closed.jpg" bindtap="ydExDialog"></image>
+      </view>
+
+      <view class="pwdDialog-logo">
+        <image src="{{clogo}}"></image>
+      </view>
+
+      <view class="ydDialog-input">
+        <input type="text" name="code" bindinput="phoneCodeInput" placeholder="请输入短信验证码" /> 
+        <view wx:if="{{ countdown <= 0 }}" class="ydDialog-btnCode" bindtap="getCode">获取验证码</view>
+        <view class="ydDialog-btnCode" style="color: #bac8da;" wx:if="{{ countdown > 0 }}" >{{countdown}}s后可重新获取</view>
+      </view>
+
+      <view class="ydDialog-btn" bindtap="sumbitYD">
+        确认
+      </view>
+    </view>
+  </view>
+
+</view>

+ 382 - 0
packageUser/pages/user/exchange/exchange.wxss

@@ -0,0 +1,382 @@
+.exchange-top {
+	position: relative;
+	width: 750rpx;
+	min-height: 100%;
+	background: #f3f3f3;
+}
+.exchange-top-content {
+	width: 100%;
+	height: 200rpx;
+	background: url('http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/icon/labibackgroud.png') no-repeat;
+	background-size: cover;
+	/* line-height: 160rpx; */
+	/* padding: 0 18rpx; */
+	box-sizing: border-box;
+	position: relative;
+	margin-bottom: 20rpx;
+}
+.exchange-top-radish {
+	position: absolute;
+	left: 52rpx;
+	top: 40rpx;
+	font-size: 30rpx;
+	color: #ffffff;
+}
+.exchange-top-count {
+	/* float: right; */
+	position: absolute;
+	top: 106rpx;
+	left: 52rpx;
+	font-size: 48rpx;
+	color: #fff;
+	font-weight: bold;
+}
+.exchange-top-btn{
+		position: absolute;
+		right: 46rpx;
+		top: 74rpx;
+		width: 160rpx;
+		height: 54rpx;
+		line-height: 54rpx;
+		border: 2rpx solid #fff;
+		border-radius:510rpx; 
+		font-size: 30rpx;
+		text-align: center;
+		color: #fff;
+}
+.exchange-tip {
+	width: 100%;
+	padding: 20rpx;
+	font-size: 24rpx;
+	color: #888888;
+	box-sizing: border-box;
+}
+.exchange-tip-info {
+	height: 90rpx;
+	line-height: 90rpx;
+	border-radius: 8rpx;
+	text-align: center;
+	background: #e3e6e9;
+}
+.exchange-title {
+	width: 100%;
+	font-size: 24rpx;
+	color: #bbbbbb;
+	padding: 0 50rpx;
+	box-sizing: border-box;
+}
+.exchange-panel {
+	width: 710rpx;
+	margin: 20rpx auto 0;
+	background: #ffffff;
+	border-radius: 8rpx;
+	padding: 20rpx 30rpx 40rpx;
+	box-sizing: border-box;
+}
+.exchange-panel.bg {
+	background: #fcfcfc;
+}
+.exchange-rule {
+	width: 100%;
+	height: 120rpx;
+	border-bottom: 1rpx solid #eee;
+}
+.exchange-rule-company {
+	float: left;
+	width: 450rpx;
+	font-size: 28rpx;
+	color: #4c4c4c;
+	line-height: 30rpx;
+}
+.exchange-rule-company image {
+	float: left;
+	width: 100rpx;
+	height: 100rpx;
+	vertical-align: middle;
+	border-radius: 50%;
+	border: 2rpx solid #e5e5e5;
+	box-sizing: border-box;
+	display: inline-block;
+	margin-right: 22rpx;
+}
+.exchange-rule-per {
+	float: right;
+	height: 100rpx;
+	font-size: 28rpx;
+	color: #999;
+	line-height: 100rpx;
+}
+.exchange-rule-per image {
+	width: 25rpx;
+	height: 25rpx;
+	margin-left: 20rpx;
+	transform:rotate(90deg);
+}
+.exchange-company-slogan {
+	float: left;
+	margin-top: 12rpx;
+	line-height: 36rpx;
+}
+.exchange-integral {
+	width: 100%;
+	height: 60rpx;
+	line-height: 60rpx;
+}
+.exchange-integral1 {
+	width: 100%;
+	height: 100rpx;
+	line-height: 100rpx;
+}
+.exchange-integral-title {
+	font-size: 24rpx;
+	color: #999;
+}
+.exchange-integral-count {
+	float: right;
+	font-size: 28rpx;
+	color: #4c4c4c;
+}
+.exchange-radish {
+	position: relative;
+	width: 100%;
+	height: 100rpx;
+	font-size: 28rpx;
+	color: #7f93ae;
+	margin-bottom: 30rpx;
+	background-color: #f6f9fd;
+}
+.exchange-radish input {
+	display: inline-block;
+	width: 260rpx;
+	height: 100rpx;
+	font-size: 28rpx;
+	color: #4c4c4c;
+	margin-left: 30rpx;
+	box-sizing: border-box;
+	z-index: 88;
+}
+.exchange-radish .left {
+	float: left;
+	height: 100rpx;
+	line-height: 100rpx;
+	margin-left: 20rpx;
+}
+.exchange-radish .right {
+	float: right;
+	width: 124rpx;
+	height: 44rpx;
+	padding-top: 14rpx;
+	padding-right: 20rpx;
+}
+.exchange-radish .right image {
+	display: block;
+	width: 32rpx;
+	height: 32rpx;
+	margin: 6rpx auto;
+}
+.exchange-radish .right .bg {
+	width: 44rpx;
+	height: 44rpx;
+	background-color: #b8c6d9;
+	border-radius: 8rpx;
+	margin-top: 14rpx;
+}
+.exchange-btn1 {
+	width: 47%;
+	height: 100rpx;
+	line-height: 100rpx;
+	border-radius: 8rpx;
+	text-align: center;
+	font-size: 28rpx;
+	color: #eab86a;
+	margin-top: 30rpx;
+	border: 1rpx solid #eab86a;
+}
+.exchange-btn2 {
+	display: block;
+	width: 47%;
+	height: 100rpx;
+	line-height: 100rpx;
+	background: #eab86a;
+	border-radius: 8rpx;
+	text-align: center;
+	margin-top: 30rpx;
+}
+.exchange-btn2__button {
+	width: 100%;
+	height: 100%;
+	font-size: 28rpx;
+	color: #fff;
+	line-height: 100rpx;
+}
+.secondTitle {
+	width: 320rpx;
+	font-size: 24rpx;
+	color: #999;
+}
+.redWord {
+	color: #eab86a;
+}
+.pwdDialog {
+	position: absolute;
+	top: 0%;
+	width: 100%;
+	height: 100%;
+	background: rgba(0, 0, 0, 0.5);
+	z-index: 100;
+}
+.pwdDialog-panel {
+	width: 650rpx;
+	height: 584rpx;
+	background-color: #fff;
+	border-radius: 8rpx;
+	margin: 260rpx auto;
+	padding: 0 30rpx;
+}
+.pwdDialog-hearder {
+	width: 100%;
+	height: 100rpx;
+	line-height: 100rpx;
+	font-size: 28rpx;
+	color: #999;
+	border-bottom: 1rpx solid #eee;
+}
+.pwdDialog-hearder image {
+	float: right;
+	position: relative;
+	top: 32rpx;
+	width: 36rpx;
+	height: 36rpx;
+}
+.pwdDialog-logo {
+	width: 100rpx;
+	height: 100rpx;
+	margin: 20rpx auto;
+}
+.pwdDialog-logo image {
+	width: 100rpx;
+	height: 100rpx;
+	border: 1rpx solid #eee;
+	border-radius: 100rpx;
+	box-sizing: border-box;
+}
+.pwdDialog-input {
+	width: 100%;
+	height: 100rpx;
+	line-height: 100rpx;
+	border: 1rpx solid #e5e5e5;
+	background-color: #f6f9fd;
+	font-size: 28rpx;
+	color: #7f93ae;
+	padding: 0 30rpx;
+	box-sizing: border-box;
+}
+.pwdDialog-input input {
+	float: right;
+	width: 300rpx;
+	height: 100rpx;
+	text-align: right;
+}
+.pwdDialog-btn {
+	width: 100%;
+	height: 100rpx;
+	line-height: 100rpx;
+	border-radius: 8rpx;
+	text-align: center;
+	font-size: 28rpx;
+	color: #fff;
+	background-color: #eab86a;
+	margin-top: 30rpx;
+}
+.pwdDialog-forgot {
+	width: 100%;
+	height: 28rpx;
+	line-height: 28rpx;
+	text-align: center;
+	font-size: 28rpx;
+	color: #3d7cbc;
+	margin-top: 40rpx;
+}
+.ydDialog-panel {
+	width: 650rpx;
+	background-color: #fff;
+	border-radius: 8rpx;
+	margin: 260rpx auto;
+	padding: 0 30rpx 30rpx;
+}
+.ydDialog-input {
+	position: relative;
+	width: 590rpx;
+	height: 100rpx;
+	margin: 0 auto;
+}
+.ydDialog-input input {
+	display: block;
+	width: 100%;
+	height: 100rpx;
+	background-color: #f6f9fd;
+	border: solid 1rpx #e5e5e5;
+	font-size: 28rpx;
+	color: #b8c6d9;
+	padding-left: 30rpx;
+	box-sizing: border-box;
+}
+.ydDialog-btn {
+	width: 590rpx;
+	height: 100rpx;
+	line-height: 100rpx;
+	border-radius: 8rpx;
+	text-align: center;
+	font-size: 28rpx;
+	color: #fff;
+	background-color: #eab86a;
+	margin: 30rpx auto 0;
+}
+.ydDialog-btnCode {
+	position: absolute;
+	top: 18rpx;
+	right: 16rpx;
+	width: 250rpx;
+	height: 64rpx;
+	line-height: 64rpx;
+	font-size: 28rpx;
+	color: #eab86a;
+	text-align: center;
+	background-color: #fff;
+	border-radius: 32rpx;
+	border: 1rpx solid #cccccc;
+	box-sizing: border-box;
+	z-index: 99;
+}
+.user-title{
+	position: absolute;
+	font-size: 26rpx;
+	color: #ffc4af;
+	top: 110rpx;
+	left: 52rpx;
+}
+.bind {
+	position: absolute;
+	font-size: 26rpx;
+	color: #fff;
+	top: 110rpx;
+	left: 228rpx;
+	text-decoration:underline
+}
+.swiper{
+	/* margin: 0 auto; */
+	margin: 0 20rpx;
+	border-radius: 10rpx;
+	height: 172rpx;
+}
+.swiper image{
+	width: 100%;
+	height: 172rpx;
+	/*height: 172rpx;*/
+}
+.exchange-integral-text{
+	padding-top:4rpx;
+	font-size: 24rpx;
+	color: #999;
+	float: right;
+}

+ 17 - 0
packageUser/pages/user/exchangeSuccess/exchangeSuccess.js

@@ -0,0 +1,17 @@
+var _handle = require('../../../../utils/handle.js')
+Page({
+  data: {
+  },
+  getAll (e) {
+    _handle.setFormId(e)
+    wx.reLaunch({
+      url: '/pages/user/all/all'
+    })
+  },
+  getExchange (e) {
+    _handle.setFormId(e)
+    wx.navigateTo({
+      url: '/packageUser/pages/user/exchange/exchange'
+    })
+  }
+})

+ 3 - 0
packageUser/pages/user/exchangeSuccess/exchangeSuccess.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "汇兑成功"
+}

+ 15 - 0
packageUser/pages/user/exchangeSuccess/exchangeSuccess.wxml

@@ -0,0 +1,15 @@
+<view class="bg">
+  <view class="block"> </view>
+  <image class="bind-logo" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/bindsuccess.png"></image>
+  <view class="bind-text">汇兑成功</view>
+  <form bindsubmit="getExchange" report-submit="{{true}}"  class="bind-btn">
+    <button formType="submit" class="bind-btn__button">
+      继续汇兑
+    </button>
+  </form>
+  <form bindsubmit="getAll" report-submit="{{true}}"  class="bind-btn1">
+    <button formType="submit" class="bind-btn1__button">
+      返回个人主页
+    </button>
+  </form>
+</view>

+ 52 - 0
packageUser/pages/user/exchangeSuccess/exchangeSuccess.wxss

@@ -0,0 +1,52 @@
+.bg {
+  width: 100%;
+  height: 100%;
+  background-color: #fff;
+}
+.block {
+  height: 233rpx;
+}
+.bind-logo {
+  display: block;
+  width: 200rpx;
+  height: 200rpx;
+  margin: 0 auto;
+}
+.bind-text {
+  padding-top: 30rpx;
+  font-size: 32rpx;
+  color: #eab86a;
+  text-align: center;
+}
+.bind-btn {
+  display: block;
+  margin: 375rpx auto 0;
+  width: 710rpx;
+  height: 88rpx;
+  border: 1px solid #eab86a;
+  border-radius: 4rpx;
+}
+.bind-btn__button {
+  width: 710rpx;
+  height: 88rpx;
+  text-align: center;
+  line-height: 88rpx;
+  color: #eab86a;
+  font-size: 28rpx;
+}
+.bind-btn1 {
+  display: block;
+  margin: 20rpx auto 0;
+  width: 710rpx;
+  height: 88rpx;
+  border: 1px solid #cccccc;
+  border-radius: 4rpx;
+}
+.bind-btn1__button {
+  width: 710rpx;
+  height: 88rpx;
+  text-align: center;
+  line-height: 88rpx;
+  color: #999999;
+  font-size: 28rpx;
+}

+ 79 - 0
packageUser/pages/user/farm/farm.js

@@ -0,0 +1,79 @@
+var _request = require('../../../../utils/request.js')
+Page({
+  data : {
+    InvestmentList: [],
+    moneyCount: ''
+  },
+  onLoad: function (options) {
+    this.getIphoneX()
+    this.getInvestmentList()
+  },
+  toFarm() {
+   // wx.navigateTo({
+   //   url: '/packageUser/pages/user/farm/farm'
+   // })
+  },
+  toGranary() {
+    wx.redirectTo({
+      url: '/packageUser/pages/user/granary/granary'
+    })
+  },
+  getInvestmentList() {
+    var that = this
+    var url = "v1/project/had_invest/list"
+    var params = {
+      cache: false
+    }
+    var success = function (val) {
+      that.setData({
+        InvestmentList: val.data.list,
+        moneyCount: val.data. help_investment
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  getIphoneX () {
+    var that = this
+    wx.getSystemInfo({
+      success: function (res) {
+        if (res.model.toLowerCase().indexOf('iphone x') > -1) {
+          that.setData({
+            value: 34
+          })
+        }
+      }
+    })
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_farm'
+    })
+  },
+  tosell (e) {
+    var that = this
+    var url = "v1/user/granary/" + e.currentTarget.dataset.id
+    var params = {
+      cache: false
+    }
+    var success = function (val) {
+      if (val.data) {
+        if (val.data.buyback_max && (val.data.total_count - val.data.self_use_min > 0)) {
+          wx.navigateTo({
+            url: '/packageUser/pages/user/granary/use/use?tab=sell&order_id=' + e.currentTarget.dataset.id
+          })
+        }
+        if (!val.data.buyback_max && (val.data.total_count - val.data.self_use_min > 0)) {
+          wx.navigateTo({
+            url: '/packageUser/pages/user/granary/use/use?tab=sell&order_id=' + e.currentTarget.dataset.id
+          })
+        }
+        if (!val.data.buyback_max && (val.data.total_count - val.data.self_use_min <= 0)) {
+          wx.navigateTo({
+            url: '/packageUser/pages/user/granary/use/use?tab=mine&order_id=' + e.currentTarget.dataset.id
+          })
+        }
+      }
+    }
+    _request.$get(url, params, success)
+  }
+})

+ 8 - 0
packageUser/pages/user/farm/farm.json

@@ -0,0 +1,8 @@
+{
+ "navigationBarTitleText": "我的团购",
+ "backgroundColor": "#f3f3f3",
+ "usingComponents": {
+  "currency": "../../../../component/currency/currency",
+  "format-time": "../../../../component/formatTime/formatTime"
+  }
+}

+ 74 - 0
packageUser/pages/user/farm/farm.wxml

@@ -0,0 +1,74 @@
+<view class="farm-center-bg">
+  <view class="farm-top">
+    <view class="farm-money">团购总额 ( 元 )</view>
+    <view class="farm-count">{{moneyCount / 100}}</view>
+    <!--
+    <view class="farm-btn">
+      <text class="farm-btn-text">预期回报 ( 元 )</text>
+      <text class="farm-btn-count">38865.55</text>
+    </view>
+    -->
+  </view>
+  <!--
+  <view class="farm-title"><view class="farm-line"></view>资助农场<view class="farm-line1"></view></view>
+  -->
+  <view class="farm-tip">开仓放粮后,可前往我的粮仓对商品进行分配 (自用/代销/回购)</view>
+  <view class="farm-item" wx:for="{{InvestmentList}}" wx:key="{{index}}" wx:if="{{InvestmentList.length && item.is_harvest}}" data-id="{{item.granary_id}}" bindtap="tosell">
+    <image class="farm-item-img" src="{{item.project_thumb_img}}"/>
+    <text class="farm-item-text">{{item.project_name}}</text>
+    <view class="farm-item-text1">
+      <view class="item-money">{{item.project_invest_way_name}} ( ¥{{item.sum_total_price / 100}} )</view>
+      <!--<view class="item-money1">( ¥{{item.sum_total_price / 100}} )</view>-->
+      <view class="item-count">持{{item.sum_count}}份</view>
+    </view>
+    <view class="clean"></view>
+    <view class="item-line"></view>
+    <!--<view class="farm-item-yuji">
+      <view class="farm-item-text2" wx:if="{{item.guess_harvest_time != 0}}">预计<format-time type="formatmonth" value="{{item.guess_harvest_time}}" ></format-time>放粮</view>
+      <text class="farm-item-text2" wx:if="{{item.guess_harvest_time == 0}}">暂无预计收成时间</text>
+      <text class="farm-item-text3" wx:if="{{item.guess_harvest_price == 0}}">暂无预计回报额</text>
+      <text class="farm-item-text3" wx:if="{{item.guess_harvest_price != 0}}">预计回报额 : ¥{{item.guess_harvest_price / 100}}</text>
+      <view class="clean"></view>
+    </view>-->
+    <view class="farm-item-yuji1">
+      <view class="farm-item-text4">已放粮( <format-time type="formatDay" value="{{item.valid_harvest_time}}" ></format-time> )</view>
+    </view>
+  </view>
+
+  <view class="farm-item" wx:for="{{InvestmentList}}" wx:key="{{index}}" wx:if="{{InvestmentList.length && !item.is_harvest}}">
+    <image class="farm-item-img" src="{{item.project_thumb_img}}"/>
+    <text class="farm-item-text">{{item.project_name}}</text>
+    <view class="farm-item-text1">
+      <view class="item-money">{{item.project_invest_way_name}} ( ¥{{item.sum_total_price / 100}} )</view>
+      <!--<view class="item-money1">( ¥{{item.sum_total_price / 100}} )</view>-->
+      <view class="item-count">持{{item.sum_count}}份</view>
+    </view>
+    <view class="clean"></view>
+    <view class="item-line1"></view>
+    <view class="farm-item-yuji">
+      <view class="farm-item-text2" wx:if="{{item.guess_harvest_time != 0}}">预计<format-time type="formatmonth" value="{{item.guess_harvest_time}}" ></format-time>放粮</view>
+      <view class="farm-item-text2" wx:if="{{item.guess_harvest_time == 0}}">暂无预计收成时间</view>
+      <view class="farm-item-text3" wx:if="{{item.guess_harvest_price == 0}}">暂无预计回报额</view>
+      <view class="farm-item-text3" wx:if="{{item.guess_harvest_price != 0}}">预计回报额 : ¥{{item.guess_harvest_price / 100}}</view>
+      <view class="clean"></view>
+    </view>
+    <!--<view class="farm-item-yuji1">
+      <view class="farm-item-text4">已放粮( <format-time type="formatDay" value="{{item.valid_harvest_time}}" ></format-time> )</view>
+    </view>-->
+  </view>
+
+  <view class="farm-footer" style="padding-bottom: {{value}}rpx;">
+    <view class="myfarm" bindtap="toFarm">
+      <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/icon/tiny_logo3.png" class="myfarm-img"/>
+      <view class="myfarm-text">我的团购</view>
+    </view>
+    <view class="mygranary" bindtap="toGranary">
+       <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/icon/tiny_logo2.png" class="mygranary-img"/>
+       <view class="mygranary-text">我的粮仓</view>
+    </view>
+  </view>
+  <view class="orders-no" wx:if="{{InvestmentList.length <= 0}}">
+      <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/unorders.png" class="orders-no__icon"></image>
+      <view class="orders-no__text">暂无相关信息</view>
+    </view>
+</view>

+ 281 - 0
packageUser/pages/user/farm/farm.wxss

@@ -0,0 +1,281 @@
+.farm-top {
+  /* height: 340rpx; */
+  height: 248rpx;
+  width: 100%;
+  position: relative;
+  background: -webkit-linear-gradient(#fe5957, #ff8678 , #ffba9d);
+  background: -o-linear-gradient(#fe5957, #ff8678 , #ffba9d); 
+  background: -moz-linear-gradient(#fe5957, #ff8678 , #ffba9d); 
+  background: linear-gradient(#fe5957, #ff8678 , #ffba9d);
+  margin-bottom: 20rpx; 
+}
+.farm-money {
+  font-size: 30rpx;
+  color: #ffffff;
+  padding-top: 62rpx;
+  padding-left: 50rpx;
+}
+.farm-count {
+  font-size: 60rpx;
+  color: #fff;
+  padding-top: 25rpx;
+  padding-left: 50rpx;
+  font-weight: 600;
+}
+.farm-btn {
+  position: absolute;
+  height: 111rpx;
+  width: 711rpx;
+  margin: 0 auto;
+  left: 50%;
+  transform: translateX(-50%);
+  bottom: 0;
+  border-top-left-radius:10rpx;
+  border-top-right-radius:10rpx;
+  border-bottom: 1rpx solid #faddb2;
+  background: -webkit-linear-gradient(#fffcf5, #fff6e8 , #fff0dd);
+  background: -o-linear-gradient(#fffcf5, #fff6e8 , #fff0dd); 
+  background: -moz-linear-gradient(#fffcf5, #fff6e8 , #fff0dd); 
+  background: linear-gradient(#fffcf5, #fff6e8 , #fff0dd); 
+}
+.farm-btn-text {
+  float: left;
+  font-size: 30rpx;
+  color: #cfa79a;
+  padding-top: 30rpx;
+  padding-left: 35rpx;
+}
+.farm-btn-count {
+  float: right;
+  font-size: 40rpx;
+  color: #ba8777;
+  padding-top: 26rpx;
+  padding-right: 35rpx;
+}
+.farm-center-bg {
+  width: 100%;
+  min-height: 100%;
+  background: #f3f3f3;
+  /* overflow: auto; */
+  padding-bottom: 90rpx;
+  box-sizing: border-box;
+}
+.farm-title {
+  height: 86rpx;
+  width: 711rpx;
+  margin: 0 auto;
+  text-align: center;
+  font-size: 30rpx;
+  color: #999999;
+  line-height: 86rpx;
+  position: relative;
+}
+.farm-line {
+  height: 1rpx;
+  width: 286rpx;
+  background: #ccc;
+  position: absolute;
+  /* transform: translateY(-50%); */
+  top: 45rpx;
+  left: 0;
+}
+.farm-line1 {
+  height: 1rpx;
+  width: 286rpx;
+  background: #ccc;
+  position: absolute;
+  /* transform: translateY(-50%); */
+  top: 45rpx;
+  right: 0;
+}
+.farm-item {
+  height: 270rpx;
+  width: 711rpx;
+  background: #fff;
+  margin: 0 auto 30rpx;
+  border-radius: 10rpx;
+  position: relative;
+}
+.farm-item-img {
+  padding-top: 30rpx;
+  padding-left: 30rpx;
+  float: left;
+  width: 230rpx;
+  height: 125rpx
+}
+.farm-item-text {
+  font-size: 28rpx;
+  height: 76rpx;
+  float: left;
+  width: 400rpx;
+  padding-top: 30rpx;
+  padding-left: 30rpx;
+  display: -webkit-box;
+  -webkit-box-orient: vertical;
+  -webkit-line-clamp: 2;
+  overflow: hidden;
+  /* white-space: nowrap; */
+  text-overflow: ellipsis;
+}
+.farm-item-text1 {
+  width: 400rpx;
+  padding-left: 30rpx;
+  padding-top: 10rpx;
+  float: left;
+}
+.item-money {
+  color: #999999;
+  font-size: 24rpx;
+  width: 315rpx;
+  overflow: hidden;
+  /* height: 30rpx; */
+  float: left;
+}
+.item-money1 {
+  color: #999999;
+  font-size: 24rpx;
+  width: 130rpx;
+  overflow: hidden;
+  height: 30rpx;
+  float: left;
+}
+.item-count {
+ /* padding-top: 18rpx; */
+ color: #999999;
+ font-size: 24rpx;
+ float: right;
+}
+.item-line {
+  width: 711rpx;
+  height: 1rpx;
+  background: #ccc;
+  position: absolute;
+  top: 200rpx;
+  left: 0;
+}
+.item-line1 {
+  width: 711rpx;
+  height: 1rpx;
+  background: #ccc;
+  position: absolute;
+  top: 200rpx;
+  left: 0;
+}
+.farm-item-yuji {
+  position: absolute;
+  bottom: 15rpx;
+  left: 50%;
+  transform: translate(-50%);
+  width: 100%;
+}
+.farm-item-yuji1 {
+  text-align: center;
+  position: absolute;
+  bottom: 15rpx;
+  left: 50%;
+  transform: translate(-50%);
+}
+.farm-item-text2 {
+  font-size: 26rpx;
+  color: #999999;
+  float: left;
+  padding-left:30rpx;
+}
+.farm-item-text3 {
+  font-size: 26rpx;
+  color: #999999;
+  float: right;
+  padding-right: 30rpx;
+}
+.farm-item-text4 {
+  font-size: 26rpx;
+  color: #f1a8aa;
+  /* float: right; */
+  text-align: center;
+}
+.farm-footer {
+  width: 100%;
+  height: 89rpx;
+  background: #fff;
+  position: fixed;
+  bottom: 0;
+  left: 0;
+  z-index: 999;
+  border-top: 1rpx solid #ddd; 
+  padding-bottom: 10rpx;
+}
+.myfarm {
+  width: 50%;
+  height: 89rpx;
+  float: left;
+}
+.mygranary {
+  float: right;
+  width: 50%;
+  height: 89rpx;
+}
+.myfarm-img {
+  width: 40rpx;
+  height: 40rpx;
+  margin: 0 auto;
+  padding-left: 168rpx;
+  padding-top: 10rpx;
+  /* position: absolute;
+  top: 15rpx;
+  left: 168rpx; */
+}
+.mygranary-img {
+  width: 40rpx;
+  height: 40rpx;
+  margin: 0 auto;
+  padding-left: 168rpx;
+  padding-top: 10rpx;
+  /* position: absolute;
+  top: 0;
+  right: 0; */
+}
+.myfarm-text {
+  color: #eab86a;
+  font-size: 20rpx;
+  /* position: absolute; */
+  /* padding-left: 152rpx; */
+  width: 100%;
+  text-align: center;
+}
+.mygranary-text {
+  color: #4c4c4c;
+  font-size: 20rpx;
+  /* position: absolute; */
+  /* padding-left: 152rpx; */
+  width: 100%;
+  text-align: center;
+}
+.orders-no {
+  padding-top: 250rpx;
+}
+.orders-no__icon {
+  display: block;
+  width: 204rpx;
+  height: 258rpx;
+  margin: 0 auto;
+}
+.orders-no__text {
+  text-align: center;
+  font-size: 28rpx;
+  margin-top: 25rpx;
+  color: #cccccc;
+}
+.farm-tip {
+  color: #ff6e6e;
+  font-size: 24rpx;
+  width: 711rpx;
+  background: #ffffff;
+  height: 82rpx;
+  /* text-align: center; */
+  padding-left: 30rpx;
+  line-height: 82rpx;
+  /* margin-top: 30rpx; */
+  margin: 30rpx auto 30rpx;
+  box-sizing: border-box;
+
+}

+ 237 - 0
packageUser/pages/user/fund/fund.js

@@ -0,0 +1,237 @@
+var _request = require('../../../../utils/request.js')
+Page({
+  data: {
+    page: 1,
+    per_page: 10,
+    cashTotal: '',
+    cashList: [],
+    cashList_more: true,
+    cashList_change: false,
+    identityDialog: false,
+    confirmDialog: false,
+    bannerList: [],
+    isCertificate: 0,
+    lockWithdraw: false,
+    has_bank:false
+  },
+  onLoad: function (options) {
+    this.getCashTotal()
+    this.getCashList()
+    this.getBanners()
+  },
+  onPullDownRefresh: function () {
+    this.setData({
+      page: 1,
+      cashList_more: true,
+      cashList_change: true
+    })
+    this.getCashList()
+    wx.stopPullDownRefresh()
+  },
+  onReachBottom: function () {
+    if (this.data.cashList_more) {
+      var page = this.data.page + 1
+      this.setData({
+        page: page
+      })
+      this.getCashList()
+    }
+  },
+  onShow () {
+    this.getCashTotal()
+    this.checkCertified()
+  },
+  getCashTotal () {
+    var that = this
+    var url = 'v1/user/cash/balance/info'
+    var params = {
+    }
+    var success = function (res) {
+      that.setData({
+        cashTotal: res.data
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  getCashList () {
+    var that = this
+	var url = 'v1/user/cash/balances'
+    var params = {
+      page: that.data.page,
+      per_page: that.data.per_page
+    }
+    var success = function (res) {
+      if (that.data.cashList_change) {
+        that.setData({
+          cashList: [],
+          cashList_change: false
+        })
+      }
+      var result = that.data.cashList.concat(res.data.balance_list || [])
+      var listMore = res.data.balance_count > result.length
+      that.setData({
+        cashList: result,
+        cashList_more: listMore
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  tipClick () {
+    var that = this
+    // if (!that.data.isCertificate) {
+    // }
+    that.data.confirmDialog = !that.data.confirmDialog
+    if (that.data.cashTotal.available >= 50) {
+      that.setData({
+        confirmDialog: that.data.confirmDialog
+      })
+    } else {
+      wx.showToast({
+        title: '提现金额需要大于50元哦~',
+        icon: 'none',
+        duration: 2000
+      })
+    }
+  },
+  getBankInfoAndTip(){
+  	var that = this
+    var url = 'v1/user/get_bank_info'
+    var params = {
+    }
+    var success = function (res) {
+      	that.setData({
+			    has_bank:res.data.has_bank
+        })
+      	
+      	if(that.data.has_bank){
+			    that.data.confirmDialog = !that.data.confirmDialog
+			    if (that.data.cashTotal.available >= 50) {
+			      that.setData({
+			        confirmDialog: that.data.confirmDialog
+			      })
+			    } else {
+			      wx.showToast({
+			        title: '提现金额需要大于50元哦~',
+			        icon: 'none',
+			        duration: 2000
+			      })
+			    }
+		    }else{
+		    	wx.showToast({
+		        title: '提现请先绑定银行卡~',
+		        icon: 'none',
+		        duration: 2000
+		      })
+		    	setTimeout(function(){
+		    		wx.navigateTo({
+				      url: '/packageUser/pages/user/bankinfo/bankinfo'
+				    })
+		    	},1000)
+		    }
+    }
+    _request.$get(url, params, success)
+  },
+  goRechargeClick () {
+    wx.navigateTo({
+      url: '/packageUser/pages/user/recharge/recharge'
+    })
+  },
+  goIdentityClick () {
+    var that = this
+    that.setData({
+      identityDialog: false
+    })
+    wx.navigateTo({
+      url: '/packageUser/pages/user/identity/identity'
+    })
+  },
+  goWithdrawClick () {
+    wx.navigateTo({
+      url: '/packageUser/pages/user/withdraw/withdraw'
+    })
+  },
+  cancelIdentity () {
+    var that = this
+    that.setData({
+      identityDialog: false
+    })
+  },
+  buyClick () {
+    var that = this
+    wx.navigateTo({
+      url: that.data.bannerList[0].url
+    })
+  },
+  confrimClick () {
+    var that = this
+    console.log('that.data.has_bank',that.data.has_bank)
+    if (that.data.has_bank) {
+      that.withdrawClick()
+    } else {
+      that.setData({
+        confirmDialog: false,
+        identityDialog: true
+      })
+    }
+  },
+  closedDialog () {
+    var that = this
+    that.setData({
+      confirmDialog: false
+    })
+  },
+  withdrawClick () {
+    var that = this
+    var url = 'v1/user/takecash'
+    var params = {
+      amount: that.data.cashTotal.available
+    }
+    var success = function (res) {
+      if (res.data) {
+        that.setData({
+          confirmDialog: false
+        })
+        // that.data.lockWithdraw = false
+        wx.showToast({
+          title: '提现成功~',
+          icon: 'none',
+          duration: 2000
+        })
+        wx.navigateTo({
+          url: '/packageUser/pages/user/withdraw/withdraw'
+        })
+      }
+    }
+    _request.$post(url, params, success)
+  },
+  getBanners: function () {
+    var that = this
+    var url = 'v1/ad/withdraw_ad/items'
+    var params = {
+      cache: false
+    }
+    var success = function (res) {
+      that.setData({
+        bannerList: res.data
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  checkCertified () {
+    var that = this
+    var url = 'v1/user/certificate'
+    var params = {
+    }
+    var success = function (res) {
+      that.setData({
+        isCertificate: res.data.is_certification
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_cash'
+    })
+  }
+})

+ 9 - 0
packageUser/pages/user/fund/fund.json

@@ -0,0 +1,9 @@
+{
+  "navigationBarTitleText": "收入统计",
+  "usingComponents": {
+    "currency": "../../../../component/currency/currency",
+    "format-time": "../../../../component/formatTime/formatTime"
+  },
+  "backgroundColor": "#f3f3f3",
+  "enablePullDownRefresh": true
+}

+ 61 - 0
packageUser/pages/user/fund/fund.wxml

@@ -0,0 +1,61 @@
+<view>
+  <view class="fund-head">
+    <view class="title">可提现金额(元) <image class="withdrawIcon" src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/icon/tiny_logo5.png" bindtap="goWithdrawClick"></image></view>
+    <view class="price"><currency symbol=" " value="{{cashTotal.available}}" ></currency></view>
+
+    <view class="fund__btnAll">
+      <view class="fund__btn withdraw" bindtap="getBankInfoAndTip" wx:if="{{cashTotal.available}}">提现</view>
+      <view class="fund__btn withdrawNot" wx:if="{{!cashTotal.available}}">暂无提现</view>
+      <!--<view class="fund__btn recharge" bindtap="goRechargeClick">充值</view>-->
+      <view class="clean"></view>
+    </view>
+    <view wx:if="{{false}}">
+      <view class="btn" bindtap="getBankInfoAndTip" wx:if="{{cashTotal.available}}">点击提现</view>
+      <view class="not" wx:if="{{!cashTotal.available}}">暂无提现</view>
+    </view>
+    
+    <view class="total">累积收入已达<currency symbol=" " value="{{cashTotal.total}}" ></currency>元</view>
+  </view>
+
+  <view class="granary-no" wx:if="{{!cashList.length}}">
+    <image src="http://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/user/unorders.png" class="granary-no__icon"></image>
+    <view class="granary-no__text">暂无收入</view>
+  </view>
+
+  <view class="fund-list" wx:if="{{cashList.length}}">
+  	<view class="fund-info" wx:key="{{index}}" wx:for="{{cashList}}">
+  		<view class="fund-goods">
+  			<view class="name">【{{item.source_name}}】{{item.remark}}</view>
+  			<view class="clean"></view>
+  		</view>
+      <view class="price" wx:if="{{item.count > 0}}"><currency symbol="+" value="{{item.count}}" ></currency>元</view>
+  		<view class="price green" wx:if="{{item.count < 0}}"><currency symbol="" value="{{item.count}}" ></currency>元</view>
+  		<view class="time"><format-time type="formatTime1" value="{{item.c_time}}" ></format-time></view>
+      <view class="clean"></view>
+  	</view>
+  </view>
+
+  <!-- 确认提现弹框 -->
+  <view class="fund__modal" wx:if="{{confirmDialog}}" bindtap="closedDialog">
+    <view class="content">
+      <image class="image2" src="{{bannerList[0].img}}"></image>
+      <view class="doing">{{bannerList[0].name}} </view>
+      <view class="continue" bindtap="buyClick">继续赚钱</view>
+      <view class="withdraw" bindtap="confrimClick">确认提现</view>
+    </view>
+  </view>
+  <!-- 未认证提示弹框 -->
+  <view class="fund__modal" wx:if="{{identityDialog}}">
+    <view class="content">
+      <image class="image1" src="https://fohow.oss-cn-shenzhen.aliyuncs.com/xcx/xcx/rabbitimg/identity_bg.png"></image>
+      <view class="p1">尚未认证身份</view>
+      <view class="p2">提现前需完成认证操作</view>
+      <view class="btn">
+        <view class="noBtn" bindtap="cancelIdentity">暂不认证</view>
+        <view class="goBtn" bindtap="goIdentityClick">前往认证</view>
+        <view class="clean"></view>
+      </view>
+    </view>
+  </view>
+
+</view>

+ 242 - 0
packageUser/pages/user/fund/fund.wxss

@@ -0,0 +1,242 @@
+.fund-bg {
+  width: 100%;
+  min-height: 100%;
+  background: #f3f3f3;
+  padding-bottom: 90rpx;
+}
+.fund-head {
+  position: relative;
+  width: 100%;
+  height: 440rpx;
+  text-align: center;
+  background: -webkit-linear-gradient(#eab86a, #d4932b);
+  background: -o-linear-gradient(#eab86a, #d4932b); 
+  background: -moz-linear-gradient(#eab86a, #d4932b); 
+  background: linear-gradient(#eab86a, #d4932b); 
+}
+.fund-head .title {
+  position: relative;
+  font-size: 28rpx;
+  color: #ffffff;
+  padding-top: 40rpx;
+}
+.fund-head .withdrawIcon {
+  position: absolute;
+  right: 50rpx;
+  width: 32rpx;
+  height: 40rpx;
+}
+.fund-head .price {
+  font-size: 72rpx;
+  color: #ffffff;
+  margin-top: 18rpx;
+  margin-bottom: 40rpx;
+}
+.fund-head .btn {
+  width: 300rpx;
+  height: 80rpx;
+  background-color: #ffffff;
+  border-radius: 40rpx;
+  margin: 0 auto;
+  line-height: 80rpx;
+  color: #5ebf62;
+  font-size: 32rpx;
+}
+.fund-head .not {
+  /*float: left;*/
+  width: 250rpx;
+  height: 80rpx;
+  background-color: #ffffff;
+  border-radius: 40rpx;
+  margin: 0 auto;
+  line-height: 80rpx;
+  color: #eab86a;
+  font-size: 32rpx;
+}
+.fund-head .total {
+  font-size: 28rpx;
+  color: #ffffff;
+  margin-top: 50rpx;
+}
+.fund-list {
+  width: 100%;
+  padding: 0 20rpx;
+  box-sizing: border-box;
+}
+.fund-info {
+  /* height: 160rpx; */
+  padding: 30rpx 0;
+  border-bottom: 1rpx solid #cccccc; 
+  box-sizing: border-box;
+}
+.fund-info .time {
+  font-size: 24rpx;
+  color: #bbbbbb;
+  margin-top: 10rpx;
+  float: right;
+}
+.fund-goods {
+}
+.fund-goods .name {
+  float: left;
+  width: 711rpx;
+  font-size: 28rpx;
+  color: #4c4c4c;
+  display: -webkit-box;
+  text-overflow: ellipsis;
+  -webkit-line-clamp: 2;
+  overflow: hidden;
+  -webkit-box-orient: vertical;
+  line-height: 40rpx;
+  margin-bottom: 22rpx;
+}
+.fund-info .price {
+  float: left;
+  width: 250rpx;
+  font-size: 28rpx;
+  color: #eab86a;
+  /* text-align: right; */
+}
+.fund-info .price.green {
+  color: #5ebf62;
+}
+
+.granary-no {
+  padding-top: 200rpx;
+}
+.granary-no__icon {
+  display: block;
+  width: 204rpx;
+  height: 258rpx;
+  margin: 0 auto;
+}
+.granary-no__text {
+  text-align: center;
+  font-size: 28rpx;
+  margin-top: 25rpx;
+  color: #cccccc;
+}
+.fund__btnAll {
+  width: 520rpx;
+  margin: 0 auto;
+}
+.fund__btnAll .withdraw {
+  color: #5ebf62;
+  margin-right: 40rpx;
+  float: none;
+margin: 0 auto;
+  
+}
+.fund__btnAll .withdrawNot {
+  background-color: #ffffff;
+  color: #eab86a;
+  margin-right: 40rpx;
+  float: none;
+margin: 0 auto;
+  
+}
+.fund__btnAll .recharge {
+  color: #eab86a;
+}
+.fund__btn {
+  float: left;
+  width: 240rpx;
+  height: 80rpx;
+  background: #fff;
+  border-radius: 40rpx;
+  line-height: 80rpx;
+  text-align: center;
+  font-size: 32rpx;
+}
+.fund__modal {
+  position: fixed;
+  top: 0;
+  left: 0;
+  width: 100%;
+  height: 100%;
+  padding: 0 20rpx;
+  background: rgba(0, 0, 0, 0.3);
+  box-sizing: border-box;
+  z-index: 200;
+}
+.fund__modal .content {
+  width: 560rpx;
+  background: #fff;
+  text-align: center;
+  font-size: 32rpx;
+  color: #7f93ae;
+  margin: 360rpx auto 0;
+}
+.fund__modal .image1 {
+  display: block;
+  width: 82rpx;
+  height: 102rpx;
+  margin: 0 auto 20rpx;
+  padding-top: 90rpx;
+}
+.fund__modal .image2 {
+  display: block;
+  width: 560rpx;
+  height: 472rpx;
+  margin-bottom: 20rpx;
+}
+.fund__modal .p1{
+  font-size: 36rpx;
+  font-weight: 600;
+  margin-bottom: 30rpx;
+}
+.fund__modal .p2{
+  font-size: 28rpx;
+  margin-bottom: 42rpx;
+}
+.fund__modal .btn {
+  width: 560rpx;
+  height: 100rpx;
+  line-height: 100rpx;
+  font-size: 28rpx;
+  text-align: center;
+}
+.fund__modal .noBtn {
+  float: left;
+  width: 50%;
+  height: 100rpx;
+  background-image: linear-gradient(90deg, 
+    #e5e9ec 0%, 
+    #cfd9e0 100%);
+  line-height: 100rpx;
+  font-size: 28rpx;
+  text-align: center;
+  color: #7f93ae;
+}
+.fund__modal .goBtn {
+  float: left;
+  width: 50%;
+  height: 100rpx;
+  background-image: linear-gradient(90deg, 
+    #eab86a 0%, 
+    #e23232 100%);
+  line-height: 100rpx;
+  font-size: 28rpx;
+  text-align: center;
+  color: #fff;
+}
+.fund__modal .doing {
+  font-size: 28rpx;
+}
+.fund__modal .continue {
+  width: 376rpx;
+  height: 88rpx;
+  background-image: linear-gradient(90deg, 
+    #eab86a 0%, 
+    #e23232 100%);
+  border-radius: 44rpx;
+  margin: 40rpx auto 30rpx;
+  font-size: 28rpx;
+  color: #fff;
+  line-height: 88rpx;
+  letter-spacing: 6rpx;
+}
+.fund__modal .withdraw {
+  font-size: 28rpx;
+  padding-bottom: 44rpx;
+}

+ 108 - 0
packageUser/pages/user/granary/granary.js

@@ -0,0 +1,108 @@
+var _request = require('../../../../utils/request.js')
+Page({
+	data: {
+    page: 1,
+    per_page: 10,
+    productList: [],
+    productTotal: 0,
+    more: true,
+    show: false,
+    angle: 0,
+    curIndex: 0
+  },
+	onLoad: function (options) {
+    this.getIphoneX()
+    this.getProductList()
+  },
+  onShow: function () {
+    this.data.page = 1
+    // this.getProductList()
+  },
+  toFarm() {
+	  wx.redirectTo({
+	    url: '/packageUser/pages/user/farm/farm'
+	  })
+  },
+  toSell(e) {
+    wx.navigateTo({
+      url: '/packageUser/pages/user/granary/use/use?tab=sell&order_id=' + e.currentTarget.dataset.id
+    })
+  },
+  toBack(e) {
+    wx.navigateTo({
+      url: '/packageUser/pages/user/granary/use/use?tab=return&order_id=' + e.currentTarget.dataset.id
+    })
+  },
+  toMine(e) {
+    wx.navigateTo({
+      url: '/packageUser/pages/user/granary/use/use?tab=mine&order_id=' + e.currentTarget.dataset.id
+    })
+  },
+  toMine1(e) {
+    wx.navigateTo({
+      url: '/packageUser/pages/user/granary/use/use?tab=mine1&order_id=' + e.currentTarget.dataset.id
+    })
+  },
+  review (e) {
+    var that = this
+    that.data.show = !that.data.show
+    if (that.data.show) {
+      that.data.angle = 180
+    } else {
+      that.data.angle = 0
+    }
+    that.data.curIndex = e.currentTarget.dataset.cur
+    if (that.data.curIndex === e.currentTarget.dataset.cur) {
+      that.setData({
+        show: that.data.show,
+        angle: that.data.angle,
+        curIndex: that.data.curIndex
+      })
+    }
+  },
+  getProductList () {
+    var that = this
+    var url = 'v1/user/granaries'
+    var params = {
+      page: that.data.page,
+      per_page: that.data.per_page,
+      cache: false
+    }
+    var success = function (res) {
+      var result = that.data.productList.concat(res.data.list || [])
+      var listMore = res.data.list_count > that.data.productList.length
+      that.setData({
+        productList: result,
+        more: listMore,
+        productTotal: res.data.list_count
+      })
+    }
+    _request.$get(url, params, success)
+  },
+  onReachBottom: function () {
+    if (this.data.more) {
+      var page = this.data.page + 1
+      this.setData({
+        page: page
+      })
+      this.getProductList()
+    }
+  },
+  getIphoneX () {
+    var that = this
+    wx.getSystemInfo({
+      success: function (res) {
+        if (res.model.toLowerCase().indexOf('iphone x') > -1) {
+          that.setData({
+            value: 34
+          })
+        }
+      }
+    })
+  },
+  onShareAppMessage: function (val) {
+    return _request.share({
+      sc: 'xcx_user_granary'
+    })
+  }
+})

+ 0 - 0
packageUser/pages/user/granary/granary.json


Some files were not shown because too many files changed in this diff