Quellcode durchsuchen

perf(client): 优化代码

yizhiyang vor 1 Jahr
Ursprung
Commit
a1ac2319ab

+ 9 - 0
src/PageMine/address/index.vue

@@ -39,6 +39,7 @@
 </template>
 
 <script>
+import ADDRESS_API from '@/api/client/address.js';
 export default {
   name: 'address',
   data() {
@@ -46,7 +47,15 @@ export default {
       value: '',
     };
   },
+  onShow() {
+    this.getAddressList();
+  },
   methods: {
+    getAddressList() {
+      ADDRESS_API.list().then(res => {
+        console.log(res, '地址');
+      });
+    },
     handleAddress() {
       uni.navigateTo({
         url: '/PageMine/address/editAddress',

+ 36 - 51
src/PageMine/feedback/index.vue

@@ -3,12 +3,18 @@
     <page-navbar :hasBack="true" bgColor="#fff" title="意见反馈"></page-navbar>
 
     <view class="feedback">
-      <u--form labelPosition="top" ref="uForm" labelWidth="auto">
+      <u--form
+        labelPosition="top"
+        ref="uForm"
+        labelWidth="auto"
+        :model="legalInfo"
+        :rules="rules"
+      >
         <base-card marginBottom="24rpx" padding="24rpx">
-          <u-form-item label="意见反馈" prop="userInfo.name" ref="item1">
+          <u-form-item label="意见反馈" prop="content" required>
             <u--textarea
-              v-model="model1.userInfo.name"
-              placeholder="请输入内容"
+              v-model="feedbackInfo.content"
+              placeholder="请输入反馈内容"
               count
               height="105"
               maxlength="200"
@@ -19,78 +25,57 @@
           </u-form-item>
         </base-card>
         <base-card>
-          <u-form-item label="联系方式" prop="userInfo.name" ref="item1">
-            <u--input placeholder="请输入内容" border="surround"></u--input>
+          <u-form-item label="联系方式" prop="phone">
+            <u--input
+              placeholder="请输入联系方式"
+              border="surround"
+              v-model="feedbackInfo.phone"
+            ></u--input>
           </u-form-item>
         </base-card>
       </u--form>
     </view>
     <view class="feedback-bottom">
-      <base-button text="提交"></base-button>
+      <base-button text="提交" @click="handlerSubmitFeedback"></base-button>
     </view>
   </view>
 </template>
 
 <script>
-import { getFeedback } from '@/api/client/mine.js';
+// import { getFeedback } from '@/api/client/mine.js';
+import FEEDBACK_API from '@/api/client/feedback.js';
 export default {
   data() {
     return {
-      model1: {
-        userInfo: {
-          name: '',
-          sex: '',
-        },
-      },
-      value1: '',
-      value: '',
-      queryParams: {
-        title: '',
+      feedbackInfo: {
         content: '',
-        type: 0,
         phone: '',
+        images: '',
         channel: 0,
       },
+      rules: {
+        content: {
+          type: 'string',
+          required: true,
+          message: '请输入反馈内容',
+          trigger: ['blur', 'change'],
+        },
+      },
     };
   },
   onLoad(options) {
     console.log(options);
-    this.queryParams.channel = options.channelType;
+  },
+  onReady() {
+    //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
+    this.$refs.uForm.setRules(this.rules);
   },
   methods: {
     // 提交反馈意见
     handlerSubmitFeedback() {
-      if (this.queryParams.title == '') {
-        uni.showToast({
-          title: '请输入标题',
-          icon: 'none',
-        });
-        return;
-      } else if (this.queryParams.content == '') {
-        uni.showToast({
-          title: '评论内容',
-          icon: 'none',
-        });
-        return;
-      } else {
-        getFeedback(this.queryParams).then(res => {
-          if (res.code === 'OK') {
-            uni.showToast({
-              title: '反馈成功',
-              icon: 'none',
-            });
-            setTimeout(() => {
-              uni.navigateBack(-1);
-            }, 1500);
-          } else {
-            uni.showToast({
-              title: res.msg,
-              icon: 'none',
-            });
-            return;
-          }
-        });
-      }
+      this.$refs.uForm.validate().then(res => {
+        console.log(res, '点击按钮');
+      });
     },
   },
 };

+ 60 - 0
src/api/client/address.js

@@ -0,0 +1,60 @@
+/* 用户常用地址接口 */
+
+import request from '@/utils/request';
+const basePath = '/maintain/userReceiveAddress/';
+
+const ADDRESS_API = {
+  /**
+   * 用户常用地址接口 - 查询用户常用地址列表
+   * @returns
+   */
+  list: () => {
+    return request({
+      url: basePath + 'list',
+      method: 'get',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+    });
+  },
+  /**
+   * 用户常用地址接口 - 新增用户常用地址
+   * @param {*} data
+   * @returns
+   */
+  add: data => {
+    return request({
+      url: basePath + 'save',
+      method: 'post',
+      data,
+    });
+  },
+  /**
+   * 用户常用地址接口 - 删除用户常用地址
+   * @param {*} id
+   * @returns
+   */
+  delete: id => {
+    return request({
+      url: basePath + `delete/${id}`,
+      method: 'put',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+    });
+  },
+
+  /**
+   * 用户常用地址接口 - 修改用户常用地址
+   * @param {*} id
+   * @returns
+   */
+  update: id => {
+    return request({
+      url: basePath + `update/${id}`,
+      method: 'put',
+    });
+  },
+};
+
+export default ADDRESS_API;

+ 12 - 12
src/api/client/business.js

@@ -20,7 +20,7 @@ export function getSellsDetail(id, data) {
   return request({
     url: `/maintain/merchant/${id}`,
     method: 'GET',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',
     },
@@ -31,7 +31,7 @@ export function getSellsDetail(id, data) {
  * 商品详情
  * @returns
  */
-export function getGoodsDetailApi(id,param) {
+export function getGoodsDetailApi(id, param) {
   return request({
     url: `/maintain/goods/${id}`,
     method: 'GET',
@@ -66,7 +66,7 @@ export function addReservation(merchantId, data) {
   return request({
     url: `/maintain/merchant/${merchantId}/reservation`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -101,7 +101,7 @@ export function changeGoodsType(merchantId, data) {
   return request({
     url: `/maintain/merchant/${merchantId}/goods`,
     method: 'get',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',
     },
@@ -143,7 +143,7 @@ export function addShoppingCart(data) {
   return request({
     url: `/maintain/cartItem`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -159,7 +159,7 @@ export function getShoppingCart(data) {
   return request({
     url: `/maintain/mineCartList`,
     method: 'get',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',
     },
@@ -205,7 +205,7 @@ export function editGoodsNumb(id, data) {
   return request({
     url: `/maintain/cartItem/${id}`,
     method: 'get',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',
     },
@@ -221,7 +221,7 @@ export function generateConfirmOrder(data) {
   return request({
     url: `/maintain/generateConfirmOrder`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -237,7 +237,7 @@ export function generateOrder(data) {
   return request({
     url: `/maintain/generateOrder`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -253,7 +253,7 @@ export function accountToOrderGetComment(data) {
   return request({
     url: `/maintain/assess/query`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -269,7 +269,7 @@ export function getGoodsConcentList(goodsId, data) {
   return request({
     url: `/maintain/goods/${goodsId}/comments`,
     method: 'get',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',
     },
@@ -285,7 +285,7 @@ export function goodsCommentsAdd(data) {
   return request({
     url: `/maintain/assess/add`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },

+ 3 - 3
src/api/client/community.js

@@ -8,7 +8,7 @@ export function clientContentList(data) {
   return request({
     url: '/maintain/client/content/page',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -20,7 +20,7 @@ export function addClientContent(data) {
   return request({
     url: `/maintain/client/content/add`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -32,7 +32,7 @@ export function addEvaulateRecords(data) {
   return request({
     url: `/maintain/client/evaluate-record/add`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },

+ 47 - 0
src/api/client/feedback.js

@@ -0,0 +1,47 @@
+/* 意见反馈接口 */
+
+import request from '@/utils/request';
+const basePath = '/maintain/feedback/';
+
+const FEEDBACK_API = {
+  /**
+   * 意见反馈接口 - 查询意见反馈
+   * @returns
+   */
+  list: data => {
+    return request({
+      url: basePath + 'query',
+      method: 'get',
+      data,
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+    });
+  },
+  /**
+   * 意见反馈接口 - 新增意见反馈
+   * @param {*} data
+   * @returns
+   */
+  add: data => {
+    return request({
+      url: '/maintain/feedback',
+      method: 'post',
+      data,
+    });
+  },
+
+  /**
+   * 意见反馈接口 - 修改意见反馈
+   * @param {*} id
+   * @returns
+   */
+  update: id => {
+    return request({
+      url: basePath + `${id}`,
+      method: 'put',
+    });
+  },
+};
+
+export default FEEDBACK_API;

+ 2 - 6
src/api/client/goods.js

@@ -1,14 +1,10 @@
 import request from '@/utils/request';
 
-/**
- * 获取当前位置
- * @returns
- */
 export function getGoodsList(data) {
   return request({
     url: '/maintain/merchant/getMerchantGoodsList',
     method: 'post',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/json',
     },
@@ -18,7 +14,7 @@ export function getCategories(merchantId) {
   return request({
     url: '/maintain/merchant/getCategories',
     method: 'post',
-    data: {merchantId},
+    data: { merchantId },
     headers: {
       'content-type': 'application/json',
     },

+ 3 - 3
src/api/client/home.js

@@ -8,7 +8,7 @@ export function getCurrentLocation(data) {
   return request({
     url: '/maintain/location',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -23,7 +23,7 @@ export function getHomePageApi(data) {
   return request({
     url: '/maintain/customer/index',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -62,7 +62,7 @@ export function listHotMerchant(data) {
   return request({
     url: `/maintain/listHotMerchant/`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },

+ 8 - 8
src/api/client/message.js

@@ -7,7 +7,7 @@ export function clientCommentList(data) {
   return request({
     url: '/maintain/client/comment/page',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -19,7 +19,7 @@ export function addClientComment(data) {
   return request({
     url: `/maintain/client/comment/add`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -33,7 +33,7 @@ export function getIsHaveNewInform(data) {
   return request({
     url: '/maintain/new/inform',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -47,7 +47,7 @@ export function getOrderInform(data) {
   return request({
     url: '/maintain/order/inform',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -61,7 +61,7 @@ export function getOrderCommentInform(data) {
   return request({
     url: '/maintain/comment/inform',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -75,7 +75,7 @@ export function getEvaluateInform(data) {
   return request({
     url: '/maintain/evaluate/inform',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -89,7 +89,7 @@ export function getCouponInform(data) {
   return request({
     url: '/maintain/coupon/inform',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -103,7 +103,7 @@ export function clearInformFlag(data) {
   return request({
     url: '/maintain/system/inform/flag',
     method: 'PUT',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },

+ 9 - 36
src/api/client/mine.js

@@ -8,7 +8,7 @@ export function maintainFavoritePaging(data) {
   return request({
     url: '/maintain/favorites',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -23,7 +23,7 @@ export function getFavouriteGoods(data) {
   return request({
     url: '/maintain/favorites/goods',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -38,7 +38,7 @@ export function maintainCouponPaging(data) {
   return request({
     url: '/maintain/coupon/paging',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -67,7 +67,7 @@ export function getUserAcceptCouponsList(data) {
   return request({
     url: '/maintain/usercoupons',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -82,7 +82,7 @@ export function accountTotIdGetCouponList(merchantId, data) {
   return request({
     url: `/maintain/coupon/${merchantId}/paging`,
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -97,67 +97,40 @@ export function maintainReservations(data) {
   return request({
     url: '/maintain/reservations',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
   });
 }
 
-/**
- * 获取 - 我的客服中心
- * @returns
- */
 export function getProbleList(data) {
   return request({
     url: `/maintain/problem/list`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/json',
     },
   });
 }
 
-/**
- * 获取 - 我的客服中心
- * @returns
- */
 export function getMyTeam(data) {
   return request({
     url: `/maintain/invite/team/page`,
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
   });
 }
 
-/**
- * 意见反馈接口 - 新增意见反馈
- * @returns
- */
-export function getFeedback(data) {
-  return request({
-    url: `/maintain/feedback`,
-    method: 'post',
-    data: data,
-    headers: {
-      'content-type': 'application/json',
-    },
-  });
-}
-
-/**
- * 意见反馈接口 - 新增意见反馈
- * @returns
- */
 export function inviteBind(data) {
   return request({
     url: `/maintain/invite/bind`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/json',
     },

+ 5 - 5
src/api/client/order.js

@@ -8,7 +8,7 @@ export function userOrdersApi(data) {
   return request({
     url: '/maintain/userorders',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -23,7 +23,7 @@ export function getUserOrderList(data) {
   return request({
     url: '/maintain/order/paging',
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -39,7 +39,7 @@ export function successfulPayment(id, data) {
   return request({
     url: `/maintain/paySuccess/${id}`,
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -55,7 +55,7 @@ export function orderDetailGoodApi(id, data) {
   return request({
     url: `/maintain/orderdetail/${id}`,
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },
@@ -71,7 +71,7 @@ export function cancelOrder(id, data) {
   return request({
     url: `/maintain/cancelOrder/${id}`,
     method: 'get',
-    data: data,
+    data,
     headers: {
       'content-type': 'application/x-www-form-urlencoded',
     },

+ 61 - 0
src/api/client/reservation.js

@@ -0,0 +1,61 @@
+/* 预约接口 */
+
+import request from '@/utils/request';
+const basePath = '/maintain/';
+
+const RESERVATION_API = {
+  /**
+   * 预约接口 - 查询用户预约列表
+   * @returns
+   */
+  list: () => {
+    return request({
+      url: basePath + '/reservations',
+      method: 'get',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+    });
+  },
+  /**
+   * 预约接口 - 查询商家被预约列表
+   * @returns
+   */
+  merchantList: () => {
+    return request({
+      url: basePath + '/listMerchantReservations',
+      method: 'get',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+    });
+  },
+  /**
+   * 预约接口 - 新增预约
+   * @param {*} data
+   * @returns
+   */
+  add: (data, merchantId) => {
+    return request({
+      url: basePath + `merchant/${merchantId}/reservation`,
+      method: 'post',
+      data,
+    });
+  },
+  /**
+   * 用户常用地址接口 - 删除用户常用地址
+   * @param {*} id
+   * @returns
+   */
+  delete: id => {
+    return request({
+      url: basePath + `reservation/${id}`,
+      method: 'put',
+      headers: {
+        'Content-Type': 'application/x-www-form-urlencoded',
+      },
+    });
+  },
+};
+
+export default RESERVATION_API;

+ 5 - 6
src/api/login.js

@@ -1,5 +1,4 @@
 import request from '@/utils/request';
-import store from '@/store';
 
 /**
  * 通过wx.login()获取登录code令牌
@@ -27,7 +26,7 @@ export function loginByWxLoginCode(data) {
   return request({
     url: '/maintain/login/wechat',
     method: 'post',
-    data: data,
+    data,
   });
 }
 
@@ -40,7 +39,7 @@ export function getSmsCodeByPhone(data) {
   return request({
     url: '/maintain/sms/captcha',
     method: 'post',
-    data: data
+    data,
   });
 }
 
@@ -53,7 +52,7 @@ export function loginByPhoneAndSmsCode(data) {
   return request({
     url: '/maintain/login/sms',
     method: 'post',
-    data: data,
+    data,
   });
 }
 
@@ -66,6 +65,6 @@ export function logout(data) {
   return request({
     url: '/maintain/logoff',
     method: 'post',
-    data: data
-  })
+    data,
+  });
 }

+ 2 - 2
src/api/merchant/evaluate.js

@@ -40,7 +40,7 @@ export function addEvaluateRecoverApi(data) {
   return request({
     url: `/assess/recover/add`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -74,7 +74,7 @@ export function saveDefaultMsgApi(data) {
   return request({
     url: `/admin/assess/saveDefaultMsg`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },

+ 9 - 9
src/api/merchant/merchantAuth.js

@@ -8,7 +8,7 @@ export function addMerchantAuth(data) {
   return request({
     url: `/maintain/merchantAuth`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -25,7 +25,7 @@ export function getMerchantAuthData(data) {
   return request({
     url: `/maintain/merchantAuth/queryById`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
@@ -47,8 +47,8 @@ export function editMerchantAuth(id, data) {
     },
     data,
   });
-}
-
+}
+
 /**
  * @description 获取主营业务数组
  * @param {*} data
@@ -56,15 +56,15 @@ export function editMerchantAuth(id, data) {
  */
 export function getParentCategoriesData(data) {
   return request({
-    url: "/maintain/getParentCategories",
+    url: '/maintain/getParentCategories',
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
   });
 }
-
+
 /**
  * @description 获取辅营业务数组
  * @param {*} data
@@ -72,9 +72,9 @@ export function getParentCategoriesData(data) {
  */
 export function getRootCategoriesData(data) {
   return request({
-    url: "/maintain/getRootCategories",
+    url: '/maintain/getRootCategories',
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },

+ 18 - 20
src/api/merchant/order.js

@@ -9,7 +9,7 @@ import request from '@/utils/request';
 export function getOrderListApi(data) {
   return request({
     url: '/maintain/order/merchantPaging',
-    data: data,
+    data,
     method: 'GET',
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',
@@ -41,18 +41,18 @@ export function getAppointListApi(data) {
   return request({
     url: `/maintain/listMerchantReservations`,
     method: 'post',
-    data: data,
+    data,
     headers: {
       'Content-Type': 'application/json',
     },
   });
-}
+}
 /**
  * 订单核验-商家端核销商品
- * @param {*} 
+ * @param {*}
  * @returns
  */
-export function getVerificationApi(orderId,merchantId) {
+export function getVerificationApi(orderId, merchantId) {
   return request({
     url: `/maintain/order/verification/${orderId}/${merchantId}`,
     method: 'get',
@@ -60,37 +60,35 @@ export function getVerificationApi(orderId,merchantId) {
       'Content-Type': 'application/x-www-form-urlencoded',
     },
   });
-}
+}
 /**
- * 查询通知配置列表	
- * @param {*} 
+ * 查询通知配置列表
+ * @param {*}
  * @returns
  */
 export function getNoticeApi(data) {
   return request({
-    url: "/maintain/notice/list",
-    method: 'get',
-	data,
+    url: '/maintain/notice/list',
+    method: 'get',
+    data,
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',
     },
   });
-}
-
-
+}
+
 /**
  * 商家预约列表
- * @param {*} 
+ * @param {*}
  * @returns
  */
 export function getMerchantListApi(data) {
   return request({
-    url: "/maintain/reservation/getMerchantList",
-    method: 'get',
-	data,
+    url: '/maintain/reservation/getMerchantList',
+    method: 'get',
+    data,
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',
     },
   });
-}
-
+}

+ 1 - 1
src/api/merchant/shopManage.js

@@ -9,7 +9,7 @@ import request from '@/utils/request';
 export function getMerchantClassify(data) {
   return request({
     url: `/maintain/merchant/${merchantId}/goods`,
-    data: data,
+    data,
     method: 'GET',
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',

+ 1 - 1
src/api/merchant/store.js

@@ -9,7 +9,7 @@ import request from '@/utils/request';
 export function getMerchantCoupon(merchantId, data) {
   return request({
     url: `/maintain/coupon/${merchantId}/paging`,
-    data: data,
+    data,
     method: 'GET',
     headers: {
       'Content-Type': 'application/x-www-form-urlencoded',

+ 1 - 1
src/api/user.js

@@ -22,6 +22,6 @@ export function updateUserInfo(data) {
   return request({
     url: '/maintain/user/mine',
     method: 'PUT',
-    data: data,
+    data,
   });
 }

+ 15 - 0
src/components/base-button/base-button.vue

@@ -11,6 +11,9 @@
       :customStyle="customStyleOut"
       @click="handleClick"
       :color="color"
+      :loadingText="loadingText"
+      :loading="loading"
+      :disabled="disabled"
     ></u-button>
   </view>
 </template>
@@ -41,6 +44,10 @@ export default {
         return {};
       },
     },
+    loadingText: {
+      type: String,
+      default: '',
+    },
     fontSize: {
       type: String,
       default: '',
@@ -49,6 +56,14 @@ export default {
       type: String,
       default: '',
     },
+    disabled: {
+      type: Boolean,
+      default: false,
+    },
+    loading: {
+      type: Boolean,
+      default: false,
+    },
   },
   computed: {
     customStyleOut() {

+ 54 - 43
src/components/upload-img/upload-img.vue

@@ -27,6 +27,7 @@
 </template>
 
 <script>
+import { uploadFile } from '@/utils/upload.js';
 export default {
   name: 'upload-img',
   props: {
@@ -46,11 +47,11 @@ export default {
       type: Boolean,
       default: true,
     },
-    multiple: {
+    deletable: {
       type: Boolean,
-      default: false,
+      default: true,
     },
-    deletable: {
+    multiple: {
       type: Boolean,
       default: false,
     },
@@ -65,50 +66,60 @@ export default {
     deletePic(event) {
       this[`fileList${event.name}`].splice(event.index, 1);
     },
+    created() {
+      console.log(fileList1, 'fileList1');
+    },
     // 新增图片
     async afterRead(event) {
-      // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
-      let lists = [].concat(event.file);
-      let fileListLen = this[`fileList${event.name}`].length;
-      lists.map(item => {
-        this[`fileList${event.name}`].push({
-          ...item,
-          status: 'uploading',
-          message: '上传中',
-        });
-      });
-      for (let i = 0; i < lists.length; i++) {
-        const result = await this.uploadFilePromise(lists[i].url);
-        let item = this[`fileList${event.name}`][fileListLen];
-        this[`fileList${event.name}`].splice(
-          fileListLen,
-          1,
-          Object.assign(item, {
-            status: 'success',
-            message: '',
-            url: result,
-          }),
-        );
-        fileListLen++;
-      }
-    },
-    uploadFilePromise(url) {
-      return new Promise((resolve, reject) => {
-        let a = uni.uploadFile({
-          url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
-          filePath: url,
-          name: 'file',
-          formData: {
-            user: 'test',
-          },
-          success: res => {
-            setTimeout(() => {
-              resolve(res.data.data);
-            }, 1000);
-          },
-        });
+      console.log(event.file, 'event.file');
+      /* 当设置 multiple 为 true 时 */
+      uploadFile(event.file.url).then(res => {
+        console.log(res.data, 'res.data');
+        this.fileList1.push(res.data.url);
       });
+      // 当设置 multiple 为 true 时, file 为数组格式,否则为对象格式
+      // let lists = [].concat(event.file);
+      // let fileListLen = this[`fileList${event.name}`].length;
+      // lists.map(item => {
+      //   this[`fileList${event.name}`].push({
+      //     ...item,
+      //     status: 'uploading',
+      //     message: '上传中',
+      //   });
+      // });
+      // for (let i = 0; i < lists.length; i++) {
+      //   const result = await uploadFile(lists[i].url);
+      //   let item = this[`fileList${event.name}`][fileListLen];
+      //   this[`fileList${event.name}`].splice(
+      //     fileListLen,
+      //     1,
+      //     Object.assign(item, {
+      //       status: 'success',
+      //       message: '',
+      //       url: result,
+      //     }),
+      //   );
+      //   fileListLen++;
+      // }
     },
+
+    // uploadFile(url) {
+    //   return new Promise((resolve, reject) => {
+    //     let a = uni.uploadFile({
+    //       url: 'http://192.168.2.21:7001/upload', // 仅为示例,非真实的接口地址
+    //       filePath: url,
+    //       name: 'file',
+    //       formData: {
+    //         user: 'test',
+    //       },
+    //       success: res => {
+    //         setTimeout(() => {
+    //           resolve(res.data.data);
+    //         }, 1000);
+    //       },
+    //     });
+    //   });
+    // },
   },
 };
 </script>

+ 308 - 260
src/pageMerchant/mineModule/certification/corporateInformation.vue

@@ -1,288 +1,336 @@
 <template>
-	<view class="container">
-		<u-form :model="legalInfo" ref="uForm" labelPosition="left" labelWidth="80" :rules="rules">
-			<view class="content-box">
-				<view class="content-item">
-					<u-form-item prop="legalRepresentativeName" required label="法人名称" right>
-						<view class="item-r">
-							<u--input placeholder="请输入法人名称" border="surround"
-								v-model="legalInfo.legalRepresentativeName"></u--input>
-						</view>
-					</u-form-item>
-				</view>
+  <view class="container">
+    <u-form
+      :model="legalInfo"
+      ref="uForm"
+      labelPosition="left"
+      labelWidth="80"
+      :rules="rules"
+    >
+      <view class="content-box">
+        <view class="content-item">
+          <u-form-item prop="legalRepresentativeName" required label="法人名称" right>
+            <view class="item-r">
+              <u--input
+                placeholder="请输入法人名称"
+                border="surround"
+                v-model="legalInfo.legalRepresentativeName"
+              ></u--input>
+            </view>
+          </u-form-item>
+        </view>
 
-				<view class="content-item">
-					<u-form-item prop="sexName" required label="性别" right @click="showSex = true">
-						<view class="item-r">
-							<u--input placeholder="请选择性别" border="surround" v-model="legalInfo.sexName" />
-						</view>
-					</u-form-item>
-					<view class="icon-right-box">
-						<u-icon name="arrow-right" color="#c5c5c5" size="20"></u-icon>
-					</view>
-				</view>
+        <view class="content-item">
+          <u-form-item prop="sexName" required label="性别" right @click="showSex = true">
+            <view class="item-r">
+              <u--input
+                placeholder="请选择性别"
+                border="surround"
+                v-model="legalInfo.sexName"
+              />
+            </view>
+          </u-form-item>
+          <view class="icon-right-box">
+            <u-icon name="arrow-right" color="#c5c5c5" size="20"></u-icon>
+          </view>
+        </view>
 
-				<view class="content-item">
-					<u-form-item prop="documentType" required label="证件类型" right>
-						<view class="item-r">
-							<u--input placeholder="居民身份证" border="surround" v-model="legalInfo.documentType"
-								disabled></u--input>
-						</view>
-					</u-form-item>
-				</view>
-				<view class="content-item">
-					<u-form-item prop="idCardNumber" required label="证件号" right>
-						<view class="item-r">
-							<u--input placeholder="请输入证件号" border="surround"
-								v-model="legalInfo.idCardNumber"></u--input>
-						</view>
-					</u-form-item>
-				</view>
-				<view class="content-item">
-					<u-form-item prop="idCardExpirationDate" required label="有效期" right @click="showPicker = true">
-						<view class="item-r">
-							<u--input placeholder="请输入证件有效期" border="surround"
-								v-model="legalInfo.idCardExpirationDate"></u--input>
-						</view>
-					</u-form-item>
-					<view class="icon-right-box">
-						<u-icon name="arrow-right" color="#c5c5c5" size="20"></u-icon>
-					</view>
-				</view>
-			</view>
+        <view class="content-item">
+          <u-form-item prop="documentType" required label="证件类型" right>
+            <view class="item-r">
+              <u--input
+                placeholder="居民身份证"
+                border="surround"
+                v-model="legalInfo.documentType"
+                disabled
+              ></u--input>
+            </view>
+          </u-form-item>
+        </view>
+        <view class="content-item">
+          <u-form-item prop="idCardNumber" required label="证件号" right>
+            <view class="item-r">
+              <u--input
+                placeholder="请输入证件号"
+                border="surround"
+                v-model="legalInfo.idCardNumber"
+              ></u--input>
+            </view>
+          </u-form-item>
+        </view>
+        <view class="content-item">
+          <u-form-item
+            prop="idCardExpirationDate"
+            required
+            label="有效期"
+            right
+            @click="showPicker = true"
+          >
+            <view class="item-r">
+              <u--input
+                placeholder="请输入证件有效期"
+                border="surround"
+                v-model="legalInfo.idCardExpirationDate"
+              ></u--input>
+            </view>
+          </u-form-item>
+          <view class="icon-right-box">
+            <u-icon name="arrow-right" color="#c5c5c5" size="20"></u-icon>
+          </view>
+        </view>
+      </view>
 
-			<view class="content-box">
-				<u-form-item prop="idCardFrontPhoto">
-					<imgs-upload @update="fileList" :value="1" :imageList="legalInfo.idCardFrontPhoto"></imgs-upload>
-					<p class="upload-text">证件正面图(国徽图)</p>
-				</u-form-item>
-			</view>
+      <view class="content-box">
+        <u-form-item prop="idCardFrontPhoto">
+          <imgs-upload
+            @update="fileList"
+            :value="1"
+            :imageList="legalInfo.idCardFrontPhoto"
+          ></imgs-upload>
+          <p class="upload-text">证件正面图(国徽图)</p>
+        </u-form-item>
+      </view>
 
-			<view class="content-box">
-				<u-form-item prop="idCardBackPhoto">
-					<imgs-upload @update="fileList" :value="2" :imageList="legalInfo.idCardBackPhoto"></imgs-upload>
-					<p class="upload-text">证件反面图(人像图)</p>
-				</u-form-item>
-			</view>
-		</u-form>
+      <view class="content-box">
+        <u-form-item prop="idCardBackPhoto">
+          <imgs-upload
+            @update="fileList"
+            :value="2"
+            :imageList="legalInfo.idCardBackPhoto"
+          ></imgs-upload>
+          <p class="upload-text">证件反面图(人像图)</p>
+        </u-form-item>
+      </view>
+    </u-form>
 
-		<button class="btn" @click="handlerSkipNext">下一步</button>
+    <button class="btn" @click="handlerSkipNext">下一步</button>
 
-		<!-- 性别 -->
-		<u-action-sheet :show="showSex" :actions="actions" title="请选择性别" description="如果选择保密会报错"
-			@close="showSex = false" @select="sexSelect">
-		</u-action-sheet>
+    <!-- 性别 -->
+    <u-action-sheet
+      :show="showSex"
+      :actions="actions"
+      title="请选择性别"
+      description="如果选择保密会报错"
+      @close="showSex = false"
+      @select="sexSelect"
+    >
+    </u-action-sheet>
 
-		<!-- 时间 -->
-		<u-datetime-picker :show="showPicker" v-model="valueDate" mode="date" @cancel="showPicker = false"
-			@confirm="handleConfirm"></u-datetime-picker>
-	</view>
+    <!-- 时间 -->
+    <u-datetime-picker
+      :show="showPicker"
+      v-model="valueDate"
+      mode="date"
+      @cancel="showPicker = false"
+      @confirm="handleConfirm"
+    ></u-datetime-picker>
+  </view>
 </template>
 
 <script>
-	import ImgsUpload from './components/ImgsUpload.vue';
-	import {
-		formatTime
-	} from '@/utils/date';
+import ImgsUpload from './components/ImgsUpload.vue';
+import { formatTime } from '@/utils/date';
 
-	export default {
-		components: {
-			ImgsUpload,
-		},
-		data() {
-			return {
-				showSex: false,
-				showPicker: false,
-				valueDate: Number(new Date()),
-				actions: [{
-						index: '1',
-						name: '男',
-					},
-					{
-						index: '2',
-						name: '女',
-					},
-					{
-						index: '0',
-						name: '保密',
-					},
-				],
-				legalInfo: {
-					legalRepresentativeName: '',
-					legalRepresenativeGender: '',
-					idCardExpirationDate: '',
-					idCardNumber: '',
-					idCardFrontPhoto: '',
-					idCardBackPhoto: '',
-					sexName: '',
-				},
-				rules: {
-					legalRepresentativeName: {
-						type: 'string',
-						required: true,
-						message: '请输入法人名称',
-						trigger: ['blur', 'change'],
-					},
-					sexName: {
-						type: 'string',
-						required: true,
-						message: '请选择性别',
-						trigger: ['blur', 'change'],
-					},
-					idCardNumber: [{
-							required: true,
-							message: '请输入证件号',
-							trigger: ['blur', 'change'],
-						},
-						{
-							validator: (rule, value, callback) => {
-								return uni.$u.test.idCard(value);
-							},
-							message: '您输入的证件号不正确',
-							trigger: ['change', 'blur'],
-						},
-					],
-					idCardExpirationDate: {
-						type: 'string',
-						required: true,
-						message: '请输入证件有效期',
-						trigger: ['change'],
-					},
-				},
-			};
-		},
-		onReady() {
-			//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
-			this.$refs.uForm.setRules(this.rules);
-		},
-		onLoad() {
-			if (this.$store.state.data.merchantInfo && this.$store.state.data.merchantInfo.idCardNumber) {
-				console.log("sadsadas")
-				this.legalInfo = {
-					legalRepresentativeName: this.$store.state.data.merchantInfo.legalRepresentativeName,
-					// legalRepresenativeGender:  this.$store.state.data.merchantInfo.legalRepresentativeName,
-					idCardExpirationDate: formatTime(this.$store.state.data.merchantInfo.idCardExpirationDate,
-						'YYYY-MM-DD'),
-					idCardNumber: this.$store.state.data.merchantInfo.idCardNumber,
-					idCardFrontPhoto: this.$store.state.data.merchantInfo.idCardFrontPhoto,
-					idCardBackPhoto: this.$store.state.data.merchantInfo.idCardBackPhoto,
-					sexName: this.$store.state.data.merchantInfo.legalRepresentativeGender == 1 ? '男' : (this.$store
-						.state
-						.data.merchantInfo.legalRepresentativeGender == 2 ? '女' : '保密'),
-				}
-			}
-		},
-		mounted() {
-			console.log(this.$store.state.data.merchantInfo)
-
-		},
-		onShow() {
-
-
-		},
-		methods: {
-			// 跳转到4/4资质信息
-			handlerSkipNext() {
-				this.$refs.uForm.validate().then(res => {
-					this.$store.commit('SET_LEGALINFO', this.legalInfo);
-					setTimeout(() => {
-						uni.navigateTo({
-							url: '/pageMerchant/mineModule/certification/qualificationInformation',
-						});
-					}, 1500);
-				});
-			},
-			sexSelect(e) {
-				this.legalInfo.sexName = e.name; // 数据渲染
-				this.legalInfo.legalRepresenativeGender = e.index; //后端接收
-				this.$refs.uForm.validateField('userInfo.sex');
-			},
-			handleConfirm(data) {
-				this.legalInfo.idCardExpirationDate = formatTime(data.value, 'YYYY-MM-DD');
-				this.showPicker = false;
-			},
-			// 处理图片
-			fileList(val, data) {
-				if (data == 1) {
-					this.legalInfo.idCardFrontPhoto = val[0];
-				} else if (data == 2) {
-					this.legalInfo.idCardBackPhoto = val[0];
-				}
-			},
-		},
-	};
+export default {
+  components: {
+    ImgsUpload,
+  },
+  data() {
+    return {
+      showSex: false,
+      showPicker: false,
+      valueDate: Number(new Date()),
+      actions: [
+        {
+          index: '1',
+          name: '男',
+        },
+        {
+          index: '2',
+          name: '女',
+        },
+        {
+          index: '0',
+          name: '保密',
+        },
+      ],
+      legalInfo: {
+        legalRepresentativeName: '',
+        legalRepresenativeGender: '',
+        idCardExpirationDate: '',
+        idCardNumber: '',
+        idCardFrontPhoto: '',
+        idCardBackPhoto: '',
+        sexName: '',
+      },
+      rules: {
+        legalRepresentativeName: {
+          type: 'string',
+          required: true,
+          message: '请输入法人名称',
+          trigger: ['blur', 'change'],
+        },
+        sexName: {
+          type: 'string',
+          required: true,
+          message: '请选择性别',
+          trigger: ['blur', 'change'],
+        },
+        idCardNumber: [
+          {
+            required: true,
+            message: '请输入证件号',
+            trigger: ['blur', 'change'],
+          },
+          {
+            validator: (rule, value, callback) => {
+              return uni.$u.test.idCard(value);
+            },
+            message: '您输入的证件号不正确',
+            trigger: ['change', 'blur'],
+          },
+        ],
+        idCardExpirationDate: {
+          type: 'string',
+          required: true,
+          message: '请输入证件有效期',
+          trigger: ['change'],
+        },
+      },
+    };
+  },
+  onReady() {
+    //如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
+    this.$refs.uForm.setRules(this.rules);
+  },
+  onLoad() {
+    if (
+      this.$store.state.data.merchantInfo &&
+      this.$store.state.data.merchantInfo.idCardNumber
+    ) {
+      this.legalInfo = {
+        legalRepresentativeName:
+          this.$store.state.data.merchantInfo.legalRepresentativeName,
+        // legalRepresenativeGender:  this.$store.state.data.merchantInfo.legalRepresentativeName,
+        idCardExpirationDate: formatTime(
+          this.$store.state.data.merchantInfo.idCardExpirationDate,
+          'YYYY-MM-DD',
+        ),
+        idCardNumber: this.$store.state.data.merchantInfo.idCardNumber,
+        idCardFrontPhoto: this.$store.state.data.merchantInfo.idCardFrontPhoto,
+        idCardBackPhoto: this.$store.state.data.merchantInfo.idCardBackPhoto,
+        sexName:
+          this.$store.state.data.merchantInfo.legalRepresentativeGender == 1
+            ? '男'
+            : this.$store.state.data.merchantInfo.legalRepresentativeGender == 2
+            ? '女'
+            : '保密',
+      };
+    }
+  },
+  methods: {
+    // 跳转到4/4资质信息
+    handlerSkipNext() {
+      this.$refs.uForm.validate().then(res => {
+        this.$store.commit('SET_LEGALINFO', this.legalInfo);
+        setTimeout(() => {
+          uni.navigateTo({
+            url: '/pageMerchant/mineModule/certification/qualificationInformation',
+          });
+        }, 1500);
+      });
+    },
+    sexSelect(e) {
+      this.legalInfo.sexName = e.name; // 数据渲染
+      this.legalInfo.legalRepresenativeGender = e.index; //后端接收
+      this.$refs.uForm.validateField('userInfo.sex');
+    },
+    handleConfirm(data) {
+      this.legalInfo.idCardExpirationDate = formatTime(data.value, 'YYYY-MM-DD');
+      this.showPicker = false;
+    },
+    // 处理图片
+    fileList(val, data) {
+      if (data == 1) {
+        this.legalInfo.idCardFrontPhoto = val[0];
+      } else if (data == 2) {
+        this.legalInfo.idCardBackPhoto = val[0];
+      }
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
-	.container {
-		background-color: #f7f7f7 !important;
-		padding-bottom: 40rpx;
+.container {
+  background-color: #f7f7f7 !important;
+  padding-bottom: 40rpx;
 
-		.top-box {
-			color: #666666;
-			font-size: 26rpx;
-			text-align: center;
-			padding: 20rpx 40rpx;
-			background-color: #fff;
-		}
+  .top-box {
+    color: #666666;
+    font-size: 26rpx;
+    text-align: center;
+    padding: 20rpx 40rpx;
+    background-color: #fff;
+  }
 
-		.content-box {
-			padding: 20rpx 40rpx;
-			background-color: #fff;
-			margin: 10rpx 0;
+  .content-box {
+    padding: 20rpx 40rpx;
+    background-color: #fff;
+    margin: 10rpx 0;
 
-			.content-item {
-				position: relative;
+    .content-item {
+      position: relative;
 
-				.item-r {
-					background-color: #f7f7f7;
-					border-radius: 20rpx;
+      .item-r {
+        background-color: #f7f7f7;
+        border-radius: 20rpx;
 
-					.data_select {
-						width: 90%;
-					}
+        .data_select {
+          width: 90%;
+        }
 
-					::v-deep .u-form-item {
-						width: 100%;
-					}
+        ::v-deep .u-form-item {
+          width: 100%;
+        }
 
-					::v-deep .u-form-item__body {
-						padding: 0;
-					}
-				}
+        ::v-deep .u-form-item__body {
+          padding: 0;
+        }
+      }
 
-				.icon-right-box {
-					position: absolute;
-					right: 15rpx;
-					top: 40rpx;
-				}
-			}
+      .icon-right-box {
+        position: absolute;
+        right: 15rpx;
+        top: 40rpx;
+      }
+    }
 
-			.upload-text {
-				text-align: center;
-				color: #666666;
-				font-size: 28rpx;
-				margin-top: 20rpx;
-			}
-		}
+    .upload-text {
+      text-align: center;
+      color: #666666;
+      font-size: 28rpx;
+      margin-top: 20rpx;
+    }
+  }
 
-		.btn {
-			background-color: #5992bb !important;
-			color: #fff;
-			font-size: 32rpx;
-			border-radius: 40rpx;
-			margin-top: 100rpx;
-			margin-bottom: 100rpx;
-			width: 95%;
-		}
-	}
+  .btn {
+    background-color: #5992bb !important;
+    color: #fff;
+    font-size: 32rpx;
+    border-radius: 40rpx;
+    margin-top: 100rpx;
+    margin-bottom: 100rpx;
+    width: 95%;
+  }
+}
 
-	::v-deep .uni-select {
-		border: none !important;
-	}
+::v-deep .uni-select {
+  border: none !important;
+}
 
-	::v-deep .uni-select__input-placeholder {
-		font-size: 28rpx !important;
-		color: #cbced4 !important;
-	}
+::v-deep .uni-select__input-placeholder {
+  font-size: 28rpx !important;
+  color: #cbced4 !important;
+}
 </style>

+ 0 - 1
src/pages/home/home copy.vue

@@ -259,7 +259,6 @@ export default {
           url: `/pagesHome/storeList/index?id=${item.id}&name=${item.name}`,
         });
       }
-      //
     },
 
     /* 询价 */

+ 10 - 4
src/pages/home/index.vue

@@ -108,6 +108,9 @@ export default {
       params: {},
     };
   },
+  onLoad() {
+    this.handleGetLocation();
+  },
   computed: {
     categories() {
       if (this.homeData.categories) {
@@ -139,15 +142,16 @@ export default {
       }
     },
   },
-  mounted() {
-    this.handleGetLocation();
-
+  onShow() {
     let { longitude, latitude, region } = this.location;
     this.params = {
       longitude,
       latitude,
       region,
     };
+    this.getHomeData(this.params);
+  },
+  mounted() {
     this.getSwiperList();
     this.handleInvitationCode();
   },
@@ -190,7 +194,9 @@ export default {
     },
 
     /* 点击swiper跳转 */
-    handlerSwiperSkip(e) {},
+    handlerSwiperSkip(e) {
+      console.log(e);
+    },
     /* 点击菜单 */
     handleMenuClick(item) {
       if (item.name === '全部') {

+ 12 - 5
src/pagesHome/homeAddress/index.vue

@@ -57,9 +57,12 @@ export default {
         success: res => {
           let { longitude, latitude } = res;
           let data = { longitude, latitude };
-          this.$store.dispatch('getLocationNow', data).then(() => {
-            uni.$u.route('/pages/home/index');
-          });
+          this.$store.dispatch('getLocationNow', data);
+          setTimeout(() => {
+            uni.navigateTo({
+              url: '/pages/home/index',
+            });
+          }, 500);
         },
       });
     },
@@ -69,8 +72,12 @@ export default {
         success: res => {
           let { longitude, latitude } = res;
           let data = { longitude, latitude };
-          this.$store.dispatch('getLocationNow', data).then(() => {
-            uni.$u.route('/pages/home/index');
+          this.$store.dispatch('getLocationNow', data).then(res => {
+            setTimeout(() => {
+              uni.navigateTo({
+                url: '/pages/home/index',
+              });
+            }, 500);
           });
         },
       });

+ 1 - 0
src/store/modules/data.js

@@ -48,6 +48,7 @@ export default {
       let point = `${location.latitude},${location.longitude}`;
       return new Promise((resolve, reject) => {
         getCurrentLocation({ point }).then(res => {
+          console.log(res, 'getCurrentLocation');
           if (res.code === 'OK') {
             let { latitude, longitude, id, address, name, city, district, province } =
               res.data;

+ 15 - 18
src/utils/upload.js

@@ -1,16 +1,16 @@
-import store from '@/store'
+import store from '@/store';
 import { getAccessToken } from './auth';
 
 function uploadFile(filePath) {
   uni.showLoading({
-    title:"上传中..."
-  })
+    title: '上传中...',
+  });
   return new Promise((resolve, reject) => {
     uni.uploadFile({
-      url: 'https://test.api.chelvc.com/maintain/file', //仅为示例,非真实的接口地址
+      url: 'https://test.api.chelvc.com/maintain/file',
       filePath: filePath,
       name: 'file',
-      header:{
+      header: {
         'Content-Type': 'multipart/form-data',
         platform: store.getters.app.system.osName.toUpperCase(),
         terminal: 'APPLET', // TODO:
@@ -18,22 +18,19 @@ function uploadFile(filePath) {
         // scope: store.getters.scope,
         device: store.getters.app.system.deviceId,
         timestamp: new Date().getTime(),
-        Authorization: `Bearer ${getAccessToken()}`
+        Authorization: `Bearer ${getAccessToken()}`,
       },
-      success: (res) => {
-        resolve(res)
+      success: res => {
+        resolve(res);
       },
-      fail: (err) => {
-        reject(err)
+      fail: err => {
+        reject(err);
+      },
+      complete: () => {
+        uni.hideLoading();
       },
-      complete:()=>{
-        uni.hideLoading()
-      }
     });
-  })
-
+  });
 }
 
-export {
-  uploadFile
-}
+export { uploadFile };