shish 4 سال پیش
والد
کامیت
8193af9dbd

+ 4 - 0
mallApp/src/api/shop/index.js

@@ -39,4 +39,8 @@ export const downQrCode = data => {
  */
 export const downMemberCode = data => {
 	return https.get('/shop/download-apply-member-code', data, {}, { hideError: true })
+}
+
+export const getNewShop = data => {
+	return https.get('/shop/get-new-shop', data, {}, { hideError: true })
 }

+ 1 - 1
mallApp/src/api/user/index.js

@@ -2,4 +2,4 @@ import https from '@/plugins/luch-request_0.0.7/request'
 
 export const recentShop = data => {
 	return https.get('/user/recent-shop', data)
-}
+}

+ 0 - 10
mallApp/src/main.js

@@ -37,16 +37,6 @@ if (process.env.NODE_ENV == 'production') {
 	}
 }
 
-// Vue.prototype.$backgroundAudioData = {
-// 	playing: false,
-// 	playTime: 0,
-// 	formatedPlayTime: '00:00:00'
-// }
-
-// Vue.component('page-head', pageHead)
-// Vue.component('page-foot', pageFoot)
-// Vue.component('uLink', uLink)
-
 App.mpType = 'app'
 
 const app = new Vue({

+ 4 - 59
mallApp/src/mixins/globalMixins.js

@@ -1,31 +1,20 @@
-import { mapGetters } from 'vuex'
-import { pageTo, getCheckLogin, isLogin } from '@/utils/util.js'
+import { pageTo, isLogin } from '@/utils/util.js'
 import { wxLoginFn } from '@/utils/auth'
-import { getShopUser } from '@/utils/auth'
-import constant from '@/constant'
 export default {
 	data() {
 		return {
-			// 全局混入,插入链接参数
 			option: null,
-			// 全局混入,插入全局常量
 			constant: this.$constant,
-			// 全局混入,插入全局工具函数
 			$util: this.$util,
-			// 全局混入,插入全局跳转函数
 			pageTo: pageTo
 		}
 	},
-	// computed: {
-	// 	...mapGetters({ userInfo: 'getUser' })
-	// },
 	// 页面生命周期才触发
 	onLoad: function (option) {
 		this.option = option || null
 		if (option.token) {
 			uni.setStorageSync('token', option.token)
 		}
-		let oldAccount = uni.getStorageSync('account')
 
 		//扫商城二维码
 		if(option.scene){
@@ -37,8 +26,6 @@ export default {
 			}
 			if(theRequest.s){
 				option.account = theRequest.s
-				//员工id
-				//shopAdminId = theRequest.a
 			}
 		}
 
@@ -69,49 +56,7 @@ export default {
 				}
 			})
 		}
-		// 登录
-		if (isLogin()) {
-			if (this.init) {
-				let self = this
-				//查看不同门店商城时,需要先确认有没生成客户id shish 2021.5.2
-				if (option.account && oldAccount != option.account) {
-
-					console.log('已经登陆,有切换门店',option.account,oldAccount)
-
-					getShopUser(true).then(res => {
-						if (!this.$util.isEmpty(res)) {
-							self.init()
-						}
-					})
-				} else {
-					console.log('已经登陆,并且没有切换门店')
-					this.init()
-				}
-			}
-		} else {
-			wxLoginFn().then(res => {
-				if (this.init) {
-					let self = this
-					//查看不同门店商城时,需要先确认有没生成客户id shish 2021.5.2
-					if (option.account && oldAccount != option.account) {
-
-						console.log('登陆后有切换门店',option.account,oldAccount)
-
-						getShopUser(true).then(res => {
-							if (!this.$util.isEmpty(res)) {
-								self.init()
-							}
-						})
-					} else {
-						console.log('登陆后没有切换门店')
-						this.init()
-					}
-				}
-			})
-		}
-
-	},
-	mounted() {
-		if (this.mInit) { }
+		this.init()
+		wxLoginFn()
 	}
-}
+}

+ 1 - 1
mallApp/src/pages.json

@@ -2,7 +2,7 @@
     "pages": [{
             "path": "pages/home/recent",
             "style": {
-                "navigationBarTitleText": "最近访问"
+                "navigationBarTitleText": "最新花店"
             }
         },
         {

+ 17 - 47
mallApp/src/pages/home/index.vue

@@ -1,30 +1,15 @@
 <template>
-  <div class="app-main app-content">
-    <app-swiper
-      v-if="!$util.isEmpty(ad)"
-      :list="ad"
-      @detail="adDetailFn"
-    />
-    <!-- <div @click="pageTo({url: '/pages/home/recent'})">返回首页</div> -->
-    <block v-if="!$util.isEmpty(category)">
-      <div
-        class="goods-module"
-        v-for="(item, index) in category"
-        :key="index"
-      >
-        <goods-list-big
-          v-if="item.showRow == 1"
-          :info="item"
-        />
-        <goods-list-small
-          v-if="item.showRow == 2"
-          :info="item"
-        />
-      </div>
-    </block>
+  <view class="app-main app-content">
+    <app-swiper v-if="!$util.isEmpty(ad)" :list="ad" />
+    <template v-if="!$util.isEmpty(category)">
+      <view class="goods-module" v-for="(item, index) in category" :key="index" >
+        <goods-list-big v-if="item.showRow == 1" :info="item" />
+        <goods-list-small v-if="item.showRow == 2" :info="item" />
+      </view>
+    </template>
     <app-trademark />
     <tab-bar :current="0"></tab-bar>
-  </div>
+  </view>
 </template>
 <script>
 import { mapGetters } from "vuex";
@@ -61,20 +46,15 @@ export default {
   computed: {
     ...mapGetters({ orderShop: "getOrderShop" })
   },
-  onLoad (option) {},
-  mounted () { },
   onShow () {
     uni.hideTabBar();
   },
   methods: {
     init () {
-      getOrderShop().then(res => {
-      })
-      this._detail().then(res => {
+      getOrderShop()
+      this.getDetail().then(res => {
         let account = uni.getStorageSync('account')
-        console.log(this.pageTitle)
         getShopUser().then(res => {
-          // 设置分享
           let shareParams = {
             title: this.pageTitle, // 分享标题
             desc: "", // 分享内容
@@ -84,38 +64,28 @@ export default {
             // #endif
           }
           this.jweixinFn(shareParams)
-          console.log('分享地址',`/pages/home/index?fromUserId=${res.id}&account=${account}`)
         })
       })
     },
-    _detail () {
+    getDetail() {
       return getMainIndex().then(res => {
         this.data = res.data;
-        if (this.$util.isEmpty(res.data)) return false;
+        if (this.$util.isEmpty(res.data)){
+          return false;
+        }
         this.ad = res.data.ad.map(e => {
           e.img = e.adImg;
           return e;
         });
         this.pageTitle = res.data.sj.name
-        uni.setNavigationBarTitle({
-          title: this.pageTitle
-        })
+        uni.setNavigationBarTitle({ title: this.pageTitle })
         this.category = res.data.category;
         this.columnStyle = res.data.columnStyle;
       });
-    },
-    adDetailFn (item) {
-      // #ifdef H5
-      location.href = item.url;
-      // #endif
-    },
-    tabClick (index) {
-      this.currentTabIndex = index
     }
   }
 };
 </script>
-
 <style lang="scss" scoped>
 .goods-module {
   padding: 0 20px;
@@ -126,4 +96,4 @@ export default {
     box-shadow: 8px 8px 20px #eee;
   }
 }
-</style>
+</style>

+ 38 - 92
mallApp/src/pages/home/recent.vue

@@ -3,117 +3,68 @@
     <!-- 为了方便审核  showGlInfo == 0 showGlInfo应该等于0  -->
     <view class="shop-list_box" v-if="showGlInfo == 0">
       <template v-if="!$util.isEmpty(list)">
-        <view
-          :key="item.id"
-          @click="pageTo({
-              url: '/pages/home/index?account',
-              type:4,
-              query: {
-                account: item.id
-              }
-            })"
-          v-for="item in list"
-        >
-          <!-- <app-avatar-module :src="item.shopImg" /> -->
-          <image :src="item.avatar"></image>
-          <view class="tit">
-            {{item.showName}}
-          </view>
+        <view :key="item.id" @click="pageTo({ url:'/pages/home/index?account', type:4, query: { account: item.id } })" v-for="item in list" >
+          <image :src="item.cover"></image>
+          <view class="tit"> {{item.showName}} </view>
         </view>
       </template>
-      <div v-else>
-        暂无数据
-      </div>
+      <view v-else> 暂无数据 </view>
+    </view>
+    <view class="app-main app-content" v-else>
+    <app-swiper :list="ad" />
+    <view class="shop-wrap">
+      <view class="shop-tit">花卉宝</view>
+      <view>厦门市中花汇信息有限公司,成立于2015年,目前旗下有销花宝、花卉宝和花掌柜三个品牌,公司致力于帮助花店更轻松高效管理花店。</view>
     </view>
-    <div class="app-main app-content" v-else>
-    <app-swiper
-      :list="ad"
-    />
-    <div class="shop-wrap">
-      <div class="shop-tit">花卉宝</div>
-      <div>厦门市中花汇信息有限公司,成立于2015年,目前旗下有销花宝、花卉宝和花掌柜三个品牌,公司致力于帮助花店更轻松高效管理花店。</div>
-    </div>
-    <div class="list-content">
+    <view class="list-content">
       <tui-list-view class="tui-list-view">
-        <tui-list-cell
-          :lineLeft="false"
-          :lineRight="false"
-          padding="26rpx 30rpx 26rpx 0"
-          class="tui-list"
-        >
-          <div class="list-wrap">
-            <div class="list-label">营业时间</div>
-            <div class="list-val">{{ shop.openTime || '08:00-22:00' }}</div>
-          </div>
+        <tui-list-cell :lineLeft="false" :lineRight="false" padding="26rpx 30rpx 26rpx 0" class="tui-list" >
+          <view class="list-wrap">
+            <view class="list-label">营业时间</view>
+            <view class="list-val">{{ shop.openTime || '08:00-22:00' }}</view>
+          </view>
         </tui-list-cell>
-        <tui-list-cell
-          @click="phoneCall"
-          :lineLeft="false"
-          :lineRight="false"
-          padding="26rpx 30rpx 26rpx 0"
-          class="tui-list"
-        >
-          <div class="list-wrap">
-            <div class="list-label">联系电话</div>
-            <div class="list-val">{{ shop.telephone || '15280215347' }}</div>
-          </div>
-          <div class="list-icon">
-            <i
-              class="iconfont iconditu"
-              style="font-size:36rpx;"
-            ></i>
-          </div>
+        <tui-list-cell @click="phoneCall" :lineLeft="false" :lineRight="false" padding="26rpx 30rpx 26rpx 0" class="tui-list" >
+          <view class="list-wrap">
+            <view class="list-label">联系电话</view>
+            <view class="list-val">{{ shop.telephone || '15280215347' }}</view>
+          </view>
+          <view class="list-icon">
+            <i class="iconfont iconditu" style="font-size:36rpx;" ></i>
+          </view>
         </tui-list-cell>
-        <tui-list-cell
-          @click="goNavBtn"
-          :lineLeft="false"
-          :lineRight="false"
-          padding="26rpx 30rpx 26rpx 0"
-          class="tui-list"
-        >
-          <div class="list-wrap">
-            <div class="list-label">公司地址</div>
-            <div class="list-val">厦门市软件园二期夜光汇2号楼521室</div>
-          </div>
-          <div class="list-icon">
-            <i
-              class="iconfont icondianhua"
-              style="font-size:36rpx;"
-            ></i>
-          </div>
+        <tui-list-cell @click="goNavBtn" :lineLeft="false" :lineRight="false" padding="26rpx 30rpx 26rpx 0" class="tui-list" >
+          <view class="list-wrap">
+            <view class="list-label">公司地址</view>
+            <view class="list-val">厦门市软件园二期夜光汇2号楼521室</view>
+          </view>
+          <view class="list-icon">
+            <i class="iconfont icondianhua" style="font-size:36rpx;" ></i>
+          </view>
         </tui-list-cell>
       </tui-list-view>
-    </div>
-  </div>
+    </view>
+  </view>
   </view>
 </template>
-
 <script>
 import AppSwiper from "@/components/app-swiper";
 import TuiListCell from "@/components/plugin/list-cell";
 import TuiListView from "@/components/plugin/list-view";
 import AppActivilyCoupon from "@/components/module/app-activily-coupon";
-import { recentShop } from "@/api/user";
+import { getNewShop } from "@/api/shop";
 import { share } from "@/mixins";
 import AppAvatarModule from "@/components/module/app-avatar";
 import { mapGetters } from 'vuex'
 export default {
   name: "recent",
-  components: { 
-    AppAvatarModule, 
-    AppSwiper,
-    TuiListView,
-    TuiListCell,
-    AppActivilyCoupon },
+  components: { AppAvatarModule, AppSwiper, TuiListView, TuiListCell, AppActivilyCoupon },
   mixins: [share],
   data () {
     return {
       list: [],
       showGlInfo: 0,
-      ad: [
-        {
-          "img":`${this.$constant.imgUrl}/logo2.jpg?v=5`          
-        }]
+      ad:[{"img":`${this.$constant.imgUrl}/logo2.jpg?v=5`}]
     };
   },
   computed: {
@@ -124,7 +75,7 @@ export default {
   methods: {
     async init () {
       try {
-        const { data } = await recentShop({})
+        const { data } = await getNewShop()
         this.list = data.list
         this.showGlInfo = data.showGlInfo
       } catch (e) {
@@ -133,7 +84,6 @@ export default {
   }
 };
 </script>
-
 <style lang="scss" scoped>
 .shop-title_box {
   color: #333333;
@@ -143,10 +93,6 @@ export default {
 }
 .shop-list_box {
   padding: 0 20upx;
-  // display: flex;
-  // align-items: center;
-  // justify-content: space-between;
-  // flex-wrap: wrap;
   & > view {
     width: 150upx;
     margin: 0 10upx;

+ 5 - 19
mallApp/src/utils/auth.js

@@ -2,32 +2,15 @@ import store from '@/store'
 // import { share } from '@/mixins'
 import CONSTANT from '@/constant'
 import UTIL from '@/utils/util'
-
-import {
-	getStaffApi,
-	getUserApi,
-	getCustomApi
-} from '@/api/common'
+import { getStaffApi, getUserApi } from '@/api/common'
 import { postWxCode } from '@/api/mini'
-
 import util from './util'
 /**
  * 获取商城端用户信息
  * @parmas update为true时会重新触发请求,重置vuex的数据
  */
 export async function getShopUser(update) {
-	let userInfo = store.getters.getShopUser
-	if (!UTIL.isEmpty(userInfo) && !update) {
-		return userInfo
-	}
-	await getCustomApi().then((res) => {
-		userInfo = res.data
-		store.dispatch('setShopUser', userInfo)
-	}).catch(() => {
-		uni.removeStorageSync('token')
-	})
-
-	return userInfo
+	
 }
 
 /**
@@ -99,6 +82,9 @@ export async function wxLoginFn(update) {
         //启动更新逻辑 shish 2020.5.18
 		if (subRes.data.update == 1) {
 
+			//更新用户数据
+			//store.dispatch('setShopUser', userInfo)
+
 			const updateManager = uni.getUpdateManager();
 			updateManager.onCheckForUpdate(function(res) {
 				// 请求完新版本信息的回调