Просмотр исходного кода

新增小程序审核体验账号

jf 5 лет назад
Родитель
Сommit
e0b8919bb4

+ 19 - 2
ghsApp/src/admin/billing/index.vue

@@ -15,6 +15,8 @@
 						<text v-if="getSelectClassById(item.classId).smallCount > 0">{{ getSelectClassById(item.classId).smallCount }}</text>
 					</text>
 				</div>
+				<view style="height: 200rpx"></view>
+				<view class="switchover-unit" @tap="isSmallCount = !isSmallCount">{{isSmallCount?'支':'扎'}}</view>
 			</scroll-view>
 
 			<scroll-view scroll-y class="right-box" :scroll-into-view="scrollClassId">
@@ -128,6 +130,7 @@ export default {
 		return {
 			COMMODITY_TYPE,
 			isModel: false,
+			isSmallCount:true,//是否是小单位(支)
 			offVerifyRepertory:true,
 			customData: {
 				bigCount: 0,
@@ -244,6 +247,7 @@ export default {
 		overflow: hidden;
 	}
 	.tab-view {
+		position: relative;
 		height: 100%;
 		width: 170upx;
 		flex-shrink: 0;
@@ -282,7 +286,6 @@ export default {
 			font-size: 26px;
 			background: #fff;
 		}
-
 		.active::before {
 			content: "";
 			position: absolute;
@@ -290,12 +293,26 @@ export default {
 			height: 100%;
 			left: 0;
 		}
+		.switchover-unit{
+			position: fixed;
+			left: calc(170rpx / 2 - 30rpx);
+			bottom: 140rpx;
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			width: 60rpx;
+			height: 60rpx;
+			color: #FFFFFF;
+			background: #4b8cf4;
+			border-radius: 50%;
+			z-index: 2;
+		}
 	}
 	.right-box {
 		height: 100%;
 		flex: 1;
 		box-sizing: border-box;
-    
+
 	}
 	.item_list_bx {
 		padding: 40px 16px;

+ 5 - 5
ghsApp/src/admin/home/workbench.vue

@@ -289,13 +289,9 @@ export default {
 	},
 	computed: {
 		...mapGetters({ userInfo: "getUser" }),
-		...mapGetters({ loginInfo: "getLoginInfo" })
+		...mapGetters({ loginInfo: "getLoginInfo" }),
 	},
 	onLoad(option) {
-    // 获取小程序的APPID
-    getWeixinId().then(res => {
-      this.getappIdList = res.data
-    });
   },
 	onPullDownRefresh() {
 		this.init();
@@ -312,6 +308,10 @@ export default {
 					this.init();
 				},100);
 			}else{
+				// 获取小程序的APPID
+				getWeixinId().then(res => {
+					this.getappIdList = res.data
+				});
 				getUser().then(res => {
 					uni.setNavigationBarTitle({
 						title: res.name

+ 17 - 3
ghsApp/src/mixins/product.js

@@ -253,11 +253,20 @@ export default {
 				if (element.id == item.id && element.classId == item.classId) {
 					has = true;
 					if(this.offVerifyRepertory){//盘点页面没有库存验证
-						list[index] = { ...element, bigCount: ++element.bigCount };
+						if(this.isSmallCount){
+							list[index] = { ...element, smallCount: ++element.smallCount };
+						}else{
+							list[index] = { ...element, bigCount: ++element.bigCount };
+						}
+
 					}else{
 						if (this.isLimit) {
 							if (element.bigCount < item.bigNum) {
-								list[index] = { ...element, bigCount: ++element.bigCount };
+								if(this.isSmallCount){
+									list[index] = { ...element, smallCount: ++element.smallCount };
+								}else{
+									list[index] = { ...element, bigCount: ++element.bigCount };
+								}
 							}else{
 								this.$msg("库存不足");
 							}
@@ -265,7 +274,12 @@ export default {
 							// 	list[index] = { ...element, smallCount: ++element.smallCount };
 							// }
 						} else {
-							list[index] = { ...element, bigCount: ++element.bigCount };
+							if(this.isSmallCount){
+								list[index] = { ...element, smallCount: ++element.smallCount };
+							}else{
+								list[index] = { ...element, bigCount: ++element.bigCount };
+							}
+							// list[index] = { ...element, bigCount: ++element.bigCount };
 						}
 						if (this.isLimit) {
 							const { bigCount, smallCount } = list[index];

+ 95 - 22
ghsApp/src/pagesClient/official/index.vue

@@ -3,8 +3,13 @@
     <view class="header_logo">
       <image :src="`${constant.imgUrl}/ghs/home_page/logo.png`" mode="widthFix"></image>
 
-      <view @click="register()" class="free_register" v-if="getLoginInfo.openShop == 1">免费注册</view>
-      <div v-if="getLoginInfo.openShop != 1" class="free_register">已申请</div>
+					<view class="header_logo-more">
+						<view class="experience" v-if="getLoginInfo.showDemo==1" @tap="experienceFun">体验</view>
+						<view @click="register()" class="free_register" v-if="getLoginInfo.openShop == 1">免费注册</view>
+						<view v-if="getLoginInfo.openShop != 1" class="free_register">已申请</view>
+					</view>
+
+
     </view>
     <view class="main">
       <view class="banner_box">
@@ -35,11 +40,15 @@
 </template>
 
 <script>
+import store from '@/store'
 import AppSwiper from "@/components/app-swiper";
 import AppImg from "@/components/app-img";
 import { applyStatus } from "@/api/official";
 import { share } from "@/mixins";
-import { mapGetters } from "vuex";
+import { postWxCode,getDictionaries } from '@/api/mini'
+import { getUser } from '@/utils/auth'
+import {mapActions, mapGetters} from "vuex";
+import util from "../../utils/util";
 export default {
   components: {
     AppSwiper,
@@ -107,15 +116,69 @@ export default {
 		...mapGetters(["getLoginInfo"])
 	},
   methods: {
-    register(){
-			this.$util.pageTo({
-				url: '/pagesClient/official/pay',
-				query: {
-					...this.option
-				},
-				type: 2
-			})
-    }
+			...mapActions(['setUserShopAll']),
+			register(){
+					this.$util.pageTo({
+						url: '/pagesClient/official/pay',
+						query: {
+							...this.option
+						},
+						type: 2
+					})
+    },
+			experienceFun(){
+				/**姜枫 2021.04.30  小程序审核体验账号**/
+				postWxCode().then(subRes => {
+					if (util.isEmpty(subRes)) {
+						return false
+					}
+					uni.setStorageSync('token', subRes.data.token)
+					uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
+					getDictionaries({ token: subRes.data.token }).then(res => {
+						if (util.isEmpty(res)) {
+							return false
+						}
+						store.commit('setDictionariesInfo', {
+							...res.data.dict,
+							...res.data
+						})
+						store.commit('setMyShopInfo', {
+							...res.data.shop,
+							...res.data
+						})
+					})
+					store.commit('setLoginInfo', {
+						...subRes.data.admin,
+						...subRes.data
+					})
+
+					//启动更新逻辑 shish 2020.5.18
+					if (subRes.data.update == 1) {
+						const updateManager = wx.getUpdateManager()
+						updateManager.onCheckForUpdate(function (res) {
+							// 请求完新版本信息的回调
+							console.log(res.hasUpdate)
+						})
+						updateManager.onUpdateReady(function () {
+							wx.showModal({
+								title: '更新提示',
+								content: '新版本已经准备好,是否重启应用?',
+								success(res) {
+									if (res.confirm) {
+										// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
+										updateManager.applyUpdate()
+									}
+								}
+							})
+						})
+						updateManager.onUpdateFailed(function () {})// 新版本下载失败
+						return true;
+					}
+					getUser(true);
+					this.setUserShopAll();
+					uni.switchTab({url:'/admin/home/workbench'})
+				})
+			},
   },
   onLoad() {
     this.jweixinFn({
@@ -135,6 +198,11 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+.experience{
+	//height: 60rpx;
+	padding: 0 30rpx;
+	color: #3385FF;
+}
 .header_logo{
   position: fixed;
   top: 0;
@@ -152,16 +220,21 @@ export default {
     height: 49upx;
     // background-color: #eee;
   }
-  &>.free_register{
-    width: 200upx;
-    height: 60pux;
-    line-height: 60upx;
-    background: linear-gradient(90deg, #3385FF, #33B0FF);
-    border-radius: 30upx;
-    text-align: center;
-    font-size: 32px;
-    color: #FFFFFF;
-  }
+	.header_logo-more{
+		display: flex;
+		align-items: center;
+		.free_register{
+			width: 200upx;
+			height: 60pux;
+			line-height: 60upx;
+			background: linear-gradient(90deg, #3385FF, #33B0FF);
+			border-radius: 30upx;
+			text-align: center;
+			font-size: 32px;
+			color: #FFFFFF;
+		}
+	}
+
 }
 .main{
   margin: 100upx 0;

+ 4 - 3
hdApp/src/admin/home/workbench.vue

@@ -278,9 +278,7 @@ export default {
     ...mapGetters({ loginInfo: "getLoginInfo" })
   },
   onLoad (option) {
-      getWeixinId().then(res => {
-        this.getappIdList = res.data
-      });
+
    },
   onPullDownRefresh () {
     this.init();
@@ -309,6 +307,9 @@ export default {
 					this.init();
 				},100);
 			}else{
+				getWeixinId().then(res => {
+					this.getappIdList = res.data
+				});
         getUser().then(res => {
           uni.setNavigationBarTitle({
             title: res.name

+ 70 - 2
hdApp/src/pagesClient/official/index.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="app-content">
+			<view class="experience" v-if="getLoginInfo.showDemo==1" @tap="experienceFun">体验</view>
     <div class="tab-wrap">
       <div class="logo-img">
         <img :src="`${constant.imgUrl}/retail/official/logo.png`" alt />
@@ -55,11 +56,15 @@
 </template>
 
 <script>
+import store from '@/store'
 import AppSwiper from "@/components/app-swiper";
 import AppImg from "@/components/app-img";
 import { applyStatus } from "@/api/official";
 import { share } from "@/mixins";
-import { mapGetters } from 'vuex';
+import {mapActions, mapGetters} from 'vuex';
+import util from "../../utils/util";
+import { postWxCode,getDictionaries } from '@/api/mini'
+import { getUser } from '@/utils/auth'
 export default {
   name: "index",
   components: {
@@ -140,16 +145,79 @@ export default {
     uni.hideHomeButton()
   },
   methods: {
+			...mapActions(['setUserShopAll']),
     contactFn() {
       uni.makePhoneCall({
         phoneNumber: "05923272000"
       });
-    }
+    },
+			experienceFun(){
+				/**姜枫 2021.04.30  小程序审核体验账号**/
+				postWxCode().then(subRes => {
+					if (util.isEmpty(subRes)) {
+						return false
+					}
+					uni.setStorageSync('token', subRes.data.token)
+					uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
+					getDictionaries({ token: subRes.data.token }).then(res => {
+						if (util.isEmpty(res)) {
+							return false
+						}
+						store.commit('setDictionariesInfo', {
+							...res.data.dict,
+							...res.data
+						})
+						store.commit('setMyShopInfo', {
+							...res.data.shop,
+							...res.data
+						})
+					})
+					store.commit('setLoginInfo', {
+						...subRes.data.admin,
+						...subRes.data
+					})
+
+					//启动更新逻辑 shish 2020.5.18
+					if (subRes.data.update == 1) {
+						const updateManager = wx.getUpdateManager()
+						updateManager.onCheckForUpdate(function (res) {
+							// 请求完新版本信息的回调
+							console.log(res.hasUpdate)
+						})
+						updateManager.onUpdateReady(function () {
+							wx.showModal({
+								title: '更新提示',
+								content: '新版本已经准备好,是否重启应用?',
+								success(res) {
+									if (res.confirm) {
+										// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
+										updateManager.applyUpdate()
+									}
+								}
+							})
+						})
+						updateManager.onUpdateFailed(function () {})// 新版本下载失败
+						return true;
+					}
+					getUser(true)
+					//获取门店信息
+					this.setUserShopAll();
+					uni.switchTab({url:'/admin/home/workbench'})
+				})
+			},
   }
 };
 </script>
 
 <style lang="scss" scoped>
+.experience{
+	display: flex;
+	align-items: center;
+	justify-content: flex-end;
+	height: 60rpx;
+	padding: 0 30rpx;
+	color: #3385FF;
+}
 .app-content {
   background-color: #fff;
   padding-bottom: 100px;