zhangdechen 3 роки тому
батько
коміт
90215f7247
100 змінених файлів з 4700 додано та 0 видалено
  1. 21 0
      LICENSE
  2. 8 0
      joolun-wx-ma/README.md
  3. 127 0
      joolun-wx-ma/app.js
  4. 57 0
      joolun-wx-ma/app.json
  5. 44 0
      joolun-wx-ma/app.wxss
  6. 30 0
      joolun-wx-ma/components/base-rade/index.js
  7. 4 0
      joolun-wx-ma/components/base-rade/index.json
  8. 10 0
      joolun-wx-ma/components/base-rade/index.wxml
  9. 1 0
      joolun-wx-ma/components/base-rade/index.wxss
  10. 46 0
      joolun-wx-ma/components/base-stepper/index.js
  11. 4 0
      joolun-wx-ma/components/base-stepper/index.json
  12. 17 0
      joolun-wx-ma/components/base-stepper/index.wxml
  13. 11 0
      joolun-wx-ma/components/base-stepper/index.wxss
  14. 56 0
      joolun-wx-ma/components/count-down/index.js
  15. 4 0
      joolun-wx-ma/components/count-down/index.json
  16. 10 0
      joolun-wx-ma/components/count-down/index.wxml
  17. 1 0
      joolun-wx-ma/components/count-down/index.wxss
  18. 43 0
      joolun-wx-ma/components/coupon-info/index.js
  19. 6 0
      joolun-wx-ma/components/coupon-info/index.json
  20. 54 0
      joolun-wx-ma/components/coupon-info/index.wxml
  21. 27 0
      joolun-wx-ma/components/coupon-info/index.wxss
  22. 26 0
      joolun-wx-ma/components/coupon-user-info/index.js
  23. 6 0
      joolun-wx-ma/components/coupon-user-info/index.json
  24. 48 0
      joolun-wx-ma/components/coupon-user-info/index.wxml
  25. 26 0
      joolun-wx-ma/components/coupon-user-info/index.wxss
  26. 20 0
      joolun-wx-ma/components/goods-card-index/index.js
  27. 4 0
      joolun-wx-ma/components/goods-card-index/index.json
  28. 22 0
      joolun-wx-ma/components/goods-card-index/index.wxml
  29. 29 0
      joolun-wx-ma/components/goods-card-index/index.wxss
  30. 20 0
      joolun-wx-ma/components/goods-card/index.js
  31. 4 0
      joolun-wx-ma/components/goods-card/index.json
  32. 20 0
      joolun-wx-ma/components/goods-card/index.wxml
  33. 26 0
      joolun-wx-ma/components/goods-card/index.wxss
  34. 20 0
      joolun-wx-ma/components/goods-row/index.js
  35. 4 0
      joolun-wx-ma/components/goods-row/index.json
  36. 26 0
      joolun-wx-ma/components/goods-row/index.wxml
  37. 9 0
      joolun-wx-ma/components/goods-row/index.wxss
  38. 145 0
      joolun-wx-ma/components/order-operate/index.js
  39. 4 0
      joolun-wx-ma/components/order-operate/index.json
  40. 40 0
      joolun-wx-ma/components/order-operate/index.wxml
  41. 29 0
      joolun-wx-ma/components/order-operate/index.wxss
  42. 40 0
      joolun-wx-ma/components/user-auth/index.js
  43. 4 0
      joolun-wx-ma/components/user-auth/index.json
  44. 17 0
      joolun-wx-ma/components/user-auth/index.wxml
  45. 1 0
      joolun-wx-ma/components/user-auth/index.wxss
  46. 521 0
      joolun-wx-ma/components/wxa-plugin-canvas/index/index.js
  47. 3 0
      joolun-wx-ma/components/wxa-plugin-canvas/index/index.json
  48. 4 0
      joolun-wx-ma/components/wxa-plugin-canvas/index/index.wxml
  49. 16 0
      joolun-wx-ma/components/wxa-plugin-canvas/index/index.wxss
  50. 87 0
      joolun-wx-ma/components/wxa-plugin-canvas/poster/index.js
  51. 6 0
      joolun-wx-ma/components/wxa-plugin-canvas/poster/index.json
  52. 4 0
      joolun-wx-ma/components/wxa-plugin-canvas/poster/index.wxml
  53. 0 0
      joolun-wx-ma/components/wxa-plugin-canvas/poster/index.wxss
  54. 29 0
      joolun-wx-ma/components/wxa-plugin-canvas/poster/poster.js
  55. 19 0
      joolun-wx-ma/config/env.js
  56. 82 0
      joolun-wx-ma/pages/base/search/index.js
  57. 4 0
      joolun-wx-ma/pages/base/search/index.json
  58. 37 0
      joolun-wx-ma/pages/base/search/index.wxml
  59. 1 0
      joolun-wx-ma/pages/base/search/index.wxss
  60. 78 0
      joolun-wx-ma/pages/goods/goods-category/index.js
  61. 6 0
      joolun-wx-ma/pages/goods/goods-category/index.json
  62. 42 0
      joolun-wx-ma/pages/goods/goods-category/index.wxml
  63. 67 0
      joolun-wx-ma/pages/goods/goods-category/index.wxss
  64. 194 0
      joolun-wx-ma/pages/goods/goods-detail/index.js
  65. 7 0
      joolun-wx-ma/pages/goods/goods-detail/index.json
  66. 133 0
      joolun-wx-ma/pages/goods/goods-detail/index.wxml
  67. 32 0
      joolun-wx-ma/pages/goods/goods-detail/index.wxss
  68. 181 0
      joolun-wx-ma/pages/goods/goods-list/index.js
  69. 7 0
      joolun-wx-ma/pages/goods/goods-list/index.json
  70. 58 0
      joolun-wx-ma/pages/goods/goods-list/index.wxml
  71. 6 0
      joolun-wx-ma/pages/goods/goods-list/index.wxss
  72. 143 0
      joolun-wx-ma/pages/home/index.js
  73. 8 0
      joolun-wx-ma/pages/home/index.json
  74. 113 0
      joolun-wx-ma/pages/home/index.wxml
  75. 89 0
      joolun-wx-ma/pages/home/index.wxss
  76. 140 0
      joolun-wx-ma/pages/order/order-confirm/index.js
  77. 7 0
      joolun-wx-ma/pages/order/order-confirm/index.json
  78. 85 0
      joolun-wx-ma/pages/order/order-confirm/index.wxml
  79. 37 0
      joolun-wx-ma/pages/order/order-confirm/index.wxss
  80. 70 0
      joolun-wx-ma/pages/order/order-detail/index.js
  81. 7 0
      joolun-wx-ma/pages/order/order-detail/index.json
  82. 156 0
      joolun-wx-ma/pages/order/order-detail/index.wxml
  83. 28 0
      joolun-wx-ma/pages/order/order-detail/index.wxss
  84. 147 0
      joolun-wx-ma/pages/order/order-list/index.js
  85. 7 0
      joolun-wx-ma/pages/order/order-list/index.json
  86. 58 0
      joolun-wx-ma/pages/order/order-list/index.wxml
  87. 7 0
      joolun-wx-ma/pages/order/order-list/index.wxss
  88. 304 0
      joolun-wx-ma/pages/shopping-cart/index.js
  89. 7 0
      joolun-wx-ma/pages/shopping-cart/index.json
  90. 131 0
      joolun-wx-ma/pages/shopping-cart/index.wxml
  91. 42 0
      joolun-wx-ma/pages/shopping-cart/index.wxss
  92. 154 0
      joolun-wx-ma/pages/user/user-address/form/index.js
  93. 3 0
      joolun-wx-ma/pages/user/user-address/form/index.json
  94. 41 0
      joolun-wx-ma/pages/user/user-address/form/index.wxml
  95. 0 0
      joolun-wx-ma/pages/user/user-address/form/index.wxss
  96. 80 0
      joolun-wx-ma/pages/user/user-address/list/index.js
  97. 3 0
      joolun-wx-ma/pages/user/user-address/list/index.json
  98. 31 0
      joolun-wx-ma/pages/user/user-address/list/index.wxml
  99. 7 0
      joolun-wx-ma/pages/user/user-address/list/index.wxss
  100. 0 0
      joolun-wx-ma/pages/user/user-center/index.js

+ 21 - 0
LICENSE

@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2021 JooLun
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

+ 8 - 0
joolun-wx-ma/README.md

@@ -0,0 +1,8 @@
+### [阿里云领取¥2000红包,服务器低至¥91.80/年](https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=wnw8gle1)
+
+### 注意
+1. 本软件为 www.joolun.com 开发研制,项目使用请保留此说明和代码头部版权
+
+### 重要信息
+1. 商业版功能更完善,代码更严谨,详情请访问(https://www.joolun.com/)
+

+ 127 - 0
joolun-wx-ma/app.js

@@ -0,0 +1,127 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+/**
+ * <version>3.3.2</version>
+ */
+import api from './utils/api'
+import __config from './config/env'
+
+App({
+  api: api,
+  globalData: {
+    thirdSession: null,
+    wxUser: null,
+    config: __config
+  },
+  onLaunch: function () {
+    //检测新版本
+    this.updateManager()
+    wx.getSystemInfo({
+      success: e => {
+        this.globalData.StatusBar = e.statusBarHeight;
+        let custom = wx.getMenuButtonBoundingClientRect();
+        this.globalData.Custom = custom;
+        this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
+      }
+    })
+  },
+  updateManager(){
+    const updateManager = wx.getUpdateManager()
+    updateManager.onUpdateReady(function () {
+      wx.showModal({
+        title: '更新提示',
+        content: '新版本已经准备好,是否重启应用?',
+        success(res) {
+          if (res.confirm) {
+            updateManager.applyUpdate()
+          }
+        }
+      })
+    })
+  },
+  //获取购物车数量
+  shoppingCartCount() {
+    this.api.shoppingCartCount()
+      .then(res => {
+        let shoppingCartCount = res.data
+        this.globalData.shoppingCartCount = shoppingCartCount + ''
+        wx.setTabBarBadge({
+          index: 2,
+          text: this.globalData.shoppingCartCount + ''
+        })
+      })
+  },
+  //初始化,供每个页面调用 
+  initPage: function () {
+    let that = this
+    return new Promise((resolve, reject) => {
+      if (!that.globalData.thirdSession) {//无thirdSession,进行登录
+        that.doLogin()
+          .then(res => {
+            resolve("success")
+          })
+      } else {//有thirdSession,说明已登录,返回初始化成功
+        wx.checkSession({//检查登录态是否过期
+          success () {
+            //session_key 未过期,并且在本生命周期一直有效
+            console.log('session_key 未过期')
+            resolve("success")
+          },
+          fail () {
+            // session_key 已经失效,需要重新执行登录流程
+            console.log('session_key 已经失效')
+            that.doLogin()
+              .then(res => {
+                resolve("success")
+              })
+          }
+        })
+       
+      }
+    })
+  },
+  doLogin(){
+    wx.showLoading({
+      title: '登录中',
+    })
+    let that = this
+    return new Promise((resolve, reject) => {
+      wx.login({
+        success: function (res) {
+          if (res.code) {
+            api.login({
+              jsCode: res.code
+            })
+              .then(res => {
+                wx.hideLoading()
+                let wxUser = res.data
+                that.globalData.thirdSession = wxUser.sessionKey
+                that.globalData.wxUser = wxUser
+                resolve("success")
+                //获取购物车数量
+                that.shoppingCartCount()
+              })
+          }
+        }
+      })
+    })
+  },
+  //获取当前页面带参数的url
+  getCurrentPageUrlWithArgs(){
+    const pages = getCurrentPages()
+    const currentPage = pages[pages.length - 1]
+    const url = currentPage.route
+    const options = currentPage.options
+    let urlWithArgs = `/${url}?`
+    for (let key in options) {
+      const value = options[key]
+      urlWithArgs += `${key}=${value}&`
+    }
+    urlWithArgs = urlWithArgs.substring(0, urlWithArgs.length - 1)
+    return urlWithArgs
+  }
+})

+ 57 - 0
joolun-wx-ma/app.json

@@ -0,0 +1,57 @@
+{
+  "pages": [
+    "pages/home/index",
+    "pages/base/search/index",
+    "pages/goods/goods-category/index",
+    "pages/goods/goods-list/index",
+    "pages/goods/goods-detail/index",
+    "pages/shopping-cart/index",
+    "pages/order/order-confirm/index",
+    "pages/order/order-list/index",
+    "pages/order/order-detail/index",
+    "pages/user/user-center/index",
+    "pages/user/user-address/list/index",
+    "pages/user/user-address/form/index"
+  ],
+  "window": {
+    "backgroundTextStyle": "dark",
+    "navigationBarBackgroundColor": "#fefefe",
+    "navigationBarTitleText": "WeChat",
+    "navigationBarTextStyle": "black"
+  },
+  "sitemapLocation": "sitemap.json",
+  "tabBar": {
+    "backgroundColor": "#ffffff",
+    "color": "#484848",
+    "selectedColor": "#2967ff",
+    "list": [
+      {
+        "pagePath": "pages/home/index",
+        "iconPath": "public/img/1-001.png",
+        "selectedIconPath": "public/img/1-002.png",
+        "text": "首页"
+      },
+      {
+        "pagePath": "pages/goods/goods-category/index",
+        "iconPath": "public/img/2-001.png",
+        "selectedIconPath": "public/img/2-002.png",
+        "text": "分类"
+      },
+      {
+        "pagePath": "pages/shopping-cart/index",
+        "iconPath": "public/img/3-001.png",
+        "selectedIconPath": "public/img/3-002.png",
+        "text": "购物车"
+      },
+      {
+        "pagePath": "pages/user/user-center/index",
+        "iconPath": "public/img/4-001.png",
+        "selectedIconPath": "public/img/4-002.png",
+        "text": "我的"
+      }
+    ]
+  },
+  "usingComponents": {
+    
+  }
+}

+ 44 - 0
joolun-wx-ma/app.wxss

@@ -0,0 +1,44 @@
+@import "public/colorui/main.wxss";
+@import "public/colorui/icon.wxss";
+@import "public/colorui/animation.wxss";
+@import "public/wxParse/wxParse.wxss";
+.overflow {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+.overflow-1 {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-line-clamp: 1;
+  -webkit-box-orient: vertical;
+}
+.overflow-2 {
+  overflow: hidden;
+  text-overflow: ellipsis;
+  display: -webkit-box;
+  -webkit-line-clamp: 2;
+  -webkit-box-orient: vertical;
+}
+.display-ib{
+  display: inline-block
+}
+.display-i{
+  display: inline
+}
+.margin-top-bar{
+  margin-top: 80rpx
+}
+.margin-bottom-bar{
+  margin-bottom: 80rpx
+}
+.vertical-center{
+  margin: auto 0rpx
+}
+.text-decorat{
+  text-decoration:line-through;
+}
+.mar-top-30{
+  margin-top: -30rpx!important
+}

+ 30 - 0
joolun-wx-ma/components/base-rade/index.js

@@ -0,0 +1,30 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+Component({
+  properties: {
+    value: {
+      type: Number,
+      value: 0
+    },
+    size: {
+      type: String,
+      value: 'xxl'
+    }
+  },
+  data: {
+
+  },
+  methods: {
+    redeHander(e){
+      let value = e.currentTarget.dataset.index + 1
+      this.setData({
+        value: value
+      })
+      this.triggerEvent('onChange', value)
+    }
+  }
+})

+ 4 - 0
joolun-wx-ma/components/base-rade/index.json

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

+ 10 - 0
joolun-wx-ma/components/base-rade/index.wxml

@@ -0,0 +1,10 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="text-{{size}} text-red">
+  <text class="cuIcon-like{{value > index ? 'fill' : ''}} margin-right" wx:for="{{5}}" wx:key="index" 
+    bindtap="redeHander" data-index="{{index}}"></text>
+</view>

+ 1 - 0
joolun-wx-ma/components/base-rade/index.wxss

@@ -0,0 +1 @@
+@import "/app.wxss";

+ 46 - 0
joolun-wx-ma/components/base-stepper/index.js

@@ -0,0 +1,46 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+Component({
+  properties: {
+    max: {
+      type: Number,
+      value: 0
+    },
+    min: {
+      type: Number,
+      value: 0
+    },
+    stNum: {
+      type: Number,
+      value: 0
+    },
+    customClass:{
+      type: String,
+      value: ''
+    }
+  },
+  data: {
+
+  },
+  methods: {
+    stNumMinus() {
+      this.setData({
+        stNum: this.data.stNum - 1
+      })
+      this.triggerEvent('numChange', this.data.stNum)
+    },
+    stNumAdd() {
+      this.setData({
+        stNum: this.data.stNum + 1
+      })
+      this.triggerEvent('numChange', this.data.stNum)
+    },
+    numChange(e){
+      this.triggerEvent('numChange', val)
+    }
+  }
+})

+ 4 - 0
joolun-wx-ma/components/base-stepper/index.json

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

+ 17 - 0
joolun-wx-ma/components/base-stepper/index.wxml

@@ -0,0 +1,17 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="flex text-center {{customClass}}" style="width:230rpx">
+  <view class="flex-sub">
+    <button class="cu-btn cuIcon-move sm st-num-bt" disabled="{{stNum <= min}}" bindtap="stNumMinus"></button>
+  </view>
+  <view class="flex-sub">
+    <input type="number" class="st-num text-center bg-gray radius" value="{{stNum}}" disabled="true" bindinput="numChange"></input>
+  </view>
+  <view class="flex-sub">
+    <button class="cu-btn cuIcon-add sm st-num-bt" disabled="{{max >= 0 ? stNum >= max : false}}" bindtap="stNumAdd"></button>
+  </view>
+</view>

+ 11 - 0
joolun-wx-ma/components/base-stepper/index.wxss

@@ -0,0 +1,11 @@
+@import "/app.wxss";
+.st-num{
+  width: 80rpx;
+  height: 50rpx;
+}
+.st-num-bt{
+  line-height: 50rpx;
+  overflow: hidden;
+  font-size: 30rpx!important;
+  height: 50rpx!important
+}

+ 56 - 0
joolun-wx-ma/components/count-down/index.js

@@ -0,0 +1,56 @@
+Component({
+  properties: {
+    // 这里定义了innerText属性,属性值可以在组件使用时指定
+    outTime: {
+      type: Number,
+      value: 0
+    }
+  },
+  data: {
+    day: null,
+    hour: null,
+    minute: null,
+    second: null,
+    timer: null
+  },
+  ready: function () {
+    this.CaculateDate()
+  },
+  detached: function () {
+    if (this.data.timer) {
+      clearInterval(this.data.timer)
+    }
+  },
+  methods: {
+    CaculateDate: function () {
+      var that = this
+      var timerID = setInterval(function () {
+        var leftTime = that.data.outTime - 1000
+        var days = parseInt(leftTime / 1000 / 60 / 60 / 24, 10)
+        var hours = parseInt(leftTime / 1000 / 60 / 60 % 24, 10)
+        var minutes = parseInt(leftTime / 1000 / 60 % 60, 10)
+        var seconds = parseInt(leftTime / 1000 % 60, 10)
+        if (leftTime > 0) {
+          that.setData({ 
+            outTime: leftTime 
+          })
+          that.setData({ 
+            day: days > 0 ? that.timeFormat(days) : null, 
+            hour: hours > 0 ? that.timeFormat(hours) : null, 
+            minute: minutes > 0 ? that.timeFormat(minutes) : null, 
+            second: seconds > 0 ? that.timeFormat(seconds) : null
+          })
+        } else { //结束
+          clearInterval(that.data.timer)
+          setTimeout(function () {
+            that.triggerEvent('countDownDone', null)
+          }, 2000)
+        }
+      }, 1000)
+      this.setData({ timer: timerID })
+    },
+    timeFormat(param) { //小于10的格式化函数
+      return param < 10 ? '0' + param : param
+    }
+  }
+})

+ 4 - 0
joolun-wx-ma/components/count-down/index.json

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

+ 10 - 0
joolun-wx-ma/components/count-down/index.wxml

@@ -0,0 +1,10 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<text wx:if="{{day}}">{{day}}天</text>
+<text wx:if="{{hour}}">{{hour}}小时</text>
+<text wx:if="{{minute}}">{{minute}}分</text>
+<text wx:if="{{second}}">{{second}}秒</text>

+ 1 - 0
joolun-wx-ma/components/count-down/index.wxss

@@ -0,0 +1 @@
+@import "/app.wxss";

+ 43 - 0
joolun-wx-ma/components/coupon-info/index.js

@@ -0,0 +1,43 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Component({
+  properties: {
+    couponInfo: {
+      type: Object,
+      value: {}
+    },
+    toUse: {
+      type: Boolean,
+      value: true
+    }
+  },
+  data: {
+    
+  },
+  methods: {
+    couponUserSave(){
+      app.api.couponUserSave({
+        couponId: this.data.couponInfo.id
+      })
+        .then(res => {
+          wx.showToast({
+            title: '领取成功',
+            icon: 'success',
+            duration: 2000
+          })
+          let couponInfo = this.data.couponInfo
+          couponInfo.couponUser = res.data
+          this.setData({
+            couponInfo: couponInfo
+          })
+          this.triggerEvent('receiveCoupon', couponInfo)
+        })
+    }
+  }
+})

+ 6 - 0
joolun-wx-ma/components/coupon-info/index.json

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

+ 54 - 0
joolun-wx-ma/components/coupon-info/index.wxml

@@ -0,0 +1,54 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="flex bg-white radius text-white main" wx:if="{{couponInfo.type == '1'}}">
+  <view class="flex-twice padding-sm radius t1-r">
+    <view class="flex">
+      <view class="flex-sub text-xxl text-bold text-price overflow-1">{{couponInfo.reduceAmount}}</view>
+      <view class="flex-twice">
+        <view class="text-sm overflow-1">{{couponInfo.name}}</view>
+        <view class="text-xs overflow-1">订单满{{couponInfo.premiseAmount}}元可使用</view>
+        <view class="text-xs">
+          {{couponInfo.suitType == '1' ? '全部商品可用' : couponInfo.suitType == '2' ? '指定商品可用' : couponInfo.suitType == '3' ? '指定商品不可用' : ''}}
+        </view>
+      </view>
+    </view>
+    <view class="text-xs" wx:if="{{couponInfo.expireType == '1'}}">领取后{{couponInfo.validDays}}天有效</view>
+    <view class="text-xs" wx:if="{{couponInfo.expireType == '2'}}">{{couponInfo.validBeginTime}}至{{couponInfo.validEndTime}}</view>
+  </view>
+  <view class="flex-sub padding-sm radius text-center t1-l">
+    <view class="padding-xs">代金券</view>
+    <button class="cu-btn bg-white" wx:if="{{!couponInfo.couponUser}}" bindtap = "couponUserSave">立即领取</button>
+    <view wx:if="{{couponInfo.couponUser}}">
+      <view class="padding-xs" wx:if="{{!toUse}}">已领取</view>
+      <navigator hover-class='none' url='/pages/goods/goods-list/index?couponUserId={{couponInfo.couponUser.id}}' class="cu-btn bg-white sm" wx:if="{{toUse}}">已领取,去使用</navigator>
+    </view>
+  </view>
+</view>
+<view class="flex bg-white radius text-white main" wx:if="{{couponInfo.type == '2'}}">
+  <view class="flex-twice padding-sm radius t2-r">
+    <view class="flex">
+      <view class="flex-sub text-xxl text-bold overflow-1">{{couponInfo.discount}}<text class="text-sm">折</text></view>
+      <view class="flex-twice">
+        <view class="text-sm overflow-1">{{couponInfo.name}}</view>
+        <view class="text-xs overflow-1">订单满{{couponInfo.premiseAmount}}元可使用</view>
+        <view class="text-xs">
+          {{couponInfo.suitType == '1' ? '全部商品可用' : couponInfo.suitType == '2' ? '指定商品可用' : couponInfo.suitType == '3' ? '指定商品不可用' : ''}}
+        </view>
+      </view>
+    </view>
+    <view class="text-xs" wx:if="{{couponInfo.expireType == '1'}}">领取后{{couponInfo.validDays}}天有效</view>
+    <view class="text-xs" wx:if="{{couponInfo.expireType == '2'}}">{{couponInfo.validBeginTime}}至{{couponInfo.validEndTime}}</view>
+  </view>
+  <view class="flex-sub padding-sm radius text-center t2-l">
+    <view class="padding-xs">折扣券</view>
+    <button class="cu-btn bg-white" wx:if="{{!couponInfo.couponUser}}" bindtap = "couponUserSave">立即领取</button>
+    <view wx:if="{{couponInfo.couponUser}}">
+      <view class="padding-xs" wx:if="{{!toUse}}">已领取</view>
+      <navigator hover-class='none' url='/pages/goods/goods-list/index?couponUserId={{couponInfo.couponUser.id}}' class="cu-btn bg-white sm" wx:if="{{toUse}}">已领取,去使用</navigator>
+    </view>
+  </view>
+</view>

+ 27 - 0
joolun-wx-ma/components/coupon-info/index.wxss

@@ -0,0 +1,27 @@
+@import "/app.wxss";
+.main{
+  height: 160rpx;
+  
+}
+.t1-r{
+  background: radial-gradient(circle at top right, transparent 5px, #f37b1d 0) top right, radial-gradient(circle at bottom right, transparent 5px, #f37b1d 0) bottom right;
+  background-size: 100% 60%;
+  background-repeat: no-repeat;
+}
+.t1-l{
+  background: radial-gradient(circle at top left, transparent 5px, #f37b1d 0) top left,radial-gradient(circle at bottom left, transparent 5px, #f37b1d 0) bottom left;
+  background-size: 100% 60%;
+  background-repeat: no-repeat;
+  border-left: 2rpx dashed rgba(255,255,255,.3);
+}
+.t2-r{
+  background: radial-gradient(circle at top right, transparent 5px, #39b54a 0) top right, radial-gradient(circle at bottom right, transparent 5px, #39b54a 0) bottom right;
+  background-size: 100% 60%;
+  background-repeat: no-repeat;
+}
+.t2-l{
+  background: radial-gradient(circle at top left, transparent 5px, #39b54a 0) top left,radial-gradient(circle at bottom left, transparent 5px, #39b54a 0) bottom left;
+  background-size: 100% 60%;
+  background-repeat: no-repeat;
+  border-left: 2rpx dashed rgba(255,255,255,.3);
+}

+ 26 - 0
joolun-wx-ma/components/coupon-user-info/index.js

@@ -0,0 +1,26 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Component({
+  properties: {
+    couponUserInfo: {
+      type: Object,
+      value: {}
+    },
+    toUse: {
+      type: Boolean,
+      value: true
+    }
+  },
+  data: {
+    
+  },
+  methods: {
+    
+  }
+})

+ 6 - 0
joolun-wx-ma/components/coupon-user-info/index.json

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

+ 48 - 0
joolun-wx-ma/components/coupon-user-info/index.wxml

@@ -0,0 +1,48 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="flex bg-white radius text-white main" wx:if="{{couponUserInfo.type == '1'}}">
+  <view class="flex-twice padding-sm radius t1-r">
+    <view class="flex">
+      <view class="flex-sub text-xxl text-bold text-price overflow-1">{{couponUserInfo.reduceAmount}}</view>
+      <view class="flex-twice">
+        <view class="text-sm overflow-1">{{couponUserInfo.name}}</view>
+        <view class="text-xs overflow-1">订单满{{couponUserInfo.premiseAmount}}元可使用</view>
+        <view class="text-xs">
+          {{couponUserInfo.suitType == '1' ? '全部商品可用' : couponUserInfo.suitType == '2' ? '指定商品可用' : couponUserInfo.suitType == '3' ? '指定商品不可用' : ''}}
+        </view>
+      </view>
+    </view>
+    <view class="text-xs">有效期至{{couponUserInfo.validEndTime}}</view>
+  </view>
+  <view class="flex-sub padding-sm radius text-center t1-l">
+    <view class="padding-sm">代金券</view>
+    <navigator hover-class='none' url='/pages/goods/goods-list/index?couponUserId={{couponUserInfo.id}}' class="cu-btn bg-white sm" wx:if="{{toUse && couponUserInfo.status == '0'}}">前去使用</navigator>
+    <view class="padding-xs" wx:if="{{couponUserInfo.status == '1'}}">已使用</view>
+    <view class="padding-xs" wx:if="{{couponUserInfo.status == '2'}}">已过期</view>
+  </view>
+</view>
+<view class="flex bg-white radius text-white main" wx:if="{{couponUserInfo.type == '2'}}">
+  <view class="flex-twice padding-sm radius t2-r">
+    <view class="flex">
+      <view class="flex-sub text-xxl text-bold overflow-1">{{couponUserInfo.discount}}<text class="text-sm">折</text></view>
+      <view class="flex-twice">
+        <view class="text-sm overflow-1">{{couponUserInfo.name}}</view>
+        <view class="text-xs overflow-1">订单满{{couponUserInfo.premiseAmount}}元可使用</view>
+        <view class="text-xs">
+          {{couponUserInfo.suitType == '1' ? '全部商品可用' : couponUserInfo.suitType == '2' ? '指定商品可用' : couponUserInfo.suitType == '3' ? '指定商品不可用' : ''}}
+        </view>
+      </view>
+    </view>
+    <view class="text-xs">有效期至{{couponUserInfo.validEndTime}}</view>
+  </view>
+  <view class="flex-sub padding-sm radius text-center t2-l">
+    <view class="padding-sm">折扣券</view>
+    <navigator hover-class='none' url='/pages/goods/goods-list/index?couponUserId={{couponUserInfo.id}}' class="cu-btn bg-white sm" wx:if="{{toUse && couponUserInfo.status == '0'}}">前去使用</navigator>
+    <view class="padding-xs" wx:if="{{couponUserInfo.status == '1'}}">已使用</view>
+    <view class="padding-xs" wx:if="{{couponUserInfo.status == '2'}}">已过期</view>
+  </view>
+</view>

+ 26 - 0
joolun-wx-ma/components/coupon-user-info/index.wxss

@@ -0,0 +1,26 @@
+@import "/app.wxss";
+.main{
+  height: 160rpx
+}
+.t1-r{
+  background: radial-gradient(circle at top right, transparent 5px, #f37b1d 0) top right, radial-gradient(circle at bottom right, transparent 5px, #f37b1d 0) bottom right;
+  background-size: 100% 60%;
+  background-repeat: no-repeat;
+}
+.t1-l{
+  background: radial-gradient(circle at top left, transparent 5px, #f37b1d 0) top left,radial-gradient(circle at bottom left, transparent 5px, #f37b1d 0) bottom left;
+  background-size: 100% 60%;
+  background-repeat: no-repeat;
+  border-left: 2rpx dashed rgba(255,255,255,.3);
+}
+.t2-r{
+  background: radial-gradient(circle at top right, transparent 5px, #39b54a 0) top right, radial-gradient(circle at bottom right, transparent 5px, #39b54a 0) bottom right;
+  background-size: 100% 60%;
+  background-repeat: no-repeat;
+}
+.t2-l{
+  background: radial-gradient(circle at top left, transparent 5px, #39b54a 0) top left,radial-gradient(circle at bottom left, transparent 5px, #39b54a 0) bottom left;
+  background-size: 100% 60%;
+  background-repeat: no-repeat;
+  border-left: 2rpx dashed rgba(255,255,255,.3);
+}

+ 20 - 0
joolun-wx-ma/components/goods-card-index/index.js

@@ -0,0 +1,20 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+Component({
+  properties: {
+    goodsList: {
+      type: Object,
+      value: []
+    }
+  },
+  data: {
+
+  },
+  methods: {
+
+  }
+})

+ 4 - 0
joolun-wx-ma/components/goods-card-index/index.json

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

+ 22 - 0
joolun-wx-ma/components/goods-card-index/index.wxml

@@ -0,0 +1,22 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="goods-container">
+  <view class="goods-box" wx:for="{{goodsList}}" wx:key="index">
+    <navigator hover-class='none' url='/pages/goods/goods-detail/index?id={{item.id}}'>
+      <view class="text-black margin-top text-bold padding-lr overflow-1">{{item.name}}</view>
+      <view class="img-box">
+        <image src="{{item.picUrls[0] ? item.picUrls[0] : '/public/img/no_pic.png'}}" class="margin-top-xs"/>
+      </view>
+      <view class="text-center margin-top">
+        <view class="cu-tag line-black round text-df text-price text-bold text-black">{{item.salesPrice}}</view>
+        <view class="market-price text-price text-gray text-sm margin-top-xs">
+          {{item.marketPrice}}
+        </view>
+      </view>
+    </navigator>
+  </view>
+</view>

+ 29 - 0
joolun-wx-ma/components/goods-card-index/index.wxss

@@ -0,0 +1,29 @@
+@import "/app.wxss";
+.goods-container {
+  display: flex;
+  justify-content: space-between;
+  flex-wrap: wrap;
+  box-sizing: content-box;
+  padding: 20rpx;
+}
+.goods-box {
+  width: 346rpx;
+  height: 560rpx;
+  background-color: #fff;
+  overflow: hidden;
+  margin-bottom: 40rpx;
+  border-radius: 20rpx;
+	box-shadow: 0rpx 0rpx 60rpx rgba(211, 211, 211, 1);
+}
+.goods-box .img-box {
+  width: 100%;
+  height: 349rpx;
+  overflow: hidden;
+}
+.goods-box .img-box image {
+  width: 100%;
+  height: 336rpx;
+}
+.market-price{
+  text-decoration: line-through;
+}

+ 20 - 0
joolun-wx-ma/components/goods-card/index.js

@@ -0,0 +1,20 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+Component({
+  properties: {
+    goodsList: {
+      type: Object,
+      value: []
+    }
+  },
+  data: {
+
+  },
+  methods: {
+
+  }
+})

+ 4 - 0
joolun-wx-ma/components/goods-card/index.json

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

+ 20 - 0
joolun-wx-ma/components/goods-card/index.wxml

@@ -0,0 +1,20 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="goods-container">
+  <view class="goods-box" wx:for="{{goodsList}}" wx:key="index">
+    <navigator hover-class='none' url='/pages/goods/goods-detail/index?id={{item.id}}'>
+    <view class="text-black margin-top text-bold padding-lr overflow-1">{{item.name}}</view>
+      <view class="img-box">
+        <image src="{{item.picUrls[0] ? item.picUrls[0] : '/public/img/no_pic.png'}}" class="margin-top-xs"/>
+      </view>
+      <view class="text-center margin-top">
+        <view class="cu-tag line-black round text-df text-price text-bold text-black">{{item.salesPrice}}</view>
+        <view class="text-gray text-sm padding-lr-sm margin-top-sm">已售{{item.saleNum}}</view>
+      </view>
+    </navigator>
+  </view>
+</view>

+ 26 - 0
joolun-wx-ma/components/goods-card/index.wxss

@@ -0,0 +1,26 @@
+@import "/app.wxss";
+.goods-container {
+  display: flex;
+  justify-content: space-between;
+  flex-wrap: wrap;
+  box-sizing: content-box;
+  padding: 20rpx;
+}
+.goods-box {
+  width: 346rpx;
+  height: 560rpx;
+  background-color: #fff;
+  overflow: hidden;
+  margin-bottom: 40rpx;
+  border-radius: 20rpx;
+	box-shadow: 0rpx 0rpx 60rpx rgba(211, 211, 211, 1);
+}
+.goods-box .img-box {
+  width: 100%;
+  height: 349rpx;
+  overflow: hidden;
+}
+.goods-box .img-box image {
+  width: 100%;
+  height: 336rpx;
+}

+ 20 - 0
joolun-wx-ma/components/goods-row/index.js

@@ -0,0 +1,20 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+Component({
+  properties: {
+    goodsList: {
+      type: Object,
+      value: []
+    }
+  },
+  data: {
+    
+  },
+  methods: {
+
+  }
+})

+ 4 - 0
joolun-wx-ma/components/goods-row/index.json

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

+ 26 - 0
joolun-wx-ma/components/goods-row/index.wxml

@@ -0,0 +1,26 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="cu-card article no-card">
+  <view class="cu-item" wx:for="{{ goodsList }}" wx:key="index">
+    <navigator hover-class='none' url='/pages/goods/goods-detail/index?id={{item.id}}'>
+      <view class="content">
+        <image src="{{item.picUrls[0] ? item.picUrls[0] : '/public/img/no_pic.png'}}" mode="aspectFill" class="row-img margin-top-xs"></image>
+        <view class="desc solid-bottom row-info">
+          <view class="text-black margin-top-sm overflow-2">{{item.name}}</view>
+          <view class="text-gray text-sm margin-top-sm overflow-2">{{item.sellPoint}}</view>
+          <view class="flex justify-between margin-top-sm">
+            <view class="text-price text-bold text-red padding-lr-sm">{{item.salesPrice}}</view>
+            <view class="text-gray text-sm padding-lr-sm">已售{{item.saleNum}}</view>
+          </view>
+          <view class="flex justify-start margin-tb-sm">
+            <view class="cu-tag bg-orange radius sm" wx:if="{{item.pointsGiveSwitch == '1'}}">积分</view>
+          </view>
+        </view>
+      </view>
+    </navigator>
+  </view>
+</view>

+ 9 - 0
joolun-wx-ma/components/goods-row/index.wxss

@@ -0,0 +1,9 @@
+@import "/app.wxss";
+.row-img{
+  width: 280rpx!important;
+  height: 280rpx!important;
+  border-radius: 10rpx
+}
+.row-info{
+  display: block!important;
+}

+ 145 - 0
joolun-wx-ma/components/order-operate/index.js

@@ -0,0 +1,145 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Component({
+  properties: {
+    orderInfo: {
+      type: Object,
+      value: {}
+    },
+    callPay: {
+      type: Boolean,
+      value: false
+    },
+    contact: {
+      type: Boolean,
+      value: false
+    }
+  },
+  data: {
+    loading: false
+  },
+  ready() {
+    let that = this
+    setTimeout(function () {
+      if (that.data.callPay) {
+        that.unifiedOrder()
+      }
+    }, 1000)
+  },
+  methods: {
+    orderReceive(){
+      let that = this
+      wx.showModal({
+        content: '是否确认收货吗?',
+        cancelText: '我再想想',
+        confirmColor: '#ff0000',
+        success(res) {
+          if (res.confirm) {
+            let id = that.data.orderInfo.id
+            app.api.orderReceive(id)
+              .then(res => {
+                that.triggerEvent('orderReceive', res)
+              })
+          }
+        }
+      })
+    },
+    orderCancel() {
+      let that = this
+      wx.showModal({
+        content: '确认取消该订单吗?',
+        cancelText: '我再想想',
+        confirmColor: '#ff0000',
+        success(res) {
+          if (res.confirm) {
+            let id = that.data.orderInfo.id
+            app.api.orderCancel(id)
+              .then(res => {
+                that.triggerEvent('orderCancel', res)
+              })
+          }
+        }
+      })
+    },
+    orderDel() {
+      let that = this
+      wx.showModal({
+        content: '确认删除该订单吗?',
+        cancelText: '我再想想',
+        confirmColor: '#ff0000',
+        success(res) {
+          if (res.confirm) {
+            let id = that.data.orderInfo.id
+            app.api.orderDel(id)
+              .then(res => {
+                that.triggerEvent('orderDel', res)
+              })
+          }
+        }
+      })
+    },
+    unifiedOrder() {
+      this.setData({
+        loading: true
+      })
+      var that = this
+      let orderInfo = this.data.orderInfo
+      app.api.unifiedOrder({
+        id: orderInfo.id
+      })
+        .then(res => {
+          this.setData({
+            loading: false
+          })
+          if (orderInfo.paymentPrice <= 0){//0元付款
+            that.triggerEvent('unifiedOrder', res)
+          }else{
+            let payData = res.data
+            wx.requestPayment({
+              'timeStamp': payData.timeStamp,
+              'nonceStr': payData.nonceStr,
+              'package': payData.packageValue,
+              'signType': payData.signType,
+              'paySign': payData.paySign,
+              'success': function (res) {
+                that.triggerEvent('unifiedOrder', res)
+              },
+              'fail': function (res) {
+
+              },
+              'complete': function (res) {
+                console.log(res)
+              }
+            })
+          }
+        }).catch(() => {
+          this.setData({
+            loading: false
+          })
+        })
+    },
+    urgeOrder() {
+      wx.showToast({
+        title: '已提醒卖家发货',
+        icon: 'success',
+        duration: 2000
+      })
+    },
+    orderLogistics(){
+      wx.navigateTo({
+        url: '/pages/order/order-logistics/index?id=' + this.data.orderInfo.orderLogistics.id
+      })
+    },
+    orderAppraise(){
+      wx.navigateTo({
+        url: '/pages/appraises/form/index?orderId=' + this.data.orderInfo.id
+      })
+    }
+  }
+})

+ 4 - 0
joolun-wx-ma/components/order-operate/index.json

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

+ 40 - 0
joolun-wx-ma/components/order-operate/index.wxml

@@ -0,0 +1,40 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="flex justify-end">
+  <button class="cu-btn radius margin-right shadow-blur service" open-type="contact" bindcontact="handleContact" wx:if="{{contact}}">
+    <view class="cuIcon-servicefill text-white"></view> 
+    <text class="text-white">客服</text>
+  </button>
+  <button class="cu-btn radius margin-right shadow-blur delete-order" bindtap="orderDel" loading="{{loading}}" 
+  disabled="{{loading}}" type="" wx:if="{{orderInfo.status == '5' && orderInfo.isPay == '0'}}">
+    <text class="text-white">删除订单</text>
+  </button>
+  <button class="cu-btn radius margin-right shadow-blur cancel-order" bindtap="orderCancel" loading="{{loading}}" 
+  disabled="{{loading}}" type="" wx:if="{{orderInfo.isPay == '0' && !orderInfo.status}}">
+    <text class="text-white">取消订单</text>
+  </button>
+  <button class="cu-btn radius margin-right shadow-blur check-logistics" bindtap="orderLogistics" loading="{{loading}}" 
+  disabled="{{loading}}" type="" wx:if="{{orderInfo.deliveryWay == '1' && (orderInfo.status == '2' || orderInfo.status == '3' || orderInfo.status == '4')}}">
+    <text class="text-white">查看物流</text>
+  </button>
+  <button class="cu-btn radius margin-right shadow-blur payment" bindtap="unifiedOrder" loading="{{loading}}" 
+  disabled="{{loading}}" type="" wx:if="{{orderInfo.isPay == '0' && !orderInfo.status}}">
+    <text class="text-white">付款</text>
+  </button>
+  <!-- <button class="cu-btn round line-red margin-right" bindtap="urgeOrder" loading="{{loading}}" 
+  disabled="{{loading}}" type="" wx:if="{{orderInfo.status == '1'}}">
+    提醒卖家发货
+  </button> -->
+  <button class="cu-btn radius margin-right shadow-blur confirm-goods" bindtap="orderReceive" loading="{{loading}}" 
+  disabled="{{loading}}" type="" wx:if="{{orderInfo.status == '2'}}">
+    <text class="text-white">确认收货</text>
+  </button>
+  <button class="cu-btn radius margin-right shadow-blur evaluation" bindtap="orderAppraise" loading="{{loading}}" 
+  disabled="{{loading}}" type="" wx:if="{{orderInfo.status == '3' && orderInfo.appraisesStatus == '0'}}">
+    <text class="text-white">评价</text>
+  </button>
+</view>

+ 29 - 0
joolun-wx-ma/components/order-operate/index.wxss

@@ -0,0 +1,29 @@
+@import "/app.wxss";
+.service{
+  background-color: #13b229 !important; 
+  width:160rpx;
+}
+.delete-order{
+  background-color: #2d2d2f !important; 
+  width:200rpx;
+}
+.cancel-order{
+  background-color: #2d2d2f !important; 
+  width:200rpx;
+}
+.check-logistics{
+  background-color: #2d2d2f !important; 
+  width:200rpx;
+}
+.payment{
+  background-color: #2967ff !important; 
+  width:200rpx;
+}
+.confirm-goods{
+  background-color: #2967ff !important; 
+  width:200rpx;
+}
+.evaluation{
+  background-color: #2d2d2f !important; 
+  width:200rpx;
+}

+ 40 - 0
joolun-wx-ma/components/user-auth/index.js

@@ -0,0 +1,40 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+Component({
+  properties: {
+    switchOn: {
+      type: Boolean,
+      value: true
+    },
+  },
+  data: {
+    wxUser: null
+  },
+  lifetimes: {
+    // 组件所在页面的生命周期函数
+    ready: function () {
+      this.setData({
+        wxUser: app.globalData.wxUser
+      })
+    }
+  },
+  methods: {
+    agreeGetUser(e) {
+      if (e.detail.errMsg == 'getUserInfo:ok') {
+        app.api.wxUserSave(e.detail)
+          .then(res => {
+            let wxUser = res.data
+            this.setData({
+              wxUser: wxUser
+            })
+            app.globalData.wxUser = wxUser
+          })
+      }
+    },
+  }
+})

+ 4 - 0
joolun-wx-ma/components/user-auth/index.json

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

+ 17 - 0
joolun-wx-ma/components/user-auth/index.wxml

@@ -0,0 +1,17 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="cu-modal show" wx:if="{{switchOn && wxUser && !wxUser.headimgUrl}}">
+  <view class="cu-dialog">
+    <view class="cu-bar bg-red justify-end">
+      <view class="content">登录授权</view>
+    </view>
+    <view class="padding-xl">
+      <view class="text-left">需要获取您的头像等信息,以便为您提供更好的服务</view>
+      <button class="cu-btn text-green cuIcon-weixin lg" open-type="getUserInfo" bind:getuserinfo="agreeGetUser" lang="zh_CN">点击授权</button>
+    </view>
+  </view>
+</view>

+ 1 - 0
joolun-wx-ma/components/user-auth/index.wxss

@@ -0,0 +1 @@
+@import "/app.wxss";

+ 521 - 0
joolun-wx-ma/components/wxa-plugin-canvas/index/index.js

@@ -0,0 +1,521 @@
+const main = {
+    /**
+     * 渲染块
+     * @param {Object} params
+     */
+    drawBlock({ text, width = 0, height, x, y, paddingLeft = 0, paddingRight = 0, borderWidth, backgroundColor, borderColor, borderRadius = 0, opacity = 1 }) {
+        // 判断是否块内有文字
+        let blockWidth = 0; // 块的宽度
+        let textX = 0;
+        let textY = 0;
+        if (typeof text !== 'undefined') {
+            // 如果有文字并且块的宽度小于文字宽度,块的宽度为 文字的宽度 + 内边距
+            const textWidth = this._getTextWidth(typeof text.text === 'string' ? text : text.text);
+            blockWidth = textWidth > width ? textWidth : width;
+            blockWidth += paddingLeft + paddingLeft;
+
+            const { textAlign = 'left', text: textCon } = text;
+            textY = height / 2 + y; // 文字的y轴坐标在块中线
+            if (textAlign === 'left') {
+                // 如果是右对齐,那x轴在块的最左边
+                textX = x + paddingLeft;
+            } else if (textAlign === 'center') {
+                textX = blockWidth / 2 + x;
+            } else {
+                textX = x + blockWidth - paddingRight;
+            }
+        } else {
+            blockWidth = width;
+        }
+
+        if (backgroundColor) {
+            // 画面
+            this.ctx.save();
+            this.ctx.setGlobalAlpha(opacity);
+            this.ctx.setFillStyle(backgroundColor);
+            if (borderRadius > 0) {
+                // 画圆角矩形
+                this._drawRadiusRect(x, y, blockWidth, height, borderRadius);
+                this.ctx.fill();
+            } else {
+                this.ctx.fillRect(this.toPx(x), this.toPx(y), this.toPx(blockWidth), this.toPx(height));
+            }
+            this.ctx.restore();
+        }
+        if (borderWidth) {
+            // 画线
+            this.ctx.save();
+            this.ctx.setGlobalAlpha(opacity);
+            this.ctx.setStrokeStyle(borderColor);
+            this.ctx.setLineWidth(this.toPx(borderWidth));
+            if (borderRadius > 0) {
+                // 画圆角矩形边框
+                this._drawRadiusRect(x, y, blockWidth, height, borderRadius);
+                this.ctx.stroke();
+            } else {
+                this.ctx.strokeRect(this.toPx(x), this.toPx(y), this.toPx(blockWidth), this.toPx(height));
+            }
+            this.ctx.restore();
+        }
+
+        if (text) {
+            this.drawText(Object.assign(text, { x: textX, y: textY }))
+        }
+    },
+
+    /**
+     * 渲染文字
+     * @param {Object} params
+     */
+    drawText(params) {
+        const { x, y, fontSize, color, baseLine, textAlign, text, opacity = 1, width, lineNum, lineHeight } = params;
+        if (Object.prototype.toString.call(text) === '[object Array]') {
+            let preText = { x, y, baseLine };
+            text.forEach(item => {
+                preText.x += item.marginLeft || 0;
+                const textWidth = this._drawSingleText(Object.assign(item, {
+                    ...preText,
+                }));
+                preText.x += textWidth + (item.marginRight || 0); // 下一段字的x轴为上一段字x + 上一段字宽度
+            })
+        } else {
+            this._drawSingleText(params);
+        }
+    },
+
+    /**
+     * 渲染图片
+     */
+    drawImage(data) {
+        const { imgPath, x, y, w, h, sx, sy, sw, sh, borderRadius = 0, borderWidth = 0, borderColor } = data;
+        this.ctx.save();
+        if (borderRadius > 0) {
+            this._drawRadiusRect(x, y, w, h, borderRadius);
+            this.ctx.strokeStyle = 'rgba(255,255,255,0)';
+            this.ctx.stroke();
+            this.ctx.clip();
+            this.ctx.drawImage(imgPath, this.toPx(sx), this.toPx(sy), this.toPx(sw), this.toPx(sh), this.toPx(x), this.toPx(y), this.toPx(w), this.toPx(h));
+            if (borderWidth > 0) {
+                this.ctx.setStrokeStyle(borderColor);
+                this.ctx.setLineWidth(this.toPx(borderWidth));
+                this.ctx.stroke();
+            }
+        } else {
+            this.ctx.drawImage(imgPath, this.toPx(sx), this.toPx(sy), this.toPx(sw), this.toPx(sh), this.toPx(x), this.toPx(y), this.toPx(w), this.toPx(h));
+        }
+        this.ctx.restore();
+    },
+    /**
+     * 渲染线
+     * @param {*} param0
+     */
+    drawLine({ startX, startY, endX, endY, color, width }) {
+        this.ctx.save();
+        this.ctx.beginPath();
+        this.ctx.setStrokeStyle(color);
+        this.ctx.setLineWidth(this.toPx(width));
+        this.ctx.moveTo(this.toPx(startX), this.toPx(startY));
+        this.ctx.lineTo(this.toPx(endX), this.toPx(endY));
+        this.ctx.stroke();
+        this.ctx.closePath();
+        this.ctx.restore();
+    },
+    downloadResource({ images = [], pixelRatio = 1 }) {
+        const drawList = [];
+        this.drawArr = [];
+        images.forEach((image, index) => drawList.push(this._downloadImageAndInfo(image, index, pixelRatio)));
+        return Promise.all(drawList);
+    },
+    initCanvas(w, h, debug) {
+        return new Promise((resolve) => {
+            this.setData({
+                pxWidth: this.toPx(w),
+                pxHeight: this.toPx(h),
+                debug,
+            }, resolve);
+        });
+    }
+}
+const handle = {
+    /**
+     * 画圆角矩形
+     */
+    _drawRadiusRect(x, y, w, h, r) {
+        const br = r / 2;
+        this.ctx.beginPath();
+        this.ctx.moveTo(this.toPx(x + br), this.toPx(y));    // 移动到左上角的点
+        this.ctx.lineTo(this.toPx(x + w - br), this.toPx(y));
+        this.ctx.arc(this.toPx(x + w - br), this.toPx(y + br), this.toPx(br), 2 * Math.PI * (3 / 4), 2 * Math.PI * (4 / 4))
+        this.ctx.lineTo(this.toPx(x + w), this.toPx(y + h - br));
+        this.ctx.arc(this.toPx(x + w - br), this.toPx(y + h - br), this.toPx(br), 0, 2 * Math.PI * (1 / 4))
+        this.ctx.lineTo(this.toPx(x + br), this.toPx(y + h));
+        this.ctx.arc(this.toPx(x + br), this.toPx(y + h - br), this.toPx(br), 2 * Math.PI * (1 / 4), 2 * Math.PI * (2 / 4))
+        this.ctx.lineTo(this.toPx(x), this.toPx(y + br));
+        this.ctx.arc(this.toPx(x + br), this.toPx(y + br), this.toPx(br), 2 * Math.PI * (2 / 4), 2 * Math.PI * (3 / 4))
+    },
+    /**
+     * 计算文本长度
+     * @param {Array|Object}} text 数组 或者 对象
+     */
+    _getTextWidth(text) {
+        let texts = [];
+        if (Object.prototype.toString.call(text) === '[object Object]') {
+            texts.push(text);
+        } else {
+            texts = text;
+        }
+        let width = 0;
+        texts.forEach(({ fontSize, text, marginLeft = 0, marginRight = 0 }) => {
+            this.ctx.setFontSize(this.toPx(fontSize));
+            width += this.ctx.measureText(text).width + marginLeft + marginRight;
+        })
+
+        return this.toRpx(width);
+    },
+    /**
+     * 渲染一段文字
+     */
+    _drawSingleText({ x, y, fontSize, color, baseLine, textAlign = 'left', text, opacity = 1, textDecoration = 'none',
+      width, lineNum = 1, lineHeight = 0, fontWeight = 'normal', fontStyle = 'normal', fontFamily = "sans-serif"}) {
+        this.ctx.save();
+        this.ctx.beginPath();
+        this.ctx.font = fontStyle + " " + fontWeight + " " + this.toPx(fontSize, true) + "px " + fontFamily
+        this.ctx.setGlobalAlpha(opacity);
+        // this.ctx.setFontSize(this.toPx(fontSize));
+        this.ctx.setFillStyle(color);
+        this.ctx.setTextBaseline(baseLine);
+        this.ctx.setTextAlign(textAlign);
+        let textWidth = this.toRpx(this.ctx.measureText(text).width);
+        const textArr = [];
+         if (textWidth > width) {
+          // 文本宽度 大于 渲染宽度
+          let fillText = '';
+          let line = 1;
+          for (let i = 0; i <= text.length - 1 ; i++) {  // 将文字转为数组,一行文字一个元素
+            fillText = fillText + text[i];
+            if (this.toRpx(this.ctx.measureText(fillText).width) >= width) {
+              if (line === lineNum) {
+                if (i !== text.length - 1) {
+                  fillText = fillText.substring(0, fillText.length - 1) + '...';
+                }
+              }
+              if(line <= lineNum) {
+                textArr.push(fillText);
+              }
+              fillText = '';
+              line++;
+            } else {
+              if(line <= lineNum) {
+                if(i === text.length -1){
+                   textArr.push(fillText);
+                }
+              }
+            }
+          }
+          textWidth = width;
+        } else {
+          textArr.push(text);
+        }
+
+        textArr.forEach((item, index) => {
+            this.ctx.fillText(item, this.toPx(x), this.toPx(y + (lineHeight || fontSize) * index));
+        })
+
+        this.ctx.restore();
+
+        // textDecoration
+        if (textDecoration !== 'none') {
+            let lineY = y;
+            if (textDecoration === 'line-through') {
+                // 目前只支持贯穿线
+                lineY = y;
+
+                // 小程序画布baseLine偏移阈值
+                let threshold = 5;
+
+                // 根据baseLine的不同对贯穿线的Y坐标做相应调整
+                switch (baseLine) {
+                  case 'top':
+                    lineY += fontSize / 2 + threshold;
+                    break;
+                  case 'middle':
+                    break;
+                  case 'bottom':
+                    lineY -= fontSize / 2 + threshold;
+                    break;
+                  default:
+                    lineY -= fontSize / 2 - threshold;
+                    break;
+                }
+            }
+            this.ctx.save();
+            this.ctx.moveTo(this.toPx(x), this.toPx(lineY));
+            this.ctx.lineTo(this.toPx(x) + this.toPx(textWidth), this.toPx(lineY));
+            this.ctx.setStrokeStyle(color);
+            this.ctx.stroke();
+            this.ctx.restore();
+        }
+
+        return textWidth;
+    },
+}
+const helper = {
+    /**
+      * 下载图片并获取图片信息
+      */
+    _downloadImageAndInfo(image, index, pixelRatio) {
+        return new Promise((resolve, reject) => {
+            const { x, y, url, zIndex } = image;
+            const imageUrl = url;
+            // 下载图片
+            this._downImage(imageUrl, index)
+                // 获取图片信息
+                .then(imgPath => this._getImageInfo(imgPath, index))
+                .then(({ imgPath, imgInfo }) => {
+                    // 根据画布的宽高计算出图片绘制的大小,这里会保证图片绘制不变形
+                    let sx;
+                    let sy;
+                    const borderRadius = image.borderRadius || 0;
+                    const setWidth = image.width;
+                    const setHeight = image.height;
+                    const width = this.toRpx(imgInfo.width / pixelRatio);
+                    const height = this.toRpx(imgInfo.height / pixelRatio);
+
+                    if (width / height <= setWidth / setHeight) {
+                        sx = 0;
+                        sy = (height - ((width / setWidth) * setHeight)) / 2;
+                    } else {
+                        sy = 0;
+                        sx = (width - ((height / setHeight) * setWidth)) / 2;
+                    }
+                    this.drawArr.push({
+                        type: 'image',
+                        borderRadius,
+                        borderWidth: image.borderWidth,
+                        borderColor: image.borderColor,
+                        zIndex: typeof zIndex !== 'undefined' ? zIndex : index,
+                        imgPath,
+                        sx,
+                        sy,
+                        sw: (width - (sx * 2)),
+                        sh: (height - (sy * 2)),
+                        x,
+                        y,
+                        w: setWidth,
+                        h: setHeight,
+                    });
+                    resolve();
+                })
+                .catch(err => reject(err));
+        });
+    },
+    /**
+     * 下载图片资源
+     * @param {*} imageUrl
+     */
+    _downImage(imageUrl) {
+        return new Promise((resolve, reject) => {
+            if (/^http/.test(imageUrl) && !new RegExp(wx.env.USER_DATA_PATH).test(imageUrl)) {
+                wx.downloadFile({
+                    url: this._mapHttpToHttps(imageUrl),
+                    success: (res) => {
+                        if (res.statusCode === 200) {
+                            resolve(res.tempFilePath);
+                        } else {
+                            reject(res.errMsg);
+                        }
+                    },
+                    fail(err) {
+                        reject(err);
+                    },
+                });
+            } else {
+                // 支持本地地址
+                resolve(imageUrl);
+            }
+        });
+    },
+    /**
+     * 获取图片信息
+     * @param {*} imgPath
+     * @param {*} index
+     */
+    _getImageInfo(imgPath, index) {
+        return new Promise((resolve, reject) => {
+            wx.getImageInfo({
+                src: imgPath,
+                success(res) {
+                    resolve({ imgPath, imgInfo: res, index });
+                },
+                fail(err) {
+                    reject(err);
+                },
+            });
+        });
+    },
+    toPx(rpx, int) {
+      if (int) {
+        return parseInt(rpx * this.factor * this.pixelRatio);
+      }
+      return rpx * this.factor * this.pixelRatio;
+
+    },
+    toRpx(px, int) {
+      if (int) {
+        return parseInt(px / this.factor);
+      }
+      return px / this.factor;
+    },
+    /**
+     * 将http转为https
+     * @param {String}} rawUrl 图片资源url
+     */
+    _mapHttpToHttps(rawUrl) {
+        if (rawUrl.indexOf(':') < 0) {
+            return rawUrl;
+        }
+        const urlComponent = rawUrl.split(':');
+        if (urlComponent.length === 2) {
+            if (urlComponent[0] === 'http') {
+                urlComponent[0] = 'https';
+                return `${urlComponent[0]}:${urlComponent[1]}`;
+            }
+        }
+        return rawUrl;
+    },
+}
+Component({
+    properties: {
+    },
+    created() {
+        const sysInfo = wx.getSystemInfoSync();
+        const screenWidth = sysInfo.screenWidth;
+        this.factor = screenWidth / 750;
+    },
+    methods: Object.assign({
+        /**
+         * 计算画布的高度
+         * @param {*} config
+         */
+        getHeight(config) {
+            const getTextHeight = (text) => {
+                let fontHeight = text.lineHeight || text.fontSize;
+                let height = 0;
+                if (text.baseLine === 'top') {
+                    height = fontHeight;
+                } else if (text.baseLine === 'middle') {
+                    height = fontHeight / 2;
+                } else {
+                    height = 0;
+                }
+                return height;
+            }
+            const heightArr = [];
+            (config.blocks || []).forEach((item) => {
+                heightArr.push(item.y + item.height);
+            });
+            (config.texts  || []).forEach((item) => {
+                let height;
+                if (Object.prototype.toString.call(item.text) === '[object Array]') {
+                    item.text.forEach((i) => {
+                        height = getTextHeight({...i, baseLine: item.baseLine});
+                        heightArr.push(item.y + height);
+                    });
+                } else {
+                    height = getTextHeight(item);
+                    heightArr.push(item.y + height);
+                }
+            });
+            (config.images || []).forEach((item) => {
+                heightArr.push(item.y + item.height);
+            });
+            (config.lines || []).forEach((item) => {
+                heightArr.push(item.startY);
+                heightArr.push(item.endY);
+            });
+            const sortRes = heightArr.sort((a, b) => b - a);
+            let canvasHeight = 0;
+            if (sortRes.length > 0) {
+                canvasHeight = sortRes[0];
+            }
+            if (config.height < canvasHeight || !config.height) {
+                return canvasHeight;
+            } else {
+                return config.height;
+            }
+        },
+        create(config) {
+            this.ctx = wx.createCanvasContext('canvasid', this);
+
+            this.pixelRatio = config.pixelRatio || 1;
+            const height = this.getHeight(config);
+            this.initCanvas(config.width, height, config.debug)
+                .then(() => {
+                    // 设置画布底色
+                    if (config.backgroundColor) {
+                        this.ctx.save();
+                        this.ctx.setFillStyle(config.backgroundColor);
+                        this.ctx.fillRect(0, 0, this.toPx(config.width), this.toPx(height));
+                        this.ctx.restore();
+                    }
+                    const { texts = [], images = [], blocks = [], lines = [] } = config;
+                    const queue = this.drawArr
+                        .concat(texts.map((item) => {
+                            item.type = 'text';
+                            item.zIndex = item.zIndex || 0;
+                            return item;
+                        }))
+                        .concat(blocks.map((item) => {
+                            item.type = 'block';
+                            item.zIndex = item.zIndex || 0;
+                            return item;
+                        }))
+                        .concat(lines.map((item) => {
+                            item.type = 'line';
+                            item.zIndex = item.zIndex || 0;
+                            return item;
+                        }));
+                    // 按照顺序排序
+                    queue.sort((a, b) => a.zIndex - b.zIndex);
+
+                    queue.forEach((item) => {
+                        if (item.type === 'image') {
+                            this.drawImage(item)
+                        } else if (item.type === 'text') {
+                            this.drawText(item)
+                        } else if (item.type === 'block') {
+                            this.drawBlock(item)
+                        } else if (item.type === 'line') {
+                            this.drawLine(item)
+                        }
+                    });
+
+                    const res = wx.getSystemInfoSync();
+                    const platform = res.platform;
+                    let time = 0;
+                    if (platform === 'android') {
+                        // 在安卓平台,经测试发现如果海报过于复杂在转换时需要做延时,要不然样式会错乱
+                        time = 300;
+                    }
+                    this.ctx.draw(false, () => {
+                        setTimeout(() => {
+                            wx.canvasToTempFilePath({
+                                canvasId: 'canvasid',
+                                success: (res) => {
+                                    this.triggerEvent('success', res.tempFilePath);
+                                },
+                                fail: (err) => {
+                                    this.triggerEvent('fail', err);
+                                },
+                            }, this);
+                        }, time);
+                    });
+                })
+                .catch((err) => {
+                    wx.showToast({ icon: 'none', title: err.errMsg || '生成失败' });
+                    console.error(err);
+                });
+        },
+    }, main, handle, helper),
+});
+

+ 3 - 0
joolun-wx-ma/components/wxa-plugin-canvas/index/index.json

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

+ 4 - 0
joolun-wx-ma/components/wxa-plugin-canvas/index/index.wxml

@@ -0,0 +1,4 @@
+<!--index.wxml-->
+<view class="container">
+  <canvas canvas-id='canvasid' class="canvas {{debug ? 'debug' : 'pro'}}" style='width: {{pxWidth}}px; height: {{pxHeight}}px;'></canvas>
+</view>

+ 16 - 0
joolun-wx-ma/components/wxa-plugin-canvas/index/index.wxss

@@ -0,0 +1,16 @@
+.canvas {
+    width: 750rpx;
+    height: 750rpx;
+}
+.canvas.pro {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    transform: translate3d(-9999rpx, 0, 0);
+}
+.canvas.debug {
+    position: absolute;
+    bottom: 0;
+    left: 0;
+    border: 1rpx solid #ccc;
+}

+ 87 - 0
joolun-wx-ma/components/wxa-plugin-canvas/poster/index.js

@@ -0,0 +1,87 @@
+Component({
+    properties: {
+        config: {
+            type: Object,
+            value: {},
+        },
+        preload: {  // 是否预下载图片资源
+            type: Boolean,
+            value: false,
+        },
+        hideLoading: {  // 是否隐藏loading
+            type: Boolean,
+            value: false,
+        }
+    },
+    ready() {
+        if (this.data.preload) {
+            const poster = this.selectComponent('#poster');
+            this.downloadStatus = 'doing';
+            poster.downloadResource(this.data.config).then(() => {
+                this.downloadStatus = 'success';
+                this.trigger('downloadSuccess');
+            }).catch((e) => {
+                this.downloadStatus = 'fail';
+                this.trigger('downloadFail', e);
+            });
+        }
+    },
+    methods: {
+        trigger(event, data) {
+            if (this.listener && typeof this.listener[event] === 'function') {
+                this.listener[event](data);
+            }
+        },
+        once(event, fun) {
+            if (typeof this.listener === 'undefined') {
+                this.listener = {};
+            }
+            this.listener[event] = fun;
+        },
+        downloadResource(reset) {
+            return new Promise((resolve, reject) => {
+                if (reset) {
+                    this.downloadStatus = null;
+                }
+                const poster = this.selectComponent('#poster');
+                if (this.downloadStatus && this.downloadStatus !== 'fail') {
+                    if (this.downloadStatus === 'success') {
+                        resolve();
+                    } else {
+                        this.once('downloadSuccess', () => resolve());
+                        this.once('downloadFail', (e) => reject(e));
+                    }
+                } else {
+                    poster.downloadResource(this.data.config)
+                        .then(() => {
+                            this.downloadStatus = 'success';
+                            resolve();
+                        })
+                        .catch((e) => reject(e));
+                }  
+            })
+        },
+        onCreate(reset = false) {
+            !this.data.hideLoading && wx.showLoading({ mask: true, title: '生成中' });
+            return this.downloadResource(typeof reset === 'boolean' && reset).then(() => {
+                !this.data.hideLoading && wx.hideLoading();
+                const poster = this.selectComponent('#poster');
+                poster.create(this.data.config);
+            })
+            .catch((err) => {
+                !this.data.hideLoading && wx.hideLoading();
+                wx.showToast({ icon: 'none', title: err.errMsg || '生成失败' });
+                console.error(err);
+                this.triggerEvent('fail', err);
+            })
+        },
+        onCreateSuccess(e) {
+            const { detail } = e;
+            this.triggerEvent('success', detail);
+        },
+        onCreateFail(err) {
+            console.error(err);
+            this.triggerEvent('fail', err);
+        }
+    }
+})

+ 6 - 0
joolun-wx-ma/components/wxa-plugin-canvas/poster/index.json

@@ -0,0 +1,6 @@
+{
+    "component": true,
+    "usingComponents": {
+        "we-canvas": "../index/index"
+    }
+}

+ 4 - 0
joolun-wx-ma/components/wxa-plugin-canvas/poster/index.wxml

@@ -0,0 +1,4 @@
+<view bindtap='onCreate'>
+    <slot/>
+</view>
+<we-canvas id="poster" bind:success="onCreateSuccess" bind:fail="onCreateFail"/>

+ 0 - 0
joolun-wx-ma/components/wxa-plugin-canvas/poster/index.wxss


+ 29 - 0
joolun-wx-ma/components/wxa-plugin-canvas/poster/poster.js

@@ -0,0 +1,29 @@
+const defaultOptions = {
+    selector: '#poster'
+};
+
+function Poster(options = {}, that) {
+    options = {
+        ...defaultOptions,
+        ...options,
+    };
+
+    const pages = getCurrentPages();
+    let ctx = pages[pages.length - 1];
+    if (that) ctx = that
+    const poster = ctx.selectComponent(options.selector);
+    delete options.selector;
+
+    return poster;
+};
+
+Poster.create = (reset = false, that) => {
+    const poster  = Poster({}, that);
+    if (!poster) {
+        console.error('请设置组件的id="poster"!!!');
+    } else {
+        return Poster({}, that).onCreate(reset);
+    }
+}
+
+export default Poster;

+ 19 - 0
joolun-wx-ma/config/env.js

@@ -0,0 +1,19 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+export default {
+  //服务器地址,即后台服务的访问地址;本地开发填http://localhost:7500即可,正式服务器环境https://后台地址/prod-api;如果要用真机调试要把localhost换成局域网ip,手机和电脑要处于同一局域网中
+  basePath: 'http://localhost:7500',
+  //广告配置,小程序流量主:https://mp.weixin.qq.com/wxopen/frame
+  //广告开关(true/false)
+  adEnable: true,
+  //Banner广告ID
+  adBannerID: 'adunit-9d021cb4da95d1d8',
+  //插屏广告ID
+  adInsertScreenID: 'adunit-2de35a3c8ce17ce8',
+  //激励式广告ID
+  adIncentiveID: 'adunit-c4029aba1e16094b',
+}

+ 82 - 0
joolun-wx-ma/pages/base/search/index.js

@@ -0,0 +1,82 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Page({
+  data: {
+    searchHistory: [],
+    goodsList: []
+  },
+  onShow() {
+    this.setData({
+      searchHistory: wx.getStorageSync('searchHistory') ? wx.getStorageSync('searchHistory') : []
+    })
+  },
+  onLoad(options) {
+    app.initPage()
+      .then(res => {
+        this.goodsPage()
+      })
+  },
+  searchHandle(e) {
+    let value
+    if (e.detail.value) {
+      value = e.detail.value
+    } else if (e.currentTarget.dataset.name){
+      value = e.currentTarget.dataset.name
+    }
+    let searchHistory = this.data.searchHistory
+    searchHistory.forEach(function (item, index) {
+      let i = 9 //最多缓存10条
+      if (item.name == value){
+        searchHistory.splice(index, 1)
+        i++
+      }
+      if (index >= i){
+        searchHistory.splice(index, 1)
+      }
+    })
+    searchHistory.unshift({
+      name: value
+    })
+    wx.setStorageSync('searchHistory', searchHistory)
+    wx.navigateTo({
+      url: '/pages/goods/goods-list/index?name=' + value
+    })
+  },
+  clearSearchHistory(){
+    let that = this
+    wx.showModal({
+      content: '确认删除全部历史记录?',
+      cancelText: '我再想想',
+      confirmColor: '#ff0000',
+      success(res) {
+        if (res.confirm) {
+          that.setData({
+            searchHistory: []
+          })
+          wx.setStorageSync('searchHistory', [])
+        }
+      }
+    })
+  },
+  goodsPage() {
+    app.api.goodsPage({
+      searchCount: false,
+      current: 1,
+      size: 10,
+      ascs: '',//升序字段
+      descs: 'sale_num'
+    })
+      .then(res => {
+        let goodsList = res.data.records
+        this.setData({
+          goodsList: goodsList
+        })
+      })
+  },
+})

+ 4 - 0
joolun-wx-ma/pages/base/search/index.json

@@ -0,0 +1,4 @@
+{
+  "navigationBarTitleText": "搜索",
+  "usingComponents": {}
+}

+ 37 - 0
joolun-wx-ma/pages/base/search/index.wxml

@@ -0,0 +1,37 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="cu-bar search bg-white">
+  <view class="search-form round">
+    <text class="cuIcon-search"></text>
+    <input type="text" placeholder="请输入商品名" confirm-type="search" bindconfirm="searchHandle" focus></input>
+  </view>
+</view>
+<view wx:if="{{searchHistory.length > 0}}">
+  <view class="cu-bar bg-white">
+    <view class="action"><text class="cuIcon-time"></text>历史搜索</view>
+    <view class="action">
+      <text class="cuIcon-delete lg text-gray" bindtap="clearSearchHistory"></text>
+    </view>
+  </view>
+  <view class="padding-sm flex flex-wrap bg-white">
+    <view class="padding-xs" wx:for="{{searchHistory}}" wx:key="index">
+      <view class="cu-tag round" bindtap="searchHandle" data-name="{{item.name}}">{{item.name}}</view>
+    </view>
+  </view>
+</view>
+<view wx:if="{{goodsList}}">
+  <view class="cu-bar bg-white">
+    <view class="action"><text class="cuIcon-hot text-orange"></text>全网热榜</view>
+  </view>
+  <view class="cu-list menu card-menu sm-border margin-top-sm">
+    <view class="cu-item" wx:for="{{goodsList}}" wx:key="index">
+      <navigator hover-class='none' url='/pages/goods/goods-detail/index?id={{item.id}}' class="content overflow-1" data-name="{{item.name}}">
+        <text class="margin-right-sm text-bold text-orange">{{index+1}}</text>{{item.name}}
+      </navigator>
+    </view>
+  </view>
+</view>

+ 1 - 0
joolun-wx-ma/pages/base/search/index.wxss

@@ -0,0 +1 @@
+@import "/app.wxss";

+ 78 - 0
joolun-wx-ma/pages/goods/goods-category/index.js

@@ -0,0 +1,78 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Page({
+  data: {
+    config: app.globalData.config,
+    TabCur: 0,
+    MainCur: 0,
+    VerticalNavTop: 0,
+    goodsCategory: [],
+    load: true
+  },
+  onLoad() { 
+    app.initPage()
+      .then(res => {
+        this.goodsCategoryGet()
+      })
+  },
+  onShow() {
+    //更新tabbar购物车数量
+    wx.setTabBarBadge({
+      index: 2,
+      text: app.globalData.shoppingCartCount + ''
+    })
+  },
+  goodsCategoryGet() {
+    app.api.goodsCategoryGet()
+      .then(res => {
+        let goodsCategory = res.data
+        this.setData({
+          goodsCategory: goodsCategory
+        })
+      })
+  },
+  tabSelect(e) {
+    this.setData({
+      TabCur: e.currentTarget.dataset.id,
+      MainCur: e.currentTarget.dataset.id,
+      VerticalNavTop: (e.currentTarget.dataset.id - 1) * 50
+    })
+  },
+  VerticalMain(e) {
+    let that = this
+    let list = this.data.goodsCategory
+    let tabHeight = 0
+    if (this.data.load) {
+      for (let i = 0; i < list.length; i++) {
+        let view = wx.createSelectorQuery().select("#main-" + i)
+        view.fields({
+          size: true
+        }, data => {
+          list[i].top = tabHeight
+          tabHeight = tabHeight + data.height
+          list[i].bottom = tabHeight
+        }).exec()
+      }
+      that.setData({
+        load: false,
+        goodsCategory: list
+      })
+    }
+    let scrollTop = e.detail.scrollTop + 20
+    for (let i = 0; i < list.length; i++) {
+      if (scrollTop > list[i].top && scrollTop < list[i].bottom) {
+        that.setData({
+          VerticalNavTop: (i - 1) * 50,
+          TabCur: i
+        })
+        return false
+      }
+    }
+  }
+})

+ 6 - 0
joolun-wx-ma/pages/goods/goods-category/index.json

@@ -0,0 +1,6 @@
+{
+  "navigationBarTitleText": "商品分类",
+  "usingComponents": {
+    
+  }
+}

+ 42 - 0
joolun-wx-ma/pages/goods/goods-category/index.wxml

@@ -0,0 +1,42 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="cu-bar search bg-white">
+  <view class="search-form round">
+    <text class="cuIcon-search"></text>
+    <navigator class="response" hover-class='none' url='/pages/base/search/index'>
+      <input type="text" placeholder="请输入商品名"></input>
+    </navigator>
+  </view>
+</view>
+<view class="VerticalBox margin-top-xs margin-left-xs">
+  <scroll-view class="VerticalNav nav" scroll-y scroll-with-animation scroll-top="{{VerticalNavTop}}" style="height:calc(100vh - 100rpx)">
+    <view class="cu-item {{index==TabCur?'text-red cur':''}}" wx:for="{{goodsCategory}}" wx:key="index" bindtap='tabSelect' data-id="{{index}}">
+      {{item.name}}
+    </view>
+  </scroll-view>
+  <scroll-view class="VerticalMain" scroll-y scroll-with-animation style="height:calc(100vh - 100rpx)" scroll-into-view="main-{{MainCur}}" bindscroll="VerticalMain">
+    <view class="padding-tb-xs padding-lr-sm" wx:for="{{goodsCategory}}" wx:key="index" id="main-{{index}}">
+      <view class='cu-bar solid-bottom bg-white'>
+        <view class='action'>
+          <text class="cuIcon-titles text-black"></text>{{item.name}}
+        </view>
+      </view>
+      <view class="cu-bar bg-white solid-bottom">
+        <view class="cate-list">
+          <image wx:if="{{item.picUrl}}" class="img-banner radius" src="{{item.picUrl}}"></image>
+          <view wx:if="{{ item.children.length>0 }}" wx:for="{{item.children}}" wx:for-item="item2" wx:key="index" class="cate">
+            <navigator hover-class='none' url='/pages/goods/goods-list/index?categorySecond={{item2.id}}&title={{item2.name}}'>
+              <image class="cate-img" src="{{item2.picUrl ? item2.picUrl : '/public/img/no_pic.png'}}"></image>
+              <view class='text-sm'>{{item2.name}}</view>
+            </navigator>
+          </view>
+          <view class='padding response text-center' wx:if="{{ !item.children }}">暂无数据</view>
+        </view>
+      </view>
+    </view>
+  </scroll-view>
+</view>

+ 67 - 0
joolun-wx-ma/pages/goods/goods-category/index.wxss

@@ -0,0 +1,67 @@
+.VerticalNav.nav {
+  width: 220rpx;
+  white-space: initial;
+}
+.VerticalNav.nav .cu-item {
+  font-size:14px;
+  font-weight:300;
+  color: #333333;
+  width: 100%;
+  text-align: center;
+  background-color: #f1f1f1;
+  margin: 0;
+  border: none;
+  height: 50px;
+  position: relative;
+}
+.VerticalNav.nav .cu-item.cur {
+  font-size:15px;
+  font-weight:500;
+  border-radius: 10rpx 0 0 10rpx;
+  background-color: #fff;
+}
+.VerticalNav.nav .cu-item.cur::after {
+  content: "";
+  position: absolute;
+  background-color: currentColor;
+  top: 0;
+  right: 0rpx;
+  bottom: 0;
+  margin: auto;
+}
+.VerticalBox{
+  display: flex;
+}
+.VerticalMain{
+  background-color: #fff;
+}
+.img-banner{
+  width: 94%;
+  height: 148rpx;
+	margin: auto;
+}
+.cate-list{
+  display:flex;
+  flex-wrap:wrap;
+  width: 100%;
+  }
+.cate-title{
+  width:100%;
+  font-size:15px;
+  font-weight:bold;
+  padding-left:10rpx;
+  }
+.cate{
+  width:150rpx;
+  font-size:14px;
+  margin:15rpx;
+  text-align:center;
+  }
+.cate-img{
+  width:140rpx;
+  height:140rpx;
+  }
+.cate-type{
+  font-size: 14px;
+  color: #000000
+  }

+ 194 - 0
joolun-wx-ma/pages/goods/goods-detail/index.js

@@ -0,0 +1,194 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const WxParse = require('../../../public/wxParse/wxParse.js')
+import Poster from '../../../components/wxa-plugin-canvas/poster/poster'
+const { base64src } = require('../../../utils/base64src.js')
+const app = getApp()
+
+Page({
+  data: {
+    config: app.globalData.config,
+    goodsSpu: null,
+    currents: 1,
+    cartNum: 1,
+    goodsSpecData: [],
+    shoppingCartCount: 0,
+    shareShow: '',
+    modalService: '',
+  },
+  onLoad(options) {
+    let id
+    if (options.scene){//接受二维码中参数
+      id = decodeURIComponent(options.scene)
+    }else{
+      id = options.id
+    }
+    this.setData({
+      id: id
+    })
+    app.initPage()
+      .then(res => {
+        this.goodsGet(id)
+        this.shoppingCartCount()
+      })
+  },
+  onShareAppMessage: function () {
+    let goodsSpu = this.data.goodsSpu
+    let title = goodsSpu.name
+    let imageUrl = goodsSpu.picUrls[0]
+    let path = 'pages/goods/goods-detail/index?id=' + goodsSpu.id
+    return {
+      title: title,
+      path: path,
+      imageUrl: imageUrl,
+      success: function (res) {
+        if (res.errMsg == 'shareAppMessage:ok') {
+          console.log(res.errMsg)
+        }
+      },
+      fail: function (res) {
+        // 转发失败
+      }
+    }
+  },
+  goodsGet(id) {
+    app.api.goodsGet(id)
+      .then(res => {
+        let goodsSpu = res.data
+        this.setData({
+          goodsSpu: goodsSpu
+        })
+        //html转wxml
+        WxParse.wxParse('description', 'html', goodsSpu.description, this, 0)
+      })
+  },
+  
+  change: function (e) {
+    this.setData({
+      currents: e.detail.current + 1
+    })
+  },
+  // 购买或加入购物车
+  toDo(e) {
+    let canDo = true
+    if (canDo) {
+      let goodsSpu = this.data.goodsSpu
+      if (e.currentTarget.dataset.type == '1') {//加购物车
+        if (this.data.shoppingCartId) {
+          app.api.shoppingCartEdit({
+            id: this.data.shoppingCartId,
+            spuId: goodsSpu.id,
+            quantity: this.data.cartNum,
+            addPrice: goodsSpu.salesPrice,
+            spuName: goodsSpu.name,
+            picUrl: goodsSpu.picUrls ? goodsSpu.picUrls[0]:''
+          })
+            .then(res => {
+              wx.showToast({
+                title: '修改成功',
+                duration: 5000
+              })
+              this.shoppingCartCount();
+            })
+        } else {
+          app.api.shoppingCartAdd({
+            spuId: goodsSpu.id,
+            quantity: this.data.cartNum,
+            addPrice: goodsSpu.salesPrice,
+            spuName: goodsSpu.name,
+            picUrl: goodsSpu.picUrls ? goodsSpu.picUrls[0] : ''
+          })
+            .then(res => {
+              wx.showToast({
+                title: '添加成功',
+                duration: 5000
+              })
+              this.setData({
+                modalSku: false
+              })
+              this.shoppingCartCount()
+            })
+        }
+      } else {//立即购买,前去确认订单
+        if (this.data.goodsSpu.stock <= 0) {
+          wx.showToast({
+            title: '抱歉,库存不足暂时无法购买',
+            icon: 'none',
+            duration: 2000
+          })
+          return;
+        }
+        /* 把参数信息异步存储到缓存当中 */
+        wx.setStorage({
+          key: 'param-orderConfirm',
+          data: [{
+            spuId: goodsSpu.id,
+            quantity: this.data.cartNum,
+            salesPrice: goodsSpu.salesPrice,
+            spuName: goodsSpu.name,
+            picUrl: goodsSpu.picUrls ? goodsSpu.picUrls[0] : ''
+          }]
+        })
+        wx.navigateTo({
+          url: '/pages/order/order-confirm/index'
+        })
+      }
+    }
+  },
+  shoppingCartCount(){
+    app.api.shoppingCartCount()
+      .then(res => {
+        let shoppingCartCount = res.data
+        this.setData({
+          shoppingCartCount: shoppingCartCount
+        })
+        //设置TabBar购物车数量
+        app.globalData.shoppingCartCount = shoppingCartCount + ''
+      })
+  },
+  operateCartEvent(){
+    this.shoppingCartCount()
+  },
+  shareShow(){
+    this.setData({
+      shareShow: 'show'
+    })
+  },
+  shareHide(){
+    this.setData({
+      shareShow: ''
+    })
+  },
+  onPosterSuccess(e) {
+    const { detail } = e
+    this.setData({
+      posterUrl: detail
+    })
+  },
+  onPosterFail(err) {
+    console.error(err);
+  },
+  hidePosterShow(){
+    this.setData({
+      posterShow: false,
+      shareShow: ''
+    })
+  },
+  /**
+   * 异步生成海报
+   */
+  onCreatePoster() {
+    
+  },
+  //点击保存到相册
+  savePoster: function () {
+    
+  },
+  handleContact(e) {
+    console.log(e)
+  }
+})

+ 7 - 0
joolun-wx-ma/pages/goods/goods-detail/index.json

@@ -0,0 +1,7 @@
+{
+  "navigationBarTitleText": "商品详情",
+  "usingComponents": {
+    "base-rade": "/components/base-rade/index",
+    "poster": "/components/wxa-plugin-canvas/poster/index"
+  }
+}

+ 133 - 0
joolun-wx-ma/pages/goods/goods-detail/index.wxml

@@ -0,0 +1,133 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class='product-bg bg-white padding-top'>
+  <swiper class="screen-swiper square-dot screen" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500" bindchange="change">
+    <swiper-item wx:for="{{goodsSpu.picUrls}}" wx:key="index">
+      <image class="screen-image" src="{{item}}" mode="aspectFill"></image>
+    </swiper-item>
+  </swiper>
+  <view class='page-index cu-tag round'>{{currents}}/{{goodsSpu.picUrls.length || 1}}</view>
+</view>
+<view class="cu-bar bg-white padding-top-xl">
+  <view class="text-xxl padding-tb-xs padding-lr-sm">
+    <text class="text-price text-blue text-bold">{{goodsSpu.salesPrice}}</text>
+  </view>
+  <button class="cu-btn icon margin-right" bindtap="shareShow">
+    <text class="cuIcon-share text-green"></text>
+  </button>
+</view>
+<view class="cu-bar bg-white">
+  <view class="text-lg text-bold padding-lr-sm">
+    <text class="text-black">{{goodsSpu.name}}</text>
+  </view>
+</view>
+<view class="cu-bar bg-white">
+  <view class="text-sm padding-lr-sm">
+    <text class="text-gray">{{goodsSpu.sellPoint}}</text>
+  </view>
+</view>
+<view class="cu-bar bg-white solid-bottom">
+  <view class="text-sm padding-lr-sm text-gray">
+    <text wx:if="{{goodsSpu.marketPrice}}">市场价:</text>
+    <text class="text-price text-gray">{{goodsSpu.marketPrice}}</text>
+  </view>
+  <view class="text-sm margin-right text-gray">
+    <text>库存:{{goodsSpu.stock}}</text>
+  </view>
+</view>
+
+<view class="cu-bar bg-white solid-bottom">
+  <view class="flex response">
+    <view class="flex-sub text-sm">
+      <view class="text-gray margin-left-sm">深圳发货</view>
+    </view>
+    <view class="flex-treble text-sm">
+      <text class="cuIcon-location text-black" wx:if="{{goodsSpu.deliveryPlace}}">{{goodsSpu.deliveryPlace.place}} | </text>
+      <text class="text-black" wx:if="{{goodsSpu.freightTemplat}}">运费:全国包邮</text>
+    </view>
+    <view class="flex-sub text-sm text-gray text-right margin-right-sm">销量{{goodsSpu.saleNum}}</view>
+  </view>
+</view>
+
+<view class="cu-bar bg-white">
+  <view class="flex response" bindtap="showModalService">
+      <view class="flex-sub text-sm">
+        <view class="text-gray margin-left-sm">服务</view>
+      </view>
+      <view class="flex-sub text-sm text-gray text-right margin-right-sm">假一赔十 | 七天无理由退款</view>
+    </view>
+</view>
+
+<ad unit-id="{{config.adBannerID}}" wx:if="{{config.adEnable}}"></ad>
+
+<view class="cu-bar bg-white margin-top-sm">
+  <view class="content">商品信息</view>
+</view>
+
+<view class="bg-white">
+  <template is="wxParse" data="{{wxParseData:description.nodes}}"/>
+</view>
+
+<view class="cu-load bg-gray to-down">已经到底啦...</view>
+
+<view class="cu-bar bg-white tabbar border shop foot">
+  <button open-type="contact" bindcontact="handleContact" class="action bg-white"
+          send-message-title="{{goodsSpu.name}}--咨询"
+          send-message-img="{{goodsSpu.picUrls[0] ? goodsSpu.picUrls[0] : '/public/img/no_pic.png'}}"
+          show-message-card="true" 
+          send-message-path="/pages/goods/goods-detail/index?id={{goodsSpu.id}}">
+    <view class="cuIcon-servicefill"></view> 
+    客服
+  </button>
+  <navigator class="action" open-type='switchTab' url='/pages/shopping-cart/index'>
+    <view class="cuIcon-cart">
+      <view class="cu-tag badge">{{shoppingCartCount}}</view>
+    </view>
+    购物车
+  </navigator>
+  <view class="btn-group">
+    <button class="cu-btn shadow-blur margin-left-sm shopping-cart" bindtap="toDo" data-type="1"><text class="text-white">加入购物车</text></button>
+    <button class="cu-btn shadow-blur buy-now" bindtap="toDo" data-type="2"><text class="text-white">立即购买</text></button>
+  </view>
+</view>
+<!-- html转wxml -->
+<import src="/public/wxParse/wxParse.wxml"/>
+<view class="cu-modal {{goodsSpu.shelf=='0'?'show':''}}">
+  <view class="cu-dialog">
+    <view class="cu-bar bg-white justify-end">
+      <view class="content">提示</view>
+    </view>
+    <view class="padding-xl">
+      抱歉,该商品已下架
+    </view>
+  </view>
+</view>
+
+<poster id="poster" hide-loading="{{false}}" preload="{{false}}" config="{{posterConfig}}" bind:success="onPosterSuccess" bind:fail="onPosterFail"></poster>
+<view class="cu-modal bottom-modal {{shareShow}}">
+  <view class="cu-dialog">
+    <view class="cu-bar bg-white">
+      <view class="action text-green"></view>
+      <view class="action text-red" bindtap="shareHide">取消</view>
+    </view>
+    <view class="padding flex flex-direction">
+      <button class="cu-btn bg-green lg" open-type='share'>发送给朋友</button>
+    </view>
+  </view>
+</view>
+
+<view class="cu-modal {{posterShow ? 'show' : ''}}">
+  <view class="cu-dialog">
+    <view style="height: calc(100vh - 200rpx)">
+      <image src="{{posterUrl}}" style="height: 100%;"></image>
+    </view>
+    <view class="cu-bar bg-white">
+      <view class="action margin-0 flex-sub" bindtap="hidePosterShow">取消</view>
+      <view class="action margin-0 flex-sub solid-left text-red text-bold" bindtap="savePoster">保存到相册</view>
+    </view>
+  </view>
+</view>

+ 32 - 0
joolun-wx-ma/pages/goods/goods-detail/index.wxss

@@ -0,0 +1,32 @@
+.product-bg{width:100%;position:relative;}
+.product-bg swiper{width:100%;height:calc(100vw);position:relative;}
+.product-bg .page-index{
+  position:absolute;right:30rpx;bottom:30rpx;
+}
+.cu-bar.tabbar.shop .action {
+  width: unset;
+}
+.to-down{
+  margin-bottom: 100rpx
+}
+.screen{
+  width:94% !important; 
+  border-radius: 20rpx; 
+  min-height: 900rpx; 
+  margin:auto;
+  background-color: #ececec;
+}
+.screen-image{
+  padding-top:80rpx;
+  height:780rpx !important;
+}
+.shopping-cart{
+  background-color: #2d2d2f !important;
+  font-weight:300;
+  width:220rpx;
+}
+.buy-now{
+  background-color: #2967ff !important;
+  font-weight:300;
+  width:220rpx;
+}

+ 181 - 0
joolun-wx-ma/pages/goods/goods-list/index.js

@@ -0,0 +1,181 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const util = require('../../../utils/util.js')
+const app = getApp()
+
+Page({
+  data: {
+    page: {
+      searchCount: false,
+      current: 1,
+      size: 10,
+      ascs: '',//升序字段
+      descs: ''
+    },
+    parameter: {},
+    loadmore: true,
+    goodsList: [],
+    viewType: true,
+    price: '',
+    sales: '',
+    createTime: '',
+    title: ''
+  },
+  onLoad(options) {
+    let title = options.title ? decodeURI(options.title) : '默认'
+    this.setData({
+      title: title
+    })
+    if (options.categorySecond){
+      this.setData({
+        ['parameter.categorySecond']: options.categorySecond
+      })
+    }
+    if (options.name) {
+      this.setData({
+        ['parameter.name']: options.name
+      })
+    }
+    if (options.type) {
+      if (options.type == '1'){
+        this.setData({
+          title: '新品首发',
+          ['page.descs']: 'create_time'
+        })
+      }
+      if (options.type == '2') {
+        this.setData({
+          title: '热销单品',
+          ['page.descs']: 'sale_num'
+        })
+      }
+    }
+    if (options.couponUserId) {
+      this.setData({
+        ['parameter.couponUserId']: options.couponUserId
+      })
+    }
+    app.initPage()
+      .then(res => {
+        this.goodsPage()
+      })
+  },
+  goodsPage() {
+    app.api.goodsPage(Object.assign(
+      {},
+      this.data.page,
+      util.filterForm(this.data.parameter)
+    ))
+      .then(res => {
+        let goodsList = res.data.records
+        this.setData({
+          goodsList: [...this.data.goodsList, ...goodsList]
+        })
+        if (goodsList.length < this.data.page.size) {
+          this.setData({
+            loadmore: false
+          })
+        }
+      })
+  },
+  viewTypeEdit(){
+    this.setData({
+      viewType: !this.data.viewType
+    })
+  },
+  onReachBottom() {
+    if (this.data.loadmore) {
+      this.setData({
+        ['page.current']: this.data.page.current + 1
+      })
+      this.goodsPage()
+    }
+  },
+  sortHandle(e){
+    let type = e.target.dataset.type
+    switch (type) {
+      case 'price':
+        if (this.data.price == ''){
+          this.setData({
+            price: 'asc',
+            ['page.descs']: '',
+            ['page.ascs']: 'sales_price'
+          })
+        } else if (this.data.price == 'asc'){
+          this.setData({
+            price: 'desc',
+            ['page.descs']: 'sales_price',
+            ['page.ascs']: ''
+          })
+        } else if (this.data.price == 'desc'){
+          this.setData({
+            price: '',
+            ['page.ascs']: '',
+            ['page.descs']: ''
+          })
+        }
+        this.setData({
+          sales: '',
+          createTime: ''
+        })
+        break
+      case 'sales':
+        if (this.data.sales == ''){
+          this.setData({
+            sales: 'desc',
+            ['page.descs']: 'sale_num',
+            ['page.ascs']: ''
+          })
+        }else if (this.data.sales == 'desc'){
+          this.setData({
+            sales: 'asc',
+            ['page.descs']: '',
+            ['page.ascs']: 'sale_num'
+          })
+        }else if (this.data.sales == 'asc'){
+          this.setData({
+            sales: '',
+            ['page.ascs']: '',
+            ['page.descs']: ''
+          })
+        }
+        this.setData({
+          price: '',
+          createTime: ''
+        })
+        break
+      case 'createTime':
+        if (this.data.createTime == ''){
+          this.setData({
+            createTime: 'desc',
+            ['page.descs']: 'create_time',
+            ['page.ascs']: ''
+          })
+        }else if (this.data.createTime == 'desc'){
+          this.setData({
+            createTime: '',
+            ['page.ascs']: '',
+            ['page.descs']: ''
+          })
+        }
+        this.setData({
+          price: '',
+          sales: ''
+        })
+        break
+    }
+    this.relod()
+  },
+  relod(){
+    this.setData({
+      loadmore: true,
+      goodsList: [],
+      ['page.current']: 1
+    })
+    this.goodsPage()
+  }
+})

+ 7 - 0
joolun-wx-ma/pages/goods/goods-list/index.json

@@ -0,0 +1,7 @@
+{
+  "navigationBarTitleText": "商品列表",
+  "usingComponents": {
+    "goods-card": "/components/goods-card/index",
+    "goods-row": "/components/goods-row/index"
+  }
+}

+ 58 - 0
joolun-wx-ma/pages/goods/goods-list/index.wxml

@@ -0,0 +1,58 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="cu-bar search bg-white fixed">
+  <view class="search-form round">
+    <text class="cuIcon-search"></text>
+    <navigator class="response" hover-class='none' url='/pages/base/search/index'>
+      <input type="text" placeholder="请输入商品名" value="{{parameter.name}}"></input>
+    </navigator>
+  </view>
+  <view class="action">
+    <view class="text-xxl">
+      <text class="cuIcon-{{viewType ? 'list' : 'cascades'}} text-black" bindtap="viewTypeEdit"></text>
+    </view>
+  </view>
+</view>
+<view class="cu-bar justify-center bg-white fixed" style="margin-top:80rpx;box-shadow:none;">
+  <view class="grid response text-center align-start">
+    <view class="flex-sub padding-sm margin-xs radius text-blue text-bold">{{title}}</view>
+    <view class="flex-sub padding-sm margin-xs radius">
+      <view class="grid text-center" bindtap="sortHandle" data-type='price'>
+        价格
+        <view class="margin-left-xs">
+          <view class="cuIcon-triangleupfill {{price=='asc' ? 'text-blue' : ''}}" data-type='price'/>
+          <view class="basis-df"/>
+          <view class="cuIcon-triangledownfill {{price=='desc' ? 'text-blue' : ''}}" data-type='price'/>
+        </view>
+      </view>
+    </view>
+    <view class="flex-sub padding-sm margin-xs radius">
+      <view class="grid text-center" bindtap="sortHandle" data-type='sales'>
+        销量
+        <view class="margin-left-xs">
+          <view class="cuIcon-triangleupfill {{sales=='asc' ? 'text-blue' : ''}}" data-type='sales'/>
+          <view class="basis-df"/>
+          <view class="cuIcon-triangledownfill {{sales=='desc' ? 'text-blue' : ''}}" data-type='sales'/>
+        </view>
+      </view>
+    </view>
+    <view class="flex-sub padding-sm margin-xs radius">
+      <view class="{{createTime=='desc' ? 'text-blue text-bold' : ''}}" bindtap="sortHandle" data-type='createTime'>
+        新上架
+      </view>
+    </view>
+  </view>
+</view>
+<view style="margin-top:200rpx">
+  <view wx:if="{{viewType}}">
+    <goods-card goodsList="{{goodsList}}"/>
+  </view>
+  <view wx:if="{{!viewType}}">
+    <goods-row goodsList="{{goodsList}}"/>
+  </view>
+  <view class="cu-load bg-gray {{loadmore?'loading':'over'}}"></view>
+</view>

+ 6 - 0
joolun-wx-ma/pages/goods/goods-list/index.wxss

@@ -0,0 +1,6 @@
+.cu-bar{
+  min-height: 80rpx!important
+}
+.cuIcon-triangledownfill{
+  margin-top: -22rpx
+}

+ 143 - 0
joolun-wx-ma/pages/home/index.js

@@ -0,0 +1,143 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Page({
+  data: {
+    config: app.globalData.config,
+    page: {
+      searchCount: false,
+      current: 1,
+      size: 10
+    },
+    loadmore: true,
+    goodsList: [],
+    goodsListNew: [],
+    goodsListHot: [],
+    swiperData: [
+      'https://joolun-base-test.oss-cn-zhangjiakou.aliyuncs.com/1/material/c888e1d3-f542-4b4e-aa43-be9d50cc0696.jpg',
+      'https://joolun-base-test.oss-cn-zhangjiakou.aliyuncs.com/1/material/a5e3b9f4-f1fe-4bb2-b487-13f4395ef187.jpg',
+      'https://joolun-base-test.oss-cn-zhangjiakou.aliyuncs.com/1/material/c8fd87ff-ca5d-4f95-8f81-e99cae48b0f7.jpg',
+      'https://joolun-base-test.oss-cn-zhangjiakou.aliyuncs.com/1/material/bf176bd5-3487-4b61-8d30-1cc2ad95b8ac.jpg'
+    ],
+    cardCur: 0,
+    noticeData: []
+  },
+  onLoad() {
+    app.initPage()
+      .then(res => {
+        this.loadData()
+      })
+  },
+  onShow(){
+    //更新tabbar购物车数量
+    wx.setTabBarBadge({
+      index: 2,
+      text: app.globalData.shoppingCartCount + ''
+    })
+  },
+  loadData(){
+    this.goodsNew()
+    this.goodsHot()
+    this.goodsPage()
+  },
+  onShareAppMessage: function () {
+    let title = 'JooLun商城源码-小程序演示'
+    let path = 'pages/home/index'
+    return {
+      title: title,
+      path: path,
+      success: function (res) {
+        if (res.errMsg == 'shareAppMessage:ok') {
+          console.log(res.errMsg)
+        }
+      },
+      fail: function (res) {
+        // 转发失败
+      }
+    }
+  },
+  //新品首发
+  goodsNew() {
+    app.api.goodsPage({
+      searchCount: false,
+      current: 1,
+      size: 5,
+      descs: 'create_time'
+    })
+      .then(res => {
+        let goodsListNew = res.data.records
+        this.setData({
+          goodsListNew: goodsListNew
+        })
+      })
+  },
+  //热销单品
+  goodsHot() {
+    app.api.goodsPage({
+      searchCount: false,
+      current: 1,
+      size: 5,
+      descs: 'sale_num'
+    })
+      .then(res => {
+        let goodsListHot = res.data.records
+        this.setData({
+          goodsListHot: goodsListHot
+        })
+      })
+  },
+  goodsPage(e) {
+    app.api.goodsPage(this.data.page)
+      .then(res => {
+        let goodsList = res.data.records
+        this.setData({
+          goodsList: [...this.data.goodsList, ...goodsList]
+        })
+        if (goodsList.length < this.data.page.size) {
+          this.setData({
+            loadmore: false
+          })
+        }
+      })
+  },
+  refresh(){
+    this.setData({
+      loadmore: true,
+      ['page.current']: 1,
+      goodsList: [],
+      goodsListNew: [],
+      goodsListHot: []
+    })
+    this.loadData()
+  },
+  onPullDownRefresh(){
+    // 显示顶部刷新图标
+    wx.showNavigationBarLoading()
+    this.refresh()
+    // 隐藏导航栏加载框
+    wx.hideNavigationBarLoading()
+    // 停止下拉动作
+    wx.stopPullDownRefresh()
+  },
+  onReachBottom() {
+    if (this.data.loadmore) {
+      this.setData({
+        ['page.current']: this.data.page.current + 1
+      })
+      this.goodsPage()
+    }
+  },
+  jumpPage(e){
+    let page = e.currentTarget.dataset.page
+    if (page){
+      wx.navigateTo({
+        url: page
+      })
+    }
+  }
+})

+ 8 - 0
joolun-wx-ma/pages/home/index.json

@@ -0,0 +1,8 @@
+{
+  "navigationBarTitleText": "商城首页",
+  "enablePullDownRefresh": true,
+  "usingComponents": {
+    "goods-card": "/components/goods-card-index/index",
+    "goods-row": "/components/goods-row/index"
+  }
+}

+ 113 - 0
joolun-wx-ma/pages/home/index.wxml

@@ -0,0 +1,113 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="cu-bar search bg-white fixed" style="box-shadow:none">
+  <view class="search-form">
+    <text class="cuIcon-search"></text>
+    <navigator class="response" hover-class='none' url='/pages/base/search/index'>
+      <input type="text" placeholder="请输入商品名"></input>
+    </navigator>
+  </view>
+</view>
+<view class="margin-top-bar bg-white">
+<navigator hover-class="none" url='/pages/goods/goods-detail/index?id=1442505794278191105'>
+  <swiper class="screen-swiper square-dot" indicator-dots="true" circular="true" autoplay="true" interval="5000" duration="500" bindchange="change" indicator-color="#cccccc" indicator-active-color="#676767">
+    <swiper-item wx:for="{{swiperData}}" wx:key="index" class="margin-top-sm">
+      <image class="swiper-image" src="{{item}}"></image>
+    </swiper-item>
+  </swiper>
+</navigator>
+<view class="cu-list grid no-border justify-around">
+  <navigator class="cu-item" hover-class="none" url='/pages/goods/goods-detail/index?id=1442505794278191105'>
+    <image class="nav-image" src="/public/img/6-1.png"></image>
+		<text class="text-black">iPhone</text>
+  </navigator>
+  <navigator class="cu-item" hover-class="none" url='/pages/goods/goods-detail/index?id=1442512382615416833'>
+    <image class="nav-image" src="/public/img/6-2.png"></image>
+		<text class="text-black">iPad</text>
+  </navigator>
+  <navigator class="cu-item" hover-class="none" url='/pages/goods/goods-detail/index?id=1442512958581436418'>
+    <image class="nav-image" src="/public/img/6-3.png"></image>
+		<text class="text-black">Mac</text>
+  </navigator>
+  <navigator class="cu-item" hover-class="none" url='/pages/goods/goods-detail/index?id=1442513594978988034'>
+    <image class="nav-image" src="/public/img/6-4.png"></image>
+		<text class="text-black">Watch</text>
+  </navigator>
+  <navigator class="cu-item" hover-class="none" url='/pages/goods/goods-detail/index?id=1442514202062548994'>
+    <image class="nav-image" src="/public/img/6-5.png"></image>
+		<text class="text-black">AirPods</text>
+  </navigator>
+</view>
+<!-- 公告 -->
+<view class="adsec light bg-white margin-top-sm">
+  <swiper class="swiper_container" autoplay="true" circular="true" interval="6000">
+    <swiper-item>
+      <view class="bg-white padding-left-sm text-black">
+        <text class="cu-tag line-black text-bold">公告</text>
+        <text class="details margin-left">再见2020,你好2021!</text>
+      </view>
+    </swiper-item>
+    <swiper-item >
+      <view class="bg-white padding-left-sm text-black">
+        <text class="cu-tag line-black text-bold">注意</text>
+        <text class="details margin-left">演示商城,不发货不退款</text>
+      </view>
+    </swiper-item>
+  </swiper>
+</view>
+
+<navigator hover-class="none" url='/pages/goods/goods-detail/index?id=1442505794278191105'>
+  <image class="margin-top-sm goods-image" src="https://joolun-base-test.oss-cn-zhangjiakou.aliyuncs.com/1/material/055f3304-13d1-43c8-8547-326cc3efc7fc.jpg"></image>
+  <view class="flex justify-between margin-top-sm align-center padding-lr">
+    <view class="text-black">RMB 7999 起</view>
+    <view class="cu-btn round bg-gray text-white buy-now">购买</view>
+  </view>
+</navigator>
+<navigator hover-class="none" url='/pages/goods/goods-detail/index?id=1442512050032275457'>
+  <image class="margin-top-xl goods-image" src="https://joolun-base-test.oss-cn-zhangjiakou.aliyuncs.com/1/material/2f290591-8351-4be8-a9ab-6277d007b8c7.jpg"></image>
+  <view class="flex justify-between margin-top-sm align-center padding-lr padding-bottom">
+    <view class="text-black">RMB 3799 起</view>
+    <view class="cu-btn round bg-gray text-white buy-now">购买</view>
+  </view>
+</navigator>
+<!--<ad unit-id="{{config.adBannerID}}" wx:if="{{config.adEnable}}"></ad>-->
+  <view class='wrapper bg-white margin-top-xl'>
+    <view class="cu-bar text-black">
+      <view class='action margin-left-sm'>
+        <text class="text-xxl text-bold">热销单品</text>
+      </view>
+      <navigator hover-class="none" url='/pages/goods/goods-list/index?type=2' class='action'>
+        更多<text class='cuIcon-right'></text>
+      </navigator>
+    </view>
+    <view class='wrapper-list bg-white radius'>
+      <scroll-view class="scroll-view_x hot-goods" scroll-x>
+        <block wx:for="{{goodsListHot}}" wx:key="index">
+          <navigator hover-class="none" url='/pages/goods/goods-detail/index?id={{item.id}}' class='item'>
+            <view class='text-cut text-bold text-xxl text-black margin-top-sm'>{{item.name}}</view>
+            <view class='text-cut text-sm text-gray margin-top-sm'>{{item.sellPoint}}</view>
+            <view class='img-box margin-top-xl'>
+              <image src="{{item.picUrls[0] ? item.picUrls[0] : '/public/img/no_pic.png'}}"></image>
+            </view>
+            <view class="flex justify-between margin-top">
+              <view class="text-df padding-top-sm"><text class="text-price">{{item.salesPrice}}</text> 起</view>
+              <view class="cu-btn round shadow-blur text-white buy-now">购买</view>
+            </view>
+          </navigator>
+        </block>  
+      </scroll-view>
+    </view>
+  </view>
+  <view class="cu-bar">
+      <view class='action'>
+        <text class="text-xxl text-bold text-black">猜你喜欢</text> 
+      </view>
+    </view>
+  <goods-card goodsList="{{goodsList}}"/>
+  <view class="cu-load bg-white {{loadmore?'loading':'over'}}"></view>
+</view>
+<ad unit-id="{{config.adBannerID}}" wx:if="{{config.adEnable}}"></ad>

+ 89 - 0
joolun-wx-ma/pages/home/index.wxss

@@ -0,0 +1,89 @@
+.wrapper-list{
+  white-space:nowrap;padding:0rpx 0rpx 50rpx 0rpx;
+}
+
+.wrapper-list .item{
+  display:inline-block;
+  width: 560rpx;
+  height:800rpx;
+  margin: 60rpx 0 60rpx 50rpx;
+  padding: 10rpx 30rpx;
+  border-radius:25rpx;
+	box-shadow: 0rpx 0rpx 60rpx rgba(211, 211, 211, 1);
+}
+
+.wrapper-list .item:nth-last-child(1){
+  margin-right:20rpx;
+}
+
+.wrapper-list .item .img-box{
+  width:100%;
+  height:480rpx;
+}
+
+.wrapper-list .item .img-box image{
+  width:100%;
+  height:100%;
+}
+
+.adsec{
+  width: 100%;
+  display: flex;
+  flex-direction: row;
+  flex-wrap: nowrap;
+  align-items: center;
+  padding: 7rpx 10rpx;
+  height: 80rpx;
+}
+
+.adsec-icon{
+  height: 80rpx;
+  line-height: 40rpx;
+}
+
+.search-form{
+  border-radius: 20rpx;
+}
+
+.swiper_container {
+  height: 80rpx;
+  width: 95%;
+  line-height: 80rpx;
+  line-height: 40rpx;
+}
+
+.screen-swiper{
+  height: 480rpx;
+}
+
+.swiper-image{
+  width: 96% !important;
+  height:350rpx !important;
+  margin:40rpx auto !important;
+  border-radius: 20rpx;
+  box-shadow: 0rpx 10rpx 60rpx rgba(211, 211, 211, 1);
+}
+
+.nav-image{
+  width:100rpx;
+  height:100rpx
+}
+
+.text-black{
+  color: #000 !important;
+}
+
+.goods-image{
+  width:100%;
+  height: 1150rpx;
+}
+
+.hot-goods{
+  width:auto;
+  overflow:hidden;
+}
+
+.buy-now{
+  color:#2967ff;
+  width:160rpx;
+}

+ 140 - 0
joolun-wx-ma/pages/order/order-confirm/index.js

@@ -0,0 +1,140 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Page({
+  data: {
+    orderConfirmData: [],
+    salesPrice: 0,
+    paymentPrice: 0,
+    freightPrice: 0,
+    userAddress: null,
+    orderSubParm: {
+      paymentType: '1',
+      deliveryWay: '1'
+    },
+    loading: false,
+    userInfo: null,
+    spuIds: [],
+  },
+  onShow() {
+    
+  },
+  onLoad: function () {
+    this.userAddressPage()
+    this.userInfoGet()
+    this.orderConfirmDo()
+  },
+  deliveryWayChange(e){
+    this.setData({
+      [`orderSubParm.deliveryWay`]: e.detail.value,
+      freightMap: null
+    })
+    this.orderConfirmDo()
+  },
+  orderConfirmDo(){
+    // 本地获取参数信息
+    let that = this
+    wx.getStorage({
+      key: 'param-orderConfirm',
+      success: function (res) {
+        let orderConfirmData = res.data
+        let salesPrice = 0 //订单金额
+        let freightPrice = 0 //运费
+        let spuIds = null
+        orderConfirmData.forEach((orderConfirm, index) => {
+          if (spuIds) {
+            spuIds = spuIds + ',' + orderConfirm.spuId
+          } else {
+            spuIds = orderConfirm.spuId
+          }
+          salesPrice = (Number(salesPrice) + orderConfirm.salesPrice * orderConfirm.quantity).toFixed(2)
+          orderConfirm.paymentPrice = (orderConfirm.salesPrice * orderConfirm.quantity).toFixed(2)
+          //计算运费
+          orderConfirm.freightPrice = 0
+          freightPrice = (Number(freightPrice) + Number(orderConfirm.freightPrice)).toFixed(2)
+        })
+        that.setData({
+          orderConfirmData: orderConfirmData,
+          salesPrice: salesPrice,
+          freightPrice: freightPrice,
+          paymentPrice: salesPrice,
+          spuIds: spuIds
+        })
+        
+      }
+    })
+  },
+  //计算运费
+  countFreight(orderConfirm, freightTemplat, quantity){
+    
+  },
+  //获取默认收货地址
+  userAddressPage() {
+    app.api.userAddressPage(
+      {
+        searchCount: false,
+        current: 1,
+        size: 1,
+        isDefault: '1'
+    })
+      .then(res => {
+        let records = res.data.records
+        if (records && records.length > 0){
+          this.setData({
+            userAddress: records[0]
+          })
+        }
+      })
+  },
+  //获取商城用户信息
+  userInfoGet() {
+    app.api.wxUserGet()
+      .then(res => {
+        this.setData({
+          userInfo: res.data
+        })
+      })
+  },
+  userMessageInput(e){
+    this.setData({
+      [`orderSubParm.userMessage`]: e.detail.value
+    })
+  },
+  //提交订单
+  orderSub(){
+    let that = this
+    let userAddress = that.data.userAddress
+    if (that.data.orderSubParm.deliveryWay == '1' && userAddress == null){
+      wx.showToast({
+        title: '请选择收货地址',
+        icon: 'none',
+        duration: 2000
+      })
+      return
+    }
+    that.setData({
+      loading: true
+    })
+    let orderSubParm = that.data.orderSubParm
+    orderSubParm.skus = that.data.orderConfirmData
+    app.api.orderSub(Object.assign(
+      {},
+      { userAddressId: that.data.orderSubParm.deliveryWay == '1' ? userAddress.id : null},
+      orderSubParm
+    ))
+      .then(res => {
+        wx.redirectTo({
+          url: '/pages/order/order-detail/index?callPay=true&id=' + res.data.id
+        })
+      }).catch(() => {
+        that.setData({
+          loading: false
+        })
+      })
+  }
+})

+ 7 - 0
joolun-wx-ma/pages/order/order-confirm/index.json

@@ -0,0 +1,7 @@
+{
+  "navigationBarTitleText": "确认订单",
+  "usingComponents": {
+    "user-auth": "/components/user-auth/index",
+    "coupon-user-info": "/components/coupon-user-info/index"
+  }
+}

+ 85 - 0
joolun-wx-ma/pages/order/order-confirm/index.wxml

@@ -0,0 +1,85 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<wxs module="numberUtil" src="../../../utils/numberUtil.wxs"></wxs>
+<view class="margin-bottom-bar">
+  <view class="cu-list menu-avatar">
+    <navigator class="cu-item" url='/pages/user/user-address/list/index?select=true' wx:if="{{orderSubParm.deliveryWay == '1'}}">
+      <view class="cu-avatar round cuIcon-location bg-black"></view>
+      <view class="content loc-content" wx:if="{{userAddress}}">
+        <view class="flex padding-top-sm">
+          <view class="cu-tag bg-red radius margin-right-sm" wx:if="{{userAddress.isDefault == '1'}}">默认</view>
+          <view class="text-black">{{userAddress.userName}}</view>
+          <view class="text-gray text-sm margin-left-sm">{{userAddress.telNum}}</view>
+        </view>
+        <view class="text-gray text-sm overflow-2 loc-info padding-bottom-sm address">
+						{{userAddress.provinceName}}{{userAddress.cityName}}{{ituserAddressem.countyName}}{{userAddress.detailInfo}}
+        </view>
+      </view>
+      <view class="content loc-content" wx:if="{{!userAddress}}">
+        请选择收货地址
+      </view>
+      <view class="action">
+        <text class="cuIcon-right"></text>
+      </view>
+    </navigator>
+  </view>
+  <view class="cu-card article">
+    <view class="cu-item">
+      <view class="cu-list menu">
+        <view wx:for="{{ orderConfirmData }}" wx:key="index">
+            <view class="flex align-center">
+              <image src="{{item.picUrl ? item.picUrl : '/public/img/no_pic.png'}}" mode="aspectFill" class="row-img margin-top-xs"></image>
+             </view> 
+              <view class="row-info margin-left">
+                <view class="text-black margin-top-xl overflow-2">{{item.spuName}}</view>
+                <view class="text-gray text-sm margin-top-xs cu-tag round" wx:if="{{item.specInfo}}">{{item.specInfo}}</view>
+                <view class="flex margin-top-sm">
+                  <view class="flex-sub">
+                    <text class="text-price text-xl text-blue text-bold margin-top-sm">{{item.salesPrice}}</text>
+                  </view>
+                  <view class="flex-twice text-gray text-sm text-right margin-right">
+                    x{{item.quantity}}
+                  </view>
+                </view>
+              </view>
+        </view>
+        <view class="cu-item margin-top-sm">
+          <text class="text-gray text-sm">订单金额</text>
+          <view class="action">
+            <view class="text-price">{{salesPrice}}</view>
+          </view>
+        </view>
+        <view class="cu-item margin-top-sm">
+          <text class="text-gray text-sm">运费金额</text>
+          <view class="action">
+            <view class="text-price">{{freightPrice}}</view>
+          </view>
+        </view>
+        
+      </view>
+    </view>
+  </view>
+  <view class="cu-card mar-top-30">
+    <view class="cu-item cu-form-group align-start" style="height:200rpx;">
+      <input style="font-size:24rpx; margin-top:20rpx;" bindinput="userMessageInput" placeholder="给卖家留言"></input>
+    </view>
+	</view>
+</view>
+<view class="cu-bar tabbar bg-white border foot">
+  <view class="flex response">
+    <view class="flex-sub"></view>
+    <view class="flex-treble bar-rt">
+      <text class="text-sm text-gray">共{{ orderConfirmData.length }}件,</text>
+      <text class="text-sm text-gray">合计:</text>
+      <text class="text-xl text-price text-blue text-bold">{{numberUtil.numberAddition(paymentPrice,freightPrice)}}</text>
+      <button class="cu-btn shadow-blur margin-left-sm" style="background-color: #2967ff;font-weight:300;width:220rpx;" bindtap="orderSub" loading="{{loading}}" disabled="{{loading}}" type="">
+        <text class="text-white">提交订单</text>
+      </button>
+    </view>
+  </view>
+</view>
+<user-auth/>

+ 37 - 0
joolun-wx-ma/pages/order/order-confirm/index.wxss

@@ -0,0 +1,37 @@
+.bar-rt{
+  text-align: right!important;
+  margin-right: 10rpx!important
+}
+.row-img{
+  width: 600rpx!important;
+  height: 600rpx!important;
+  margin:0 auto;
+  border-radius: 10rpx;
+}
+.row-info{
+  display: block!important;
+}
+.loc-content{
+  width: calc(100% - 96rpx - 60rpx - 80rpx)!important;
+  left: 126rpx!important
+}
+.loc-info{
+  line-height: 1.4em
+}
+.list-item {
+  display: block !important;
+  padding: 6rpx !important;
+}
+.cu-list.menu>.cu-item:after {
+  border-bottom: unset !important
+}
+.cu-list.menu>.cu-item {
+  min-height: unset !important
+}
+.delivery-way{
+  justify-content: unset !important
+}
+.address{
+  line-height:160%;
+  font-weight:300;
+}

+ 70 - 0
joolun-wx-ma/pages/order/order-detail/index.js

@@ -0,0 +1,70 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Page({
+  data: {
+    orderInfo: null,
+    id: null,
+    callPay: false//是否直接调起支付
+  },
+  onShow() {
+    app.initPage()
+      .then(res => {
+        this.orderGet(this.data.id)
+      })
+  },
+  onLoad(options) {
+    this.setData({
+      id: options.id
+    })
+    if (options.callPay){
+      this.setData({
+        callPay: true
+      })
+    }
+  },
+  orderGet(id){
+    let that = this
+    app.api.orderGet(id)
+      .then(res => {
+        let orderInfo = res.data
+        if (!orderInfo){
+          wx.redirectTo({
+            url: '/pages/order/order-list/index'
+          })
+        }
+        this.setData({
+          orderInfo: orderInfo
+        })
+        setTimeout(function () {
+          that.setData({
+            callPay: false
+          })
+        }, 4000)
+      })
+  },
+  //复制内容
+  copyData(e) {
+    wx.setClipboardData({
+      data: e.currentTarget.dataset.data
+    })
+  },
+  orderCancel(){
+    let id = this.data.orderInfo.id
+    this.orderGet(id)
+  },
+  orderDel(){
+    wx.navigateBack()
+  },
+  unifiedOrder() {
+    this.onShow()
+  },
+  countDownDone(){
+    this.orderGet(this.data.id)
+  }
+})

+ 7 - 0
joolun-wx-ma/pages/order/order-detail/index.json

@@ -0,0 +1,7 @@
+{
+  "navigationBarTitleText": "订单详情",
+  "usingComponents": {
+    "order-operate": "/components/order-operate/index",
+    "count-down": "/components/count-down/index"
+  }
+}

+ 156 - 0
joolun-wx-ma/pages/order/order-detail/index.wxml

@@ -0,0 +1,156 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="margin-bottom-bar">
+  <view class="bg-white padding">
+    <view class="status-desc text-red margin-left text-bold text-center cuIcon-{{orderInfo.status == '0' ? 'pay' : orderInfo.status == '1' ? 'send' : orderInfo.status == '2' ? 'deliver' : orderInfo.status == '3' ? 'evaluate' : orderInfo.status == '4' ? 'upstage' : orderInfo.status == '5' ? 'roundclose' : ''}}">
+      {{orderInfo.statusDesc}}
+    </view>
+    <view class="text-black margin-left text-center" wx:if="{{orderInfo.isPay == '0' && !orderInfo.status}}">
+      请在<count-down outTime="{{1000 * orderInfo.outTime}}" bind:countDownDone="countDownDone"/>内付款,超时订单将自动取消
+    </view>
+    <view class="text-black margin-left text-center" wx:if="{{orderInfo.status == '2'}}">
+      还剩<count-down outTime="{{1000 * orderInfo.outTime}}" bind:countDownDone="countDownDone"/>自动确认
+    </view>
+  </view>
+  <view class="cu-list cu-card menu-avatar">
+    <navigator class="cu-item" url='/pages/order/order-logistics/index?id={{orderInfo.orderLogistics.id}}' wx:if="{{orderInfo.deliveryWay == '1' && (orderInfo.status == '2' || orderInfo.status == '3' || orderInfo.status == '4')}}">
+      <view class="cu-avatar round cuIcon-deliver bg-red"></view>
+      <view class="content loc-content">
+        <view class="flex">
+          <view class="text-black">{{orderInfo.orderLogistics.statusDesc}}</view>
+          <view class="text-sm margin-left-sm">{{orderInfo.orderLogistics.logisticsDesc}}</view>
+        </view>
+        <view class="text-black text-sm overflow-2 loc-info" wx:if="{{orderInfo.orderLogistics.message}}">
+					{{orderInfo.orderLogistics.message}}
+        </view>
+      </view>
+      <view class="action">
+        <text class="cuIcon-right"></text>
+      </view>
+    </navigator>
+    <view class="cu-item">
+      <view class="cu-avatar round cuIcon-location bg-black"></view>
+      <view class="content loc-content">
+        <view class="flex">
+          <view class="text-black">{{orderInfo.orderLogistics.userName}}</view>
+          <view class="text-gray text-sm margin-left-sm">{{orderInfo.orderLogistics.telNum}}</view>
+        </view>
+        <view class="text-gray text-sm overflow-2 loc-info">
+					{{orderInfo.orderLogistics.address}}
+        </view>
+      </view>
+    </view>
+  </view>
+  <view class="cu-card article mar-top-30">
+    <view class="cu-item">
+      <view class="cu-list menu">
+        <view wx:for="{{ orderInfo.listOrderItem }}" wx:key="index">
+          <navigator hover-class='none' url='/pages/goods/goods-detail/index?id={{item.spuId}}' class="cu-item">
+            <view class="align-center">
+              <view class="flex align-center">
+                <image src="{{item.picUrl ? item.picUrl : '/public/img/no_pic.png'}}" mode="aspectFill" class="row-img margin-top-xs"></image>
+              </view>
+                <view class="desc row-info">
+                  <view class="text-black margin-left margin-top-sm overflow-2">{{item.spuName}}</view>
+                  <view class="text-gray text-sm margin-top-sm overflow-2" wx:if="{{item.specInfo}}">{{item.specInfo}}</view>
+                  <view class="flex justify-between">
+                    <view class="text-bold text-gray margin-top-sm margin-left-xs padding-lr-sm font-weight">数量</view>
+                    <view class="text-black text-sm margin-top-sm margin-right-xs padding-lr-sm">x{{item.quantity}}</view>
+                  </view>
+                </view>
+            </view>
+          </navigator>
+        </view>
+        <view class="cu-item margin-top-xs">
+            <text class="text-gray font-weight">订单金额</text>
+          <view class="action">
+            <text class="text-price">{{orderInfo.salesPrice}}</text>
+          </view>
+        </view>
+        <view class="cu-item margin-top-xs">
+            <text class="text-gray font-weight">运费金额</text>
+          <view class="action">
+            + <text class="text-price">{{orderInfo.freightPrice}}</text>
+          </view>
+        </view>
+        <view class="cu-item margin-top-xs">
+            <text class="text-gray font-weight">支付金额</text>
+          <view class="action">
+            <text class="text-price text-xl text-blue text-bold">{{orderInfo.paymentPrice}}</text>
+          </view>
+        </view>
+      </view>
+    </view>
+  </view>
+  <view class="cu-card mar-top-30">
+    <view class="cu-item">
+      <view class="cu-bar bg-white">
+        <view class="action">
+          <text class="cuIcon-titles text-black"></text>订单信息
+        </view>
+      </view>
+      <view class="margin flex">
+        <text class="flex-sub text-gray font-weight">订单编号</text>
+        <view class="action">{{orderInfo.orderNo}}
+          <button class="cu-btn sm" bindtap="copyData" data-data="{{orderInfo.orderNo}}">复制</button>
+        </view>
+      </view>
+      <view class="margin flex">
+        <text class="flex-sub text-gray font-weight">创建时间</text>
+        <view class="action">{{orderInfo.createTime}}</view>
+      </view>
+      <view class="margin flex" wx:if="{{orderInfo.paymentTime}}">
+        <text class="flex-sub text-gray font-weight">付款时间</text>
+        <view class="action">{{orderInfo.paymentTime}}</view>
+      </view>
+    </view>
+  </view>
+  
+  <view class="cu-card mar-top-30" wx:if="{{orderInfo.orderLogistics.logisticsDesc}}">
+    <view class="cu-item">
+      <view class="cu-bar bg-white">
+        <view class="action">
+          <text class="cuIcon-titles text-orange "></text> 物流信息
+        </view>
+      </view>
+      <view class="margin flex">
+        <text class="flex-sub">快递公司</text>
+        <view class="flex-twice">
+          {{orderInfo.orderLogistics.logisticsDesc}}
+        </view>
+      </view>
+      <view class="margin flex">
+        <text class="flex-sub">快递单号</text>
+        <view class="flex-twice">
+          {{orderInfo.orderLogistics.logisticsNo}}
+          <button class="cu-btn sm" bindtap="copyData" data-data="{{orderInfo.orderLogistics.logisticsNo}}">复制</button>
+        </view>
+      </view>
+    </view>
+  </view>
+  
+  <view class="cu-card mar-top-30" wx:if="{{orderInfo.userMessage}}">
+    <view class="cu-item cu-form-group align-start">
+      <view class="title">给卖家留言</view>
+      <textarea readonly value="{{orderInfo.userMessage}}"></textarea>
+    </view>
+	</view>
+  <view style="padding-bottom: 60px;">
+	</view>
+</view>
+<view class="cu-bar tabbar bg-white border foot">
+  <order-operate
+    class="response"
+    orderInfo="{{orderInfo}}"
+    callPay="{{callPay}}"
+    contact="true"
+    bind:orderCancel="orderCancel"
+    bind:orderReceive="orderCancel"
+    bind:orderDel="orderDel"
+    bind:unifiedOrder="unifiedOrder"
+  />
+</view>

+ 28 - 0
joolun-wx-ma/pages/order/order-detail/index.wxss

@@ -0,0 +1,28 @@
+.row-img{
+  width: 600rpx!important;
+  height: 600rpx!important;
+  margin: auto !important;
+  border-radius: 10rpx
+}
+.row-info{
+  display: block!important;
+}
+.loc-content{
+  width: calc(100% - 96rpx - 60rpx - 80rpx)!important;
+  left: 126rpx!important
+}
+.loc-info{
+  line-height: 1.4em
+}
+.cu-list.menu>.cu-item:after {
+  border-bottom: unset !important;
+}
+.cu-list.menu>.cu-item {
+  min-height: unset !important;
+}
+.status-desc{
+  font-size: 38rpx!important;
+}
+.font-weight{
+  font-weight: 300;
+}

+ 147 - 0
joolun-wx-ma/pages/order/order-list/index.js

@@ -0,0 +1,147 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const util = require('../../../utils/util.js')
+const app = getApp()
+
+Page({
+  data: {
+    tabCur: 0,
+    orderStatus: [
+      {
+        value: '全部订单',
+        key: ''
+      },
+      {
+        value: '待付款',
+        key: '0'
+      }, {
+        value: '待发货',
+        key: '1'
+      }, {
+        value: '待收货',
+        key: '2'
+      }, {
+        value: '已完成',
+        key: '4'
+      }
+    ],
+    page: {
+      searchCount: false,
+      current: 1,
+      size: 10,
+      ascs: '',//升序字段
+      descs: 'create_time'
+    },
+    parameter: {},
+    loadmore: true,
+    orderList: []
+  },
+  onShow() {
+    
+  },
+  onLoad: function (options) {
+    let that = this
+    if (options.status) {
+      this.setData({
+        ['parameter.status']: options.status
+      })
+      this.data.orderStatus.forEach(function (status, index) {
+        if (status.key == options.status){
+          that.setData({
+            tabCur: index
+          })
+        }
+      })
+    }
+    app.initPage()
+      .then(res => {
+        this.orderPage()
+      })
+  },
+  orderPage() {
+    app.api.orderPage(Object.assign(
+      {},
+      this.data.page,
+      util.filterForm(this.data.parameter)
+    ))
+      .then(res => {
+        let orderList = res.data.records
+        this.setData({
+          orderList: [...this.data.orderList, ...orderList]
+        })
+        if (orderList.length < this.data.page.size) {
+          this.setData({
+            loadmore: false
+          })
+        }
+      })
+  },
+  onReachBottom() {
+    if (this.data.loadmore) {
+      this.setData({
+        ['page.current']: this.data.page.current + 1
+      })
+      this.orderPage()
+    }
+  },
+  refresh(){
+    this.setData({
+      loadmore: true,
+      orderList: [],
+      ['page.current']: 1
+    })
+    this.orderPage()
+  },
+  onPullDownRefresh() {
+    // 显示顶部刷新图标
+    wx.showNavigationBarLoading()
+    this.refresh()
+    // 隐藏导航栏加载框
+    wx.hideNavigationBarLoading()
+    // 停止下拉动作
+    wx.stopPullDownRefresh()
+  },
+  tabSelect(e) {
+    let dataset = e.currentTarget.dataset
+    if (dataset.index != this.data.tabCur){
+      this.setData({
+        tabCur: dataset.index,
+        ['parameter.status']: dataset.key
+      })
+      this.refresh()
+    }
+  },
+  orderCancel(e) {
+    let index = e.target.dataset.index
+    let orderList = this.data.orderList
+    app.api.orderGet(orderList[index].id)
+      .then(res => {
+        this.data.orderList[index] = res.data
+        this.setData({
+          orderList: this.data.orderList
+        })
+      })
+  },
+  orderDel(e) {
+    let index = e.target.dataset.index
+    this.data.orderList.splice(index, 1)
+    this.setData({
+      orderList: this.data.orderList
+    })
+  },
+  unifiedOrder(e) {
+    let index = e.target.dataset.index
+    let orderList = this.data.orderList
+    app.api.orderGet(orderList[index].id)
+      .then(res => {
+        this.data.orderList[index] = res.data
+        this.setData({
+          orderList: this.data.orderList
+        })
+      })
+  }
+})

+ 7 - 0
joolun-wx-ma/pages/order/order-list/index.json

@@ -0,0 +1,7 @@
+{
+  "navigationBarTitleText": "订单列表",
+  "enablePullDownRefresh": true,
+  "usingComponents": {
+    "order-operate": "/components/order-operate/index"
+  }
+}

+ 58 - 0
joolun-wx-ma/pages/order/order-list/index.wxml

@@ -0,0 +1,58 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<scroll-view scroll-x class="bg-white nav fixed">
+  <view class="flex text-center">
+    <view class="cu-item flex-sub {{index==tabCur?'text-blue cur':''}}" wx:for="{{orderStatus}}" wx:key="index" 
+    bindtap="tabSelect" data-index="{{index}}" data-key="{{item.key}}">
+      {{item.value}}
+    </view>
+  </view>
+</scroll-view>
+<view class="margin-top-bar">
+  <view class="cu-card article">
+    <view class="cu-item" wx:for="{{ orderList }}" wx:key="index" wx:for-index="index">
+      <navigator hover-class='none' url='/pages/order/order-detail/index?id={{item.id}}'>
+        <view class="cu-bar bg-white">
+          <view class="action">
+            <text class="cuIcon-titles text-black"></text> {{ item.createTime }}
+          </view>
+          <view class="action text-red">
+            {{item.statusDesc}}
+          </view>
+        </view>
+        <view class="cu-item padding-bottom" wx:for="{{ item.listOrderItem }}" wx:for-item="item2" wx:key="index" wx:for-index="index2">
+          <view class="content">
+            <image src="{{item2.picUrl ? item2.picUrl : '/public/img/no_pic.png'}}" mode="aspectFill" class="row-img margin-top-xs"></image>
+            <view class="desc row-info margin-top-sm">
+              <view class="text-black margin-top-sm overflow-2">{{item2.spuName}}</view>
+              <view class="text-gray text-sm margin-top-sm overflow-2" wx:if="{{item2.specInfo}}">{{item2.specInfo}}</view>
+              <view class="flex justify-between">
+                <view class="text-price text-bold text-xl text-blue margin-top-sm">{{item2.paymentPrice}}</view>
+                <view class="text-black text-sm margin-top-sm padding-lr-sm">x{{item2.quantity}}</view>
+              </view>
+            </view>
+          </view>
+          <view class="cu-item text-right padding-sm" catchtap wx:if="{{item2.status != '0'&&item2.statusDesc}}">
+            <navigator class="cu-btn line sm text-orange" 
+              url='/pages/order/order-refunds/form/index?orderItemId={{item2.id}}'>
+              {{item2.statusDesc}}
+            </navigator>
+          </view>
+        </view>
+      </navigator>
+      <order-operate
+        class="response"
+        orderInfo="{{item}}"
+        bind:orderCancel="orderCancel"
+        bind:orderReceive="orderCancel"
+        bind:orderDel="orderDel"
+        bind:unifiedOrder="unifiedOrder"
+        data-index="{{index}}"/>
+    </view>
+  </view>
+  <view class="cu-load bg-gray {{loadmore?'loading':'over'}}"></view>
+</view>

+ 7 - 0
joolun-wx-ma/pages/order/order-list/index.wxss

@@ -0,0 +1,7 @@
+.row-img{
+  height: 240rpx!important;
+  border-radius: 10rpx
+}
+.row-info{
+  display: block!important;
+}

+ 304 - 0
joolun-wx-ma/pages/shopping-cart/index.js

@@ -0,0 +1,304 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Page({
+  data: {
+    config: app.globalData.config,
+    page: {
+      current: 1,
+      size: 50,
+      ascs: '',//升序字段
+      descs: 'create_time'
+    },
+    parameter: {},
+    loadmore: true,
+    operation: true,
+    shoppingCartData: [],
+    shoppingCartDataInvalid: [],
+    isAllSelect: false,//全选
+    selectValue: [],
+    settlePrice: 0, //结算金额
+    goodsSpu: [],
+    shoppingCartSelect: []
+  },
+  onShow() {
+    //更新tabbar购物车数量
+    wx.setTabBarBadge({
+      index: 2,
+      text: app.globalData.shoppingCartCount + ''
+    })
+    app.initPage()
+      .then(res => {
+        this.shoppingCartPage()
+      })
+  },
+  onLoad: function () {
+    app.initPage()
+      .then(res => {
+        this.goodsRecom()
+      })
+  },
+  //管理按键事件
+  operation() {
+    this.setData({
+      operation: !this.data.operation
+    })
+    this.checkboxHandle(this.data.selectValue)
+  },
+  //加载数据
+  shoppingCartPage(){
+    app.api.shoppingCartPage(this.data.page)
+      .then(res => {
+        //更新购物车数量
+        app.globalData.shoppingCartCount = res.data.total + ''
+        wx.setTabBarBadge({
+          index: 2,
+          text: app.globalData.shoppingCartCount + ''
+        })
+
+        let shoppingCartData = []
+        //过滤出失效商品
+        let shoppingCartDataInvalid = []
+        res.data.records.forEach(function (shoppingCart, index) {
+          if (!shoppingCart.goodsSpu || shoppingCart.goodsSpu.shelf == '0'){//下架或删除了
+            shoppingCartDataInvalid.push(shoppingCart)
+          }else{
+            shoppingCartData.push(shoppingCart)
+          }
+        })
+        this.setData({
+          shoppingCartData: shoppingCartData,
+          shoppingCartDataInvalid: shoppingCartDataInvalid,
+          loadmore: false
+        })
+        let selectValue = this.data.selectValue
+        if (selectValue.length > 0) {
+          this.checkboxHandle(selectValue)
+        }
+      })
+  },
+  //推荐商品
+  goodsRecom() {
+    app.api.goodsPage({
+      searchCount: false,
+      current: 1,
+      size: 4,
+      descs: 'create_time'
+    })
+      .then(res => {
+        let goodsListRecom = res.data.records
+        this.setData({
+          goodsListRecom: goodsListRecom
+        })
+      })
+  },
+  //数量变化
+  cartNumChang(e) {
+    let index = e.target.dataset.index
+    let shoppingCart = this.data.shoppingCartData[index]
+    let quantity = Number(e.detail)
+    this.setData({
+      [`shoppingCartData[${index}].quantity`]: quantity
+    })
+    this.shoppingCartEdit({
+      id: shoppingCart.id,
+      quantity: quantity
+    })
+    this.countSelect()
+  },
+  shoppingCartEdit(parm){
+    app.api.shoppingCartEdit(parm)
+  },
+  //收藏
+  userCollectAdd(){
+    
+  },
+  shoppingCartDel(){
+    let selectValue = this.data.selectValue
+    let that = this
+    if (selectValue.length > 0){
+      wx.showModal({
+        content: '确认将这' + selectValue.length+'个宝贝删除',
+        cancelText: '我再想想',
+        confirmColor: '#ff0000',
+        success(res) {
+          if (res.confirm) {
+            app.api.shoppingCartDel(selectValue)
+              .then(res => {
+                that.setData({
+                  selectValue: [],
+                  isAllSelect: false,
+                  settlePrice: 0
+                })
+                that.shoppingCartPage()
+              })
+          }
+        }
+      })
+    }
+  },
+  clearInvalid(){
+    let selectValue = []
+    let that = this
+    this.data.shoppingCartDataInvalid.forEach(function (shoppingCart, index) {
+      selectValue.push(shoppingCart.id)
+    })
+    wx.showModal({
+      content: '确认清空失效的宝贝吗',
+      cancelText: '我再想想',
+      confirmColor: '#ff0000',
+      success(res) {
+        if (res.confirm) {
+          app.api.shoppingCartDel(selectValue)
+            .then(res => {
+              that.setData({
+                shoppingCartDataInvalid: []
+              })
+            })
+        }
+      }
+    })
+  },
+  checkboxHandle(selectValue){
+    let that = this
+    let shoppingCartData = this.data.shoppingCartData
+    let isAllSelect = false
+    if (shoppingCartData.length == selectValue.length) { isAllSelect = true }
+    if (selectValue.length > 0) {
+      let shoppingCartIds = []
+      shoppingCartData.forEach(function (shoppingCart, index) {
+        shoppingCartIds.push(shoppingCart.id)
+        let selectValueIndex = selectValue.indexOf(shoppingCart.id)
+        if (selectValueIndex > -1) {
+          if (!that.data.operation){
+            shoppingCart.checked = true
+          }else{//如果是购买操作,需过滤不符商品
+            if (shoppingCart.goodsSpu && shoppingCart.quantity <= shoppingCart.goodsSpu.stock) {
+              shoppingCart.checked = true
+            } else {
+              shoppingCart.checked = false
+              selectValue.splice(selectValueIndex, 1)
+            }
+          }
+        } else {
+          shoppingCart.checked = false
+        }
+      })
+      selectValue.forEach(function (obj, index) {
+        if (shoppingCartIds.indexOf(obj) <= -1) {
+          selectValue.splice(index, 1)
+        }
+      })
+    }else{
+      shoppingCartData.forEach(function (shoppingCart, index) {
+        shoppingCart.checked = false
+      })
+    }
+    this.setData({
+      shoppingCartData: shoppingCartData,
+      isAllSelect: isAllSelect,
+      selectValue: selectValue
+    })
+    this.countSelect()
+  },
+  checkboxChange: function (e) {
+    this.checkboxHandle(e.detail.value)
+  },
+  checkboxAllChange(e) {
+    var value = e.detail.value;
+    if (value.length > 0) { 
+      this.setAllSelectValue(true) 
+    }else { 
+      this.setAllSelectValue(false) 
+    }
+  },
+  setAllSelectValue(status) {
+    let shoppingCartData = this.data.shoppingCartData
+    let selectValue = []
+    let that = this
+    if (shoppingCartData.length > 0) {
+      if (status) {
+        shoppingCartData.forEach(function (shoppingCart, index) {
+          if (!that.data.operation) {
+            selectValue.push(shoppingCart.id)
+          } else {//如果是购买操作,需过滤不符商品
+            if (shoppingCart.goodsSpu
+              && shoppingCart.quantity <= shoppingCart.goodsSpu.stock) {
+              selectValue.push(shoppingCart.id)
+            }
+          } 
+        })
+      }
+      this.checkboxHandle(selectValue)
+    }
+  },
+  //计算结算值
+  countSelect() {
+    let selectValue = this.data.selectValue
+    let settlePrice = 0
+    if (selectValue.length <= 0) { 
+      this.setData({ 
+        settlePrice: settlePrice
+      }) 
+    }else {
+      this.data.shoppingCartData.forEach(function (shoppingCart, index) {
+        if (selectValue.indexOf(shoppingCart.id) > -1 
+            && shoppingCart.goodsSpu 
+          && shoppingCart.quantity <= shoppingCart.goodsSpu.stock) {
+          settlePrice = Number(settlePrice) + Number(shoppingCart.quantity) * Number(shoppingCart.goodsSpu.salesPrice)
+        }
+      })
+      this.setData({ 
+        settlePrice: settlePrice.toFixed(2) 
+      })
+    }
+  },
+  //更换规格
+  changeSpecs(e){
+   
+  },
+  goodsGet(id) {
+    app.api.goodsGet(id)
+      .then(res => {
+        let goodsSpu = res.data
+        this.setData({
+          goodsSpu: goodsSpu
+        })
+      })
+  },
+  operateCartEvent() {
+    this.shoppingCartPage()
+  },
+  //结算
+  orderConfirm(){
+    let params = []
+    let shoppingCartData = this.data.shoppingCartData
+    shoppingCartData.forEach(function (shoppingCart, index) {
+      if (shoppingCart.checked && shoppingCart.goodsSpu 
+        && shoppingCart.goodsSpu && shoppingCart.goodsSpu.shelf == '1'
+        && shoppingCart.quantity <= shoppingCart.goodsSpu.stock){
+        let param = {
+          spuId: shoppingCart.spuId,
+          quantity: shoppingCart.quantity,
+          salesPrice: shoppingCart.goodsSpu.salesPrice,
+          spuName: shoppingCart.goodsSpu.name,
+          picUrl: shoppingCart.goodsSpu.picUrls?shoppingCart.goodsSpu.picUrls[0]:''
+        }
+        params.push(param)
+      }
+    })
+    /* 把参数信息异步存储到缓存当中 */
+    wx.setStorage({
+      key: 'param-orderConfirm',
+      data: params
+    })
+    wx.navigateTo({
+      url: '/pages/order/order-confirm/index'
+    })
+  }
+})

+ 7 - 0
joolun-wx-ma/pages/shopping-cart/index.json

@@ -0,0 +1,7 @@
+{
+  "navigationBarTitleText": "购物车",
+  "usingComponents": {
+    "base-stepper": "/components/base-stepper/index",
+    "goods-card": "/components/goods-card/index"
+  }
+}

+ 131 - 0
joolun-wx-ma/pages/shopping-cart/index.wxml

@@ -0,0 +1,131 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<wxs module="numberUtil" src="../../utils/numberUtil.wxs"></wxs>
+<view class="cu-bar bg-white fixed" style="min-height: 80rpx;font-weight: 300;">
+  <view class="grid col-3 response text-center text-gray">
+    <view><text class="cuIcon-selection margin-right-xs"></text>100%正品保证</view>
+    <view><text class="cuIcon-discover margin-right-xs"></text>精挑细选</view>
+    <view><text class="cuIcon-squarecheck margin-right-xs"></text>售后无忧</view>
+  </view>
+</view>
+<view class="cu-bar bg-white solid-bottom solid-top fixed" style="margin-top:80rpx; min-height: 80rpx;box-shadow:none;">
+  <view class="action">
+    共{{ shoppingCartData.length }}件宝贝
+  </view>
+  <view class="action">
+    <button class="cu-btn line-gray sm" bindtap="operation">{{operation ? '管理' : '完成'}}</button>
+  </view>
+</view>
+<view class="bg-white" style="margin-top:160rpx;margin-bottom:100rpx;padding-top:40rpx;padding-bottom: 50px;">
+  <checkbox-group bindchange="checkboxChange">
+    <view class="cu-card article no-card solid-bottom">
+      <view class="cu-item padding-top-xs" wx:for="{{ shoppingCartData }}" wx:key="index">
+        <view class="flex align-center">
+          <checkbox class="blue round margin-left" value="{{item.id}}" disabled="{{(item.quantity > item.goodsSpu.stock || !item.goodsSpu) && operation}}" checked="{{item.checked}}"></checkbox>
+          <navigator hover-class='none' style="width:100%" url='/pages/goods/goods-detail/index?id={{item.spuId}}'>
+            <view class="content">
+              <image src="{{item.goodsSpu.picUrls[0] ? item.goodsSpu.picUrls[0] : '/public/img/no_pic.png'}}" mode="aspectFill" class="row-img margin-top-xs"></image>
+              <view class="desc row-info">
+                <view class="text-black margin-top-sm overflow-2">{{item.goodsSpu.name}}</view>
+                <view class="text-gray text-sm margin-top-xs cu-tag round" catchtap bindtap="changeSpecs" data-spuid="{{item.goodsSpu.id}}" data-index="{{index}}" wx:if="{{item.goodsSpu.specType == '1'}}">
+                  <text class="overflow-1"></text>
+                  <text class="cuIcon-unfold"></text>
+                </view>
+                <view class="text-{{item.quantity > item.goodsSpu.stock ? 'red' : 'gray'}} margin-top-sm text-right text-sm">库存{{item.goodsSpu.stock}}</view>
+                <view wx:if="{{item.goodsSpu}}">
+                  <view class="text-red margin-top-sm" wx:if="{{(item.addPrice-item.goodsSpu.salesPrice) > 0}}">
+                    比加入时降
+                    <view class="text-price display-ib">{{numberUtil.numberFormat(item.addPrice-item.goodsSpu.salesPrice,2)}}</view>
+                  </view>
+                  <view class="flex">
+                    <view class="flex-sub">
+                      <view class="text-price text-bold text-blue text-xl margin-top-sm">{{item.goodsSpu.salesPrice}}</view>
+                    </view>
+                    <view class="flex-sub margin-top-sm" catchtap>
+                      <base-stepper
+                        stNum="{{item.quantity}}"
+                        min="1"
+                        max="{{item.goodsSpu.stock}}"
+                        bind:numChange="cartNumChang"
+                        data-index="{{index}}"
+                      />
+                    </view>
+                  </view>
+                </view>
+                <view wx:if="{{!item.goodsSpu}}" class="margin-top-sm">
+                  <view class="text-red">请重新选择规格</view>
+                </view>
+              </view>
+            </view>
+          </navigator>
+        </view>
+      </view>
+    </view>
+  </checkbox-group>
+  <!-- 失效商品 -->
+  <view class="cu-bar bg-white solid-bottom margin-top" wx:if="{{shoppingCartDataInvalid.length > 0}}">
+    <view class="action">
+      失效宝贝{{ shoppingCartDataInvalid.length }}件
+    </view>
+    <view class="action">
+      <button class="cu-btn line-blue round" bindtap="clearInvalid">清空失效宝贝</button>
+    </view>
+  </view>
+  <view class="cu-card article no-card">
+      <view class="cu-item" wx:for="{{ shoppingCartDataInvalid }}" wx:key="index">
+        <view class="flex align-center">
+          <navigator hover-class='none' style="width:100%" url='/pages/goods/goods-detail/index?id={{item.spuId}}'>
+            <view class="content">
+              <image src="{{item.goodsSpu.picUrls[0] ? item.goodsSpu.picUrls[0] : '/public/img/no_pic.png'}}" mode="aspectFill" class="row-img margin-top-xs"></image>
+              <view class="desc row-info">
+                <view class="text-black margin-top-sm overflow-2">{{item.goodsSpu.name}}</view>
+                <view class="text-sm margin-top-lg text-blue">
+                  已下架
+                </view>
+              </view>
+            </view>
+          </navigator>
+        </view>
+      </view>
+  </view>
+  <view class="cu-load bg-gray {{loadmore?'loading':''}}"></view>
+  <view class="text-center margin-bottom" wx:if="{{ shoppingCartData.length <= 0 && !loadmore}}">
+    <view class="text-xsl margin-top without">
+			<image class="margin-top-sm" src="/public/img/shopping-cart.jpg"></image>
+		</view>
+    购物车空空如也~
+    <navigator hover-class='none' url='/pages/goods/goods-list/index'>
+      <button class="cu-btn bg-black margin-top">去逛逛</button>
+    </navigator>
+  </view>
+  <ad unit-id="{{config.adBannerID}}" wx:if="{{config.adEnable}}"></ad>
+  <view class="cu-bar justify-center bg-white margin-top-sm">
+    <view class='action text-blue text-bold'>
+      <text class='cuIcon-move'></text> <text class='cuIcon-appreciate'></text>为您推荐 <text class='cuIcon-move'></text>
+    </view>
+  </view>
+  <goods-card goodsList="{{goodsListRecom}}"/>
+</view>
+<view class="cu-bar bg-white tabbar border shop foot">
+  <view class="flex align-center">
+    <checkbox-group bindchange="checkboxAllChange">
+      <checkbox class="blue round margin-left" value="all" checked="{{isAllSelect}}"></checkbox>
+    </checkbox-group>
+    <view class="text-lg margin-left-xs">全选</view>
+  </view>
+  <view class="action bar-rt" wx:if="{{operation}}">
+    <text class="text-xs text-bold">合计:</text>
+    <text class="text-xl text-bold text-price text-blue margin-right-sm">{{settlePrice}}</text>
+    <button class="cu-btn shadow-blur margin-left-sm settle-bt" disabled="{{selectValue.length <= 0}}" type="" bindtap="orderConfirm">
+      <text class="text-white">结算{{selectValue.length > 0 ? '('+selectValue.length+')' : ''}}</text>
+    </button>
+  </view>
+  <view class="action bar-rt" wx:if="{{!operation}}">
+    <button class="cu-btn shadow-blur collection" disabled="{{selectValue.length <= 0}}" bindtap="userCollectAdd"><text class="text-white">移入收藏夹</text></button>
+    <button class="cu-btn shadow-blur margin-left-sm delete" disabled="{{selectValue.length <= 0}}" bindtap="shoppingCartDel"><text class="text-white">删除</text></button>
+  </view>
+</view>

+ 42 - 0
joolun-wx-ma/pages/shopping-cart/index.wxss

@@ -0,0 +1,42 @@
+.bar-rt{
+  width: 480rpx!important;
+  text-align: right!important;
+  margin-right: 10rpx!important
+}
+.settle-bt{
+  background-color: #2967ff !important;
+  font-weight:300;
+  width:220rpx;
+}
+.row-img{
+  width: 30%!important;
+  border-radius: 10rpx
+}
+.row-info{
+  display: block!important;
+  width: 60%;
+}
+.row-specs{
+  width: 200px;
+}
+.cu-tag {
+  white-space: unset!important
+}
+.without {
+  margin: auto;
+}
+.without image {
+  padding-top: 50rpx;
+  width: 360rpx;
+  height: 305rpx;
+}
+.collection{
+  background-color: #2d2d2f !important;
+  font-weight:300;
+  width:220rpx;
+}
+.delete{
+  background-color: #2967ff !important;
+  font-weight:300;
+  width:220rpx;
+}

+ 154 - 0
joolun-wx-ma/pages/user/user-address/form/index.js

@@ -0,0 +1,154 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Page({
+  data: {
+    region: [],
+    userAddress: []
+  },
+  onLoad(options) {
+    // 本地获取参数信息
+    let that = this
+    wx.getStorage({
+      key: 'param-userAddressForm',
+      success: function (res) {
+        let userAddress = res.data
+        that.setData({
+          [`region[0]`]: userAddress.provinceName ? userAddress.provinceName : '选择省',
+          [`region[1]`]: userAddress.cityName ? userAddress.cityName : '选择市',
+          [`region[2]`]: userAddress.countyName ? userAddress.countyName : '选择区',
+          userAddress: userAddress
+        })
+      }
+    })
+  },
+  regionChange(e) {
+    this.setData({
+      region: e.detail.value
+    })
+  },
+  isDefaultChange(e){
+    if(e.detail.value){
+      this.setData({
+        [`userAddress.isDefault`]: '1'
+      })
+    }else{
+      this.setData({
+        [`userAddress.isDefault`]: '0'
+      })
+    }
+  },
+  userAddressSave(e) {
+    let value = e.detail.value
+    let region = this.data.region
+    if (!value.userName){
+      wx.showToast({
+        title: '请填写收货人姓名',
+        icon: 'none',
+        duration: 3000
+      })
+      return
+    }
+    if (!value.telNum) {
+      wx.showToast({
+        title: '请填写联系电话',
+        icon: 'none',
+        duration: 3000
+      })
+      return
+    }
+    if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(value.telNum)) {
+      wx.showToast({
+        title: '请输入正确的手机号码',
+        icon: 'none',
+        duration: 3000
+      })
+      return
+    }
+    if (region[0] == '选择省') {
+      wx.showToast({
+        title: '请选择所在地区',
+        icon: 'none',
+        duration: 3000
+      })
+      return
+    }
+    if (!value.detailInfo) {
+      wx.showToast({
+        title: '请填写详细地址',
+        icon: 'none',
+        duration: 3000
+      })
+      return
+    }
+    app.api.userAddressSave({
+      id: this.data.userAddress.id,
+      userName: value.userName,
+      telNum: value.telNum,
+      provinceName: region[0],
+      cityName: region[1],
+      countyName: region[2],
+      detailInfo: value.detailInfo,
+      isDefault: this.data.userAddress.isDefault
+    })
+      .then(res => {
+        wx.navigateBack()
+      })
+  },
+  userAddressDelete(){
+    let that = this
+    wx.showModal({
+      content: '确认将这个地址删除吗?',
+      cancelText: '我再想想',
+      confirmColor: '#ff0000',
+      success(res) {
+        if (res.confirm) {
+          app.api.userAddressDel(that.data.userAddress.id)
+            .then(res => {
+              wx.navigateBack()
+            })
+        }
+      }
+    })
+  },
+  /*
+  * 导入微信地址
+  */
+  getWxAddress: function () {
+    let that = this
+    wx.authorize({
+      scope: 'scope.address',
+      success: function (res) {
+        wx.chooseAddress({
+          success: function (res) {
+            that.setData({
+              [`region[0]`]: res.provinceName,
+              [`region[1]`]: res.cityName,
+              [`region[2]`]: res.countyName,
+              [`userAddress.userName`]: res.userName,
+              [`userAddress.telNum`]: res.telNumber,
+              [`userAddress.detailInfo`]: res.detailInfo,
+            })
+          },
+          fail: function (res) {
+            if (res.errMsg == 'chooseAddress:cancel') {
+              wx.showToast({
+                title: '取消选择',
+                icon: 'none',
+                duration: 3000
+              })
+            }
+          },
+        })
+      },
+      fail: function (res) {
+        console.log(res);
+      },
+    })
+  },
+})

+ 3 - 0
joolun-wx-ma/pages/user/user-address/form/index.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "新增收货地址"
+}

+ 41 - 0
joolun-wx-ma/pages/user/user-address/form/index.wxml

@@ -0,0 +1,41 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<form bindsubmit="userAddressSave">
+  <view class="cu-form-group">
+		<view class="title">姓名</view>
+		<input placeholder="请输入姓名" name="userName" value="{{userAddress.userName}}"></input>
+	</view>
+  <view class="cu-form-group">
+		<view class="title">联系电话</view>
+		<input placeholder="请输入电话" name="telNum" value="{{userAddress.telNum}}"></input>
+	</view>
+  <view class="cu-form-group">
+		<view class="title">地址选择</view>
+		<picker mode="region" bindchange="regionChange" value="{{region}}" custom-item="{{customItem}}">
+			<view class="picker">
+				{{region[0]}},{{region[1]}},{{region[2]}}
+			</view>
+		</picker>
+	</view>
+  <view class="cu-form-group">
+		<view class="title">详细地址</view>
+		<input placeholder="请输入详细地址" name="detailInfo" value="{{userAddress.detailInfo}}"></input>
+	</view>
+  <view class="cu-form-group">
+		<view class="title">设为默认地址</view>
+		<switch class="red sm" checked="{{userAddress.isDefault == '1'}}" bindchange="isDefaultChange"></switch>
+	</view>
+  <button class="cu-btn block bg-green margin-sm" formType="submit">
+    立即保存
+  </button>
+  <button class="cu-btn block bg-red margin-sm" bindtap="userAddressDelete" wx:if="{{userAddress.id}}">
+    删除
+  </button>
+  <button class="cu-btn block bg-orange margin-sm cuIcon-weixin" bindtap="getWxAddress">
+    导入微信地址
+  </button>
+</form>

+ 0 - 0
joolun-wx-ma/pages/user/user-address/form/index.wxss


+ 80 - 0
joolun-wx-ma/pages/user/user-address/list/index.js

@@ -0,0 +1,80 @@
+/**
+ * Copyright (C) 2018-2019
+ * All rights reserved, Designed By www.joolun.com
+ * 注意:
+ * 本软件为www.joolun.com开发研制,项目使用请保留此说明
+ */
+const app = getApp()
+
+Page({
+  data: {
+    page: {
+      searchCount: false,
+      current: 1,
+      size: 10,
+      ascs: '',//升序字段
+      descs: ''
+    },
+    parameter: {},
+    loadmore: true,
+    userAddress: [],
+    select: false
+  },
+  onLoad(options) {
+    if (options.select){
+      this.setData({
+        select: true
+      })
+    }
+  },
+  onShow() {
+    app.initPage()
+      .then(res => {
+        this.userAddressPage()
+      })
+  },
+  userAddressPage() {
+    app.api.userAddressPage(this.data.page)
+      .then(res => {
+        let userAddress = res.data.records
+        this.setData({
+          userAddress: userAddress,
+          loadmore: false
+        })
+      })
+  },
+  toAdd(){
+    wx.setStorage({
+      key: 'param-userAddressForm',
+      data: []
+    })
+    wx.navigateTo({
+      url: '/pages/user/user-address/form/index'
+    })
+  },
+  toEdit(e){
+    let index = e.currentTarget.dataset.index
+    let userAddressForm = this.data.userAddress[index]
+    /* 把参数信息异步存储到缓存当中 */
+    wx.setStorage({
+      key: 'param-userAddressForm',
+      data: userAddressForm
+    })
+    wx.navigateTo({
+      url: '/pages/user/user-address/form/index'
+    })
+  },
+  selectUserAddress(e){
+    if (this.data.select){
+      let index = e.currentTarget.dataset.index
+      let userAddressForm = this.data.userAddress[index]
+      var pages = getCurrentPages(); // 获取页面栈
+      var currPage = pages[pages.length - 1]; // 当前页面
+      var prevPage = pages[pages.length - 2]; // 上一个页面
+      prevPage.setData({
+        userAddress: userAddressForm
+      })
+      wx.navigateBack()
+    }
+  }
+})

+ 3 - 0
joolun-wx-ma/pages/user/user-address/list/index.json

@@ -0,0 +1,3 @@
+{
+  "navigationBarTitleText": "收货地址"
+}

+ 31 - 0
joolun-wx-ma/pages/user/user-address/list/index.wxml

@@ -0,0 +1,31 @@
+<!--
+  - Copyright (C) 2018-2019
+  - All rights reserved, Designed By www.joolun.com
+  - 注意:
+  - 本软件为www.joolun.com开发研制,项目使用请保留此说明
+-->
+<view class="cu-list menu-avatar">
+  <view class="cu-item solid-top" wx:for="{{ userAddress }}" wx:key="index">
+    <view class="cu-avatar round bg-red">
+      <text class="avatar-text">{{item.userName}}</text>
+    </view>
+    <view class="content loc-content" bindtap="selectUserAddress" data-index="{{index}}">
+      <view class="flex">
+        <view class="text-black">{{item.userName}}</view>
+        <view class="text-gray text-sm margin-left-sm">{{item.telNum}}</view>
+      </view>
+      <view class="text-black text-sm overflow-2 loc-info">
+          <view class="cu-tag bg-orange sm margin-left-sm" wx:if="{{item.isDefault == '1'}}">默认</view>
+          {{item.provinceName}}{{item.cityName}}{{item.countyName}}{{item.detailInfo}}
+      </view>
+    </view>
+    <view class="action" bindtap="toEdit" data-index="{{index}}">
+      <text class="cuIcon-edit"></text>
+    </view>
+  </view>
+</view>
+<view class="cu-load bg-gray {{loadmore?'loading':''}}"></view>
+<view class="cu-load bg-gray margin-top-xl" wx:if="{{ userAddress.length <= 0 && !loadmore}}"><text class="text-gray">暂无收货地址,请添加</text></view>
+<button class="cu-btn block shadow-blur margin-sm" style="background-color: #2967ff;font-weight:300;height:88rpx; margin-top:200rpx;" wx:if="{{userAddress.length < 10}}" bindtap="toAdd">
+  <text class="text-white">添加新地址</text>
+</button>

+ 7 - 0
joolun-wx-ma/pages/user/user-address/list/index.wxss

@@ -0,0 +1,7 @@
+.loc-content{
+  width: calc(100% - 96rpx - 60rpx - 80rpx)!important;
+  left: 126rpx!important
+}
+.loc-info{
+  line-height: 1.4em
+}

+ 0 - 0
joolun-wx-ma/pages/user/user-center/index.js


Деякі файли не було показано, через те що забагато файлів було змінено