Răsfoiți Sursa

切换门店

shish 4 ani în urmă
părinte
comite
7bbade2019

+ 2 - 2
ghsApp/src/admin/goodsManage/freight.vue

@@ -19,7 +19,7 @@
 
 <script>
 import { mapGetters, mapState } from 'vuex'
-import { getUser } from '@/utils/auth'
+import { getShopInfo } from '@/utils/auth'
 import { freightSet } from '@/api/goods'
 export default {
 	name: 'setting-freight',
@@ -48,7 +48,7 @@ export default {
 	},
 	methods: {
 		init() {
-			getUser().then(res => {
+			getShopInfo().then(res => {
 				this.form.first = this.userInfo.extend.freeDistance
 				this.form.add = this.userInfo.extend.freight
 			})

+ 3 - 3
ghsApp/src/admin/home/login.vue

@@ -153,7 +153,7 @@ export default {
 							that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 						})
 						that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-						getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
+						getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
 						that.setUserShopAll()
 						// #ifdef APP-PLUS
 						//保存安卓的clientId
@@ -224,7 +224,7 @@ export default {
 										that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 									})
 									that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-									getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
+									getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
 									that.setUserShopAll()
 									// #ifdef APP-PLUS
 									//保存安卓的clientId
@@ -302,7 +302,7 @@ export default {
 						that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
 					})
 					that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
-					getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
+					getShopInfo(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
 					that.setUserShopAll()
 					// #ifdef APP-PLUS
 					//保存安卓的clientId

+ 2 - 0
ghsApp/src/admin/home/me.vue

@@ -133,6 +133,7 @@ import ShopSelect from "@/components/module/shopSelect";
 import { list } from "@/mixins";
 import { mapGetters } from "vuex";
 import NotLogin from "@/components/not-login";
+import { getShopInfo } from "@/utils/auth";
 export default {
   name: "me",
   components: {
@@ -220,6 +221,7 @@ export default {
         this.$store.commit("setMyShopInfo", {})
         plus.runtime.restart()
         // #endif
+        getShopInfo(true)
       } finally {
         uni.hideLoading();
       }

+ 10 - 8
ghsApp/src/admin/home/workbench.vue

@@ -91,7 +91,7 @@
 <script>
 import { mapGetters,mapActions } from "vuex";
 import NotLogin from "@/components/not-login";
-import { getUser } from "@/utils/auth";
+import { getShopInfo } from "@/utils/auth";
 import { consoleIndex } from "@/api/workbench";
 import { closeBook } from "@/api/book";
 import productMins from "@/mixins/product";
@@ -167,6 +167,15 @@ export default {
 			console.log('................载入最新花材................')
 		})
 		// #endif
+
+		getShopInfo().then(res => {
+			if(res.name){
+				uni.setNavigationBarTitle({ title: res.name })
+			}else{
+				uni.setNavigationBarTitle({ title: '店铺' })
+			}
+		})
+
 	},
 	methods: {
 		...mapActions(['setUserShopAll']),
@@ -215,13 +224,6 @@ export default {
 			}
 		},
 		init() {
-			getUser().then(res => {
-				if(res.name){
-					uni.setNavigationBarTitle({ title: res.name })
-				}else{
-					uni.setNavigationBarTitle({ title: '店铺' })
-				}
-			})
 			this.setIndex()
 		},
 		setIndex(){

+ 1 - 1
ghsApp/src/api/common/index.js

@@ -13,7 +13,7 @@ export const getMerchantInfo = param => https.get("/merchant/get-info", param);
 export const getShopUserApi = param => https.get("/user/my-profile", param);
 
 // 商户信息
-export const getUserApi = param => https.get("/merchant/detail", param);
+export const getShopInfoApi = param => https.get("/merchant/detail", param);
 
 // 员工信息
 export const getStaffApi = param => https.get("/admin/login-detail", param);

+ 2 - 2
ghsApp/src/mixins/globalMixins.js

@@ -62,7 +62,7 @@ export default {
 						uni.setStorageSync('currentMiniOpenId', currentMiniOpenId)
             let token = res.token || ''
             if (!this.$util.isEmpty(token)) {
-              getUser(true)
+              getShopInfo(true)
               this.setUserShopAll()
             }
             if (this.init) {
@@ -202,7 +202,7 @@ export default {
 
         this.no_shop_show_model = false
 
-        getUser(true)
+        getShopInfo(true)
         //获取门店信息
         this.setUserShopAll();
         uni.reLaunch({url:'/admin/home/workbench'})

+ 1 - 1
ghsApp/src/pagesClient/official/index.vue

@@ -36,7 +36,7 @@ import AppImg from "@/components/app-img";
 import { applyStatus } from "@/api/official";
 import { share } from "@/mixins";
 import { postWxCode,getDictionaries } from '@/api/mini'
-import { getUser } from '@/utils/auth'
+import { getShopInfo } from '@/utils/auth'
 import {mapActions, mapGetters} from "vuex";
 import util from "../../utils/util";
 export default {

+ 1 - 4
ghsApp/src/pagesPurchase/components/pageSuccess.vue

@@ -13,10 +13,7 @@
 							<view class="product-area">
 								<view class="first-area"><text>{{res.name}}</text><input type="digit" v-model="res.autoPrice" @focus="priceFocus(i,res)" @input="modifyPrice(res)"> 元</view>
 								<view class="second-area">
-										<view class="one" v-if="parseFloat(res.autoPrice)!=parseFloat(Number(res.addPrice)+Number(res.cost)) && parseFloat(Number(res.autoPrice)-Number(res.cost)) > 0">
-										<label>重量 {{parseFloat(res.weight)}} 成本 {{parseFloat(res.cost)}},加价建议{{parseFloat(Number(res.autoPrice)-Number(res.cost))}}元,修改请勾选<checkbox :value="res.id" style="transform:scale(0.7)" /> </label>
-									</view>
-									<view class="two" v-else>成本 {{parseFloat(res.cost)}},加价 {{parseFloat(res.addPrice)}}元</view>
+									<view class="two">成本 ¥{{parseFloat(res.cost)}},加价 ¥{{parseFloat(res.addPrice)}}</view>
 								</view>
 							</view>
 						</view>

+ 2 - 2
ghsApp/src/store/modules/merchant.js

@@ -1,4 +1,4 @@
-import { getUserApi } from "@/api/common/index";
+import { getShopInfo } from "@/api/common/index";
 export default {
 	state: {
 		merchantInfo: null //商家信息
@@ -11,7 +11,7 @@ export default {
 	actions: {
 		async initMerchantInfo({ commit }) {
 			try {
-				const { data } = await getUserApi();
+				const { data } = await getShopInfo();
 				commit("UPDATE_MERCHANT_INFO", data);
 				return data;
 			} catch (error) {

+ 3 - 3
ghsApp/src/utils/auth.js

@@ -1,5 +1,5 @@
 import store from '@/store'
-import {getStaffApi,getUserApi,getShopUserApi} from '@/api/common'
+import {getStaffApi,getShopInfoApi,getShopUserApi} from '@/api/common'
 import { postWxCode,getDictionaries } from '@/api/mini'
 
 import util from './util'
@@ -23,12 +23,12 @@ export async function getShopUser(update) {
  * 获取后台商户用户信息
  * @parmas update为true时会重新触发请求,重置vuex的数据
  */
-export async function getUser(update) {
+export async function getShopInfo(update) {
 	let userInfo = store.getters.getUser
 	if (!util.isEmpty(userInfo) && !update) {
 		return userInfo
 	}
-	await getUserApi().then((res) => {
+	await getShopInfoApi().then((res) => {
 		userInfo = res.data
 		store.dispatch('setUser', userInfo)
 	}).catch(() => {})