fuwei 5 лет назад
Родитель
Сommit
40c9537487

+ 0 - 2
ghs/src/App.vue

@@ -17,8 +17,6 @@
 			const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
 			uni.setStorageSync('account', extConfig.account)
 			// #endif
-			var pages = getCurrentPages();
-			console.log(pages)
 			wxLoginFn()
 				.then(res => {
 					//花店员工和未知身份可以访问的地址

+ 2 - 4
ghs/src/admin/ad/list.vue

@@ -60,14 +60,12 @@
 		<div class="app-footer">
 			<div
 				class="admin-button-com middle blue"
-				@click="
-					pageTo({
+				@click="pageTo({
 						url: '/admin/ad/add',
 						query: {
 							type: tabIndex
 						}
-					})
-				"
+					})"
 			>
 				添加
 			</div>

+ 1 - 1
ghs/src/admin/home/apply.vue

@@ -58,7 +58,7 @@
                             },
                             {
                                 name: "库存预警",
-                                img: `${this.$constant.imgUrl}/ghs/home/kcyj.png`,
+                                img: `${this.$constant.imgUrl}/ghs/home/kcyjs.png`,
                                 url: "/admin/staff/list"
                             },
                             {

+ 36 - 5
ghs/src/admin/home/me.vue

@@ -29,12 +29,22 @@
                                 </view>
                         </view>
                         </view>
-                        <view class="chang-shop_btn">
-                            <i class="iconfont iconqiehuan1"></i>
-                            切换店铺
+                        <view 
+                            v-if="loginInfo.super"
+                            class="chang-shop_btn">
+                            <DorpdownSelect 
+							:menuObj.sync="menuObj"  
+							top="200px"
+							:selectItemId.sync="shopId"
+							@selectSussess="selectSussess"></DorpdownSelect>
                         </view>
                     </view>
-                    <view class="image-box">
+                    <view 
+                        @click=" pageTo({
+                            url: '/pagesClient/official/index',
+                            type:2
+                        })"
+                        class="image-box">
                         <view class="dec">
                             店铺服务期至: {{infoData.deadline}}
                         </view>
@@ -77,12 +87,18 @@
     import AppAvatarModule from '@/components/module/app-avatar'
     import TuiListCell from '@/components/plugin/list-cell'
     import { mainMy } from '@/api/home'
+    import { toggleShop } from '@/api/common'
+    import DorpdownSelect from "@/components/module/dorpdownSelect";
+    import { selectShop } from '@/mixins'
+    import { getUser } from '@/utils/auth'
     export default { // 我的
         name:"Me",
         components:{
             AppAvatarModule,
-            TuiListCell
+            TuiListCell,
+            DorpdownSelect
         },
+        mixins:[selectShop],
         data(){
             return {
                 constant: this.$constant,
@@ -97,6 +113,19 @@
                 } finally {
 
                 }
+            },
+            async selectSussess(val){
+                uni.showLoading({
+                    title: '加载中'
+                });
+              try {
+                  let res = await toggleShop({ shopId: this.shopId});
+                  getUser(true)
+                  this.init()
+              } finally {
+                 uni.hideLoading(); 
+              }
+              
             }
         }
     }
@@ -192,6 +221,7 @@
                     width: 100%;
                     height: 70upx;
                     position: relative;
+                    z-index: 1;
                     & > .dec {
                         color: #FFFFFF;
                         font-size: 24upx;
@@ -200,6 +230,7 @@
                         top: 50%;
                         left: 20upx;
                         transform: translate(0,-50%);
+  
                     }
                     & > image {
                         width: 100%;

+ 3 - 1
ghs/src/api/common/index.js

@@ -34,5 +34,7 @@ export const suggestion = param => https.get('/map/suggestion', param)
 
 // 微信分享 m b
 export const wxShare = data => https.post('/wx-share/get-params', data)
-
+// 获取所有门店
 export const shopAll = data => https.get('/shop/all', data)
+// 切换门店
+export const toggleShop = data => https.post('/shop/toggle-shop', data)

+ 1 - 1
ghs/src/components/module/app-search.vue

@@ -120,7 +120,7 @@ export default {
 		@include disFlex(center, flex-start);
 		width: 100%;
 		height: 100%;
-		border-radius: 10px;
+		border-radius: 30px;
 		.icon-wrap {
 			margin-left: 20px;
 			width: 40px;

+ 53 - 24
ghs/src/components/module/dorpdownSelect.vue

@@ -7,9 +7,6 @@
             <i class="iconfont iconsanjiao_xia"></i>
         </view>
          <view 
-            :style="{
-               top
-            }"
             class="select-mark-view" v-show="dropdownShow" @click="switchCut"></view>
         <view 
             v-if="dropdownShow"
@@ -25,7 +22,7 @@
                             v-for="(item,index) in menuObj.list"
                             :key="index"
                             @click="changeItem(item)"
-                            :class="['admin-button-com','mini-btn',selectItem.name === item.name?'blue':'default']">
+                            :class="['admin-button-com','mini-btn',selectItemId === item.id?'blue':'default']">
                             {{item.name}}
                         </button>
                     </view>
@@ -37,8 +34,8 @@
                     <view class="item-child_box">
                         <picker
                             class="admin-button-com mini-btn default custom"
-                                mode="date" :value="selectItem" @change="endTimeFn">
-                            <div v-if="selectItem&&$util.isString(selectItem)">{{ selectItem }}</div>
+                                mode="date" :value="selectItemId" @change="endTimeFn">
+                            <div v-if="selectItemId&&formatSelect(selectItemId)">{{ selectItemId }}</div>
                             <div class="tui-placeholder" v-else>自定义时间</div>
                         </picker>
                     </view>
@@ -63,7 +60,7 @@
                 type: Object,
                 default: ()=>({
                     title:'时间',
-                    titleChild:'选择时间',
+                    titleChild:'门店',
                     list: [{name:'昨天'},{name:'今天'},{name:'本月'},{name:'上月'},{name:'今年'}]  
                 })
             },
@@ -75,6 +72,10 @@
             top:{
                type: String,
                default: 'auto'
+            },
+            selectItemId:{
+                type:[String,Number],
+                default:''
             }
         },
         data(){
@@ -87,23 +88,52 @@
 
         },
         methods:{
+            formatSelect(val){
+                if(val.split('-').length>1){
+                    return true
+                }else{
+                    return false
+                }
+            },
             switchCut(){
                 this.dropdownShow = !this.dropdownShow
             },
             changeItem(val){
-                this.selectItem = val
+                if(val.id== this.selectItemId){
+                    return false
+                }
+                this.$emit('update:selectItemId',val.id)
+
+                this.dropdownShow = false;
+
+                this.$emit('update:menuObj',{
+                    ...this.menuObj,
+                    title:val.name
+                })
+
+                this.$emit('selectSussess',{
+                    select: this.$util.isString(val)?val:val.name,
+                    selectItem: val
+                })
             },
             endTimeFn(e){
-                this.selectItem = e.detail.value;
+
+                this.selectItemId = e.detail.value;
+
+                this.dropdownShow = false;
+
+                this.$emit('update:selectItemId',val.id)
+
+                this.$emit('update:menuObj',{
+                    ...this.menuObj,
+                    title:e.detail.value
+                })
+
+                this.$emit('selectSussess',{
+                    select: e.detail.value,
+                    selectItem: val
+                })
             }
-        },
-        watch:{
-           selectItem(val){
-               this.$emit('selectSussess',{
-                   select: this.$util.isString(val)?val:val.name,
-                   selectItem: val
-               })
-           } 
         }
     }
 </script>
@@ -113,8 +143,9 @@
         .select-title {
             color: #666666;
             font-size: 26px;
+            
             & .iconsanjiao_xia {
-                margin-left: 30px;
+                margin-left: 10px;
             }
             &.select_corlor {
                 color: #3385FF;
@@ -124,17 +155,14 @@
             }
         }
         .select-mark-view {
-            /*  #ifndef  H5  */
             height: 100vh;
-            /*  #endif  */
-            /*  #ifdef  H5  */
             height: 100%;
-            /*  #endif  */
-            position: absolute;
+            position: fixed;
             width: 100%;
             background-color: rgba(0, 0, 0, 0.5);
             left: 0;
-            // top: 100px;
+            top: 0px;
+            z-index: 900;
         }
         & .select-fixed_bx {
             position: fixed;
@@ -152,6 +180,7 @@
                     font-size: 24px;
                     color: #333333;
                     font-weight: 600;
+                    text-align: left;
                 }
                 & .item-child_box {
                     display: flex;

+ 1 - 3
ghs/src/mixins/index.js

@@ -1,5 +1,3 @@
 export { default as list } from './list'
-// export { default as allOptions } from './allOptions'
 export { default as share } from './share'
-// export { default as orderBtn } from './orderBtn'
-// export { default as area } from './area'
+export { default as selectShop } from './selectShop'

+ 3 - 1
ghs/src/mixins/product.js

@@ -113,7 +113,9 @@ export default {
 				});
 				this.productInfo = data;
 				this.classIndex = 0;
-			} catch (error) {}
+			} catch (error) {}finally{
+				uni.hideLoading();
+			}
 		},
 		/**
 		 * 通过id获取当前选中的该商品信息

+ 38 - 0
ghs/src/mixins/selectShop.js

@@ -0,0 +1,38 @@
+import { mapState,mapGetters } from 'vuex'
+export default {
+    data(){
+        return {
+            menuObj:{
+				title:'门店',
+				titleChild:'请选择门店',
+				list: []
+			},
+			shopId:0
+        }
+    },
+    computed:{
+		...mapState({
+			userShopAll:state=>state.user.userShopAll
+        }),
+        ...mapGetters({ 
+            loginInfo: "getLoginInfo",
+            userInfo: 'getUser'
+    })
+    },
+    mounted(){
+        this.menuObj.list = this.userShopAll.map(i=>({
+            ...i,
+            name:i.shopName
+        }));
+    },
+	watch:{
+		userShopAll(val){
+			if(!this.$util.isEmpty(val)) {
+				this.menuObj.list = val.map(i=>({
+					...i,
+					name:i.shopName
+				}));
+			}
+		}
+	}
+}

+ 51 - 23
ghs/src/pagesStatistics/business.vue

@@ -4,10 +4,15 @@
 			<view class="business-info">
 				<view class="amount-view">
 					<text class="amount-label">账户余额</text>
-					<text class="amount-btn">
-						瑞景店
-						<text class="iconfont iconsanjiao_xia"></text>
-					</text>
+					<view 
+						v-if="loginInfo.super"
+						class="amount-btn">
+						<DorpdownSelect 
+							:menuObj.sync="menuObj"  
+							top="40px"
+							:selectItemId.sync="shopId"
+							@selectSussess="selectSussess"></DorpdownSelect>	
+					</view>
 				</view>
 				<view class="price-view">
 					<text class="unit">¥</text>
@@ -142,7 +147,7 @@
 									</view>
 								</view>
 								<view class="item-right">
-									<text class="iconfont iconxiangyou"> </text>
+									<!-- <text class="iconfont iconxiangyou"> </text> -->
 								</view>
 							</view>
 							<view class="list-item" >
@@ -157,7 +162,7 @@
 									</view>
 								</view>
 								<view class="item-right">
-									<text class="iconfont iconxiangyou"> </text>
+									<!-- <text class="iconfont iconxiangyou"> </text> -->
 								</view>
 							</view>	
 							<view class="list-item" >
@@ -186,8 +191,14 @@
 
 <script>
 import {getMainProfile} from '@/api/statistics'
+import DorpdownSelect from "@/components/module/dorpdownSelect";
+import { selectShop } from '@/mixins'
 export default {
 	name:'Business',
+	components:{
+		DorpdownSelect
+	},
+	mixins:[selectShop],
 	data() {
 		return {
 			curTabIndex: 0,
@@ -210,23 +221,33 @@ export default {
 				}
 			],
 			bussinessList: [{}, {}],
-			baseInfo:{}
+			baseInfo:{},
 		};
 	},
 	methods:{
 		async init(){
+				this.shopId = this.userInfo.id
+				uni.showLoading({
+					title: '加载中'
+				});
 				try {
-					let {data:{base,more}} = await getMainProfile({})
+					let {data:{base,more}} = await getMainProfile({
+						shopId: this.shopId
+					})
 					this.baseInfo = base
 					this.bussinessList = [more.today,more.yesterday,more.latestSeven,more.latestThirty]
 				} finally {
-
+					uni.hideLoading();
 				}
 		},
 		changeDate(idx){
 			this.curTabIndex = idx;
+		},
+		selectSussess(val){
+			this.shopId = val.selectItem.id;
+			this.init();
 		}
-	}
+	},
 };
 </script>
 
@@ -425,20 +446,27 @@ export default {
 			.amount-btn {
 				border: 1px solid #ffffff;
 				border-radius: 22px;
-				padding: 0px 17px;
-				height: 44px;
-				line-height: 44px;
-				font-size: 24px;
-				font-family: PingFang SC;
-				font-weight: 400;
-				color: #ffffff;
-				// margin: 0 10px;
-
-				.iconfont {
-					margin-left: 20upx;
-					font-size: 25px;
-					padding-right: 10px;
+				text-align: center;
+				display: flex;
+				align-items: center;
+				justify-content: center;
+			// 	// padding: 0px 17px;
+				width: 165upx;
+				height: 44upx;
+				& /deep/ .select-title {
+					color: #FFFFFF;
 				}
+			// 	font-size: 24px;
+			// 	font-family: PingFang SC;
+			// 	font-weight: 400;
+			// 	color: #ffffff;
+			// 	// margin: 0 10px;
+			// 	position: relative;
+			// 	.iconfont {
+			// 		margin-left: 20upx;
+			// 		font-size: 25px;
+			// 		padding-right: 10px;
+			// 	}
 			}
 		}
 		.price-view {

+ 44 - 17
ghs/src/pagesStorehouse/stockWarn/manage.vue

@@ -8,10 +8,20 @@
 		/>
 		<view 
 			class="input-wrap">
-			<view 
-				v-if="loginInfo.super == 1"
+			<!-- <view 
+				v-if=" == 1"
 				class="city-select text-line">
 				瑞经典<text class="iconfont iconsanjiao_xia"></text>
+			</view> -->
+			<view 
+				v-if="loginInfo.super"
+				class="city-select text-line">
+				<DorpdownSelect 
+					:menuObj.sync="menuObj"
+					:selectItemId.sync="shopId"
+					top="40px" 
+					@selectSussess="selectSussess">
+				</DorpdownSelect>	
 			</view>
 			<view class="search-bar">
 				<app-search-module
@@ -85,16 +95,19 @@ import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import CommodityStock from "../components/CommodityStock";
 import { STOCK_TYPE } from "@/utils/declare";
 import productMins from "@/mixins/product";
+import { selectShop } from '@/mixins'
 import { mapGetters } from 'vuex'
+import DorpdownSelect from "@/components/module/dorpdownSelect";
 export default {
 	name: "stock_manage", // 开单
 	components: {
 		AppTabs,
 		AppSearchModule,
 		AppWrapperEmpty,
-		CommodityStock
+		CommodityStock,
+		DorpdownSelect
 	},
-	mixins: [productMins],
+	mixins: [productMins,selectShop],
 	data() {
 		return {
 			STOCK_TYPE,
@@ -110,19 +123,16 @@ export default {
 					name: "库存管理",
 					key: STOCK_TYPE.MANAGE
 				}
-			]
+			],
 		};
 	},
 	onLoad() {
 		let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
-		this.initData({ type });
-	},
-	computed: {
-		pageType() {
-			return this.tabs[this.tabIndex].key;
-		},
-		...mapGetters({ loginInfo: "getLoginInfo" })
+		// 当前门店
+		this.shopId = this.userInfo.id
+		this.initData({ type,shopId:this.shopId });
 	},
+	
 	methods: {
 		affirm(val) {
 			if (val.index === 0) {
@@ -131,19 +141,35 @@ export default {
 			}
 		},
 		change(e) {
+			
 			if (this.tabIndex == e.index) {
 				return false;
 			} else {
+				uni.showLoading({
+					title: '加载中'
+				});
 				this.tabIndex = e.index;
+				this.tabs[this.tabIndex].key;
 				let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
-				this.initData({ type });
+				this.initData({ type,shopId:this.shopId });
 			}
 		},
 		searchFn() {
-			this.initData();
+			uni.showLoading({
+					title: '加载中'
+				});
+			this.initData({ shopId:this.shopId });
 		},
-		scrollTop() {}
-	}
+		scrollTop() {},
+		selectSussess(val){
+			uni.showLoading({
+				title: '加载中'
+			});
+			let type = this.tabs[this.tabIndex].key == STOCK_TYPE.WARN ? "waring" : "";
+			this.shopId = val.selectItem.id;
+			this.initData({ type,shopId:this.shopId });
+		}
+	},
 };
 </script>
 
@@ -162,7 +188,8 @@ export default {
 			display: flex;
 			flex-shrink: 0;
 			align-items: center;
-			margin-right: 20upx;
+			margin-right: 45upx;
+			margin-left: 15px;
 			background-color: #ffff;
 			.iconfont {
 				margin-left: 20upx;

+ 1 - 2
ghs/src/store/modules/user.js

@@ -6,7 +6,7 @@ const state = {
 	selfInfo: null,
 	user: null,
 	shopUser: null,
-	userShopAll: {}  //用户所有店铺
+	userShopAll: []  //用户所有店铺
 }
 
 const getters = {
@@ -99,7 +99,6 @@ const actions = {
 	},
 	setUserShopAll({commit,state},info={}){
 		return shopAll(info).then(res=>{
-			console.log(res)
 			commit('SET_USER_SHOP_ALL',res.data)
 		})
 	}