洪海涛 8 年之前
父节点
当前提交
f1b3665cf6

+ 4 - 0
www/vue/config/index.js

@@ -32,6 +32,10 @@ module.exports = {
         target: apiPath+'/index.php?r=', //你的目标域名
         changeOrigin: true
       },
+      '/api': {
+        target: apiPath+'/index.php?r=', //你的目标域名
+        changeOrigin: true
+      },
     },
     // CSS Sourcemaps off by default because relative paths are "buggy"
     // with this option, according to the CSS-Loader README

文件差异内容过多而无法显示
+ 0 - 0
www/vue/dist/static/css/app.css


文件差异内容过多而无法显示
+ 0 - 0
www/vue/dist/static/js/app.js


文件差异内容过多而无法显示
+ 0 - 0
www/vue/dist/static/js/vendor.js


+ 7 - 0
www/vue/src/components/address/addresList.vue

@@ -0,0 +1,7 @@
+<template>
+
+</template>
+<script>
+
+</script>
+<style scoped lang="less"></style>

+ 34 - 2
www/vue/src/components/address/addressAdd.vue

@@ -28,6 +28,8 @@
 <script>
   import {XInput, Group, Cell, Alert, TransferDomDirective as TransferDom} from 'vux'
   import config from '../../config/config'
+//  import axios from 'axios'
+//  import qs from 'qs'
   export default {
     name: 'home',
     data () {
@@ -83,7 +85,7 @@
           return
         }
         // 手机号码格式必须正确
-        if (!this.userMobile) {
+        if (!config.addressAdd.userMobile) {
           this.alertContent = '请输入正确手记号码'
           this.showAlert = true
           return
@@ -94,10 +96,40 @@
           this.showAlert = true
           return
         }
-        this.$router.go(-1)
+        console.log(config.addressPio)
+        config.addressDetail = {
+          'province': config.addressPio.city,
+          'city': config.addressPio.city,
+          'area': config.addressPio.city,
+          'detail': '',
+          'poi': {
+            'uid': config.addressPio.uid,
+            'name': config.addressPio.name
+          }
+        }
+//        let param = {
+//          request_from: 'weixin',
+//          name: this.userName,
+//          mobile: this.userMobile,
+//          user_id: config.userId,
+//          address_position: config.addressPio.location,
+//          address: addressDetail
+//        }
+//        getAddressAdd(param)
+//        axios.get('api/shop/addAddress&request_from=weixin&name=' + this.userName + '&mobile=' + config.addressAdd.userMobile + '&user_id=' + config.userId + '&address_position=' + JSON.stringify(config.addressPio.location) + '&address=' + JSON.stringify(addressDetail)).then(function (res) {
+//          if (res.data.data.success) {
+//            this.$router.go(-1)
+//          }
+//        })
+//        this.$router.go(-1)
       }
     }
   }
+//  function getAddressAdd (val) {
+//    axios.get('api/shop/addAddress' + qs.stringify(val)).then(function (res) {
+//      console.log(res)
+//    })
+//  }
 </script>
 
 <!-- 添加“scoped”属性来限制CSS到此组件 -->

+ 6 - 0
www/vue/src/config/api.js

@@ -95,5 +95,11 @@ export default ({
     }).catch(function (error) {
       console.log(error)
     })
+  },
+  // 新增地址
+  addressAdd: function (cb) {
+    axios.get('api/shop/addAddress&request_from=weixin&name=' + this.userName + '&mobile=' + config.addressAdd.userMobile + '&user_id=' + config.userId + '&address_position=' + JSON.stringify(config.addressPio.location) + '&address=' + JSON.stringify(config.addressDetail)).then(function (res) {
+      cb(res.data.data)
+    })
   }
 })

+ 3 - 1
www/vue/src/config/config.js

@@ -17,6 +17,7 @@ let addressAdd = {
   positionName: '请定位您的小区或者街道',
   userAddress: ''
 }
+let addressDetail = {}
 let addressPio = []
 if (uri.indexOf('common.yiguanjia.me') > -1) {
   test = false
@@ -51,5 +52,6 @@ export default {
   isActive: isActive,
   xNumberValue: xNumberValue,
   addressPio: addressPio,
-  addressAdd: addressAdd
+  addressAdd: addressAdd,
+  addressDetail: addressDetail
 }

+ 25 - 0
www/vue/src/store/addressAdd.js

@@ -0,0 +1,25 @@
+/**
+ * Created by north on 2017/6/12.
+ */
+import api from '../config/api'
+
+export default {
+  state: {
+    addressAdd: {}
+  },
+  mutations: {
+    // 注意,这里可以设置 state 属性,但是不能异步调用,异步操作写到 actions 中
+    ADDRESSADD (state, addressAdd) {
+      state.addressAdd = addressAdd
+    }
+  },
+  actions: {
+    ADDRESSADD ({commit}) {
+      // 获取详情,并调用 mutations 设置 detail
+      api.addressAdd(function (res) {
+        commit('ADDRESSADD', res.data.data)
+      })
+    }
+  }
+}
+

部分文件因为文件数量过多而无法显示