shish пре 4 година
родитељ
комит
f440c906be
3 измењених фајлова са 29 додато и 69 уклоњено
  1. 25 40
      hdApp/src/admin/home/me.vue
  2. 2 17
      hdApp/src/constant/index.js
  3. 2 12
      hdApp/src/plugins/luch-request_0.0.7/request.js

+ 25 - 40
hdApp/src/admin/home/me.vue

@@ -1,7 +1,7 @@
 <template>
   <view class="me-content_box app-content">
     <image :src="`${constant.imgUrl}/ghs/me/bg.png`" class="me-content_bg" ></image>
-    <template v-if="!$util.isEmpty(shopInfo)">
+    <template>
       <view class="me-user_box">
         <view class="user-info_item">
           <view v-if="shopInfo.shopAdminId > 0"> <view class="name"> {{ shopInfo.adminName }} </view> <view class="mobile"> ID:{{ shopInfo.shopAdminId }} </view> </view>
@@ -35,8 +35,8 @@
         <view class="account-info_box content_box">
           <view class="info-lf_box">
             <view> 账户余额(元) </view>
-            <view> <text>¥ </text> {{ shopInfo.balance }} </view>
-            <view> 可提现余额 ¥ {{ shopInfo.txBalance }} <text v-if="shopInfo.txBalance > 0" @click="checkToApplyCash" class="to-cash">提现</text> </view>
+            <view> <text>¥ </text> {{ shopInfo.balance||0 }} </view>
+            <view> 可提现余额 ¥ {{ shopInfo.txBalance||0 }} <text v-if="shopInfo.txBalance > 0" @click="checkToApplyCash" class="to-cash">提现</text> </view>
           </view>
         </view>
         <view class="module-com content_box user-open_bx">
@@ -78,18 +78,13 @@
               <div class="tui-title">新手教程</div>
             </tui-list-cell>
 
-            <tui-list-cell @click="getCustomService()" class="line-cell" :hover="false" :arrow="true">
-              <div class="tui-title">联系客服</div>
-            </tui-list-cell>
-
           </view>
         </view>
       </view>
     </template>
-    <DorpdownSelect ref="dorpdownSelect" :menuObj.sync="menuObj" top="0upx" :isShowTit="false" :selectItemId.sync="shopId" @selectSussess="selectSussess" ></DorpdownSelect>
+    <DorpdownSelect ref="dorpdownSelect" :menuObj.sync="menuObj" top="0upx" :isShowTit="false" :selectItemId.sync="shopId" @selectSussess="changeShop()" ></DorpdownSelect>
   </view>
 </template>
-
 <script>
 import AppAvatarModule from "@/components/module/app-avatar";
 import TuiListCell from "@/components/plugin/list-cell";
@@ -101,7 +96,7 @@ import { getUser } from "@/utils/auth";
 import { list } from "@/mixins";
 import { mapGetters } from "vuex";
 export default {
-  name: "Me",
+  name: "me",
   components: {
     AppAvatarModule,
     TuiListCell,
@@ -113,22 +108,19 @@ export default {
   },
   data () {
     return {
-      constant: this.$constant,
-      shopInfo: {},
+      constant:this.$constant,
+      shopInfo:{},
     };
   },
   onPullDownRefresh () {
-    this.init()
+    this.getMyInfo()
   },
   onShow () {
-    if(uni.getStorageSync('switchTabQuery').refresh == '1') {
-      this.init()
-      uni.removeStorageSync('switchTabQuery')
-    }
+    this.getMyInfo()
   },
   methods: {
 		getCustomService(){
-			let self = this;
+			let that = this;
 			uni.showModal({
 				title: "客服电话微信",
 				content: "15280215347",
@@ -139,7 +131,7 @@ export default {
 						uni.setClipboardData({
 							data: "15280215347",
 							success: function() {
-								self.$msg("已复制")
+								that.$msg("已复制")
 							}
 						});
 					}
@@ -150,30 +142,25 @@ export default {
       this.shopId = this.getLoginInfo.shopId;
       this.$refs.dorpdownSelect.dropdownShow = true;
     },
-    async init () {
-        try {
-          const { data } = await mainMy();
-          this.shopInfo = data;
-          //不要删除此输出,方法查看 shish 20210512
-          console.log('商家ID',data.sjId,'门店ID',data.shopId)
-          uni.stopPullDownRefresh();
-        } finally {
+    getMyInfo () {
+      console.log('uuuuuuu')
+      mainMy().then(res=>{
+        console.log(res)
+        console.log('------')
+        if(res.code == 1){
+          this.shopInfo = res.data
         }
+      })
+      console.log('hhhhhhhhh')
+      console.log('3333')
+      uni.stopPullDownRefresh()
     },
-    async selectSussess () {
-      uni.showLoading({
-        title: "加载中",
-      });
-      try {
+    async changeShop() {
+        uni.showLoading()
         await toggleShop({ shopId: this.shopId })
-
-        //这个切换得更彻底
         this.$store.commit("setLoginInfo", {})
         this.$util.pageTo({url: "/admin/home/me",type: 3})
-
-      } finally {
-        uni.hideLoading();
-      }
+        uni.hideLoading()
     },
     checkToApplyCash () {
       let self = this;
@@ -211,7 +198,6 @@ export default {
   },
 };
 </script>
-
 <style lang="scss" scoped>
 .me-content_box {
   position: relative;
@@ -290,7 +276,6 @@ export default {
           position: absolute;
           right: 20upx;
           top: 40upx;
-          // text-align: center;
           & .iconqiehuan1 {
             margin-right: 10upx;
             box-sizing: border-box;

+ 2 - 17
hdApp/src/constant/index.js

@@ -13,27 +13,12 @@ const envVal = {
 	imgUrl: extConfig.imgHost,
 	env: process.env.NODE_ENV,
 	// 本地连接地址
-	hostUrl: null,
+	hostUrl: extConfig.apiHost,
 	// 请求接口地址
 	formal: null,
 	// 项目来源
 	source: ProjectName,
 	// 第一个host
-	firstHost: getFirstHost()
-}
-
-// #ifdef H5
-envVal.formal = process.env.NODE_ENV == 'development' ? 'https://ghs.huaml.com' : `${window.location.protocol}//${window.location.host}`
-envVal.hostUrl = process.env.NODE_ENV == 'development' ? `https://api.shop.huaml.com` : `${window.location.protocol}//api.${window.location.host}`
-// #endif
-
-// #ifdef MP-WEIXIN
-envVal.formal = process.env.NODE_ENV == 'development' ? extConfig.apiHost : extConfig.apiHost
-envVal.hostUrl = process.env.NODE_ENV == 'development' ? extConfig.apiHost : extConfig.apiHost
-// #endif
-
-function getFirstHost() {
-	let host = extConfig.apiHost
-	return process.env.NODE_ENV == 'development' ? 'huaml' : host
+	firstHost: ''
 }
 export default envVal

+ 2 - 12
hdApp/src/plugins/luch-request_0.0.7/request.js

@@ -8,18 +8,12 @@
  * **/
 import qs from 'qs'
 import constant from '@/constant/index'
-// import common from '@/utils/common'
 import { parse, getCheckLogin } from '@/utils/util'
 
 const Base64 = require('js-base64').Base64
 class Request {
 	config = {
-		// #ifdef H5
-		baseUrl: process.env.NODE_ENV == 'development' ? '/api' : constant.hostUrl,
-		// #endif
-		// #ifdef MP-WEIXIN
 		baseUrl: constant.hostUrl,
-		// #endif
 		header: {
 			'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8'
 		},
@@ -128,17 +122,14 @@ class Request {
 		options.data = qs.stringify(options.data) || {}
 		options.header = options.header || this.config.header
 		options.method = options.method || this.config.method
+		console.log(options)
 		return new Promise((resolve, reject) => {
 			let next = true
 			let _config = null
 			options.complete = (response) => {
+				console.log(response)
 				const statusCode = response.statusCode
 				response.config = _config
-				//   if(config.method === 'get') {
-				// 	response.config.config = config
-				//   }else if(config.method === 'post'){
-				// 	response.config.config.config = config
-				//   }
 				response.config.config = config
 				response = this.requestComFun(response)
 				// 全局忽略错误,在单个请求里面自行处理
@@ -175,7 +166,6 @@ class Request {
 						} else {
 							console.log('response.data', response.data)
 							if (!config.hideError) {
-								// this.$msg(response.data.msg)
 								uni.showToast({
 									title: response.data.msg,
 									icon: 'none',